diff --git a/DEPS b/DEPS index 14b7fc9..909971b 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # 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': 'd03ca18d8616aa49880963c6e20794f152551838', + 'v8_revision': '75aa1b4ec1bfa7663f3af99b0e17a813b66283c2', # 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. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '6fb71b53350cb314ad3e19cf1bb94301e7cf6753', + 'catapult_revision': 'ae648e44341b1565cec2f59ab4a7c337792868ff', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -232,7 +232,7 @@ Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067', 'src/third_party/webrtc': - Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '7427e1cbcfee8f7a19febb15e3e534362351fa9b', # commit position 18226 + Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '01915025bc1873e556d09b5083b5d7ccc31da068', # commit position 18252 'src/third_party/openmax_dl': Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'),
diff --git a/base/logging.h b/base/logging.h index 3797bbd..96ef7c3 100644 --- a/base/logging.h +++ b/base/logging.h
@@ -252,12 +252,10 @@ // Gets the VLOG default verbosity level. BASE_EXPORT int GetVlogVerbosity(); -// Gets the current vlog level for the given file (usually taken from -// __FILE__). - // Note that |N| is the size *with* the null terminator. BASE_EXPORT int GetVlogLevelHelper(const char* file_start, size_t N); +// Gets the current vlog level for the given file (usually taken from __FILE__). template <size_t N> int GetVlogLevel(const char (&file)[N]) { return GetVlogLevelHelper(file, N);
diff --git a/base/trace_event/sharded_allocation_register.cc b/base/trace_event/sharded_allocation_register.cc index 1b3eece..f1e2d3c 100644 --- a/base/trace_event/sharded_allocation_register.cc +++ b/base/trace_event/sharded_allocation_register.cc
@@ -14,6 +14,10 @@ // "base/trace_event/heap_profiler_allocation_register.h". #if defined(OS_ANDROID) || defined(OS_IOS) const size_t ShardCount = 1; +#elif defined(OS_WIN) +// Using ShardCount = 64 adds about 1.6GB of committed memory, which triggers +// the sandbox's committed memory limit. +const size_t ShardCount = 16; #else const size_t ShardCount = 64; #endif
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py index bbeb315a..071e73c 100644 --- a/build/android/pylib/instrumentation/instrumentation_test_instance.py +++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -671,6 +671,7 @@ self._render_results_dir = args.render_results_dir self._screenshot_dir = args.screenshot_dir self._timeout_scale = args.timeout_scale or 1 + self._ui_screenshot_dir = args.ui_screenshot_dir def _initializeTestCoverageAttributes(self, args): self._coverage_directory = args.coverage_dir @@ -808,6 +809,10 @@ def total_external_shards(self): return self._total_external_shards + @property + def ui_screenshot_dir(self): + return self._ui_screenshot_dir + #override def TestType(self): return 'instrumentation'
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py index 5e09d41..8f2b2e7 100644 --- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py +++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -57,6 +57,11 @@ EXTRA_SCREENSHOT_FILE = ( 'org.chromium.base.test.ScreenshotOnFailureStatement.ScreenshotFile') +EXTRA_UI_CAPTURE_DIR = ( + 'org.chromium.base.test.util.Screenshooter.ScreenshotDir') + +UI_CAPTURE_DIRS = ['chromium_tests_root', 'UiCapture'] + FEATURE_ANNOTATION = 'Feature' RENDER_TEST_FEATURE_ANNOTATION = 'RenderTest' @@ -106,6 +111,7 @@ def __init__(self, env, test_instance): super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) self._flag_changers = {} + self._ui_capture_dir = dict() #override def TestPackage(self): @@ -230,8 +236,20 @@ valgrind_tools.SetChromeTimeoutScale( dev, self._test_instance.timeout_scale) + @trace_event.traced + def setup_ui_capture_dir(): + # Make sure the UI capture directory exists and is empty by deleting + # and recreating it. + # TODO (aberent) once DeviceTempDir exists use it here. + self._ui_capture_dir[dev] = posixpath.join(dev.GetExternalStoragePath(), + *UI_CAPTURE_DIRS) + + if dev.PathExists(self._ui_capture_dir[dev]): + dev.RunShellCommand(['rm', '-rf', self._ui_capture_dir[dev]]) + dev.RunShellCommand(['mkdir', self._ui_capture_dir[dev]]) + steps += [set_debug_app, edit_shared_prefs, push_test_data, - create_flag_changer] + create_flag_changer, setup_ui_capture_dir] if self._env.concurrent_adb: reraiser_thread.RunAsync(steps) else: @@ -258,6 +276,20 @@ valgrind_tools.SetChromeTimeoutScale(dev, None) + if self._test_instance.ui_screenshot_dir: + pull_ui_screen_captures(dev) + + @trace_event.traced + def pull_ui_screen_captures(dev): + file_names = dev.ListDirectory(self._ui_capture_dir[dev]) + target_path = self._test_instance.ui_screenshot_dir + if not os.path.exists(target_path): + os.makedirs(target_path) + + for file_name in file_names: + dev.PullFile(posixpath.join(self._ui_capture_dir[dev], file_name), + target_path) + self._env.parallel_devices.pMap(individual_device_tear_down) def _CreateFlagChangerIfNeeded(self, device): @@ -306,6 +338,8 @@ device.adb, suffix='.png', dir=device.GetExternalStoragePath()) extras[EXTRA_SCREENSHOT_FILE] = screenshot_device_file.name + extras[EXTRA_UI_CAPTURE_DIR] = self._ui_capture_dir[device] + if isinstance(test, list): if not self._test_instance.driver_apk: raise Exception('driver_apk does not exist. '
diff --git a/build/android/test_runner.py b/build/android/test_runner.py index db27e49..81b4f7e 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py
@@ -430,6 +430,10 @@ '--timeout-scale', type=float, help='Factor by which timeouts should be scaled.') + parser.add_argument( + '--ui-screenshot-directory', + dest='ui_screenshot_dir', type=os.path.realpath, + help='Destination for screenshots captured by the tests') # These arguments are suppressed from the help text because they should # only ever be specified by an intermediate script.
diff --git a/build/check_gn_headers.py b/build/check_gn_headers.py index 732f6038..0850196e 100755 --- a/build/check_gn_headers.py +++ b/build/check_gn_headers.py
@@ -163,14 +163,13 @@ if args.whitelist: whitelist = ParseWhiteList(open(args.whitelist).read()) missing -= whitelist - nonexisting -= whitelist missing = sorted(missing) nonexisting = sorted(nonexisting) if args.json: with open(args.json, 'w') as f: - json.dump(sorted(missing + nonexisting), f) + json.dump(missing, f) if len(missing) == 0 and len(nonexisting) == 0: return 0
diff --git a/build/check_gn_headers_whitelist.txt b/build/check_gn_headers_whitelist.txt deleted file mode 100644 index d45e1fd5..0000000 --- a/build/check_gn_headers_whitelist.txt +++ /dev/null
@@ -1,386 +0,0 @@ -ash/accelerators/accelerator_controller_delegate.h -ash/accelerators/accelerator_controller_delegate_aura.h -ash/accelerators/accelerator_table.h -ash/ash_export.h -ash/ash_switches.h -ash/frame/header_painter.h -ash/metrics/task_switch_metrics_recorder.h -ash/metrics/task_switch_source.h -ash/metrics/user_metrics_action.h -ash/metrics/user_metrics_recorder.h -ash/public/cpp/ash_public_export.h -ash/public/cpp/config.h -ash/public/cpp/shelf_types.h -ash/session/session_observer.h -ash/shell.h -ash/system/devicetype_utils.h -ash/wm/system_modal_container_event_filter_delegate.h -cc/base/ring_buffer.h -cc/blink/web_blend_mode.h -cc/cc_export.h -cc/input/browser_controls_state.h -cc/input/event_listener_properties.h -cc/input/scrollbar.h -cc/input/scroller_size_metrics.h -cc/layers/performance_properties.h -cc/layers/scrollbar_theme_painter.h -cc/output/bsp_compare_result.h -cc/resources/release_callback_impl.h -cc/resources/return_callback.h -cc/surfaces/surface_observer.h -chrome/browser/android/android_theme_resources.h -chrome/browser/android/resource_id.h -chrome/browser/chromeos/certificate_provider/certificate_info.h -chrome/browser/chromeos/certificate_provider/certificate_provider.h -chrome/browser/chromeos/certificate_provider/certificate_provider_service.h -chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h -chrome/browser/chromeos/certificate_provider/certificate_requests.h -chrome/browser/chromeos/certificate_provider/pin_dialog_manager.h -chrome/browser/chromeos/certificate_provider/sign_requests.h -chrome/browser/chromeos/certificate_provider/thread_safe_certificate_map.h -chrome/browser/chromeos/login/signin/oauth2_login_manager.h -chrome/browser/chromeos/login/signin/oauth2_login_verifier.h -chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h -chrome/browser/chromeos/profiles/profile_helper.h -chrome/browser/chromeos/settings/cros_settings.h -chrome/browser/chromeos/ui/request_pin_view.h -chrome/browser/component_updater/component_installer_errors.h -chrome/browser/download/download_file_icon_extractor.h -chrome/browser/extensions/api/networking_cast_private/chrome_networking_cast_private_delegate.h -chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h -chrome/browser/extensions/api/socket/mock_tcp_client_socket.h -chrome/browser/mac/bluetooth_utility.h -chrome/browser/media/router/mojo/media_route_provider_util_win.h -chrome/browser/media/webrtc/desktop_media_list_ash.h -chrome/browser/media/webrtc/desktop_media_list_observer.h -chrome/browser/media/webrtc/rtp_dump_type.h -chrome/browser/media_galleries/fileapi/file_path_watcher_util.h -chrome/browser/media_galleries/fileapi/iapps_data_provider.h -chrome/browser/media_galleries/fileapi/itunes_data_provider.h -chrome/browser/media_galleries/fileapi/picasa_data_provider.h -chrome/browser/media_galleries/fileapi/safe_iapps_library_parser.h -chrome/browser/media_galleries/media_file_system_context.h -chrome/browser/notifications/displayed_notifications_dispatch_callback.h -chrome/browser/permissions/permission_queue_controller.h -chrome/browser/prefs/active_profile_pref_service.h -chrome/browser/rlz/chrome_rlz_tracker_delegate.h -chrome/browser/signin/easy_unlock_service_observer.h -chrome/browser/ui/android/content_settings/subresource_filter_infobar_delegate.h -chrome/browser/ui/app_icon_loader_delegate.h -chrome/browser/ui/app_list/app_list_syncable_service_factory.h -chrome/browser/ui/ash/ash_util.h -chrome/browser/ui/ash/multi_user/multi_user_util.h -chrome/browser/ui/network_profile_bubble.h -chrome/browser/ui/passwords/manage_passwords_icon.h -chrome/browser/ui/views/frame/browser_header_painter_ash.h -chrome/browser/ui/webui/large_icon_source.h -chrome/common/mac/app_shim_launch.h -chrome/common/mac/app_shim_messages.h -chrome/common/media_galleries/itunes_library.h -chrome/common/media_galleries/picasa_types.h -chrome/install_static/chromium_install_modes.h -chrome/install_static/install_constants.h -chrome/install_static/install_details.h -chrome/install_static/install_modes.h -chrome/install_static/test/scoped_install_details.h -chrome/installer/util/browser_distribution.h -chrome/installer/util/google_update_constants.h -chrome/installer/util/google_update_settings.h -chrome/installer/util/util_constants.h -chromeos/chromeos_export.h -chromeos/login/login_state.h -chromeos/login/scoped_test_public_session_login_state.h -chromeos/settings/cros_settings_names.h -chromeos/settings/cros_settings_provider.h -components/browser_watcher/features.h -components/browser_watcher/stability_paths.h -components/cast_certificate/cast_crl_root_ca_cert_der-inc.h -components/cdm/browser/cdm_message_filter_android.h -components/contextual_search/browser/contextual_search_js_api_handler.h -components/cryptauth/connection_finder.h -components/cryptauth/connection_observer.h -components/data_reduction_proxy/core/browser/data_use_group.h -components/data_reduction_proxy/core/browser/data_use_group_provider.h -components/data_use_measurement/core/url_request_classifier.h -components/device_event_log/device_event_log_export.h -components/dom_distiller/core/font_family_list.h -components/dom_distiller/core/theme_list.h -components/login/login_export.h -components/nacl/browser/nacl_browser_delegate.h -components/nacl/renderer/ppb_nacl_private.h -components/omnibox/browser/autocomplete_i18n.h -components/omnibox/browser/autocomplete_provider_client.h -components/omnibox/browser/autocomplete_provider_listener.h -components/password_manager/core/browser/keychain_migration_status_mac.h -components/policy/core/browser/configuration_policy_handler_parameters.h -components/policy/proto/policy_proto_export.h -components/rlz/rlz_tracker_delegate.h -components/session_manager/session_manager_types.h -components/sessions/core/sessions_export.h -components/sync/engine/connection_status.h -components/sync/engine/net/network_time_update_callback.h -components/translate/core/browser/translate_infobar_delegate.h -components/user_manager/user.h -components/user_manager/user_image/user_image.h -components/user_manager/user_manager.h -components/viz/viz_export.h -components/wallpaper/wallpaper_export.h -components/wifi/wifi_export.h -components/wifi/wifi_service.h -content/browser/background_fetch/background_fetch_constants.h -content/common/gpu_stream_constants.h -content/common/mac/attributed_string_coder.h -content/common/mac/font_descriptor.h -content/public/browser/context_factory.h -content/public/browser/media_observer.h -content/renderer/external_popup_menu.h -content/shell/android/shell_descriptors.h -device/media_transfer_protocol/media_transfer_protocol_manager.h -extensions/browser/api/clipboard/clipboard_api.h -extensions/browser/api/networking_config/networking_config_service_factory.h -extensions/browser/api/webcam_private/webcam.h -extensions/browser/api/webcam_private/webcam_private_api.h -extensions/browser/entry_info.h -extensions/browser/extension_event_histogram_value.h -extensions/browser/extension_function_histogram_value.h -google_apis/gcm/base/encryptor.h -google_apis/gcm/base/gcm_export.h -gpu/GLES2/gl2chromium.h -gpu/GLES2/gl2chromium_autogen.h -gpu/GLES2/gl2extchromium.h -gpu/command_buffer/client/context_support.h -gpu/command_buffer/client/gles2_implementation_unittest_autogen.h -gpu/command_buffer/client/gles2_interface_autogen.h -gpu/command_buffer/client/gles2_interface_stub_autogen.h -gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h -gpu/command_buffer/client/gpu_control_client.h -gpu/command_buffer/client/ref_counted.h -gpu/command_buffer/client/shared_memory_limits.h -gpu/command_buffer/common/command_buffer_shared.h -gpu/command_buffer/common/gles2_cmd_utils_autogen.h -gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h -gpu/command_buffer/common/gpu_memory_allocation.h -gpu/command_buffer/service/gl_stream_texture_image.h -gpu/command_buffer/service/gles2_cmd_decoder_unittest_extensions_autogen.h -gpu/command_buffer/service/memory_tracking.h -gpu/command_buffer/service/progress_reporter.h -gpu/gles2_conform_support/gtf/gtf_stubs.h -gpu/gpu_export.h -headless/lib/headless_macros.h -headless/public/headless_tab_socket.h -ipc/ipc_channel_proxy_unittest_messages.h -ipc/ipc_message_null_macros.h -ipc/param_traits_size_macros.h -media/audio/audio_logging.h -media/audio/sounds/test_data.h -media/base/routing_token_callback.h -media/base/video_renderer_sink.h -media/cast/common/mod_util.h -media/cast/net/rtcp/rtcp_session.h -media/filters/ffmpeg_aac_bitstream_converter.h -media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h -media/filters/h264_to_annex_b_bitstream_converter.h -media/formats/mp4/avc.h -media/formats/mp4/bitstream_converter.h -media/formats/mp4/fourccs.h -media/formats/mp4/rcheck.h -media/formats/mpeg/adts_stream_parser.h -media/formats/mpeg/mpeg1_audio_stream_parser.h -media/formats/mpeg/mpeg_audio_stream_parser_base.h -media/gpu/media_gpu_export.h -mojo/common/mojo_common_export.h -mojo/edk/system/broker_messages.h -mojo/edk/system/system_impl_export.h -mojo/public/cpp/bindings/strong_associated_binding_set.h -mojo/public/cpp/bindings/tests/mojo_test_blink_export.h -mojo/public/cpp/test_support/test_support.h -net/base/winsock_init.h -net/cert/cert_type.h -net/cert/cert_verify_proc_android.h -net/cert/scoped_nss_types.h -net/dns/notify_watcher_mac.h -net/http/http_status_code_list.h -ppapi/cpp/pass_ref.h -ppapi/lib/gl/include/GLES2/gl2.h -ppapi/lib/gl/include/GLES2/gl2ext.h -ppapi/lib/gl/include/GLES2/gl2platform.h -ppapi/lib/gl/include/KHR/khrplatform.h -ppapi/nacl_irt/irt_manifest.h -ppapi/nacl_irt/public/irt_ppapi.h -ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h -ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h -ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.h -ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h -ppapi/proxy/content_decryptor_private_serializer.h -ppapi/proxy/dispatch_reply_message.h -ppapi/proxy/plugin_proxy_delegate.h -ppapi/proxy/plugin_resource_callback.h -ppapi/proxy/ppapi_proxy_export.h -ppapi/proxy/resource_message_filter.h -ppapi/proxy/video_decoder_constants.h -ppapi/shared_impl/api_id.h -ppapi/shared_impl/dir_contents.h -ppapi/shared_impl/ppapi_shared_export.h -ppapi/shared_impl/singleton_resource_id.h -remoting/base/chromoting_event_log_writer.h -remoting/base/logging.h -remoting/client/display/gl_renderer_delegate.h -remoting/client/display/gl_texture_ids.h -remoting/codec/webrtc_video_encoder.h -remoting/host/linux/x11_keyboard.h -remoting/host/worker_process_ipc_delegate.h -remoting/protocol/audio_source.h -remoting/protocol/audio_stream.h -remoting/protocol/cursor_shape_stub.h -remoting/protocol/message_channel_factory.h -remoting/protocol/test_event_matchers.h -remoting/protocol/video_feedback_stub.h -remoting/protocol/video_stream.h -sandbox/linux/system_headers/capability.h -sdch/linux/config.h -services/service_manager/public/c/main.h -services/ui/ws/ids.h -skia/ext/convolver_mips_dspr2.h -skia/ext/skia_commit_hash.h -skia/ext/texture_handle.h -testing/gmock_mutant.h -third_party/WebKit/Source/bindings/modules/v8/serialization/WebCryptoSubTags.h -third_party/WebKit/Source/core/css/CSSPropertyMetadata.h -third_party/WebKit/Source/core/css/resolver/StyleBuilder.h -third_party/WebKit/Source/core/css/zoomAdjustedPixelValue.h -third_party/WebKit/Source/core/dom/ArrayBufferViewHelpers.h -third_party/WebKit/Source/core/editing/FindOptions.h -third_party/WebKit/Source/core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h -third_party/WebKit/Source/core/style/ShapeValue.h -third_party/WebKit/Source/core/style/TransformOrigin.h -third_party/WebKit/Source/platform/ColorSuggestion.h -third_party/WebKit/Source/platform/EncryptedMediaRequest.h -third_party/WebKit/Source/platform/fonts/FontSelector.h -third_party/WebKit/Source/platform/fonts/Glyph.h -third_party/WebKit/Source/platform/graphics/cpu/arm/WebGLImageConversionNEON.h -third_party/WebKit/Source/platform/graphics/cpu/mips/WebGLImageConversionMSA.h -third_party/WebKit/Source/platform/graphics/paint/PaintImage.h -third_party/WebKit/Source/platform/scheduler/base/task_queue.h -third_party/WebKit/Source/platform/scroll/ScrollerSizeMetrics.h -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/WebFeaturePolicyFeature.h -third_party/WebKit/public/platform/WebSourceLocation.h -third_party/WebKit/public/platform/WebTouchInfo.h -third_party/WebKit/public/platform/modules/media_capabilities/WebMediaCapabilitiesInfo.h -third_party/cacheinvalidation/src/google/cacheinvalidation/impl/build_constants.h -third_party/expat/files/lib/ascii.h -third_party/expat/files/lib/asciitab.h -third_party/expat/files/lib/expat_config.h -third_party/expat/files/lib/expat_external.h -third_party/expat/files/lib/iasciitab.h -third_party/expat/files/lib/internal.h -third_party/expat/files/lib/latin1tab.h -third_party/expat/files/lib/nametab.h -third_party/expat/files/lib/utf8tab.h -third_party/expat/files/lib/xmlrole.h -third_party/expat/files/lib/xmltok.h -third_party/expat/files/lib/xmltok_impl.h -third_party/harfbuzz-ng/src/hb-ot-cbdt-table.hh -third_party/harfbuzz-ng/src/hb-ot-cmap-table.hh -third_party/harfbuzz-ng/src/hb-ot-glyf-table.hh -third_party/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh -third_party/harfbuzz-ng/src/hb-ot-os2-table.hh -third_party/hunspell/src/hunspell/hunvisapi.h -third_party/khronos/EGL/egl.h -third_party/khronos/EGL/eglext.h -third_party/khronos/EGL/eglplatform.h -third_party/khronos/GLES2/gl2.h -third_party/khronos/GLES2/gl2ext.h -third_party/khronos/GLES2/gl2platform.h -third_party/khronos/GLES3/gl3.h -third_party/khronos/GLES3/gl3platform.h -third_party/khronos/KHR/khrplatform.h -third_party/leveldatabase/chromium_logger.h -third_party/libaddressinput/chromium/addressinput_util.h -third_party/libaddressinput/chromium/override/basictypes_override.h -third_party/libphonenumber/phonenumber_api.h -third_party/libudev/libudev0.h -third_party/libudev/libudev1.h -third_party/libvpx/source/config/linux/x64/vp8_rtcd.h -third_party/libvpx/source/config/linux/x64/vp9_rtcd.h -third_party/libvpx/source/config/linux/x64/vpx_config.h -third_party/libvpx/source/config/linux/x64/vpx_dsp_rtcd.h -third_party/libvpx/source/config/linux/x64/vpx_scale_rtcd.h -third_party/libvpx/source/config/nacl/vp8_rtcd.h -third_party/libvpx/source/config/nacl/vp9_rtcd.h -third_party/libvpx/source/config/nacl/vpx_config.h -third_party/libvpx/source/config/nacl/vpx_dsp_rtcd.h -third_party/libvpx/source/config/nacl/vpx_scale_rtcd.h -third_party/libvpx/source/config/vpx_version.h -third_party/libwebp/mux/animi.h -third_party/libwebp/mux/muxi.h -third_party/libwebp/webp/mux.h -third_party/libxslt/src/libxslt/xsltwin32config.h -third_party/opus/src/src/opus_private.h -third_party/opus/src/tests/test_opus_common.h -third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h -third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_params.h -third_party/qcms/src/halffloat.h -third_party/qcms/src/tests/qcms_test_util.h -third_party/qcms/src/tests/timing.h -third_party/snappy/linux/config.h -third_party/speech-dispatcher/libspeechd.h -third_party/sqlite/sqlite3.h -third_party/tcmalloc/chromium/src/addressmap-inl.h -third_party/tcmalloc/chromium/src/base/basictypes.h -third_party/tcmalloc/chromium/src/base/dynamic_annotations.h -third_party/tcmalloc/chromium/src/base/googleinit.h -third_party/tcmalloc/chromium/src/base/linux_syscall_support.h -third_party/tcmalloc/chromium/src/base/spinlock_linux-inl.h -third_party/tcmalloc/chromium/src/base/stl_allocator.h -third_party/tcmalloc/chromium/src/base/thread_annotations.h -third_party/tcmalloc/chromium/src/base/thread_lister.h -third_party/tcmalloc/chromium/src/gperftools/malloc_extension_c.h -third_party/tcmalloc/chromium/src/gperftools/malloc_hook_c.h -third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h -third_party/tcmalloc/chromium/src/heap-profile-stats.h -third_party/tcmalloc/chromium/src/libc_override.h -third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h -third_party/tcmalloc/chromium/src/packed-cache-inl.h -third_party/tcmalloc/chromium/src/page_heap_allocator.h -third_party/tcmalloc/chromium/src/pagemap.h -third_party/tcmalloc/chromium/src/stacktrace_config.h -third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h -third_party/tcmalloc/chromium/src/system-alloc.h -third_party/tcmalloc/chromium/src/tcmalloc_guard.h -third_party/wayland/include/config.h -third_party/wayland/include/src/wayland-version.h -third_party/woff2/src/port.h -third_party/yasm/source/config/linux/config.h -third_party/yasm/source/config/linux/libyasm-stdint.h -third_party/zlib/contrib/minizip/crypt.h -tools/battor_agent/battor_protocol_types.h -tools/gn/ordered_set.h -tools/ipc_fuzzer/message_lib/all_message_null_macros.h -ui/accessibility/ax_export.h -ui/app_list/app_list_export.h -ui/app_list/app_list_item.h -ui/app_list/app_list_switches.h -ui/aura/aura_export.h -ui/base/clipboard/clipboard_test_template.h -ui/base/dragdrop/download_file_interface.h -ui/compositor/compositor_constants.h -ui/compositor/layer_owner_delegate.h -ui/events/keycodes/keyboard_codes_posix.h -ui/gfx/overlay_transform.h -ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h -ui/gfx/swap_result.h -ui/gfx/sys_color_change_listener.h -ui/gl/GL/glextchromium.h -ui/gl/gl_bindings_api_autogen_egl.h -ui/gl/gl_bindings_api_autogen_gl.h -ui/gl/gl_bindings_api_autogen_glx.h -ui/gl/gl_bindings_api_autogen_osmesa.h -ui/gl/gpu_preference.h -ui/gl/gpu_switching_observer.h -ui/native_theme/native_theme_export.h -ui/ozone/ozone_base_export.h -ui/ozone/public/ozone_switches.h -ui/shell_dialogs/shell_dialogs_export.h
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java index 8caf532..748b51e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java
@@ -8,6 +8,7 @@ import android.app.FragmentManager; import android.content.Context; import android.graphics.Bitmap; +import android.os.SystemClock; import android.support.v7.app.AlertDialog; import android.text.TextUtils; import android.text.method.LinkMovementMethod; @@ -21,6 +22,7 @@ import com.google.android.gms.common.ConnectionResult; import org.chromium.base.Callback; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; @@ -37,6 +39,7 @@ import org.chromium.ui.widget.ButtonCompat; import java.util.List; +import java.util.concurrent.TimeUnit; // TODO(gogerald): refactor common part into one place after redesign all sign in screens. @@ -440,15 +443,16 @@ // Ensure that the AccountTrackerService has a fully up to date GAIA id <-> email mapping, // as this is needed for the previous account check. + final long seedingStartTime = SystemClock.elapsedRealtime(); if (AccountTrackerService.get().checkAndSeedSystemAccounts()) { - showConfirmSigninPagePreviousAccountCheck(); + showConfirmSigninPagePreviousAccountCheck(seedingStartTime); } else { AccountTrackerService.get().addSystemAccountsSeededListener( new OnSystemAccountsSeededListener() { @Override public void onSystemAccountsSeedingComplete() { AccountTrackerService.get().removeSystemAccountsSeededListener(this); - showConfirmSigninPagePreviousAccountCheck(); + showConfirmSigninPagePreviousAccountCheck(seedingStartTime); } @Override @@ -457,7 +461,9 @@ } } - private void showConfirmSigninPagePreviousAccountCheck() { + private void showConfirmSigninPagePreviousAccountCheck(long seedingStartTime) { + RecordHistogram.recordTimesHistogram("Signin.AndroidAccountSigninViewSeedingTime", + SystemClock.elapsedRealtime() - seedingStartTime, TimeUnit.MILLISECONDS); String accountName = getSelectedAccountName(); ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncLastAccountName(), accountName, ImportSyncType.PREVIOUS_DATA_FOUND,
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc index 1c0ffcd..28acf23a 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
@@ -28,6 +28,7 @@ #include "extensions/common/permissions/permissions_data.h" #include "extensions/test/extension_test_message_listener.h" #include "extensions/test/result_catcher.h" +#include "ui/base/ui_features.h" #if defined(OS_WIN) #include "ui/views/win/hwnd_util.h" @@ -44,6 +45,12 @@ BrowserActionInteractiveTest() {} ~BrowserActionInteractiveTest() override {} + // BrowserTestBase: + void SetUpOnMainThread() override { + ExtensionApiTest::SetUpOnMainThread(); + EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); + } + protected: // Function to control whether to run popup tests for the current platform. // These tests require RunExtensionSubtest to work as expected and the browser @@ -53,17 +60,20 @@ // TODO(justinlin): http://crbug.com/177163 #if defined(OS_WIN) && !defined(NDEBUG) return false; -#elif defined(OS_MACOSX) - // TODO(justinlin): Browser window do not become active on Mac even when - // Activate() is called on them. Enable when/if it's possible to fix. - return false; #else return true; #endif } + void EnsurePopupActive() { + BrowserActionTestUtil test_util(browser()); + EXPECT_TRUE(test_util.HasPopup()); + EXPECT_TRUE(test_util.WaitForPopup()); + EXPECT_TRUE(test_util.HasPopup()); + } + // Open an extension popup via the chrome.browserAction.openPopup API. - void OpenExtensionPopupViaAPI() { + void OpenPopupViaAPI() { // Setup the notification observer to wait for the popup to finish loading. content::WindowedNotificationObserver frame_observer( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, @@ -72,7 +82,35 @@ ASSERT_TRUE(RunExtensionSubtest("browser_action/open_popup", "open_popup_succeeds.html")) << message_; frame_observer.Wait(); + EnsurePopupActive(); + } + + // Open an extension popup by clicking the browser action button. + void OpenPopupViaToolbar() { + content::WindowedNotificationObserver frame_observer( + content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, + content::NotificationService::AllSources()); + BrowserActionTestUtil(browser()).Press(0); + frame_observer.Wait(); + EnsurePopupActive(); + } + + // Click on the omnibox to close the extension popup. + void ClosePopupViaClick() { EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); + content::WindowedNotificationObserver observer( + extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, + content::NotificationService::AllSources()); + + ui_test_utils::ClickOnView(browser(), VIEW_ID_OMNIBOX); + + // The window disappears immediately. + EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); + + // Wait for the notification to achieve a consistent state and verify that + // the popup was properly torn down. + observer.Wait(); + base::RunLoop().RunUntilIdle(); } }; @@ -87,7 +125,7 @@ // Setup extension message listener to wait for javascript to finish running. ExtensionTestMessageListener listener("ready", true); { - OpenExtensionPopupViaAPI(); + OpenPopupViaAPI(); EXPECT_TRUE(browserActionBar.HasPopup()); browserActionBar.HidePopup(); } @@ -205,15 +243,7 @@ ASSERT_TRUE(RunExtensionSubtest("browser_action/open_popup", "open_popup_fails.html")) << message_; EXPECT_TRUE(listener.WaitUntilSatisfied()); - - content::WindowedNotificationObserver frame_observer( - content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::NotificationService::AllSources()); - // Open popup in the first extension. - BrowserActionTestUtil(browser()).Press(0); - frame_observer.Wait(); - EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); - + OpenPopupViaToolbar(); ResultCatcher catcher; // Return control to javascript to validate that opening a popup fails now. listener.Reply("show another"); @@ -227,7 +257,7 @@ if (!ShouldRunPopupTest()) return; - OpenExtensionPopupViaAPI(); + OpenPopupViaAPI(); ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); ASSERT_FALSE( @@ -243,19 +273,8 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, BrowserClickClosesPopup1) { if (!ShouldRunPopupTest()) return; - - // Open an extension popup via the chrome.browserAction.openPopup API. - content::WindowedNotificationObserver frame_observer( - content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::NotificationService::AllSources()); - ASSERT_TRUE(RunExtensionSubtest("browser_action/open_popup", - "open_popup_succeeds.html")) << message_; - frame_observer.Wait(); - EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); - - // Click on the omnibox to close the extension popup. - ui_test_utils::ClickOnView(browser(), VIEW_ID_OMNIBOX); - EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); + OpenPopupViaAPI(); + ClosePopupViaClick(); } // Test that the extension popup is closed when the browser window is clicked. @@ -275,18 +294,8 @@ "browser_action/popup"))); const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; - - // Open an extension popup by clicking the browser action button. - content::WindowedNotificationObserver frame_observer( - content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::NotificationService::AllSources()); - BrowserActionTestUtil(browser()).Press(0); - frame_observer.Wait(); - EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); - - // Click on the omnibox to close the extension popup. - ui_test_utils::ClickOnView(browser(), VIEW_ID_OMNIBOX); - EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); + OpenPopupViaToolbar(); + ClosePopupViaClick(); } // Test that the extension popup is closed on browser tab switches. @@ -299,7 +308,7 @@ ASSERT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(browser()->tab_strip_model()->GetWebContentsAt(1), browser()->tab_strip_model()->GetActiveWebContents()); - OpenExtensionPopupViaAPI(); + OpenPopupViaAPI(); content::WindowedNotificationObserver observer( extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, @@ -317,7 +326,7 @@ return; // First, we open a popup. - OpenExtensionPopupViaAPI(); + OpenPopupViaAPI(); BrowserActionTestUtil browser_action_test_util(browser()); EXPECT_TRUE(browser_action_test_util.HasPopup()); @@ -336,9 +345,15 @@ EXPECT_FALSE(browser_action_test_util.HasPopup()); } -#if defined(TOOLKIT_VIEWS) +// BrowserActionTestUtil::InspectPopup() is not implemented for a Cocoa browser. +#if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) +#define MAYBE_CloseBrowserWithDevTools CloseBrowserWithDevTools +#else +#define MAYBE_CloseBrowserWithDevTools DISABLED_CloseBrowserWithDevTools +#endif // Test closing the browser while inspecting an extension popup with dev tools. -IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, CloseBrowserWithDevTools) { +IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, + MAYBE_CloseBrowserWithDevTools) { if (!ShouldRunPopupTest()) return; @@ -359,7 +374,6 @@ // Close the browser window, this should not cause a crash. chrome::CloseWindow(browser()); } -#endif // TOOLKIT_VIEWS #if defined(OS_WIN) // Test that forcibly closing the browser and popup HWND does not cause a crash. @@ -369,7 +383,7 @@ if (!ShouldRunPopupTest()) return; - OpenExtensionPopupViaAPI(); + OpenPopupViaAPI(); BrowserActionTestUtil test_util(browser()); const gfx::NativeView view = test_util.GetPopupNativeView(); EXPECT_NE(static_cast<gfx::NativeView>(NULL), view);
diff --git a/chrome/browser/extensions/browser_action_test_util.h b/chrome/browser/extensions/browser_action_test_util.h index 4bdeedf..cf90784 100644 --- a/chrome/browser/extensions/browser_action_test_util.h +++ b/chrome/browser/extensions/browser_action_test_util.h
@@ -69,6 +69,10 @@ gfx::NativeView GetPopupNativeView(); + // Spins a RunLoop until the NativeWindow hosting |GetPopupNativeView()| is + // reported as active by the OS. Returns true if successful. + bool WaitForPopup(); + // Returns whether a browser action popup is being shown currently. bool HasPopup();
diff --git a/chrome/browser/resources/chromeos/login/encryption_migration.html b/chrome/browser/resources/chromeos/login/encryption_migration.html index da40f3b..2dd79466 100644 --- a/chrome/browser/resources/chromeos/login/encryption_migration.html +++ b/chrome/browser/resources/chromeos/login/encryption_migration.html
@@ -30,7 +30,7 @@ </div> </template> <template is="dom-if" if="[[!isEnoughBattery]]"> - <div class="footer layout vertical"> + <div class="footer layout vertical" aria-live="polite"> <div class="warning"> [[computeBatteryWarningLabel_(batteryPercent)]] </div> @@ -70,7 +70,7 @@ indeterminate="[[isProgressIndeterminate_(progress)]]"> </paper-progress> <template is="dom-if" if="[[!isProgressIndeterminate_(progress)]]"> - <div>[[computeProgressLabel_(progress)]]</div> + <div aria-live="polite">[[computeProgressLabel_(progress)]]</div> </template> </div> </oobe-dialog> @@ -103,7 +103,7 @@ <h1 class="title">$i18n{migrationReadyTitle}</h1> <div class="subtitle">$i18n{migrationReadyDescription}</div> </div> - <div class="footer layout vertical"> + <div class="footer layout vertical" aria-live="polite"> <div class="warning">$i18n{migrationNospaceWarningLabel}</div> <div>$i18n{migrationAskFreeSpaceMessage}</div> <div>[[computeAvailableSpaceLabel_(availableSpaceInString)]]</div>
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 1580d1c..314d824 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -3582,6 +3582,7 @@ "cocoa/extensions/browser_action_test_util_mac.mm", "cocoa/find_bar/find_bar_host_unittest_util_cocoa.mm", ] + deps += [ "//ui/base:test_support" ] } }
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm index 2c97e95f..ca79282 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
@@ -26,6 +26,7 @@ #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" #include "chrome/common/chrome_constants.h" +#import "ui/base/test/windowed_nsnotification_observer.h" #include "ui/base/theme_provider.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" @@ -158,6 +159,23 @@ return popup_owner ? popup_owner->GetPopupNativeView() : nil; } +bool BrowserActionTestUtil::WaitForPopup() { + NSWindow* window = [GetPopupNativeView() window]; + if (!window) + return false; + + if ([window isKeyWindow]) + return true; + + base::scoped_nsobject<WindowedNSNotificationObserver> waiter( + [[WindowedNSNotificationObserver alloc] + initForNotification:NSWindowDidBecomeKeyNotification + object:window]); + + BOOL notification_observed = [waiter wait]; + return notification_observed && [window isKeyWindow]; +} + bool BrowserActionTestUtil::HasPopup() { return GetPopupNativeView() != nil; }
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc index 251c0ea..06d347e7 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
@@ -184,6 +184,26 @@ DISALLOW_COPY_AND_ASSIGN(ExpirationDateValidationDelegate); }; +// Formats card number. For example, "4111111111111111" is formatted into +// "4111 1111 1111 1111". +base::string16 FormatCardNumber(const base::string16& text) { + base::string16 number = autofill::CreditCard::StripSeparators(text); + + std::vector<size_t> positions = {4U, 9U, 14U}; + if (autofill::CreditCard::GetCardNetwork(number) == + autofill::kAmericanExpressCard) { + positions = {4U, 11U}; + } + + static const base::char16 kSeparator = base::ASCIIToUTF16(" ")[0]; + for (size_t i : positions) { + if (number.size() > i) + number.insert(i, 1U, kSeparator); + } + + return number; +} + } // namespace CreditCardEditorViewController::CreditCardEditorViewController( @@ -369,8 +389,10 @@ if (!credit_card_to_edit_ || type == kBillingAddressType) return base::string16(); - return credit_card_to_edit_->GetInfo(autofill::AutofillType(type), - state()->GetApplicationLocale()); + base::string16 info = credit_card_to_edit_->GetInfo( + autofill::AutofillType(type), state()->GetApplicationLocale()); + + return type == autofill::CREDIT_CARD_NUMBER ? FormatCardNumber(info) : info; } bool CreditCardEditorViewController::ValidateModelAndSave() { @@ -592,6 +614,17 @@ ~CreditCardValidationDelegate() {} bool CreditCardEditorViewController::CreditCardValidationDelegate:: + ShouldFormat() { + return field_.type == autofill::CREDIT_CARD_NUMBER; +} + +base::string16 +CreditCardEditorViewController::CreditCardValidationDelegate::Format( + const base::string16& text) { + return FormatCardNumber(text); +} + +bool CreditCardEditorViewController::CreditCardValidationDelegate:: IsValidTextfield(views::Textfield* textfield) { return ValidateValue(textfield->text(), nullptr); }
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h index 3c396fd..1b08203 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
@@ -86,6 +86,8 @@ ~CreditCardValidationDelegate() override; // ValidationDelegate: + bool ShouldFormat() override; + base::string16 Format(const base::string16& text) override; bool IsValidTextfield(views::Textfield* textfield) override; bool IsValidCombobox(views::Combobox* combobox) override; bool TextfieldValueChanged(views::Textfield* textfield,
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 992cea77..7c883c80 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
@@ -65,7 +65,7 @@ SetEditorTextfieldValue(base::ASCIIToUTF16("Bob Jones"), autofill::CREDIT_CARD_NAME_FULL); - SetEditorTextfieldValue(base::ASCIIToUTF16("4111111111111111"), + SetEditorTextfieldValue(base::ASCIIToUTF16(" 4111 1111-1111 1111-"), autofill::CREDIT_CARD_NUMBER); SetComboboxValue(base::ASCIIToUTF16("05"), autofill::CREDIT_CARD_EXP_MONTH); SetComboboxValue(base::ASCIIToUTF16("2026"), @@ -385,7 +385,7 @@ EXPECT_EQ(base::ASCIIToUTF16("Test User"), GetEditorTextfieldValue(autofill::CREDIT_CARD_NAME_FULL)); - EXPECT_EQ(base::ASCIIToUTF16("4111111111111111"), + EXPECT_EQ(base::ASCIIToUTF16("4111 1111 1111 1111"), GetEditorTextfieldValue(autofill::CREDIT_CARD_NUMBER)); EXPECT_EQ(base::ASCIIToUTF16("01"), GetComboboxValue(autofill::CREDIT_CARD_EXP_MONTH));
diff --git a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc index 78e6cfe8..0a5f6c0 100644 --- a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc +++ b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc
@@ -167,6 +167,12 @@ return popup_owner ? popup_owner->GetPopupNativeView() : nullptr; } +bool BrowserActionTestUtil::WaitForPopup() { + // TODO(tapted): Implement this for MacViews. + NOTIMPLEMENTED(); + return HasPopup(); +} + bool BrowserActionTestUtil::HasPopup() { return GetPopupNativeView() != nullptr; }
diff --git a/chrome/renderer/autofill/form_classifier_browsertest.cc b/chrome/renderer/autofill/form_classifier_browsertest.cc index 2cccb25..43c954f 100644 --- a/chrome/renderer/autofill/form_classifier_browsertest.cc +++ b/chrome/renderer/autofill/form_classifier_browsertest.cc
@@ -7,10 +7,10 @@ #include "chrome/test/base/chrome_render_view_test.h" #include "components/autofill/content/renderer/form_classifier.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFormElement.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "ui/native_theme/native_theme_features.h" namespace autofill {
diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc index 48b39e95..52c772c 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc
@@ -24,10 +24,10 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/WebKit/public/platform/URLConversion.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebScriptSource.h" #include "ui/native_theme/native_theme_features.h"
diff --git a/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc b/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc index e5dc97b..b537f33 100644 --- a/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc +++ b/chrome/renderer/safe_browsing/threat_dom_details_browsertest.cc
@@ -15,7 +15,7 @@ #include "content/public/renderer/render_view.h" #include "net/base/escape.h" #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "ui/native_theme/native_theme_features.h" namespace {
diff --git a/chromecast/renderer/cast_content_renderer_client.cc b/chromecast/renderer/cast_content_renderer_client.cc index 7af9014..ba3f58c4 100644 --- a/chromecast/renderer/cast_content_renderer_client.cc +++ b/chromecast/renderer/cast_content_renderer_client.cc
@@ -28,8 +28,8 @@ #include "media/base/media.h" #include "services/service_manager/public/cpp/connector.h" #include "third_party/WebKit/public/platform/WebColor.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebFrameWidget.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebSettings.h" #include "third_party/WebKit/public/web/WebView.h"
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index 8f672874..e25de68 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -41,6 +41,7 @@ #include "chromeos/dbus/sms_client.h" #include "chromeos/dbus/system_clock_client.h" #include "chromeos/dbus/update_engine_client.h" +#include "chromeos/dbus/upstart_client.h" #include "dbus/bus.h" #include "dbus/dbus_statistics.h" @@ -416,4 +417,10 @@ std::move(client); } +void DBusThreadManagerSetter::SetUpstartClient( + std::unique_ptr<UpstartClient> client) { + DBusThreadManager::Get()->clients_browser_->upstart_client_ = + std::move(client); +} + } // namespace chromeos
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index 49671319..c7f793d 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -200,6 +200,7 @@ void SetPowerManagerClient(std::unique_ptr<PowerManagerClient> client); void SetSessionManagerClient(std::unique_ptr<SessionManagerClient> client); void SetUpdateEngineClient(std::unique_ptr<UpdateEngineClient> client); + void SetUpstartClient(std::unique_ptr<UpstartClient> client); private: friend class DBusThreadManager;
diff --git a/chromeos/dbus/proto/media_perception.proto b/chromeos/dbus/proto/media_perception.proto index c7b78704..c14ef236 100644 --- a/chromeos/dbus/proto/media_perception.proto +++ b/chromeos/dbus/proto/media_perception.proto
@@ -31,11 +31,10 @@ message State { enum Status { STATUS_UNSPECIFIED = 0; // Unused required default value for Proto enums. - TIMEOUT = 1; // Unable to reach media analysis process. - UNINITIALIZED = 2; // Media analytics working on loading configuration. - STARTED = 3; // Analysis process running but not recieving frames. - RUNNING = 4; // Analysis process running and injesting frames. - SUSPENDED = 5; // Media analytics process waiting to be started. + UNINITIALIZED = 1; // Media analytics working on loading configuration. + STARTED = 2; // Analysis process running but not recieving frames. + RUNNING = 3; // Analysis process running and injesting frames. + SUSPENDED = 4; // Media analytics process waiting to be started. } // Note: RUNNING and SUSPENDED are the only two states which should be sent to
diff --git a/components/favicon/core/large_icon_service.cc b/components/favicon/core/large_icon_service.cc index 387f5a71..df9f2e32e 100644 --- a/components/favicon/core/large_icon_service.cc +++ b/components/favicon/core/large_icon_service.cc
@@ -40,10 +40,12 @@ const char kGoogleServerV2RequestFormat[] = "https://t0.gstatic.com/faviconV2?" - "client=chrome&drop_404_icon=true&check_seen=true&" + "client=chrome&drop_404_icon=true&%s" "size=%d&min_size=%d&max_size=%d&fallback_opts=TYPE,SIZE,URL&url=%s"; const char kGoogleServerV2RequestFormatParam[] = "request_format"; +const char kCheckSeenParam[] = "check_seen=true&"; + const int kGoogleServerV2EnforcedMinSizeInPixel = 32; const char kGoogleServerV2EnforcedMinSizeInPixelParam[] = "enforced_min_size_in_pixel"; @@ -66,7 +68,8 @@ GURL GetRequestUrlForGoogleServerV2(const GURL& page_url, int min_source_size_in_pixel, - int desired_size_in_pixel) { + int desired_size_in_pixel, + bool may_page_url_be_private) { std::string url_format = base::GetFieldTrialParamValueByFeature( kLargeIconServiceFetchingFeature, kGoogleServerV2RequestFormatParam); double desired_to_max_size_factor = base::GetFieldTrialParamByFeatureAsDouble( @@ -86,8 +89,8 @@ return GURL(base::StringPrintf( url_format.empty() ? kGoogleServerV2RequestFormat : url_format.c_str(), - desired_size_in_pixel, min_source_size_in_pixel, max_size_in_pixel, - page_url.spec().c_str())); + may_page_url_be_private ? kCheckSeenParam : "", desired_size_in_pixel, + min_source_size_in_pixel, max_size_in_pixel, page_url.spec().c_str())); } bool IsDbResultAdequate(const favicon_base::FaviconRawBitmapResult& db_result, @@ -345,12 +348,14 @@ const GURL& page_url, int min_source_size_in_pixel, int desired_size_in_pixel, + bool may_page_url_be_private, const base::Callback<void(bool success)>& callback) { DCHECK_LE(0, min_source_size_in_pixel); const GURL trimmed_page_url = TrimPageUrlForGoogleServer(page_url); const GURL server_request_url = GetRequestUrlForGoogleServerV2( - trimmed_page_url, min_source_size_in_pixel, desired_size_in_pixel); + trimmed_page_url, min_source_size_in_pixel, desired_size_in_pixel, + may_page_url_be_private); // Do not download if the URL is invalid after trimming, or there is a // previous cache miss recorded for |server_request_url|.
diff --git a/components/favicon/core/large_icon_service.h b/components/favicon/core/large_icon_service.h index d07888a..b25ab3e3 100644 --- a/components/favicon/core/large_icon_service.h +++ b/components/favicon/core/large_icon_service.h
@@ -75,6 +75,11 @@ // |desired_size_in_pixel| serves only as a hint to the service, no guarantees // on the fetched size are provided. // + // Unless you are sure |page_url| is a public URL (known to Google Search), + // set |may_page_url_be_private| to true. This slighty increases the chance of + // a failure (e.g. if the URL _is_ private) but it makes sure Google servers + // do not crawl a private URL as a result of this call. + // // The callback is triggered when the operation finishes, where |success| // tells whether the fetch actually managed to database a new icon in the // FaviconService. @@ -88,6 +93,7 @@ const GURL& page_url, int min_source_size_in_pixel, int desired_size_in_pixel, + bool may_page_url_be_private, const base::Callback<void(bool success)>& callback); private:
diff --git a/components/favicon/core/large_icon_service_unittest.cc b/components/favicon/core/large_icon_service_unittest.cc index 000df89..79f9a6b 100644 --- a/components/favicon/core/large_icon_service_unittest.cc +++ b/components/favicon/core/large_icon_service_unittest.cc
@@ -40,7 +40,10 @@ using testing::IsEmpty; using testing::IsNull; using testing::Eq; +using testing::HasSubstr; using testing::NiceMock; +using testing::Not; +using testing::Property; using testing::Return; using testing::SaveArg; using testing::_; @@ -116,6 +119,7 @@ MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*()); }; +// TODO(jkrcal): Make the tests a bit crisper, see crbug.com/725822. class LargeIconServiceTest : public testing::Test { public: LargeIconServiceTest() @@ -159,7 +163,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(true)); base::RunLoop().RunUntilIdle(); @@ -172,13 +177,13 @@ "LargeIconServiceFetching", {{"request_format", "https://t0.gstatic.com/" - "faviconV2?size=%d&min_size=%d&max_size=%d&url=%s"}, + "faviconV2?%ssize=%d&min_size=%d&max_size=%d&url=%s"}, {"enforced_min_size_in_pixel", "43"}, {"desired_to_max_size_factor", "1.5"}}, {"LargeIconServiceFetching"}); const GURL kExpectedServerUrl( - "https://t0.gstatic.com/" - "faviconV2?size=61&min_size=43&max_size=91&url=http://www.example.com/"); + "https://t0.gstatic.com/faviconV2?check_seen=true&" + "size=61&min_size=43&max_size=91&url=http://www.example.com/"); EXPECT_CALL(mock_favicon_service_, UnableToDownloadFavicon(_)).Times(0); @@ -195,7 +200,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(true)); base::RunLoop().RunUntilIdle(); @@ -225,7 +231,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(true)); base::RunLoop().RunUntilIdle(); @@ -249,11 +256,32 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyUrlWithQuery), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, base::Callback<void(bool success)>()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + base::Callback<void(bool success)>()); base::RunLoop().RunUntilIdle(); } +TEST_F(LargeIconServiceTest, ShouldNotCheckOnPublicUrls) { + // The request has no "check_seen=true"; full URL is tested elsewhere. + EXPECT_CALL( + *mock_image_fetcher_, + StartOrQueueNetworkRequest( + _, Property(&GURL::query, Not(HasSubstr("check_seen=true"))), _, _)) + .WillOnce(PostFetchReply(gfx::Image())); + + base::MockCallback<base::Callback<void(bool success)>> callback; + + large_icon_service_ + .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( + GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/false, + callback.Get()); + + EXPECT_CALL(callback, Run(false)); + base::RunLoop().RunUntilIdle(); +} + TEST_F(LargeIconServiceTest, ShouldNotQueryGoogleServerIfInvalidScheme) { const GURL kDummyFtpUrl("ftp://www.example.com"); @@ -265,7 +293,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyFtpUrl), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(false)); base::RunLoop().RunUntilIdle(); @@ -294,7 +323,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( kDummyUrlWithQuery, /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(false)); base::RunLoop().RunUntilIdle(); @@ -322,7 +352,8 @@ large_icon_service_ .GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( GURL(kDummyUrl), /*min_source_size_in_pixel=*/42, - /*desired_size_in_pixel=*/61, callback.Get()); + /*desired_size_in_pixel=*/61, /*may_page_url_be_private=*/true, + callback.Get()); EXPECT_CALL(callback, Run(false)); base::RunLoop().RunUntilIdle();
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.cc b/components/gcm_driver/crypto/gcm_encryption_provider.cc index c9c7183..6a4bdc5f 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider.cc +++ b/components/gcm_driver/crypto/gcm_encryption_provider.cc
@@ -13,6 +13,7 @@ #include "components/gcm_driver/crypto/encryption_header_parsers.h" #include "components/gcm_driver/crypto/gcm_key_store.h" #include "components/gcm_driver/crypto/gcm_message_cryptographer.h" +#include "components/gcm_driver/crypto/message_payload_parser.h" #include "components/gcm_driver/crypto/p256_key_util.h" #include "components/gcm_driver/crypto/proto/gcm_encryption_data.pb.h" @@ -21,8 +22,12 @@ namespace { const char kEncryptionProperty[] = "encryption"; +const char kContentEncodingProperty[] = "content-encoding"; const char kCryptoKeyProperty[] = "crypto-key"; +// Content coding name defined by ietf-httpbis-encryption-encoding. +const char kContentCodingAes128Gcm[] = "aes128gcm"; + // Directory in the GCM Store in which the encryption database will be stored. const base::FilePath::CharType kEncryptionDirectoryName[] = FILE_PATH_LITERAL("Encryption"); @@ -34,8 +39,10 @@ switch (result) { case DECRYPTION_RESULT_UNENCRYPTED: return "Message was not encrypted"; - case DECRYPTION_RESULT_DECRYPTED: - return "Message decrypted"; + case DECRYPTION_RESULT_DECRYPTED_DRAFT_03: + return "Message decrypted (draft 03)"; + case DECRYPTION_RESULT_DECRYPTED_DRAFT_08: + return "Message decrypted (draft 08)"; case DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER: return "Invalid format for the Encryption header"; case DECRYPTION_RESULT_INVALID_CRYPTO_KEY_HEADER: @@ -46,6 +53,8 @@ return "The shared secret cannot be derived from the keying material"; case DECRYPTION_RESULT_INVALID_PAYLOAD: return "AES-GCM decryption failed"; + case DECRYPTION_RESULT_INVALID_BINARY_HEADER: + return "The message's binary header could not be parsed."; } NOTREACHED(); @@ -97,6 +106,14 @@ bool GCMEncryptionProvider::IsEncryptedMessage(const IncomingMessage& message) const { + // Messages that explicitly specify their content coding to be "aes128gcm" + // indicate that they use draft-ietf-webpush-encryption-08. + auto content_encoding_iter = message.data.find(kContentEncodingProperty); + if (content_encoding_iter != message.data.end() && + content_encoding_iter->second == kContentCodingAes128Gcm) { + return true; + } + // The Web Push protocol requires the encryption and crypto-key properties to // be set, and the raw_data field to be populated with the payload. if (message.data.find(kEncryptionProperty) == message.data.end() || @@ -116,77 +133,110 @@ return; } - // IsEncryptedMessage() verifies that both the Encryption and Crypto-Key HTTP - // headers have been provided for the |message|. - const auto& encryption_header = message.data.find(kEncryptionProperty); - const auto& crypto_key_header = message.data.find(kCryptoKeyProperty); + std::string salt, public_key, ciphertext; + GCMMessageCryptographer::Version version; + uint32_t record_size; - DCHECK(encryption_header != message.data.end()); - DCHECK(crypto_key_header != message.data.end()); + auto content_encoding_iter = message.data.find(kContentEncodingProperty); + if (content_encoding_iter != message.data.end() && + content_encoding_iter->second == kContentCodingAes128Gcm) { + // The message follows encryption per draft-ietf-webpush-encryption-08. Use + // the binary header of the message to derive the values. - EncryptionHeaderIterator encryption_header_iterator( - encryption_header->second.begin(), encryption_header->second.end()); - if (!encryption_header_iterator.GetNext()) { - DLOG(ERROR) << "Unable to parse the value of the Encryption header"; - callback.Run(DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER, - IncomingMessage()); - return; - } - - if (encryption_header_iterator.salt().size() != - GCMMessageCryptographer::kSaltSize) { - DLOG(ERROR) << "Invalid values supplied in the Encryption header"; - callback.Run(DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER, - IncomingMessage()); - return; - } - - CryptoKeyHeaderIterator crypto_key_header_iterator( - crypto_key_header->second.begin(), crypto_key_header->second.end()); - if (!crypto_key_header_iterator.GetNext()) { - DLOG(ERROR) << "Unable to parse the value of the Crypto-Key header"; - callback.Run(DECRYPTION_RESULT_INVALID_CRYPTO_KEY_HEADER, - IncomingMessage()); - return; - } - - // Ignore values that don't include the "dh" property. When using VAPID, it is - // valid for the application server to supply multiple values. - while (crypto_key_header_iterator.dh().empty() && - crypto_key_header_iterator.GetNext()) {} - - bool valid_crypto_key_header = false; - std::string dh; - - if (!crypto_key_header_iterator.dh().empty()) { - dh = crypto_key_header_iterator.dh(); - valid_crypto_key_header = true; - - // Guard against the "dh" property being included more than once. - while (crypto_key_header_iterator.GetNext()) { - if (crypto_key_header_iterator.dh().empty()) - continue; - - valid_crypto_key_header = false; - break; + MessagePayloadParser parser(message.raw_data); + if (!parser.IsValid()) { + DLOG(ERROR) << "Unable to parse the message's binary header"; + callback.Run(DECRYPTION_RESULT_INVALID_BINARY_HEADER, IncomingMessage()); + return; } - } - if (!valid_crypto_key_header) { - DLOG(ERROR) << "Invalid values supplied in the Crypto-Key header"; - callback.Run(DECRYPTION_RESULT_INVALID_CRYPTO_KEY_HEADER, - IncomingMessage()); - return; + salt = parser.salt(); + public_key = parser.public_key(); + record_size = parser.record_size(); + ciphertext = parser.ciphertext(); + version = GCMMessageCryptographer::Version::DRAFT_08; + + } else { + // The message follows encryption per draft-ietf-webpush-encryption-03. Use + // the Encryption and Crypto-Key header values to derive the values. + + const auto& encryption_header = message.data.find(kEncryptionProperty); + DCHECK(encryption_header != message.data.end()); + + const auto& crypto_key_header = message.data.find(kCryptoKeyProperty); + DCHECK(crypto_key_header != message.data.end()); + + EncryptionHeaderIterator encryption_header_iterator( + encryption_header->second.begin(), encryption_header->second.end()); + if (!encryption_header_iterator.GetNext()) { + DLOG(ERROR) << "Unable to parse the value of the Encryption header"; + callback.Run(DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER, + IncomingMessage()); + return; + } + + if (encryption_header_iterator.salt().size() != + GCMMessageCryptographer::kSaltSize) { + DLOG(ERROR) << "Invalid values supplied in the Encryption header"; + callback.Run(DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER, + IncomingMessage()); + return; + } + + salt = encryption_header_iterator.salt(); + record_size = encryption_header_iterator.rs(); + + CryptoKeyHeaderIterator crypto_key_header_iterator( + crypto_key_header->second.begin(), crypto_key_header->second.end()); + if (!crypto_key_header_iterator.GetNext()) { + DLOG(ERROR) << "Unable to parse the value of the Crypto-Key header"; + callback.Run(DECRYPTION_RESULT_INVALID_CRYPTO_KEY_HEADER, + IncomingMessage()); + return; + } + + // Ignore values that don't include the "dh" property. When using VAPID, it + // is valid for the application server to supply multiple values. + while (crypto_key_header_iterator.dh().empty() && + crypto_key_header_iterator.GetNext()) { + } + + bool valid_crypto_key_header = false; + + if (!crypto_key_header_iterator.dh().empty()) { + public_key = crypto_key_header_iterator.dh(); + valid_crypto_key_header = true; + + // Guard against the "dh" property being included more than once. + while (crypto_key_header_iterator.GetNext()) { + if (crypto_key_header_iterator.dh().empty()) + continue; + + valid_crypto_key_header = false; + break; + } + } + + if (!valid_crypto_key_header) { + DLOG(ERROR) << "Invalid values supplied in the Crypto-Key header"; + callback.Run(DECRYPTION_RESULT_INVALID_CRYPTO_KEY_HEADER, + IncomingMessage()); + return; + } + + ciphertext = message.raw_data; + version = GCMMessageCryptographer::Version::DRAFT_03; } // Use |fallback_to_empty_authorized_entity|, since this message might have // been sent to either an InstanceID token or a non-InstanceID registration. - key_store_->GetKeys(app_id, message.sender_id /* authorized_entity */, - true /* fallback_to_empty_authorized_entity */, - base::Bind(&GCMEncryptionProvider::DecryptMessageWithKey, - weak_ptr_factory_.GetWeakPtr(), message, - callback, encryption_header_iterator.salt(), - dh, encryption_header_iterator.rs())); + key_store_->GetKeys( + app_id, message.sender_id /* authorized_entity */, + true /* fallback_to_empty_authorized_entity */, + base::Bind(&GCMEncryptionProvider::DecryptMessageWithKey, + weak_ptr_factory_.GetWeakPtr(), message.collapse_key, + message.sender_id, std::move(salt), std::move(public_key), + record_size, std::move(ciphertext), version, callback)); } void GCMEncryptionProvider::DidGetEncryptionInfo( @@ -222,11 +272,14 @@ } void GCMEncryptionProvider::DecryptMessageWithKey( - const IncomingMessage& message, - const MessageCallback& callback, + const std::string& collapse_key, + const std::string& sender_id, const std::string& salt, - const std::string& dh, - uint64_t rs, + const std::string& public_key, + uint32_t record_size, + const std::string& ciphertext, + GCMMessageCryptographer::Version version, + const MessageCallback& callback, const KeyPair& pair, const std::string& auth_secret) { if (!pair.IsInitialized()) { @@ -238,8 +291,8 @@ DCHECK_EQ(KeyPair::ECDH_P256, pair.type()); std::string shared_secret; - if (!ComputeSharedP256Secret(pair.private_key(), pair.public_key_x509(), dh, - &shared_secret)) { + if (!ComputeSharedP256Secret(pair.private_key(), pair.public_key_x509(), + public_key, &shared_secret)) { DLOG(ERROR) << "Unable to calculate the shared secret."; callback.Run(DECRYPTION_RESULT_INVALID_SHARED_SECRET, IncomingMessage()); return; @@ -247,19 +300,19 @@ std::string plaintext; - GCMMessageCryptographer cryptographer( - GCMMessageCryptographer::Version::DRAFT_03); + GCMMessageCryptographer cryptographer(version); - if (!cryptographer.Decrypt(pair.public_key(), dh, shared_secret, auth_secret, - salt, message.raw_data, rs, &plaintext)) { + if (!cryptographer.Decrypt(pair.public_key(), public_key, shared_secret, + auth_secret, salt, ciphertext, record_size, + &plaintext)) { DLOG(ERROR) << "Unable to decrypt the incoming data."; callback.Run(DECRYPTION_RESULT_INVALID_PAYLOAD, IncomingMessage()); return; } IncomingMessage decrypted_message; - decrypted_message.collapse_key = message.collapse_key; - decrypted_message.sender_id = message.sender_id; + decrypted_message.collapse_key = collapse_key; + decrypted_message.sender_id = sender_id; decrypted_message.raw_data.swap(plaintext); decrypted_message.decrypted = true; @@ -267,7 +320,10 @@ // to make sure that we don't end up in an infinite decryption loop. DCHECK_EQ(0u, decrypted_message.data.size()); - callback.Run(DECRYPTION_RESULT_DECRYPTED, decrypted_message); + callback.Run(version == GCMMessageCryptographer::Version::DRAFT_03 + ? DECRYPTION_RESULT_DECRYPTED_DRAFT_03 + : DECRYPTION_RESULT_DECRYPTED_DRAFT_08, + decrypted_message); } } // namespace gcm
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.h b/components/gcm_driver/crypto/gcm_encryption_provider.h index a117134..65c1c9cc 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider.h +++ b/components/gcm_driver/crypto/gcm_encryption_provider.h
@@ -14,6 +14,7 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "components/gcm_driver/crypto/gcm_message_cryptographer.h" namespace base { class FilePath; @@ -37,8 +38,9 @@ DECRYPTION_RESULT_UNENCRYPTED = 0, // The message had been encrypted by the sender, and could successfully be - // decrypted for the registration it has been received for. - DECRYPTION_RESULT_DECRYPTED = 1, + // decrypted for the registration it has been received for. The encryption + // scheme used for the message was draft-ietf-webpush-encryption-03. + DECRYPTION_RESULT_DECRYPTED_DRAFT_03 = 1, // The contents of the Encryption HTTP header could not be parsed. DECRYPTION_RESULT_INVALID_ENCRYPTION_HEADER = 2, @@ -55,7 +57,16 @@ // The payload could not be decrypted as AES-128-GCM. DECRYPTION_RESULT_INVALID_PAYLOAD = 6, - DECRYPTION_RESULT_LAST = DECRYPTION_RESULT_INVALID_PAYLOAD + // The binary header leading the ciphertext could not be parsed. Only + // applicable to messages encrypted per draft-ietf-webpush-encryption-08. + DECRYPTION_RESULT_INVALID_BINARY_HEADER = 7, + + // The message had been encrypted by the sender, and could successfully be + // decrypted for the registration it has been received for. The encryption + // scheme used for the message was draft-ietf-webpush-encryption-08. + DECRYPTION_RESULT_DECRYPTED_DRAFT_08 = 8, + + DECRYPTION_RESULT_LAST = DECRYPTION_RESULT_DECRYPTED_DRAFT_08 }; // Callback to be invoked when the public key and auth secret are available. @@ -126,11 +137,14 @@ const KeyPair& pair, const std::string& auth_secret); - void DecryptMessageWithKey(const IncomingMessage& message, - const MessageCallback& callback, + void DecryptMessageWithKey(const std::string& collapse_key, + const std::string& sender_id, const std::string& salt, - const std::string& dh, - uint64_t rs, + const std::string& public_key, + uint32_t record_size, + const std::string& ciphertext, + GCMMessageCryptographer::Version version, + const MessageCallback& callback, const KeyPair& pair, const std::string& auth_secret);
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc index 15ff1ae..0f0fc0c4 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc +++ b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
@@ -10,6 +10,7 @@ #include <string> #include "base/base64url.h" +#include "base/big_endian.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/scoped_temp_dir.h" @@ -141,7 +142,8 @@ // Performs a full round-trip test of the encryption feature. Must wrap this // in ASSERT_NO_FATAL_FAILURE. void TestEncryptionRoundTrip(const std::string& app_id, - const std::string& authorized_entity); + const std::string& authorized_entity, + GCMMessageCryptographer::Version version); private: void DidDecryptMessage(GCMEncryptionProvider::DecryptionResult result, @@ -186,6 +188,11 @@ double_header_with_data_message.raw_data = "foo"; EXPECT_TRUE(encryption_provider()->IsEncryptedMessage( double_header_with_data_message)); + + IncomingMessage draft08_message; + draft08_message.data["content-encoding"] = "aes128gcm"; + draft08_message.raw_data = "foo"; + EXPECT_TRUE(encryption_provider()->IsEncryptedMessage(draft08_message)); } TEST_F(GCMEncryptionProviderTest, VerifiesEncryptionHeaderParsing) { @@ -447,7 +454,8 @@ void GCMEncryptionProviderTest::TestEncryptionRoundTrip( const std::string& app_id, - const std::string& authorized_entity) { + const std::string& authorized_entity, + GCMMessageCryptographer::Version version) { // Performs a full round-trip of the encryption feature, including getting a // public/private key-pair and performing the cryptographic operations. This // is more of an integration test than a unit test. @@ -495,34 +503,71 @@ // Encrypts the |kExampleMessage| using the generated shared key and the // random |salt|, storing the result in |record_size| and the message. - GCMMessageCryptographer cryptographer( - GCMMessageCryptographer::Version::DRAFT_03); + GCMMessageCryptographer cryptographer(version); + std::string ciphertext; ASSERT_TRUE(cryptographer.Encrypt( pair.public_key(), server_pair.public_key(), shared_secret, auth_secret, - salt, kExampleMessage, &record_size, &message.raw_data)); + salt, kExampleMessage, &record_size, &ciphertext)); - std::string encoded_salt, encoded_key; + switch (version) { + case GCMMessageCryptographer::Version::DRAFT_03: { + std::string encoded_salt, encoded_key; - // Compile the incoming GCM message, including the required headers. - base::Base64UrlEncode( - salt, base::Base64UrlEncodePolicy::INCLUDE_PADDING, &encoded_salt); - base::Base64UrlEncode( - server_pair.public_key(), base::Base64UrlEncodePolicy::INCLUDE_PADDING, - &encoded_key); + // Compile the incoming GCM message, including the required headers. + base::Base64UrlEncode(salt, base::Base64UrlEncodePolicy::INCLUDE_PADDING, + &encoded_salt); + base::Base64UrlEncode(server_pair.public_key(), + base::Base64UrlEncodePolicy::INCLUDE_PADDING, + &encoded_key); - std::stringstream encryption_header; - encryption_header << "rs=" << base::SizeTToString(record_size) << ";"; - encryption_header << "salt=" << encoded_salt; + std::stringstream encryption_header; + encryption_header << "rs=" << base::SizeTToString(record_size) << ";"; + encryption_header << "salt=" << encoded_salt; - message.data["encryption"] = encryption_header.str(); - message.data["crypto-key"] = "dh=" + encoded_key; + message.data["encryption"] = encryption_header.str(); + message.data["crypto-key"] = "dh=" + encoded_key; + message.raw_data.swap(ciphertext); + break; + } + case GCMMessageCryptographer::Version::DRAFT_08: { + uint32_t rs = record_size; + uint8_t key_length = server_pair.public_key().size(); + + std::vector<char> payload(salt.size() + sizeof(rs) + sizeof(key_length) + + server_pair.public_key().size() + + ciphertext.size()); + + char* current = &payload.front(); + + memcpy(current, salt.data(), salt.size()); + current += salt.size(); + + base::WriteBigEndian(current, rs); + current += sizeof(rs); + + base::WriteBigEndian(current, key_length); + current += sizeof(key_length); + + memcpy(current, server_pair.public_key().data(), + server_pair.public_key().size()); + current += server_pair.public_key().size(); + + memcpy(current, ciphertext.data(), ciphertext.size()); + + message.data["content-encoding"] = "aes128gcm"; + message.raw_data.assign(payload.begin(), payload.end()); + break; + } + } ASSERT_TRUE(encryption_provider()->IsEncryptedMessage(message)); // Decrypt the message, and expect everything to go wonderfully well. ASSERT_NO_FATAL_FAILURE(Decrypt(message)); - ASSERT_EQ(GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED, + ASSERT_EQ(version == GCMMessageCryptographer::Version::DRAFT_03 + ? GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_03 + : GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_08, decryption_result()); EXPECT_TRUE(decrypted_message().decrypted); @@ -533,14 +578,24 @@ // GCMEncryptionProvider::DecryptMessage should succeed when the message was // sent to a non-InstanceID GCM registration (empty authorized_entity). ASSERT_NO_FATAL_FAILURE(TestEncryptionRoundTrip( - kExampleAppId, "" /* empty authorized entity for non-InstanceID */)); + kExampleAppId, "" /* empty authorized entity for non-InstanceID */, + GCMMessageCryptographer::Version::DRAFT_03)); } TEST_F(GCMEncryptionProviderTest, EncryptionRoundTripInstanceIDToken) { // GCMEncryptionProvider::DecryptMessage should succeed when the message was // sent to an InstanceID token (non-empty authorized_entity). ASSERT_NO_FATAL_FAILURE( - TestEncryptionRoundTrip(kExampleAppId, kExampleAuthorizedEntity)); + TestEncryptionRoundTrip(kExampleAppId, kExampleAuthorizedEntity, + GCMMessageCryptographer::Version::DRAFT_03)); +} + +TEST_F(GCMEncryptionProviderTest, EncryptionRoundTripDraft08) { + // GCMEncryptionProvider::DecryptMessage should succeed when the message was + // encrypted following raft-ietf-webpush-encryption-08. + ASSERT_NO_FATAL_FAILURE( + TestEncryptionRoundTrip(kExampleAppId, kExampleAuthorizedEntity, + GCMMessageCryptographer::Version::DRAFT_08)); } } // namespace gcm
diff --git a/components/gcm_driver/crypto/gcm_message_cryptographer.cc b/components/gcm_driver/crypto/gcm_message_cryptographer.cc index deaaba3..fb72d73 100644 --- a/components/gcm_driver/crypto/gcm_message_cryptographer.cc +++ b/components/gcm_driver/crypto/gcm_message_cryptographer.cc
@@ -57,10 +57,8 @@ const base::StringPiece& auth_secret) override { const char kInfo[] = "Content-Encoding: auth"; - std::string info; - info.reserve(sizeof(kInfo) + 1); - info.append(kInfo); - info.append(1, '\0'); + // This deliberately copies over the NUL terminus. + base::StringPiece info(kInfo, sizeof(kInfo)); crypto::HKDF hkdf(ecdh_shared_secret, auth_secret, info, 32, /* key_bytes_to_generate */ @@ -197,9 +195,10 @@ const char kInfo[] = "WebPush: info"; std::string info; - info.reserve(sizeof(kInfo) + 1 + 65 + 65); - info.append(kInfo); - info.append(1, '\0'); + info.reserve(sizeof(kInfo) + 65 + 65); + + // This deliberately copies over the NUL terminus. + info.append(kInfo, sizeof(kInfo)); recipient_public_key.AppendToString(&info); sender_public_key.AppendToString(&info);
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc index a6b0440..0f797f7 100644 --- a/components/gcm_driver/gcm_driver.cc +++ b/components/gcm_driver/gcm_driver.cc
@@ -288,7 +288,8 @@ switch (result) { case GCMEncryptionProvider::DECRYPTION_RESULT_UNENCRYPTED: - case GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED: { + case GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_03: + case GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_08: { GCMAppHandler* handler = GetAppHandler(app_id); if (handler) handler->OnMessage(app_id, message); @@ -302,6 +303,7 @@ case GCMEncryptionProvider::DECRYPTION_RESULT_NO_KEYS: case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_SHARED_SECRET: case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_PAYLOAD: + case GCMEncryptionProvider::DECRYPTION_RESULT_INVALID_BINARY_HEADER: RecordDecryptionFailure(app_id, result); return; }
diff --git a/components/gcm_driver/gcm_stats_recorder_android.cc b/components/gcm_driver/gcm_stats_recorder_android.cc index b07235c..fedd7ba 100644 --- a/components/gcm_driver/gcm_stats_recorder_android.cc +++ b/components/gcm_driver/gcm_stats_recorder_android.cc
@@ -127,7 +127,10 @@ const std::string& app_id, GCMEncryptionProvider::DecryptionResult result) { DCHECK_NE(result, GCMEncryptionProvider::DECRYPTION_RESULT_UNENCRYPTED); - DCHECK_NE(result, GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED); + DCHECK_NE(result, + GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_03); + DCHECK_NE(result, + GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_08); if (!is_recording_) return;
diff --git a/components/gcm_driver/gcm_stats_recorder_impl.cc b/components/gcm_driver/gcm_stats_recorder_impl.cc index 721e85a..14544a9 100644 --- a/components/gcm_driver/gcm_stats_recorder_impl.cc +++ b/components/gcm_driver/gcm_stats_recorder_impl.cc
@@ -191,7 +191,10 @@ const std::string& app_id, GCMEncryptionProvider::DecryptionResult result) { DCHECK_NE(result, GCMEncryptionProvider::DECRYPTION_RESULT_UNENCRYPTED); - DCHECK_NE(result, GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED); + DCHECK_NE(result, + GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_03); + DCHECK_NE(result, + GCMEncryptionProvider::DECRYPTION_RESULT_DECRYPTED_DRAFT_08); if (!is_recording_) return;
diff --git a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc index 0930a321..9b0e2df80d 100644 --- a/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc +++ b/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
@@ -31,7 +31,7 @@ namespace { const int kMaxBookmarks = 10; -const int kMaxBookmarkAgeInDays = 42; +const int kMaxBookmarkAgeInDays = 7; const char* kMaxBookmarksParamName = "bookmarks_max_count"; const char* kMaxBookmarkAgeInDaysParamName = "bookmarks_max_age_in_days"; @@ -57,7 +57,7 @@ bool AreDesktopVisitsConsidered() { return variations::GetVariationParamByFeatureAsBool( ntp_snippets::kBookmarkSuggestionsFeature, - kConsiderDesktopVisitsParamName, false); + kConsiderDesktopVisitsParamName, true); } } // namespace
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc index 9187566..36a6167 100644 --- a/components/ntp_snippets/content_suggestions_service.cc +++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -245,9 +245,13 @@ } // Try to fetch the favicon from a Google favicon server. + // TODO(jkrcal): Currently used only for Articles for you which have public + // URLs. Let the provider decide whether |publisher_url| may be private or + // not. large_icon_service_ ->GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( publisher_url, minimum_size_in_pixel, desired_size_in_pixel, + /*may_page_url_be_private=*/false, base::Bind( &ContentSuggestionsService::OnGetFaviconFromGoogleServerFinished, base::Unretained(this), publisher_url, minimum_size_in_pixel,
diff --git a/components/ntp_tiles/icon_cacher_impl.cc b/components/ntp_tiles/icon_cacher_impl.cc index 4c900c5..015685fa 100644 --- a/components/ntp_tiles/icon_cacher_impl.cc +++ b/components/ntp_tiles/icon_cacher_impl.cc
@@ -219,6 +219,7 @@ large_icon_service_ ->GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( page_url, kTileIconMinSizePx, kTileIconDesiredSizePx, + /*may_page_url_be_private=*/true, base::Bind(&IconCacherImpl::OnMostLikelyFaviconDownloaded, weak_ptr_factory_.GetWeakPtr(), page_url)); }
diff --git a/content/browser/renderer_host/frame_sink_provider_impl.h b/content/browser/renderer_host/frame_sink_provider_impl.h index 7823a6e5..29b19c4 100644 --- a/content/browser/renderer_host/frame_sink_provider_impl.h +++ b/content/browser/renderer_host/frame_sink_provider_impl.h
@@ -11,8 +11,7 @@ namespace content { // This class lives in the browser and provides MojoCompositorFrameSink for the -// renderer. To access this class in the renderer, call: -// RenderThreadImpl::current()->GetFrameSinkProvider(). +// renderer. class FrameSinkProviderImpl : public mojom::FrameSinkProvider { public: explicit FrameSinkProviderImpl(int32_t process_id);
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 17f8094..a240fa2 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -17,7 +17,7 @@ #include "content/public/common/content_switches.h" #include "media/base/media_switches.h" #include "services/device/public/cpp/device_features.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h"
diff --git a/content/child/service_worker/web_service_worker_impl.cc b/content/child/service_worker/web_service_worker_impl.cc index 9852ee4..3536d7c4 100644 --- a/content/child/service_worker/web_service_worker_impl.cc +++ b/content/child/service_worker/web_service_worker_impl.cc
@@ -14,10 +14,10 @@ #include "content/child/thread_safe_sender.h" #include "content/child/webmessageportchannel_impl.h" #include "content/common/service_worker/service_worker_messages.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProxy.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" using blink::WebMessagePortChannel; using blink::WebMessagePortChannelArray;
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 539ed1f..9b64e40 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -61,10 +61,10 @@ #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallback.h" #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebSelection.h" #include "ui/gfx/switches.h" #include "ui/gl/gl_switches.h"
diff --git a/content/renderer/gpu/renderer_compositor_frame_sink.cc b/content/renderer/gpu/renderer_compositor_frame_sink.cc index 6409c54..9e7dd131 100644 --- a/content/renderer/gpu/renderer_compositor_frame_sink.cc +++ b/content/renderer/gpu/renderer_compositor_frame_sink.cc
@@ -33,6 +33,8 @@ scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, cc::SharedBitmapManager* shared_bitmap_manager, + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info, + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue) : CompositorFrameSink(std::move(context_provider), std::move(worker_context_provider), @@ -48,18 +50,21 @@ ? nullptr : base::MakeUnique<cc::ExternalBeginFrameSource>(this)), routing_id_(routing_id), + sink_info_(std::move(sink_info)), + sink_client_request_(std::move(sink_client_request)), sink_client_binding_(this) { DCHECK(compositor_frame_sink_filter_); DCHECK(frame_swap_message_queue_); DCHECK(message_sender_); thread_checker_.DetachFromThread(); - EstablishMojoConnection(); } RendererCompositorFrameSink::RendererCompositorFrameSink( int32_t routing_id, std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source, scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info, + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue) : CompositorFrameSink(std::move(vulkan_context_provider)), compositor_frame_sink_filter_( @@ -72,12 +77,13 @@ ? nullptr : base::MakeUnique<cc::ExternalBeginFrameSource>(this)), routing_id_(routing_id), + sink_info_(std::move(sink_info)), + sink_client_request_(std::move(sink_client_request)), sink_client_binding_(this) { DCHECK(compositor_frame_sink_filter_); DCHECK(frame_swap_message_queue_); DCHECK(message_sender_); thread_checker_.DetachFromThread(); - EstablishMojoConnection(); } RendererCompositorFrameSink::~RendererCompositorFrameSink() = default; @@ -88,7 +94,7 @@ if (!cc::CompositorFrameSink::BindToClient(client)) return false; - sink_.Bind(std::move(sink_ptr_info_)); + sink_.Bind(std::move(sink_info_)); sink_client_binding_.Bind(std::move(sink_client_request_)); if (synthetic_begin_frame_source_) @@ -196,15 +202,4 @@ sink_->SetNeedsBeginFrame(needs_begin_frames); } -void RendererCompositorFrameSink::EstablishMojoConnection() { - cc::mojom::MojoCompositorFrameSinkPtr sink; - cc::mojom::MojoCompositorFrameSinkRequest sink_request = - mojo::MakeRequest(&sink); - cc::mojom::MojoCompositorFrameSinkClientPtr sink_client; - sink_client_request_ = mojo::MakeRequest(&sink_client); - RenderThreadImpl::current()->GetFrameSinkProvider()->CreateForWidget( - routing_id_, std::move(sink_request), std::move(sink_client)); - sink_ptr_info_ = sink.PassInterface(); -} - } // namespace content
diff --git a/content/renderer/gpu/renderer_compositor_frame_sink.h b/content/renderer/gpu/renderer_compositor_frame_sink.h index eff7605..e80c047d 100644 --- a/content/renderer/gpu/renderer_compositor_frame_sink.h +++ b/content/renderer/gpu/renderer_compositor_frame_sink.h
@@ -58,12 +58,16 @@ scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, cc::SharedBitmapManager* shared_bitmap_manager, + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info, + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); RendererCompositorFrameSink( int32_t routing_id, std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source, scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info, + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue); ~RendererCompositorFrameSink() override; @@ -106,8 +110,6 @@ // cc::ExternalBeginFrameSourceClient implementation. void OnNeedsBeginFrames(bool need_begin_frames) override; - void EstablishMojoConnection(); - scoped_refptr<CompositorForwardingMessageFilter> compositor_frame_sink_filter_; CompositorForwardingMessageFilter::Handler @@ -126,7 +128,7 @@ base::ThreadChecker thread_checker_; cc::mojom::MojoCompositorFrameSinkPtr sink_; - cc::mojom::MojoCompositorFrameSinkPtrInfo sink_ptr_info_; + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info_; cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request_; mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> sink_client_binding_; };
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 1add34ed..302684e 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -160,6 +160,7 @@ #include "third_party/WebKit/public/platform/WebImageGenerator.h" #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebThread.h" #include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h" @@ -168,7 +169,6 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebScriptController.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h" #include "third_party/WebKit/public/web/WebView.h" @@ -1920,15 +1920,24 @@ } #endif + cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info; + cc::mojom::MojoCompositorFrameSinkRequest sink_request = + mojo::MakeRequest(&sink_info); + cc::mojom::MojoCompositorFrameSinkClientPtr client; + cc::mojom::MojoCompositorFrameSinkClientRequest client_request = + mojo::MakeRequest(&client); + if (command_line.HasSwitch(switches::kEnableVulkan)) { scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = cc::VulkanInProcessContextProvider::Create(); if (vulkan_context_provider) { DCHECK(!layout_test_mode()); + frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), + std::move(client)); callback.Run(base::MakeUnique<RendererCompositorFrameSink>( routing_id, std::move(synthetic_begin_frame_source), - std::move(vulkan_context_provider), - std::move(frame_swap_message_queue))); + std::move(vulkan_context_provider), std::move(sink_info), + std::move(client_request), std::move(frame_swap_message_queue))); return; } } @@ -1951,9 +1960,12 @@ if (use_software) { DCHECK(!layout_test_mode()); + frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), + std::move(client)); callback.Run(base::MakeUnique<RendererCompositorFrameSink>( routing_id, std::move(synthetic_begin_frame_source), nullptr, nullptr, - nullptr, shared_bitmap_manager(), std::move(frame_swap_message_queue))); + nullptr, shared_bitmap_manager(), std::move(sink_info), + std::move(client_request), std::move(frame_swap_message_queue))); return; } @@ -2020,11 +2032,13 @@ return; } #endif + frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), + std::move(client)); callback.Run(base::WrapUnique(new RendererCompositorFrameSink( routing_id, std::move(synthetic_begin_frame_source), std::move(context_provider), std::move(worker_context_provider), - GetGpuMemoryBufferManager(), nullptr, - std::move(frame_swap_message_queue)))); + GetGpuMemoryBufferManager(), nullptr, std::move(sink_info), + std::move(client_request), std::move(frame_swap_message_queue)))); } AssociatedInterfaceRegistry*
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index b2734508..7aa12c86 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -510,10 +510,6 @@ return needs_to_record_first_active_paint_; } - mojom::FrameSinkProvider* GetFrameSinkProvider() { - return frame_sink_provider_.get(); - } - protected: RenderThreadImpl( const InProcessChildThreadParams& params,
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 31fdebd..54fb6f8 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -66,6 +66,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebData.h" #include "third_party/WebKit/public/platform/WebHTTPBody.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" @@ -77,7 +78,6 @@ #include "third_party/WebKit/public/web/WebInputMethodController.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebPerformance.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebScriptSource.h" #include "third_party/WebKit/public/web/WebSettings.h" #include "third_party/WebKit/public/web/WebView.h"
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index da0189f5..e2674a7 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -121,6 +121,7 @@ #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" #include "third_party/WebKit/public/platform/WebPoint.h" #include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -157,7 +158,6 @@ #include "third_party/WebKit/public/web/WebPluginAction.h" #include "third_party/WebKit/public/web/WebRange.h" #include "third_party/WebKit/public/web/WebRenderTheme.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebScriptSource.h" #include "third_party/WebKit/public/web/WebSearchableFormData.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index e7c9601..6c5e6d5 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -75,6 +75,7 @@ #include "third_party/WebKit/public/platform/WebMouseEvent.h" #include "third_party/WebKit/public/platform/WebPoint.h" #include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/scheduler/renderer/render_widget_scheduling_state.h" @@ -88,7 +89,6 @@ #include "third_party/WebKit/public/web/WebPagePopup.h" #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" #include "third_party/WebKit/public/web/WebRange.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebView.h" #include "third_party/WebKit/public/web/WebWidget.h" #include "third_party/skia/include/core/SkShader.h"
diff --git a/content/renderer/renderer_main_platform_delegate_win.cc b/content/renderer/renderer_main_platform_delegate_win.cc index 46a15548..0f08e5c7 100644 --- a/content/renderer/renderer_main_platform_delegate_win.cc +++ b/content/renderer/renderer_main_platform_delegate_win.cc
@@ -21,7 +21,7 @@ #include "content/public/renderer/render_thread.h" #include "content/renderer/render_thread_impl.h" #include "sandbox/win/src/sandbox.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/win/WebFontRendering.h" #include "third_party/icu/source/i18n/unicode/timezone.h" #include "third_party/skia/include/ports/SkTypeface_win.h"
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 340bf70..bf0ffca 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
@@ -35,11 +35,11 @@ #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" #include "third_party/WebKit/public/web/WebFrameWidget.h" #include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebPluginParams.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebTestingSupport.h" #include "third_party/WebKit/public/web/WebView.h" #include "ui/gfx/icc_profile.h"
diff --git a/content/test/blink_test_environment.cc b/content/test/blink_test_environment.cc index 9530521..051dc2e2 100644 --- a/content/test/blink_test_environment.cc +++ b/content/test/blink_test_environment.cc
@@ -18,8 +18,8 @@ #include "content/public/test/test_content_client_initializer.h" #include "content/test/test_blink_web_unit_test_support.h" #include "third_party/WebKit/public/platform/WebCache.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "url/url_util.h" #if defined(OS_WIN)
diff --git a/content/test/fuzzer/fuzzer_support.cc b/content/test/fuzzer/fuzzer_support.cc index 6d6e923a0..b46e295b 100644 --- a/content/test/fuzzer/fuzzer_support.cc +++ b/content/test/fuzzer/fuzzer_support.cc
@@ -12,8 +12,8 @@ #include "content/renderer/render_view_impl.h" #include "content/test/test_render_frame.h" #include "gin/v8_initializer.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" namespace content {
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc index 74d675f..7150daf1 100644 --- a/content/test/test_blink_web_unit_test_support.cc +++ b/content/test/test_blink_web_unit_test_support.cc
@@ -32,13 +32,13 @@ #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebThread.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h" #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "v8/include/v8.h" #if defined(OS_MACOSX)
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index b6d2d4f..e3abfd9 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -369,9 +369,15 @@ deps += [ "//extensions/shell:app_shell" ] } if (is_chromeos) { - sources += [ "api/virtual_keyboard/virtual_keyboard_apitest.cc" ] + sources += [ + "api/media_perception_private/media_perception_private_apitest.cc", + "api/virtual_keyboard/virtual_keyboard_apitest.cc", + ] - deps += [ "//chromeos" ] + deps += [ + "//chromeos", + "//chromeos:media_perception_proto", + ] } } @@ -511,9 +517,14 @@ if (is_chromeos) { sources += [ "api/audio/audio_device_id_calculator_unittest.cc", + "api/media_perception_private/conversion_utils_unittest.cc", + "api/media_perception_private/media_perception_api_manager_unittest.cc", "api/webcam_private/visca_webcam_unittest.cc", ] - deps += [ "//chromeos:test_support" ] + deps += [ + "//chromeos:media_perception_proto", + "//chromeos:test_support", + ] } }
diff --git a/extensions/browser/api/BUILD.gn b/extensions/browser/api/BUILD.gn index caf551d..b17d2e2 100644 --- a/extensions/browser/api/BUILD.gn +++ b/extensions/browser/api/BUILD.gn
@@ -106,6 +106,10 @@ if (is_chromeos) { sources += [ + "media_perception_private/conversion_utils.cc", + "media_perception_private/conversion_utils.h", + "media_perception_private/media_perception_api_manager.cc", + "media_perception_private/media_perception_api_manager.h", "media_perception_private/media_perception_private_api.cc", "media_perception_private/media_perception_private_api.h", ] @@ -119,7 +123,10 @@ "//extensions/browser/api/webcam_private", ] - deps += [ "//chromeos" ] + deps += [ + "//chromeos", + "//chromeos:media_perception_proto", + ] } }
diff --git a/extensions/browser/api/media_perception_private/conversion_utils.cc b/extensions/browser/api/media_perception_private/conversion_utils.cc new file mode 100644 index 0000000..ea303fc5 --- /dev/null +++ b/extensions/browser/api/media_perception_private/conversion_utils.cc
@@ -0,0 +1,248 @@ +// 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 "extensions/browser/api/media_perception_private/conversion_utils.h" + +#include "base/memory/ptr_util.h" + +namespace extensions { +namespace api { +namespace media_perception_private { + +namespace { + +std::unique_ptr<Point> PointProtoToIdl(const mri::Point& point) { + std::unique_ptr<Point> point_result = base::MakeUnique<Point>(); + if (point.has_x()) + point_result->x = base::MakeUnique<double>(point.x()); + + if (point.has_y()) + point_result->y = base::MakeUnique<double>(point.y()); + + return point_result; +} + +std::unique_ptr<BoundingBox> BoundingBoxProtoToIdl( + const mri::BoundingBox& bounding_box) { + std::unique_ptr<BoundingBox> bounding_box_result = + base::MakeUnique<BoundingBox>(); + if (bounding_box.has_normalized()) { + bounding_box_result->normalized = + base::MakeUnique<bool>(bounding_box.normalized()); + } + + if (bounding_box.has_top_left()) + bounding_box_result->top_left = PointProtoToIdl(bounding_box.top_left()); + + if (bounding_box.has_bottom_right()) { + bounding_box_result->bottom_right = + PointProtoToIdl(bounding_box.bottom_right()); + } + + return bounding_box_result; +} + +EntityType EntityTypeProtoToIdl(const mri::Entity& entity) { + if (entity.has_type()) { + switch (entity.type()) { + case mri::Entity::FACE: + return ENTITY_TYPE_FACE; + case mri::Entity::PERSON: + return ENTITY_TYPE_PERSON; + case mri::Entity::UNSPECIFIED: + return ENTITY_TYPE_UNSPECIFIED; + } + NOTREACHED() << "Unknown entity type: " << entity.type(); + } + return ENTITY_TYPE_UNSPECIFIED; +} + +Entity EntityProtoToIdl(const mri::Entity& entity) { + Entity entity_result; + if (entity.has_id()) + entity_result.id = base::MakeUnique<int>(entity.id()); + + entity_result.type = EntityTypeProtoToIdl(entity); + if (entity.has_confidence()) + entity_result.confidence = base::MakeUnique<double>(entity.confidence()); + + if (entity.has_bounding_box()) + entity_result.bounding_box = BoundingBoxProtoToIdl(entity.bounding_box()); + + return entity_result; +} + +FramePerception FramePerceptionProtoToIdl( + const mri::FramePerception& frame_perception) { + FramePerception frame_perception_result; + if (frame_perception.has_frame_id()) { + frame_perception_result.frame_id = + base::MakeUnique<int>(frame_perception.frame_id()); + } + if (frame_perception.has_frame_width_in_px()) { + frame_perception_result.frame_width_in_px = + base::MakeUnique<int>(frame_perception.frame_width_in_px()); + } + if (frame_perception.has_frame_height_in_px()) { + frame_perception_result.frame_height_in_px = + base::MakeUnique<int>(frame_perception.frame_height_in_px()); + } + if (frame_perception.has_timestamp()) { + frame_perception_result.timestamp = + base::MakeUnique<double>(frame_perception.timestamp()); + } + if (frame_perception.entity_size() > 0) { + frame_perception_result.entities = base::MakeUnique<std::vector<Entity>>(); + for (const auto& entity : frame_perception.entity()) + frame_perception_result.entities->emplace_back(EntityProtoToIdl(entity)); + } + return frame_perception_result; +} + +ImageFormat ImageFormatProtoToIdl(const mri::ImageFrame& image_frame) { + if (image_frame.has_format()) { + switch (image_frame.format()) { + case mri::ImageFrame::RGB: + return IMAGE_FORMAT_RAW; + case mri::ImageFrame::PNG: + return IMAGE_FORMAT_PNG; + case mri::ImageFrame::JPEG: + return IMAGE_FORMAT_JPEG; + case mri::ImageFrame::FORMAT_UNSPECIFIED: + return IMAGE_FORMAT_NONE; + } + NOTREACHED() << "Unknown image format: " << image_frame.format(); + } + return IMAGE_FORMAT_NONE; +} + +ImageFrame ImageFrameProtoToIdl(const mri::ImageFrame& image_frame) { + ImageFrame image_frame_result; + if (image_frame.has_width()) + image_frame_result.width = base::MakeUnique<int>(image_frame.width()); + + if (image_frame.has_height()) + image_frame_result.height = base::MakeUnique<int>(image_frame.height()); + + if (image_frame.has_data_length()) { + image_frame_result.data_length = + base::MakeUnique<int>(image_frame.data_length()); + } + + if (image_frame.has_pixel_data()) { + image_frame_result.frame = base::MakeUnique<std::vector<char>>( + image_frame.pixel_data().begin(), image_frame.pixel_data().end()); + } + + image_frame_result.format = ImageFormatProtoToIdl(image_frame); + return image_frame_result; +} + +PerceptionSample PerceptionSampleProtoToIdl( + const mri::PerceptionSample& perception_sample) { + PerceptionSample perception_sample_result; + if (perception_sample.has_frame_perception()) { + perception_sample_result.frame_perception = + base::MakeUnique<FramePerception>( + FramePerceptionProtoToIdl(perception_sample.frame_perception())); + } + if (perception_sample.has_image_frame()) { + perception_sample_result.image_frame = base::MakeUnique<ImageFrame>( + ImageFrameProtoToIdl(perception_sample.image_frame())); + } + return perception_sample_result; +} + +Status StateStatusProtoToIdl(const mri::State& state) { + switch (state.status()) { + case mri::State::UNINITIALIZED: + return STATUS_UNINITIALIZED; + case mri::State::STARTED: + return STATUS_STARTED; + case mri::State::RUNNING: + return STATUS_RUNNING; + case mri::State::SUSPENDED: + return STATUS_SUSPENDED; + case mri::State::STATUS_UNSPECIFIED: + return STATUS_NONE; + } + NOTREACHED() << "Reached status not in switch."; + return STATUS_NONE; +} + +mri::State::Status StateStatusIdlToProto(const State& state) { + switch (state.status) { + case STATUS_UNINITIALIZED: + return mri::State::UNINITIALIZED; + case STATUS_STARTED: + return mri::State::STARTED; + case STATUS_RUNNING: + return mri::State::RUNNING; + case STATUS_SUSPENDED: + return mri::State::SUSPENDED; + case STATUS_NONE: + return mri::State::STATUS_UNSPECIFIED; + } + NOTREACHED() << "Reached status not in switch."; + return mri::State::STATUS_UNSPECIFIED; +} + +} // namespace + +State StateProtoToIdl(const mri::State& state) { + State state_result; + if (state.has_status()) { + state_result.status = StateStatusProtoToIdl(state); + } + if (state.has_device_context()) { + state_result.device_context = + base::MakeUnique<std::string>(state.device_context()); + } + return state_result; +} + +mri::State StateIdlToProto(const State& state) { + mri::State state_result; + state_result.set_status(StateStatusIdlToProto(state)); + if (state.device_context) + state_result.set_device_context(*state.device_context); + + return state_result; +} + +MediaPerception MediaPerceptionProtoToIdl( + const mri::MediaPerception& media_perception) { + MediaPerception media_perception_result; + if (media_perception.has_timestamp()) { + media_perception_result.timestamp = + base::MakeUnique<double>(media_perception.timestamp()); + } + + if (media_perception.frame_perception_size() > 0) { + media_perception_result.frame_perceptions = + base::MakeUnique<std::vector<FramePerception>>(); + for (const auto& frame_perception : media_perception.frame_perception()) { + media_perception_result.frame_perceptions->emplace_back( + FramePerceptionProtoToIdl(frame_perception)); + } + } + return media_perception_result; +} + +Diagnostics DiagnosticsProtoToIdl(const mri::Diagnostics& diagnostics) { + Diagnostics diagnostics_result; + if (diagnostics.perception_sample_size() > 0) { + diagnostics_result.perception_samples = + base::MakeUnique<std::vector<PerceptionSample>>(); + for (const auto& perception_sample : diagnostics.perception_sample()) { + diagnostics_result.perception_samples->emplace_back( + PerceptionSampleProtoToIdl(perception_sample)); + } + } + return diagnostics_result; +} + +} // namespace media_perception_private +} // namespace api +} // namespace extensions
diff --git a/extensions/browser/api/media_perception_private/conversion_utils.h b/extensions/browser/api/media_perception_private/conversion_utils.h new file mode 100644 index 0000000..a2e97fa --- /dev/null +++ b/extensions/browser/api/media_perception_private/conversion_utils.h
@@ -0,0 +1,36 @@ +// 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 EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_CONVERSION_UTILS_H_ +#define EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_CONVERSION_UTILS_H_ + +#include "chromeos/media_perception/media_perception.pb.h" +#include "extensions/common/api/media_perception_private.h" + +namespace extensions { +namespace api { +namespace media_perception_private { + +// Converts State proto messages to State objects (generated by the +// media_perception_private.idl). +State StateProtoToIdl(const mri::State& state); + +// Converts State objects (generated by the media_perception_private.idl) to +// State proto messages. +mri::State StateIdlToProto(const State& state); + +// Converts MediaPerception proto messages to MediaPerception objects +// (generated by the media_perception_private.idl). +MediaPerception MediaPerceptionProtoToIdl( + const mri::MediaPerception& media_perception); + +// Converts Diagnostics proto messages to Diagnostics objects (generated by the +// media_perception_private.idl). +Diagnostics DiagnosticsProtoToIdl(const mri::Diagnostics& diagnostics); + +} // namespace media_perception_private +} // namespace api +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_CONVERSION_UTILS_H_
diff --git a/extensions/browser/api/media_perception_private/conversion_utils_unittest.cc b/extensions/browser/api/media_perception_private/conversion_utils_unittest.cc new file mode 100644 index 0000000..0c3aa0f --- /dev/null +++ b/extensions/browser/api/media_perception_private/conversion_utils_unittest.cc
@@ -0,0 +1,208 @@ +// 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 "extensions/browser/api/media_perception_private/conversion_utils.h" + +#include "base/memory/ptr_util.h" +#include "chromeos/media_perception/media_perception.pb.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media_perception = extensions::api::media_perception_private; + +namespace extensions { + +namespace { + +const char kTestDeviceContext[] = "Video camera"; + +void InitializeFakeFramePerception(const int index, + mri::FramePerception* frame_perception) { + frame_perception->set_frame_id(index); + frame_perception->set_frame_width_in_px(3); + frame_perception->set_frame_height_in_px(4); + frame_perception->set_timestamp(5); + + mri::Entity* entity_one = frame_perception->add_entity(); + entity_one->set_id(6); + entity_one->set_type(mri::Entity::FACE); + entity_one->set_confidence(7); + + mri::Entity* e_two = frame_perception->add_entity(); + e_two->set_id(8); + e_two->set_type(mri::Entity::PERSON); + e_two->set_confidence(9); + + mri::BoundingBox* bounding_box_one = entity_one->mutable_bounding_box(); + bounding_box_one->mutable_top_left()->set_x(10); + bounding_box_one->mutable_top_left()->set_y(11); + bounding_box_one->mutable_bottom_right()->set_x(12); + bounding_box_one->mutable_bottom_right()->set_y(13); + bounding_box_one->set_normalized(false); + + mri::BoundingBox* bounding_box_two = e_two->mutable_bounding_box(); + bounding_box_two->mutable_top_left()->set_x(14); + bounding_box_two->mutable_top_left()->set_y(15); + bounding_box_two->set_normalized(true); +} + +void ValidateFramePerceptionResult( + const int index, + const media_perception::FramePerception& frame_perception_result) { + ASSERT_TRUE(frame_perception_result.frame_id); + EXPECT_EQ(*frame_perception_result.frame_id, index); + ASSERT_TRUE(frame_perception_result.frame_width_in_px); + EXPECT_EQ(*frame_perception_result.frame_width_in_px, 3); + ASSERT_TRUE(frame_perception_result.frame_height_in_px); + EXPECT_EQ(*frame_perception_result.frame_height_in_px, 4); + ASSERT_TRUE(frame_perception_result.timestamp); + EXPECT_EQ(*frame_perception_result.timestamp, 5); + + ASSERT_EQ(2u, frame_perception_result.entities->size()); + const media_perception::Entity& entity_result_one = + frame_perception_result.entities->at(0); + ASSERT_TRUE(entity_result_one.id); + EXPECT_EQ(*entity_result_one.id, 6); + ASSERT_TRUE(entity_result_one.confidence); + EXPECT_EQ(*entity_result_one.confidence, 7); + EXPECT_EQ(entity_result_one.type, media_perception::ENTITY_TYPE_FACE); + + const media_perception::Entity& entity_result_two = + frame_perception_result.entities->at(1); + ASSERT_TRUE(entity_result_two.id); + EXPECT_EQ(*entity_result_two.id, 8); + ASSERT_TRUE(entity_result_two.confidence); + EXPECT_EQ(*entity_result_two.confidence, 9); + EXPECT_EQ(entity_result_two.type, media_perception::ENTITY_TYPE_PERSON); + + const media_perception::BoundingBox* bounding_box_result_one = + entity_result_one.bounding_box.get(); + ASSERT_TRUE(bounding_box_result_one); + ASSERT_TRUE(bounding_box_result_one->top_left); + ASSERT_TRUE(bounding_box_result_one->top_left->x); + EXPECT_EQ(*bounding_box_result_one->top_left->x, 10); + ASSERT_TRUE(bounding_box_result_one->top_left->y); + EXPECT_EQ(*bounding_box_result_one->top_left->y, 11); + ASSERT_TRUE(bounding_box_result_one->bottom_right); + ASSERT_TRUE(bounding_box_result_one->bottom_right->x); + EXPECT_EQ(*bounding_box_result_one->bottom_right->x, 12); + ASSERT_TRUE(bounding_box_result_one->bottom_right->y); + EXPECT_EQ(*bounding_box_result_one->bottom_right->y, 13); + EXPECT_FALSE(*bounding_box_result_one->normalized); + + const media_perception::BoundingBox* bounding_box_result_two = + entity_result_two.bounding_box.get(); + ASSERT_TRUE(bounding_box_result_two); + ASSERT_TRUE(bounding_box_result_two->top_left); + EXPECT_EQ(*bounding_box_result_two->top_left->x, 14); + EXPECT_EQ(*bounding_box_result_two->top_left->y, 15); + EXPECT_FALSE(bounding_box_result_two->bottom_right); + EXPECT_TRUE(*bounding_box_result_two->normalized); +} + +void InitializeFakeImageFrameData(mri::ImageFrame* image_frame) { + image_frame->set_width(1); + image_frame->set_height(2); + image_frame->set_data_length(3); + image_frame->set_pixel_data(" "); + image_frame->set_format(mri::ImageFrame::JPEG); +} + +void ValidateFakeImageFrameData( + const media_perception::ImageFrame& image_frame_result) { + ASSERT_TRUE(image_frame_result.width); + EXPECT_EQ(*image_frame_result.width, 1); + ASSERT_TRUE(image_frame_result.height); + EXPECT_EQ(*image_frame_result.height, 2); + ASSERT_TRUE(image_frame_result.data_length); + EXPECT_EQ(*image_frame_result.data_length, 3); + ASSERT_TRUE(image_frame_result.frame); + EXPECT_EQ((*image_frame_result.frame).size(), 4ul); + EXPECT_EQ(image_frame_result.format, media_perception::IMAGE_FORMAT_JPEG); +} + +} // namespace + +// Verifies that the data is converted successfully and as expected in each of +// these cases. + +TEST(MediaPerceptionConversionUtilsTest, MediaPerceptionProtoToIdl) { + const int kFrameId = 2; + mri::MediaPerception media_perception; + // Fill in fake values for the media_perception proto. + media_perception.set_timestamp(1); + mri::FramePerception* frame_perception = + media_perception.add_frame_perception(); + InitializeFakeFramePerception(kFrameId, frame_perception); + media_perception::MediaPerception media_perception_result = + media_perception::MediaPerceptionProtoToIdl(media_perception); + EXPECT_EQ(*media_perception_result.timestamp, 1); + ASSERT_TRUE(media_perception_result.frame_perceptions); + ASSERT_EQ(1u, media_perception_result.frame_perceptions->size()); + ValidateFramePerceptionResult( + kFrameId, media_perception_result.frame_perceptions->at(0)); +} + +TEST(MediaPerceptionConversionUtilsTest, DiagnosticsProtoToIdl) { + const size_t kNumSamples = 3; + mri::Diagnostics diagnostics; + for (size_t i = 0; i < kNumSamples; i++) { + mri::PerceptionSample* perception_sample = + diagnostics.add_perception_sample(); + mri::FramePerception* frame_perception = + perception_sample->mutable_frame_perception(); + InitializeFakeFramePerception(i, frame_perception); + mri::ImageFrame* image_frame = perception_sample->mutable_image_frame(); + InitializeFakeImageFrameData(image_frame); + } + media_perception::Diagnostics diagnostics_result = + media_perception::DiagnosticsProtoToIdl(diagnostics); + ASSERT_EQ(kNumSamples, diagnostics_result.perception_samples->size()); + for (size_t i = 0; i < kNumSamples; i++) { + SCOPED_TRACE(testing::Message() << "Sample number: " << i); + const media_perception::PerceptionSample& perception_sample_result = + diagnostics_result.perception_samples->at(i); + + const media_perception::FramePerception* frame_perception_result = + perception_sample_result.frame_perception.get(); + ASSERT_TRUE(frame_perception_result); + + const media_perception::ImageFrame* image_frame_result = + perception_sample_result.image_frame.get(); + ASSERT_TRUE(image_frame_result); + + ValidateFramePerceptionResult(i, *frame_perception_result); + ValidateFakeImageFrameData(*image_frame_result); + } +} + +TEST(MediaPerceptionConversionUtilsTest, StateProtoToIdl) { + mri::State state; + state.set_status(mri::State::RUNNING); + media_perception::State state_result = + media_perception::StateProtoToIdl(state); + EXPECT_EQ(state_result.status, media_perception::STATUS_RUNNING); + + state.set_status(mri::State::STARTED); + state.set_device_context(kTestDeviceContext); + state_result = media_perception::StateProtoToIdl(state); + EXPECT_EQ(state_result.status, media_perception::STATUS_STARTED); + ASSERT_TRUE(state_result.device_context); + EXPECT_EQ(*state_result.device_context, kTestDeviceContext); +} + +TEST(MediaPerceptionConversionUtilsTest, StateIdlToProto) { + media_perception::State state; + state.status = media_perception::STATUS_UNINITIALIZED; + mri::State state_proto = StateIdlToProto(state); + EXPECT_EQ(state_proto.status(), mri::State::UNINITIALIZED); + EXPECT_FALSE(state_proto.has_device_context()); + + state.status = media_perception::STATUS_SUSPENDED; + state.device_context = base::MakeUnique<std::string>(kTestDeviceContext); + state_proto = StateIdlToProto(state); + EXPECT_EQ(state_proto.status(), mri::State::SUSPENDED); + EXPECT_EQ(state_proto.device_context(), kTestDeviceContext); +} + +} // namespace extensions
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager.cc b/extensions/browser/api/media_perception_private/media_perception_api_manager.cc new file mode 100644 index 0000000..e071e5c --- /dev/null +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager.cc
@@ -0,0 +1,180 @@ +// 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 "extensions/browser/api/media_perception_private/media_perception_api_manager.h" + +#include "base/lazy_instance.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/upstart_client.h" +#include "extensions/browser/api/media_perception_private/conversion_utils.h" +#include "extensions/browser/event_router.h" +#include "extensions/browser/extension_function.h" + +namespace media_perception = extensions::api::media_perception_private; + +namespace extensions { + +// static +MediaPerceptionAPIManager* MediaPerceptionAPIManager::Get( + content::BrowserContext* context) { + return GetFactoryInstance()->Get(context); +} + +static base::LazyInstance< + BrowserContextKeyedAPIFactory<MediaPerceptionAPIManager>>::Leaky g_factory = + LAZY_INSTANCE_INITIALIZER; + +// static +BrowserContextKeyedAPIFactory<MediaPerceptionAPIManager>* +MediaPerceptionAPIManager::GetFactoryInstance() { + return g_factory.Pointer(); +} + +MediaPerceptionAPIManager::MediaPerceptionAPIManager( + content::BrowserContext* context) + : browser_context_(context), + analytics_process_state_(AnalyticsProcessState::IDLE), + weak_ptr_factory_(this) { + chromeos::MediaAnalyticsClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); + dbus_client->SetMediaPerceptionSignalHandler( + base::Bind(&MediaPerceptionAPIManager::MediaPerceptionSignalHandler, + weak_ptr_factory_.GetWeakPtr())); +} + +MediaPerceptionAPIManager::~MediaPerceptionAPIManager() { + chromeos::MediaAnalyticsClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); + dbus_client->ClearMediaPerceptionSignalHandler(); + // Stop the separate media analytics process. + chromeos::UpstartClient* upstart_client = + chromeos::DBusThreadManager::Get()->GetUpstartClient(); + upstart_client->StopMediaAnalytics(); +} + +void MediaPerceptionAPIManager::GetState(const APIStateCallback& callback) { + if (analytics_process_state_ == AnalyticsProcessState::RUNNING) { + chromeos::MediaAnalyticsClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); + dbus_client->GetState(base::Bind(&MediaPerceptionAPIManager::StateCallback, + weak_ptr_factory_.GetWeakPtr(), callback)); + return; + } + + if (analytics_process_state_ == AnalyticsProcessState::LAUNCHING) { + callback.Run(CallbackStatus::PROCESS_LAUNCHING_ERROR, + media_perception::State()); + return; + } + + // Calling getState with process not running returns State UNINITIALIZED. + media_perception::State state_uninitialized; + state_uninitialized.status = media_perception::STATUS_UNINITIALIZED; + callback.Run(CallbackStatus::SUCCESS, std::move(state_uninitialized)); +} + +void MediaPerceptionAPIManager::SetState(const media_perception::State& state, + const APIStateCallback& callback) { + mri::State state_proto = StateIdlToProto(state); + DCHECK(state_proto.status() == mri::State::RUNNING || + state_proto.status() == mri::State::SUSPENDED) + << "Cannot set state to something other than RUNNING or SUSPENDED."; + + if (analytics_process_state_ == AnalyticsProcessState::RUNNING) { + SetStateInternal(callback, state_proto); + return; + } + + if (analytics_process_state_ == AnalyticsProcessState::LAUNCHING) { + callback.Run(CallbackStatus::PROCESS_LAUNCHING_ERROR, + media_perception::State()); + return; + } + + // Analytics process is in state IDLE. + if (state_proto.status() == mri::State::RUNNING) { + analytics_process_state_ = AnalyticsProcessState::LAUNCHING; + chromeos::UpstartClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetUpstartClient(); + dbus_client->StartMediaAnalytics( + base::Bind(&MediaPerceptionAPIManager::UpstartCallback, + weak_ptr_factory_.GetWeakPtr(), callback, state_proto)); + return; + } + + callback.Run(CallbackStatus::PROCESS_IDLE_ERROR, media_perception::State()); +} + +void MediaPerceptionAPIManager::SetStateInternal( + const APIStateCallback& callback, + const mri::State& state) { + chromeos::MediaAnalyticsClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); + dbus_client->SetState(state, + base::Bind(&MediaPerceptionAPIManager::StateCallback, + weak_ptr_factory_.GetWeakPtr(), callback)); +} + +void MediaPerceptionAPIManager::GetDiagnostics( + const APIGetDiagnosticsCallback& callback) { + chromeos::MediaAnalyticsClient* dbus_client = + chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); + dbus_client->GetDiagnostics( + base::Bind(&MediaPerceptionAPIManager::GetDiagnosticsCallback, + weak_ptr_factory_.GetWeakPtr(), callback)); +} + +void MediaPerceptionAPIManager::UpstartCallback( + const APIStateCallback& callback, + const mri::State& state, + bool succeeded) { + if (!succeeded) { + analytics_process_state_ = AnalyticsProcessState::IDLE; + callback.Run(CallbackStatus::PROCESS_IDLE_ERROR, media_perception::State()); + return; + } + analytics_process_state_ = AnalyticsProcessState::RUNNING; + SetStateInternal(callback, state); +} + +void MediaPerceptionAPIManager::StateCallback(const APIStateCallback& callback, + bool succeeded, + const mri::State& state_proto) { + media_perception::State state; + if (!succeeded) { + callback.Run(CallbackStatus::DBUS_ERROR, media_perception::State()); + return; + } + callback.Run(CallbackStatus::SUCCESS, + media_perception::StateProtoToIdl(state_proto)); +} + +void MediaPerceptionAPIManager::GetDiagnosticsCallback( + const APIGetDiagnosticsCallback& callback, + bool succeeded, + const mri::Diagnostics& diagnostics_proto) { + if (!succeeded) { + callback.Run(CallbackStatus::DBUS_ERROR, media_perception::Diagnostics()); + return; + } + callback.Run(CallbackStatus::SUCCESS, + media_perception::DiagnosticsProtoToIdl(diagnostics_proto)); +} + +void MediaPerceptionAPIManager::MediaPerceptionSignalHandler( + const mri::MediaPerception& media_perception_proto) { + EventRouter* router = EventRouter::Get(browser_context_); + DCHECK(router) << "EventRouter is null."; + + media_perception::MediaPerception media_perception = + media_perception::MediaPerceptionProtoToIdl(media_perception_proto); + std::unique_ptr<Event> event( + new Event(events::MEDIA_PERCEPTION_PRIVATE_ON_MEDIA_PERCEPTION, + media_perception::OnMediaPerception::kEventName, + media_perception::OnMediaPerception::Create(media_perception))); + router->BroadcastEvent(std::move(event)); +} + +} // namespace extensions
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager.h b/extensions/browser/api/media_perception_private/media_perception_api_manager.h new file mode 100644 index 0000000..a404a0d --- /dev/null +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager.h
@@ -0,0 +1,108 @@ +// 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 EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_API_MANAGER_H_ +#define EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_API_MANAGER_H_ + +#include "base/memory/weak_ptr.h" +#include "chromeos/media_perception/media_perception.pb.h" +#include "extensions/browser/browser_context_keyed_api_factory.h" +#include "extensions/common/api/media_perception_private.h" + +namespace extensions { + +class MediaPerceptionAPIManager : public BrowserContextKeyedAPI { + public: + enum class CallbackStatus { + // Request to media analytics process was successful. + SUCCESS, + // Request to media analytics process failed at D-Bus layer. + DBUS_ERROR, + // The media analytics process is not running. + PROCESS_IDLE_ERROR, + // The media analytics process is still being launched via Upstart + // service. + PROCESS_LAUNCHING_ERROR + }; + + using APIStateCallback = base::Callback<void( + CallbackStatus status, + extensions::api::media_perception_private::State state)>; + + using APIGetDiagnosticsCallback = base::Callback<void( + CallbackStatus status, + extensions::api::media_perception_private::Diagnostics diagnostics)>; + + explicit MediaPerceptionAPIManager(content::BrowserContext* context); + ~MediaPerceptionAPIManager() override; + + // Convenience method to get the MediaPeceptionAPIManager for a + // BrowserContext. + static MediaPerceptionAPIManager* Get(content::BrowserContext* context); + + // BrowserContextKeyedAPI implementation. + static BrowserContextKeyedAPIFactory<MediaPerceptionAPIManager>* + GetFactoryInstance(); + + // Public functions for MediaPerceptionPrivateAPI implementation. + void GetState(const APIStateCallback& callback); + void SetState(const extensions::api::media_perception_private::State& state, + const APIStateCallback& callback); + void GetDiagnostics(const APIGetDiagnosticsCallback& callback); + + private: + friend class BrowserContextKeyedAPIFactory<MediaPerceptionAPIManager>; + + // BrowserContextKeyedAPI: + static const char* service_name() { return "MediaPerceptionAPIManager"; } + + enum class AnalyticsProcessState { + // The process is not running. + IDLE, + // The process has been launched via Upstart, but waiting for callback to + // confirm. + LAUNCHING, + // The process is running. + RUNNING + }; + + // Sets the state of the analytics process. + void SetStateInternal(const APIStateCallback& callback, + const mri::State& state); + + // Event handler for MediaPerception proto messages coming over D-Bus as + // signal. + void MediaPerceptionSignalHandler( + const mri::MediaPerception& media_perception); + + // Callback for State D-Bus method calls to the media analytics process. + void StateCallback(const APIStateCallback& callback, + bool succeeded, + const mri::State& state); + + // Callback for GetDiagnostics D-Bus method calls to the media analytics + // process. + void GetDiagnosticsCallback(const APIGetDiagnosticsCallback& callback, + bool succeeded, + const mri::Diagnostics& diagnostics); + + // Callback for Upstart command to start media analytics process. + void UpstartCallback(const APIStateCallback& callback, + const mri::State& state, + bool succeeded); + + content::BrowserContext* const browser_context_; + + // Keeps track of whether the analytics process is running so that it can be + // started with an Upstart D-Bus method call if necessary. + AnalyticsProcessState analytics_process_state_; + + base::WeakPtrFactory<MediaPerceptionAPIManager> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionAPIManager); +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_API_MANAGER_H_
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc b/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc new file mode 100644 index 0000000..47180d3 --- /dev/null +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc
@@ -0,0 +1,208 @@ +// 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 "extensions/browser/api/media_perception_private/media_perception_api_manager.h" + +#include <queue> + +#include "base/bind.h" +#include "base/memory/ptr_util.h" +#include "base/run_loop.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_media_analytics_client.h" +#include "chromeos/dbus/fake_upstart_client.h" +#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/upstart_client.h" +#include "content/public/test/test_browser_context.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media_perception = extensions::api::media_perception_private; + +namespace chromeos { +namespace { + +class TestUpstartClient : public FakeUpstartClient { + public: + TestUpstartClient() : enqueue_requests_(false) {} + + ~TestUpstartClient() override{}; + + // Overrides behavior to queue start requests. + void StartMediaAnalytics(const UpstartCallback& callback) override { + pending_upstart_request_callbacks_.push(callback); + if (!enqueue_requests_) { + HandleNextUpstartRequest(true); + return; + } + } + + // Triggers the next queue'd start request to succeed or fail. + bool HandleNextUpstartRequest(bool should_succeed) { + if (pending_upstart_request_callbacks_.empty()) + return false; + + UpstartCallback callback = pending_upstart_request_callbacks_.front(); + pending_upstart_request_callbacks_.pop(); + + if (!should_succeed) { + callback.Run(false); + return true; + } + + FakeUpstartClient::StartMediaAnalytics(callback); + return true; + } + + void set_enqueue_requests(bool enqueue_requests) { + enqueue_requests_ = enqueue_requests; + } + + private: + std::queue<UpstartCallback> pending_upstart_request_callbacks_; + + bool enqueue_requests_; + + DISALLOW_COPY_AND_ASSIGN(TestUpstartClient); +}; + +} // namespace +} // namespace chromeos + +namespace extensions { + +using CallbackStatus = MediaPerceptionAPIManager::CallbackStatus; + +namespace { + +void RecordStatusAndRunClosure(base::Closure quit_run_loop, + CallbackStatus* status, + CallbackStatus result_status, + media_perception::State result_state) { + *status = result_status; + quit_run_loop.Run(); +} + +CallbackStatus SetStateAndWaitForResponse( + MediaPerceptionAPIManager* manager, + const media_perception::State& state) { + base::RunLoop run_loop; + CallbackStatus status; + manager->SetState(state, base::Bind(&RecordStatusAndRunClosure, + run_loop.QuitClosure(), &status)); + run_loop.Run(); + return status; +} + +CallbackStatus GetStateAndWaitForResponse(MediaPerceptionAPIManager* manager) { + base::RunLoop run_loop; + CallbackStatus status; + manager->GetState( + base::Bind(&RecordStatusAndRunClosure, run_loop.QuitClosure(), &status)); + run_loop.Run(); + return status; +} + +} // namespace + +class MediaPerceptionAPIManagerTest : public testing::Test { + public: + MediaPerceptionAPIManagerTest() + : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) {} + + void SetUp() override { + std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = + chromeos::DBusThreadManager::GetSetterForTesting(); + auto media_analytics_client = + base::MakeUnique<chromeos::FakeMediaAnalyticsClient>(); + media_analytics_client_ = media_analytics_client.get(); + dbus_setter->SetMediaAnalyticsClient(std::move(media_analytics_client)); + + auto upstart_client = base::MakeUnique<chromeos::TestUpstartClient>(); + upstart_client_ = upstart_client.get(); + dbus_setter->SetUpstartClient(std::move(upstart_client)); + + manager_ = base::MakeUnique<MediaPerceptionAPIManager>(&browser_context_); + } + + void TearDown() override { + // Need to make sure that the MediaPerceptionAPIManager is destructed before + // the DbusThreadManager. + manager_.reset(); + chromeos::DBusThreadManager::Shutdown(); + } + + std::unique_ptr<MediaPerceptionAPIManager> manager_; + + // Ownership of both is passed on to chromeos::DbusThreadManager. + chromeos::FakeMediaAnalyticsClient* media_analytics_client_; + chromeos::TestUpstartClient* upstart_client_; + + private: + content::TestBrowserContext browser_context_; + content::TestBrowserThreadBundle thread_bundle_; + + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionAPIManagerTest); +}; + +TEST_F(MediaPerceptionAPIManagerTest, UpstartFailure) { + upstart_client_->set_enqueue_requests(true); + media_perception::State state; + state.status = media_perception::STATUS_RUNNING; + + base::RunLoop run_loop; + CallbackStatus status; + manager_->SetState(state, base::Bind(&RecordStatusAndRunClosure, + run_loop.QuitClosure(), &status)); + EXPECT_TRUE(upstart_client_->HandleNextUpstartRequest(false)); + run_loop.Run(); + EXPECT_EQ(CallbackStatus::PROCESS_IDLE_ERROR, status); + + // Check that after a failed request, setState RUNNING will go through. + upstart_client_->set_enqueue_requests(false); + EXPECT_EQ(CallbackStatus::SUCCESS, + SetStateAndWaitForResponse(manager_.get(), state)); +} + +TEST_F(MediaPerceptionAPIManagerTest, UpstartStall) { + upstart_client_->set_enqueue_requests(true); + media_perception::State state; + state.status = media_perception::STATUS_RUNNING; + + base::RunLoop run_loop; + CallbackStatus status; + manager_->SetState(state, base::Bind(&RecordStatusAndRunClosure, + run_loop.QuitClosure(), &status)); + + EXPECT_EQ(CallbackStatus::PROCESS_LAUNCHING_ERROR, + GetStateAndWaitForResponse(manager_.get())); + EXPECT_EQ(CallbackStatus::PROCESS_LAUNCHING_ERROR, + SetStateAndWaitForResponse(manager_.get(), state)); + EXPECT_TRUE(upstart_client_->HandleNextUpstartRequest(true)); + run_loop.Run(); + EXPECT_EQ(CallbackStatus::SUCCESS, status); + + // Verify that after the slow start, things works as normal. + upstart_client_->set_enqueue_requests(false); + EXPECT_EQ(CallbackStatus::SUCCESS, + GetStateAndWaitForResponse(manager_.get())); + state.status = media_perception::STATUS_SUSPENDED; + EXPECT_EQ(CallbackStatus::SUCCESS, + SetStateAndWaitForResponse(manager_.get(), state)); +} + +TEST_F(MediaPerceptionAPIManagerTest, MediaAnalyticsDbusError) { + media_perception::State state; + state.status = media_perception::STATUS_RUNNING; + EXPECT_EQ(CallbackStatus::SUCCESS, + SetStateAndWaitForResponse(manager_.get(), state)); + // Disable the functionality of the fake process. + media_analytics_client_->set_process_running(false); + EXPECT_EQ(CallbackStatus::DBUS_ERROR, + GetStateAndWaitForResponse(manager_.get())); + EXPECT_EQ(CallbackStatus::DBUS_ERROR, + SetStateAndWaitForResponse(manager_.get(), state)); +} + +} // namespace extensions
diff --git a/extensions/browser/api/media_perception_private/media_perception_private_api.cc b/extensions/browser/api/media_perception_private/media_perception_private_api.cc index daa65c1..48bb02b 100644 --- a/extensions/browser/api/media_perception_private/media_perception_private_api.cc +++ b/extensions/browser/api/media_perception_private/media_perception_private_api.cc
@@ -4,8 +4,33 @@ #include "extensions/browser/api/media_perception_private/media_perception_private_api.h" +namespace media_perception = extensions::api::media_perception_private; + namespace extensions { +using CallbackStatus = MediaPerceptionAPIManager::CallbackStatus; + +namespace { + +const char kErrorStringStatusDbusError[] = "Service is unreachable."; +const char kErrorStringStatusIdle[] = "Service is not running."; +const char kErrorStringStatusLaunching[] = "Service busy launching."; + +std::string CallbackStatusToErrorMessage(const CallbackStatus& status) { + switch (status) { + case CallbackStatus::DBUS_ERROR: + return kErrorStringStatusDbusError; + case CallbackStatus::PROCESS_IDLE_ERROR: + return kErrorStringStatusIdle; + case CallbackStatus::PROCESS_LAUNCHING_ERROR: + return kErrorStringStatusLaunching; + case CallbackStatus::SUCCESS: + return "CallbackStatus success."; + } +} + +} // namespace + MediaPerceptionPrivateGetStateFunction :: MediaPerceptionPrivateGetStateFunction() {} @@ -14,7 +39,21 @@ ExtensionFunction::ResponseAction MediaPerceptionPrivateGetStateFunction::Run() { - return RespondNow(Error("Not implemented.")); + MediaPerceptionAPIManager* manager = + MediaPerceptionAPIManager::Get(browser_context()); + manager->GetState(base::Bind( + &MediaPerceptionPrivateGetStateFunction::GetStateCallback, this)); + return RespondLater(); +} + +void MediaPerceptionPrivateGetStateFunction::GetStateCallback( + CallbackStatus status, + media_perception::State state) { + if (status != CallbackStatus::SUCCESS) { + Respond(Error(CallbackStatusToErrorMessage(status))); + return; + } + Respond(OneArgument(state.ToValue())); } MediaPerceptionPrivateSetStateFunction :: @@ -25,7 +64,38 @@ ExtensionFunction::ResponseAction MediaPerceptionPrivateSetStateFunction::Run() { - return RespondNow(Error("Not implemented.")); + std::unique_ptr<media_perception::SetState::Params> params = + media_perception::SetState::Params::Create(*args_); + EXTENSION_FUNCTION_VALIDATE(params.get()); + if (params->state.status != media_perception::STATUS_RUNNING && + params->state.status != media_perception::STATUS_SUSPENDED) { + return RespondNow( + Error("Status can only be set to RUNNING and SUSPENDED.")); + } + + // Check that device context is only provided with SetState RUNNING. + if (params->state.status != media_perception::STATUS_RUNNING && + params->state.device_context.get() != nullptr) { + return RespondNow( + Error("Only provide deviceContext with SetState RUNNING.")); + } + MediaPerceptionAPIManager* manager = + MediaPerceptionAPIManager::Get(browser_context()); + manager->SetState( + params->state, + base::Bind(&MediaPerceptionPrivateSetStateFunction::SetStateCallback, + this)); + return RespondLater(); +} + +void MediaPerceptionPrivateSetStateFunction::SetStateCallback( + CallbackStatus status, + media_perception::State state) { + if (status != CallbackStatus::SUCCESS) { + Respond(Error(CallbackStatusToErrorMessage(status))); + return; + } + Respond(OneArgument(state.ToValue())); } MediaPerceptionPrivateGetDiagnosticsFunction :: @@ -36,7 +106,22 @@ ExtensionFunction::ResponseAction MediaPerceptionPrivateGetDiagnosticsFunction::Run() { - return RespondNow(Error("Not implemented.")); + MediaPerceptionAPIManager* manager = + MediaPerceptionAPIManager::Get(browser_context()); + manager->GetDiagnostics(base::Bind( + &MediaPerceptionPrivateGetDiagnosticsFunction::GetDiagnosticsCallback, + this)); + return RespondLater(); +} + +void MediaPerceptionPrivateGetDiagnosticsFunction::GetDiagnosticsCallback( + CallbackStatus status, + media_perception::Diagnostics diagnostics) { + if (status != CallbackStatus::SUCCESS) { + Respond(Error(CallbackStatusToErrorMessage(status))); + return; + } + Respond(OneArgument(diagnostics.ToValue())); } } // namespace extensions
diff --git a/extensions/browser/api/media_perception_private/media_perception_private_api.h b/extensions/browser/api/media_perception_private/media_perception_private_api.h index 16c57333..3528a50 100644 --- a/extensions/browser/api/media_perception_private/media_perception_private_api.h +++ b/extensions/browser/api/media_perception_private/media_perception_private_api.h
@@ -5,7 +5,9 @@ #ifndef EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_PRIVATE_API_H_ #define EXTENSIONS_BROWSER_API_MEDIA_PERCEPTION_PRIVATE_MEDIA_PERCEPTION_PRIVATE_API_H_ +#include "extensions/browser/api/media_perception_private/media_perception_api_manager.h" #include "extensions/browser/extension_function.h" +#include "extensions/common/api/media_perception_private.h" namespace extensions { @@ -22,6 +24,9 @@ // ExtensionFunction: ResponseAction Run() override; + void GetStateCallback(MediaPerceptionAPIManager::CallbackStatus status, + extensions::api::media_perception_private::State state); + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateGetStateFunction); }; @@ -38,6 +43,9 @@ // ExtensionFunction: ResponseAction Run() override; + void SetStateCallback(MediaPerceptionAPIManager::CallbackStatus status, + extensions::api::media_perception_private::State state); + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateSetStateFunction); }; @@ -54,6 +62,10 @@ // ExtensionFunction: ResponseAction Run() override; + void GetDiagnosticsCallback( + MediaPerceptionAPIManager::CallbackStatus status, + extensions::api::media_perception_private::Diagnostics diagnostics); + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateGetDiagnosticsFunction); };
diff --git a/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc b/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc new file mode 100644 index 0000000..c293bc6 --- /dev/null +++ b/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc
@@ -0,0 +1,93 @@ +// 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 "base/auto_reset.h" +#include "base/command_line.h" +#include "base/memory/ptr_util.h" +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/fake_media_analytics_client.h" +#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/media_perception/media_perception.pb.h" +#include "extensions/browser/api/media_perception_private/media_perception_private_api.h" +#include "extensions/common/features/feature_session_type.h" +#include "extensions/common/switches.h" +#include "extensions/shell/test/shell_apitest.h" +#include "extensions/test/extension_test_message_listener.h" +#include "extensions/test/result_catcher.h" + +namespace extensions { + +class MediaPerceptionPrivateApiTest : public ShellApiTest { + public: + MediaPerceptionPrivateApiTest() {} + ~MediaPerceptionPrivateApiTest() override {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + ShellApiTest::SetUpCommandLine(command_line); + // Whitelist of the extension ID of the test extension. + command_line->AppendSwitchASCII( + extensions::switches::kWhitelistedExtensionID, + "epcifkihnkjgphfkloaaleeakhpmgdmn"); + } + + void SetUpInProcessBrowserTestFixture() override { + std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = + chromeos::DBusThreadManager::GetSetterForTesting(); + auto media_analytics_client = + base::MakeUnique<chromeos::FakeMediaAnalyticsClient>(); + media_analytics_client_ = media_analytics_client.get(); + dbus_setter->SetMediaAnalyticsClient(std::move(media_analytics_client)); + } + + void SetUpOnMainThread() override { + session_feature_type_ = extensions::ScopedCurrentFeatureSessionType( + extensions::FeatureSessionType::KIOSK); + ShellApiTest::SetUpOnMainThread(); + } + + // Ownership is passed on to chromeos::DbusThreadManager. + chromeos::FakeMediaAnalyticsClient* media_analytics_client_; + + private: + std::unique_ptr<base::AutoReset<extensions::FeatureSessionType>> + session_feature_type_; + + DISALLOW_COPY_AND_ASSIGN(MediaPerceptionPrivateApiTest); +}; + +// Verify that we can set and get mediaPerception system state. +IN_PROC_BROWSER_TEST_F(MediaPerceptionPrivateApiTest, State) { + ASSERT_TRUE(RunAppTest("media_perception_private/state")) << message_; +} + +// Verify that we can request Diagnostics. +IN_PROC_BROWSER_TEST_F(MediaPerceptionPrivateApiTest, GetDiagnostics) { + // Allows us to validate that the right data comes through the code path. + mri::Diagnostics diagnostics; + diagnostics.add_perception_sample()->mutable_frame_perception()->set_frame_id( + 1); + media_analytics_client_->SetDiagnostics(diagnostics); + + ASSERT_TRUE(RunAppTest("media_perception_private/diagnostics")) << message_; +} + +// Verify that we can listen for MediaPerceptionDetection signals and handle +// them. +IN_PROC_BROWSER_TEST_F(MediaPerceptionPrivateApiTest, MediaPerception) { + extensions::ResultCatcher catcher; + catcher.RestrictToBrowserContext(browser_context()); + + ExtensionTestMessageListener handler_registered_listener( + "mediaPerceptionListenerSet", false); + ASSERT_TRUE(LoadApp("media_perception_private/media_perception")) << message_; + ASSERT_TRUE(handler_registered_listener.WaitUntilSatisfied()); + + mri::MediaPerception media_perception; + media_perception.add_frame_perception()->set_frame_id(1); + ASSERT_TRUE( + media_analytics_client_->FireMediaPerceptionEvent(media_perception)); + EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); +} + +} // namespace extensions
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 2a8a0ea..bfcf2d3d 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -101,6 +101,7 @@ #include "extensions/renderer/worker_thread_dispatcher.h" #include "gin/converter.h" #include "mojo/public/js/constants.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/web/WebCustomElement.h" @@ -108,7 +109,6 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebScopedUserGesture.h" #include "third_party/WebKit/public/web/WebScriptController.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
diff --git a/extensions/test/data/media_perception_private/diagnostics/manifest.json b/extensions/test/data/media_perception_private/diagnostics/manifest.json new file mode 100644 index 0000000..f30f4cc --- /dev/null +++ b/extensions/test/data/media_perception_private/diagnostics/manifest.json
@@ -0,0 +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. +{ + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC74Vbx3EbhPc/FOvn6+HxCjMSml0HdPMiuRjj5a3b+MnRML1iJ9OAgbKUYJ/u3s25/cGq8pNB0NbyupHGEqvqAE7TcNr1mdgs0PWxh2IOI1GKrxlzxpqzQuFmxq5WHKr5RrwZ4/Xq0t/+e8JkvhZdW0jarz/28Jom0gkM5lorsewIDAQAB", + "manifest_version": 2, + "name": "Test mediaPerceptionPrivate API's getDiagnostics function.", + "version": "1.0", + "app": { + "background": { + "scripts": ["runtest.js"] + } + }, + "permissions": ["mediaPerceptionPrivate"], + "kiosk_enabled": true +}
diff --git a/extensions/test/data/media_perception_private/diagnostics/runtest.js b/extensions/test/data/media_perception_private/diagnostics/runtest.js new file mode 100644 index 0000000..e9b247e --- /dev/null +++ b/extensions/test/data/media_perception_private/diagnostics/runtest.js
@@ -0,0 +1,26 @@ +// 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. + +chrome.test.runTests([ + function setStateRunning() { + // Need to start the mocked media analytics process. + chrome.mediaPerceptionPrivate.setState({ + status: 'RUNNING' + }, chrome.test.callbackPass(function(state) { + chrome.test.assertEq({ status: 'RUNNING' }, state); + })); + }, + function getDiagnostics() { + chrome.mediaPerceptionPrivate.getDiagnostics( + chrome.test.callbackPass(function(response) { + chrome.test.assertEq({ + perceptionSamples: [{ + framePerception: { + frameId: 1 + } + }] + }, response); + })); + } +]);
diff --git a/extensions/test/data/media_perception_private/media_perception/manifest.json b/extensions/test/data/media_perception_private/media_perception/manifest.json new file mode 100644 index 0000000..0e423b4 --- /dev/null +++ b/extensions/test/data/media_perception_private/media_perception/manifest.json
@@ -0,0 +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. +{ + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC74Vbx3EbhPc/FOvn6+HxCjMSml0HdPMiuRjj5a3b+MnRML1iJ9OAgbKUYJ/u3s25/cGq8pNB0NbyupHGEqvqAE7TcNr1mdgs0PWxh2IOI1GKrxlzxpqzQuFmxq5WHKr5RrwZ4/Xq0t/+e8JkvhZdW0jarz/28Jom0gkM5lorsewIDAQAB", + "manifest_version": 2, + "name": "Test mediaPerceptionPrivate API's MediaPerceptionDetection event listener", + "version": "1.0", + "app": { + "background": { + "scripts": ["runtest.js"] + } + }, + "permissions": ["mediaPerceptionPrivate"], + "kiosk_enabled": true +}
diff --git a/extensions/test/data/media_perception_private/media_perception/runtest.js b/extensions/test/data/media_perception_private/media_perception/runtest.js new file mode 100644 index 0000000..19cd8a7 --- /dev/null +++ b/extensions/test/data/media_perception_private/media_perception/runtest.js
@@ -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. + +// Set the state to STARTED to automatically start listening to +// MediaPerceptionDetection signals. + +chrome.test.runTests([ + function setStateRunning() { + // Need to start the mocked media analytics process. + chrome.mediaPerceptionPrivate.setState({ + status: 'RUNNING' + }, chrome.test.callbackPass(function(state) { + chrome.test.assertEq({ status: 'RUNNING' }, state); + })); + }, + function registerListener() { + chrome.test.listenOnce( + chrome.mediaPerceptionPrivate.onMediaPerception, + function(evt) { + chrome.test.assertEq({ + framePerceptions: [{ + frameId: 1 + }] + }, evt); + }); + // By sending this message, we trigger the fake D-Bus client to fire an + // onMediaPerception event. + chrome.test.sendMessage('mediaPerceptionListenerSet'); + } +]); +
diff --git a/extensions/test/data/media_perception_private/state/manifest.json b/extensions/test/data/media_perception_private/state/manifest.json new file mode 100644 index 0000000..1151d62 --- /dev/null +++ b/extensions/test/data/media_perception_private/state/manifest.json
@@ -0,0 +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. +{ + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC74Vbx3EbhPc/FOvn6+HxCjMSml0HdPMiuRjj5a3b+MnRML1iJ9OAgbKUYJ/u3s25/cGq8pNB0NbyupHGEqvqAE7TcNr1mdgs0PWxh2IOI1GKrxlzxpqzQuFmxq5WHKr5RrwZ4/Xq0t/+e8JkvhZdW0jarz/28Jom0gkM5lorsewIDAQAB", + "manifest_version": 2, + "name": "Test mediaPerceptionPrivate API's get and set state functions", + "version": "1.0", + "app": { + "background": { + "scripts": ["runtest.js"] + } + }, + "permissions": ["mediaPerceptionPrivate"], + "kiosk_enabled": true +}
diff --git a/extensions/test/data/media_perception_private/state/runtest.js b/extensions/test/data/media_perception_private/state/runtest.js new file mode 100644 index 0000000..be02705 --- /dev/null +++ b/extensions/test/data/media_perception_private/state/runtest.js
@@ -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. + +function getStateUninitialized() { + chrome.mediaPerceptionPrivate.getState( + chrome.test.callbackPass(function(state) { + chrome.test.assertEq({ status: 'UNINITIALIZED' }, state); + })); +} + +function setStateRunning() { + chrome.mediaPerceptionPrivate.setState({ + status: 'RUNNING', + deviceContext: 'device_context' + }, chrome.test.callbackPass(function(state) { + chrome.test.assertEq('RUNNING', state.status); + })); +} + +function getStateRunning() { + chrome.mediaPerceptionPrivate.getState( + chrome.test.callbackPass(function(state) { + chrome.test.assertEq('RUNNING', state.status); + })); +} + +function setStateUnsettable() { + const error = 'Status can only be set to RUNNING and SUSPENDED.'; + chrome.mediaPerceptionPrivate.setState({ + status: 'UNINITIALIZED' + }, chrome.test.callbackFail(error)); + chrome.mediaPerceptionPrivate.setState({ + status: 'STARTED' + }, chrome.test.callbackFail(error)); +} + +function setStateSuspendedButWithDeviceContextFail() { + const error = 'Only provide deviceContext with SetState RUNNING.'; + chrome.mediaPerceptionPrivate.setState({ + status: 'SUSPENDED', + deviceContext: 'device_context' + }, chrome.test.callbackFail(error)); +} + +chrome.test.runTests([ + getStateUninitialized, + setStateRunning, + getStateRunning, + setStateUnsettable, + setStateSuspendedButWithDeviceContextFail]); +
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 3139afc..574f3dc 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1513,6 +1513,9 @@ <message name="IDS_IOS_SIGNIN_PROMO_NOT" desc="Button that the user can press if they are not the profile that Chrome found (opposite of 'Continue as Joe Doe')."> Not <ph name="EMAIL">$1<ex>john.doe@example.com</ex>?</ph> </message> + <message name="IDS_IOS_SIGNIN_PROMO_CLOSE_ACCESSIBILITY" desc="Accessibility label to describe the close button in the sign-in promo element."> + Close + </message> <message name="IDS_IOS_SYSTEM_MAIL_APP" desc="Name of iOS system-provided Mail app. Note that this is not consistently translated for all locales, e.g. it is still 'Mail' (in English) for French locale, but is translated to '邮件' for Chinese locale. [Length: 10em]"> Mail </message>
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view.h b/ios/chrome/browser/ui/authentication/signin_promo_view.h index db7dfb1..d9eaa275 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view.h +++ b/ios/chrome/browser/ui/authentication/signin_promo_view.h
@@ -40,6 +40,8 @@ @property(nonatomic, readonly) UILabel* textLabel; @property(nonatomic, readonly) MDCFlatButton* primaryButton; @property(nonatomic, readonly) MDCFlatButton* secondaryButton; +// Hidden by default. +@property(nonatomic, readonly) UIButton* closeButton; // Horizontal padding used for |textLabel|, |primaryButton| and // |secondaryButton|. Used to compute the preferred max layout width of
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view.mm b/ios/chrome/browser/ui/authentication/signin_promo_view.mm index a52cb92..3487b8f 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_view.mm
@@ -9,6 +9,7 @@ #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_chromium_strings.h" +#include "ios/chrome/grit/ios_strings.h" #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #include "ui/base/l10n/l10n_util.h" @@ -42,6 +43,7 @@ @synthesize textLabel = _textLabel; @synthesize primaryButton = _primaryButton; @synthesize secondaryButton = _secondaryButton; +@synthesize closeButton = _closeButton; - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -75,6 +77,11 @@ forControlEvents:UIControlEventTouchUpInside]; [self addSubview:_secondaryButton]; + _closeButton = [[UIButton alloc] init]; + _closeButton.translatesAutoresizingMaskIntoConstraints = NO; + _closeButton.accessibilityIdentifier = @"signin_promo_close_button"; + [self addSubview:_closeButton]; + // Adding style. _imageView.contentMode = UIViewContentModeCenter; _imageView.layer.masksToBounds = YES; @@ -93,6 +100,10 @@ _secondaryButton.customTitleColor = [[MDCPalette cr_bluePalette] tint500]; _secondaryButton.uppercaseTitle = NO; + [_closeButton setImage:[UIImage imageNamed:@"signin_promo_close_gray"] + forState:UIControlStateNormal]; + _closeButton.hidden = YES; + // Adding constraints. NSDictionary* metrics = @{ @"kButtonHeight" : @(kButtonHeight), @@ -122,6 +133,10 @@ ]; ApplyVisualConstraintsWithMetricsAndOptions( visualConstraints, views, metrics, NSLayoutFormatAlignAllCenterX); + NSArray* buttonVisualConstraints = + @[ @"H:[closeButton]-|", @"V:|-[closeButton]" ]; + ApplyVisualConstraints(buttonVisualConstraints, + @{ @"closeButton" : _closeButton }); // Constraints for cold state mode. NSArray* coldStateVisualConstraints = @[ @@ -201,6 +216,10 @@ [_secondaryButton sendActionsForControlEvents:UIControlEventTouchUpInside]; } +- (void)accessibilityCloseAction:(id)unused { + [_closeButton sendActionsForControlEvents:UIControlEventTouchUpInside]; +} + - (CGFloat)horizontalPadding { return kHorizontalPadding; } @@ -223,6 +242,8 @@ #pragma mark - NSObject(Accessibility) - (NSArray<UIAccessibilityCustomAction*>*)accessibilityCustomActions { + NSMutableArray* actions = [NSMutableArray array]; + NSString* primaryActionName = [_primaryButton titleForState:UIControlStateNormal]; UIAccessibilityCustomAction* primaryCustomAction = @@ -230,17 +251,31 @@ initWithName:primaryActionName target:self selector:@selector(accessibilityPrimaryAction:)]; - if (_mode == SigninPromoViewModeColdState) { - return @[ primaryCustomAction ]; + [actions addObject:primaryCustomAction]; + + if (_mode == SigninPromoViewModeWarmState) { + NSString* secondaryActionName = + [_secondaryButton titleForState:UIControlStateNormal]; + UIAccessibilityCustomAction* secondaryCustomAction = + [[UIAccessibilityCustomAction alloc] + initWithName:secondaryActionName + target:self + selector:@selector(accessibilitySecondaryAction:)]; + [actions addObject:secondaryCustomAction]; } - NSString* secondaryActionName = - [_secondaryButton titleForState:UIControlStateNormal]; - UIAccessibilityCustomAction* secondaryCustomAction = - [[UIAccessibilityCustomAction alloc] - initWithName:secondaryActionName - target:self - selector:@selector(accessibilitySecondaryAction:)]; - return @[ primaryCustomAction, secondaryCustomAction ]; + + if (!_closeButton.hidden) { + NSString* closeActionName = + l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_CLOSE_ACCESSIBILITY); + UIAccessibilityCustomAction* closeCustomAction = + [[UIAccessibilityCustomAction alloc] + initWithName:closeActionName + target:self + selector:@selector(accessibilityCloseAction:)]; + [actions addObject:closeCustomAction]; + } + + return actions; } - (NSString*)accessibilityLabel {
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h index 2cf1a0a..8e08d99 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.h
@@ -19,6 +19,8 @@ + (NSString*)reuseIdentifier; @property(nonatomic, readonly) SigninPromoView* signinPromoView; +// Called when the user taps on the close button. If not set, the close button +// is hidden. @property(nonatomic, copy) CloseButtonCallback closeButtonAction; @end
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm index edf209f..e5df703 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_signin_promo_cell.mm
@@ -13,11 +13,6 @@ #error "This file requires ARC support." #endif -namespace { -// Close button size. -const CGFloat kCloseButtonSize = 24; -} - @implementation BookmarkSigninPromoCell { SigninPromoView* _signinPromoView; UIButton* _closeButton; @@ -43,19 +38,10 @@ [contentView addSubview:_signinPromoView]; AddSameConstraints(_signinPromoView, contentView); - _closeButton = [[UIButton alloc] - initWithFrame:CGRectMake(0, 0, kCloseButtonSize, kCloseButtonSize)]; - [_closeButton addTarget:self - action:@selector(closeButtonAction:) - forControlEvents:UIControlEventTouchUpInside]; - _closeButton.translatesAutoresizingMaskIntoConstraints = NO; - [contentView addSubview:_closeButton]; - [_closeButton setImage:[UIImage imageNamed:@"signin_promo_close_gray"] - forState:UIControlStateNormal]; - NSArray* buttonVisualConstraints = - @[ @"H:[closeButton]-|", @"V:|-[closeButton]" ]; - NSDictionary* views = @{ @"closeButton" : _closeButton }; - ApplyVisualConstraints(buttonVisualConstraints, views); + _signinPromoView.closeButton.hidden = NO; + [_signinPromoView.closeButton addTarget:self + action:@selector(closeButtonAction:) + forControlEvents:UIControlEventTouchUpInside]; _signinPromoView.backgroundColor = [UIColor whiteColor]; _signinPromoView.textLabel.text = @@ -82,9 +68,8 @@ } - (void)closeButtonAction:(id)sender { - if (_closeButtonAction) { - _closeButtonAction(); - } + DCHECK(_closeButtonAction); + _closeButtonAction(); } @end
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_controller.h b/ios/chrome/browser/ui/stack_view/stack_view_controller.h index 8070a7f3d..047e369 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_controller.h +++ b/ios/chrome/browser/ui/stack_view/stack_view_controller.h
@@ -16,7 +16,6 @@ // A protocol used by the StackViewController for test purposes. @protocol StackViewControllerTestDelegate -@required // Informs the delegate that the show tab animation starts. - (void)stackViewControllerShowWithSelectedTabAnimationDidStart; // Informs the delegate that the show tab animation finished.
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_controller_perftest.mm b/ios/chrome/browser/ui/stack_view/stack_view_controller_perftest.mm index 4770f4b..0b2723f4 100644 --- a/ios/chrome/browser/ui/stack_view/stack_view_controller_perftest.mm +++ b/ios/chrome/browser/ui/stack_view/stack_view_controller_perftest.mm
@@ -7,6 +7,7 @@ #include "base/callback_helpers.h" #import "base/mac/bind_objc_block.h" #include "base/mac/foundation_util.h" +#include "base/macros.h" #include "base/strings/sys_string_conversions.h" #import "base/test/ios/wait_util.h" #import "ios/chrome/browser/snapshots/snapshot_manager.h" @@ -128,10 +129,6 @@ namespace { -#define ARRAYSIZE(a) \ - ((sizeof(a) / sizeof(*(a))) / \ - static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) - // Use multiple URLs in the test in case the complexity of a website has an // effect on the performance of UIWebView -renderInContext. static const char* url_list[] = { @@ -247,7 +244,7 @@ const GURL StackViewControllerPerfTest::NextURL() { current_url_index_++; - if (static_cast<unsigned long>(current_url_index_) >= ARRAYSIZE(url_list)) + if (static_cast<unsigned long>(current_url_index_) >= arraysize(url_list)) current_url_index_ = 0; return GURL(url_list[current_url_index_]); }
diff --git a/ios/chrome/browser/ui/tab_switcher/BUILD.gn b/ios/chrome/browser/ui/tab_switcher/BUILD.gn index 1f7dba7..5a9a65d 100644 --- a/ios/chrome/browser/ui/tab_switcher/BUILD.gn +++ b/ios/chrome/browser/ui/tab_switcher/BUILD.gn
@@ -109,6 +109,8 @@ "//ios/chrome/browser/sync", "//ios/chrome/browser/tabs", "//ios/chrome/browser/ui", + "//ios/chrome/browser/ui/authentication:authentication_arc", + "//ios/chrome/browser/ui/authentication:authentication_ui", "//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/keyboard",
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm index b32f389b..bb8797c3 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm
@@ -6,6 +6,12 @@ #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "components/signin/core/browser/signin_metrics.h" +#include "ios/chrome/browser/experimental_flags.h" +#import "ios/chrome/browser/ui/authentication/signin_promo_view.h" +#import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" +#import "ios/chrome/browser/ui/authentication/signin_promo_view_consumer.h" +#import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" #include "ios/chrome/browser/ui/commands/ios_command_ids.h" @@ -52,7 +58,7 @@ const CGFloat kSubtitleMinimunLineHeight = 24.0; } -@interface TabSwitcherPanelOverlayView () +@interface TabSwitcherPanelOverlayView ()<SigninPromoViewConsumer> // Updates the texts of labels and button according to the current // |overlayType|. @@ -73,6 +79,8 @@ MDCButton* _floatingButton; MDCActivityIndicator* _activityIndicator; std::string _recordedMetricString; + SigninPromoViewMediator* _signinPromoViewMediator; + SigninPromoView* _signinPromoView; } @synthesize overlayType = _overlayType; @@ -167,7 +175,7 @@ @"H:|-(>=0)-[container(==containerWidth@999)]-(>=0)-|", ], @{ @"container" : _container }, - @{ @"containerWidth" : @(kContainerWidth) }, self); + @{ @"containerWidth" : @(kContainerWidth) }); } return self; } @@ -185,13 +193,59 @@ - (void)setOverlayType:(TabSwitcherPanelOverlayType)overlayType { _overlayType = overlayType; - [self updateText]; - [self updateButtonTarget]; + if (experimental_flags::IsSigninPromoEnabled() && + _overlayType == + TabSwitcherPanelOverlayType::OVERLAY_PANEL_USER_SIGNED_OUT) { + [self createSigninPromoviewIfNeeded]; + _container.hidden = YES; + } else { + _container.hidden = NO; + [_signinPromoView removeFromSuperview]; + _signinPromoView = nil; + _signinPromoViewMediator.consumer = nil; + _signinPromoViewMediator = nil; + [self updateText]; + [self updateButtonTarget]; + } } #pragma mark - Private +// Creates the sign-in view and its mediator if it doesn't exist. +- (void)createSigninPromoviewIfNeeded { + if (_signinPromoView) { + DCHECK(_signinPromoViewMediator); + return; + } + _signinPromoView = [[SigninPromoView alloc] initWithFrame:CGRectZero]; + _signinPromoView.translatesAutoresizingMaskIntoConstraints = NO; + _signinPromoView.textLabel.text = + l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_RECENT_TABS); + _signinPromoView.textLabel.textColor = [UIColor whiteColor]; + _signinPromoView.textLabel.font = [MDCTypography headlineFont]; + _signinPromoView.textLabel.preferredMaxLayoutWidth = + kContainerWidth - (2 * _signinPromoView.horizontalPadding); + [self addSubview:_signinPromoView]; + ApplyVisualConstraintsWithMetrics( + @[ @"H:[signinPromoView(containerWidth)]" ], + @{ @"signinPromoView" : _signinPromoView }, + @{ @"containerWidth" : @(kContainerWidth) }); + AddSameCenterXConstraint(_signinPromoView, self); + [_signinPromoView.centerYAnchor + constraintEqualToAnchor:self.centerYAnchor + constant:kContainerOriginYOffset] + .active = YES; + _signinPromoViewMediator = [[SigninPromoViewMediator alloc] init]; + _signinPromoViewMediator.accessPoint = + signin_metrics::AccessPoint::ACCESS_POINT_RECENT_TABS; + _signinPromoView.delegate = _signinPromoViewMediator; + _signinPromoViewMediator.consumer = self; + [[_signinPromoViewMediator createConfigurator] + configureSigninPromoView:_signinPromoView]; +} + - (void)updateText { + DCHECK(_signinPromoView == nil && _signinPromoViewMediator == nil); NSMutableAttributedString* titleString = nil; NSMutableAttributedString* subtitleString = nil; @@ -206,6 +260,7 @@ case TabSwitcherPanelOverlayType::OVERLAY_PANEL_EMPTY: break; case TabSwitcherPanelOverlayType::OVERLAY_PANEL_USER_SIGNED_OUT: + DCHECK(!experimental_flags::IsSigninPromoEnabled()); titleString = [[NSMutableAttributedString alloc] initWithString:l10n_util::GetNSString( IDS_IOS_TAB_SWITCHER_SIGN_IN_ACCOUNT_TITLE)]; @@ -325,6 +380,7 @@ } - (void)updateButtonTarget { + DCHECK(_signinPromoView == nil && _signinPromoViewMediator == nil); NSInteger tag = 0; SEL selector = nil; _recordedMetricString = ""; @@ -336,6 +392,7 @@ shouldShowTextButton = NO; break; case TabSwitcherPanelOverlayType::OVERLAY_PANEL_USER_SIGNED_OUT: + DCHECK(!experimental_flags::IsSigninPromoEnabled()); selector = @selector(showSignIn); _recordedMetricString = "MobileTabSwitcherSignIn"; break; @@ -408,4 +465,14 @@ base::RecordAction(base::UserMetricsAction(_recordedMetricString.c_str())); } +#pragma mark - SigninPromoViewConsumer + +- (void)configureSigninPromoViewWithNewIdentity:(BOOL)newIdentity + configurator:(SigninPromoViewConfigurator*) + configurator { + DCHECK(_signinPromoView); + DCHECK(_signinPromoViewMediator); + [configurator configureSigninPromoView:_signinPromoView]; +} + @end
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index dfe54af..2dddf9bf 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -56,6 +56,7 @@ #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" #include "third_party/WebKit/public/platform/WebMediaSource.h" #include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebString.h"
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 47614de..27df7745 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -4181,10 +4181,6 @@ ], "scripts": [ { - "name": "check_gn_headers", - "script": "check_gn_headers.py" - }, - { "name": "checkdeps", "script": "checkdeps.py" }, @@ -4801,10 +4797,6 @@ ], "scripts": [ { - "name": "check_gn_headers", - "script": "check_gn_headers.py" - }, - { "name": "nacl_integration", "script": "nacl_integration.py" }
diff --git a/testing/scripts/check_gn_headers.py b/testing/scripts/check_gn_headers.py deleted file mode 100755 index 7aa36a6a..0000000 --- a/testing/scripts/check_gn_headers.py +++ /dev/null
@@ -1,46 +0,0 @@ -#!/usr/bin/env python -# 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 json -import os -import sys - - -import common - - -def main_run(args): - with common.temporary_file() as tempfile_path: - rc = common.run_command([ - sys.executable, - os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'), - '--out-dir', - os.path.join(args.paths['checkout'], 'out', args.build_config_fs), - '--whitelist', - os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'), - '--json', tempfile_path - ], cwd=common.SRC_DIR) - - with open(tempfile_path) as f: - failures = json.load(f) - - json.dump({ - 'valid': True, - 'failures': failures, - }, args.output) - - return rc - - -def main_compile_targets(args): - json.dump([], args.output) - - -if __name__ == '__main__': - funcs = { - 'run': main_run, - 'compile_targets': main_compile_targets, - } - sys.exit(common.run_script(sys.argv[1:], funcs))
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 934dd05..9b9f3c4 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1521,25 +1521,6 @@ ] } ], - "NTPBookmarkSuggestions": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Phase2Enabled3wWithDesktop", - "params": { - "bookmarks_consider_desktop_visits": "true", - "bookmarks_max_age_in_days": "21" - }, - "enable_features": [ - "NTPBookmarkSuggestions" - ] - } - ] - } - ], "NTPFaviconsFromNewServer": [ { "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation b/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation index fca7fdb..791d316 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation
@@ -25,67 +25,9 @@ Bug(718942) virtual/mojo-loading/http/tests/security/contentSecurityPolicy/1.1/form-action-src-redirect-blocked.html [ Failure ] Bug(718942) virtual/off-main-thread-fetch/http/tests/misc/onload-detach-during-csp-frame-src-none.html [ Failure ] -# Missing console warning about new lines in urls. -# ``` -# CONSOLE WARNING: Resource requests whose URLs contain raw newline characters -# are deprecated, and may be blocked in M60, around August 2017. Please remove -# newlines from places like element attribute values in order to continue -# loading those resources. See -# https://www.chromestatus.com/features/5735596811091968 for more details. -# ``` -# See https://crbug.com/723595 -Bug(723595) compositing/iframes/iframe-in-composited-layer.html [ Failure ] -Bug(723595) fast/css/counters/counter-traverse-table-cell.html [ Failure ] -Bug(723595) fast/dom/Element/offsetLeft-offsetTop-body-quirk.html [ Failure ] -Bug(723595) fast/dom/Element/offsetLeft-offsetTop-html.html [ Failure ] -Bug(723595) fast/events/drag-and-drop-autoscroll-inner-frame.html [ Failure ] -Bug(723595) fast/events/resize-subframe.html [ Failure ] -Bug(723595) fast/events/touch/gesture/long-press-focuses-frame.html [ Failure ] -Bug(723595) fast/files/null-origin-string.html [ Failure ] -Bug(723595) fast/frames/content-opacity-1.html [ Failure ] -Bug(723595) fast/frames/frameset-style-recalc.html [ Failure ] -Bug(723595) fast/frames/negative-remaining-length-crash.html [ Failure ] -Bug(723595) fast/loader/simultaneous-reloads-assert.html [ Failure ] -Bug(723595) fast/loader/stateobjects/pushstate-in-data-url-denied.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-hidden-iframe-zero-size.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-hidden-iframe.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-iframe-nested.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-iframe-no-focusable-content.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-iframe-no-scrollable-content.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-iframe-recursive-offset-parent.html [ Failure ] -Bug(723595) fast/spatial-navigation/snav-iframe-with-offscreen-focusable-element.html [ Failure ] -Bug(723595) fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent.html [ Failure ] -Bug(723595) http/tests/inspector/service-workers/service-workers-redundant.html [ Failure ] -Bug(723595) http/tests/security/document-all.html [ Failure ] -Bug(723595) http/tests/security/no-indexeddb-from-sandbox.html [ Failure ] -Bug(723595) http/tests/security/no-popup-from-sandbox-top.html [ Failure ] -Bug(723595) http/tests/security/no-popup-from-sandbox.html [ Failure ] -Bug(723595) http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html [ Failure ] -Bug(723595) http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html [ Failure ] -Bug(723595) http/tests/security/popup-allowed-by-sandbox-when-allowed.html [ Failure ] -Bug(723595) http/tests/security/sandboxed-opener-can-close-window.html [ Failure ] -Bug(723595) http/tests/security/window-named-proto.html [ Failure ] -Bug(723595) http/tests/security/window-named-valueOf.html [ Failure ] -Bug(723595) http/tests/xmlhttprequest/access-control-basic-allow-access-control-origin-header-data-url.html [ Failure ] -Bug(723595) plugins/createScriptableObject-before-start.html [ Failure ] -Bug(723595) printing/subframes-percentage-height.html [ Failure ] -Bug(723595) svg/custom/g-outside-svg.html [ Failure ] -Bug(723595) virtual/android/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent.html [ Failure ] -Bug(723595) virtual/disable-spinvalidation/compositing/iframes/iframe-in-composited-layer.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/document-all.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/no-indexeddb-from-sandbox.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/no-popup-from-sandbox-top.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/no-popup-from-sandbox.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/popup-allowed-by-sandbox-when-allowed.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/sandboxed-opener-can-close-window.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/window-named-proto.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/security/window-named-valueOf.html [ Failure ] -Bug(723595) virtual/mojo-loading/http/tests/xmlhttprequest/access-control-basic-allow-access-control-origin-header-data-url.html [ Failure ] -Bug(723595) virtual/off-main-thread-fetch/http/tests/inspector/service-workers/service-workers-redundant.html [ Failure ] -Bug(723595) virtual/scroll_customization/fast/events/touch/gesture/long-press-focuses-frame.html [ Failure ] -Bug(723595) virtual/threaded/printing/subframes-percentage-height.html [ Failure ] +# PlzNavigate: A few line are missing in InspectorTest.dumpServiceWorkersView() +Bug(725818) http/tests/inspector/service-workers/service-workers-redundant.html [ Failure ] +Bug(725818) virtual/off-main-thread-fetch/http/tests/inspector/service-workers/service-workers-redundant.html [ Failure ] # PlzNavigate: Navigation requests upgraded via upgrade-insecure-requests will not get reported # See https://crbug.com/713388
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 747ac00..2cf75ae 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2800,7 +2800,6 @@ # [css-align] crbug.com/668639 external/wpt/css/css-align-3/default-alignment/place-items-shorthand-006.html [ Failure ] crbug.com/668639 external/wpt/css/css-align-3/self-alignment/place-self-shorthand-006.html [ Failure ] -crbug.com/708121 external/wpt/css/css-align-3/distribution-values/space-evenly-001.html [ Failure ] # [selectors-4] crbug.com/706118 external/wpt/css/selectors4/hover-001-manual.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html b/third_party/WebKit/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html index 50b5273..ceb0e066 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html
@@ -43,6 +43,9 @@ <div class="default" style="align-content: space-around"> <div data-offset-y="0">This text should be at the top of it's container</div> </div> +<div class="default" style="align-content: space-evenly"> +<div data-offset-y="0">This text should be at the top of it's container</div> +</div> <div class="default" style="align-content: stretch"> <div data-offset-y="0">This text should be at the top of it's container</div> </div>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/css-properties-expected.txt b/third_party/WebKit/LayoutTests/css3/flexbox/css-properties-expected.txt index 32a83c25..9880226f 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/css-properties-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/flexbox/css-properties-expected.txt
@@ -26,6 +26,8 @@ PASS window.getComputedStyle(flexbox, null).justifyContent is "center" PASS flexbox.style.justifyContent is "space-between" PASS window.getComputedStyle(flexbox, null).justifyContent is "space-between" +PASS flexbox.style.justifyContent is "space-evenly" +PASS window.getComputedStyle(flexbox, null).justifyContent is "space-evenly" PASS flexbox.style.justifyContent is "" PASS window.getComputedStyle(flexbox, null).justifyContent is "normal" PASS flexbox.style.alignSelf is "" @@ -210,6 +212,8 @@ PASS window.getComputedStyle(flexbox, null).alignContent is "space-between" PASS flexbox.style.alignContent is "space-around" PASS window.getComputedStyle(flexbox, null).alignContent is "space-around" +PASS flexbox.style.alignContent is "space-evenly" +PASS window.getComputedStyle(flexbox, null).alignContent is "space-evenly" PASS flexbox.style.alignContent is "stretch" PASS window.getComputedStyle(flexbox, null).alignContent is "stretch" PASS flexbox.style.alignContent is ""
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/css-properties.html b/third_party/WebKit/LayoutTests/css3/flexbox/css-properties.html index 344129f..b95bb5a1 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/css-properties.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/css-properties.html
@@ -75,6 +75,10 @@ shouldBeEqualToString('flexbox.style.justifyContent', 'space-between'); shouldBeEqualToString('window.getComputedStyle(flexbox, null).justifyContent', 'space-between'); +flexbox.style.justifyContent = 'space-evenly'; +shouldBeEqualToString('flexbox.style.justifyContent', 'space-evenly'); +shouldBeEqualToString('window.getComputedStyle(flexbox, null).justifyContent', 'space-evenly'); + flexbox.style.justifyContent = ''; shouldBeEqualToString('flexbox.style.justifyContent', ''); shouldBeEqualToString('window.getComputedStyle(flexbox, null).justifyContent', 'normal'); @@ -301,6 +305,10 @@ shouldBeEqualToString('flexbox.style.alignContent', 'space-around'); shouldBeEqualToString('window.getComputedStyle(flexbox, null).alignContent', 'space-around'); +flexbox.style.alignContent = 'space-evenly'; +shouldBeEqualToString('flexbox.style.alignContent', 'space-evenly'); +shouldBeEqualToString('window.getComputedStyle(flexbox, null).alignContent', 'space-evenly'); + flexbox.style.alignContent = 'stretch'; shouldBeEqualToString('flexbox.style.alignContent', 'stretch'); shouldBeEqualToString('window.getComputedStyle(flexbox, null).alignContent', 'stretch');
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/flex-justify-content.html b/third_party/WebKit/LayoutTests/css3/flexbox/flex-justify-content.html index 2704a0f5..e2d2262 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/flex-justify-content.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/flex-justify-content.html
@@ -96,6 +96,31 @@ <!-- Make sure we don't crash with no children. --> <div class="flexbox" style="justify-content: space-around"></div> +<div class="flexbox" style="justify-content: space-evenly"> + <div data-expected-width="100" data-offset-x="75" style="flex: 1 0 0; max-width: 100px;"></div> + <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div> + <div data-expected-width="100" data-offset-x="425" style="width: 100px;"></div> +</div> + +<div class="flexbox" style="justify-content: space-evenly"> + <div data-expected-width="200" data-offset-x="0" style="flex: 1 100px;"></div> + <div data-expected-width="200" data-offset-x="200" style="flex: 1 100px;"></div> + <div data-expected-width="200" data-offset-x="400" style="flex: 1 100px;"></div> +</div> + +<!-- If there's only one child, we justify-content: center. --> +<div class="flexbox" style="justify-content: space-evenly"> + <div data-expected-width="100" data-offset-x="250" style="flex: 1 0 0; max-width: 100px;"></div> +</div> + +<!-- True centering on overflow. --> +<div class="flexbox" style="justify-content: space-evenly"> + <div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div> +</div> + +<!-- Make sure we don't crash with no children. --> +<div class="flexbox" style="justify-content: space-evenly"></div> + <!-- margin:auto applies before justify-content. --> <div class="flexbox" style="justify-content: flex-end"> <div data-expected-width="100" data-offset-x="0" style="width: 100px;"></div>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column.html b/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column.html index c6ff618..c0d9cf8d 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content-horizontal-column.html
@@ -47,6 +47,9 @@ .align-content-space-around { align-content: space-around; } +.align-content-space-evenly { + align-content: space-evenly; +} .align-content-stretch { align-content: stretch; } @@ -74,6 +77,7 @@ 'center': [200, 300], 'space-between': [0, 500], 'space-around': [100, 400], + 'space-evenly': [133, 367], 'stretch': [0, 300], }, 'wrap-reverse': { @@ -82,6 +86,7 @@ 'center': [300, 200], 'space-between': [500, 0], 'space-around': [400, 100], + 'space-evenly': [367, 133], 'stretch': [300, 0], }, }, @@ -92,6 +97,7 @@ 'center': [300, 200], 'space-between': [500, 0], 'space-around': [400, 100], + 'space-evenly': [367, 133], 'stretch': [300, 0], }, 'wrap-reverse': { @@ -100,6 +106,7 @@ 'center': [200, 300], 'space-between': [0, 500], 'space-around': [100, 400], + 'space-evenly': [133, 367], 'stretch': [0, 300], }, }, @@ -113,6 +120,7 @@ 'center': [200, 300], 'space-between': [0, 500], 'space-around': [100, 400], + 'space-evenly': [133, 367], 'stretch': [0, 300], }, 'wrap-reverse': { @@ -121,6 +129,7 @@ 'center': [300, 200], 'space-between': [500, 0], 'space-around': [400, 100], + 'space-evenly': [367, 133], 'stretch': [300, 0], }, }, @@ -131,6 +140,7 @@ 'center': [300, 200], 'space-between': [500, 0], 'space-around': [400, 100], + 'space-evenly': [367, 133], 'stretch': [300, 0], }, 'wrap-reverse': { @@ -139,6 +149,7 @@ 'center': [200, 300], 'space-between': [0, 500], 'space-around': [100, 400], + 'space-evenly': [133, 367], 'stretch': [0, 300], }, }, @@ -172,7 +183,7 @@ var flexDirections = ['column', 'column-reverse']; var directions = ['ltr', 'rtl']; var wraps = ['wrap', 'wrap-reverse']; -var alignContents = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch']; +var alignContents = ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch']; writingModes.forEach(function(writingMode) { flexDirections.forEach(function(flexDirection) {
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content.html b/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content.html index db0854d..a40fa6c6 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content.html
@@ -106,6 +106,13 @@ <div data-offset-x="0" data-offset-y="100" data-expected-height="20"></div> </div> +<div data-expected-height="120" class="flexbox horizontal" style="align-content: space-evenly"> + <div data-offset-x="0" data-offset-y="15" data-expected-height="20"></div> + <div data-offset-x="100" data-offset-y="15" data-expected-height="20"></div> + <div data-offset-x="0" data-offset-y="50" data-expected-height="20"></div> + <div data-offset-x="0" data-offset-y="85" data-expected-height="20"></div> +</div> + <div data-expected-height="120" class="flexbox horizontal" style="align-content: space-around"> <div data-offset-x="0" data-offset-y="10" data-expected-height="20"></div> <div data-offset-x="100" data-offset-y="10" data-expected-height="20"></div> @@ -152,6 +159,14 @@ <div data-offset-x="0" data-offset-y="25" data-expected-height="20"></div> </div> +<!-- If we overflow, we should true center. --> +<div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> + <div data-offset-x="0" data-offset-y="-15" data-expected-height="20"></div> + <div data-offset-x="100" data-offset-y="-15" data-expected-height="20"></div> + <div data-offset-x="0" data-offset-y="5" data-expected-height="20"></div> + <div data-offset-x="0" data-offset-y="25" data-expected-height="20"></div> +</div> + <!-- Stretch should only grow, not shrink. --> <div data-expected-height="30" class="flexbox horizontal" style="align-content: stretch; height: 30px"> <div data-offset-x="0" data-offset-y="0" data-expected-height="20"></div> @@ -165,6 +180,8 @@ </div> <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-around; height: 30px"> </div> +<div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> +</div> <div data-expected-height="30" class="flexbox horizontal" style="align-content: stretch; height: 30px"> </div> @@ -175,6 +192,9 @@ <div data-expected-height="30" class="flexbox horizontal" style="align-content: space-around; height: 30px"> <div data-offset-x="0" data-offset-y="0" data-expected-height="30"></div> </div> +<div data-expected-height="30" class="flexbox horizontal" style="align-content: space-evenly; height: 30px"> + <div data-offset-x="0" data-offset-y="0" data-expected-height="30"></div> +</div> <div data-expected-height="30" class="flexbox horizontal" style="align-content: stretch; height: 30px"> <div data-offset-x="0" data-offset-y="0" data-expected-height="30"></div> </div> @@ -222,6 +242,13 @@ <div data-offset-x="10" data-offset-y="0" data-expected-width="20"></div> </div> +<div data-expected-width="120" class="flexbox vertical-rl" style="align-content: space-evenly"> + <div data-offset-x="85" data-offset-y="0" data-expected-width="20"></div> + <div data-offset-x="85" data-offset-y="10" data-expected-width="20"></div> + <div data-offset-x="50" data-offset-y="0" data-expected-width="20"></div> + <div data-offset-x="15" data-offset-y="0" data-expected-width="20"></div> +</div> + <div data-expected-width="120" class="flexbox vertical-rl" style="align-content: stretch"> <div data-offset-x="80" data-offset-y="0" data-expected-width="40"></div> <div data-offset-x="80" data-offset-y="10" data-expected-width="40"></div> @@ -261,6 +288,14 @@ <div data-offset-x="-15" data-offset-y="0" data-expected-width="20"></div> </div> +<!-- If we overflow, we should true center. --> +<div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px;"> + <div data-offset-x="25" data-offset-y="0" data-expected-width="20"></div> + <div data-offset-x="25" data-offset-y="10" data-expected-width="20"></div> + <div data-offset-x="5" data-offset-y="0" data-expected-width="20"></div> + <div data-offset-x="-15" data-offset-y="0" data-expected-width="20"></div> +</div> + <!-- Stretch should only grow, not shrink. --> <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px;"> <div data-offset-x="10" data-offset-y="0" data-expected-width="20"></div> @@ -274,6 +309,8 @@ </div> <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-around; width: 30px"> </div> +<div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px"> +</div> <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px"> </div> @@ -284,6 +321,9 @@ <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-around; width: 30px"> <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> </div> +<div data-expected-width="30" class="flexbox vertical-rl" style="align-content: space-evenly; width: 30px"> + <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> +</div> <div data-expected-width="30" class="flexbox vertical-rl" style="align-content: stretch; width: 30px"> <div data-offset-x="0" data-offset-y="0" data-expected-width="30"></div> </div>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/resources/flexbox.css b/third_party/WebKit/LayoutTests/css3/flexbox/resources/flexbox.css index 83502cd1..6b0e581 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/resources/flexbox.css +++ b/third_party/WebKit/LayoutTests/css3/flexbox/resources/flexbox.css
@@ -70,6 +70,10 @@ -webkit-align-content: space-around; align-content: space-around; } +.align-content-space-around { + -webkit-align-content: space-evenly; + align-content: space-evenly; +} .align-content-stretch { -webkit-align-content: stretch; align-content: stretch; @@ -141,3 +145,7 @@ -webkit-justify-content: space-around; justify-content: space-around; } +.justify-content-space-around { + -webkit-justify-content: space-evenly; + justify-content: space-evenly; +}
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/true-centering.html b/third_party/WebKit/LayoutTests/css3/flexbox/true-centering.html index 248f8b3d..839083b 100644 --- a/third_party/WebKit/LayoutTests/css3/flexbox/true-centering.html +++ b/third_party/WebKit/LayoutTests/css3/flexbox/true-centering.html
@@ -79,6 +79,11 @@ <div data-offset-x="50" data-offset-y="-5"></div> </div> +<div class="flexbox" style="align-items: center; justify-content: space-evenly;"> + <div data-offset-x="-10" data-offset-y="-5"></div> + <div data-offset-x="50" data-offset-y="-5"></div> +</div> + <div class="flexbox" style="align-items: flex-start; justify-content: flex-start;"> <div data-offset-x=0 data-offset-y=0></div> <div data-offset-x=60 data-offset-y=0></div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/dom/elements/elements-in-the-dom/historical.html b/third_party/WebKit/LayoutTests/external/wpt/html/dom/elements/elements-in-the-dom/historical.html index 078ce29..469ff08c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/dom/elements/elements-in-the-dom/historical.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/dom/elements/elements-in-the-dom/historical.html
@@ -15,6 +15,8 @@ "commandTriggers", // https://github.com/whatwg/html/pull/2402 "dropzone", + // https://github.com/whatwg/html/commit/5ddfc78b1f82e86cc202d72ccc752a0e15f1e4ad + "inert", ].forEach(function(member) { test(function() { assert_false(member in document.body);
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-does-not-match-disabled-selector.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-does-not-match-disabled-selector.html deleted file mode 100644 index 212df61..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-does-not-match-disabled-selector.html +++ /dev/null
@@ -1,27 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -<style> -button { - color: green; -} - -button:disabled { - color: red; -} - -</style> -</head> -<body style="color: green"> -<button inert>The test passes if this is in green.</button> -<script> -test(function() { - button = document.querySelector('button'); - color = document.defaultView.getComputedStyle(button).getPropertyValue('color'); - assert_equals(color, 'rgb(0, 128, 0)'); -}, 'Tests that inert elements do not match the :disabled selector.'); -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html deleted file mode 100644 index 01b9271..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body> - -<div inert> -<iframe height=400 width=600 id="main-iframe"> -<frameset rows="*" cols="50,50"> - <frame src="resources/inert-focus-in-frames-frame1.html"> - <frame src='data:text/html,<div id="frame2-div" class="target" tabindex="0">Hello</div>'> -</frameset> -</iframe> -</div> - -<script> -setup({ explicit_done: true }); - -framesLoaded = 0; -numFrames = 4; -var mainIframe = document.getElementById('main-iframe'); - -function frameLoaded() { - framesLoaded++; - if (framesLoaded == numFrames) { - test(function() { - var frame1 = mainIframe.contentWindow.frames[0].document; - var target1 = frame1.querySelector('.target'); - testCantFocus(target1); - var iframe = frame1.querySelector('iframe').contentDocument; - testCantFocus(iframe.querySelector('.target')); - }, "Focus can't go into frames or iframes in inert subtree"); - done(); - } -} - -function testCantFocus(element) { - focusedElement = null; - element.addEventListener('focus', function() { focusedElement = element; }, false); - element.focus(); - theElement = element; - assert_false(focusedElement === theElement); -} - -mainIframe.contentDocument.write(mainIframe.textContent); -mainIframe.contentDocument.close(); - -mainIframe.contentWindow.frames[1].window.onload = frameLoaded; - -window.onload = frameLoaded; -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-in-shadow-dom.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-in-shadow-dom.html deleted file mode 100644 index f153cd6..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-in-shadow-dom.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body> - - <div id="shadow-host"> - <button slot="slot-1" id="button-1">Button 1 (inert)</button> - <button slot="slot-2" id="button-2">Button 2 (not inert)</button> - </div> - <script> - const shadowHost = document.getElementById('shadow-host'); - const shadowRoot = shadowHost.attachShadow({ mode: 'open' }); - const inertDiv = document.createElement('div'); - inertDiv.inert = true; - shadowRoot.appendChild(inertDiv); - const slot1 = document.createElement('slot'); - slot1.name = 'slot-1'; - inertDiv.appendChild(slot1); - const slot2 = document.createElement('slot'); - slot2.name = 'slot-2'; - shadowRoot.appendChild(slot2); - - function testCanFocus(selector, canFocus) { - const element = document.querySelector(selector); - let focusedElement = null; - element.addEventListener('focus', function() { focusedElement = element; }, false); - element.focus(); - if (canFocus) - assert_true(focusedElement === element); - else - assert_false(focusedElement === element); - } - - testCanFocus('#button-1', false); - testCanFocus('#button-2', true); - done(); - </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html deleted file mode 100644 index c0d96bc81..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html +++ /dev/null
@@ -1,74 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body> -<a inert id="a" href="javascript:void(0)">Click me</a> -<button inert id="button">Click me</button> -<div inert id="div" style="background-color: blue; width: 50px; height: 50px">Click meeee</div> -<span inert id="span">Click me</span> -<script> -function clickOn(element) -{ - return new Promise(function(resolve, reject) { - if (!window.eventSender) - reject(); - - var absoluteTop = 0; - var absoluteLeft = 0; - for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) { - absoluteLeft += parentNode.offsetLeft; - absoluteTop += parentNode.offsetTop; - } - - var x = absoluteLeft + element.offsetWidth / 2; - var y = absoluteTop + element.offsetHeight / 2; - var pointerActions = [{ - source: "mouse", - actions: [ - { name: "pointerMove", x: x, y: y }, - { name: "pointerDown", x: x, y: x }, - { name: "pointerUp" }, - { name: "pointerMove", x: 0, y: 0} - ] - }]; - chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve); - }); -} - -function eventFiredOnInertElement(e) { - e.target.style.background = 'red'; - inertElementFiredOn = true; -} - -inertElements = ['a', 'button', 'div', 'span'] -inertElements.forEach(function(id) { - element = document.getElementById(id); - element.addEventListener('click', eventFiredOnInertElement); - element.addEventListener('mousemove', eventFiredOnInertElement); -}); - -document.addEventListener('click', function(e) { - document.firedOn = true; -}); - -test(function() { - inertElements.forEach(function(id) { - expectedTarget = document; - element = document.getElementById(id); - inertElementFiredOn = false; - expectedTarget.firedOn = false; - clickOn(element).then(() => { - assert_false(inertElementFiredOn, 'no event should be fired on ' + id); - assert_true(expectedTarget.firedOn, 'event should be fired on document instead of ' + id); - }); - }); -}, 'Tests that inert inlines do not receive mouse events. ' + - 'To test manually, click on all the "Click me"s. The test ' + - 'fails if you see red.'); - -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html deleted file mode 100644 index 199e32e..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-label-focus.html +++ /dev/null
@@ -1,50 +0,0 @@ -<!DOCTYPE html> -<html> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -<label inert for="submit">Label for Submit</label> -<input id="text" type="text"> -<input id="submit" type="submit"> -<script> -function clickOn(element) { - return new Promise(function(resolve, reject) { - if (!window.eventSender) - reject(); - - var absoluteTop = 0; - var absoluteLeft = 0; - for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) { - absoluteLeft += parentNode.offsetLeft; - absoluteTop += parentNode.offsetTop; - } - - var x = absoluteLeft + element.offsetWidth / 2; - var y = absoluteTop + element.offsetHeight / 2; - var pointerActions = [{ - source: "mouse", - actions: [ - { name: "pointerMove", x: x, y: y }, - { name: "pointerDown", x: x, y: x }, - { name: "pointerUp" }, - { name: "pointerMove", x: 0, y: 0} - ] - }]; - chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve); - }); -} - -document.querySelector('#text').focus(); - -test(function() { - label = document.querySelector('label'); - label.focus(); - assert_equals(document.activeElement, document.querySelector('#submit')); -}, 'Calling focus() on an inert label should still send focus to its target.'); - -test(function() { - clickOn(label).then(() => { - assert_equals(document.activeElement, document.body); - }); -}, 'Clicking on an inert label should send focus to document.body.'); -</script> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-uneditable.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-uneditable.html deleted file mode 100644 index 15793e5..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-uneditable.html +++ /dev/null
@@ -1,60 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body> -<span inert id="not-editable" contenteditable>I'm not editable.</span> -<span id="editable" contenteditable>I'm editable.</span> -<script> -function clickOn(element) -{ - return new Promise(function(resolve, reject) { - if (!window.eventSender) - reject(); - - var absoluteTop = 0; - var absoluteLeft = 0; - for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) { - absoluteLeft += parentNode.offsetLeft; - absoluteTop += parentNode.offsetTop; - } - - var x = absoluteLeft + element.offsetWidth / 2; - var y = absoluteTop + element.offsetHeight / 2; - var pointerActions = [{ - source: "mouse", - actions: [ - { name: "pointerMove", x: x, y: y }, - { name: "pointerDown", x: x, y: x }, - { name: "pointerUp" }, - { name: "pointerMove", x: 0, y: 0} - ] - }]; - chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve); - }); -} - -notEditable = document.querySelector('#not-editable'); -editable = document.querySelector('#editable'); - -test(function() { - clickOn(notEditable).then(() => { - oldValue = notEditable.textContent; - eventSender.keyDown('a'); - assert_equals(notEditable.textContent, oldValue); - }); -}, "Can't edit inert contenteditable"); - -test(function() { - clickOn(editable).then(() => { - oldValue = editable.textContent; - eventSender.keyDown('a'); - assert_not_equals(editable.textContent, oldValue); - }); -}, "Can edit non-inert contenteditable"); - -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unfocusable.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unfocusable.html deleted file mode 100644 index 721d49b..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unfocusable.html +++ /dev/null
@@ -1,76 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body id="body" tabindex="1"> - <button id="focusable">Outside of inert container</button> - <button inert id="inert">Inert button</button> - <div inert id="container"> - <input id="text" type="text"> - <input id="datetime" type="datetime"> - <input id="color" type="color"> - <select id="select"> - <optgroup id="optgroup"> - <option id="option">Option</option> - </optgroup> - </select> - <div id="contenteditable-div" contenteditable>I'm editable</div> - <span id="tabindex-span" tabindex="0">I'm tabindexed.</div> - <embed id="embed" type="application/x-blink-test-plugin" width=100 height=100></embed> - <a id="anchor" href="">Link</a> - </div> -<script> -function testFocus(element, expectFocus) { - focusedElement = null; - element.addEventListener('focus', function() { focusedElement = element; }, false); - element.focus(); - theElement = element; - assert_equals(focusedElement === theElement, expectFocus); -} - -function testTree(element, expectFocus, excludeCurrent) { - if (element.nodeType == Node.ELEMENT_NODE && !excludeCurrent) - testFocus(element, expectFocus); - if (element.tagName === "SELECT") - return; - var childNodes = element.childNodes; - for (var i = 0; i < childNodes.length; i++) - testTree(childNodes[i], expectFocus); -} - - -test(function() { - testFocus(document.getElementById('focusable'), true); -}, "Button outside of inert container is focusable."); - -test(function() { - testFocus(document.getElementById('inert'), false); -}, "Button with inert atribute is unfocusable."); - -test(function() { - testTree(document.getElementById('container'), false); -}, "All focusable elements inside inert subtree are unfocusable"); - -test(function() { - assert_false(document.getElementById("focusable").inert, "Inert not set explicitly is false") - assert_true(document.getElementById("inert").inert, "Inert set explicitly is true"); - assert_true(document.getElementById("container").inert, "Inert set on container is true"); -}, "Can get inert via property"); - -test(function() { - assert_false(document.getElementById("text").inert, "Elements inside of inert subtrees return false when getting inert"); -}, "Elements inside of inert subtrees return false when getting 'inert'"); - -test(function() { - document.getElementById('focusable').inert = true; - testFocus(document.getElementById('focusable'), false); - document.getElementById('inert').inert = false; - testFocus(document.getElementById('inert'), true); - document.getElementById('container').inert = false; - testTree(document.getElementById('container'), true, true); -}, "Setting inert via property correctly modifies inert state"); -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unselectable.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unselectable.html deleted file mode 100644 index 1be4a8d84..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-node-is-unselectable.html +++ /dev/null
@@ -1,17 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -</head> -<body> - <div inert>Here is a text node you can't select.</div> - <div>I'm selectable.</div> -<script> -test(function() { - document.execCommand('SelectAll'); - assert_equals(window.getSelection().toString(), "I'm selectable."); -}, "Inert nodes cannot be selected."); -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/resources/dialog-layout.css b/third_party/WebKit/LayoutTests/fast/dom/inert/resources/dialog-layout.css deleted file mode 100644 index 709b450..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/resources/dialog-layout.css +++ /dev/null
@@ -1,25 +0,0 @@ -/* Remove body margin and dialog styles for easier positioning expected values */ -body { - height: 10000px; - margin: 0; -} - -dialog { - border: 0; - padding: 0; - height: auto; - width: auto; -} - -#absolute-div { - position: absolute; - top: 800px; - height: 50px; - width: 90%; -} - -#relative-div { - position: relative; - top: 20px; - height: 30px; -}
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/resources/inert-focus-in-frames-frame1.html b/third_party/WebKit/LayoutTests/fast/dom/inert/resources/inert-focus-in-frames-frame1.html deleted file mode 100644 index a569993c..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/inert/resources/inert-focus-in-frames-frame1.html +++ /dev/null
@@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> -window.onload = parent.parent.frameLoaded; -</script> -</head> -<body> -<dialog id="dialog"> - <button id="dialog-button" tabindex="0">Button</button> -</dialog> -<input id="frame1-input" class="target" type="text"> -<iframe id="iframe1" srcdoc=' - <dialog id="iframe-dialog"> - <button id="iframe-dialog-button" tabindex="0">Button</button> - </dialog> - <input id="iframe-input" class="target" type="date"> - <script>window.onload = parent.parent.parent.frameLoaded;</script> -'> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/push_messaging/pushmanager-supported-content-encodings.html b/third_party/WebKit/LayoutTests/http/tests/push_messaging/pushmanager-supported-content-encodings.html index 27fcc9e6..27b8ad3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/push_messaging/pushmanager-supported-content-encodings.html +++ b/third_party/WebKit/LayoutTests/http/tests/push_messaging/pushmanager-supported-content-encodings.html
@@ -17,9 +17,12 @@ assert_equals(PushManager.supportedContentEncodings, PushManager.supportedContentEncodings); assert_true(Array.isArray(PushManager.supportedContentEncodings)); - // TODO(crbug.com/679789): The `aes128gcm` Content-Encoding must be supported as well. - assert_equals(PushManager.supportedContentEncodings.length, 1); - assert_equals(PushManager.supportedContentEncodings[0], 'aesgcm'); + assert_equals(PushManager.supportedContentEncodings.length, 2); + + const encodings = Array.from(PushManager.supportedContentEncodings).sort(); + + assert_equals(encodings[0], 'aes128gcm'); + assert_equals(encodings[1], 'aesgcm'); }); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt index 5b72dad..70b9d7b0 100644 --- a/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt
@@ -5,8 +5,7 @@ Descendant of aria-hidden node List item also presentational Div in list isn't presentational -Content within label refers to label container inert button -button in inert subtree +Content within label refers to label container WebArea tree @@ -93,7 +92,7 @@ "ignored": true, "ignoredReasons": [ { - "name": "ariaHiddenElement", + "name": "ariaHidden", "value": { "type": "boolean", "value": true @@ -114,7 +113,7 @@ "ignored": true, "ignoredReasons": [ { - "name": "ariaHiddenSubtree", + "name": "ariaHiddenRoot", "value": { "type": "idref", "relatedNodes": [ @@ -179,17 +178,8 @@ } WebArea - GenericContainer - tree - img - button "Buttons are leaf nodes" - text "List item also presentational" *GenericContainer text "Div in list isn't presentational" - checkbox "Content within label refers to label container" - GenericContainer - combobox - GenericContainer { "nodeId": "<string>", "ignored": false, @@ -367,17 +357,11 @@ } WebArea - GenericContainer - tree - img - button "Buttons are leaf nodes" - text "List item also presentational" - GenericContainer - checkbox "Content within label refers to label container" - GenericContainer *combobox MenuListPopup - GenericContainer + menuitem "Options should be" + menuitem "sent down even though" + menuitem "they are grandchildren" { "nodeId": "<string>", "ignored": false, @@ -430,88 +414,3 @@ "domNode": "select" } -WebArea - combobox - MenuListPopup - *menuitem "Options should be" - menuitem "sent down even though" - menuitem "they are grandchildren" -{ - "nodeId": "<string>", - "ignored": false, - "role": { - "type": "role", - "value": "menuitem" - }, - "name": { - "type": "computedString", - "value": "Options should be", - "sources": [ - { - "type": "relatedElement", - "attribute": "aria-labelledby" - }, - { - "type": "attribute", - "attribute": "aria-label" - }, - { - "type": "contents", - "value": { - "type": "computedString", - "value": "Options should be" - } - } - ] - }, - "properties": [], - "domNode": "option" -} - -WebArea - *Ignored -{ - "nodeId": "<string>", - "ignored": true, - "ignoredReasons": [ - { - "name": "inertElement", - "value": { - "type": "boolean", - "value": true - } - } - ], - "role": { - "type": "internalRole", - "value": "Ignored" - }, - "domNode": "button" -} - -WebArea - *Ignored -{ - "nodeId": "<string>", - "ignored": true, - "ignoredReasons": [ - { - "name": "inertSubtree", - "value": { - "type": "idref", - "relatedNodes": [ - { - "idref": "inert-root", - "nodeResult": "div#inert-root" - } - ] - } - } - ], - "role": { - "type": "internalRole", - "value": "Ignored" - }, - "domNode": "button" -} -
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes.html b/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes.html index e9fff58..05d3896 100644 --- a/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes.html +++ b/third_party/WebKit/LayoutTests/inspector-protocol/accessibility/accessibility-ignoredNodes.html
@@ -51,14 +51,9 @@ <canvas role="presentation" data-dump><div>Canvas fallback content</div></canvas> <select data-dump> - <option data-dump>Options should be</option> + <option>Options should be</option> <option>sent down even though</option> <option>they are grandchildren</option> </select> - - <button inert data-dump>inert button</button> - <div id="inert-root" inert> - <button data-dump>button in inert subtree</button> - </div> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt new file mode 100644 index 0000000..70b9d7b0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt
@@ -0,0 +1,416 @@ +Non-hidden div for comparison +non-hidden treeitem +hidden non-treeitem + Buttons are leaf nodes +Descendant of aria-hidden node +List item also presentational +Div in list isn't presentational +Content within label refers to label container + +WebArea + tree + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorDisallowsChild", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + img + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorDisallowsChild", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "svg" +} + +WebArea + button "Buttons are leaf nodes" + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorIsLeafNode", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "button" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ariaHidden", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ariaHiddenRoot", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "presentationalRole", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "ol" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "inheritsPresentation", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "ol" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "li" +} + +WebArea + *GenericContainer + text "Div in list isn't presentational" +{ + "nodeId": "<string>", + "ignored": false, + "role": { + "type": "internalRole", + "value": "GenericContainer" + }, + "name": { + "type": "computedString", + "value": "", + "sources": [ + { + "type": "relatedElement", + "attribute": "aria-labelledby" + }, + { + "type": "attribute", + "attribute": "aria-label" + }, + { + "type": "attribute", + "attribute": "title" + } + ] + }, + "properties": [], + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "labelFor", + "value": { + "type": "idref", + "relatedNodes": [ + { + "idref": "checkbox", + "nodeResult": "input#checkbox" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "label" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "labelContainer", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "label" + } + ] + } + }, + { + "name": "labelFor", + "value": { + "type": "idref", + "relatedNodes": [ + { + "idref": "checkbox", + "nodeResult": "input#checkbox" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "notRendered", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "notRendered", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "probablyPresentational", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "canvas" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "presentationalRole", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "canvas" +} + +WebArea + *combobox + MenuListPopup + menuitem "Options should be" + menuitem "sent down even though" + menuitem "they are grandchildren" +{ + "nodeId": "<string>", + "ignored": false, + "role": { + "type": "role", + "value": "combobox" + }, + "name": { + "type": "computedString", + "value": "", + "sources": [ + { + "type": "relatedElement", + "attribute": "aria-labelledby" + }, + { + "type": "attribute", + "attribute": "aria-label" + }, + { + "type": "relatedElement", + "nativeSource": "label" + }, + { + "type": "attribute", + "attribute": "title" + } + ] + }, + "value": { + "type": "string", + "value": "Options should be" + }, + "properties": [ + { + "name": "invalid", + "value": { + "type": "token", + "value": "false" + } + }, + { + "name": "expanded", + "value": { + "type": "booleanOrUndefined", + "value": false + } + } + ], + "domNode": "select" +} +
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt index aabc9867..784297a5 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3206,7 +3206,6 @@ getter metaKey getter repeat getter shiftKey - getter which method constructor method getModifierState method initKeyboardEvent @@ -3544,7 +3543,6 @@ getter screenY getter shiftKey getter toElement - getter which getter x getter y method constructor
diff --git a/third_party/WebKit/LayoutTests/platform/win/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt b/third_party/WebKit/LayoutTests/platform/win/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt new file mode 100644 index 0000000..9f7000882 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/win/inspector-protocol/accessibility/accessibility-ignoredNodes-expected.txt
@@ -0,0 +1,416 @@ +Non-hidden div for comparison +non-hidden treeitem +hidden non-treeitem + Buttons are leaf nodes +Descendant of aria-hidden node +List item also presentational +Div in list isn't presentational +Content within label refers to label container + +WebArea + tree + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorDisallowsChild", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + img + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorDisallowsChild", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "svg" +} + +WebArea + button "Buttons are leaf nodes" + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ancestorIsLeafNode", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "button" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ariaHidden", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "ariaHiddenRoot", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "div" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "presentationalRole", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "ol" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "inheritsPresentation", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "ol" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "li" +} + +WebArea + *GenericContainer + text "Div in list isn't presentational" +{ + "nodeId": "<string>", + "ignored": false, + "role": { + "type": "internalRole", + "value": "GenericContainer" + }, + "name": { + "type": "computedString", + "value": "", + "sources": [ + { + "type": "relatedElement", + "attribute": "aria-labelledby" + }, + { + "type": "attribute", + "attribute": "aria-label" + }, + { + "type": "attribute", + "attribute": "title" + } + ] + }, + "properties": [], + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "labelFor", + "value": { + "type": "idref", + "relatedNodes": [ + { + "idref": "checkbox", + "nodeResult": "input#checkbox" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "label" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "labelContainer", + "value": { + "type": "idref", + "relatedNodes": [ + { + "nodeResult": "label" + } + ] + } + }, + { + "name": "labelFor", + "value": { + "type": "idref", + "relatedNodes": [ + { + "idref": "checkbox", + "nodeResult": "input#checkbox" + } + ] + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "notRendered", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "div" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "notRendered", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "span" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "probablyPresentational", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "canvas" +} + +WebArea + *Ignored +{ + "nodeId": "<string>", + "ignored": true, + "ignoredReasons": [ + { + "name": "presentationalRole", + "value": { + "type": "boolean", + "value": true + } + } + ], + "role": { + "type": "internalRole", + "value": "Ignored" + }, + "domNode": "canvas" +} + +WebArea + *combobox + MenuListPopup + menuitem "Options should be" + menuitem "sent down even though" + menuitem "they are grandchildren" +{ + "nodeId": "<string>", + "ignored": false, + "role": { + "type": "role", + "value": "combobox" + }, + "name": { + "type": "computedString", + "value": "", + "sources": [ + { + "type": "relatedElement", + "attribute": "aria-labelledby" + }, + { + "type": "attribute", + "attribute": "aria-label" + }, + { + "type": "relatedElement", + "nativeSource": "label" + }, + { + "type": "attribute", + "attribute": "title" + } + ] + }, + "value": { + "type": "string", + "value": "Options should be" + }, + "properties": [ + { + "name": "invalid", + "value": { + "type": "token", + "value": "false" + } + }, + { + "name": "expanded", + "value": { + "type": "booleanOrUndefined", + "value": false + } + } + ], + "domNode": "select" +} +
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt index 649faf1..77ccfe9 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3135,7 +3135,6 @@ getter metaKey getter repeat getter shiftKey - getter which method constructor method getModifierState method initKeyboardEvent @@ -3473,7 +3472,6 @@ getter screenY getter shiftKey getter toElement - getter which getter x getter y method constructor
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt index afbadf9..0cb0a79 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
@@ -2363,7 +2363,6 @@ getter dir getter draggable getter hidden - getter inert getter innerText getter inputMode getter isContentEditable @@ -2464,7 +2463,6 @@ setter dir setter draggable setter hidden - setter inert setter innerText setter inputMode setter lang @@ -3912,7 +3910,6 @@ getter metaKey getter repeat getter shiftKey - getter which method constructor method getModifierState method initKeyboardEvent @@ -4339,7 +4336,6 @@ getter screenY getter shiftKey getter toElement - getter which getter x getter y method constructor
diff --git a/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt index 43d3c90..6277766 100644 --- a/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt
@@ -82,7 +82,6 @@ property hasPointerCapture property hidden property id - property inert property innerHTML property innerText property inputMode @@ -1188,7 +1187,6 @@ property hasPointerCapture property hidden property id - property inert property innerHTML property innerText property inputMode
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index f59df7b..88890ad3e 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -2363,7 +2363,6 @@ getter dir getter draggable getter hidden - getter inert getter innerText getter inputMode getter isContentEditable @@ -2464,7 +2463,6 @@ setter dir setter draggable setter hidden - setter inert setter innerText setter inputMode setter lang @@ -3912,7 +3910,6 @@ getter metaKey getter repeat getter shiftKey - getter which method constructor method getModifierState method initKeyboardEvent @@ -4339,7 +4336,6 @@ getter screenY getter shiftKey getter toElement - getter which getter x getter y method constructor
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h index f8ee8c3..c49ec6c 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h
@@ -24,6 +24,9 @@ } bool AnimationsMatchForStyleRecalc(const CSSAnimationData& other) const; + bool operator==(const CSSAnimationData& other) const { + return AnimationsMatchForStyleRecalc(other); + } Timing ConvertToTiming(size_t index) const;
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 21488cce..dcdb71f 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -755,9 +755,8 @@ void Node::MarkAncestorsWithChildNeedsDistributionRecalc() { ScriptForbiddenScope forbid_script_during_raw_iteration; for (Node* node = this; node && !node->ChildNeedsDistributionRecalc(); - node = node->ParentOrShadowHostNode()) { + node = node->ParentOrShadowHostNode()) node->SetChildNeedsDistributionRecalc(); - } GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); } @@ -849,27 +848,11 @@ } bool Node::IsInert() const { - if (!isConnected() || !CanParticipateInFlatTree()) - return true; - - DCHECK(!ChildNeedsDistributionRecalc()); - const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog(); if (dialog && this != GetDocument() && - !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)) { + (!CanParticipateInFlatTree() || + !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this))) return true; - } - - if (RuntimeEnabledFeatures::inertAttributeEnabled()) { - const Element* element = this->IsElementNode() - ? ToElement(this) - : FlatTreeTraversal::ParentElement(*this); - while (element) { - if (element->hasAttribute(HTMLNames::inertAttr)) - return true; - element = FlatTreeTraversal::ParentElement(*element); - } - } return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert(); }
diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h index db84b53..3bd0fceb 100644 --- a/third_party/WebKit/Source/core/dom/Node.h +++ b/third_party/WebKit/Source/core/dom/Node.h
@@ -552,11 +552,8 @@ // This is called only when the node is focused. virtual bool ShouldHaveFocusAppearance() const; - // Whether the node is inert: - // https://html.spec.whatwg.org/multipage/interaction.html#inert - // https://github.com/WICG/inert/blob/master/README.md - // This can't be in Element because text nodes must be recognized as - // inert to prevent text selection. + // Whether the node is inert. This can't be in Element because text nodes + // must be recognized as inert to prevent text selection. bool IsInert() const; virtual LayoutRect BoundingBox() const;
diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp index bd379c0..d17dd2d 100644 --- a/third_party/WebKit/Source/core/dom/Text.cpp +++ b/third_party/WebKit/Source/core/dom/Text.cpp
@@ -464,7 +464,6 @@ LazyReattachIfAttached(); return; } - text_layout_object->SetTextWithOffset(DataImpl(), offset_of_replaced_data, length_of_replaced_data); }
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp index ee655ceb..51e99bb 100644 --- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -1519,133 +1519,7 @@ EXPECT_STREQ("Abc 1", input->value().Utf8().data()); } -static String GetMarkedText( - DocumentMarkerController& document_marker_controller, - Node* node, - int marker_index) { - DocumentMarker* marker = document_marker_controller.Markers()[marker_index]; - return node->textContent().Substring( - marker->StartOffset(), marker->EndOffset() - marker->StartOffset()); -} - -TEST_F(InputMethodControllerTest, - Marker_WhitespaceFixupAroundMarkerNotContainingSpace) { - Element* div = InsertHTMLElement( - "<div id='sample' contenteditable>Initial text blah</div>", "sample"); - - // Add marker under "text" (use TextMatch since Composition markers don't - // persist across editing operations) - EphemeralRange marker_range = PlainTextRange(8, 12).CreateRange(*div); - GetDocument().Markers().AddMarker(marker_range.StartPosition(), - marker_range.EndPosition(), - DocumentMarker::kTextMatch); - // Delete "Initial" - Vector<CompositionUnderline> empty_underlines; - Controller().SetCompositionFromExistingText(empty_underlines, 0, 7); - Controller().CommitText(String(""), empty_underlines, 0); - - // Delete "blah" - Controller().SetCompositionFromExistingText(empty_underlines, 6, 10); - Controller().CommitText(String(""), empty_underlines, 0); - - // Check that the marker is still attached to "text" and doesn't include - // either space around it - EXPECT_EQ(1u, GetDocument().Markers().MarkersFor(div->firstChild()).size()); - EXPECT_STREQ("text", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); -} - -TEST_F(InputMethodControllerTest, - Marker_WhitespaceFixupAroundMarkerBeginningWithSpace) { - Element* div = InsertHTMLElement( - "<div id='sample' contenteditable>Initial text blah</div>", "sample"); - - // Add marker under " text" (use TextMatch since Composition markers don't - // persist across editing operations) - EphemeralRange marker_range = PlainTextRange(7, 12).CreateRange(*div); - GetDocument().Markers().AddMarker(marker_range.StartPosition(), - marker_range.EndPosition(), - DocumentMarker::kTextMatch); - // Delete "Initial" - Vector<CompositionUnderline> empty_underlines; - Controller().SetCompositionFromExistingText(empty_underlines, 0, 7); - Controller().CommitText(String(""), empty_underlines, 0); - - // Delete "blah" - Controller().SetCompositionFromExistingText(empty_underlines, 6, 10); - Controller().CommitText(String(""), empty_underlines, 0); - - // Check that the marker is still attached to " text" and includes the space - // before "text" but not the space after - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("\xC2\xA0text", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); -} - -TEST_F(InputMethodControllerTest, - Marker_WhitespaceFixupAroundMarkerEndingWithSpace) { - Element* div = InsertHTMLElement( - "<div id='sample' contenteditable>Initial text blah</div>", "sample"); - - // Add marker under "text " (use TextMatch since Composition markers don't - // persist across editing operations) - EphemeralRange marker_range = PlainTextRange(8, 13).CreateRange(*div); - GetDocument().Markers().AddMarker(marker_range.StartPosition(), - marker_range.EndPosition(), - DocumentMarker::kTextMatch); - // Delete "Initial" - Vector<CompositionUnderline> empty_underlines; - Controller().SetCompositionFromExistingText(empty_underlines, 0, 7); - Controller().CommitText(String(""), empty_underlines, 0); - - // Delete "blah" - Controller().SetCompositionFromExistingText(empty_underlines, 6, 10); - Controller().CommitText(String(""), empty_underlines, 0); - - // Check that the marker is still attached to "text " and includes the space - // after "text" but not the space before - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("text\xC2\xA0", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); -} - -TEST_F(InputMethodControllerTest, - Marker_WhitespaceFixupAroundMarkerBeginningAndEndingWithSpaces) { - Element* div = InsertHTMLElement( - "<div id='sample' contenteditable>Initial text blah</div>", "sample"); - - // Add marker under " text " (use TextMatch since Composition markers don't - // persist across editing operations) - EphemeralRange marker_range = PlainTextRange(7, 13).CreateRange(*div); - GetDocument().Markers().AddMarker(marker_range.StartPosition(), - marker_range.EndPosition(), - DocumentMarker::kTextMatch); - - // Delete "Initial" - Vector<CompositionUnderline> empty_underlines; - Controller().SetCompositionFromExistingText(empty_underlines, 0, 7); - Controller().CommitText(String(""), empty_underlines, 0); - - // Delete "blah" - Controller().SetCompositionFromExistingText(empty_underlines, 6, 10); - Controller().CommitText(String(""), empty_underlines, 0); - - // Check that the marker is still attached to " text " and includes both the - // space before "text" and the space after - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("\xC2\xA0text\xC2\xA0", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); -} - -TEST_F(InputMethodControllerTest, Marker_ReplaceStartOfMarker) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_ReplaceStartOfMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>Initial text</div>", "sample"); @@ -1660,15 +1534,12 @@ Controller().SetCompositionFromExistingText(empty_underlines, 0, 7); Controller().CommitText(String("Original"), empty_underlines, 0); - // Verify marker is under "Original text" - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("Original text", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceTextContainsStartOfMarker) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_ReplaceTextContainsStartOfMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>This is some initial text</div>", "sample"); @@ -1684,15 +1555,11 @@ Controller().SetCompositionFromExistingText(empty_underlines, 8, 20); Controller().CommitText(String("boring"), empty_underlines, 0); - // Verify marker is under " text" - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - EXPECT_STREQ(" text", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceEndOfMarker) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_ReplaceEndOfMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>Initial text</div>", "sample"); @@ -1707,15 +1574,12 @@ Controller().SetCompositionFromExistingText(empty_underlines, 8, 12); Controller().CommitText(String("string"), empty_underlines, 0); - // Verify marker is under "Initial string" - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("Initial string", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceTextContainsEndOfMarker) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_ReplaceTextContainsEndOfMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>This is some initial text</div>", "sample"); @@ -1733,15 +1597,11 @@ EXPECT_STREQ("This is some content", div->innerHTML().Utf8().data()); - // Verify marker is under "some " - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - EXPECT_STREQ("some ", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceEntireMarker) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_ReplaceEntireMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>Initial text</div>", "sample"); @@ -1756,15 +1616,12 @@ Controller().SetCompositionFromExistingText(empty_underlines, 8, 12); Controller().CommitText(String("string"), empty_underlines, 0); - // Verify marker is under "string" - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - ASSERT_STREQ("string", - GetMarkedText(GetDocument().Markers(), div->firstChild(), 0) - .Utf8() - .data()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceTextWithMarkerAtBeginning) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_ReplaceTextWithMarkerAtBeginning) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>Initial text</div>", "sample"); @@ -1785,7 +1642,8 @@ EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_ReplaceTextWithMarkerAtEnd) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_ReplaceTextWithMarkerAtEnd) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>Initial text</div>", "sample"); @@ -1806,7 +1664,7 @@ EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_Deletions) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_Deletions) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>1111122222333334444455555</div>", "sample"); @@ -1844,22 +1702,17 @@ Controller().CommitText(String(""), empty_underlines, 0); // Verify markers were updated correctly - EXPECT_EQ(4u, GetDocument().Markers().Markers().size()); + EXPECT_EQ(2u, GetDocument().Markers().Markers().size()); EXPECT_EQ(0u, GetDocument().Markers().Markers()[0]->StartOffset()); EXPECT_EQ(5u, GetDocument().Markers().Markers()[0]->EndOffset()); - EXPECT_EQ(5u, GetDocument().Markers().Markers()[1]->StartOffset()); - EXPECT_EQ(8u, GetDocument().Markers().Markers()[1]->EndOffset()); - - EXPECT_EQ(8u, GetDocument().Markers().Markers()[2]->StartOffset()); - EXPECT_EQ(11u, GetDocument().Markers().Markers()[2]->EndOffset()); - - EXPECT_EQ(11u, GetDocument().Markers().Markers()[3]->StartOffset()); - EXPECT_EQ(16u, GetDocument().Markers().Markers()[3]->EndOffset()); + EXPECT_EQ(11u, GetDocument().Markers().Markers()[1]->StartOffset()); + EXPECT_EQ(16u, GetDocument().Markers().Markers()[1]->EndOffset()); } -TEST_F(InputMethodControllerTest, Marker_DeleteExactlyOnMarker) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_DeleteExactlyOnMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>1111122222333334444455555</div>", "sample"); @@ -1878,7 +1731,7 @@ EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_DeleteMiddleOfMarker) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_DeleteMiddleOfMarker) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>1111122222333334444455555</div>", "sample"); @@ -1893,13 +1746,12 @@ Controller().SetCompositionFromExistingText(empty_underlines, 6, 9); Controller().CommitText(String(""), empty_underlines, 0); - EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); - - EXPECT_EQ(5u, GetDocument().Markers().Markers()[0]->StartOffset()); - EXPECT_EQ(7u, GetDocument().Markers().Markers()[0]->EndOffset()); + // Verify marker was removed + EXPECT_EQ(0u, GetDocument().Markers().Markers().size()); } -TEST_F(InputMethodControllerTest, Marker_InsertInMarkerInterior) { +TEST_F(InputMethodControllerTest, + ContentDependentMarker_InsertInMarkerInterior) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>1111122222333334444455555</div>", "sample"); @@ -1926,19 +1778,16 @@ Controller().SetComposition("", empty_underlines, 7, 7); Controller().CommitText(String("66666"), empty_underlines, -7); - EXPECT_EQ(3u, GetDocument().Markers().Markers().size()); + EXPECT_EQ(2u, GetDocument().Markers().Markers().size()); EXPECT_EQ(0u, GetDocument().Markers().Markers()[0]->StartOffset()); EXPECT_EQ(5u, GetDocument().Markers().Markers()[0]->EndOffset()); - EXPECT_EQ(5u, GetDocument().Markers().Markers()[1]->StartOffset()); - EXPECT_EQ(15u, GetDocument().Markers().Markers()[1]->EndOffset()); - - EXPECT_EQ(15u, GetDocument().Markers().Markers()[2]->StartOffset()); - EXPECT_EQ(20u, GetDocument().Markers().Markers()[2]->EndOffset()); + EXPECT_EQ(15u, GetDocument().Markers().Markers()[1]->StartOffset()); + EXPECT_EQ(20u, GetDocument().Markers().Markers()[1]->EndOffset()); } -TEST_F(InputMethodControllerTest, Marker_InsertBetweenMarkers) { +TEST_F(InputMethodControllerTest, ContentDependentMarker_InsertBetweenMarkers) { Element* div = InsertHTMLElement( "<div id='sample' contenteditable>1111122222333334444455555</div>", "sample");
diff --git a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp index d1f37ee..4c0ad5a6 100644 --- a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp +++ b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp
@@ -45,8 +45,8 @@ bool CompositionMarkerListImpl::ShiftMarkers(unsigned offset, unsigned old_length, unsigned new_length) { - return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, - new_length); + return DocumentMarkerListEditor::ShiftMarkersContentIndependent( + &markers_, offset, old_length, new_length); } DEFINE_TRACE(CompositionMarkerListImpl) {
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp index ee00cee..d9a181b6 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp
@@ -81,10 +81,44 @@ return doc_dirty; } -bool DocumentMarkerListEditor::ShiftMarkers(MarkerList* list, - unsigned offset, - unsigned old_length, - unsigned new_length) { +// TODO(rlanday): make this not take O(n^2) time when all the markers are +// removed +bool DocumentMarkerListEditor::ShiftMarkersContentDependent( + MarkerList* list, + unsigned offset, + unsigned old_length, + unsigned new_length) { + bool did_shift_marker = false; + for (MarkerList::iterator it = list->begin(); it != list->end(); ++it) { + DocumentMarker& marker = **it; + + // marked text is neither changed nor shifted + if (marker.EndOffset() <= offset) + continue; + + // marked text is (potentially) changed by edit, remove marker + if (marker.StartOffset() < offset + old_length) { + list->erase(it - list->begin()); + --it; + did_shift_marker = true; + continue; + } + + // marked text is shifted but not changed + marker.ShiftOffsets(new_length - old_length); + did_shift_marker = true; + } + + return did_shift_marker; +} + +// TODO(rlanday): make this not take O(n^2) time when all the markers are +// removed +bool DocumentMarkerListEditor::ShiftMarkersContentIndependent( + MarkerList* list, + unsigned offset, + unsigned old_length, + unsigned new_length) { bool did_shift_marker = false; for (MarkerList::iterator it = list->begin(); it != list->end(); ++it) { DocumentMarker& marker = **it;
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h index 55d10c1a..5da0620 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h
@@ -26,11 +26,25 @@ // Returns true if a marker was removed, false otherwise. static bool RemoveMarkers(MarkerList*, unsigned start_offset, int length); + // The following two methods both update the position of a list's + // DocumentMarkers in response to editing operations. The difference is that + // if an editing operation actually changes the text spanned by a marker (as + // opposed to only changing text before or after the marker), + // ShiftMarkersContentDependent will remove the marker, and + // ShiftMarkersContentIndependent will attempt to keep tracking the marked + // region across edits. + // Returns true if a marker was shifted or removed, false otherwise. - static bool ShiftMarkers(MarkerList*, - unsigned offset, - unsigned old_length, - unsigned new_length); + static bool ShiftMarkersContentDependent(MarkerList*, + unsigned offset, + unsigned old_length, + unsigned new_length); + + // Returns true if a marker was shifted or removed, false otherwise. + static bool ShiftMarkersContentIndependent(MarkerList*, + unsigned offset, + unsigned old_length, + unsigned new_length); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp index f0636a5..fa83de2a 100644 --- a/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp +++ b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.cpp
@@ -68,8 +68,8 @@ bool SpellCheckMarkerListImpl::ShiftMarkers(unsigned offset, unsigned old_length, unsigned new_length) { - return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, - new_length); + return DocumentMarkerListEditor::ShiftMarkersContentDependent( + &markers_, offset, old_length, new_length); } DEFINE_TRACE(SpellCheckMarkerListImpl) {
diff --git a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp index cea15c01..9eede22c 100644 --- a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp +++ b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp
@@ -44,8 +44,8 @@ bool TextMatchMarkerListImpl::ShiftMarkers(unsigned offset, unsigned old_length, unsigned new_length) { - return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, - new_length); + return DocumentMarkerListEditor::ShiftMarkersContentDependent( + &markers_, offset, old_length, new_length); } DEFINE_TRACE(TextMatchMarkerListImpl) {
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp index d1a38933..e95396cc 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
@@ -187,11 +187,11 @@ return true; } -int KeyboardEvent::which() const { +unsigned KeyboardEvent::which() const { // Netscape's "which" returns a virtual key code for keydown and keyup, and a // character code for keypress. That's exactly what IE's "keyCode" returns. // So they are the same for keyboard events. - return keyCode(); + return (unsigned)keyCode(); } void KeyboardEvent::InitLocationModifiers(unsigned location) {
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.h b/third_party/WebKit/Source/core/events/KeyboardEvent.h index fb842d4..659fd97 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.h +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.h
@@ -84,7 +84,7 @@ const AtomicString& InterfaceName() const override; bool IsKeyboardEvent() const override; - int which() const override; + unsigned which() const override; bool isComposing() const { return is_composing_; } DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.idl b/third_party/WebKit/Source/core/events/KeyboardEvent.idl index d61be61..a42c3cd 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.idl +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.idl
@@ -56,5 +56,4 @@ // https://w3c.github.io/uievents/#KeyboardEvent-supplemental-interface readonly attribute long charCode; readonly attribute long keyCode; - readonly attribute long which; };
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp index 62b5aed..29d148a 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.cpp +++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -396,13 +396,13 @@ return button_; } -int MouseEvent::which() const { +unsigned MouseEvent::which() const { // For the DOM, the return values for left, middle and right mouse buttons are // 0, 1, 2, respectively. // For the Netscape "which" property, the return values for left, middle and // right mouse buttons are 1, 2, 3, respectively. // So we must add 1. - return button_ + 1; + return (unsigned)(button_ + 1); } Node* MouseEvent::toElement() const {
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.h b/third_party/WebKit/Source/core/events/MouseEvent.h index eec939b..7d948b1 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.h +++ b/third_party/WebKit/Source/core/events/MouseEvent.h
@@ -113,7 +113,7 @@ const AtomicString& InterfaceName() const override; bool IsMouseEvent() const override; - int which() const final; + unsigned which() const override; EventDispatchMediator* CreateMediator() override;
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.idl b/third_party/WebKit/Source/core/events/MouseEvent.idl index 8cbea08..d67152d 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.idl +++ b/third_party/WebKit/Source/core/events/MouseEvent.idl
@@ -73,7 +73,6 @@ // Non-standard [MeasureAs=MouseEventFromElement] readonly attribute Node fromElement; [MeasureAs=MouseEventToElement] readonly attribute Node toElement; - [MeasureAs=MouseEventWhich] readonly attribute long which; [Measure] readonly attribute long layerX; [Measure] readonly attribute long layerY; };
diff --git a/third_party/WebKit/Source/core/events/UIEvent.cpp b/third_party/WebKit/Source/core/events/UIEvent.cpp index 3356ba6..0537edc 100644 --- a/third_party/WebKit/Source/core/events/UIEvent.cpp +++ b/third_party/WebKit/Source/core/events/UIEvent.cpp
@@ -90,7 +90,7 @@ return EventNames::UIEvent; } -int UIEvent::which() const { +unsigned UIEvent::which() const { return 0; }
diff --git a/third_party/WebKit/Source/core/events/UIEvent.h b/third_party/WebKit/Source/core/events/UIEvent.h index d79d1c3..0594a039 100644 --- a/third_party/WebKit/Source/core/events/UIEvent.h +++ b/third_party/WebKit/Source/core/events/UIEvent.h
@@ -70,7 +70,7 @@ const AtomicString& InterfaceName() const override; bool IsUIEvent() const final; - virtual int which() const; + virtual unsigned which() const; DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/events/UIEvent.idl b/third_party/WebKit/Source/core/events/UIEvent.idl index bbf6c47..2b0e986 100644 --- a/third_party/WebKit/Source/core/events/UIEvent.idl +++ b/third_party/WebKit/Source/core/events/UIEvent.idl
@@ -34,6 +34,5 @@ [Default=Undefined] optional Window? view, [Default=Undefined] optional long detail); - // FIXME: this belongs on the KeyboardEvent interface - [MeasureAs=UIEventWhich] readonly attribute long which; + readonly attribute unsigned long which; };
diff --git a/third_party/WebKit/Source/core/exported/WebViewBase.h b/third_party/WebKit/Source/core/exported/WebViewBase.h index ebe4165..ed45829 100644 --- a/third_party/WebKit/Source/core/exported/WebViewBase.h +++ b/third_party/WebKit/Source/core/exported/WebViewBase.h
@@ -36,7 +36,7 @@ class WebInputMethodControllerImpl; class WebKeyboardEvent; class WebLayer; -class WebLocalFrameImpl; +class WebLocalFrameBase; class WebLayerTreeView; class WebPagePopupImpl; class WebSettingsImpl; @@ -71,7 +71,7 @@ // Returns the main frame associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. - virtual WebLocalFrameImpl* MainFrameImpl() const = 0; + virtual WebLocalFrameBase* MainFrameImpl() const = 0; virtual float DefaultMinimumPageScaleFactor() const = 0; virtual float DefaultMaximumPageScaleFactor() const = 0; @@ -137,8 +137,8 @@ // 2) Calling updateAllLifecyclePhases() is a no-op. // After calling WebWidget::updateAllLifecyclePhases(), expect to get this // notification unless the view did not need a layout. - virtual void LayoutUpdated(WebLocalFrameImpl*) = 0; - virtual void ResizeAfterLayout(WebLocalFrameImpl*) = 0; + virtual void LayoutUpdated(WebLocalFrameBase*) = 0; + virtual void ResizeAfterLayout(WebLocalFrameBase*) = 0; virtual void UpdatePageDefinedViewportConstraints( const ViewportDescription&) = 0;
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index 4fadc0d..9f95cc7 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -437,8 +437,6 @@ // The above items are available in M40 branch. kSetReferrerPolicy = 593, - kMouseEventWhich = 595, - kUIEventWhich = 598, kTextWholeText = 599, kNotificationCloseEvent = 603, kStyleMedia = 606, @@ -1411,7 +1409,6 @@ kCSSValueUserModifyReadOnly = 1798, kCSSValueUserModifyReadWrite = 1799, kCSSValueUserModifyReadWritePlaintextOnly = 1800, - kV8TextDetector_Detect_Method = 1801, kCSSValueOnDemand = 1802, kServiceWorkerNavigationPreload = 1803, kFullscreenRequestWithPendingElement = 1804, @@ -1604,7 +1601,8 @@ kShapeDetection_FaceDetectorConstructor = 1992, kShapeDetection_TextDetectorConstructor = 1993, kCredentialManagerCredentialRequestOptionsOnlyUnmediated = 1994, - kInertAttribute = 1995, + // TODO(aboxhall): Reuse value 1995 when + // https://codereview.chromium.org/2088453002 is relanded. kPluginInstanceAccessFromIsolatedWorld = 1996, kPluginInstanceAccessFromMainWorld = 1997,
diff --git a/third_party/WebKit/Source/core/frame/WebLocalFrameBase.h b/third_party/WebKit/Source/core/frame/WebLocalFrameBase.h index ef7213c0..81c6d8b 100644 --- a/third_party/WebKit/Source/core/frame/WebLocalFrameBase.h +++ b/third_party/WebKit/Source/core/frame/WebLocalFrameBase.h
@@ -76,6 +76,8 @@ virtual SharedWorkerRepositoryClientImpl* SharedWorkerRepositoryClient() const = 0; virtual TextCheckerClient& GetTextCheckerClient() const = 0; + virtual TextFinder* GetTextFinder() const = 0; + virtual void SetInputEventsTransformForEmulation(const IntSize&, float) = 0; DEFINE_INLINE_VIRTUAL_TRACE() {}
diff --git a/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 b/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 index 4169fa1..99c9455 100644 --- a/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 +++ b/third_party/WebKit/Source/core/html/HTMLAttributeNames.json5
@@ -146,7 +146,6 @@ "icon", "id", "incremental", - "inert", "inputmode", "integrity", "is",
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp index 2eb5239..e5326701 100644 --- a/third_party/WebKit/Source/core/html/HTMLElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -463,8 +463,6 @@ DirAttributeChanged(params.new_value); } else if (params.name == langAttr) { PseudoStateChanged(CSSSelector::kPseudoLang); - } else if (params.name == inertAttr) { - UseCounter::Count(GetDocument(), UseCounter::kInertAttribute); } else { const AtomicString& event_name = EventNameForAttributeName(params.name); if (!event_name.IsNull()) {
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.idl b/third_party/WebKit/Source/core/html/HTMLElement.idl index 74763c0..95b0d0a7f 100644 --- a/third_party/WebKit/Source/core/html/HTMLElement.idl +++ b/third_party/WebKit/Source/core/html/HTMLElement.idl
@@ -32,7 +32,6 @@ [CEReactions, Reflect] attribute boolean hidden; void click(); [CEReactions, CustomElementCallbacks] attribute long tabIndex; - [CEReactions, RuntimeEnabled=InertAttribute, Reflect] attribute boolean inert; void focus(); void blur(); [CEReactions, Reflect] attribute DOMString accessKey;
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp index 512f64f..79ca9899 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1539,6 +1539,12 @@ return available_free_space / 2; } + if (data.Distribution() == kContentDistributionSpaceEvenly) { + if (available_free_space > 0 && number_of_items) + return available_free_space / (number_of_items + 1); + // Fallback to 'center' + return available_free_space / 2; + } return LayoutUnit(); } @@ -1552,6 +1558,8 @@ if (data.Distribution() == kContentDistributionSpaceAround || data.Distribution() == kContentDistributionStretch) return available_free_space / number_of_items; + if (data.Distribution() == kContentDistributionSpaceEvenly) + return available_free_space / (number_of_items + 1); } return LayoutUnit(); }
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index 0b5df2e..88a3709 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1299,6 +1299,19 @@ if (request.Url().IsEmpty() || substitute_data.IsValid()) return kNavigationPolicyCurrentTab; + // Check for non-escaped new lines in the url. + if (request.Url().WhitespaceRemoved()) { + Deprecation::CountDeprecation( + frame_, UseCounter::kCanRequestURLHTTPContainingNewline); + if (request.Url().ProtocolIsInHTTPFamily()) { + if (RuntimeEnabledFeatures::restrictCanRequestURLCharacterSetEnabled()) + return kNavigationPolicyIgnore; + } else { + UseCounter::Count(frame_, + UseCounter::kCanRequestURLNonHTTPContainingNewline); + } + } + Settings* settings = frame_->GetSettings(); if (MaybeCheckCSP(request, type, frame_, policy, should_check_main_world_content_security_policy ==
diff --git a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp index 3b9086f..1007c74 100644 --- a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp +++ b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp
@@ -319,11 +319,7 @@ bool StyleRareNonInheritedData::AnimationDataEquivalent( const StyleRareNonInheritedData& o) const { - if (!animations_ && !o.animations_) - return true; - if (!animations_ || !o.animations_) - return false; - return animations_->AnimationsMatchForStyleRecalc(*o.animations_); + return DataEquivalent(animations_, o.animations_); } bool StyleRareNonInheritedData::TransitionDataEquivalent(
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js index 41c8a98..0fea753 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js
@@ -574,11 +574,11 @@ case 'ancestorIsLeafNode': reasonElement = UI.formatLocalized('Ancestor\'s children are all presentational:\u00a0', []); break; - case 'ariaHiddenElement': + case 'ariaHidden': var ariaHiddenSpan = createElement('span', 'source-code').textContent = 'aria-hidden'; reasonElement = UI.formatLocalized('Element is %s.', [ariaHiddenSpan]); break; - case 'ariaHiddenSubTree': + case 'ariaHiddenRoot': var ariaHiddenSpan = createElement('span', 'source-code').textContent = 'aria-hidden'; var trueSpan = createElement('span', 'source-code').textContent = 'true'; reasonElement = UI.formatLocalized('%s is %s on ancestor:\u00a0', [ariaHiddenSpan, trueSpan]); @@ -589,12 +589,9 @@ case 'emptyText': reasonElement = UI.formatLocalized('No text content.', []); break; - case 'inertElement': + case 'inert': reasonElement = UI.formatLocalized('Element is inert.', []); break; - case 'inertSubtree': - reasonElement = UI.formatLocalized('Element is in an inert subtree from\u00a0', []); - break; case 'inheritsPresentation': reasonElement = UI.formatLocalized('Element inherits presentational role from\u00a0', []); break;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp index a08faf2..43739e3 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp
@@ -27,7 +27,6 @@ #include "SkMatrix44.h" #include "core/dom/AccessibleNode.h" -#include "core/html/HTMLSelectElement.h" #include "modules/accessibility/AXMenuListPopup.h" #include "modules/accessibility/AXObjectCacheImpl.h" @@ -64,26 +63,6 @@ return element_; } -AXObjectImpl* AXMenuListOption::ComputeParent() const { - Node* node = GetNode(); - if (!node) - return nullptr; - HTMLSelectElement* select = toHTMLOptionElement(node)->OwnerSelectElement(); - if (!select) - return nullptr; - AXObjectImpl* select_ax_object = AxObjectCache().GetOrCreate(select); - if (select_ax_object->HasChildren()) { - const auto& child_objects = select_ax_object->Children(); - DCHECK(!child_objects.IsEmpty()); - DCHECK_EQ(child_objects.size(), 1UL); - DCHECK(child_objects[0]->IsMenuListPopup()); - ToAXMenuListPopup(child_objects[0].Get())->UpdateChildrenIfNecessary(); - } else { - select_ax_object->UpdateChildrenIfNecessary(); - } - return parent_.Get(); -} - bool AXMenuListOption::IsEnabled() const { // isDisabledFormControl() returns true if the parent <select> element is // disabled, which we don't want.
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h index 6d924da..3447fee 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h
@@ -54,7 +54,6 @@ bool IsDetached() const override { return !element_; } AccessibilityRole RoleValue() const override; bool CanHaveChildren() const override { return false; } - AXObjectImpl* ComputeParent() const override; Element* ActionElement() const override; bool IsEnabled() const override;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h index 0f710320b..7eaee499 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h +++ b/third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.h
@@ -49,7 +49,6 @@ void DidShow(); void DidHide(); AXObjectImpl* ActiveDescendant() final; - void UpdateChildrenIfNecessary() override; private: explicit AXMenuListPopup(AXObjectCacheImpl&); @@ -61,6 +60,7 @@ bool IsVisible() const override; bool Press() override; void AddChildren() override; + void UpdateChildrenIfNecessary() override; bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const override; AXMenuListOption* MenuListOptionAXObject(HTMLElement*) const;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp index 1b6ab5e..fb07f28 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -39,7 +39,6 @@ #include "core/frame/Settings.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLCanvasElement.h" -#include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLLabelElement.h" @@ -592,8 +591,11 @@ if (!obj) return; + bool parent_already_exists = obj->ParentObjectIfExists(); obj->TextChanged(); PostNotification(obj, AXObjectCacheImpl::kAXTextChanged); + if (parent_already_exists) + obj->NotifyIfIgnoredValueChanged(); } void AXObjectCacheImpl::UpdateCacheAfterNodeIsAttached(Node* node) {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h index 04a9474f..d307561 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h
@@ -54,7 +54,6 @@ virtual ~AXObjectCacheImpl(); DECLARE_VIRTUAL_TRACE(); - Document& GetDocument() { return *document_; } AXObjectImpl* FocusedObject(); void Dispose() override;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp index 27e1826..356be92f 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.cpp
@@ -598,26 +598,7 @@ } } -bool AXObjectImpl::AccessibilityIsIgnored() { - Node* node = GetNode(); - if (!node) { - AXObjectImpl* parent = this->ParentObject(); - while (!node && parent) { - node = parent->GetNode(); - parent = parent->ParentObject(); - } - } - - if (node) - node->UpdateDistribution(); - - // TODO(aboxhall): Instead of this, propagate inert down through frames - Document* document = GetDocument(); - while (document && document->LocalOwner()) { - document->LocalOwner()->UpdateDistribution(); - document = document->LocalOwner()->ownerDocument(); - } - +bool AXObjectImpl::AccessibilityIsIgnored() const { UpdateCachedAttributeValuesIfNeeded(); return cached_is_ignored_; } @@ -699,16 +680,11 @@ ignored_reasons->push_back( IgnoredReason(kAXActiveModalDialog, dialog_object)); } else { - ignored_reasons->push_back(IgnoredReason(kAXInertElement)); + ignored_reasons->push_back(IgnoredReason(kAXInert)); } } else { - const AXObjectImpl* inert_root_el = InertRoot(); - if (inert_root_el == this) { - ignored_reasons->push_back(IgnoredReason(kAXInertElement)); - } else { - ignored_reasons->push_back( - IgnoredReason(kAXInertSubtree, inert_root_el)); - } + // TODO(aboxhall): handle inert attribute if it eventuates + ignored_reasons->push_back(IgnoredReason(kAXInert)); } } return true; @@ -726,10 +702,10 @@ if (hidden_root) { if (ignored_reasons) { if (hidden_root == this) { - ignored_reasons->push_back(IgnoredReason(kAXAriaHiddenElement)); + ignored_reasons->push_back(IgnoredReason(kAXAriaHidden)); } else { ignored_reasons->push_back( - IgnoredReason(kAXAriaHiddenSubtree, hidden_root)); + IgnoredReason(kAXAriaHiddenRoot, hidden_root)); } } return true; @@ -764,26 +740,6 @@ return 0; } -const AXObjectImpl* AXObjectImpl::InertRoot() const { - const AXObjectImpl* object = this; - if (!RuntimeEnabledFeatures::inertAttributeEnabled()) - return 0; - - while (object && !object->IsAXNodeObject()) - object = object->ParentObject(); - Node* node = object->GetNode(); - Element* element = node->IsElementNode() - ? ToElement(node) - : FlatTreeTraversal::ParentElement(*node); - while (element) { - if (element->hasAttribute(inertAttr)) - return AxObjectCache().GetOrCreate(element); - element = FlatTreeTraversal::ParentElement(*element); - } - - return 0; -} - bool AXObjectImpl::IsDescendantOfDisabledNode() const { UpdateCachedAttributeValuesIfNeeded(); return cached_is_descendant_of_disabled_node_;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h index f94ffcb..cd91e85c 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h
@@ -144,12 +144,11 @@ kAXActiveModalDialog, kAXAncestorDisallowsChild, kAXAncestorIsLeafNode, - kAXAriaHiddenElement, - kAXAriaHiddenSubtree, + kAXAriaHidden, + kAXAriaHiddenRoot, kAXEmptyAlt, kAXEmptyText, - kAXInertElement, - kAXInertSubtree, + kAXInert, kAXInheritsPresentation, kAXLabelContainer, kAXLabelFor, @@ -466,7 +465,7 @@ virtual bool CanSetSelectedAttribute() const { return false; } // Whether objects are ignored, i.e. not included in the tree. - bool AccessibilityIsIgnored(); + bool AccessibilityIsIgnored() const; typedef HeapVector<IgnoredReason> IgnoredReasons; virtual bool ComputeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const { return true; @@ -857,8 +856,6 @@ return nullptr; } - const AXObjectImpl* InertRoot() const; - mutable Member<AXObjectImpl> parent_; // The following cached attribute values (the ones starting with m_cached*)
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp index 090379f4..ea56db8 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -475,9 +475,9 @@ *nodes, *cache)); return Response::OK(); } else { - (*nodes)->addItem(BuildProtocolAXObjectImpl( - *inspected_ax_object, inspected_ax_object, - fetch_relatives.fromMaybe(true), *nodes, *cache)); + (*nodes)->addItem( + BuildProtocolAXObject(*inspected_ax_object, inspected_ax_object, + fetch_relatives.fromMaybe(true), *nodes, *cache)); } if (!inspected_ax_object) @@ -500,8 +500,8 @@ AXObjectCacheImpl& cache) const { AXObjectImpl* ancestor = &first_ancestor; while (ancestor) { - nodes->addItem(BuildProtocolAXObjectImpl(*ancestor, inspected_ax_object, - true, nodes, cache)); + nodes->addItem(BuildProtocolAXObject(*ancestor, inspected_ax_object, true, + nodes, cache)); ancestor = ancestor->ParentObjectUnignored(); } } @@ -577,7 +577,7 @@ // Populate parent and ancestors. std::unique_ptr<AXNode> parent_node_object = - BuildProtocolAXObjectImpl(*parent_ax_object, nullptr, true, nodes, cache); + BuildProtocolAXObject(*parent_ax_object, nullptr, true, nodes, cache); std::unique_ptr<protocol::Array<AXNodeId>> child_ids = protocol::Array<AXNodeId>::create(); child_ids->addItem(String::Number(kIDForInspectedNodeWithNoAXNode)); @@ -590,7 +590,7 @@ AddAncestors(*grandparent_ax_object, nullptr, nodes, cache); } -std::unique_ptr<AXNode> InspectorAccessibilityAgent::BuildProtocolAXObjectImpl( +std::unique_ptr<AXNode> InspectorAccessibilityAgent::BuildProtocolAXObject( AXObjectImpl& ax_object, AXObjectImpl* inspected_ax_object, bool fetch_relatives, @@ -724,16 +724,15 @@ child_ids->addItem(String::Number(child_ax_object.AxObjectID())); if (&child_ax_object == inspected_ax_object) continue; - if (&ax_object != inspected_ax_object) { - if (!inspected_ax_object) - continue; - if (&ax_object != inspected_ax_object->ParentObjectUnignored()) - continue; + if (&ax_object != inspected_ax_object && + (ax_object.GetNode() || + ax_object.ParentObjectUnignored() != inspected_ax_object)) { + continue; } // Only add children of inspected node (or un-inspectable children of // inspected node) to returned nodes. - std::unique_ptr<AXNode> child_node = BuildProtocolAXObjectImpl( + std::unique_ptr<AXNode> child_node = BuildProtocolAXObject( child_ax_object, inspected_ax_object, true, nodes, cache); nodes->addItem(std::move(child_node)); }
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h index c93ef9d..4f836ec6 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h
@@ -47,7 +47,7 @@ AXNode&, std::unique_ptr<protocol::Array<AXNode>>& nodes, AXObjectCacheImpl&) const; - std::unique_ptr<AXNode> BuildProtocolAXObjectImpl( + std::unique_ptr<AXNode> BuildProtocolAXObject( AXObjectImpl&, AXObjectImpl* inspected_ax_object, bool fetch_relatives, @@ -74,11 +74,6 @@ AXObjectImpl* inspected_ax_object, std::unique_ptr<protocol::Array<AXNode>>& nodes, AXObjectCacheImpl&) const; - void addChild(std::unique_ptr<protocol::Array<AXNodeId>>& child_ids, - AXObjectImpl& child_ax_object, - AXObjectImpl* inspected_ax_object, - std::unique_ptr<protocol::Array<AXNode>>& nodes, - AXObjectCacheImpl&) const; void AddChildren(AXObjectImpl&, AXObjectImpl* inspected_ax_object, std::unique_ptr<protocol::Array<AXNodeId>>& child_ids,
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorTypeBuilderHelper.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorTypeBuilderHelper.cpp index 897aa82..18e16d3d 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorTypeBuilderHelper.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorTypeBuilderHelper.cpp
@@ -26,18 +26,16 @@ return "ancestorDisallowsChild"; case kAXAncestorIsLeafNode: return "ancestorIsLeafNode"; - case kAXAriaHiddenElement: - return "ariaHiddenElement"; - case kAXAriaHiddenSubtree: - return "ariaHiddenSubtree"; + case kAXAriaHidden: + return "ariaHidden"; + case kAXAriaHiddenRoot: + return "ariaHiddenRoot"; case kAXEmptyAlt: return "emptyAlt"; case kAXEmptyText: return "emptyText"; - case kAXInertElement: - return "inertElement"; - case kAXInertSubtree: - return "inertSubtree"; + case kAXInert: + return "inert"; case kAXInheritsPresentation: return "inheritsPresentation"; case kAXLabelContainer: @@ -99,7 +97,7 @@ .build(); } -std::unique_ptr<AXRelatedNode> RelatedNodeForAXObjectImpl( +std::unique_ptr<AXRelatedNode> RelatedNodeForAXObject( const AXObjectImpl& ax_object, String* name = nullptr) { Node* node = ax_object.GetNode(); @@ -129,7 +127,7 @@ const String& value_type) { std::unique_ptr<protocol::Array<AXRelatedNode>> related_nodes = protocol::Array<AXRelatedNode>::create(); - related_nodes->addItem(RelatedNodeForAXObjectImpl(ax_object, name)); + related_nodes->addItem(RelatedNodeForAXObject(ax_object, name)); return AXValue::create() .setType(value_type) .setRelatedNodes(std::move(related_nodes)) @@ -143,8 +141,8 @@ protocol::Array<AXRelatedNode>::create(); for (unsigned i = 0; i < related_objects.size(); i++) { std::unique_ptr<AXRelatedNode> frontend_related_node = - RelatedNodeForAXObjectImpl(*(related_objects[i]->object), - &(related_objects[i]->text)); + RelatedNodeForAXObject(*(related_objects[i]->object), + &(related_objects[i]->text)); if (frontend_related_node) frontend_related_nodes->addItem(std::move(frontend_related_node)); } @@ -161,7 +159,7 @@ protocol::Array<AXRelatedNode>::create(); for (unsigned i = 0; i < ax_objects.size(); i++) { std::unique_ptr<AXRelatedNode> related_node = - RelatedNodeForAXObjectImpl(*(ax_objects[i].Get())); + RelatedNodeForAXObject(*(ax_objects[i].Get())); if (related_node) related_nodes->addItem(std::move(related_node)); }
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp b/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp index 3409e1a..e31408b 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp
@@ -44,7 +44,7 @@ // static Vector<String> PushManager::supportedContentEncodings() { - return Vector<String>({"aesgcm"}); + return Vector<String>({"aes128gcm", "aesgcm"}); } ScriptPromise PushManager::subscribe(ScriptState* script_state,
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index 2095809..a358825 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -606,6 +606,7 @@ "exported/WebRTCStatsRequest.cpp", "exported/WebRTCStatsResponse.cpp", "exported/WebRTCVoidRequest.cpp", + "exported/WebRuntimeFeatures.cpp", "exported/WebScrollbarImpl.cpp", "exported/WebScrollbarImpl.h", "exported/WebScrollbarThemeClientImpl.cpp",
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 index 66a09ac..b6f4495 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -505,10 +505,6 @@ status: "test", }, { - name: "InertAttribute", - status: "experimental", - }, - { name: "InertTopControls", status: "stable", },
diff --git a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp similarity index 99% rename from third_party/WebKit/Source/web/WebRuntimeFeatures.cpp rename to third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp index 19db183..2fa21863 100644 --- a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "public/web/WebRuntimeFeatures.h" +#include "public/platform/WebRuntimeFeatures.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/wtf/Assertions.h"
diff --git a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp index 494b38d..0c1496df 100644 --- a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp +++ b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
@@ -953,116 +953,4 @@ return headers; } -bool IsTokenCharacter(Mode mode, UChar c) { - if (c >= 128) - return false; - if (c < 0x20) - return false; - - switch (c) { - case ' ': - case ';': - case '"': - return false; - case '(': - case ')': - case '<': - case '>': - case '@': - case ',': - case ':': - case '\\': - case '/': - case '[': - case ']': - case '?': - case '=': - return mode == Mode::kRelaxed; - default: - return true; - } -} - -bool Consume(char c, const String& input, unsigned& index) { - DCHECK_NE(c, ' '); - while (index < input.length() && input[index] == ' ') - ++index; - - if (index < input.length() && input[index] == c) { - ++index; - return true; - } - return false; -} - -bool ConsumeToken(Mode mode, - const String& input, - unsigned& index, - StringView& output) { - DCHECK(output.IsNull()); - - while (index < input.length() && input[index] == ' ') - ++index; - - auto start = index; - while (index < input.length() && IsTokenCharacter(mode, input[index])) - ++index; - - if (start == index) - return false; - - output = StringView(input, start, index - start); - return true; -} - -bool ConsumeQuotedString(const String& input, unsigned& index, String& output) { - StringBuilder builder; - DCHECK_EQ('"', input[index]); - ++index; - while (index < input.length()) { - if (input[index] == '\\') { - ++index; - if (index == input.length()) - return false; - builder.Append(input[index]); - ++index; - continue; - } - if (input[index] == '"') { - output = builder.ToString(); - ++index; - return true; - } - builder.Append(input[index]); - ++index; - } - return false; -} - -bool ConsumeTokenOrQuotedString(Mode mode, - const String& input, - unsigned& index, - String& output) { - while (index < input.length() && input[index] == ' ') - ++index; - if (input.length() == index) - return false; - if (input[index] == '"') { - return ConsumeQuotedString(input, index, output); - } - StringView view; - auto result = ConsumeToken(mode, input, index, view); - output = view.ToString(); - return result; -} - -bool IsEnd(const String& input, unsigned index) { - while (index < input.length()) { - if (input[index] != ' ') - return false; - ++index; - } - return true; -} - } // namespace blink
diff --git a/third_party/WebKit/Source/platform/network/HTTPParsers.h b/third_party/WebKit/Source/platform/network/HTTPParsers.h index 3c072f8d..5a75d01 100644 --- a/third_party/WebKit/Source/platform/network/HTTPParsers.h +++ b/third_party/WebKit/Source/platform/network/HTTPParsers.h
@@ -188,16 +188,6 @@ PLATFORM_EXPORT String CheckDoubleQuotedString(const String&); -using Mode = blink::ParsedContentType::Mode; -PLATFORM_EXPORT bool Consume(char, const String&, unsigned&); -PLATFORM_EXPORT bool ConsumeToken(Mode, const String&, unsigned&, StringView&); -PLATFORM_EXPORT bool ConsumeQuotedString(const String&, unsigned&, String&); -PLATFORM_EXPORT bool ConsumeTokenOrQuotedString(Mode, - const String&, - unsigned&, - String&); -PLATFORM_EXPORT bool IsEnd(const String&, unsigned); - } // namespace blink #endif
diff --git a/third_party/WebKit/Source/web/BUILD.gn b/third_party/WebKit/Source/web/BUILD.gn index ad12e85..d6bb368 100644 --- a/third_party/WebKit/Source/web/BUILD.gn +++ b/third_party/WebKit/Source/web/BUILD.gn
@@ -173,7 +173,6 @@ "WebPluginScriptForbiddenScope.cpp", "WebRemoteFrameImpl.cpp", "WebRemoteFrameImpl.h", - "WebRuntimeFeatures.cpp", "WebScopedUserGesture.cpp", "WebScopedWindowFocusAllowedIndicator.cpp", "WebSearchableFormData.cpp",
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp index b49082c7..af9e15d 100644 --- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
@@ -9,6 +9,7 @@ #include "core/frame/FrameView.h" #include "core/frame/Settings.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/input/EventHandler.h" #include "core/page/Page.h" #include "core/style/ComputedStyle.h" @@ -21,7 +22,6 @@ #include "platform/loader/fetch/MemoryCache.h" #include "platform/wtf/PtrUtil.h" #include "public/platform/WebLayerTreeView.h" -#include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" namespace {
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp index 86c98d2..a6a582d3d 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
@@ -8,6 +8,7 @@ #include "core/HTMLNames.h" #include "core/dom/NodeComputedStyle.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLSelectElement.h" #include "core/layout/LayoutMenuList.h" #include "core/page/Page.h" @@ -21,7 +22,6 @@ #include "public/web/WebPopupMenuInfo.h" #include "public/web/WebSettings.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" namespace blink { @@ -127,7 +127,7 @@ const ExternalPopupMenuWebFrameClient& Client() const { return web_frame_client_; } - WebLocalFrameImpl* MainFrame() const { + WebLocalFrameBase* MainFrame() const { return helper_.WebView()->MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/FullscreenController.cpp b/third_party/WebKit/Source/web/FullscreenController.cpp index c0d5ec4..8142f04 100644 --- a/third_party/WebKit/Source/web/FullscreenController.cpp +++ b/third_party/WebKit/Source/web/FullscreenController.cpp
@@ -36,19 +36,19 @@ #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/frame/PageScaleConstraintsSet.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLVideoElement.h" #include "core/layout/LayoutFullScreen.h" #include "core/page/Page.h" #include "public/platform/WebLayerTreeView.h" #include "public/web/WebFrameClient.h" -#include "web/WebLocalFrameImpl.h" namespace blink { namespace { WebFrameClient& GetWebFrameClient(LocalFrame& frame) { - WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame); + WebLocalFrameBase* web_frame = WebLocalFrameBase::FromFrame(frame); DCHECK(web_frame); DCHECK(web_frame->Client()); return *web_frame->Client();
diff --git a/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp b/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp index 6f067fc..07fd6b0 100644 --- a/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp +++ b/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp
@@ -45,6 +45,7 @@ #include "core/frame/LocalFrameClient.h" #include "core/frame/Settings.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/input/EventHandler.h" #include "core/inspector/IdentifiersFactory.h" @@ -65,7 +66,6 @@ #include "public/platform/WebData.h" #include "v8/include/v8.h" #include "web/PageOverlay.h" -#include "web/WebLocalFrameImpl.h" namespace blink { @@ -211,7 +211,7 @@ }; InspectorOverlayAgent::InspectorOverlayAgent( - WebLocalFrameImpl* frame_impl, + WebLocalFrameBase* frame_impl, InspectedFrames* inspected_frames, v8_inspector::V8InspectorSession* v8_session, InspectorDOMAgent* dom_agent)
diff --git a/third_party/WebKit/Source/web/InspectorOverlayAgent.h b/third_party/WebKit/Source/web/InspectorOverlayAgent.h index ec242ac3..cff9882 100644 --- a/third_party/WebKit/Source/web/InspectorOverlayAgent.h +++ b/third_party/WebKit/Source/web/InspectorOverlayAgent.h
@@ -55,7 +55,7 @@ class PageOverlay; class WebGestureEvent; class WebMouseEvent; -class WebLocalFrameImpl; +class WebLocalFrameBase; class WebTouchEvent; class InspectorOverlayAgent final @@ -65,7 +65,7 @@ USING_GARBAGE_COLLECTED_MIXIN(InspectorOverlayAgent); public: - InspectorOverlayAgent(WebLocalFrameImpl*, + InspectorOverlayAgent(WebLocalFrameBase*, InspectedFrames*, v8_inspector::V8InspectorSession*, InspectorDOMAgent*); @@ -186,7 +186,7 @@ bool omit_tooltip); void InnerHideHighlight(); - Member<WebLocalFrameImpl> frame_impl_; + Member<WebLocalFrameBase> frame_impl_; Member<InspectedFrames> inspected_frames_; bool enabled_; String paused_in_debugger_message_;
diff --git a/third_party/WebKit/Source/web/PageOverlay.cpp b/third_party/WebKit/Source/web/PageOverlay.cpp index a663cc5b3..dd43c7a 100644 --- a/third_party/WebKit/Source/web/PageOverlay.cpp +++ b/third_party/WebKit/Source/web/PageOverlay.cpp
@@ -46,12 +46,12 @@ namespace blink { std::unique_ptr<PageOverlay> PageOverlay::Create( - WebLocalFrameImpl* frame_impl, + WebLocalFrameBase* frame_impl, std::unique_ptr<PageOverlay::Delegate> delegate) { return WTF::WrapUnique(new PageOverlay(frame_impl, std::move(delegate))); } -PageOverlay::PageOverlay(WebLocalFrameImpl* frame_impl, +PageOverlay::PageOverlay(WebLocalFrameBase* frame_impl, std::unique_ptr<PageOverlay::Delegate> delegate) : frame_impl_(frame_impl), delegate_(std::move(delegate)) {}
diff --git a/third_party/WebKit/Source/web/PageOverlay.h b/third_party/WebKit/Source/web/PageOverlay.h index 377ab22..370c6f7 100644 --- a/third_party/WebKit/Source/web/PageOverlay.h +++ b/third_party/WebKit/Source/web/PageOverlay.h
@@ -39,7 +39,7 @@ namespace blink { class GraphicsContext; -class WebLocalFrameImpl; +class WebLocalFrameBase; // Manages a layer that is overlaid on a WebLocalFrame's content. class WEB_EXPORT PageOverlay : public GraphicsLayerClient, @@ -56,7 +56,7 @@ }; static std::unique_ptr<PageOverlay> Create( - WebLocalFrameImpl*, + WebLocalFrameBase*, std::unique_ptr<PageOverlay::Delegate>); ~PageOverlay(); @@ -80,9 +80,9 @@ String DebugName(const GraphicsLayer*) const override; private: - PageOverlay(WebLocalFrameImpl*, std::unique_ptr<PageOverlay::Delegate>); + PageOverlay(WebLocalFrameBase*, std::unique_ptr<PageOverlay::Delegate>); - Persistent<WebLocalFrameImpl> frame_impl_; + Persistent<WebLocalFrameBase> frame_impl_; std::unique_ptr<PageOverlay::Delegate> delegate_; std::unique_ptr<GraphicsLayer> layer_; };
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index 0e1855e..45d7d63 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -395,7 +395,7 @@ return shared_worker_repository_client_.get(); } - void SetInputEventsTransformForEmulation(const IntSize&, float); + void SetInputEventsTransformForEmulation(const IntSize&, float) override; static void SelectWordAroundPosition(LocalFrame*, VisiblePosition); @@ -404,7 +404,7 @@ return text_check_client_; } - TextFinder* GetTextFinder() const; + TextFinder* GetTextFinder() const override; // Returns the text finder object if it already exists. // Otherwise creates it and then returns. TextFinder& EnsureTextFinder() override;
diff --git a/third_party/WebKit/Source/web/WebViewFrameWidget.cpp b/third_party/WebKit/Source/web/WebViewFrameWidget.cpp index 0690f2af..29cf1d8 100644 --- a/third_party/WebKit/Source/web/WebViewFrameWidget.cpp +++ b/third_party/WebKit/Source/web/WebViewFrameWidget.cpp
@@ -5,15 +5,15 @@ #include "web/WebViewFrameWidget.h" #include "core/exported/WebViewBase.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/layout/HitTestResult.h" #include "web/WebInputMethodControllerImpl.h" -#include "web/WebLocalFrameImpl.h" namespace blink { WebViewFrameWidget::WebViewFrameWidget(WebWidgetClient& client, WebViewBase& web_view, - WebLocalFrameImpl& main_frame) + WebLocalFrameBase& main_frame) : client_(&client), web_view_(&web_view), main_frame_(&main_frame) { main_frame_->SetFrameWidget(this); web_view_->SetCompositorVisibility(true); @@ -207,7 +207,7 @@ web_view_->SetBaseBackgroundColor(color); } -WebLocalFrameImpl* WebViewFrameWidget::LocalRoot() const { +WebLocalFrameBase* WebViewFrameWidget::LocalRoot() const { return web_view_->MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/WebViewFrameWidget.h b/third_party/WebKit/Source/web/WebViewFrameWidget.h index 925f7640..93410d7 100644 --- a/third_party/WebKit/Source/web/WebViewFrameWidget.h +++ b/third_party/WebKit/Source/web/WebViewFrameWidget.h
@@ -6,11 +6,11 @@ #define WebViewFrameWidget_h #include "core/frame/WebFrameWidgetBase.h" +#include "core/frame/WebLocalFrameBase.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h" #include "platform/wtf/RefPtr.h" #include "web/WebInputMethodControllerImpl.h" -#include "web/WebLocalFrameImpl.h" namespace blink { @@ -38,7 +38,7 @@ public: explicit WebViewFrameWidget(WebWidgetClient&, WebViewBase&, - WebLocalFrameImpl&); + WebLocalFrameBase&); virtual ~WebViewFrameWidget(); // WebFrameWidget overrides: @@ -91,7 +91,7 @@ void SetBaseBackgroundColorOverride(WebColor) override; void ClearBaseBackgroundColorOverride() override; void SetBaseBackgroundColor(WebColor) override; - WebLocalFrameImpl* LocalRoot() const override; + WebLocalFrameBase* LocalRoot() const override; WebInputMethodControllerImpl* GetActiveWebInputMethodController() const override; @@ -110,7 +110,7 @@ private: WebWidgetClient* client_; RefPtr<WebViewBase> web_view_; - Persistent<WebLocalFrameImpl> main_frame_; + Persistent<WebLocalFrameBase> main_frame_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index 6496744..76ced05 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -64,6 +64,7 @@ #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLMediaElement.h" #include "core/html/HTMLPlugInElement.h" #include "core/html/HTMLTextAreaElement.h" @@ -170,7 +171,6 @@ #include "web/StorageQuotaClientImpl.h" #include "web/WebDevToolsAgentImpl.h" #include "web/WebInputMethodControllerImpl.h" -#include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" #include "web/WebSettingsImpl.h" @@ -428,13 +428,13 @@ } WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() { - WebLocalFrameImpl* main_frame = MainFrameImpl(); + WebLocalFrameBase* main_frame = MainFrameImpl(); return main_frame ? main_frame->DevToolsAgentImpl() : nullptr; } -WebLocalFrameImpl* WebViewImpl::MainFrameImpl() const { +WebLocalFrameBase* WebViewImpl::MainFrameImpl() const { return page_ && page_->MainFrame() && page_->MainFrame()->IsLocalFrame() - ? WebLocalFrameImpl::FromFrame(page_->DeprecatedLocalMainFrame()) + ? WebLocalFrameBase::FromFrame(page_->DeprecatedLocalMainFrame()) : nullptr; } @@ -1701,7 +1701,7 @@ page_popup_->ClosePopup(); page_popup_ = nullptr; } - EnablePopupMouseWheelEventListener(WebLocalFrameImpl::FromFrame( + EnablePopupMouseWheelEventListener(WebLocalFrameBase::FromFrame( client->OwnerElement().GetDocument().GetFrame()->LocalFrameRoot())); return page_popup_.Get(); } @@ -1726,7 +1726,7 @@ } void WebViewImpl::EnablePopupMouseWheelEventListener( - WebLocalFrameImpl* local_root) { + WebLocalFrameBase* local_root) { DCHECK(!popup_mouse_wheel_event_listener_); Document* document = local_root->GetDocument(); DCHECK(document); @@ -1855,7 +1855,7 @@ GetBrowserControls().Height(), GetBrowserControls().ShrinkViewport()); } - WebLocalFrameImpl* main_frame = MainFrameImpl(); + WebLocalFrameBase* main_frame = MainFrameImpl(); if (!main_frame) return; @@ -1936,7 +1936,7 @@ return; } - WebLocalFrameImpl* main_frame = MainFrameImpl(); + WebLocalFrameBase* main_frame = MainFrameImpl(); if (!main_frame) return; @@ -2048,7 +2048,7 @@ if (FrameView* view = MainFrameImpl()->GetFrameView()) { LocalFrame* frame = MainFrameImpl()->GetFrame(); WebWidgetClient* client = - WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->Client(); + WebLocalFrameBase::FromFrame(frame)->FrameWidget()->Client(); if (should_dispatch_first_visually_non_empty_layout_ && view->IsVisuallyNonEmpty()) { @@ -2639,11 +2639,11 @@ // to WebFrame. if (!relative_to_frame) relative_to_frame = MainFrame(); - Frame* frame = ToWebLocalFrameImpl(relative_to_frame)->GetFrame(); + Frame* frame = ToWebLocalFrameBase(relative_to_frame)->GetFrame(); frame = frame->Tree().Find(name); if (!frame || !frame->IsLocalFrame()) return nullptr; - return WebLocalFrameImpl::FromFrame(ToLocalFrame(frame)); + return WebLocalFrameBase::FromFrame(ToLocalFrame(frame)); } WebLocalFrame* WebViewImpl::FocusedFrame() { @@ -2653,7 +2653,7 @@ // See crbug.com/625068 if (!frame || !frame->IsLocalFrame()) return nullptr; - return WebLocalFrameImpl::FromFrame(ToLocalFrame(frame)); + return WebLocalFrameBase::FromFrame(ToLocalFrame(frame)); } void WebViewImpl::SetFocusedFrame(WebFrame* frame) { @@ -2664,7 +2664,7 @@ ToLocalFrame(focused_frame)->Selection().SetFrameIsFocused(false); return; } - LocalFrame* core_frame = ToWebLocalFrameImpl(frame)->GetFrame(); + LocalFrame* core_frame = ToWebLocalFrameBase(frame)->GetFrame(); core_frame->GetPage()->GetFocusController().SetFocusedFrame(core_frame); } @@ -2887,7 +2887,7 @@ // TODO(alexmos): Pass in proper with sourceCapabilities. GetPage()->GetFocusController().AdvanceFocusAcrossFrames( type, ToWebRemoteFrameImpl(from)->GetFrame(), - ToWebLocalFrameImpl(to)->GetFrame()); + ToWebLocalFrameBase(to)->GetFrame()); } double WebViewImpl::ZoomLevel() { @@ -3637,7 +3637,7 @@ EndActiveFlingAnimation(); } -void WebViewImpl::ResizeAfterLayout(WebLocalFrameImpl* webframe) { +void WebViewImpl::ResizeAfterLayout(WebLocalFrameBase* webframe) { LocalFrame* frame = webframe->GetFrame(); if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame()) return; @@ -3662,7 +3662,7 @@ resize_viewport_anchor_->ResizeFrameView(MainFrameSize()); } -void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) { +void WebViewImpl::LayoutUpdated(WebLocalFrameBase* webframe) { LocalFrame* frame = webframe->GetFrame(); if (!client_ || !frame->IsMainFrame()) return; @@ -3918,7 +3918,7 @@ } PaintLayerCompositor* WebViewImpl::Compositor() const { - WebLocalFrameImpl* frame = MainFrameImpl(); + WebLocalFrameBase* frame = MainFrameImpl(); if (!frame) return nullptr;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 520bd24..591da9f 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -88,7 +88,7 @@ class WebInputMethodControllerImpl; class WebLayerTreeView; class WebLocalFrame; -class WebLocalFrameImpl; +class WebLocalFrameBase; class CompositorMutatorImpl; class WebRemoteFrame; class WebSettingsImpl; @@ -309,7 +309,7 @@ // Returns the main frame associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. - WebLocalFrameImpl* MainFrameImpl() const override; + WebLocalFrameBase* MainFrameImpl() const override; // Event related methods: void MouseContextMenu(const WebMouseEvent&); @@ -348,8 +348,8 @@ // 2) Calling updateAllLifecyclePhases() is a no-op. // After calling WebWidget::updateAllLifecyclePhases(), expect to get this // notification unless the view did not need a layout. - void LayoutUpdated(WebLocalFrameImpl*) override; - void ResizeAfterLayout(WebLocalFrameImpl*) override; + void LayoutUpdated(WebLocalFrameBase*) override; + void ResizeAfterLayout(WebLocalFrameBase*) override; void DidChangeContentsSize() override; void PageScaleFactorChanged() override; @@ -582,7 +582,7 @@ WebGestureEvent CreateGestureScrollEventFromFling(WebInputEvent::Type, WebGestureDevice) const; - void EnablePopupMouseWheelEventListener(WebLocalFrameImpl* local_root); + void EnablePopupMouseWheelEventListener(WebLocalFrameBase* local_root); void DisablePopupMouseWheelEventListener(); void CancelPagePopup(); @@ -726,7 +726,7 @@ // The local root whose document has |popup_mouse_wheel_event_listener_| // registered. - WeakPersistent<WebLocalFrameImpl> local_root_with_empty_mouse_wheel_listener_; + WeakPersistent<WebLocalFrameBase> local_root_with_empty_mouse_wheel_listener_; WebPageImportanceSignals page_importance_signals_;
diff --git a/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp b/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp index 29f08e2..0ad61833 100644 --- a/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp +++ b/third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp
@@ -33,6 +33,7 @@ #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/page/Page.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" @@ -43,7 +44,6 @@ #include "public/web/WebSettings.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp index ccd9415c..9566f05d 100644 --- a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp +++ b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
@@ -5,6 +5,7 @@ #include "core/loader/DocumentLoader.h" #include <queue> +#include "core/frame/WebLocalFrameBase.h" #include "core/page/Page.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" @@ -13,7 +14,6 @@ #include "public/platform/WebURLLoaderClient.h" #include "public/platform/WebURLLoaderMockFactory.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" namespace blink { @@ -35,7 +35,7 @@ ->UnregisterAllURLsAndClearMemoryCache(); } - WebLocalFrameImpl* MainFrame() { + WebLocalFrameBase* MainFrame() { return web_view_helper_.WebView()->MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp index 4a0fd3c..9e99adb 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -30,6 +30,7 @@ #include "web/tests/FrameTestHelpers.h" +#include "core/frame/WebLocalFrameBase.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" @@ -48,7 +49,6 @@ #include "public/web/WebSettings.h" #include "public/web/WebTreeScopeType.h" #include "public/web/WebViewClient.h" -#include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" namespace blink { @@ -72,7 +72,7 @@ // progress, it exits the run loop. // 7. At this point, all parsing, resource loads, and layout should be finished. TestWebFrameClient* TestClientForFrame(WebFrame* frame) { - return static_cast<TestWebFrameClient*>(ToWebLocalFrameImpl(frame)->Client()); + return static_cast<TestWebFrameClient*>(ToWebLocalFrameBase(frame)->Client()); } void RunServeAsyncRequestsTask(TestWebFrameClient* client) { @@ -149,7 +149,7 @@ return result; } -WebLocalFrameImpl* CreateLocalChild(WebRemoteFrame* parent, +WebLocalFrameBase* CreateLocalChild(WebRemoteFrame* parent, const WebString& name, WebFrameClient* client, WebWidgetClient* widget_client, @@ -158,7 +158,7 @@ if (!client) client = DefaultWebFrameClient(); - WebLocalFrameImpl* frame = ToWebLocalFrameImpl(parent->CreateLocalChild( + WebLocalFrameBase* frame = ToWebLocalFrameBase(parent->CreateLocalChild( WebTreeScopeType::kDocument, name, WebSandboxFlags::kNone, client, static_cast<TestWebFrameClient*>(client)->GetInterfaceProvider(), nullptr, previous_sibling, WebParsedFeaturePolicy(), properties, nullptr)); @@ -219,7 +219,7 @@ web_view_->SetDeviceScaleFactor( web_view_client->GetScreenInfo().device_scale_factor); web_view_->SetDefaultPageScaleLimits(1, 4); - WebLocalFrame* frame = WebLocalFrameImpl::Create( + WebLocalFrame* frame = WebLocalFrameBase::Create( WebTreeScopeType::kDocument, web_frame_client, web_frame_client->GetInterfaceProvider(), nullptr, opener); web_view_->SetMainFrame(frame);
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h index 15703412..8c752a5 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h
@@ -53,7 +53,7 @@ namespace blink { class WebFrame; -class WebLocalFrameImpl; +class WebLocalFrameBase; class WebRemoteFrameImpl; class WebSettings; enum class WebCachePolicy; @@ -91,7 +91,7 @@ // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled // with default test values (i.e. with a default |client| or |properties| and/or // with a precalculated |uniqueName|). -WebLocalFrameImpl* CreateLocalChild( +WebLocalFrameBase* CreateLocalChild( WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr,
diff --git a/third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp b/third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp index 3dd5880..75676bd 100644 --- a/third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp +++ b/third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp
@@ -4,6 +4,7 @@ #include "core/dom/Range.h" #include "core/frame/FrameView.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/input/EventHandler.h" #include "core/page/ChromeClient.h" #include "core/page/ContextMenuController.h" @@ -16,7 +17,6 @@ #include "public/web/WebSettings.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" using ::testing::_; @@ -51,7 +51,7 @@ FrameTestHelpers::WebViewHelper helper_; WebViewBase* web_view_ = nullptr; - Persistent<WebLocalFrameImpl> main_frame_ = nullptr; + Persistent<WebLocalFrameBase> main_frame_ = nullptr; }; void LinkSelectionTestBase::EmulateMouseDrag(const IntPoint& down_point,
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp index e3b38bb..6b70f453 100644 --- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -677,7 +677,7 @@ FrameTestHelpers::TestWebRemoteFrameClient remote_client; FrameTestHelpers::TestWebWidgetClient web_widget_client; WebFrameWidget* widget; - WebLocalFrameImpl* local_frame; + WebLocalFrameBase* local_frame; Initialize("root-scroller-iframe.html");
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp index 986caa05..db418fa 100644 --- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp +++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -12,6 +12,7 @@ #include "core/editing/FindInPageCoordinates.h" #include "core/frame/FrameView.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLElement.h" #include "core/layout/TextAutosizer.h" #include "core/page/Page.h" @@ -20,7 +21,6 @@ #include "public/platform/Platform.h" #include "public/web/WebDocument.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" using blink::testing::RunPendingTasks; @@ -31,7 +31,7 @@ protected: TextFinderTest() { web_view_helper_.Initialize(); - WebLocalFrameImpl& frame_impl = + WebLocalFrameBase& frame_impl = *web_view_helper_.WebView()->MainFrameImpl(); frame_impl.ViewImpl()->Resize(WebSize(640, 480)); frame_impl.ViewImpl()->UpdateAllLifecyclePhases();
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp index f8dc2cb..82335a0 100644 --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -1800,7 +1800,7 @@ RegisterMockedHttpURLLoad("content-width-1000-min-scale.html"); NavigateTo(base_url_ + "content-width-1000-min-scale.html"); - WebLocalFrameImpl* local_frame = WebViewImpl()->MainFrameImpl(); + WebLocalFrameBase* local_frame = WebViewImpl()->MainFrameImpl(); // The shutdown() calls are a hack to prevent this test from violating // invariants about frame state during navigation/detach. local_frame->GetFrame()->GetDocument()->Shutdown();
diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerSanitizationTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerSanitizationTest.cpp index 5b0ab1dc..1fecdcde 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameSerializerSanitizationTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerSanitizationTest.cpp
@@ -31,6 +31,7 @@ #include "public/web/WebFrameSerializer.h" #include "core/exported/WebViewBase.h" +#include "core/frame/WebLocalFrameBase.h" #include "platform/mhtml/MHTMLArchive.h" #include "platform/mhtml/MHTMLParser.h" #include "platform/testing/HistogramTester.h" @@ -43,7 +44,6 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLLoaderMockFactory.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" namespace blink { @@ -162,7 +162,7 @@ WebViewBase* WebView() { return helper_.WebView(); } - WebLocalFrameImpl* MainFrameImpl() { + WebLocalFrameBase* MainFrameImpl() { return helper_.WebView()->MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp index c6cc94d6..15f843e 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
@@ -31,6 +31,7 @@ #include "public/web/WebFrameSerializer.h" #include "core/exported/WebViewBase.h" +#include "core/frame/WebLocalFrameBase.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" #include "platform/weborigin/KURL.h" @@ -42,7 +43,6 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "public/web/WebFrameSerializerClient.h" #include "testing/gtest/include/gtest/gtest.h" -#include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" namespace blink { @@ -124,7 +124,7 @@ return serializer_client.ToString(); } - WebLocalFrameImpl* MainFrameImpl() { + WebLocalFrameBase* MainFrameImpl() { return helper_.WebView()->MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index 0ab9d67..39b2d23 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -64,6 +64,7 @@ #include "core/frame/RemoteFrame.h" #include "core/frame/Settings.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLBodyElement.h" #include "core/html/HTMLFormElement.h" #include "core/html/HTMLIFrameElement.h" @@ -154,7 +155,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" #include "web/TextFinder.h" -#include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" #include "web/tests/FrameTestHelpers.h" #include "web/tests/sim/SimDisplayItemList.h" @@ -292,7 +292,7 @@ return frame->NodeImage(*element); } - void RemoveElementById(WebLocalFrameImpl* frame, const AtomicString& id) { + void RemoveElementById(WebLocalFrameBase* frame, const AtomicString& id) { Element* element = frame->GetFrame()->GetDocument()->getElementById(id); DCHECK(element); element->remove(); @@ -530,7 +530,7 @@ web_view_helper.WebView()->MainFrame()->MainWorldScriptContext(); // Suspend scheduled tasks so the script doesn't run. - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); main_frame->GetFrame()->GetDocument()->SuspendScheduledTasks(); ScriptExecutionCallbackHelper callback_helper(context); @@ -561,7 +561,7 @@ }; // Suspend scheduled tasks so the script doesn't run. - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); Document* document = main_frame->GetFrame()->GetDocument(); document->SuspendScheduledTasks(); @@ -1993,7 +1993,7 @@ IntPoint hit_point = IntPoint(30, 30); // button size is 100x100 - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("tap_button"); @@ -2028,7 +2028,7 @@ WebFrameOwnerProperties properties; properties.margin_width = 11; properties.margin_height = 22; - WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( + WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild( root, "frameName", nullptr, nullptr, nullptr, properties); RegisterMockedHttpURLLoad("frame_owner_properties.html"); @@ -2064,7 +2064,7 @@ // Turn off scrolling in the subframe. properties.scrolling_mode = WebFrameOwnerProperties::ScrollingMode::kAlwaysOff; - WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( + WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild( root, "frameName", nullptr, nullptr, nullptr, properties); RegisterMockedHttpURLLoad("frame_owner_properties.html"); @@ -2078,7 +2078,7 @@ HTMLNames::marginheightAttr)); FrameView* frame_view = - static_cast<WebLocalFrameImpl*>(local_frame)->GetFrameView(); + static_cast<WebLocalFrameBase*>(local_frame)->GetFrameView(); EXPECT_EQ(nullptr, frame_view->HorizontalScrollbar()); EXPECT_EQ(nullptr, frame_view->VerticalScrollbar()); @@ -4909,13 +4909,13 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -4975,12 +4975,12 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -4989,8 +4989,8 @@ EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); main_frame->StopFinding(WebLocalFrame::kStopFindActionClearSelection); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -5006,8 +5006,8 @@ main_frame->Find(kFindIdentifier, search_text_new, options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches( kFindIdentifier, search_text_new, options); } @@ -5033,9 +5033,9 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); - WebLocalFrameImpl* second_frame = - ToWebLocalFrameImpl(main_frame->TraverseNext()); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* second_frame = + ToWebLocalFrameBase(main_frame->TraverseNext()); // Detach the frame before finding. RemoveElementById(main_frame, "frame"); @@ -5049,8 +5049,8 @@ main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -5075,7 +5075,7 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, @@ -5089,8 +5089,8 @@ main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -5115,7 +5115,7 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, @@ -5126,8 +5126,8 @@ main_frame->EnsureTextFinder().ResetMatchCount(); - for (WebLocalFrameImpl* frame = main_frame; frame; - frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + for (WebLocalFrameBase* frame = main_frame; frame; + frame = static_cast<WebLocalFrameBase*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, search_text, options); } @@ -5155,7 +5155,7 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); // Check that child frame exists. EXPECT_TRUE(!!main_frame->TraverseNext()); @@ -5184,7 +5184,7 @@ WebFindOptions options; WebString search_text = WebString::FromUTF8(kFindString); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); @@ -5233,7 +5233,7 @@ web_view_helper.Resize(WebSize(640, 480)); RunPendingTasks(); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); const int kFindIdentifier = 12345; static const char* kFindString = "foo"; WebString search_text = WebString::FromUTF8(kFindString); @@ -5306,7 +5306,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(true, &client); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); FrameTestHelpers::LoadHTMLString(frame, html, URLTestHelpers::ToKURL(base_url_)); web_view_helper.Resize(WebSize(640, 480)); @@ -5423,7 +5423,7 @@ InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); frame->SelectRange(WebRange(0, 5)); EXPECT_FALSE(frame->SelectionRange().IsNull()); @@ -5438,7 +5438,7 @@ InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle); EXPECT_FALSE(frame->GetFrame()->Selection().IsHandleVisible()) @@ -5452,7 +5452,7 @@ InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); frame->SelectRange(WebRange(0, 5), WebLocalFrame::kShowSelectionHandle); EXPECT_TRUE(frame->GetFrame()->Selection().IsHandleVisible()) @@ -5466,7 +5466,7 @@ InitializeTextSelectionWebView(base_url_ + "select_range_basic.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); frame->SelectRange(WebRange(0, 5), WebLocalFrame::kHideSelectionHandle); frame->SelectRange(WebRange(0, 6), WebLocalFrame::kPreserveHandleVisibility); @@ -5699,7 +5699,7 @@ } TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtent) { - WebLocalFrameImpl* frame; + WebLocalFrameBase* frame; WebRect start_web_rect; WebRect end_web_rect; @@ -5736,7 +5736,7 @@ } TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentCannotCollapse) { - WebLocalFrameImpl* frame; + WebLocalFrameBase* frame; WebRect start_web_rect; WebRect end_web_rect; @@ -5762,7 +5762,7 @@ } TEST_P(ParameterizedWebFrameTest, MoveRangeSelectionExtentScollsInputField) { - WebLocalFrameImpl* frame; + WebLocalFrameBase* frame; WebRect start_web_rect; WebRect end_web_rect; @@ -5806,7 +5806,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "select_range_span_editable.html", &web_view_helper); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); LayoutObject* layout_object = main_frame->GetFrame() ->Selection() @@ -5837,7 +5837,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "move_caret.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); WebRect initial_start_rect; WebRect initial_end_rect; @@ -5877,13 +5877,13 @@ } TEST_P(ParameterizedWebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved) { - WebLocalFrameImpl* frame; + WebLocalFrameBase* frame; RegisterMockedHttpURLLoad("move_caret.html"); FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "move_caret.html", &web_view_helper); - frame = (WebLocalFrameImpl*)web_view_helper.WebView()->MainFrame(); + frame = (WebLocalFrameBase*)web_view_helper.WebView()->MainFrame(); WebRect initial_start_rect; WebRect initial_end_rect; @@ -6609,7 +6609,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); TextCheckClient textcheck; frame->SetTextCheckClient(&textcheck); @@ -6656,7 +6656,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); TextCheckClient textcheck; frame->SetTextCheckClient(&textcheck); @@ -6707,7 +6707,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* web_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* web_frame = web_view_helper.WebView()->MainFrameImpl(); TextCheckClient textcheck; web_frame->SetTextCheckClient(&textcheck); @@ -6787,7 +6787,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); StubbornTextCheckClient textcheck; frame->SetTextCheckClient(&textcheck); @@ -6829,7 +6829,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "spell.html"); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); frame->SetTextCheckClient(0); Document* document = frame->GetFrame()->GetDocument(); @@ -6849,7 +6849,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); StubbornTextCheckClient textcheck; frame->SetTextCheckClient(&textcheck); @@ -6889,7 +6889,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "spell.html", &web_view_helper); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); StubbornTextCheckClient textcheck; frame->SetTextCheckClient(&textcheck); @@ -7113,7 +7113,7 @@ if (Frame()->Parent()) return; EXPECT_FALSE(did_scroll_frame_); - FrameView* view = ToWebLocalFrameImpl(Frame())->GetFrameView(); + FrameView* view = ToWebLocalFrameBase(Frame())->GetFrameView(); // FrameView can be scrolled in FrameView::setFixedVisibleContentRect which // is called from LocalFrame::createView (before the frame is associated // with the the view). @@ -7136,7 +7136,7 @@ &client); web_view_helper.Resize(WebSize(1000, 1000)); - WebLocalFrameImpl* frame_impl = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame_impl = web_view_helper.WebView()->MainFrameImpl(); DocumentLoader::InitialScrollState& initial_scroll_state = frame_impl->GetFrame() ->Loader() @@ -7511,9 +7511,9 @@ web_view_helper.InitializeAndLoad(base_url_ + "iframe_reload.html", true, &main_client); - WebLocalFrameImpl* main_frame = web_view_helper.WebView()->MainFrameImpl(); - WebLocalFrameImpl* child_frame = - ToWebLocalFrameImpl(main_frame->FirstChild()); + WebLocalFrameBase* main_frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* child_frame = + ToWebLocalFrameBase(main_frame->FirstChild()); ASSERT_EQ(child_frame->Client(), &child_client); EXPECT_EQ(main_client.ChildFrameCreationCount(), 1); EXPECT_EQ(child_client.WillSendRequestCallCount(), 1); @@ -7524,8 +7524,8 @@ // A new WebFrame should have been created, but the child WebFrameClient // should be reused. - ASSERT_NE(child_frame, ToWebLocalFrameImpl(main_frame->FirstChild())); - ASSERT_EQ(ToWebLocalFrameImpl(main_frame->FirstChild())->Client(), + ASSERT_NE(child_frame, ToWebLocalFrameBase(main_frame->FirstChild())); + ASSERT_EQ(ToWebLocalFrameBase(main_frame->FirstChild())->Client(), &child_client); EXPECT_EQ(main_client.ChildFrameCreationCount(), 2); @@ -7545,7 +7545,7 @@ virtual void WillSendRequest(WebURLRequest&) { FrameLoader& frame_loader = - ToWebLocalFrameImpl(Frame())->GetFrame()->Loader(); + ToWebLocalFrameBase(Frame())->GetFrame()->Loader(); if (frame_loader.ProvisionalDocumentLoader()->LoadType() == kFrameLoadTypeReload) frame_load_type_reload_seen_ = true; @@ -7758,7 +7758,7 @@ "document.body.appendChild(document.createElement('iframe'))"))); WebFrame* iframe = frame->FirstChild(); - ASSERT_EQ(&client, ToWebLocalFrameImpl(iframe)->Client()); + ASSERT_EQ(&client, ToWebLocalFrameBase(iframe)->Client()); std::string url1 = base_url_ + "history.html"; FrameTestHelpers::LoadFrame(iframe, url1); @@ -7826,8 +7826,8 @@ ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); // Call javascript to make the layer scrollable, and verify it. - WebLocalFrameImpl* frame = - (WebLocalFrameImpl*)web_view_helper.WebView()->MainFrame(); + WebLocalFrameBase* frame = + (WebLocalFrameBase*)web_view_helper.WebView()->MainFrame(); frame->ExecuteScript(WebScriptSource("allowScroll();")); web_view_helper.WebView()->UpdateAllLifecyclePhases(); ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); @@ -8208,7 +8208,7 @@ web_view_impl->UpdateAllLifecyclePhases(); Document* document = - ToWebLocalFrameImpl(web_view_helper.WebView()->MainFrame()->FirstChild()) + ToWebLocalFrameBase(web_view_helper.WebView()->MainFrame()->FirstChild()) ->GetFrame() ->GetDocument(); UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); @@ -8832,7 +8832,7 @@ web_view_helper.InitializeAndLoad(base_url_ + "theme_color_test.html", true, &client); EXPECT_TRUE(client.DidNotify()); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); EXPECT_EQ(0xff0000ff, frame->GetDocument().ThemeColor()); // Change color by rgb. client.Reset(); @@ -9122,8 +9122,9 @@ remote_frame); FrameTestHelpers::TestWebFrameClient client; - WebLocalFrameImpl* provisional_frame = WebLocalFrameImpl::CreateProvisional( - &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); + WebLocalFrameBase* provisional_frame = + ToWebLocalFrameBase(WebLocalFrame::CreateProvisional( + &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone)); // The provisional frame should have a local frame owner. FrameOwner* owner = provisional_frame->GetFrame()->Owner(); @@ -9552,7 +9553,7 @@ ASSERT_TRUE(MainFrame()->IsWebLocalFrame()); ASSERT_TRUE(MainFrame()->FirstChild()->IsWebRemoteFrame()); LocalDOMWindow* main_window = - ToWebLocalFrameImpl(MainFrame())->GetFrame()->DomWindow(); + ToWebLocalFrameBase(MainFrame())->GetFrame()->DomWindow(); KURL destination = ToKURL("data:text/html:destination"); NonThrowableExceptionState exception_state; @@ -10110,7 +10111,7 @@ FrameTestHelpers::CreateLocalChild(remote_root); RegisterMockedHttpURLLoad("foo.html"); FrameTestHelpers::LoadFrame(web_local_child, base_url_ + "foo.html"); - LocalFrame* local_child = ToWebLocalFrameImpl(web_local_child)->GetFrame(); + LocalFrame* local_child = ToWebLocalFrameBase(web_local_child)->GetFrame(); EXPECT_FALSE(page->Suspended()); EXPECT_FALSE( local_child->GetDocument()->Fetcher()->Context().DefersLoading()); @@ -10918,7 +10919,7 @@ base_url_ + "promote_img_in_viewport_priority.html"); // Ensure the image in the viewport got promoted after the request was sent. - Resource* image = ToWebLocalFrameImpl(helper.WebView()->MainFrame()) + Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame()) ->GetFrame() ->GetDocument() ->Fetcher() @@ -11711,7 +11712,7 @@ base_url); web_view_impl->UpdateAllLifecyclePhases(); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); Document* document = ToLocalFrame(web_view_impl->GetPage()->MainFrame())->GetDocument(); Element* container = document->getElementById("container"); @@ -11971,7 +11972,7 @@ unique_origin); ShowVirtualKeyboardObserverWidgetClient web_widget_client; - WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( + WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild( remote_frame, "child", nullptr, &web_widget_client); RegisterMockedHttpURLLoad("input_field_default.html"); @@ -12079,7 +12080,7 @@ WebRemoteFrame* root = view->MainFrame()->ToWebRemoteFrame(); root->SetReplicatedOrigin(SecurityOrigin::CreateUnique()); - WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild(root); + WebLocalFrameBase* local_frame = FrameTestHelpers::CreateLocalChild(root); FrameTestHelpers::LoadFrame(local_frame, "data:text/html,some page"); // Local frame with remote parent should have transparent baseBackgroundColor. @@ -12132,7 +12133,7 @@ FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.Initialize(true, &mainClient); - WebLocalFrameImpl* main_frame = webViewHelper.WebView()->MainFrameImpl(); + WebLocalFrameBase* main_frame = webViewHelper.WebView()->MainFrameImpl(); WebURLRequest request(ToKURL(base_url_ + "fallback.html")); main_frame->LoadRequest(request); @@ -12157,7 +12158,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", true); web_view_helper.Resize(WebSize(640, 480)); - WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); const char kSource[] = "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>";
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index 383bbc1..ecfb858 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -47,6 +47,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" #include "core/frame/VisualViewport.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLTextAreaElement.h" @@ -108,7 +109,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "web/DevToolsEmulator.h" #include "web/WebInputMethodControllerImpl.h" -#include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" #include "web/tests/FrameTestHelpers.h" @@ -513,7 +513,7 @@ web_view->SetFocus(true); web_view->SetIsActive(true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); EXPECT_TRUE(frame->GetFrame()->GetDocument()->IsHTMLDocument()); Document* document = frame->GetFrame()->GetDocument(); @@ -675,7 +675,7 @@ web_view_helper_.InitializeAndLoad(url, true, 0, &client); client.GetTestData().SetWebView(web_view); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); FrameView* frame_view = frame->GetFrame()->View(); frame_view->UpdateLayout(); EXPECT_FALSE(frame_view->LayoutPending()); @@ -782,7 +782,7 @@ RegisterMockedHttpURLLoad(html_file); WebViewBase* web_view = web_view_helper_.InitializeAndLoad(base_url_ + html_file); - WebInputMethodControllerImpl* controller = + WebInputMethodController* controller = web_view->MainFrameImpl()->GetInputMethodController(); EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputType()); EXPECT_EQ(kWebTextInputTypeNone, controller->TextInputInfo().type); @@ -908,8 +908,8 @@ WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); web_view->SetInitialFocus(false); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); - WebInputMethodControllerImpl* active_input_method_controller = + WebLocalFrameBase* frame = web_view->MainFrameImpl(); + WebInputMethodController* active_input_method_controller = frame->GetInputMethodController(); frame->SetEditableSelectionOffsets(5, 13); EXPECT_EQ("56789abc", frame->SelectionAsText()); @@ -1331,7 +1331,7 @@ // Set up a composition from existing text that needs to be committed. Vector<CompositionUnderline> empty_underlines; - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->GetFrame()->GetInputMethodController().SetCompositionFromExistingText( empty_underlines, 0, 3); @@ -1362,7 +1362,7 @@ WebVector<WebCompositionUnderline> empty_underlines; - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); WebInputMethodController* active_input_method_controller = frame->GetInputMethodController(); frame->SetEditableSelectionOffsets(4, 4); @@ -1401,7 +1401,7 @@ RegisterMockedHttpURLLoad("input_field_populated.html"); WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); web_view->SetInitialFocus(false); frame->SetEditableSelectionOffsets(10, 10); frame->ExtendSelectionAndDelete(5, 8); @@ -1420,7 +1420,7 @@ RegisterMockedHttpURLLoad("input_field_populated.html"); WebView* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); - WebLocalFrameImpl* frame = ToWebLocalFrameImpl(web_view->MainFrame()); + WebLocalFrameBase* frame = ToWebLocalFrameBase(web_view->MainFrame()); WebInputMethodController* active_input_method_controller = frame->GetInputMethodController(); web_view->SetInitialFocus(false); @@ -1466,7 +1466,7 @@ web_view->SetInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); WebInputMethodController* active_input_method_controller = frame->GetInputMethodController(); frame->SetEditableSelectionOffsets(4, 10); @@ -1492,7 +1492,7 @@ web_view->SetInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); WebInputMethodController* active_input_method_controller = frame->FrameWidget()->GetActiveWebInputMethodController(); frame->SetEditableSelectionOffsets(27, 27); @@ -1535,7 +1535,7 @@ web_view->SetInitialFocus(false); WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetEditableSelectionOffsets(1, 1); WebDocument document = web_view->MainFrame()->GetDocument(); EXPECT_FALSE(document.GetElementById("bold").IsNull()); @@ -1570,7 +1570,7 @@ EXPECT_EQ(6, info.composition_start); EXPECT_EQ(11, info.composition_end); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetEditableSelectionOffsets(6, 6); info = active_input_method_controller->TextInputInfo(); EXPECT_EQ("hello world", std::string(info.value.Utf8().data())); @@ -2291,7 +2291,7 @@ event.source_device = kWebGestureDeviceTouchscreen; event.x = 300; event.y = 300; - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); EXPECT_EQ(WebInputEventResult::kHandledSystem, web_view->HandleInputEvent(WebCoalescedInputEvent(event))); @@ -2309,7 +2309,7 @@ WebString target = WebString::FromUTF8("target"); WebString onselectstartfalse = WebString::FromUTF8("onselectstartfalse"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); EXPECT_TRUE( TapElementById(WebInputEvent::kGestureLongPress, onselectstartfalse)); @@ -2328,7 +2328,7 @@ RunPendingTasks(); WebString target = WebString::FromUTF8("target"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); WebInputMethodController* active_input_method_controller = frame->FrameWidget()->GetActiveWebInputMethodController(); EXPECT_TRUE(TapElementById(WebInputEvent::kGestureTap, target)); @@ -2364,7 +2364,7 @@ RunPendingTasks(); WebString blanklinestextbox = WebString::FromUTF8("blanklinestextbox"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); // Long-press on carriage returns. EXPECT_TRUE( @@ -2425,7 +2425,7 @@ RunPendingTasks(); WebString target = WebString::FromUTF8("target"); - WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view->MainFrameImpl(); EXPECT_TRUE(TapElementById(WebInputEvent::kGestureLongPress, target)); EXPECT_FALSE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); @@ -2452,7 +2452,7 @@ web_view->HandleInputEvent(WebCoalescedInputEvent(mouse_event)); RunPendingTasks(); - WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); + WebLocalFrameBase* main_frame = web_view->MainFrameImpl(); EXPECT_TRUE(main_frame->GetFrame()->Selection().IsCaretBlinkingSuspended()); // Caret blinking is still suspended after showing context menu. @@ -2475,7 +2475,7 @@ std::string test_word = "This text should be selected."; - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); EXPECT_EQ(test_word, std::string(frame->SelectionAsText().Utf8().data())); WebRange range = web_view->CaretOrSelectionRange(); @@ -2650,7 +2650,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -2692,7 +2692,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "composition_not_cancelled_by_backspace.html"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -2738,7 +2738,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -2780,7 +2780,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html", true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -2843,7 +2843,7 @@ // Make a request from a local frame. WebURLRequest web_url_request_with_target_start; LocalFrame* local_frame = - ToWebLocalFrameImpl(web_view_impl->MainFrame()->FirstChild())->GetFrame(); + ToWebLocalFrameBase(web_view_impl->MainFrame()->FirstChild())->GetFrame(); FrameLoadRequest request_with_target_start( local_frame->GetDocument(), web_url_request_with_target_start.ToResourceRequest(), "_top"); @@ -2857,7 +2857,7 @@ ViewCreatingWebViewClient client; FrameTestHelpers::WebViewHelper web_view_helper; WebViewBase* web_view_impl = web_view_helper.Initialize(true, 0, &client); - WebLocalFrameImpl* frame = web_view_impl->MainFrameImpl(); + WebLocalFrameBase* frame = web_view_impl->MainFrameImpl(); frame->SetName("_start"); // Make a request that will open a new window @@ -3409,8 +3409,8 @@ WebViewBase* web_view_impl = web_view_helper_.InitializeAndLoad(url, true); web_view_impl->SetInitialFocus(false); - WebLocalFrameImpl* frame = web_view_impl->MainFrameImpl(); - WebInputMethodControllerImpl* active_input_method_controller = + WebLocalFrameBase* frame = web_view_impl->MainFrameImpl(); + WebInputMethodController* active_input_method_controller = frame->GetInputMethodController(); Document* document = frame->GetFrame()->GetDocument(); @@ -3468,7 +3468,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -3492,7 +3492,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad(base_url_ + "form.html", true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -3516,7 +3516,7 @@ RegisterMockedHttpURLLoad("input_field_populated.html"); WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_populated.html"); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); MockAutofillClient client; frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -3537,7 +3537,7 @@ WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "longpress_selection.html", true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->ExecuteScript(WebScriptSource( WebString::FromUTF8("document.execCommand('SelectAll', false, null)"))); std::string actual = frame->SelectionAsText().Utf8(); @@ -3731,7 +3731,7 @@ web_view->Resize(WebSize(500, 300)); web_view->UpdateAllLifecyclePhases(); RunPendingTasks(); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); // Test dom mutation. TEST_EACH_MOUSEEVENT("mutateDom", TRUE); @@ -3756,7 +3756,7 @@ web_view->Resize(WebSize(500, 300)); web_view->UpdateAllLifecyclePhases(); RunPendingTasks(); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); // Test style mutation. TEST_EACH_MOUSEEVENT("mutateStyle", TRUE); @@ -3790,7 +3790,7 @@ web_view->Resize(WebSize(500, 300)); web_view->UpdateAllLifecyclePhases(); RunPendingTasks(); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); // Testswallowing. TEST_EACH_MOUSEEVENT("preventDefault", FALSE); @@ -3829,7 +3829,7 @@ base_url_ + "content_editable_populated.html"); web_view->GetSettings()->SetDefaultFontSize(12); web_view->Resize(WebSize(400, 400)); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); WebPoint baseline_point; NSAttributedString* result = WebSubstringUtil::AttributedSubstringInRange( @@ -3859,7 +3859,7 @@ base_url_ + "content_editable_populated.html"); web_view->GetSettings()->SetDefaultFontSize(12); web_view->Resize(WebSize(400, 400)); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); NSAttributedString* result = nil; WebPoint baseline_point; @@ -3888,8 +3888,8 @@ web_view->GetSettings()->SetDefaultFontSize(12); web_view->GetSettings()->SetJavaScriptEnabled(true); web_view->Resize(WebSize(400, 400)); - WebLocalFrameImpl* main_frame = web_view->MainFrameImpl(); - WebLocalFrameImpl* child_frame = WebLocalFrameImpl::FromFrame( + WebLocalFrameBase* main_frame = web_view->MainFrameImpl(); + WebLocalFrameBase* child_frame = WebLocalFrameBase::FromFrame( ToLocalFrame(main_frame->GetFrame()->Tree().FirstChild())); WebPoint baseline_point; @@ -3923,7 +3923,7 @@ MockAutofillClient client; WebViewBase* web_view = web_view_helper_.InitializeAndLoad( base_url_ + "input_field_password.html", true); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); frame->SetAutofillClient(&client); web_view->SetInitialFocus(false); @@ -4191,7 +4191,7 @@ "<div id=vw></div>", base_url); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); Document* document = frame->GetFrame()->GetDocument(); Element* vw_element = document->getElementById("vw"); @@ -4236,7 +4236,7 @@ "<div id=d></div>", base_url); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); Document* document = frame->GetFrame()->GetDocument(); Element* div = document->getElementById("d"); @@ -4272,7 +4272,7 @@ "<div id=t2></div>", base_url); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); Document* document = frame->GetFrame()->GetDocument(); Element* t1 = document->getElementById("t1"); Element* t2 = document->getElementById("t2"); @@ -4309,7 +4309,7 @@ "</style>", base_url); - WebLocalFrameImpl* frame = web_view->MainFrameImpl(); + WebLocalFrameBase* frame = web_view->MainFrameImpl(); auto* frame_view = frame->GetFrameView(); EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
diff --git a/third_party/WebKit/Source/web/tests/sim/SimTest.cpp b/third_party/WebKit/Source/web/tests/sim/SimTest.cpp index e173ef2e..8e1fa17 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimTest.cpp +++ b/third_party/WebKit/Source/web/tests/sim/SimTest.cpp
@@ -7,11 +7,11 @@ #include "core/dom/Document.h" #include "core/exported/WebViewBase.h" #include "core/frame/LocalDOMWindow.h" +#include "core/frame/WebLocalFrameBase.h" #include "platform/LayoutTestSupport.h" #include "platform/scroll/ScrollbarTheme.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/WebCache.h" -#include "web/WebLocalFrameImpl.h" namespace blink { @@ -66,7 +66,7 @@ return *web_view_helper_.WebView(); } -WebLocalFrameImpl& SimTest::MainFrame() { +WebLocalFrameBase& SimTest::MainFrame() { return *WebView().MainFrameImpl(); }
diff --git a/third_party/WebKit/Source/web/tests/sim/SimTest.h b/third_party/WebKit/Source/web/tests/sim/SimTest.h index 6c46d47..cd1d0811 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimTest.h +++ b/third_party/WebKit/Source/web/tests/sim/SimTest.h
@@ -16,7 +16,7 @@ namespace blink { class WebViewBase; -class WebLocalFrameImpl; +class WebLocalFrameBase; class Document; class LocalDOMWindow; @@ -36,7 +36,7 @@ SimPage& Page(); Document& GetDocument(); WebViewBase& WebView(); - WebLocalFrameImpl& MainFrame(); + WebLocalFrameBase& MainFrame(); const SimWebViewClient& WebViewClient() const; SimCompositor& Compositor();
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn index 83a8e6c..af769703 100644 --- a/third_party/WebKit/public/BUILD.gn +++ b/third_party/WebKit/public/BUILD.gn
@@ -303,6 +303,7 @@ "platform/WebRect.h", "platform/WebReferrerPolicy.h", "platform/WebRenderingStats.h", + "platform/WebRuntimeFeatures.h", "platform/WebScreenInfo.h", "platform/WebScrollbar.h", "platform/WebScrollbarBehavior.h", @@ -557,7 +558,6 @@ "web/WebRemoteFrame.h", "web/WebRemoteFrameClient.h", "web/WebRenderTheme.h", - "web/WebRuntimeFeatures.h", "web/WebSandboxFlags.h", "web/WebScopedUserGesture.h", "web/WebScopedWindowFocusAllowedIndicator.h",
diff --git a/third_party/WebKit/public/platform/WebRuntimeFeatures.h b/third_party/WebKit/public/platform/WebRuntimeFeatures.h new file mode 100644 index 0000000..4f83c0e --- /dev/null +++ b/third_party/WebKit/public/platform/WebRuntimeFeatures.h
@@ -0,0 +1,167 @@ +/* + * Copyright (C) 2013 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. + */ + +#ifndef WebRuntimeFeatures_h +#define WebRuntimeFeatures_h + +#include "WebCommon.h" +#include "WebString.h" + +#include <string> + +namespace blink { +// This class is used to enable runtime features of Blink. +// Stable features are enabled by default. +class WebRuntimeFeatures { + public: + // Enable features with status=experimental listed in + // Source/platform/RuntimeEnabledFeatures.in. + BLINK_PLATFORM_EXPORT static void EnableExperimentalFeatures(bool); + + // Enable features with status=test listed in + // Source/platform/RuntimeEnabledFeatures.in. + BLINK_PLATFORM_EXPORT static void EnableTestOnlyFeatures(bool); + + // Enables a feature by its string identifier from + // Source/platform/RuntimeEnabledFeatures.in. + // Note: We use std::string instead of WebString because this API can + // be called before blink::initalize(). We can't create WebString objects + // before blink::initialize(). + BLINK_PLATFORM_EXPORT static void EnableFeatureFromString( + const std::string& name, + bool enable); + + BLINK_PLATFORM_EXPORT static void EnableCompositedSelectionUpdate(bool); + BLINK_PLATFORM_EXPORT static bool IsCompositedSelectionUpdateEnabled(); + + BLINK_PLATFORM_EXPORT static void EnableDisplayList2dCanvas(bool); + BLINK_PLATFORM_EXPORT static void ForceDisplayList2dCanvas(bool); + BLINK_PLATFORM_EXPORT static void ForceDisable2dCanvasCopyOnWrite(bool); + + BLINK_PLATFORM_EXPORT static void EnableOriginTrials(bool); + BLINK_PLATFORM_EXPORT static bool IsOriginTrialsEnabled(); + + BLINK_PLATFORM_EXPORT static void EnableAccelerated2dCanvas(bool); + BLINK_PLATFORM_EXPORT static void EnableAudioOutputDevices(bool); + BLINK_PLATFORM_EXPORT static void EnableCanvas2dImageChromium(bool); + BLINK_PLATFORM_EXPORT static void EnableColorCorrectRendering(bool); + BLINK_PLATFORM_EXPORT static void EnableColorCorrectRenderingDefaultMode( + bool); + BLINK_PLATFORM_EXPORT static void EnableDatabase(bool); + BLINK_PLATFORM_EXPORT static void EnableDecodeToYUV(bool); + BLINK_PLATFORM_EXPORT static void EnableDocumentWriteEvaluator(bool); + BLINK_PLATFORM_EXPORT static void EnableExperimentalCanvasFeatures(bool); + BLINK_PLATFORM_EXPORT static void EnableFastMobileScrolling(bool); + BLINK_PLATFORM_EXPORT static void EnableFeaturePolicy(bool); + BLINK_PLATFORM_EXPORT static void EnableFileSystem(bool); + BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool); + BLINK_PLATFORM_EXPORT static void EnableGamepadExtensions(bool); + BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool); + BLINK_PLATFORM_EXPORT static void EnableHeapCompaction(bool); + BLINK_PLATFORM_EXPORT static void EnableInputMultipleFieldsUI(bool); + BLINK_PLATFORM_EXPORT static void EnableLazyParseCSS(bool); + BLINK_PLATFORM_EXPORT static void EnableLoadingWithMojo(bool); + BLINK_PLATFORM_EXPORT static void EnableMediaCapture(bool); + BLINK_PLATFORM_EXPORT static void EnableMediaDocumentDownloadButton(bool); + BLINK_PLATFORM_EXPORT static void EnableMediaSession(bool); + BLINK_PLATFORM_EXPORT static void EnableMiddleClickAutoscroll(bool); + BLINK_PLATFORM_EXPORT static void EnableNavigatorContentUtils(bool); + BLINK_PLATFORM_EXPORT static void EnableNetworkInformation(bool); + BLINK_PLATFORM_EXPORT static void EnableNotificationConstructor(bool); + BLINK_PLATFORM_EXPORT static void EnableNotificationContentImage(bool); + BLINK_PLATFORM_EXPORT static void EnableNotifications(bool); + BLINK_PLATFORM_EXPORT static void EnableOffMainThreadFetch(bool); + BLINK_PLATFORM_EXPORT static void EnableOnDeviceChange(bool); + BLINK_PLATFORM_EXPORT static void EnableOrientationEvent(bool); + BLINK_PLATFORM_EXPORT static void EnableOverlayScrollbars(bool); + BLINK_PLATFORM_EXPORT static void EnablePagePopup(bool); + BLINK_PLATFORM_EXPORT static void EnablePassiveDocumentEventListeners(bool); + BLINK_PLATFORM_EXPORT static void EnablePaymentRequest(bool); + BLINK_PLATFORM_EXPORT static void EnablePermissionsAPI(bool); + BLINK_PLATFORM_EXPORT static void EnablePointerEvent(bool); + BLINK_PLATFORM_EXPORT static void EnablePreciseMemoryInfo(bool); + BLINK_PLATFORM_EXPORT static void EnablePrintBrowser(bool); + BLINK_PLATFORM_EXPORT static void EnablePresentationAPI(bool); + BLINK_PLATFORM_EXPORT static void EnablePushMessaging(bool); + BLINK_PLATFORM_EXPORT static void EnableReducedReferrerGranularity(bool); + BLINK_PLATFORM_EXPORT static void EnableRenderingPipelineThrottling(bool); + BLINK_PLATFORM_EXPORT static void EnableRemotePlaybackAPI(bool); + BLINK_PLATFORM_EXPORT static void EnableRootLayerScrolling(bool); + 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 EnableSharedArrayBuffer(bool); + BLINK_PLATFORM_EXPORT static void EnableSharedWorker(bool); + BLINK_PLATFORM_EXPORT static void EnableSlimmingPaintV2(bool); + BLINK_PLATFORM_EXPORT static void EnableSlimmingPaintInvalidation(bool); + BLINK_PLATFORM_EXPORT static void EnableTouchEventFeatureDetection(bool); + BLINK_PLATFORM_EXPORT static void EnableTouchpadAndWheelScrollLatching(bool); + BLINK_PLATFORM_EXPORT static void EnableV8IdleTasks(bool); + BLINK_PLATFORM_EXPORT static void EnableWebAssemblyStreaming(bool); + BLINK_PLATFORM_EXPORT static void EnableWebBluetooth(bool); + BLINK_PLATFORM_EXPORT static void EnableWebFontsInterventionV2With2G(bool); + BLINK_PLATFORM_EXPORT static void EnableWebFontsInterventionV2With3G(bool); + BLINK_PLATFORM_EXPORT static void EnableWebFontsInterventionV2WithSlow2G( + bool); + BLINK_PLATFORM_EXPORT static void EnableWebFontsInterventionTrigger(bool); + BLINK_PLATFORM_EXPORT static void EnableWebGLDraftExtensions(bool); + BLINK_PLATFORM_EXPORT static void EnableWebGLImageChromium(bool); + BLINK_PLATFORM_EXPORT static void EnableWebNfc(bool); + BLINK_PLATFORM_EXPORT static void EnableWebUsb(bool); + BLINK_PLATFORM_EXPORT static void EnableWebVR(bool); + BLINK_PLATFORM_EXPORT static void EnableWebVRExperimentalRendering(bool); + BLINK_PLATFORM_EXPORT static void EnableXSLT(bool); + BLINK_PLATFORM_EXPORT static void ForceOverlayFullscreenVideo(bool); + BLINK_PLATFORM_EXPORT static void EnableAutoplayMutedVideos(bool); + BLINK_PLATFORM_EXPORT static void EnableTimerThrottlingForBackgroundTabs( + bool); + BLINK_PLATFORM_EXPORT static void EnableTimerThrottlingForHiddenFrames(bool); + BLINK_PLATFORM_EXPORT static void EnableExpensiveBackgroundTimerThrottling( + bool); + BLINK_PLATFORM_EXPORT static void EnableCanvas2dDynamicRenderingModeSwitching( + bool); + BLINK_PLATFORM_EXPORT static void + EnableSendBeaconThrowForBlobWithNonSimpleType(bool); + BLINK_PLATFORM_EXPORT static void EnableBackgroundVideoTrackOptimization( + bool); + BLINK_PLATFORM_EXPORT static void EnableNewRemotePlaybackPipeline(bool); + BLINK_PLATFORM_EXPORT static void EnableVideoFullscreenOrientationLock(bool); + BLINK_PLATFORM_EXPORT static void EnableVideoRotateToFullscreen(bool); + BLINK_PLATFORM_EXPORT static void EnableVideoFullscreenDetection(bool); + BLINK_PLATFORM_EXPORT static void EnableMediaControlsOverlayPlayButton(bool); + BLINK_PLATFORM_EXPORT static void EnableLocationHardReload(bool); + + private: + WebRuntimeFeatures(); +}; + +} // namespace blink + +#endif
diff --git a/third_party/WebKit/public/web/WebRuntimeFeatures.h b/third_party/WebKit/public/web/WebRuntimeFeatures.h deleted file mode 100644 index e0fcebff..0000000 --- a/third_party/WebKit/public/web/WebRuntimeFeatures.h +++ /dev/null
@@ -1,160 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef WebRuntimeFeatures_h -#define WebRuntimeFeatures_h - -#include "public/platform/WebCommon.h" -#include "public/platform/WebString.h" - -#include <string> - -namespace blink { - -// This class is used to enable runtime features of Blink. -// Stable features are enabled by default. -class WebRuntimeFeatures { - public: - // Enable features with status=experimental listed in - // Source/platform/RuntimeEnabledFeatures.in. - BLINK_EXPORT static void EnableExperimentalFeatures(bool); - - // Enable features with status=test listed in - // Source/platform/RuntimeEnabledFeatures.in. - BLINK_EXPORT static void EnableTestOnlyFeatures(bool); - - // Enables a feature by its string identifier from - // Source/platform/RuntimeEnabledFeatures.in. - // Note: We use std::string instead of WebString because this API can - // be called before blink::initalize(). We can't create WebString objects - // before blink::initialize(). - BLINK_EXPORT static void EnableFeatureFromString(const std::string& name, - bool enable); - - BLINK_EXPORT static void EnableCompositedSelectionUpdate(bool); - BLINK_EXPORT static bool IsCompositedSelectionUpdateEnabled(); - - BLINK_EXPORT static void EnableDisplayList2dCanvas(bool); - BLINK_EXPORT static void ForceDisplayList2dCanvas(bool); - BLINK_EXPORT static void ForceDisable2dCanvasCopyOnWrite(bool); - - BLINK_EXPORT static void EnableOriginTrials(bool); - BLINK_EXPORT static bool IsOriginTrialsEnabled(); - - BLINK_EXPORT static void EnableAccelerated2dCanvas(bool); - BLINK_EXPORT static void EnableAudioOutputDevices(bool); - BLINK_EXPORT static void EnableCanvas2dImageChromium(bool); - BLINK_EXPORT static void EnableColorCorrectRendering(bool); - BLINK_EXPORT static void EnableColorCorrectRenderingDefaultMode(bool); - BLINK_EXPORT static void EnableDatabase(bool); - BLINK_EXPORT static void EnableDecodeToYUV(bool); - BLINK_EXPORT static void EnableDocumentWriteEvaluator(bool); - BLINK_EXPORT static void EnableExperimentalCanvasFeatures(bool); - BLINK_EXPORT static void EnableFastMobileScrolling(bool); - BLINK_EXPORT static void EnableFeaturePolicy(bool); - BLINK_EXPORT static void EnableFileSystem(bool); - BLINK_EXPORT static void EnableForceTallerSelectPopup(bool); - BLINK_EXPORT static void EnableGamepadExtensions(bool); - BLINK_EXPORT static void EnableGenericSensor(bool); - BLINK_EXPORT static void EnableHeapCompaction(bool); - BLINK_EXPORT static void EnableInputMultipleFieldsUI(bool); - BLINK_EXPORT static void EnableLazyParseCSS(bool); - BLINK_EXPORT static void EnableLoadingWithMojo(bool); - BLINK_EXPORT static void EnableMediaCapture(bool); - BLINK_EXPORT static void EnableMediaDocumentDownloadButton(bool); - BLINK_EXPORT static void EnableMediaSession(bool); - BLINK_EXPORT static void EnableMiddleClickAutoscroll(bool); - BLINK_EXPORT static void EnableNavigatorContentUtils(bool); - BLINK_EXPORT static void EnableNetworkInformation(bool); - BLINK_EXPORT static void EnableNotificationConstructor(bool); - BLINK_EXPORT static void EnableNotificationContentImage(bool); - BLINK_EXPORT static void EnableNotifications(bool); - BLINK_EXPORT static void EnableOffMainThreadFetch(bool); - BLINK_EXPORT static void EnableOnDeviceChange(bool); - BLINK_EXPORT static void EnableOrientationEvent(bool); - BLINK_EXPORT static void EnableOverlayScrollbars(bool); - BLINK_EXPORT static void EnablePagePopup(bool); - BLINK_EXPORT static void EnablePassiveDocumentEventListeners(bool); - BLINK_EXPORT static void EnablePaymentRequest(bool); - BLINK_EXPORT static void EnablePermissionsAPI(bool); - BLINK_EXPORT static void EnablePointerEvent(bool); - BLINK_EXPORT static void EnablePreciseMemoryInfo(bool); - BLINK_EXPORT static void EnablePrintBrowser(bool); - BLINK_EXPORT static void EnablePresentationAPI(bool); - BLINK_EXPORT static void EnablePushMessaging(bool); - BLINK_EXPORT static void EnableReducedReferrerGranularity(bool); - BLINK_EXPORT static void EnableRenderingPipelineThrottling(bool); - BLINK_EXPORT static void EnableRemotePlaybackAPI(bool); - BLINK_EXPORT static void EnableRootLayerScrolling(bool); - BLINK_EXPORT static void EnableScriptedSpeech(bool); - BLINK_EXPORT static void EnableScrollAnchoring(bool); - BLINK_EXPORT static void EnableServiceWorkerNavigationPreload(bool); - BLINK_EXPORT static void EnableSharedArrayBuffer(bool); - BLINK_EXPORT static void EnableSharedWorker(bool); - BLINK_EXPORT static void EnableSlimmingPaintV2(bool); - BLINK_EXPORT static void EnableSlimmingPaintInvalidation(bool); - BLINK_EXPORT static void EnableTouchEventFeatureDetection(bool); - BLINK_EXPORT static void EnableTouchpadAndWheelScrollLatching(bool); - BLINK_EXPORT static void EnableV8IdleTasks(bool); - BLINK_EXPORT static void EnableWebAssemblyStreaming(bool); - BLINK_EXPORT static void EnableWebBluetooth(bool); - BLINK_EXPORT static void EnableWebFontsInterventionV2With2G(bool); - BLINK_EXPORT static void EnableWebFontsInterventionV2With3G(bool); - BLINK_EXPORT static void EnableWebFontsInterventionV2WithSlow2G(bool); - BLINK_EXPORT static void EnableWebFontsInterventionTrigger(bool); - BLINK_EXPORT static void EnableWebGLDraftExtensions(bool); - BLINK_EXPORT static void EnableWebGLImageChromium(bool); - BLINK_EXPORT static void EnableWebNfc(bool); - BLINK_EXPORT static void EnableWebUsb(bool); - BLINK_EXPORT static void EnableWebVR(bool); - BLINK_EXPORT static void EnableWebVRExperimentalRendering(bool); - BLINK_EXPORT static void EnableXSLT(bool); - BLINK_EXPORT static void ForceOverlayFullscreenVideo(bool); - BLINK_EXPORT static void EnableAutoplayMutedVideos(bool); - BLINK_EXPORT static void EnableTimerThrottlingForBackgroundTabs(bool); - BLINK_EXPORT static void EnableTimerThrottlingForHiddenFrames(bool); - BLINK_EXPORT static void EnableExpensiveBackgroundTimerThrottling(bool); - BLINK_EXPORT static void EnableCanvas2dDynamicRenderingModeSwitching(bool); - BLINK_EXPORT static void EnableSendBeaconThrowForBlobWithNonSimpleType(bool); - BLINK_EXPORT static void EnableBackgroundVideoTrackOptimization(bool); - BLINK_EXPORT static void EnableNewRemotePlaybackPipeline(bool); - BLINK_EXPORT static void EnableVideoFullscreenOrientationLock(bool); - BLINK_EXPORT static void EnableVideoRotateToFullscreen(bool); - BLINK_EXPORT static void EnableVideoFullscreenDetection(bool); - BLINK_EXPORT static void EnableMediaControlsOverlayPlayButton(bool); - BLINK_EXPORT static void EnableLocationHardReload(bool); - - private: - WebRuntimeFeatures(); -}; - -} // namespace blink - -#endif
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index c94d9c5..f945554b 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -15011,7 +15011,6 @@ <int value="1993" label="ShapeDetection_TextDetectorConstructor"/> <int value="1994" label="CredentialManagerCredentialRequestOptionsOnlyUnmediated"/> - <int value="1995" label="InertAttribute"/> <int value="1996" label="PluginInstanceAccessFromIsolatedWorld"/> <int value="1997" label="PluginInstanceAccessFromMainWorld"/> </enum> @@ -16937,12 +16936,14 @@ <enum name="GCMDecryptionResult" type="int"> <int value="0" label="Success (message unencrypted)"/> - <int value="1" label="Success (message decrypted)"/> + <int value="1" label="Success (message decrypted per draft 03)"/> <int value="2" label="Failure (invalid Encryption HTTP header)"/> <int value="3" label="Failure (invalid Crypto-Key HTTP header)"/> <int value="4" label="Failure (no keying material available)"/> <int value="5" label="Failure (unable to compute the shared secret)"/> <int value="6" label="Failure (unable to decrypt using AES-GCM)"/> + <int value="7" label="Failure (invalid binary header)"/> + <int value="8" label="Success (message decrypted per draft 08)"/> </enum> <enum name="GCMEndpoints" type="int">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index a6da3e3..fb8f675c 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -68323,6 +68323,14 @@ </summary> </histogram> +<histogram name="Signin.AndroidAccountSigninViewSeedingTime" units="ms"> + <owner>bsazonov@chromium.org</owner> + <summary> + The time it takes to seed accounts before proceeding to the account + confirmation screen. + </summary> +</histogram> + <histogram name="Signin.AndroidGetAccountsTime" units="ms"> <owner>nyquist@chromium.org</owner> <summary>
diff --git a/tools/perf/benchmarks/system_health_smoke_test.py b/tools/perf/benchmarks/system_health_smoke_test.py index 9646110..6b9841d8 100644 --- a/tools/perf/benchmarks/system_health_smoke_test.py +++ b/tools/perf/benchmarks/system_health_smoke_test.py
@@ -63,9 +63,6 @@ # crbug.com/699966 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_health.memory_desktop.multitab:misc:typical24', # pylint: disable=line-too-long - - # crbug.com/725386 - 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_health.memory_desktop.browse:social:twitter', # pylint: disable=line-too-long })
diff --git a/tools/perf/page_sets/data/system_health_desktop.json b/tools/perf/page_sets/data/system_health_desktop.json index 554c9fc..58d9359 100644 --- a/tools/perf/page_sets/data/system_health_desktop.json +++ b/tools/perf/page_sets/data/system_health_desktop.json
@@ -37,7 +37,7 @@ "DEFAULT": "system_health_desktop_039.wpr" }, "browse:social:twitter": { - "DEFAULT": "system_health_desktop_019.wpr" + "DEFAULT": "system_health_desktop_053.wpr" }, "browse:tools:earth": { "DEFAULT": "system_health_desktop_050.wpr" @@ -195,4 +195,4 @@ }, "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", "platform_specific": true -} +} \ No newline at end of file
diff --git a/tools/perf/page_sets/data/system_health_desktop_053.wpr.sha1 b/tools/perf/page_sets/data/system_health_desktop_053.wpr.sha1 new file mode 100644 index 0000000..f2176b3 --- /dev/null +++ b/tools/perf/page_sets/data/system_health_desktop_053.wpr.sha1
@@ -0,0 +1 @@ +153752344db22b625bd11bec9060d21cf2ec83e7 \ No newline at end of file
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py index bdf4882..7d57323 100644 --- a/tools/perf/page_sets/system_health/browsing_stories.py +++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -211,7 +211,6 @@ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY -@decorators.Disabled('win') # crbug.com/662971 class TwitterDesktopStory(_ArticleBrowsingStory): NAME = 'browse:social:twitter' URL = 'https://www.twitter.com/nasa'
diff --git a/tools/roll_webrtc.py b/tools/roll_webrtc.py index 5a6a5ea..7b3386e6 100755 --- a/tools/roll_webrtc.py +++ b/tools/roll_webrtc.py
@@ -96,7 +96,7 @@ local_scope = {} var = GClientKeywords.VarImpl({}, local_scope) global_scope = { - 'From': GClientKeywords.FromImpl, +# 'From': GClientKeywords.FromImpl, 'Var': var.Lookup, 'deps_os': {}, }