diff --git a/.gn b/.gn index 4025cb90..9d2eb7e 100644 --- a/.gn +++ b/.gn
@@ -74,7 +74,6 @@ "//remoting/host/win:*", # 43 errors "//remoting/ios/app/settings:*", # 6 errors "//remoting/protocol:*", # 3 errors - "//remoting/test:*", # 2 error "//sandbox/win:*", # 7 errors "//third_party/icu/*",
diff --git a/DEPS b/DEPS index 157c543..3558b1b 100644 --- a/DEPS +++ b/DEPS
@@ -190,7 +190,7 @@ # luci-go CIPD package version. # Make sure the revision is uploaded by infra-packagers builder. # https://ci.chromium.org/p/infra-internal/g/infra-packagers/console - 'luci_go': 'git_revision:40f945205c8670537d14901c310374774f589254', + 'luci_go': 'git_revision:a5505c14c78e1a27562164fb55f7d2d8190a0a9b', # This can be overridden, e.g. with custom_vars, to build clang from HEAD # instead of downloading the prebuilt pinned revision. @@ -222,11 +222,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '8cbd2b476cdbf67e0fe341ee2e2c4da570cc552f', + 'skia_revision': 'fcd068ad7215d94c02333b3b07843e750d0266cd', # 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': '70f20a327d637fd542cecccf8b13d9be592bd11f', + 'v8_revision': 'e0d15f8b527b3d4ba861c83d754e30ef9c2f4621', # 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. @@ -234,11 +234,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'da523f6b461771dac44e981c6e6fb4eca9cc36e7', + 'angle_revision': '0fa2e7f9aa786e59ed23c3106441b078267097cd', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': '69deca60e70d2992ee3f49c1a981b8432864abc0', + 'swiftshader_revision': '6f1260556b102395e25e9991ee377701b66abfb4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -301,7 +301,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': 'd2778d192a469d0a617eee89544a552eb1de2f3c', + 'devtools_frontend_revision': '73321061892bef1e65552437c4e1fac84a4ea85e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -341,7 +341,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'aeff235dc3737ef40b8aaced3f67f8df3996e494', + 'dawn_revision': '14f3813677dcee7ee0d5d0d1243261ef5852c5e9', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -408,7 +408,7 @@ 'libcxx_revision': '8fa87946779682841e21e2da977eccfb6cb3bded', # GN CIPD package version. - 'gn_version': 'git_revision:4d207c94eab41f09c9a8505eb47f3d2919e47943', + 'gn_version': 'git_revision:31f2bba8aafa8015ca5761100a21f17c2d741062', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -954,7 +954,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'f17e649a5f23bf666247dbe603bd6513f0607fd9', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'c826272602f92e36cd3e12dd4d9e63c1ceb6cb43', 'condition': 'checkout_chromeos', }, @@ -969,7 +969,7 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '308f229434b8a49d57cdd691470068042090dc75', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'eb6d5a97b259e28f02dd8e54483cd462ef49ef13', 'condition': 'checkout_linux', }, @@ -1360,7 +1360,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f4ffdc1c0d10c444b6ca626319d6cdb20f8edae4', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '1f54e94bc36a5e662a09896ccafa0213284cad5c', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1468,7 +1468,7 @@ }, 'src/third_party/re2/src': - Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + 'd541d5abdb9dd8a8922228935f3000c265535518', + Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + 'a5d27a7b2289c98849516aea50c807f3e3a5914b', 'src/third_party/r8': { 'packages': [ @@ -1592,7 +1592,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '782277b9c5d41ecbdcba2941887cbcb9c365da10', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '92fc02161e858d8e3a15932593b0f033ed71219e', + Var('webrtc_git') + '/src.git' + '@' + '6b09c451dc7a7bdc3b2183171bfc96209f889889', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1653,7 +1653,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4ed852047ae1ef2ebdd40af464dd965d397cc094', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@859485c571f8b1d2d79f3632252df80b98090043', 'condition': 'checkout_src_internal', }, @@ -1683,7 +1683,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': '9qYtGtXiVi1ncokVz_H2NTzAvR4wO2U8NEy0dWekd3YC', + 'version': 'RNatxCAGpJjbVaT700xpyTmbzsU5P6EPAZ_BBs-QHD8C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/gfx/BUILD.gn b/android_webview/browser/gfx/BUILD.gn index 4a660b51..6eafbc6 100644 --- a/android_webview/browser/gfx/BUILD.gn +++ b/android_webview/browser/gfx/BUILD.gn
@@ -34,6 +34,8 @@ "deferred_gpu_command_service.h", "display_scheduler_webview.cc", "display_scheduler_webview.h", + "display_webview.cc", + "display_webview.h", "gpu_service_webview.cc", "gpu_service_webview.h", "hardware_renderer.cc",
diff --git a/android_webview/browser/gfx/DEPS b/android_webview/browser/gfx/DEPS index 8c89897b..a8b64c5 100644 --- a/android_webview/browser/gfx/DEPS +++ b/android_webview/browser/gfx/DEPS
@@ -9,6 +9,7 @@ "+components/power_scheduler", "+components/viz/service/gl", "+components/viz/service/main", + "+components/viz/service/surfaces", "+ui/latency", ]
diff --git a/android_webview/browser/gfx/display_scheduler_webview.cc b/android_webview/browser/gfx/display_scheduler_webview.cc index cacc22b..d009671 100644 --- a/android_webview/browser/gfx/display_scheduler_webview.cc +++ b/android_webview/browser/gfx/display_scheduler_webview.cc
@@ -6,8 +6,11 @@ #include "android_webview/browser/gfx/root_frame_sink.h" namespace android_webview { -DisplaySchedulerWebView::DisplaySchedulerWebView(RootFrameSink* root_frame_sink) - : root_frame_sink_(root_frame_sink) {} +DisplaySchedulerWebView::DisplaySchedulerWebView( + RootFrameSink* root_frame_sink, + OverlaysInfoProvider* overlays_info_provider) + : root_frame_sink_(root_frame_sink), + overlays_info_provider_(overlays_info_provider) {} DisplaySchedulerWebView::~DisplaySchedulerWebView() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } @@ -47,13 +50,22 @@ // WebView can't handle surface lost so this isn't called. NOTREACHED(); } + +bool DisplaySchedulerWebView::IsFrameSinkOverlayed( + viz::FrameSinkId frame_sink_id) { + return overlays_info_provider_ && + overlays_info_provider_->IsFrameSinkOverlayed(frame_sink_id); +} + void DisplaySchedulerWebView::OnDisplayDamaged(viz::SurfaceId surface_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // We don't need to track damage of root frame sink as we submit frame to it // at DrawAndSwap and Root Renderer sink because Android View.Invalidation is // handled by SynchronousCompositorHost. + if (surface_id.frame_sink_id() != root_frame_sink_->root_frame_sink_id() && - !root_frame_sink_->IsChildSurface(surface_id.frame_sink_id())) { + !root_frame_sink_->IsChildSurface(surface_id.frame_sink_id()) && + !IsFrameSinkOverlayed(surface_id.frame_sink_id())) { int count = damaged_frames_[surface_id.frame_sink_id()] + 1; TRACE_EVENT_INSTANT2(
diff --git a/android_webview/browser/gfx/display_scheduler_webview.h b/android_webview/browser/gfx/display_scheduler_webview.h index 610eafc..d97a073 100644 --- a/android_webview/browser/gfx/display_scheduler_webview.h +++ b/android_webview/browser/gfx/display_scheduler_webview.h
@@ -15,9 +15,15 @@ namespace android_webview { class RootFrameSink; +class OverlaysInfoProvider { + public: + virtual bool IsFrameSinkOverlayed(viz::FrameSinkId frame_sink_id) = 0; +}; + class DisplaySchedulerWebView : public viz::DisplaySchedulerBase { public: - DisplaySchedulerWebView(RootFrameSink* root_frame_sink); + DisplaySchedulerWebView(RootFrameSink* root_frame_sink, + OverlaysInfoProvider* overlays_info_provider); ~DisplaySchedulerWebView() override; // DisplaySchedulerBase implementation. @@ -35,12 +41,18 @@ void OnPendingSurfacesChanged() override {} private: + bool IsFrameSinkOverlayed(viz::FrameSinkId frame_sink_id); + RootFrameSink* const root_frame_sink_; // This count how many times specific sink damaged display. It's incremented // in OnDisplayDamaged and decremented in DidSwapBuffers. std::map<viz::FrameSinkId, int> damaged_frames_; + // Due to destruction order in viz::Display this might be not safe to use in + // destructor of this class. + OverlaysInfoProvider* const overlays_info_provider_; + THREAD_CHECKER(thread_checker_); }; } // namespace android_webview
diff --git a/android_webview/browser/gfx/display_webview.cc b/android_webview/browser/gfx/display_webview.cc new file mode 100644 index 0000000..bcc2f34c --- /dev/null +++ b/android_webview/browser/gfx/display_webview.cc
@@ -0,0 +1,92 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "android_webview/browser/gfx/display_webview.h" + +#include "android_webview/browser/gfx/overlay_processor_webview.h" +#include "base/memory/ptr_util.h" +#include "components/viz/service/display/overlay_processor_stub.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" +#include "gpu/config/gpu_finch_features.h" + +namespace android_webview { + +std::unique_ptr<DisplayWebView> DisplayWebView::Create( + const viz::RendererSettings& settings, + const viz::DebugRendererSettings* debug_settings, + const viz::FrameSinkId& frame_sink_id, + std::unique_ptr<viz::DisplayCompositorMemoryAndTaskController> + gpu_dependency, + std::unique_ptr<viz::OutputSurface> output_surface, + viz::FrameSinkManagerImpl* frame_sink_manager, + RootFrameSink* root_frame_sink) { + std::unique_ptr<viz::OverlayProcessorInterface> overlay_processor; + OverlayProcessorWebView* overlay_processor_webview_raw = nullptr; + if (features::IsAndroidSurfaceControlEnabled()) { + auto overlay_processor_webview = std::make_unique<OverlayProcessorWebView>( + gpu_dependency.get(), frame_sink_manager); + overlay_processor_webview_raw = overlay_processor_webview.get(); + overlay_processor = std::move(overlay_processor_webview); + } else { + overlay_processor = std::make_unique<viz::OverlayProcessorStub>(); + } + + auto scheduler = std::make_unique<DisplaySchedulerWebView>( + root_frame_sink, overlay_processor_webview_raw); + + return base::WrapUnique(new DisplayWebView( + settings, debug_settings, frame_sink_id, std::move(gpu_dependency), + std::move(output_surface), std::move(overlay_processor), + std::move(scheduler), overlay_processor_webview_raw, frame_sink_manager)); +} + +DisplayWebView::DisplayWebView( + const viz::RendererSettings& settings, + const viz::DebugRendererSettings* debug_settings, + const viz::FrameSinkId& frame_sink_id, + std::unique_ptr<viz::DisplayCompositorMemoryAndTaskController> + gpu_dependency, + std::unique_ptr<viz::OutputSurface> output_surface, + std::unique_ptr<viz::OverlayProcessorInterface> overlay_processor, + std::unique_ptr<viz::DisplaySchedulerBase> scheduler, + OverlayProcessorWebView* overlay_processor_webview, + viz::FrameSinkManagerImpl* frame_sink_manager) + : viz::Display(/*bitmap_manager=*/nullptr, + settings, + debug_settings, + frame_sink_id, + std::move(gpu_dependency), + std::move(output_surface), + std::move(overlay_processor), + std::move(scheduler), + /*current_task_runner=*/nullptr), + overlay_processor_webview_(overlay_processor_webview) { + if (overlay_processor_webview_) { + frame_sink_manager_observation_.Observe(frame_sink_manager); + } +} + +DisplayWebView::~DisplayWebView() = default; + +void DisplayWebView::OnFrameSinkDidFinishFrame( + const viz::FrameSinkId& frame_sink_id, + const viz::BeginFrameArgs& args) { + DCHECK(overlay_processor_webview_); + auto surface_id = + overlay_processor_webview_->GetOverlaySurfaceId(frame_sink_id); + if (surface_id.is_valid()) { + // TODO(vasilyt): We don't need full aggregation here as we don't need + // aggregated frame. + aggregator_->Aggregate(current_surface_id_, base::TimeTicks::Now(), + gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(), + ++swapped_trace_id_); + auto* resolved_data = aggregator_->GetLatestFrameData(surface_id); + if (resolved_data) { + overlay_processor_webview_->ProcessForFrameSinkId(frame_sink_id, + resolved_data); + } + } +} + +} // namespace android_webview
diff --git a/android_webview/browser/gfx/display_webview.h b/android_webview/browser/gfx/display_webview.h new file mode 100644 index 0000000..402fe7eb --- /dev/null +++ b/android_webview/browser/gfx/display_webview.h
@@ -0,0 +1,75 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ANDROID_WEBVIEW_BROWSER_GFX_DISPLAY_WEBVIEW_H_ +#define ANDROID_WEBVIEW_BROWSER_GFX_DISPLAY_WEBVIEW_H_ + +#include "base/scoped_observation.h" +#include "components/viz/service/display/display.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" +#include "components/viz/service/frame_sinks/frame_sink_observer.h" + +namespace android_webview { +class OverlayProcessorWebView; +class RootFrameSink; + +class DisplayWebView : public viz::Display, public viz::FrameSinkObserver { + public: + static std::unique_ptr<DisplayWebView> Create( + const viz::RendererSettings& settings, + const viz::DebugRendererSettings* debug_settings, + const viz::FrameSinkId& frame_sink_id, + std::unique_ptr<viz::DisplayCompositorMemoryAndTaskController> + gpu_dependency, + std::unique_ptr<viz::OutputSurface> output_surface, + viz::FrameSinkManagerImpl* frame_sink_manager, + RootFrameSink* root_frame_sink); + + ~DisplayWebView() override; + + OverlayProcessorWebView* overlay_processor() const { + return overlay_processor_webview_; + } + + // viz::FrameSinkObserver implenentation: + void OnRegisteredFrameSinkId(const viz::FrameSinkId& frame_sink_id) override { + } + void OnInvalidatedFrameSinkId( + const viz::FrameSinkId& frame_sink_id) override {} + void OnCreatedCompositorFrameSink(const viz::FrameSinkId& frame_sink_id, + bool is_root) override {} + void OnDestroyedCompositorFrameSink( + const viz::FrameSinkId& frame_sink_id) override {} + void OnRegisteredFrameSinkHierarchy( + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) override {} + void OnUnregisteredFrameSinkHierarchy( + const viz::FrameSinkId& parent_frame_sink_id, + const viz::FrameSinkId& child_frame_sink_id) override {} + void OnFrameSinkDidBeginFrame(const viz::FrameSinkId& frame_sink_id, + const viz::BeginFrameArgs& args) override {} + void OnFrameSinkDidFinishFrame(const viz::FrameSinkId& frame_sink_id, + const viz::BeginFrameArgs& args) override; + + private: + DisplayWebView( + const viz::RendererSettings& settings, + const viz::DebugRendererSettings* debug_settings, + const viz::FrameSinkId& frame_sink_id, + std::unique_ptr<viz::DisplayCompositorMemoryAndTaskController> + gpu_dependency, + std::unique_ptr<viz::OutputSurface> output_surface, + std::unique_ptr<viz::OverlayProcessorInterface> overlay_processor, + std::unique_ptr<viz::DisplaySchedulerBase> scheduler, + OverlayProcessorWebView* overlay_processor_webview, + viz::FrameSinkManagerImpl* frame_sink_manager); + + OverlayProcessorWebView* const overlay_processor_webview_; + base::ScopedObservation<viz::FrameSinkManagerImpl, viz::FrameSinkObserver> + frame_sink_manager_observation_{this}; +}; + +} // namespace android_webview + +#endif // ANDROID_WEBVIEW_BROWSER_GFX_DISPLAY_WEBVIEW_H_
diff --git a/android_webview/browser/gfx/hardware_renderer_viz.cc b/android_webview/browser/gfx/hardware_renderer_viz.cc index 3bbfbdcc..1d3c4ad 100644 --- a/android_webview/browser/gfx/hardware_renderer_viz.cc +++ b/android_webview/browser/gfx/hardware_renderer_viz.cc
@@ -12,6 +12,7 @@ #include "android_webview/browser/gfx/aw_gl_surface.h" #include "android_webview/browser/gfx/aw_render_thread_context_provider.h" #include "android_webview/browser/gfx/display_scheduler_webview.h" +#include "android_webview/browser/gfx/display_webview.h" #include "android_webview/browser/gfx/gpu_service_webview.h" #include "android_webview/browser/gfx/overlay_processor_webview.h" #include "android_webview/browser/gfx/parent_compositor_draw_constraints.h" @@ -35,7 +36,6 @@ #include "components/viz/common/quads/surface_draw_quad.h" #include "components/viz/common/surfaces/local_surface_id.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" -#include "components/viz/service/display/display.h" #include "components/viz/service/display/display_client.h" #include "components/viz/service/display/display_scheduler.h" #include "components/viz/service/display/overlay_processor_stub.h" @@ -108,7 +108,7 @@ const viz::FrameSinkId frame_sink_id_; viz::LocalSurfaceId root_local_surface_id_; std::unique_ptr<viz::BeginFrameSource> stub_begin_frame_source_; - std::unique_ptr<viz::Display> display_; + std::unique_ptr<DisplayWebView> display_; std::unique_ptr<viz::HitTestAggregator> hit_test_aggregator_; viz::SurfaceId child_surface_id_; @@ -138,32 +138,13 @@ stub_begin_frame_source_ = std::make_unique<viz::StubBeginFrameSource>(); - std::unique_ptr<viz::OverlayProcessorInterface> overlay_processor; - - if (features::IsAndroidSurfaceControlEnabled()) { - auto overlay_processor_webview = - std::make_unique<OverlayProcessorWebView>(display_controller.get()); - overlay_processor_webview_ = overlay_processor_webview.get(); - overlay_processor = std::move(overlay_processor_webview); - } else { - overlay_processor = std::make_unique<viz::OverlayProcessorStub>(); - } - - auto scheduler = - std::make_unique<DisplaySchedulerWebView>(without_gpu_.get()); - - // Android WebView has no overlay processor, and does not need to share - // gpu_task_scheduler, so it is passed in as nullptr. - // TODO(weiliangc): Android WebView should support overlays. Change initialize - // order to make this happen. - display_ = std::make_unique<viz::Display>( - nullptr /* shared_bitmap_manager */, + display_ = DisplayWebView::Create( output_surface_provider->renderer_settings(), output_surface_provider->debug_settings(), frame_sink_id_, std::move(display_controller), std::move(output_surface), - std::move(overlay_processor), std::move(scheduler), - nullptr /* current_task_runner */); + GetFrameSinkManager(), without_gpu_.get()); display_->Initialize(this, GetFrameSinkManager()->surface_manager(), true); + overlay_processor_webview_ = display_->overlay_processor(); display_->SetVisible(true); display_->DisableGPUAccessByDefault();
diff --git a/android_webview/browser/gfx/overlay_processor_webview.cc b/android_webview/browser/gfx/overlay_processor_webview.cc index ee0d0c95..cbe15de 100644 --- a/android_webview/browser/gfx/overlay_processor_webview.cc +++ b/android_webview/browser/gfx/overlay_processor_webview.cc
@@ -6,13 +6,17 @@ #include "android_webview/browser/gfx/gpu_service_webview.h" #include "android_webview/browser/gfx/viz_compositor_thread_runner_webview.h" +#include "base/android/android_hardware_buffer_compat.h" #include "base/android/scoped_hardware_buffer_fence_sync.h" #include "base/bind_post_task.h" #include "base/callback_helpers.h" #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" #include "components/viz/service/display/display_compositor_memory_and_task_controller.h" +#include "components/viz/service/display/resolved_frame_data.h" +#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "components/viz/service/gl/gpu_service_impl.h" +#include "components/viz/service/surfaces/surface.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/shared_image_manager.h" #include "gpu/command_buffer/service/shared_image_representation.h" @@ -50,6 +54,7 @@ Resource(gpu::SharedImageManager* shared_image_manager, gpu::MemoryTypeTracker* memory_tracker, const gpu::Mailbox& mailbox, + const gfx::RectF& uv_rect, base::ScopedClosureRunner return_resource) : return_resource(std::move(return_resource)) { representation_ = @@ -65,6 +70,12 @@ begin_read_fence_ = std::move( acquire_fences.front().GetGpuFenceHandle().Clone().owned_fd); } + + AHardwareBuffer_Desc desc; + base::AndroidHardwareBufferCompat::GetInstance().Describe( + GetAHardwareBuffer(), &desc); + gfx::RectF scaled_rect = gfx::ScaleRect(uv_rect, desc.width, desc.height); + crop_rect_ = gfx::ToEnclosedRect(scaled_rect); } ~Resource() { @@ -102,7 +113,10 @@ return read_access_->GetAHardwareBuffer(); } + const gfx::Rect& crop_rect() { return crop_rect_; } + private: + gfx::Rect crop_rect_; base::ScopedClosureRunner return_resource; std::unique_ptr<gpu::SharedImageRepresentationOverlay> representation_; std::unique_ptr<gpu::SharedImageRepresentationOverlay::ScopedReadAccess> @@ -142,7 +156,8 @@ auto& transaction = GetHWUITransaction(); std::unique_ptr<Resource> resource = - CreateResource(candidate.mailbox, std::move(return_resource)); + CreateResource(candidate.mailbox, candidate.unclipped_uv_rect, + std::move(return_resource)); { base::AutoLock lock(lock_); @@ -154,9 +169,9 @@ DCHECK(inserted); auto& overlay_surface = it->second; - UpdateGeometryInTransaction(transaction, *overlay_surface.surface, + UpdateGeometryInTransaction(transaction, *overlay_surface.bounds_surface, candidate); - UpdateBufferInTransaction(transaction, *overlay_surface.surface, + UpdateBufferInTransaction(transaction, *overlay_surface.buffer_surface, resource.get()); overlay_surface.buffer_update_pending = true; } @@ -180,7 +195,7 @@ base::AutoLock lock(lock_); auto& overlay_surface = GetOverlaySurfaceLocked(overlay_id); - UpdateGeometryInTransaction(transaction, *overlay_surface.surface, + UpdateGeometryInTransaction(transaction, *overlay_surface.bounds_surface, candidate); } @@ -188,6 +203,7 @@ // Thread. void UpdateOverlayBuffer(uint64_t overlay_id, gpu::Mailbox mailbox, + const gfx::RectF& uv_rect, base::ScopedClosureRunner return_resource) { DCHECK_CALLED_ON_VALID_THREAD(gpu_thread_checker_); TRACE_EVENT1("gpu,benchmark,android_webview", @@ -205,7 +221,7 @@ } std::unique_ptr<Resource> resource = - CreateResource(mailbox, std::move(return_resource)); + CreateResource(mailbox, uv_rect, std::move(return_resource)); // If there is already transaction with buffer update in-flight, store this // one. This will return any previous stored resource if any. @@ -233,7 +249,7 @@ { base::AutoLock lock(lock_); auto& overlay_surface = GetOverlaySurfaceLocked(overlay_id); - transaction.SetParent(*overlay_surface.surface, nullptr); + transaction.SetParent(*overlay_surface.bounds_surface, nullptr); } pending_removals_.insert(overlay_id); @@ -256,7 +272,7 @@ base::AutoLock lock(lock_); for (auto overlay_id : overlay_ids) { auto& overlay = GetOverlaySurfaceLocked(overlay_id); - transaction.SetParent(*overlay.surface, nullptr); + transaction.SetParent(*overlay.bounds_surface, nullptr); } } @@ -278,7 +294,7 @@ DCHECK_EQ(transaction_stats.surface_stats.size(), 1u); DCHECK_EQ(transaction_stats.surface_stats.front().surface, - overlay_surface.surface->surface()); + overlay_surface.buffer_surface->surface()); bool empty_buffer = !resource; overlay_surface.SetResource( @@ -295,7 +311,7 @@ if (overlay_surface.pending_remove) { // If there is no resource, we can free our surface. if (empty_buffer) { - overlay_surface.surface.reset(); + overlay_surface.Reset(); overlay_surfaces_.erase(overlay_id); } else { // This means there was buffer transaction in flight when surface was @@ -321,7 +337,7 @@ base::ScopedFD fence; for (auto& stat : transaction_stats.surface_stats) { - if (stat.surface == overlay_surface.surface->surface()) { + if (stat.surface == overlay_surface.buffer_surface->surface()) { DCHECK(!fence.is_valid()); fence = std::move(stat.fence); } @@ -375,13 +391,17 @@ class OverlaySurface { public: OverlaySurface(const gfx::SurfaceControl::Surface& parent) - : surface(base::MakeRefCounted<gfx::SurfaceControl::Surface>( + : bounds_surface(base::MakeRefCounted<gfx::SurfaceControl::Surface>( parent, - "webview_overlay")) {} + "webview_overlay_bounds")), + buffer_surface(base::MakeRefCounted<gfx::SurfaceControl::Surface>( + *bounds_surface, + "webview_overlay_content")) {} OverlaySurface(OverlaySurface&& other) = default; OverlaySurface& operator=(OverlaySurface&& other) = default; ~OverlaySurface() { - DCHECK(!surface); + DCHECK(!bounds_surface); + DCHECK(!buffer_surface); DCHECK(!current_resource); } @@ -404,6 +424,13 @@ pending_resource = std::move(resource); } + void Reset() { + DCHECK(!pending_resource); + DCHECK(!current_resource); + bounds_surface.reset(); + buffer_surface.reset(); + } + // Set when we're in process of removing this overlay. bool pending_remove = false; @@ -419,7 +446,8 @@ std::unique_ptr<Resource> pending_resource; // SurfaceControl for this overlay. - scoped_refptr<gfx::SurfaceControl::Surface> surface; + scoped_refptr<gfx::SurfaceControl::Surface> bounds_surface; + scoped_refptr<gfx::SurfaceControl::Surface> buffer_surface; }; ~Manager() { @@ -454,22 +482,50 @@ std::unique_ptr<Resource> CreateResource( const gpu::Mailbox& mailbox, + const gfx::RectF uv_rect, base::ScopedClosureRunner return_resource) { if (mailbox.IsZero()) return nullptr; return std::make_unique<Resource>(shared_image_manager_, - memory_tracker_.get(), mailbox, + memory_tracker_.get(), mailbox, uv_rect, std::move(return_resource)); } + // Because we update different parts of geometry on different threads we use + // two surfaces to avoid races. The Bounds surface is setup the way it assumes + // that its content size is kBoundsSurfaceContentSize. The Buffer surface is + // setup to scale itself to kBoundsSurfaceContentSize. Note, that from scaling + // perspective this number doesn't matter as scales of two surfaces will be + // just multiplied inside SurfaceFlinger, but because positions and crop rects + // are integers we need the content size to be large enough to avoid rounding + // errors. To avoid floating point errors we also use power of two. + static constexpr float kBoundsSurfaceContentSize = 8192.0f; + static void UpdateGeometryInTransaction( gfx::SurfaceControl::Transaction& transaction, gfx::SurfaceControl::Surface& surface, const viz::OverlayCandidate& candidate) { - gfx::Rect src = gfx::Rect(candidate.resource_size_in_pixels); - gfx::Rect dst = gfx::ToEnclosedRect(candidate.display_rect); + DCHECK_EQ(candidate.transform, gfx::OVERLAY_TRANSFORM_NONE); + gfx::Rect dst = gfx::ToEnclosingRect(candidate.unclipped_display_rect); - transaction.SetGeometry(surface, src, dst, candidate.transform); + transaction.SetPosition(surface, dst.origin()); + // Setup scale so the contents of size kBoundsSurfaceContentSize would fit + // into display_rect. The buffer surface will make sure to scale its content + // to kBoundsSurfaceContentSize. + float scale_x = dst.width() / kBoundsSurfaceContentSize; + float scale_y = dst.height() / kBoundsSurfaceContentSize; + transaction.SetScale(surface, scale_x, scale_y); + if (candidate.clip_rect) { + // Make |crop_rect| relative to |display_rect|. + auto crop_rect = dst; + crop_rect.Intersect(*candidate.clip_rect); + crop_rect.Offset(-dst.x(), -dst.y()); + + // Crop rect is in content space, so we need to scale it. + auto scaled_clip = gfx::ToEnclosingRect(gfx::ScaleRect( + gfx::RectF(crop_rect), 1.0f / scale_x, 1.0f / scale_y)); + transaction.SetCrop(surface, scaled_clip); + } } static void UpdateBufferInTransaction( @@ -480,8 +536,24 @@ "OverlayProcessorWebview::Manager::UpdateBufferInTransaction", "has_resource", !!resource); if (resource) { - transaction.SetBuffer(surface, resource->GetAHardwareBuffer(), - resource->TakeBeginReadFence()); + auto* buffer = resource->GetAHardwareBuffer(); + auto crop_rect = resource->crop_rect(); + + // Crop rect defines the valid portion of the buffer, so we use its as a + // surface size. This calculates scale from our size to bounds surface + // content size, see comment at kBoundsSurfaceContentSize. + float scale_x = kBoundsSurfaceContentSize / crop_rect.width(); + float scale_y = kBoundsSurfaceContentSize / crop_rect.height(); + + // Crop rect is defined in buffer space, so we need to translate our + // surface to make sure crop rect origin matches bounds surface (0, 0). + // Position is defined in parent space, so we need to scale it. + transaction.SetPosition(surface, + gfx::Point(-ceil(crop_rect.x() * scale_x), + -ceil(crop_rect.y() * scale_y))); + transaction.SetScale(surface, scale_x, scale_y); + transaction.SetCrop(surface, crop_rect); + transaction.SetBuffer(surface, buffer, resource->TakeBeginReadFence()); } else { transaction.SetBuffer(surface, nullptr, base::ScopedFD()); } @@ -496,7 +568,7 @@ overlay_surface.buffer_update_pending = true; gfx::SurfaceControl::Transaction transaction; - UpdateBufferInTransaction(transaction, *overlay_surface.surface, + UpdateBufferInTransaction(transaction, *overlay_surface.buffer_surface, resource.get()); auto cb = base::BindOnce(&Manager::OnUpdateBufferTransactionAck, this, @@ -534,10 +606,12 @@ }; OverlayProcessorWebView::OverlayProcessorWebView( - viz::DisplayCompositorMemoryAndTaskController* display_controller) + viz::DisplayCompositorMemoryAndTaskController* display_controller, + viz::FrameSinkManagerImpl* frame_sink_manager) : command_buffer_id_(gpu::DisplayCompositorMemoryAndTaskControllerOnGpu:: NextCommandBufferId()), - render_thread_sequence_(display_controller->gpu_task_scheduler()) { + render_thread_sequence_(display_controller->gpu_task_scheduler()), + frame_sink_manager_(frame_sink_manager) { base::WaitableEvent event; render_thread_sequence_->ScheduleGpuTask( base::BindOnce( @@ -656,16 +730,13 @@ base::Unretained(manager_.get()), overlay->second.id, candidate), std::vector<gpu::SyncToken>()); - - // TODO(vasilyt): This needs to be when we process compositor frame. - if (candidate.resource_id != overlay->second.resource_id) { - overlay->second.resource_id = candidate.resource_id; - auto result = LockResource(overlay->second); - gpu_thread_sequence_->ScheduleTask( - base::BindOnce(&Manager::UpdateOverlayBuffer, manager_.get(), - overlay->second.id, result.mailbox, - std::move(result.unlock_cb)), - {result.sync_token, overlay->second.create_sync_token}); + // If renderer embedded new surface (i.e video player size changed) we + // need to update buffer here. For all other cases it's updated in + // ProcessForFrameSinkId(). + if (overlay->second.surface_id != surface_id) { + overlay->second.surface_id = surface_id; + UpdateOverlayResource(sink_id, candidate.resource_id, + candidate.unclipped_uv_rect); } } else { overlay = @@ -728,6 +799,28 @@ return result; } +void OverlayProcessorWebView::UpdateOverlayResource( + viz::FrameSinkId frame_sink_id, + viz::ResourceId new_resource_id, + const gfx::RectF& uv_rect) { + DCHECK(resource_provider_); + auto overlay = overlays_.find(frame_sink_id); + DCHECK(overlay != overlays_.end()); + + DCHECK(resource_provider_->IsOverlayCandidate(new_resource_id)); + + if (new_resource_id != overlay->second.resource_id) { + overlay->second.resource_id = new_resource_id; + auto result = LockResource(overlay->second); + + gpu_thread_sequence_->ScheduleTask( + base::BindOnce(&Manager::UpdateOverlayBuffer, + base::Unretained(manager_.get()), overlay->second.id, + result.mailbox, uv_rect, std::move(result.unlock_cb)), + {result.sync_token, overlay->second.create_sync_token}); + } +} + void OverlayProcessorWebView::ReturnResource(viz::ResourceId resource_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); @@ -741,6 +834,50 @@ locked_resources_.erase(it); } +void OverlayProcessorWebView::ProcessForFrameSinkId( + const viz::FrameSinkId& frame_sink_id, + const viz::ResolvedFrameData* frame_data) { + auto it = overlays_.find(frame_sink_id); + DCHECK(it != overlays_.end()); + auto& overlay = it->second; + + auto& pass = frame_data->GetRootRenderPassData(); + if (!pass.draw_quads.empty()) { + DCHECK_EQ(pass.draw_quads.size(), 1u); + auto* surface = frame_sink_manager_->surface_manager()->GetSurfaceForId( + overlay.surface_id); + + // TODO(vasilyt): We should get this from surface aggregator after + // aggregator refactoring will be finished. + const auto& frame = surface->GetActiveFrame(); + auto* quad = viz::StreamVideoDrawQuad::MaterialCast( + frame.render_pass_list.back()->quad_list.front()); + DCHECK(quad); + + auto uv_rect = gfx::BoundingRect(quad->uv_top_left, quad->uv_bottom_right); + + UpdateOverlayResource(frame_sink_id, + pass.draw_quads.front().remapped_resources.ids[0], + uv_rect); + // TODO(vasilyt): Implement back pressure + surface->SendAckToClient(); + } +} + +viz::SurfaceId OverlayProcessorWebView::GetOverlaySurfaceId( + const viz::FrameSinkId& frame_sink_id) { + auto it = overlays_.find(frame_sink_id); + if (it != overlays_.end()) { + return it->second.surface_id; + } + return viz::SurfaceId(); +} + +bool OverlayProcessorWebView::IsFrameSinkOverlayed( + viz::FrameSinkId frame_sink_id) { + return overlays_.contains(frame_sink_id); +} + OverlayProcessorWebView::ScopedSurfaceControlAvailable:: ScopedSurfaceControlAvailable(OverlayProcessorWebView* processor, GetSurfaceControlFn surface_getter)
diff --git a/android_webview/browser/gfx/overlay_processor_webview.h b/android_webview/browser/gfx/overlay_processor_webview.h index e931cdf..809da17 100644 --- a/android_webview/browser/gfx/overlay_processor_webview.h +++ b/android_webview/browser/gfx/overlay_processor_webview.h
@@ -14,6 +14,7 @@ #include "components/viz/service/display/display_resource_provider_skia.h" #include "components/viz/service/display/overlay_processor_interface.h" #include "components/viz/service/display/overlay_processor_surface_control.h" +#include "components/viz/service/frame_sinks/frame_sink_observer.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/sync_token.h" #include "ui/gfx/android/android_surface_control_compat.h" @@ -22,8 +23,14 @@ class DisplayCompositorMemoryAndTaskControllerOnGpu; } +namespace viz { +class FrameSinkManagerImpl; +class ResolvedFrameData; +} // namespace viz + namespace android_webview { -class OverlayProcessorWebView : public viz::OverlayProcessorSurfaceControl { +class OverlayProcessorWebView : public viz::OverlayProcessorSurfaceControl, + public OverlaysInfoProvider { public: typedef ASurfaceControl* (*GetSurfaceControlFn)(); class ScopedSurfaceControlAvailable { @@ -37,12 +44,16 @@ }; OverlayProcessorWebView( - viz::DisplayCompositorMemoryAndTaskController* display_controller); + viz::DisplayCompositorMemoryAndTaskController* display_controller, + viz::FrameSinkManagerImpl* frame_sink_manager); ~OverlayProcessorWebView() override; + void ProcessForFrameSinkId(const viz::FrameSinkId& frame_sink_id, + const viz::ResolvedFrameData* frame_data); void SetOverlaysEnabledByHWUI(bool enabled); void RemoveOverlays(); absl::optional<gfx::SurfaceControl::Transaction> TakeSurfaceTransactionOnRT(); + viz::SurfaceId GetOverlaySurfaceId(const viz::FrameSinkId& frame_sink_id); // viz::OverlayProcessorSurfaceControl overrides: void TakeOverlayCandidates( @@ -56,6 +67,9 @@ primary_plane, viz::OverlayCandidateList* candidates) override; + // OverlaysInfoProvider implenentation: + bool IsFrameSinkOverlayed(viz::FrameSinkId frame_sink_id) override; + private: class Manager; @@ -86,6 +100,10 @@ gpu::SequenceId sequence_id, base::WaitableEvent* event); + void UpdateOverlayResource(viz::FrameSinkId frame_sink_id, + viz::ResourceId new_resource_id, + const gfx::RectF& uv_rect); + using OverlayResourceLock = viz::DisplayResourceProviderSkia::ScopedExclusiveReadLockSharedImage; @@ -104,6 +122,7 @@ std::unique_ptr<gpu::SingleTaskSequence> gpu_thread_sequence_; viz::DisplayResourceProvider* resource_provider_ = nullptr; + viz::FrameSinkManagerImpl* const frame_sink_manager_; scoped_refptr<Manager> manager_;
diff --git a/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc b/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc index 82b33d4b..768f9375 100644 --- a/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc +++ b/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc
@@ -181,7 +181,7 @@ security_interstitial_tab_helper->IsDisplayingInterstitial()) { // In this case we are about to leave an interstitial due to the user // clicking proceed on it, we shouldn't call OnSafeBrowsingHit again. - resource.callback_thread->PostTask( + resource.callback_sequence->PostTask( FROM_HERE, base::BindOnce(resource.callback, true /* proceed */, false /* showed_interstitial */)); return;
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 23c6639..31ebf59f 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1285,8 +1285,6 @@ "system/privacy_screen/privacy_screen_toast_controller.h", "system/privacy_screen/privacy_screen_toast_view.cc", "system/privacy_screen/privacy_screen_toast_view.h", - "system/quick_pair/fast_pair_notification_controller.cc", - "system/quick_pair/fast_pair_notification_controller.h", "system/rotation/rotation_lock_feature_pod_controller.cc", "system/rotation/rotation_lock_feature_pod_controller.h", "system/screen_layout_observer.cc", @@ -1843,6 +1841,7 @@ "//ash/constants", "//ash/keyboard/ui", "//ash/login/resources:resources_grit", + "//ash/quick_pair", "//ash/services/recording", "//ash/services/recording/public/mojom", "//ash/system/machine_learning:user_settings_event_proto", @@ -2488,6 +2487,7 @@ "//ash/public/cpp/external_arc:test_support", "//ash/public/cpp/external_arc:unit_tests", "//ash/public/cpp/holding_space:test_support", + "//ash/quick_pair:unit_tests", "//ash/resources/vector_icons", "//ash/services/recording:test_support", "//ash/shortcut_viewer:unit_tests",
diff --git a/ash/quick_pair/BUILD.gn b/ash/quick_pair/BUILD.gn new file mode 100644 index 0000000..7eed7ab --- /dev/null +++ b/ash/quick_pair/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") + +source_set("quick_pair") { + deps = [ + "//ash/quick_pair/common", + "//ash/quick_pair/feature_status_tracker", + "//ash/quick_pair/keyed_service", + "//ash/quick_pair/scanning", + "//ash/quick_pair/ui", + ] +} + +source_set("unit_tests") { + testonly = true + + deps = [ + "//ash/quick_pair/common:unit_tests", + "//ash/quick_pair/feature_status_tracker:unit_tests", + "//ash/quick_pair/keyed_service:unit_tests", + "//ash/quick_pair/scanning:unit_tests", + ] +}
diff --git a/chromeos/components/quick_pair/DEPS b/ash/quick_pair/DEPS similarity index 62% rename from chromeos/components/quick_pair/DEPS rename to ash/quick_pair/DEPS index 66569f7c..9a26362 100644 --- a/chromeos/components/quick_pair/DEPS +++ b/ash/quick_pair/DEPS
@@ -1,4 +1,3 @@ include_rules = [ - "+device/bluetooth", "+google_apis", ]
diff --git a/chromeos/components/quick_pair/DIR_METADATA b/ash/quick_pair/DIR_METADATA similarity index 100% rename from chromeos/components/quick_pair/DIR_METADATA rename to ash/quick_pair/DIR_METADATA
diff --git a/chromeos/components/quick_pair/OWNERS b/ash/quick_pair/OWNERS similarity index 100% rename from chromeos/components/quick_pair/OWNERS rename to ash/quick_pair/OWNERS
diff --git a/chromeos/components/quick_pair/common/BUILD.gn b/ash/quick_pair/common/BUILD.gn similarity index 68% rename from chromeos/components/quick_pair/common/BUILD.gn rename to ash/quick_pair/common/BUILD.gn index f094bb9..fc82dea 100644 --- a/chromeos/components/quick_pair/common/BUILD.gn +++ b/ash/quick_pair/common/BUILD.gn
@@ -2,9 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") +import("//build/config/chromeos/ui_mode.gni") -static_library("common") { +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") + +component("common") { + output_name = "quick_pair_common" + + defines = [ "IS_QUICK_PAIR_COMMON_IMPL" ] + sources = [ "device.cc", "device.h", @@ -18,9 +25,7 @@ "quick_pair_features.h", ] - public_deps = [ "//base" ] - - deps = [] + deps = [ "//base" ] } source_set("unit_tests") {
diff --git a/chromeos/components/quick_pair/common/device.cc b/ash/quick_pair/common/device.cc similarity index 79% rename from chromeos/components/quick_pair/common/device.cc rename to ash/quick_pair/common/device.cc index 04aca6bc..90fa4e6 100644 --- a/chromeos/components/quick_pair/common/device.cc +++ b/ash/quick_pair/common/device.cc
@@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/device.h" +#include "ash/quick_pair/common/device.h" + #include <ostream> -#include "chromeos/components/quick_pair/common/protocol.h" +#include "ash/quick_pair/common/protocol.h" -namespace chromeos { +namespace ash { namespace quick_pair { Device::Device(std::string metadata_id, std::string address, Protocol protocol) @@ -23,4 +24,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/common/device.h b/ash/quick_pair/common/device.h similarity index 82% rename from chromeos/components/quick_pair/common/device.h rename to ash/quick_pair/common/device.h index 4fbc91bb..fe04619 100644 --- a/chromeos/components/quick_pair/common/device.h +++ b/ash/quick_pair/common/device.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_DEVICE_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_DEVICE_H_ +#ifndef ASH_QUICK_PAIR_COMMON_DEVICE_H_ +#define ASH_QUICK_PAIR_COMMON_DEVICE_H_ -#include "chromeos/components/quick_pair/common/protocol.h" +#include "ash/quick_pair/common/protocol.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Thin class which is used by the higher level components of the Quick Pair @@ -40,6 +40,6 @@ std::ostream& operator<<(std::ostream& stream, Device device); } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_DEVICE_H_ +#endif // ASH_QUICK_PAIR_COMMON_DEVICE_H_
diff --git a/chromeos/components/quick_pair/common/log_buffer.cc b/ash/quick_pair/common/log_buffer.cc similarity index 93% rename from chromeos/components/quick_pair/common/log_buffer.cc rename to ash/quick_pair/common/log_buffer.cc index b82be6a..fbe7dd4 100644 --- a/chromeos/components/quick_pair/common/log_buffer.cc +++ b/ash/quick_pair/common/log_buffer.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/log_buffer.h" +#include "ash/quick_pair/common/log_buffer.h" #include "base/lazy_instance.h" -namespace chromeos { +namespace ash { namespace quick_pair { namespace { @@ -62,4 +62,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/common/log_buffer.h b/ash/quick_pair/common/log_buffer.h similarity index 89% rename from chromeos/components/quick_pair/common/log_buffer.h rename to ash/quick_pair/common/log_buffer.h index 6700076..bffa14c 100644 --- a/chromeos/components/quick_pair/common/log_buffer.h +++ b/ash/quick_pair/common/log_buffer.h
@@ -2,24 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOG_BUFFER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOG_BUFFER_H_ +#ifndef ASH_QUICK_PAIR_COMMON_LOG_BUFFER_H_ +#define ASH_QUICK_PAIR_COMMON_LOG_BUFFER_H_ #include <stddef.h> #include <list> +#include "base/component_export.h" #include "base/logging.h" #include "base/observer_list.h" #include "base/time/time.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Contains logs specific to the Quick Pair implementations (e.g. Fast Pair). // This buffer has a maximum size and will discard entries in FIFO order. Call // LogBuffer::GetInstance() to get the global LogBuffer instance. -class LogBuffer { +class COMPONENT_EXPORT(QUICK_PAIR_COMMON) LogBuffer { public: // Represents a single log entry in the log buffer. struct LogMessage { @@ -79,6 +80,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOG_BUFFER_H_ +#endif // ASH_QUICK_PAIR_COMMON_LOG_BUFFER_H_
diff --git a/chromeos/components/quick_pair/common/logging.cc b/ash/quick_pair/common/logging.cc similarity index 89% rename from chromeos/components/quick_pair/common/logging.cc rename to ash/quick_pair/common/logging.cc index 21c0527e..741bf584 100644 --- a/chromeos/components/quick_pair/common/logging.cc +++ b/ash/quick_pair/common/logging.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/logging.h" +#include "ash/quick_pair/common/logging.h" +#include "ash/quick_pair/common/log_buffer.h" #include "base/time/time.h" -#include "chromeos/components/quick_pair/common/log_buffer.h" -namespace chromeos { +namespace ash { namespace quick_pair { namespace { @@ -51,4 +51,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/common/logging.h b/ash/quick_pair/common/logging.h similarity index 79% rename from chromeos/components/quick_pair/common/logging.h rename to ash/quick_pair/common/logging.h index 5627650..cb1271ec 100644 --- a/chromeos/components/quick_pair/common/logging.h +++ b/ash/quick_pair/common/logging.h
@@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOGGING_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOGGING_H_ +#ifndef ASH_QUICK_PAIR_COMMON_LOGGING_H_ +#define ASH_QUICK_PAIR_COMMON_LOGGING_H_ #include <sstream> +#include "base/component_export.h" #include "base/logging.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Use the QP_LOG() macro for all logging related to Quick Pair implementations @@ -21,9 +22,9 @@ // Examples: // QP_LOG(INFO) << "Waiting for " << x << " pending requests."; // QP_LOG(ERROR) << "Request failed: " << error_string; -#define QP_LOG(severity) \ - chromeos::quick_pair::ScopedLogMessage(__FILE__, __LINE__, \ - logging::LOG_##severity) \ +#define QP_LOG(severity) \ + ash::quick_pair::ScopedLogMessage(__FILE__, __LINE__, \ + logging::LOG_##severity) \ .stream() // Disables all logging while in scope. Intended to be called only from test @@ -39,7 +40,7 @@ // be logged with the standard logging system and also added to Proximity Auth // specific log buffer. You should use the QP_LOG() macro instead of this class // directly. -class ScopedLogMessage { +class COMPONENT_EXPORT(QUICK_PAIR_COMMON) ScopedLogMessage { public: ScopedLogMessage(const char* file, int line, logging::LogSeverity severity); ScopedLogMessage(const ScopedLogMessage&) = delete; @@ -56,6 +57,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_LOGGING_H_ +#endif // ASH_QUICK_PAIR_COMMON_LOGGING_H_
diff --git a/chromeos/components/quick_pair/common/logging_unittest.cc b/ash/quick_pair/common/logging_unittest.cc similarity index 95% rename from chromeos/components/quick_pair/common/logging_unittest.cc rename to ash/quick_pair/common/logging_unittest.cc index 7802bc7e..5410e5fa 100644 --- a/chromeos/components/quick_pair/common/logging_unittest.cc +++ b/ash/quick_pair/common/logging_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/logging.h" +#include "ash/quick_pair/common/logging.h" #include <stddef.h> +#include "ash/quick_pair/common/log_buffer.h" #include "base/lazy_instance.h" #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" -#include "chromeos/components/quick_pair/common/log_buffer.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { namespace quick_pair { namespace { @@ -125,4 +125,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/common/protocol.cc b/ash/quick_pair/common/protocol.cc similarity index 79% rename from chromeos/components/quick_pair/common/protocol.cc rename to ash/quick_pair/common/protocol.cc index abd5228..6c62167 100644 --- a/chromeos/components/quick_pair/common/protocol.cc +++ b/ash/quick_pair/common/protocol.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/protocol.h" +#include "ash/quick_pair/common/protocol.h" -namespace chromeos { +namespace ash { namespace quick_pair { std::ostream& operator<<(std::ostream& stream, Protocol protocol) { @@ -18,4 +18,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/common/protocol.h b/ash/quick_pair/common/protocol.h similarity index 62% rename from chromeos/components/quick_pair/common/protocol.h rename to ash/quick_pair/common/protocol.h index 3d16118e..3181e04 100644 --- a/chromeos/components/quick_pair/common/protocol.h +++ b/ash/quick_pair/common/protocol.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_PROTOCOL_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_PROTOCOL_H_ +#ifndef ASH_QUICK_PAIR_COMMON_PROTOCOL_H_ +#define ASH_QUICK_PAIR_COMMON_PROTOCOL_H_ #include <ostream> -namespace chromeos { +namespace ash { namespace quick_pair { enum class Protocol { @@ -18,6 +18,6 @@ std::ostream& operator<<(std::ostream& stream, Protocol protocol); } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_PROTOCOL_H_ +#endif // ASH_QUICK_PAIR_COMMON_PROTOCOL_H_
diff --git a/chromeos/components/quick_pair/common/quick_pair_features.cc b/ash/quick_pair/common/quick_pair_features.cc similarity index 73% rename from chromeos/components/quick_pair/common/quick_pair_features.cc rename to ash/quick_pair/common/quick_pair_features.cc index ac9a0b6..a1a1a97 100644 --- a/chromeos/components/quick_pair/common/quick_pair_features.cc +++ b/ash/quick_pair/common/quick_pair_features.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/common/quick_pair_features.h" +#include "ash/quick_pair/common/quick_pair_features.h" -namespace chromeos { +namespace ash { namespace features { // Enables Fast Pair functionality. const base::Feature kFastPair{"FastPair", base::FEATURE_DISABLED_BY_DEFAULT}; } // namespace features -} // namespace chromeos +} // namespace ash
diff --git a/ash/quick_pair/common/quick_pair_features.h b/ash/quick_pair/common/quick_pair_features.h new file mode 100644 index 0000000..0427f76a --- /dev/null +++ b/ash/quick_pair/common/quick_pair_features.h
@@ -0,0 +1,19 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_ +#define ASH_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_ + +#include "base/component_export.h" +#include "base/feature_list.h" + +namespace ash { +namespace features { + +COMPONENT_EXPORT(QUICK_PAIR_COMMON) extern const base::Feature kFastPair; + +} // namespace features +} // namespace ash + +#endif // ASH_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/BUILD.gn b/ash/quick_pair/feature_status_tracker/BUILD.gn similarity index 89% rename from chromeos/components/quick_pair/feature_status_tracker/BUILD.gn rename to ash/quick_pair/feature_status_tracker/BUILD.gn index ec0a2a6e..0cb38256 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/BUILD.gn +++ b/ash/quick_pair/feature_status_tracker/BUILD.gn
@@ -2,7 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") static_library("feature_status_tracker") { sources = [ @@ -20,8 +23,8 @@ ] deps = [ + "//ash/quick_pair/common", "//base", - "//chromeos/components/quick_pair/common", "//device/bluetooth", "//google_apis", ] @@ -63,8 +66,8 @@ deps = [ ":feature_status_tracker", ":test_support", + "//ash/quick_pair/common", "//base/test:test_support", - "//chromeos/components/quick_pair/common", "//device/bluetooth", "//device/bluetooth:mocks", "//testing/gtest",
diff --git a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.cc b/ash/quick_pair/feature_status_tracker/base_enabled_provider.cc similarity index 84% rename from chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.cc rename to ash/quick_pair/feature_status_tracker/base_enabled_provider.cc index 70e3ac2..78bba7019 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.cc +++ b/ash/quick_pair/feature_status_tracker/base_enabled_provider.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" #include "base/callback.h" -namespace chromeos { +namespace ash { namespace quick_pair { BaseEnabledProvider::BaseEnabledProvider() = default; @@ -33,4 +33,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h b/ash/quick_pair/feature_status_tracker/base_enabled_provider.h similarity index 79% rename from chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h rename to ash/quick_pair/feature_status_tracker/base_enabled_provider.h index f352cfda..1b482f9 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h +++ b/ash/quick_pair/feature_status_tracker/base_enabled_provider.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_ #include "base/callback.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Common Base class to expose whether or not a feature is enabled. @@ -38,6 +38,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BASE_ENABLED_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc b/ash/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc similarity index 91% rename from chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc rename to ash/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc index f163003..81e5d65 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc +++ b/ash/quick_pair/feature_status_tracker/base_enabled_provider_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" #include <memory> @@ -13,14 +13,14 @@ namespace { -class TestEnabledProvider : public chromeos::quick_pair::BaseEnabledProvider { +class TestEnabledProvider : public ash::quick_pair::BaseEnabledProvider { public: using BaseEnabledProvider::SetEnabledAndInvokeCallback; }; } // namespace -namespace chromeos { +namespace ash { namespace quick_pair { class BaseEnabledProviderTest : public testing::Test { @@ -79,4 +79,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc similarity index 88% rename from chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc rename to ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc index 53ab4b4..5c67ba4 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc +++ b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" #include "base/bind.h" #include "base/memory/scoped_refptr.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" -namespace chromeos { +namespace ash { namespace quick_pair { BluetoothEnabledProvider::BluetoothEnabledProvider() { @@ -35,4 +35,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h similarity index 74% rename from chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h rename to ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h index 2ee21e07..57f32b8 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h +++ b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_ +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" #include "device/bluetooth/bluetooth_adapter.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Observes BluetoothAdapter::IsPowered state and exposes a callback to be @@ -37,6 +37,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_BLUETOOTH_ENABLED_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc similarity index 90% rename from chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc rename to ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc index 1eea651..6213ea9 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc +++ b/ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider_unittest.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" #include <memory> +#include "ash/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h" #include "base/callback.h" #include "base/memory/scoped_refptr.h" #include "base/test/mock_callback.h" -#include "chromeos/components/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { namespace quick_pair { class BluetoothEnabledProviderTest : public testing::Test { @@ -73,4 +73,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h b/ash/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h similarity index 65% rename from chromeos/components/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h rename to ash/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h index 0ab2953..b71527d 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h +++ b/ash/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_ #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { namespace quick_pair { class FakeBluetoothAdapter @@ -23,6 +23,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_BLUETOOTH_ADAPTER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc b/ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc similarity index 86% rename from chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc rename to ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc index cf695bc..5ca20a44 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc +++ b/ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.h" +#include "ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.h" #include "base/observer_list.h" -namespace chromeos { +namespace ash { namespace quick_pair { FakeFeatureStatusTracker::FakeFeatureStatusTracker() = default; @@ -33,4 +33,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.h b/ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.h similarity index 61% rename from chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.h rename to ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.h index 652e1f9c0..030919a 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fake_feature_status_tracker.h +++ b/ash/quick_pair/feature_status_tracker/fake_feature_status_tracker.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_ +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" #include "base/observer_list.h" -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" -namespace chromeos { +namespace ash { namespace quick_pair { class FakeFeatureStatusTracker : public FeatureStatusTracker { @@ -28,6 +28,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAKE_FEATURE_STATUS_TRACKER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc similarity index 79% rename from chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc rename to ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc index 4802b38..5e3baa82 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc +++ b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" +#include "ash/quick_pair/common/quick_pair_features.h" +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" #include "base/bind.h" #include "base/feature_list.h" -#include "chromeos/components/quick_pair/common/quick_pair_features.h" -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" -namespace chromeos { +namespace ash { namespace quick_pair { FastPairEnabledProvider::FastPairEnabledProvider( @@ -20,7 +20,7 @@ : bluetooth_enabled_provider_(std::move(bluetooth_enabled_provider)), google_api_key_availability_provider_( std::move(google_api_key_availability_provider)) { - // If the flag isn't enabled or if the API keys aren't available, + // If the flag isn't enabled or if the API keys aren't available, // Fast Pair will never be enabled so don't hook up any callbacks. if (base::FeatureList::IsEnabled(features::kFastPair) && google_api_key_availability_provider_->is_enabled()) { @@ -45,4 +45,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h similarity index 62% rename from chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h rename to ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h index 1441b32..14d632a 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h +++ b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_ +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Exposes an |is_enabled()| method and callback to query and observe when the @@ -34,6 +34,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_FAST_PAIR_ENABLED_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc similarity index 84% rename from chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc rename to ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc index 549634f2..c39344f 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc +++ b/ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider_unittest.cc
@@ -2,25 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" #include <memory> +#include "ash/quick_pair/common/quick_pair_features.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h" +#include "ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h" #include "base/callback.h" #include "base/memory/ptr_util.h" #include "base/memory/scoped_refptr.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/components/quick_pair/common/quick_pair_features.h" -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/fake_bluetooth_adapter.h" -#include "chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "testing/gtest/include/gtest/gtest-param-test.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { namespace quick_pair { class FastPairEnabledProviderTest : public testing::Test { @@ -95,4 +95,4 @@ testing::Bool())); } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc b/ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc similarity index 78% rename from chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc rename to ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc index 8b3af4a6..bc11e1c 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc +++ b/ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" +#include "ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" #include "google_apis/google_api_keys.h" -namespace chromeos { +namespace ash { namespace quick_pair { GoogleApiKeyAvailabilityProvider::GoogleApiKeyAvailabilityProvider() { @@ -17,4 +17,4 @@ GoogleApiKeyAvailabilityProvider::~GoogleApiKeyAvailabilityProvider() = default; } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h b/ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h new file mode 100644 index 0000000..bcb8293 --- /dev/null +++ b/ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h
@@ -0,0 +1,24 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ + +#include "ash/quick_pair/feature_status_tracker/base_enabled_provider.h" + +namespace ash { +namespace quick_pair { + +// Exposes whether Google API keys are available on the current build. Since +// this cannot be changed at runtime, there is no need to register an observer. +class GoogleApiKeyAvailabilityProvider : public BaseEnabledProvider { + public: + GoogleApiKeyAvailabilityProvider(); + ~GoogleApiKeyAvailabilityProvider() override; +}; + +} // namespace quick_pair +} // namespace ash + +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc b/ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc similarity index 71% rename from chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc rename to ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc index 54977aa..90ab66b 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc +++ b/ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h" -namespace chromeos { +namespace ash { namespace quick_pair { MockBluetoothEnabledProvider::MockBluetoothEnabledProvider() = default; @@ -12,4 +12,4 @@ MockBluetoothEnabledProvider::~MockBluetoothEnabledProvider() = default; } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h b/ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h similarity index 65% rename from chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h rename to ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h index 371d1d96f..79da432b 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h +++ b/ash/quick_pair/feature_status_tracker/mock_bluetooth_enabled_provider.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_ -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" #include "base/callback.h" #include "testing/gmock/include/gmock/gmock.h" -namespace chromeos { +namespace ash { namespace quick_pair { class MockBluetoothEnabledProvider : public BluetoothEnabledProvider { @@ -29,6 +29,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_BLUETOOTH_ENABLED_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc b/ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc similarity index 72% rename from chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc rename to ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc index 5c0705a..2815bce 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc +++ b/ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h" +#include "ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h" -namespace chromeos { +namespace ash { namespace quick_pair { MockGoogleApiKeyAvailabilityProvider::MockGoogleApiKeyAvailabilityProvider() = @@ -14,4 +14,4 @@ default; } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h b/ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h similarity index 60% rename from chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h rename to ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h index d95dfd68..2e0de60 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h +++ b/ash/quick_pair/feature_status_tracker/mock_google_api_key_availability_provider.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ -#include "chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" +#include "ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" #include "testing/gmock/include/gmock/gmock.h" -namespace chromeos { +namespace ash { namespace quick_pair { class MockGoogleApiKeyAvailabilityProvider @@ -25,6 +25,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_
diff --git a/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc b/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc new file mode 100644 index 0000000..56f8d42c --- /dev/null +++ b/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc
@@ -0,0 +1,15 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h" + +namespace ash { +namespace quick_pair { + +MockFeatureStatusTracker::MockFeatureStatusTracker() = default; + +MockFeatureStatusTracker::~MockFeatureStatusTracker() = default; + +} // namespace quick_pair +} // namespace ash
diff --git a/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h b/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h new file mode 100644 index 0000000..0f7b5ac1a --- /dev/null +++ b/ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h
@@ -0,0 +1,34 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ + +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ash { +namespace quick_pair { + +class MockFeatureStatusTracker : public FeatureStatusTracker { + public: + MockFeatureStatusTracker(); + MockFeatureStatusTracker(const MockFeatureStatusTracker&) = delete; + MockFeatureStatusTracker& operator=(const MockFeatureStatusTracker&) = delete; + ~MockFeatureStatusTracker() override; + + MOCK_METHOD(void, AddObserver, (FeatureStatusTracker::Observer*), (override)); + + MOCK_METHOD(void, + RemoveObserver, + (FeatureStatusTracker::Observer*), + (override)); + + MOCK_METHOD(bool, IsFastPairEnabled, (), (override)); +}; + +} // namespace quick_pair +} // namespace ash + +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h similarity index 64% rename from chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h rename to ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h index a670d11..34e90b7 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h +++ b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ +#include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" -#include "chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Exposes APIs to query and track the status of the various @@ -31,6 +31,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_
diff --git a/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc new file mode 100644 index 0000000..027f650 --- /dev/null +++ b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc
@@ -0,0 +1,47 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h" + +#include <memory> + +#include "ash/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" +#include "base/bind.h" + +namespace ash { +namespace quick_pair { + +FeatureStatusTrackerImpl::FeatureStatusTrackerImpl() + : fast_pair_enabled_provider_(std::make_unique<FastPairEnabledProvider>( + std::make_unique<BluetoothEnabledProvider>(), + std::make_unique<GoogleApiKeyAvailabilityProvider>())) { + fast_pair_enabled_provider_->SetCallback( + base::BindRepeating(&FeatureStatusTrackerImpl::OnFastPairEnabledChanged, + weak_factory_.GetWeakPtr())); +} + +FeatureStatusTrackerImpl::~FeatureStatusTrackerImpl() = default; + +void FeatureStatusTrackerImpl::AddObserver(Observer* observer) { + observers_.AddObserver(observer); +} + +void FeatureStatusTrackerImpl::RemoveObserver(Observer* observer) { + observers_.RemoveObserver(observer); +} + +bool FeatureStatusTrackerImpl::IsFastPairEnabled() { + return fast_pair_enabled_provider_->is_enabled(); +} + +void FeatureStatusTrackerImpl::OnFastPairEnabledChanged(bool is_enabled) { + for (auto& observer : observers_) { + observer.OnFastPairEnabledChanged(is_enabled); + } +} + +} // namespace quick_pair +} // namespace ash
diff --git a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h similarity index 61% rename from chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h rename to ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h index 01c57c06..5f6231a7 100644 --- a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h +++ b/ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_ +#ifndef ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_ +#define ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_ #include <memory> +#include "ash/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" -#include "chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" -namespace chromeos { +namespace ash { namespace quick_pair { class FeatureStatusTrackerImpl : public FeatureStatusTracker { @@ -34,6 +34,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_ +#endif // ASH_QUICK_PAIR_FEATURE_STATUS_TRACKER_QUICK_PAIR_FEATURE_STATUS_TRACKER_IMPL_H_
diff --git a/chromeos/components/quick_pair/keyed_service/BUILD.gn b/ash/quick_pair/keyed_service/BUILD.gn similarity index 68% rename from chromeos/components/quick_pair/keyed_service/BUILD.gn rename to ash/quick_pair/keyed_service/BUILD.gn index 3dbc13c..df70f4a 100644 --- a/chromeos/components/quick_pair/keyed_service/BUILD.gn +++ b/ash/quick_pair/keyed_service/BUILD.gn
@@ -2,7 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") static_library("keyed_service") { sources = [ @@ -13,9 +16,9 @@ ] deps = [ + "//ash/quick_pair/common", + "//ash/quick_pair/feature_status_tracker", "//base", - "//chromeos/components/quick_pair/common", - "//chromeos/components/quick_pair/feature_status_tracker", "//components/keyed_service/core", ] } @@ -27,8 +30,8 @@ deps = [ ":keyed_service", + "//ash/quick_pair/feature_status_tracker:test_support", "//base/test:test_support", - "//chromeos/components/quick_pair/feature_status_tracker:test_support", "//testing/gtest", ] }
diff --git a/chromeos/components/quick_pair/keyed_service/DEPS b/ash/quick_pair/keyed_service/DEPS similarity index 100% rename from chromeos/components/quick_pair/keyed_service/DEPS rename to ash/quick_pair/keyed_service/DEPS
diff --git a/chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.cc b/ash/quick_pair/keyed_service/quick_pair_keyed_service.cc similarity index 70% rename from chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.cc rename to ash/quick_pair/keyed_service/quick_pair_keyed_service.cc index 2e63499..49ce426 100644 --- a/chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.cc +++ b/ash/quick_pair/keyed_service/quick_pair_keyed_service.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.h" +#include "ash/quick_pair/keyed_service/quick_pair_keyed_service.h" #include <memory> -#include "chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h" +#include "ash/quick_pair/keyed_service/quick_pair_mediator.h" -namespace chromeos { +namespace ash { namespace quick_pair { QuickPairKeyedService::QuickPairKeyedService(std::unique_ptr<Mediator> mediator) @@ -21,4 +21,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.h b/ash/quick_pair/keyed_service/quick_pair_keyed_service.h similarity index 69% rename from chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.h rename to ash/quick_pair/keyed_service/quick_pair_keyed_service.h index 34aed13..f74593a 100644 --- a/chromeos/components/quick_pair/keyed_service/quick_pair_keyed_service.h +++ b/ash/quick_pair/keyed_service/quick_pair_keyed_service.h
@@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_ +#ifndef ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_ +#define ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_ #include <memory> -#include "chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h" + +#include "ash/quick_pair/keyed_service/quick_pair_mediator.h" #include "components/keyed_service/core/keyed_service.h" -namespace chromeos { +namespace ash { namespace quick_pair { // This class is intentionally 'thin' (i.e. holds references to other classes) @@ -28,6 +29,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_ +#endif // ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_KEYED_SERVICE_H_
diff --git a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator.cc b/ash/quick_pair/keyed_service/quick_pair_mediator.cc similarity index 72% rename from chromeos/components/quick_pair/keyed_service/quick_pair_mediator.cc rename to ash/quick_pair/keyed_service/quick_pair_mediator.cc index a7edc4a..2faf79f9 100644 --- a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h" +#include "ash/quick_pair/keyed_service/quick_pair_mediator.h" #include <memory> -#include "chromeos/components/quick_pair/common/logging.h" -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" +#include "ash/quick_pair/common/logging.h" +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" -namespace chromeos { +namespace ash { namespace quick_pair { Mediator::Mediator(std::unique_ptr<FeatureStatusTracker> feature_status_tracker) @@ -30,4 +30,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h b/ash/quick_pair/keyed_service/quick_pair_mediator.h similarity index 72% rename from chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h rename to ash/quick_pair/keyed_service/quick_pair_mediator.h index 74aaa4bd..b9ce003 100644 --- a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_ +#ifndef ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_ +#define ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_ #include <memory> +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" #include "base/scoped_observation.h" -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" -namespace chromeos { +namespace ash { namespace quick_pair { // Implements the Mediator design pattern for the components in the Quick Pair @@ -35,6 +35,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_ +#endif // ASH_QUICK_PAIR_KEYED_SERVICE_QUICK_PAIR_MEDIATOR_H_
diff --git a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator_unittest.cc b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc similarity index 77% rename from chromeos/components/quick_pair/keyed_service/quick_pair_mediator_unittest.cc rename to ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc index 7f0b067..047e695f 100644 --- a/chromeos/components/quick_pair/keyed_service/quick_pair_mediator_unittest.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/keyed_service/quick_pair_mediator.h" +#include "ash/quick_pair/keyed_service/quick_pair_mediator.h" #include <memory> -#include "chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h" -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" +#include "ash/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h" +#include "ash/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { namespace quick_pair { class MediatorTest : public testing::Test { @@ -42,4 +42,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/proto/BUILD.gn b/ash/quick_pair/proto/BUILD.gn similarity index 66% rename from chromeos/components/quick_pair/proto/BUILD.gn rename to ash/quick_pair/proto/BUILD.gn index b601efbf..d729619c 100644 --- a/chromeos/components/quick_pair/proto/BUILD.gn +++ b/ash/quick_pair/proto/BUILD.gn
@@ -2,8 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromeos/ui_mode.gni") import("//third_party/grpc/grpc_library.gni") +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") + grpc_library("fastpair_proto") { sources = [ "fastpair.proto" ] }
diff --git a/chromeos/components/quick_pair/proto/fastpair.proto b/ash/quick_pair/proto/fastpair.proto similarity index 100% rename from chromeos/components/quick_pair/proto/fastpair.proto rename to ash/quick_pair/proto/fastpair.proto
diff --git a/ash/quick_pair/scanning/BUILD.gn b/ash/quick_pair/scanning/BUILD.gn new file mode 100644 index 0000000..c9dc424 --- /dev/null +++ b/ash/quick_pair/scanning/BUILD.gn
@@ -0,0 +1,39 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") + +source_set("scanning") { + sources = [ + "fast_pair/fast_pair_scanner.h", + "fast_pair/fast_pair_scanner_impl.cc", + "fast_pair/fast_pair_scanner_impl.h", + "scanner_broker.h", + "scanner_broker_impl.cc", + "scanner_broker_impl.h", + ] + + deps = [ + "//ash/quick_pair/common", + "//base", + "//device/bluetooth", + ] +} + +source_set("unit_tests") { + testonly = true + + sources = [ "fast_pair/fast_pair_scanner_unittest.cc" ] + + deps = [ + ":scanning", + "//base/test:test_support", + "//device/bluetooth", + "//device/bluetooth:mocks", + "//testing/gtest", + ] +}
diff --git a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner.h b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner.h similarity index 75% rename from chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner.h rename to ash/quick_pair/scanning/fast_pair/fast_pair_scanner.h index 037fdbf..9c6d45f1 100644 --- a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner.h +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_ +#ifndef ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_ +#define ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_ #include "base/observer_list.h" #include "base/observer_list_types.h" #include "device/bluetooth/bluetooth_device.h" -namespace chromeos { +namespace ash { namespace quick_pair { // This registers a BluetoothLowEnergyScanner with the Advertisement Monitoring @@ -29,6 +29,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_ +#endif // ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_H_
diff --git a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc similarity index 91% rename from chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc rename to ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc index c85eade..3c0e135b 100644 --- a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h" +#include "ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h" #include "device/bluetooth/bluetooth_adapter_factory.h" @@ -10,7 +10,7 @@ using device::BluetoothAdapterFactory; using device::BluetoothDevice; -namespace chromeos { +namespace ash { namespace quick_pair { FastPairScannerImpl::FastPairScannerImpl() { @@ -47,4 +47,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h similarity index 82% rename from chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h rename to ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h index a8758fa..ae0888d8 100644 --- a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_ +#ifndef ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_ +#define ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_ +#include "ash/quick_pair/scanning/fast_pair/fast_pair_scanner.h" #include "base/observer_list.h" #include "base/observer_list_types.h" #include "base/scoped_observation.h" -#include "chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" -namespace chromeos { +namespace ash { namespace quick_pair { // This registers a BluetoothLowEnergyScanner with the Advertisement Monitoring @@ -50,6 +50,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_ +#endif // ASH_QUICK_PAIR_SCANNING_FAST_PAIR_FAST_PAIR_SCANNER_IMPL_H_
diff --git a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc similarity index 94% rename from chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc rename to ash/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc index 17c49c8..9cbc566e 100644 --- a/chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc +++ b/ash/quick_pair/scanning/fast_pair/fast_pair_scanner_unittest.cc
@@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner.h" -#include "chromeos/components/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h" +#include "ash/quick_pair/scanning/fast_pair/fast_pair_scanner_impl.h" #include <memory> @@ -49,7 +48,7 @@ } // namespace -namespace chromeos { +namespace ash { namespace quick_pair { class FastPairScannerObserver : public FastPairScanner::Observer { @@ -123,4 +122,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/scanning/scanner_broker.h b/ash/quick_pair/scanning/scanner_broker.h similarity index 69% rename from chromeos/components/quick_pair/scanning/scanner_broker.h rename to ash/quick_pair/scanning/scanner_broker.h index 1e81a6da..063f817 100644 --- a/chromeos/components/quick_pair/scanning/scanner_broker.h +++ b/ash/quick_pair/scanning/scanner_broker.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_ +#ifndef ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_ +#define ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_ +#include "ash/quick_pair/common/device.h" +#include "ash/quick_pair/common/logging.h" +#include "ash/quick_pair/common/protocol.h" #include "base/observer_list_types.h" -#include "chromeos/components/quick_pair/common/device.h" -#include "chromeos/components/quick_pair/common/logging.h" -#include "chromeos/components/quick_pair/common/protocol.h" -namespace chromeos { +namespace ash { namespace quick_pair { // The ScannerBroker is the entry point for the Scanning component in the Quick @@ -32,6 +32,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_ +#endif // ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_H_
diff --git a/chromeos/components/quick_pair/scanning/scanner_broker_impl.cc b/ash/quick_pair/scanning/scanner_broker_impl.cc similarity index 81% rename from chromeos/components/quick_pair/scanning/scanner_broker_impl.cc rename to ash/quick_pair/scanning/scanner_broker_impl.cc index 9d2f378..833feec 100644 --- a/chromeos/components/quick_pair/scanning/scanner_broker_impl.cc +++ b/ash/quick_pair/scanning/scanner_broker_impl.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/quick_pair/scanning/scanner_broker_impl.h" +#include "ash/quick_pair/scanning/scanner_broker_impl.h" -#include "chromeos/components/quick_pair/common/device.h" -#include "chromeos/components/quick_pair/common/logging.h" -#include "chromeos/components/quick_pair/common/protocol.h" +#include "ash/quick_pair/common/device.h" +#include "ash/quick_pair/common/logging.h" +#include "ash/quick_pair/common/protocol.h" -namespace chromeos { +namespace ash { namespace quick_pair { ScannerBrokerImpl::ScannerBrokerImpl() = default; @@ -60,4 +60,4 @@ } } // namespace quick_pair -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/components/quick_pair/scanning/scanner_broker_impl.h b/ash/quick_pair/scanning/scanner_broker_impl.h similarity index 69% rename from chromeos/components/quick_pair/scanning/scanner_broker_impl.h rename to ash/quick_pair/scanning/scanner_broker_impl.h index d0c4b546..b6670b4 100644 --- a/chromeos/components/quick_pair/scanning/scanner_broker_impl.h +++ b/ash/quick_pair/scanning/scanner_broker_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_ +#ifndef ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_ +#define ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_ +#include "ash/quick_pair/common/device.h" +#include "ash/quick_pair/scanning/scanner_broker.h" #include "base/observer_list.h" -#include "chromeos/components/quick_pair/common/device.h" -#include "chromeos/components/quick_pair/scanning/scanner_broker.h" -namespace chromeos { +namespace ash { namespace quick_pair { class ScannerBrokerImpl : public ScannerBroker { @@ -36,6 +36,6 @@ }; } // namespace quick_pair -} // namespace chromeos +} // namespace ash -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_ +#endif // ASH_QUICK_PAIR_SCANNING_SCANNER_BROKER_IMPL_H_
diff --git a/ash/quick_pair/ui/BUILD.gn b/ash/quick_pair/ui/BUILD.gn new file mode 100644 index 0000000..c1bfd0c --- /dev/null +++ b/ash/quick_pair/ui/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, + "Quick Pair protocols (e.g. Fast Pair) are ash-chrome only") + +component("ui") { + output_name = "quick_pair_ui" + + defines = [ "IS_QUICK_PAIR_UI_IMPL" ] + + sources = [ + "fast_pair/fast_pair_notification_controller.cc", + "fast_pair/fast_pair_notification_controller.h", + ] + + deps = [ + "//ash/public/cpp:cpp", + "//ash/resources/vector_icons", + "//ash/strings", + "//base", + "//ui/base", + "//ui/gfx", + "//ui/message_center", + ] +}
diff --git a/ash/system/quick_pair/fast_pair_notification_controller.cc b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc similarity index 96% rename from ash/system/quick_pair/fast_pair_notification_controller.cc rename to ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc index 8b79d06..ba2f91b 100644 --- a/ash/system/quick_pair/fast_pair_notification_controller.cc +++ b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/system/quick_pair/fast_pair_notification_controller.h" +#include "ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h" #include "ash/public/cpp/notification_utils.h" #include "ash/resources/vector_icons/vector_icons.h" @@ -15,8 +15,6 @@ using message_center::MessageCenter; using message_center::Notification; -namespace ash { - namespace { const char kNotifierFastPair[] = "ash.fastpair"; @@ -36,7 +34,7 @@ std::unique_ptr<message_center::Notification> CreateNotification( const std::string& id) { std::unique_ptr<message_center::Notification> notification = - CreateSystemNotification( + ash::CreateSystemNotification( /*type=*/message_center::NOTIFICATION_TYPE_SIMPLE, /*id=*/id, /*title=*/std::u16string(), @@ -48,7 +46,7 @@ kNotifierFastPair), /*optional_fields=*/{}, /*delegate=*/nullptr, - /*small_image=*/kNotificationBluetoothIcon, + /*small_image=*/ash::kNotificationBluetoothIcon, /*warning_level=*/ message_center::SystemNotificationWarningLevel::NORMAL); @@ -60,6 +58,10 @@ } } // namespace + +namespace ash { +namespace quick_pair { + // NotificationDelegate implementation for handling click and dismiss events on // a notification. Used by Error, Pairing, and Discovery notifications. class NotificationDelegate : public message_center::NotificationDelegate { @@ -166,4 +168,5 @@ MessageCenter::Get()->AddNotification(std::move(pairing_notification)); } +} // namespace quick_pair } // namespace ash
diff --git a/ash/system/quick_pair/fast_pair_notification_controller.h b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h similarity index 79% rename from ash/system/quick_pair/fast_pair_notification_controller.h rename to ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h index fd64cd7..b609c2d8 100644 --- a/ash/system/quick_pair/fast_pair_notification_controller.h +++ b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h
@@ -2,18 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_SYSTEM_QUICK_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_ -#define ASH_SYSTEM_QUICK_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_ +#ifndef ASH_QUICK_PAIR_UI_FAST_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_ +#define ASH_QUICK_PAIR_UI_FAST_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_ -#include "ash/ash_export.h" #include "base/callback.h" +#include "base/component_export.h" #include "ui/gfx/image/image.h" namespace ash { +namespace quick_pair { // This controller creates and manages a message_center::Notification for each // FastPair corresponding notification event. -class ASH_EXPORT FastPairNotificationController { +class COMPONENT_EXPORT(QUICK_PAIR_UI) FastPairNotificationController { public: FastPairNotificationController(); ~FastPairNotificationController(); @@ -38,6 +39,7 @@ base::OnceCallback<void(bool)> on_close); }; +} // namespace quick_pair } // namespace ash -#endif // ASH_SYSTEM_QUICK_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_ +#endif // ASH_QUICK_PAIR_UI_FAST_PAIR_FAST_PAIR_NOTIFICATION_CONTROLLER_H_
diff --git a/ash/strings/ash_strings_fil.xtb b/ash/strings/ash_strings_fil.xtb index 6550b5a..4987117 100644 --- a/ash/strings/ash_strings_fil.xtb +++ b/ash/strings/ash_strings_fil.xtb
@@ -348,6 +348,7 @@ <translation id="370665806235115550">Naglo-load...</translation> <translation id="3712407551474845318">I-capture ang rehiyon</translation> <translation id="371370241367527062">Mikropono sa harap</translation> +<translation id="3713734891607377840">Buksan kapag kumpleto na</translation> <translation id="3742055079367172538">Nakakuha na ng screenshot</translation> <translation id="3771549900096082774">High Contrast Mode</translation> <translation id="3773700760453577392">Hindi pinayagan ng isang administrator ang maraming pag-sign in para sa <ph name="USER_EMAIL" />. Dapat mag-sign out ang lahat ng user para makapagpatuloy.</translation>
diff --git a/ash/strings/ash_strings_km.xtb b/ash/strings/ash_strings_km.xtb index d940f273..e9f3e0784 100644 --- a/ash/strings/ash_strings_km.xtb +++ b/ash/strings/ash_strings_km.xtb
@@ -137,6 +137,7 @@ <translation id="1990046457226896323">បានទាញយកឯកសារនិយាយ</translation> <translation id="1993072747612765854">ស្វែងយល់បន្ថែមអំពីកំណែ <ph name="SYSTEM_APP_NAME" /> ថ្មីបំផុត</translation> <translation id="1998100899771863792">តុនិម្មិតបច្ចុប្បន្ន</translation> +<translation id="1999628559811343244">បានចាប់ផ្ដើមការថតកញ្ចប់បណ្ដាញ</translation> <translation id="2016340657076538683">សរសេរសារ</translation> <translation id="2018630726571919839">និយាយរឿងកំប្លែងឱ្យខ្ញុំស្ដាប់</translation> <translation id="2021864487439853900">ចុចដើម្បីដោះសោ</translation> @@ -727,6 +728,7 @@ <translation id="6751826523481687655">បានបើកការតាមដានប្រតិបត្តិការ</translation> <translation id="6752912906630585008">បានលុបតុទី <ph name="REMOVED_DESK" /> ហើយបានរួមបញ្ចូលជាមួយតុទី <ph name="RECEIVE_DESK" /></translation> <translation id="6757237461819837179">គ្មានការចាក់មេឌៀទេ</translation> +<translation id="6773040085467426602">ចុច "បញ្ឈប់" ដើម្បីបញ្ឈប់ប្រតិបត្តិការថតកញ្ចប់ដែលកំពុងដំណើរការ។</translation> <translation id="6777216307882431711">កំពុងសាកថ្មឧបករណ៍ USB-C ដែលបានភ្ជាប់</translation> <translation id="6790428901817661496">លេង</translation> <translation id="6803622936009808957">មិនអាចឆ្លុះអេក្រង់ទេ ដោយសារមិនមានកម្រិតច្បាស់ដែលគាំទ្រត្រូវបានរកឃើញទេ។</translation> @@ -940,6 +942,7 @@ <translation id="8433977262951327081">ផ្លូវកាត់សម្រាប់បង្ហាញម៉ឺនុយជម្រើសបញ្ចូលសារលេចឡើងនៅក្នុងធ្នើរបានផ្លាស់ប្តូរ។ សូមប្រើ <ph name="NEW_SHORTCUT" /> ជំនួសឲ្យ <ph name="OLD_SHORTCUT" /> ។</translation> <translation id="8444246603146515890">បានបើកដំណើរការតុទី <ph name="DESK_TITILE" /></translation> <translation id="8452135315243592079">បាត់ស៊ីមកាត</translation> +<translation id="8456543082656546101"><ph name="SHORTCUT_KEY_NAME" /> + V</translation> <translation id="8462305545768648477">បិទមុខងារជ្រើសរើសដើម្បីអាន</translation> <translation id="847056008324733326">ការកំណត់មាត្រដ្ឋានអេក្រង់</translation> <translation id="8473301994082929012"><ph name="ORGANIZATION_NAME" /> មាន <ph name="FEATURE_STATE" /> <ph name="FEATURE_NAME" />។</translation>
diff --git a/ash/strings/ash_strings_mn.xtb b/ash/strings/ash_strings_mn.xtb index d0b6c48e6..93b20f8 100644 --- a/ash/strings/ash_strings_mn.xtb +++ b/ash/strings/ash_strings_mn.xtb
@@ -348,6 +348,7 @@ <translation id="370665806235115550">Уншиж байна...</translation> <translation id="3712407551474845318">Бүсийн зураг авах</translation> <translation id="371370241367527062">Урд талын микрофон</translation> +<translation id="3713734891607377840">Дуусах үед нээх</translation> <translation id="3742055079367172538">Дэлгэцний зургийг авсан болно (Screenshot)</translation> <translation id="3771549900096082774">Өндөр ялгаралтай горим</translation> <translation id="3773700760453577392">Админ <ph name="USER_EMAIL" />-д олон зэрэг нэвтрэхийг зөвшөөрөөгүй байна.
diff --git a/ash/strings/ash_strings_pa.xtb b/ash/strings/ash_strings_pa.xtb index 10e9892..70497fa 100644 --- a/ash/strings/ash_strings_pa.xtb +++ b/ash/strings/ash_strings_pa.xtb
@@ -137,6 +137,7 @@ <translation id="1990046457226896323">ਬੋਲੀ ਵਾਲੀਆਂ ਫ਼ਾਈਲਾਂ ਨੂੰ ਡਾਊਨਲੋਡ ਕੀਤਾ ਗਿਆ</translation> <translation id="1993072747612765854">ਨਵੀਨਤਮ <ph name="SYSTEM_APP_NAME" /> ਅੱਪਡੇਟ ਬਾਰੇ ਹੋਰ ਜਾਣੋ</translation> <translation id="1998100899771863792">ਮੌਜੂਦਾ ਡੈਸਕ</translation> +<translation id="1999628559811343244">ਨੈੱਟਵਰਕ ਪੈਕੇਟ ਕੈਪਚਰ ਦੀ ਕਾਰਵਾਈ ਸ਼ੁਰੂ ਹੋ ਗਈ ਹੈ</translation> <translation id="2016340657076538683">ਕੋਈ ਸੁਨੇਹਾ ਟਾਈਪ ਕਰੋ</translation> <translation id="2018630726571919839">ਮੈਨੂੰ ਕੋਈ ਚੁਟਕਲਾ ਸੁਣਾਓ</translation> <translation id="2021864487439853900">ਅਣਲਾਕ ਕਰਨ ਲਈ ਕਲਿੱਕ ਕਰੋ</translation> @@ -727,6 +728,7 @@ <translation id="6751826523481687655">ਪ੍ਰਦਰਸ਼ਨ ਟ੍ਰੇਸਿੰਗ ਚਾਲੂ ਹੈ</translation> <translation id="6752912906630585008">ਡੈਸਕ <ph name="REMOVED_DESK" /> ਨੂੰ ਹਟਾ ਕੇ ਡੈਸਕ <ph name="RECEIVE_DESK" /> ਵਿੱਚ ਵਿਲੀਨ ਕੀਤਾ ਗਿਆ</translation> <translation id="6757237461819837179">ਕੋਈ ਮੀਡੀਆ ਨਹੀਂ ਚੱਲ ਰਿਹਾ ਹੈ</translation> +<translation id="6773040085467426602">ਚੱਲ ਰਹੀਆਂ ਪੈਕੇਟ ਕੈਪਚਰ ਕਾਰਵਾਈਆਂ ਨੂੰ ਰੋਕਣ ਲਈ 'ਰੋਕੋ' 'ਤੇ ਕਲਿੱਕ ਕਰੋ।</translation> <translation id="6777216307882431711">ਕਨੈਕਟ ਕੀਤੇ USB-C ਡੀਵਾਈਸਾਂ ਨੂੰ ਪਾਵਰ ਦਿੱਤੀ ਜਾ ਰਹੀ ਹੈ</translation> <translation id="6790428901817661496">ਪਲੇ ਕਰੋ</translation> <translation id="6803622936009808957">ਡਿਸਪਲੇਆਂ ਨੂੰ ਮਿਰਰ ਨਹੀਂ ਕਰ ਸਕਿਆ ਕਿਉਂਕਿ ਕੋਈ ਸਮਰਥਿਤ ਰੈਜ਼ੋਲਿਊਸ਼ਨ ਨਹੀਂ ਮਿਲੇ। ਇਸਦੀ ਬਜਾਏ ਵਿਸਤ੍ਰਿਤ ਡੈਸਕਟਾਪ ਵਿੱਚ ਚਲਾ ਗਿਆ।</translation> @@ -940,6 +942,7 @@ <translation id="8433977262951327081">ਸ਼ੈਲਫ਼ ਵਿੱਚ ਇਨਪੁੱਟ ਵਿਕਲਪ ਮੀਨੂ ਬੁਲਬੁਲੇ ਨੂੰ ਦਿਖਾਉਣ ਵਾਲਾ ਸ਼ਾਰਟਕੱਟ ਬਦਲ ਗਿਆ ਹੈ। ਕਿਰਪਾ ਕਰਕੇ <ph name="OLD_SHORTCUT" /> ਦੀ ਬਜਾਏ <ph name="NEW_SHORTCUT" /> ਵਰਤੋ।</translation> <translation id="8444246603146515890">ਡੈਸਕ <ph name="DESK_TITILE" /> ਕਿਰਿਆਸ਼ੀਲ ਕੀਤਾ ਗਿਆ</translation> <translation id="8452135315243592079">ਗੁੰਮ ਸਿਮ ਕਾਰਡ</translation> +<translation id="8456543082656546101"><ph name="SHORTCUT_KEY_NAME" /> + V</translation> <translation id="8462305545768648477">'ਚੁਣੋ ਅਤੇ ਸੁਣੋ' ਨੂੰ ਬੰਦ ਕਰੋ</translation> <translation id="847056008324733326">ਡਿਸਪਲੇ ਸਕੇਲ ਸੈਟਿੰਗਾਂ</translation> <translation id="8473301994082929012"><ph name="ORGANIZATION_NAME" /> ਕੋਲ <ph name="FEATURE_STATE" /> <ph name="FEATURE_NAME" /> ਹੈ।</translation>
diff --git a/ash/strings/ash_strings_sq.xtb b/ash/strings/ash_strings_sq.xtb index de8077c8..49c225b 100644 --- a/ash/strings/ash_strings_sq.xtb +++ b/ash/strings/ash_strings_sq.xtb
@@ -137,6 +137,7 @@ <translation id="1990046457226896323">Skedarët e ligjërimit u shkarkuan</translation> <translation id="1993072747612765854">Mëso më shumë rreth përditësimit të fundit të <ph name="SYSTEM_APP_NAME" /></translation> <translation id="1998100899771863792">Tavolina aktuale e punës</translation> +<translation id="1999628559811343244">Filloi regjistrimi i paketave të rrjetit</translation> <translation id="2016340657076538683">Shkruaj një mesazh</translation> <translation id="2018630726571919839">Më trego një barsoletë</translation> <translation id="2021864487439853900">Kliko për ta shkyçur</translation> @@ -727,6 +728,7 @@ <translation id="6751826523481687655">Gjurmimi i cilësisë së funksionimit është aktivizuar</translation> <translation id="6752912906630585008">Tavolina e punës <ph name="REMOVED_DESK" /> u hoq dhe u shkri me tavolinën e punës <ph name="RECEIVE_DESK" /></translation> <translation id="6757237461819837179">Nuk po luhet asnjë media</translation> +<translation id="6773040085467426602">Kliko për të ndaluar veprimet në proces të regjistrimit të paketave.</translation> <translation id="6777216307882431711">Po furnizon me energji pajisjet e lidhura USB-C</translation> <translation id="6790428901817661496">Luaj</translation> <translation id="6803622936009808957">Nuk mundi të pasqyrojë ekranet sepse nuk u gjetën rezolucione të mbështetura. Në vend të kësaj kaloi në desktopin e zgjeruar.</translation> @@ -940,6 +942,7 @@ <translation id="8433977262951327081">Shkurtorja për të shfaqur flluskën e menysë së opsioneve të hyrjes në raft ka ndryshuar. Përdor <ph name="NEW_SHORTCUT" /> në vend të <ph name="OLD_SHORTCUT" />.</translation> <translation id="8444246603146515890">Tavolina e punës <ph name="DESK_TITILE" /> u aktivizua</translation> <translation id="8452135315243592079">Karta SIM mungon</translation> +<translation id="8456543082656546101"><ph name="SHORTCUT_KEY_NAME" /> + V</translation> <translation id="8462305545768648477">Mbyll "Zgjidh që të thuhet"</translation> <translation id="847056008324733326">Cilësimet e shkallës së ekranit</translation> <translation id="8473301994082929012"><ph name="ORGANIZATION_NAME" /> ka <ph name="FEATURE_STATE" /> <ph name="FEATURE_NAME" />.</translation>
diff --git a/ash/strings/ash_strings_uz.xtb b/ash/strings/ash_strings_uz.xtb index 68e65fc0..d0e7410 100644 --- a/ash/strings/ash_strings_uz.xtb +++ b/ash/strings/ash_strings_uz.xtb
@@ -306,7 +306,7 @@ <translation id="3410336247007142655">Tungi mavzu sozlamalarini chiqarish</translation> <translation id="3413817803639110246">Hozircha hech narsa yo‘q</translation> <translation id="3428447136709161042"><ph name="NETWORK_NAME" /> aloqasini uzish</translation> -<translation id="3430396595145920809">Orqaga qaytish uchun oʻngdan suring</translation> +<translation id="3430396595145920809">Orqaga qaytish uchun oʻngdan chapga suring</translation> <translation id="343571671045587506">Eslatmani tahrirlash</translation> <translation id="3435967511775410570">Barmoq izi aniqlandi</translation> <translation id="3441920967307853524"><ph name="RECEIVED_BYTES" />/<ph name="TOTAL_BYTES" /></translation> @@ -348,6 +348,7 @@ <translation id="370665806235115550">Yuklanmoqda…</translation> <translation id="3712407551474845318">Qisman suratga olish</translation> <translation id="371370241367527062">Old mikrofon</translation> +<translation id="3713734891607377840">Yuklab olinganda ochish</translation> <translation id="3742055079367172538">Ekran suratga olindi</translation> <translation id="3771549900096082774">Yuqori kontrastli rejim</translation> <translation id="3773700760453577392">Administrator <ph name="USER_EMAIL" /> hisobi uchun bir multi-kirish imkoniyatini o‘chirib qo‘ydi. Hisobga kirishingizdan avval barcha foydalanuvchilar hisobdan chiqishi kerak.</translation>
diff --git a/ash/system/quick_pair/OWNERS b/ash/system/quick_pair/OWNERS deleted file mode 100644 index 8eb55b9..0000000 --- a/ash/system/quick_pair/OWNERS +++ /dev/null
@@ -1 +0,0 @@ -file://chromeos/components/quick_pair/OWNERS
diff --git a/base/allocator/partition_allocator/partition_bucket.cc b/base/allocator/partition_allocator/partition_bucket.cc index 49030d3..0848b4af 100644 --- a/base/allocator/partition_allocator/partition_bucket.cc +++ b/base/allocator/partition_allocator/partition_bucket.cc
@@ -592,6 +592,7 @@ if (root->IsQuarantineEnabled()) { RecommitSystemPages(quarantine_bitmaps, quarantine_bitmaps_size_to_commit, PageReadWrite, PageUpdatePermissions); + PCScan::RegisterNewSuperPage(root, reinterpret_cast<uintptr_t>(super_page)); } // If we were after a specific address, but didn't get it, assume that
diff --git a/base/allocator/partition_allocator/starscan/metadata_allocator.h b/base/allocator/partition_allocator/starscan/metadata_allocator.h index ed2d8ff..873b3dd 100644 --- a/base/allocator/partition_allocator/starscan/metadata_allocator.h +++ b/base/allocator/partition_allocator/starscan/metadata_allocator.h
@@ -27,13 +27,20 @@ MetadataAllocator(const MetadataAllocator<U>&) {} // NOLINT template <typename U> - MetadataAllocator& operator=(const MetadataAllocator<U>&) {} + MetadataAllocator& operator=(const MetadataAllocator<U>&) { + return *this; + } template <typename U> bool operator==(const MetadataAllocator<U>&) { return true; } + template <typename U> + bool operator!=(const MetadataAllocator<U>& o) { + return !operator==(o); + } + value_type* allocate(size_t size) { return static_cast<value_type*>(PCScanMetadataAllocator().AllocFlagsNoHooks( 0, size * sizeof(value_type), PartitionPageSize()));
diff --git a/base/allocator/partition_allocator/starscan/pcscan.cc b/base/allocator/partition_allocator/starscan/pcscan.cc index 2f898cd3..de8ba54 100644 --- a/base/allocator/partition_allocator/starscan/pcscan.cc +++ b/base/allocator/partition_allocator/starscan/pcscan.cc
@@ -21,6 +21,10 @@ PCScanInternal::Instance().RegisterNonScannableRoot(root); } +void PCScan::RegisterNewSuperPage(Root* root, uintptr_t super_page_base) { + PCScanInternal::Instance().RegisterNewSuperPage(root, super_page_base); +} + void PCScan::PerformScan(InvocationMode invocation_mode) { PCScanInternal::Instance().PerformScan(invocation_mode); }
diff --git a/base/allocator/partition_allocator/starscan/pcscan.h b/base/allocator/partition_allocator/starscan/pcscan.h index 629ba48c..5d2aa5aa 100644 --- a/base/allocator/partition_allocator/starscan/pcscan.h +++ b/base/allocator/partition_allocator/starscan/pcscan.h
@@ -71,6 +71,11 @@ // quarantined objects. static void RegisterNonScannableRoot(Root* root); + // Registers a newly allocated super page for |root|. + static void RegisterNewSuperPage(Root* root, uintptr_t super_page_base); + static void RegisterNewSuperPage(PartitionRoot<NotThreadSafe>* root, + uintptr_t super_page_base) {} + ALWAYS_INLINE static void MoveToQuarantine(void* ptr, size_t usable_size, size_t slot_size);
diff --git a/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/base/allocator/partition_allocator/starscan/pcscan_internal.cc index 2ff3e76..1cfbd29 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/base/allocator/partition_allocator/starscan/pcscan_internal.cc
@@ -181,9 +181,10 @@ } #if DCHECK_IS_ON() -bool IsScannerQuarantineBitmapEmpty(char* super_page, size_t epoch) { - auto* bitmap = QuarantineBitmapFromPointer(QuarantineBitmapType::kScanner, - epoch, super_page); +bool IsScannerQuarantineBitmapEmpty(uintptr_t super_page, size_t epoch) { + auto* bitmap = + QuarantineBitmapFromPointer(QuarantineBitmapType::kScanner, epoch, + reinterpret_cast<void*>(super_page)); size_t visited = 0; bitmap->Iterate([&visited](auto) { ++visited; }); return !visited; @@ -214,20 +215,6 @@ #endif } -void CommitQuarantineBitmaps(PCScan::Root& root) { - size_t quarantine_bitmaps_size_to_commit = CommittedQuarantineBitmapsSize(); - for (auto* super_page_extent = root.first_extent; super_page_extent; - super_page_extent = super_page_extent->next) { - for (char *super_page = SuperPagesBeginFromExtent(super_page_extent), - *super_page_end = SuperPagesEndFromExtent(super_page_extent); - super_page != super_page_end; super_page += kSuperPageSize) { - RecommitSystemPages(internal::SuperPageQuarantineBitmaps(super_page), - quarantine_bitmaps_size_to_commit, PageReadWrite, - PageUpdatePermissions); - } - } -} - class PCScanSnapshot final { public: struct ScanArea { @@ -286,11 +273,10 @@ } template <class Function> -void IterateNonEmptySlotSpans(char* super_page_base, +void IterateNonEmptySlotSpans(uintptr_t super_page_base, size_t nonempty_slot_spans, Function function) { - PA_DCHECK( - !(reinterpret_cast<uintptr_t>(super_page_base) % kSuperPageAlignment)); + PA_DCHECK(!(super_page_base % kSuperPageAlignment)); PA_DCHECK(nonempty_slot_spans); size_t slot_spans_to_visit = nonempty_slot_spans; @@ -299,7 +285,7 @@ #endif IterateSlotSpans<ThreadSafe>( - super_page_base, true /*with_quarantine*/, + reinterpret_cast<char*>(super_page_base), true /*with_quarantine*/, [&function, &slot_spans_to_visit #if DCHECK_IS_ON() , @@ -335,61 +321,54 @@ static constexpr size_t kLargeScanAreaThreshold = 8192; auto& pcscan_internal = PCScanInternal::Instance(); - for (Root* root : pcscan_internal.scannable_roots()) { + for (const auto& pair : pcscan_internal.scannable_roots()) { + Root* root = pair.first; typename Root::ScopedGuard guard(root->lock_); - // Take a snapshot of all super pages and scannable slot spans. - for (auto* super_page_extent = root->first_extent; super_page_extent; - super_page_extent = super_page_extent->next) { - for (char *super_page = SuperPagesBeginFromExtent(super_page_extent), - *super_page_end = SuperPagesEndFromExtent(super_page_extent); - super_page != super_page_end; super_page += kSuperPageSize) { - auto* extent_entry = - reinterpret_cast<PartitionSuperPageExtentEntry<ThreadSafe>*>( - PartitionSuperPageToMetadataArea(super_page)); - const size_t nonempty_slot_spans = - extent_entry->number_of_nonempty_slot_spans; - if (!nonempty_slot_spans) { + // Take a snapshot of all scannable slot spans. + for (uintptr_t super_page : pair.second) { + auto* extent_entry = + reinterpret_cast<PartitionSuperPageExtentEntry<ThreadSafe>*>( + PartitionSuperPageToMetadataArea( + reinterpret_cast<char*>(super_page))); + const size_t nonempty_slot_spans = + extent_entry->number_of_nonempty_slot_spans; + if (!nonempty_slot_spans) { #if DCHECK_IS_ON() - // Check that quarantine bitmap is empty for super-pages that contain - // only empty/decommitted slot-spans. - PA_CHECK(IsScannerQuarantineBitmapEmpty(super_page, pcscan_epoch)); + // Check that quarantine bitmap is empty for super-pages that contain + // only empty/decommitted slot-spans. + PA_CHECK(IsScannerQuarantineBitmapEmpty(super_page, pcscan_epoch)); #endif - continue; - } - - IterateNonEmptySlotSpans( - super_page, nonempty_slot_spans, [this](SlotSpan* slot_span) { - auto* payload_begin = static_cast<uintptr_t*>( - SlotSpan::ToSlotSpanStartPtr(slot_span)); - const size_t provisioned_size = slot_span->GetProvisionedSize(); - // Free & decommitted slot spans are skipped. - PA_DCHECK(provisioned_size > 0); - auto* payload_end = - payload_begin + (provisioned_size / sizeof(uintptr_t)); - if (slot_span->bucket->slot_size >= kLargeScanAreaThreshold) { - large_scan_areas_worklist_.Push( - {payload_begin, payload_end, slot_span->bucket->slot_size}); - } else { - scan_areas_worklist_.Push({payload_begin, payload_end}); - } - }); - super_pages_.insert(reinterpret_cast<uintptr_t>(super_page)); - super_pages_worklist_.Push(reinterpret_cast<uintptr_t>(super_page)); + continue; } + + IterateNonEmptySlotSpans( + super_page, nonempty_slot_spans, [this](SlotSpan* slot_span) { + auto* payload_begin = static_cast<uintptr_t*>( + SlotSpan::ToSlotSpanStartPtr(slot_span)); + const size_t provisioned_size = slot_span->GetProvisionedSize(); + // Free & decommitted slot spans are skipped. + PA_DCHECK(provisioned_size > 0); + auto* payload_end = + payload_begin + (provisioned_size / sizeof(uintptr_t)); + if (slot_span->bucket->slot_size >= kLargeScanAreaThreshold) { + large_scan_areas_worklist_.Push( + {payload_begin, payload_end, slot_span->bucket->slot_size}); + } else { + scan_areas_worklist_.Push({payload_begin, payload_end}); + } + }); + super_pages_.insert(super_page); + super_pages_worklist_.Push(super_page); } } - for (Root* root : pcscan_internal.nonscannable_roots()) { + for (const auto& pair : pcscan_internal.nonscannable_roots()) { + Root* root = pair.first; typename Root::ScopedGuard guard(root->lock_); // Take a snapshot of all super pages and nnonscannable slot spans. - for (auto* super_page_extent = root->first_extent; super_page_extent; - super_page_extent = super_page_extent->next) { - for (char *super_page = SuperPagesBeginFromExtent(super_page_extent), - *super_page_end = SuperPagesEndFromExtent(super_page_extent); - super_page != super_page_end; super_page += kSuperPageSize) { - super_pages_.insert(reinterpret_cast<uintptr_t>(super_page)); - super_pages_worklist_.Push(reinterpret_cast<uintptr_t>(super_page)); - } + for (uintptr_t super_page : pair.second) { + super_pages_.insert(super_page); + super_pages_worklist_.Push(super_page); } } } @@ -1017,19 +996,6 @@ TimeDelta wanted_delay_; }; -void PCScanInternal::Roots::Add(Root* root) { - PA_CHECK(std::find(begin(), end(), root) == end()); - (*this)[current_] = root; - ++current_; - PA_CHECK(current_ != kMaxNumberOfRoots) - << "Exceeded number of allowed partition roots"; -} - -void PCScanInternal::Roots::ClearForTesting() { - std::fill(begin(), end(), nullptr); - current_ = 0; -} - PCScanInternal::PCScanInternal() : simd_support_(DetectSimdSupport()) {} PCScanInternal::~PCScanInternal() = default; @@ -1053,11 +1019,12 @@ #if DCHECK_IS_ON() PA_DCHECK(is_initialized()); PA_DCHECK(scannable_roots().size() > 0); - PA_DCHECK(std::all_of(scannable_roots().begin(), scannable_roots().end(), - [](Root* root) { return root->IsScanEnabled(); })); - PA_DCHECK( - std::all_of(nonscannable_roots().begin(), nonscannable_roots().end(), - [](Root* root) { return root->IsQuarantineEnabled(); })); + PA_DCHECK(std::all_of( + scannable_roots().begin(), scannable_roots().end(), + [](const auto& pair) { return pair.first->IsScanEnabled(); })); + PA_DCHECK(std::all_of( + nonscannable_roots().begin(), nonscannable_roots().end(), + [](const auto& pair) { return pair.first->IsQuarantineEnabled(); })); #endif PCScan& frontend = PCScan::Instance(); @@ -1133,30 +1100,94 @@ current_task_.reset(); } +namespace { +PCScanInternal::SuperPages GetSuperPagesAndCommitQuarantineBitmaps( + PCScan::Root& root) { + const size_t quarantine_bitmaps_size_to_commit = + CommittedQuarantineBitmapsSize(); + PCScanInternal::SuperPages super_pages; + for (auto* super_page_extent = root.first_extent; super_page_extent; + super_page_extent = super_page_extent->next) { + for (char *super_page = SuperPagesBeginFromExtent(super_page_extent), + *super_page_end = SuperPagesEndFromExtent(super_page_extent); + super_page != super_page_end; super_page += kSuperPageSize) { + RecommitSystemPages(internal::SuperPageQuarantineBitmaps(super_page), + quarantine_bitmaps_size_to_commit, PageReadWrite, + PageUpdatePermissions); + super_pages.push_back(reinterpret_cast<uintptr_t>(super_page)); + } + } + return super_pages; +} +} // namespace + void PCScanInternal::RegisterScannableRoot(Root* root) { PA_DCHECK(is_initialized()); PA_DCHECK(root); - PA_CHECK(root->IsQuarantineAllowed()); - typename Root::ScopedGuard guard(root->lock_); - if (root->IsScanEnabled()) - return; - PA_CHECK(!root->IsQuarantineEnabled()); - CommitQuarantineBitmaps(*root); - root->scan_mode = Root::ScanMode::kEnabled; - root->quarantine_mode = Root::QuarantineMode::kEnabled; - scannable_roots_.Add(root); + // Avoid nesting locks and store super_pages in a temporary vector. + SuperPages super_pages; + { + typename Root::ScopedGuard guard(root->lock_); + PA_CHECK(root->IsQuarantineAllowed()); + if (root->IsScanEnabled()) + return; + PA_CHECK(!root->IsQuarantineEnabled()); + super_pages = GetSuperPagesAndCommitQuarantineBitmaps(*root); + root->scan_mode = Root::ScanMode::kEnabled; + root->quarantine_mode = Root::QuarantineMode::kEnabled; + } + std::lock_guard<std::mutex> lock(roots_mutex_); + PA_DCHECK(!scannable_roots_.count(root)); + auto& root_super_pages = scannable_roots_[root]; + root_super_pages.insert(root_super_pages.end(), super_pages.begin(), + super_pages.end()); } void PCScanInternal::RegisterNonScannableRoot(Root* root) { PA_DCHECK(is_initialized()); PA_DCHECK(root); + // Avoid nesting locks and store super_pages in a temporary vector. + SuperPages super_pages; + { + typename Root::ScopedGuard guard(root->lock_); + PA_CHECK(root->IsQuarantineAllowed()); + PA_CHECK(!root->IsScanEnabled()); + if (root->IsQuarantineEnabled()) + return; + super_pages = GetSuperPagesAndCommitQuarantineBitmaps(*root); + root->quarantine_mode = Root::QuarantineMode::kEnabled; + } + std::lock_guard<std::mutex> lock(roots_mutex_); + PA_DCHECK(!nonscannable_roots_.count(root)); + auto& root_super_pages = nonscannable_roots_[root]; + root_super_pages.insert(root_super_pages.end(), super_pages.begin(), + super_pages.end()); +} + +void PCScanInternal::RegisterNewSuperPage(Root* root, + uintptr_t super_page_base) { + PA_DCHECK(is_initialized()); + PA_DCHECK(root); PA_CHECK(root->IsQuarantineAllowed()); - typename Root::ScopedGuard guard(root->lock_); - if (root->IsQuarantineEnabled()) - return; - CommitQuarantineBitmaps(*root); - root->quarantine_mode = Root::QuarantineMode::kEnabled; - nonscannable_roots_.Add(root); + PA_DCHECK(!(super_page_base % kSuperPageAlignment)); + + std::lock_guard<std::mutex> lock(roots_mutex_); + + // Dispatch based on whether root is scannable or not. + if (root->IsScanEnabled()) { + PA_DCHECK(scannable_roots_.count(root)); + auto& super_pages = scannable_roots_[root]; + PA_DCHECK(std::find(super_pages.begin(), super_pages.end(), + super_page_base) == super_pages.end()); + super_pages.push_back(super_page_base); + } else { + PA_DCHECK(root->IsQuarantineEnabled()); + PA_DCHECK(nonscannable_roots_.count(root)); + auto& super_pages = nonscannable_roots_[root]; + PA_DCHECK(std::find(super_pages.begin(), super_pages.end(), + super_page_base) == super_pages.end()); + super_pages.push_back(super_page_base); + } } void PCScanInternal::SetProcessName(const char* process_name) { @@ -1168,8 +1199,9 @@ size_t PCScanInternal::CalculateTotalHeapSize() const { PA_DCHECK(is_initialized()); - const auto acc = [](size_t size, Root* root) { - return size + root->get_total_size_of_committed_pages(); + std::lock_guard<std::mutex> lock(roots_mutex_); + const auto acc = [](size_t size, const auto& pair) { + return size + pair.first->get_total_size_of_committed_pages(); }; return std::accumulate(scannable_roots_.begin(), scannable_roots_.end(), 0u, acc) + @@ -1228,16 +1260,19 @@ } void PCScanInternal::ClearRootsForTesting() { + std::lock_guard<std::mutex> lock(roots_mutex_); // Set all roots as non-scannable and non-quarantinable. - for (auto* root : scannable_roots_) { + for (auto& pair : scannable_roots_) { + Root* root = pair.first; root->scan_mode = Root::ScanMode::kDisabled; root->quarantine_mode = Root::QuarantineMode::kDisabledByDefault; } - for (auto* root : nonscannable_roots_) { + for (auto& pair : nonscannable_roots_) { + Root* root = pair.first; root->quarantine_mode = Root::QuarantineMode::kDisabledByDefault; } - scannable_roots_.ClearForTesting(); // IN-TEST - nonscannable_roots_.ClearForTesting(); // IN-TEST + scannable_roots_.clear(); // IN-TEST + nonscannable_roots_.clear(); // IN-TEST // Destroy write protector object, so that there is no double free on the next // call to ReinitForTesting(); write_protector_.reset();
diff --git a/base/allocator/partition_allocator/starscan/pcscan_internal.h b/base/allocator/partition_allocator/starscan/pcscan_internal.h index 2d8d022..845ff7d 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_internal.h +++ b/base/allocator/partition_allocator/starscan/pcscan_internal.h
@@ -30,33 +30,13 @@ using Root = PCScan::Root; using TaskHandle = scoped_refptr<PCScanTask>; - static constexpr size_t kMaxNumberOfRoots = 8u; - class Roots final : private std::array<Root*, kMaxNumberOfRoots> { - using Base = std::array<Root*, kMaxNumberOfRoots>; - - public: - using typename Base::const_iterator; - using typename Base::iterator; - - // Explicitly value-initialize Base{} as otherwise the default - // (aggregate) initialization won't be considered as constexpr. - constexpr Roots() : Base{} {} - - iterator begin() { return Base::begin(); } - const_iterator begin() const { return Base::begin(); } - - iterator end() { return begin() + current_; } - const_iterator end() const { return begin() + current_; } - - void Add(Root* root); - - size_t size() const { return current_; } - - void ClearForTesting(); // IN-TEST - - private: - size_t current_ = 0u; - }; + using SuperPages = std::vector<uintptr_t, MetadataAllocator<uintptr_t>>; + using RootsMap = + std::unordered_map<Root*, + SuperPages, + std::hash<Root*>, + std::equal_to<>, + MetadataAllocator<std::pair<Root* const, SuperPages>>>; static PCScanInternal& Instance() { // Since the data that PCScanInternal holds is cold, it's fine to have the @@ -85,11 +65,13 @@ void RegisterScannableRoot(Root* root); void RegisterNonScannableRoot(Root* root); - Roots& scannable_roots() { return scannable_roots_; } - const Roots& scannable_roots() const { return scannable_roots_; } + RootsMap& scannable_roots() { return scannable_roots_; } + const RootsMap& scannable_roots() const { return scannable_roots_; } - Roots& nonscannable_roots() { return nonscannable_roots_; } - const Roots& nonscannable_roots() const { return nonscannable_roots_; } + RootsMap& nonscannable_roots() { return nonscannable_roots_; } + const RootsMap& nonscannable_roots() const { return nonscannable_roots_; } + + void RegisterNewSuperPage(Root* root, uintptr_t super_page_base); void SetProcessName(const char* name); const char* process_name() const { return process_name_; } @@ -133,8 +115,9 @@ TaskHandle current_task_; mutable std::mutex current_task_mutex_; - Roots scannable_roots_{}; - Roots nonscannable_roots_{}; + RootsMap scannable_roots_; + RootsMap nonscannable_roots_; + mutable std::mutex roots_mutex_; bool stack_scanning_enabled_{false}; // TLS emulation of stack tops. Since this is guaranteed to go through
diff --git a/base/rand_util.cc b/base/rand_util.cc index 4259200..fe8ed471 100644 --- a/base/rand_util.cc +++ b/base/rand_util.cc
@@ -117,4 +117,11 @@ return this->RandUint64() >> 32; } +double InsecureRandomGenerator::RandDouble() { + uint64_t x = RandUint64(); + // From https://vigna.di.unimi.it/xorshift/. + // 53 bits of mantissa, hence the "hexadecimal exponent" 1p-53. + return (x >> 11) * 0x1.0p-53; +} + } // namespace base
diff --git a/base/rand_util.h b/base/rand_util.h index 22bbb84..8414016 100644 --- a/base/rand_util.h +++ b/base/rand_util.h
@@ -78,6 +78,12 @@ class RandomGenerator; } +namespace sequence_manager { +namespace internal { +class SequenceManagerImpl; +} +} // namespace sequence_manager + // Fast, insecure pseudo-random number generator. // // WARNING: This is not the generator you are looking for. This has significant @@ -114,6 +120,8 @@ uint32_t RandUint32(); uint64_t RandUint64(); + // In [0, 1). + double RandDouble(); private: InsecureRandomGenerator() = default; @@ -131,10 +139,16 @@ // need a secure PRNG, as it's used for ASLR and zeroing some allocations at // free() time. friend class partition_alloc::RandomGenerator; + // The random number generator is used to sub-sample metrics at each task + // execution. Task execution overhead is <1us, and is already showing as a + // non-trivial amount of total CPU time in sampling profiling from the wild, + // on Desktop and Android. + friend class sequence_manager::internal::SequenceManagerImpl; FRIEND_TEST_ALL_PREFIXES(RandUtilTest, InsecureRandomGeneratorProducesBothValuesOfAllBits); FRIEND_TEST_ALL_PREFIXES(RandUtilTest, InsecureRandomGeneratorChiSquared); + FRIEND_TEST_ALL_PREFIXES(RandUtilTest, InsecureRandomGeneratorRandDouble); FRIEND_TEST_ALL_PREFIXES(RandUtilPerfTest, InsecureRandomRandUint64); };
diff --git a/base/rand_util_unittest.cc b/base/rand_util_unittest.cc index f6ea8c87..73134d8 100644 --- a/base/rand_util_unittest.cc +++ b/base/rand_util_unittest.cc
@@ -284,4 +284,14 @@ } } +TEST(RandUtilTest, InsecureRandomGeneratorRandDouble) { + InsecureRandomGenerator gen; + gen.Seed(); + + for (int i = 0; i < 1000; i++) { + volatile double x = gen.RandDouble(); + EXPECT_GE(x, 0.); + EXPECT_LT(x, 1.); + } +} } // namespace base
diff --git a/base/task/sequence_manager/sequence_manager_impl.cc b/base/task/sequence_manager/sequence_manager_impl.cc index 62f34f4d..f8e1889 100644 --- a/base/task/sequence_manager/sequence_manager_impl.cc +++ b/base/task/sequence_manager/sequence_manager_impl.cc
@@ -267,8 +267,7 @@ : selector(associated_thread, settings), real_time_domain(new internal::RealTimeDomain()) { if (settings.randomised_sampling_enabled) { - random_generator = std::mt19937_64(RandUint64()); - uniform_distribution = std::uniform_real_distribution<double>(0.0, 1.0); + random_generator.Seed(); } } @@ -1064,8 +1063,7 @@ DCHECK(ThreadTicks::IsSupported() || !metric_recording_settings_.records_cpu_time_for_some_tasks()); return metric_recording_settings_.records_cpu_time_for_some_tasks() && - main_thread_only().uniform_distribution( - main_thread_only().random_generator) < + main_thread_only().random_generator.RandDouble() < metric_recording_settings_ .task_sampling_rate_for_recording_cpu_time; }
diff --git a/base/task/sequence_manager/sequence_manager_impl.h b/base/task/sequence_manager/sequence_manager_impl.h index 60d7ae8..1f6c04e2 100644 --- a/base/task/sequence_manager/sequence_manager_impl.h +++ b/base/task/sequence_manager/sequence_manager_impl.h
@@ -9,7 +9,6 @@ #include <list> #include <map> #include <memory> -#include <random> #include <set> #include <string> #include <utility> @@ -22,6 +21,7 @@ #include "base/memory/weak_ptr.h" #include "base/message_loop/message_pump_type.h" #include "base/pending_task.h" +#include "base/rand_util.h" #include "base/run_loop.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" @@ -270,8 +270,7 @@ std::array<char, static_cast<size_t>(debug::CrashKeySize::Size64)> async_stack_buffer = {}; - std::mt19937_64 random_generator; - std::uniform_real_distribution<double> uniform_distribution; + base::InsecureRandomGenerator random_generator; internal::TaskQueueSelector selector; ObserverList<TaskObserver>::Unchecked task_observers;
diff --git a/build/android/gyp/nocompile_test.py b/build/android/gyp/nocompile_test.py index f02a2ad..69fb395 100755 --- a/build/android/gyp/nocompile_test.py +++ b/build/android/gyp/nocompile_test.py
@@ -50,17 +50,22 @@ _raise_command_exception(args, p.returncode, pout) -def _run_command_get_output(args, success_output): - """Runs shell command and returns command output.""" +def _run_command_get_failure_output(args): + """Runs shell command. + + Returns: + Command output if command fails, None if command succeeds. + """ p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) pout, _ = p.communicate() + if p.returncode == 0: - return success_output + return None # For Python3 only: if isinstance(pout, bytes) and sys.version_info >= (3, ): pout = pout.decode('utf-8') - return pout + return '' if pout is None else pout def _copy_and_append_gn_args(src_args_path, dest_args_path, extra_args): @@ -93,6 +98,9 @@ Otherwise: the entire test output after the 'FAILED' message is searched. """ + if test_output is None: + return False + failed_index = test_output.find('FAILED') if failed_index < 0: return False @@ -111,6 +119,22 @@ return False +def _do_build_get_failure_output(gn_path, gn_cmd, options): + # Extract directory from test target. As all of the test targets are declared + # in the same BUILD.gn file, it does not matter which test target is used. + target_dir = gn_path.rsplit(':', 1)[0] + + if gn_cmd is not None: + gn_args = [ + _GN_SRC_REL_PATH, '--root-target=' + target_dir, gn_cmd, + os.path.relpath(options.out_dir, _CHROMIUM_SRC) + ] + _run_command(gn_args, cwd=_CHROMIUM_SRC) + + ninja_args = [_NINJA_PATH, '-C', options.out_dir, gn_path] + return _run_command_get_failure_output(ninja_args) + + def main(): parser = argparse.ArgumentParser() parser.add_argument('--gn-args-path', @@ -144,37 +168,34 @@ _copy_and_append_gn_args(options.gn_args_path, out_gn_args_path, extra_gn_args) - # Extract directory from test target. As all of the test targets are declared - # in the same BUILD.gn file, it does not matter which test target is used. - target0_dir = test_configs[0]['target'].rsplit(':', 1)[0] - gn_args = [ - _GN_SRC_REL_PATH, '--root-target=' + target0_dir, 'gen', - os.path.relpath(options.out_dir, _CHROMIUM_SRC) - ] - ran_gn_gen = False + did_clean_build = False error_messages = [] for config in test_configs: # Strip leading '//' gn_path = config['target'][2:] expect_regex = config['expect_regex'] - ninja_args = [_NINJA_PATH, '-C', options.out_dir, gn_path] - # Purpose of quotes at beginning of message is to make it clear that - # "Compile successful." is not a compiler log message. - test_output = _run_command_get_output(ninja_args, '""\nCompile successful.') + test_output = _do_build_get_failure_output(gn_path, None, options) # 'gn gen' takes > 1s to run. Only run 'gn gen' if it is needed for compile. - if _search_regex_in_list(test_output.split('\n'), _GN_GEN_REGEX): + if (test_output + and _search_regex_in_list(test_output.split('\n'), _GN_GEN_REGEX)): assert not ran_gn_gen ran_gn_gen = True - _run_command(gn_args, cwd=_CHROMIUM_SRC) + test_output = _do_build_get_failure_output(gn_path, 'gen', options) - # Redo compile. - test_output = _run_command_get_output(ninja_args, - '""\nCompile successful.') + if (not _find_regex_in_test_failure_output(test_output, expect_regex) + and not did_clean_build): + # Ensure the failure is not due to incremental build. + did_clean_build = True + test_output = _do_build_get_failure_output(gn_path, 'clean', options) if not _find_regex_in_test_failure_output(test_output, expect_regex): + if test_output is None: + # Purpose of quotes at beginning of message is to make it clear that + # "Compile successful." is not a compiler log message. + test_output = '""\nCompile successful.' error_message = '//{} failed.\nExpected compile output pattern:\n'\ '{}\nActual compile output:\n{}'.format( gn_path, expect_regex, test_output)
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 791a6e96..4675b75 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
@@ -130,22 +130,20 @@ ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], check_return=True) -# TODO(jbudorick): Make this private once the instrumentation test_runner -# is deprecated. -def DidPackageCrashOnDevice(package_name, device): + +def DismissCrashDialogs(device): # Dismiss any error dialogs. Limit the number in case we have an error # loop or we are failing to dismiss. + packages = set() try: for _ in range(10): package = device.DismissCrashDialogIfNeeded(timeout=10, retries=1) if not package: - return False - # Assume test package convention of ".test" suffix - if package in package_name: - return True + break + packages.add(package) except device_errors.CommandFailedError: logging.exception('Error while attempting to dismiss crash dialog.') - return False + return packages _CURRENT_FOCUS_CRASH_RE = re.compile( @@ -378,7 +376,7 @@ steps += [ set_debug_app, edit_shared_prefs, push_test_data, create_flag_changer, - set_vega_permissions + set_vega_permissions, DismissCrashDialogs ] def bind_crash_handler(step, dev): @@ -796,10 +794,17 @@ # Update the result type if we detect a crash. try: - if DidPackageCrashOnDevice(self._test_instance.test_package, device): + crashed_packages = DismissCrashDialogs(device) + # Assume test package convention of ".test" suffix + if any(p in self._test_instance.test_package for p in crashed_packages): for r in results: if r.GetType() == base_test_result.ResultType.UNKNOWN: r.SetType(base_test_result.ResultType.CRASH) + if (crashed_packages and len(results) == 1 + and results[0].GetType() != base_test_result.ResultType.PASS): + _AppendToLogForResult( + results[0], 'OS displayed error dialogs for {}'.format( + ', '.join(crashed_packages))) except device_errors.CommandTimeoutError: logging.warning('timed out when detecting/dismissing error dialogs') # Attach screenshot to the test to help with debugging the dialog boxes. @@ -1427,7 +1432,11 @@ for result in results: if found_matching_test and result.GetName() != full_test_name: continue - result.SetLog(result.GetLog() + '\n' + line) + _AppendToLogForResult(result, line) + + +def _AppendToLogForResult(result, line): + result.SetLog(result.GetLog() + '\n' + line) def _SetLinkOnResults(results, full_test_name, link_name, link):
diff --git a/build/android/pylib/symbols/stack_symbolizer.py b/build/android/pylib/symbols/stack_symbolizer.py index 4173741..fdd4778 100644 --- a/build/android/pylib/symbols/stack_symbolizer.py +++ b/build/android/pylib/symbols/stack_symbolizer.py
@@ -72,7 +72,7 @@ constants.GetOutDirectory(), '--more-info'] env = dict(os.environ) env['PYTHONDONTWRITEBYTECODE'] = '1' - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(mode='w') as f: f.write('\n'.join(data_to_symbolize)) f.flush() start = time.time()
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 88de18f..c1e14dc 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -75,7 +75,10 @@ # Enable fatal linker warnings. Building Chromium with certain versions # of binutils can cause linker warning. - fatal_linker_warnings = true + # TODO(thakis): Set this to true unconditionally once lld/MachO no longer + # warns in mac intel->arm cross builds. + fatal_linker_warnings = !(is_apple && use_lld && ((target_cpu == "arm64" && + host_cpu != target_cpu) || is_asan)) # Build with C++ RTTI enabled. Chromium builds without RTTI by default, # but some sanitizers are known to require it, like CFI diagnostics
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 6bac6d0d8..0614e56 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni
@@ -197,7 +197,8 @@ # Not supported for macOS (see docs/mac_lld.md), and not functional at all for # iOS. But used for mac cross-compile on linux (may not work properly). # The default linker everywhere else. - use_lld = is_clang && (!is_apple || host_os == "linux") + use_lld = + is_clang && (!is_apple || (target_os == "mac" && chrome_pgo_phase != 1)) } declare_args() {
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index d994627a..902e69f7 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -5.20210705.0.1 +5.20210706.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index d994627a..c69fb0d 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -5.20210705.0.1 +5.20210706.0.1
diff --git a/chrome/VERSION b/chrome/VERSION index 05c307a..5fa11c77 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=93 MINOR=0 -BUILD=4567 +BUILD=4568 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 189cce11..b120b2ad 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -321,6 +321,7 @@ "//chrome/android/webapk/libs/common:splash_java", "//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java", "//chrome/browser/android/browserservices/intents:java", + "//chrome/browser/android/browserservices/metrics:java", "//chrome/browser/android/browserservices/verification:java", "//chrome/browser/android/crypto:java", "//chrome/browser/android/lifecycle:java",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index ee0b70bc..d545a9dc 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -181,7 +181,6 @@ "java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetProvider.java", "java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetProxy.java", "java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetServiceImpl.java", - "java/src/org/chromium/chrome/browser/browserservices/BrowserServicesMetrics.java", "java/src/org/chromium/chrome/browser/browserservices/BrowserServicesStore.java", "java/src/org/chromium/chrome/browser/browserservices/ClearDataDialogActivity.java", "java/src/org/chromium/chrome/browser/browserservices/ClearDataDialogResultRecorder.java",
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java index 856704e..27502d6 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java
@@ -5,15 +5,14 @@ package org.chromium.chrome.browser.autofill_assistant; import static androidx.test.espresso.Espresso.onView; -import static androidx.test.espresso.action.ViewActions.actionWithAssertions; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.scrollTo; import static androidx.test.espresso.action.ViewActions.typeText; import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast; import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; @@ -26,6 +25,7 @@ import static org.chromium.chrome.browser.autofill_assistant.AssistantTagsForTesting.RECYCLER_VIEW_TAG; import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.getAbsoluteBoundingRect; import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.startAutofillAssistant; +import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.tapElement; import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewAssertionTrue; import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewMatchesCondition; import static org.chromium.chrome.browser.autofill_assistant.ProtoTestUtil.toCssSelector; @@ -37,15 +37,10 @@ import static org.chromium.chrome.browser.autofill_assistant.proto.ConfigureBottomSheetProto.ViewportResizing.RESIZE_VISUAL_VIEWPORT; import android.graphics.Rect; -import android.os.Build.VERSION_CODES; import android.support.test.InstrumentationRegistry; import androidx.test.espresso.Espresso; -import androidx.test.espresso.ViewAction; import androidx.test.espresso.action.GeneralLocation; -import androidx.test.espresso.action.GeneralSwipeAction; -import androidx.test.espresso.action.Press; -import androidx.test.espresso.action.Swipe; import androidx.test.filters.MediumTest; import org.hamcrest.Matchers; @@ -57,7 +52,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; @@ -69,9 +63,14 @@ import org.chromium.chrome.browser.autofill_assistant.proto.ConfigureBottomSheetProto; import org.chromium.chrome.browser.autofill_assistant.proto.ConfigureBottomSheetProto.PeekMode; import org.chromium.chrome.browser.autofill_assistant.proto.ConfigureBottomSheetProto.ViewportResizing; +import org.chromium.chrome.browser.autofill_assistant.proto.ConfigureUiStateProto; +import org.chromium.chrome.browser.autofill_assistant.proto.ConfigureUiStateProto.OverlayBehavior; import org.chromium.chrome.browser.autofill_assistant.proto.DetailsProto; +import org.chromium.chrome.browser.autofill_assistant.proto.ElementConditionProto; +import org.chromium.chrome.browser.autofill_assistant.proto.ElementConditionsProto; import org.chromium.chrome.browser.autofill_assistant.proto.PromptProto; import org.chromium.chrome.browser.autofill_assistant.proto.PromptProto.Choice; +import org.chromium.chrome.browser.autofill_assistant.proto.SelectorProto; import org.chromium.chrome.browser.autofill_assistant.proto.ShowCastProto; import org.chromium.chrome.browser.autofill_assistant.proto.ShowDetailsProto; import org.chromium.chrome.browser.autofill_assistant.proto.SupportedScriptProto; @@ -144,7 +143,12 @@ // Focus on the bottom element. list.add(ActionProto.newBuilder() .setShowCast(ShowCastProto.newBuilder().setElementToPresent( - toCssSelector("p.bottom"))) + toCssSelector("div.bottom"))) + .build()); + // Hides the overlay + list.add(ActionProto.newBuilder() + .setConfigureUiState(ConfigureUiStateProto.newBuilder().setOverlayBehavior( + OverlayBehavior.HIDDEN)) .build()); if (withDetails) { // ShowDetails. @@ -158,7 +162,42 @@ .build()))) .build()); } - // Add "Done" button. + // First prompt, at this point the sheet is expanded. + list.add(ActionProto.newBuilder() + .setPrompt(PromptProto.newBuilder().addChoices( + Choice.newBuilder().setChip(ChipProto.newBuilder() + .setType(ChipType.DONE_ACTION) + .setText("Collapse")))) + .build()); + // Collapse the sheet. + list.add(ActionProto.newBuilder() + .setConfigureBottomSheet( + ConfigureBottomSheetProto.newBuilder().setCollapse(true)) + .build()); + // Second prompt, at this point the sheet should be collapsed. + // Since the sheet is collapsed we can't click a button to finish the action, so we add an + // element condition to be able to finish by clicking an element in the website. + SelectorProto touchArea = toCssSelector("#touch_area"); + ElementConditionProto autoSelectCondition = + ElementConditionProto.newBuilder() + .setNoneOf(ElementConditionsProto.newBuilder().addConditions( + ElementConditionProto.newBuilder().setMatch(touchArea))) + .build(); + list.add(ActionProto.newBuilder() + .setPrompt(PromptProto.newBuilder() + .addChoices( + Choice.newBuilder() + .setChip(ChipProto.newBuilder().setText( + "Expand")) + .setAutoSelectWhen(autoSelectCondition)) + .setDisableForceExpandSheet(true)) + .build()); + // Expand the sheet. + list.add(ActionProto.newBuilder() + .setConfigureBottomSheet( + ConfigureBottomSheetProto.newBuilder().setExpand(true)) + .build()); + // Final prompt, the sheet should be expanded again. list.add(ActionProto.newBuilder() .setPrompt(PromptProto.newBuilder().addChoices( Choice.newBuilder().setChip(ChipProto.newBuilder() @@ -171,121 +210,117 @@ @Test @MediumTest - @DisabledTest(message = "crbug.com/1059442") public void testNoResize() { AutofillAssistantTestService testService = new AutofillAssistantTestService( Collections.singletonList(makeScript(NO_RESIZE, HANDLE, false))); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); + waitUntilViewMatchesCondition(withText("Collapse"), isDisplayingAtLeast(90)); checkElementIsCoveredByBottomsheet("bottom", true); - onView(withId(R.id.swipe_indicator)).perform(swipeDownToMinimize()); + onView(withText("Collapse")).perform(click()); waitUntilViewMatchesCondition(withText("Hello world!"), not(isDisplayed())); // Since no resizing of the viewport happens in this mode, the element is partially covered - // even when the bottomsheet is minimized + // even when the bottom sheet is minimized checkElementIsCoveredByBottomsheet("bottom", true); - onView(withText("Done")).check(matches(not(isDisplayed()))); - onView(withId(R.id.swipe_indicator)).perform(swipeUpToExpand()); - checkElementIsCoveredByBottomsheet("bottom", true); - waitUntilViewMatchesCondition(withText("Hello world!"), isDisplayed()); } @Test @MediumTest - @DisabledTest(message = "crbug.com/1059442") - public void testResizeLayoutViewport() { + public void testResizeLayoutViewport() throws Exception { AutofillAssistantTestService testService = new AutofillAssistantTestService( Collections.singletonList(makeScript(RESIZE_LAYOUT_VIEWPORT, HANDLE, false))); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); + waitUntilViewMatchesCondition(withText("Collapse"), isDisplayingAtLeast(90)); // The viewport should be resized so that the bottom element is not covered by the bottom // sheet. checkElementIsCoveredByBottomsheet("bottom", false); - onView(withId(R.id.swipe_indicator)).perform(swipeDownToMinimize()); + onView(withText("Collapse")).perform(click()); // Minimizing the bottomsheet should completely uncover the bottom element. waitUntilViewMatchesCondition(withText("Hello world!"), not(isDisplayed())); checkElementIsCoveredByBottomsheet("bottom", false); - onView(withText("Done")).check(matches(not(isDisplayed()))); - onView(withId(R.id.swipe_indicator)).perform(swipeUpToExpand()); + onView(withText("Expand")).check(matches(not(isDisplayed()))); + // We tap the element as a way of ending the action without having to manually expand the + // sheet. + tapElement(mTestRule, "touch_area"); checkElementIsCoveredByBottomsheet("bottom", true); waitUntilViewMatchesCondition(withText("Hello world!"), isDisplayed()); } @Test @MediumTest - @DisabledTest(message = "crbug.com/1059442") - public void testResizeVisualViewport() { + public void testResizeVisualViewport() throws Exception { AutofillAssistantTestService testService = new AutofillAssistantTestService( Collections.singletonList(makeScript(RESIZE_VISUAL_VIEWPORT, HANDLE, false))); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); + waitUntilViewMatchesCondition(withText("Collapse"), isDisplayingAtLeast(90)); // The viewport should be resized so that the bottom element is not covered by the bottom // sheet. checkElementIsCoveredByBottomsheet("bottom", false); - onView(withId(R.id.swipe_indicator)).perform(swipeDownToMinimize()); + onView(withText("Collapse")).perform(click()); waitUntilViewMatchesCondition(withText("Hello world!"), not(isDisplayed())); checkElementIsCoveredByBottomsheet("bottom", false); - onView(withText("Done")).check(matches(not(isDisplayed()))); - onView(withId(R.id.swipe_indicator)).perform(swipeUpToExpand()); + onView(withText("Expand")).check(matches(not(isDisplayed()))); + // We tap the element as a way of ending the action without having to manually expand the + // sheet. + tapElement(mTestRule, "touch_area"); checkElementIsCoveredByBottomsheet("bottom", true); waitUntilViewMatchesCondition(withText("Hello world!"), isDisplayed()); } @Test @MediumTest - @DisableIf.Build(message = "Flaky on Android P, see https://crbug.com/1166168", - sdk_is_greater_than = VERSION_CODES.O_MR1, sdk_is_less_than = VERSION_CODES.Q) - public void - testHandleHeader() { + public void testHandleHeader() throws Exception { AutofillAssistantTestService testService = new AutofillAssistantTestService( Collections.singletonList(makeScript(RESIZE_LAYOUT_VIEWPORT, HANDLE_HEADER, true))); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); - waitUntilViewMatchesCondition(withText("Details title"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Collapse"), isDisplayingAtLeast(90)); checkElementIsCoveredByBottomsheet("bottom", true); - onView(withId(R.id.swipe_indicator)).perform(swipeDownToMinimize()); + onView(withText("Collapse")).perform(click()); checkElementIsCoveredByBottomsheet("bottom", false); // The header should be visible even when minimized - onView(withText("Hello world!")).check(matches(isCompletelyDisplayed())); + onView(withText("Hello world!")).check(matches(isDisplayingAtLeast(90))); onView(withText("Details title")).check(matches(not(isDisplayed()))); - onView(withText("Done")).check(matches(not(isDisplayed()))); - onView(withId(R.id.swipe_indicator)).perform(swipeUpToExpand()); + onView(withText("Expand")).check(matches(not(isDisplayed()))); + // We tap the element as a way of ending the action without having to manually expand the + // sheet. + tapElement(mTestRule, "touch_area"); checkElementIsCoveredByBottomsheet("bottom", true); - onView(withText("Details title")).check(matches(isCompletelyDisplayed())); + waitUntilViewMatchesCondition(withText("Details title"), isDisplayingAtLeast(90)); } @Test @MediumTest - @DisableIf.Build(message = "Flaky on Android P, see https://crbug.com/1166168", - sdk_is_greater_than = VERSION_CODES.O_MR1, sdk_is_less_than = VERSION_CODES.Q) - public void - testHandleHeaderCarousels() { + public void testHandleHeaderCarousels() { AutofillAssistantTestService testService = new AutofillAssistantTestService(Collections.singletonList( makeScript(RESIZE_LAYOUT_VIEWPORT, HANDLE_HEADER_CAROUSELS, true))); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); - waitUntilViewMatchesCondition(withText("Details title"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Collapse"), isDisplayingAtLeast(90)); checkElementIsCoveredByBottomsheet("bottom", true); - onView(withId(R.id.swipe_indicator)).perform(swipeDownToMinimize()); + onView(withText("Collapse")).perform(click()); checkElementIsCoveredByBottomsheet("bottom", false); // The header should be visible even when minimized - onView(withText("Hello world!")).check(matches(isCompletelyDisplayed())); + onView(withText("Hello world!")).check(matches(isDisplayingAtLeast(90))); // The button gets initially hidden while swiping down but should reappear shortly after. - waitUntilViewMatchesCondition(withText("Done"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Expand"), isDisplayingAtLeast(90)); onView(withText("Details title")).check(matches(not(isDisplayed()))); - onView(withId(R.id.swipe_indicator)).perform(swipeUpToExpand()); + onView(withText("Expand")).perform(click()); checkElementIsCoveredByBottomsheet("bottom", true); - onView(withText("Details title")).check(matches(isCompletelyDisplayed())); + onView(withText("Details title")).check(matches(isDisplayingAtLeast(90))); } @Test @@ -323,22 +358,21 @@ AutofillAssistantTestService testService = new AutofillAssistantTestService(Collections.singletonList(script)); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Continue"), isCompletelyDisplayed()); - - onView(withId(R.id.control_container)).check(matches(isCompletelyDisplayed())); + waitUntilViewMatchesCondition(withText("Continue"), isDisplayingAtLeast(90)); + onView(withId(R.id.control_container)).check(matches(isDisplayingAtLeast(90))); onView(withText("Title 0")).perform(click()); waitUntilViewMatchesCondition( - withContentDescription("Text input 0"), isCompletelyDisplayed()); + withContentDescription("Text input 0"), isDisplayingAtLeast(90)); // Typing text will show the soft keyboard, leading to resize of the Chrome window. onView(withContentDescription("Text input 0")).perform(typeText("Hello World!")); - onView(withId(R.id.control_container)).check(matches(isCompletelyDisplayed())); + onView(withId(R.id.control_container)).check(matches(isDisplayingAtLeast(90))); onView(allOf(withContentDescription("Close"), isDisplayed())) - .check(matches(isCompletelyDisplayed())); + .check(matches(isDisplayingAtLeast(90))); // Closing the soft keyboard will restore the window size. Espresso.closeSoftKeyboard(); onView(withContentDescription("Text input 0")).check(matches(isDisplayed())); - onView(withId(R.id.control_container)).check(matches(isCompletelyDisplayed())); - onView(withText("Continue")).check(matches(isCompletelyDisplayed())); + onView(withId(R.id.control_container)).check(matches(isDisplayingAtLeast(90))); + onView(withText("Continue")).check(matches(isDisplayingAtLeast(90))); // Scroll down. onView(withText("Title 19")).check(matches(not(isDisplayed()))); @@ -371,10 +405,9 @@ AutofillAssistantTestService testService = new AutofillAssistantTestService(Collections.singletonList(script)); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Cancel"), isCompletelyDisplayed()); - + waitUntilViewMatchesCondition(withText("Cancel"), isDisplayingAtLeast(90)); onView(withText("Cancel")).perform(click()); - waitUntilViewMatchesCondition(withText(R.string.undo), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText(R.string.undo), isDisplayingAtLeast(90)); onView(withText("Cancel")).check(doesNotExist()); onView(withText(R.string.undo)).perform(click()); waitUntilViewMatchesCondition(withText("Cancel"), isDisplayed()); @@ -404,10 +437,10 @@ AutofillAssistantTestService testService = new AutofillAssistantTestService(Collections.singletonList(script), clientSettings); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Cancel"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Cancel"), isDisplayingAtLeast(90)); onView(withText("Cancel")).perform(click()); - waitUntilViewMatchesCondition(withText(R.string.undo), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText(R.string.undo), isDisplayingAtLeast(90)); onView(withText("Cancel")).check(doesNotExist()); waitUntilViewAssertionTrue(withText(R.string.undo), doesNotExist(), 3000L); onView(withId(R.id.autofill_assistant)).check(doesNotExist()); @@ -468,14 +501,14 @@ new AutofillAssistantTestService(Collections.singletonList(script)); startAutofillAssistant(mTestRule.getActivity(), testService); - waitUntilViewMatchesCondition(withText("Focus element"), isCompletelyDisplayed()); + waitUntilViewMatchesCondition(withText("Focus element"), isDisplayingAtLeast(90)); onView(withText("Focus element")).perform(click()); // Check that the sheet is in peek state and has a sticky button. There is // a second button still in the hidden carousel. waitUntilViewMatchesCondition( allOf(withText("Sticky next"), isDescendantOfA(withId(R.id.header))), - isCompletelyDisplayed()); + isDisplayingAtLeast(90)); onView(allOf(withText("Sticky next"), isDescendantOfA(withTagValue(is(RECYCLER_VIEW_TAG))))) .check(matches(not(isDisplayed()))); onView(allOf(withText("Sticky next"), isDescendantOfA(withId(R.id.header)))) @@ -485,26 +518,7 @@ // not the header. waitUntilViewMatchesCondition( allOf(withText("Done"), isDescendantOfA(withTagValue(is(RECYCLER_VIEW_TAG)))), - isCompletelyDisplayed()); - } - - private ViewAction swipeDownToMinimize() { - return actionWithAssertions( - new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER, view -> { - float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view); - coordinates[1] = - view.getContext().getResources().getDisplayMetrics().heightPixels; - return coordinates; - }, Press.FINGER)); - } - - private ViewAction swipeUpToExpand() { - return actionWithAssertions( - new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER, view -> { - float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view); - coordinates[1] = 0; - return coordinates; - }, Press.FINGER)); + isDisplayingAtLeast(90)); } private void checkElementIsCoveredByBottomsheet(String elementId, boolean shouldBeCovered) {
diff --git a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java index 060423a..3da930f 100644 --- a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java +++ b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java
@@ -219,7 +219,8 @@ quick = getGridTabListDelegate().prepareOverview(); } - // Skip shrinking animation when there is no tab in current tab model. + // Skip shrinking animation when there is no tab in current tab model. If it's showing start + // surface, we don't show the shrink tab animation. boolean isCurrentTabModelEmpty = mTabModelSelector.getCurrentModel().getCount() == 0; boolean showShrinkingAnimation = animate && TabUiFeatureUtilities.isTabToGtsAnimationEnabled() && !isCurrentTabModelEmpty @@ -571,13 +572,16 @@ super.updateSceneLayer(viewport, contentViewport, layerTitleCache, tabContentManager, resourceManager, browserControls); assert mSceneLayer != null; + TabListDelegate currentTabListDelegate = isShowingStartSurface() + ? getCarouselOrSingleTabListDelegate() + : getGridTabListDelegate(); // The content viewport is intentionally sent as both params below. mSceneLayer.pushLayers(getContext(), contentViewport, contentViewport, this, layerTitleCache, tabContentManager, resourceManager, browserControls, TabUiFeatureUtilities.isTabToGtsAnimationEnabled() - ? getGridTabListDelegate().getResourceId() + ? currentTabListDelegate.getResourceId() : 0, - mBackgroundAlpha, mStartSurface.getGridTabListDelegate().getTabListTopOffset()); + mBackgroundAlpha, currentTabListDelegate.getTabListTopOffset()); mFrameCount++; if (mLastFrameTime != 0) { long elapsed = SystemClock.elapsedRealtime() - mLastFrameTime;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java index 589e6b5c..822ea94 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java
@@ -14,9 +14,9 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; import org.chromium.base.task.PostTask; -import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics; import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient; import org.chromium.chrome.browser.browserservices.intents.WebappConstants; +import org.chromium.chrome.browser.browserservices.metrics.BrowserServicesTimingMetrics; import org.chromium.chrome.browser.notifications.WebPlatformNotificationMetrics; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabLaunchType; @@ -97,8 +97,8 @@ Context context = ContextUtils.getApplicationContext(); List<ResolveInfo> resolveInfos; - try (BrowserServicesMetrics.TimingMetric t = - BrowserServicesMetrics.getServiceTabResolveInfoTimingContext()) { + try (BrowserServicesTimingMetrics.TimingMetric t = + BrowserServicesTimingMetrics.getServiceTabResolveInfoTimingContext()) { resolveInfos = WebApkValidator.resolveInfosForUrl(context, url); } String webApkPackageName = WebApkValidator.findFirstWebApkPackage(context, resolveInfos);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ClientAppBroadcastReceiver.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ClientAppBroadcastReceiver.java index 3dbd4f5..0bec068 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ClientAppBroadcastReceiver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ClientAppBroadcastReceiver.java
@@ -10,6 +10,7 @@ import org.chromium.base.Log; import org.chromium.chrome.browser.ChromeApplicationImpl; +import org.chromium.chrome.browser.browserservices.metrics.BrowserServicesTimingMetrics; import org.chromium.chrome.browser.browserservices.permissiondelegation.PermissionUpdater; import org.chromium.chrome.browser.metrics.WebApkUma; import org.chromium.chrome.browser.version.ChromeVersionInfo; @@ -114,9 +115,8 @@ } } - try (BrowserServicesMetrics.TimingMetric unused = - BrowserServicesMetrics.getClientAppDataLoadTimingContext()) { - + try (BrowserServicesTimingMetrics.TimingMetric unused = + BrowserServicesTimingMetrics.getClientAppDataLoadTimingContext()) { // The ClientAppDataRegister (because it uses Preferences) is loaded lazily, so to time // opening the file we must include the first read as well. if (!mRegister.chromeHoldsDataForPackage(uid)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/PermissionUpdater.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/PermissionUpdater.java index a5cf34e..b5672f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/PermissionUpdater.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/permissiondelegation/PermissionUpdater.java
@@ -10,7 +10,7 @@ import org.chromium.base.Log; import org.chromium.base.PackageManagerUtils; import org.chromium.chrome.browser.ChromeApplicationImpl; -import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics; +import org.chromium.chrome.browser.browserservices.metrics.BrowserServicesTimingMetrics; import org.chromium.components.embedder_support.util.Origin; import javax.inject.Inject; @@ -73,8 +73,8 @@ browsableIntent.setAction(Intent.ACTION_VIEW); browsableIntent.addCategory(Intent.CATEGORY_BROWSABLE); - try (BrowserServicesMetrics.TimingMetric unused = - BrowserServicesMetrics.getBrowsableIntentResolutionTimingContext()) { + try (BrowserServicesTimingMetrics.TimingMetric unused = + BrowserServicesTimingMetrics.getBrowsableIntentResolutionTimingContext()) { return PackageManagerUtils.resolveActivity(browsableIntent, 0) != null; } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifier.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifier.java index 81308e2..f943af2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifier.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifier.java
@@ -8,7 +8,6 @@ import androidx.browser.customtabs.CustomTabsService; import org.chromium.base.Promise; -import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.browserservices.ui.controller.Verifier; import org.chromium.chrome.browser.browserservices.verification.OriginVerifier; @@ -64,9 +63,8 @@ // TODO(peconn): See if we can get rid of the dependency on Web Contents. WebContents webContents = tabProvider.getTab() != null ? tabProvider.getTab().getWebContents() : null; - mOriginVerifier = originVerifierFactory.create(clientPackageNameProvider.get(), - RELATIONSHIP, webContents, externalAuthUtils, - new BrowserServicesMetrics.OriginVerifierMetricsListener()); + mOriginVerifier = originVerifierFactory.create( + clientPackageNameProvider.get(), RELATIONSHIP, webContents, externalAuthUtils); lifecycleDispatcher.register(this); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPicker.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPicker.java index 0000acd..3d31e1d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPicker.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPicker.java
@@ -6,8 +6,8 @@ import static android.app.NotificationManager.IMPORTANCE_NONE; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_INITIAL; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_SUBSEQUENT; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS_QUIET; import android.annotation.TargetApi; import android.app.NotificationChannel; @@ -82,8 +82,7 @@ if (!mNotificationManager.areNotificationsEnabled()) return false; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return true; - return isChannelEnabled(TWA_DISCLOSURE_INITIAL) - && isChannelEnabled(TWA_DISCLOSURE_SUBSEQUENT); + return isChannelEnabled(WEBAPPS) && isChannelEnabled(WEBAPPS_QUIET); } @TargetApi(Build.VERSION_CODES.O)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotification.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotification.java index 32b20dee..ce82d031 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotification.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotification.java
@@ -73,6 +73,10 @@ NotificationWrapper notification = createNotification(firstTime, mCurrentScope, packageName); mNotificationManager.notify(notification); + NotificationUmaTracker.getInstance().onNotificationShown(firstTime + ? NotificationUmaTracker.SystemNotificationType.TWA_DISCLOSURE_INITIAL + : NotificationUmaTracker.SystemNotificationType.TWA_DISCLOSURE_SUBSEQUENT, + notification.getNotification()); mModel.get(DISCLOSURE_EVENTS_CALLBACK).onDisclosureShown(); } @@ -92,12 +96,12 @@ if (firstTime) { umaType = NotificationUmaTracker.SystemNotificationType.TWA_DISCLOSURE_INITIAL; preOPriority = NotificationCompat.PRIORITY_MAX; - channelId = ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_INITIAL; + channelId = ChromeChannelDefinitions.ChannelId.WEBAPPS; notificationId = NOTIFICATION_ID_TWA_DISCLOSURE_INITIAL; } else { umaType = NotificationUmaTracker.SystemNotificationType.TWA_DISCLOSURE_SUBSEQUENT; preOPriority = NotificationCompat.PRIORITY_MIN; - channelId = ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_SUBSEQUENT; + channelId = ChromeChannelDefinitions.ChannelId.WEBAPPS_QUIET; notificationId = NOTIFICATION_ID_TWA_DISCLOSURE_SUBSEQUENT; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java index 006b419..0ab1ec0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java
@@ -30,7 +30,6 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.PostTask; import org.chromium.chrome.browser.IntentHandler; -import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics; import org.chromium.chrome.browser.browserservices.PostMessageHandler; import org.chromium.chrome.browser.browserservices.verification.OriginVerifier; import org.chromium.chrome.browser.browserservices.verification.OriginVerifier.OriginVerificationListener; @@ -483,8 +482,7 @@ }; params.originVerifier = mOriginVerifierFactory.create(params.getPackageName(), relation, - /* webContents= */ null, /* externalAuthUtils= */ null, - new BrowserServicesMetrics.OriginVerifierMetricsListener()); + /* webContents= */ null, /* externalAuthUtils= */ null); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { params.originVerifier.start(listener, origin); });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryAdapter.java index 818674620..07d69cf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryAdapter.java
@@ -404,6 +404,14 @@ if (mAreHeadersInitialized) setHeaders(); } + /** + * Sets the query text. + * @param query The text to be searched for. + */ + void setQueryText(String query) { + mQueryText = query; + } + @VisibleForTesting ItemGroup getFirstGroupForTests() { return getGroupAt(0).first;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java index ab9e3e6..0a39bec6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java
@@ -97,6 +97,7 @@ private final boolean mIsSeparateActivity; private final boolean mIsIncognito; private final boolean mIsScrollToLoadDisabled; + private final String mHostName; private final TabCreatorManager mTabCreatorManager; private final Supplier<Tab> mTabSupplier; private HistoryAdapter mHistoryAdapter; @@ -115,6 +116,7 @@ * @param isIncognito Whether the incognito tab model is currently selected. * @param shouldShowPrivacyDisclaimers Whether the privacy disclaimers should be shown, if * available. + * @param hostName The hostName to retrieve history entries for, or null for all hosts. * @param selectionDelegate A class responsible for handling list item selection, null for * unselectable items. * @param tabCreatorManager Allows creation of tabs in different models, null if the history UI @@ -124,13 +126,14 @@ */ public HistoryContentManager(@NonNull Activity activity, @NonNull Observer observer, boolean isSeparateActivity, boolean isIncognito, boolean shouldShowPrivacyDisclaimers, - @Nullable SelectionDelegate<HistoryItem> selectionDelegate, + @Nullable String hostName, @Nullable SelectionDelegate<HistoryItem> selectionDelegate, @Nullable TabCreatorManager tabCreatorManager, @Nullable Supplier<Tab> tabSupplier) { mActivity = activity; mObserver = observer; mIsSeparateActivity = isSeparateActivity; mIsIncognito = isIncognito; mShouldShowPrivacyDisclaimers = shouldShowPrivacyDisclaimers; + mHostName = hostName; mIsScrollToLoadDisabled = ChromeAccessibilityUtil.get().isAccessibilityEnabled() || ChromeAccessibilityUtil.isHardwareKeyboardAttached( mActivity.getResources().getConfiguration()); @@ -217,6 +220,12 @@ /** Initialize the HistoryContentManager to start loading items. */ public void initialize() { + if (mHostName != null) { + // Filtering the adapter to only the results from this particular host. + // TODO(crbug.com/1173154): Add robust filtering for just items with a matching host in + // backend. QueryText could return entries that contain the string anywhere. + mHistoryAdapter.setQueryText(mHostName); + } mHistoryAdapter.initialize(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java index bbedcaa5..3562fd9a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
@@ -109,9 +109,9 @@ // 2. Create HistoryContentManager and initialize recycler view. boolean shouldShowInfoHeader = SharedPreferencesManager.getInstance().readBoolean( ChromePreferenceKeys.HISTORY_SHOW_HISTORY_INFO, true); - mContentManager = - new HistoryContentManager(mActivity, this, isSeparateActivity, isIncognito, - shouldShowInfoHeader, mSelectionDelegate, tabCreatorManager, tabSupplier); + mContentManager = new HistoryContentManager(mActivity, this, isSeparateActivity, + isIncognito, shouldShowInfoHeader, /* hostName */ null, mSelectionDelegate, + tabCreatorManager, tabSupplier); mSelectableListLayout.initializeRecyclerView( mContentManager.getAdapter(), mContentManager.getRecyclerView());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/ChromePageInfoControllerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/ChromePageInfoControllerDelegate.java index 5e2f63d..45f1726 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/ChromePageInfoControllerDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/ChromePageInfoControllerDelegate.java
@@ -218,8 +218,8 @@ @Override public PageInfoSubpageController createHistoryController( - PageInfoMainController mainController, PageInfoRowView rowView, String url) { - return new PageInfoHistoryController(mainController, rowView, this, url); + PageInfoMainController mainController, PageInfoRowView rowView, String host) { + return new PageInfoHistoryController(mainController, rowView, this, host); } /** @@ -283,4 +283,12 @@ if (activity.isFinishing()) return null; return activity.getSupportFragmentManager(); } + + /** + * {@inheritDoc} + */ + @Override + public boolean isIncognito() { + return mProfile.isOffTheRecord(); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoHistoryController.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoHistoryController.java index 524675db..fd6bfc7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoHistoryController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoHistoryController.java
@@ -7,6 +7,8 @@ import android.view.ViewGroup; import org.chromium.chrome.R; +import org.chromium.chrome.browser.history.HistoryContentManager; +import org.chromium.chrome.browser.history.HistoryItem; import org.chromium.components.page_info.PageInfoAction; import org.chromium.components.page_info.PageInfoControllerDelegate; import org.chromium.components.page_info.PageInfoMainController; @@ -14,23 +16,24 @@ import org.chromium.components.page_info.PageInfoSubpageController; /** - * Controller to manage the history elements of PageInfo. Including the row view, subpage, and - * forget site button. + * Class for controlling the page info history section. */ -public class PageInfoHistoryController implements PageInfoSubpageController { +public class PageInfoHistoryController + implements PageInfoSubpageController, HistoryContentManager.Observer { private final PageInfoMainController mMainController; private final PageInfoRowView mRowView; private final PageInfoControllerDelegate mDelegate; private final String mTitle; - private final String mPageUrl; + private final String mHost; + private HistoryContentManager mContentManager; public PageInfoHistoryController(PageInfoMainController mainController, PageInfoRowView rowView, - PageInfoControllerDelegate delegate, String pageUrl) { + PageInfoControllerDelegate delegate, String host) { mMainController = mainController; mRowView = rowView; mDelegate = delegate; - mPageUrl = pageUrl; mTitle = mRowView.getContext().getResources().getString(R.string.page_info_history_title); + mHost = host; setupHistoryRow(); } @@ -47,17 +50,28 @@ @Override public View createViewForSubpage(ViewGroup parent) { - // TODO(crbug.com/1173154): Should launch the history subpage. - return new View(mRowView.getContext()); + assert !mDelegate.isIncognito(); + mContentManager = new HistoryContentManager(mMainController.getActivity(), this, + /* isSeparateActivity */ false, + /* isIncognito */ false, /* shouldShowPrivacyDisclaimers */ true, mHost, + /* selectionDelegate */ null, /* tabCreatorManager */ null, + /* tabSupplier */ null); + mContentManager.initialize(); + return mContentManager.getRecyclerView(); } @Override - public void onSubpageRemoved() {} + public void onSubpageRemoved() { + if (mContentManager != null) { + mContentManager.onDestroyed(); + mContentManager = null; + } + } private void setupHistoryRow() { PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams(); rowParams.title = getRowTitle(); - rowParams.visible = mDelegate.isSiteSettingsAvailable(); + rowParams.visible = mDelegate.isSiteSettingsAvailable() && !mDelegate.isIncognito(); rowParams.iconResId = R.drawable.ic_history_googblue_24dp; rowParams.clickCallback = this::launchSubpage; @@ -65,10 +79,47 @@ } private String getRowTitle() { - // TODO(crbug.com/1173154): This should return string about how long since last visit. + // TODO(crbug.com/1173154): This should return a string about how long since the last visit. return mTitle; } @Override - public void clearData() {} + public void clearData() { + // TODO(crbug.com/1173154): Add functionality for clear history for this site. + return; + } + + // HistoryContentManager.Observer + @Override + public void onScrolledCallback(boolean loadedMore) {} + + // HistoryContentManager.Observer + @Override + public void onItemClicked(HistoryItem item) { + // TODO(crbug.com/1173154): Add metrics for item clicked. + return; + } + + // HistoryContentManager.Observer + @Override + public void onItemRemoved(HistoryItem item) { + // TODO(crbug.com/1173154): Add metrics for item removed. + return; + } + + // HistoryContentManager.Observer + @Override + public void onClearBrowsingDataClicked() { + // TODO(crbug.com/1173154): Add functionality for "clear history" button click and + // change the name of the current clear browsing data button. + return; + } + + // HistoryContentManager.Observer + @Override + public void onPrivacyDisclaimerHasChanged() {} + + // HistoryContentManager.Observer + @Override + public void onUserAccountStateChanged() {} }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninBridge.java index ce9e73a..5e2441e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninBridge.java
@@ -85,8 +85,6 @@ final List<Account> accounts = AccountUtils.getAccountsIfFulfilledOrEmpty( AccountManagerFacadeProvider.getInstance().getAccounts()); if (accounts.isEmpty()) { - // TODO(https://crbug.com/1119720): Show the bottom sheet when no accounts on device - // in the future. This disabling is only temporary. SigninMetricsUtils.logAccountConsistencyPromoAction( AccountConsistencyPromoAction.SUPPRESSED_NO_ACCOUNTS); return;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java index 418fc6c..1d271c03 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java
@@ -52,6 +52,8 @@ import org.chromium.chrome.browser.browsing_data.BrowsingDataType; import org.chromium.chrome.browser.browsing_data.TimePeriod; import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.browser.history.HistoryContentManager; +import org.chromium.chrome.browser.history.StubbedHistoryProvider; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; import org.chromium.chrome.browser.profiles.Profile; @@ -253,6 +255,7 @@ setThirdPartyCookieBlocking(CookieControlsMode.INCOGNITO_ONLY); clearPermissions(); + HistoryContentManager.setProviderForTests(null); } /** @@ -448,6 +451,31 @@ } /** + * Tests the history page of the PageInfo UI. + */ + @Test + @MediumTest + @Feature({"RenderTest"}) + @Features.EnableFeatures(PageInfoFeatures.PAGE_INFO_HISTORY_NAME) + public void testShowHistorySubpage() throws IOException { + StubbedHistoryProvider historyProvider = new StubbedHistoryProvider(); + // Need to always have the same dates for render tests. + // April 4, 2021 12:00:00 GMT+00:00 + long timestamp1 = 1617537600000L; + historyProvider.addItem(StubbedHistoryProvider.createHistoryItem(1, timestamp1)); + // June 4, 2021 12:00:00 GMT+00:00 + long timestamp2 = 1622808000000L; + historyProvider.addItem(StubbedHistoryProvider.createHistoryItem(1, timestamp2)); + HistoryContentManager.setProviderForTests(historyProvider); + + loadUrlAndOpenPageInfo( + mTestServerRule.getServer().getURLWithHostName("www.example.com", "/")); + onView(withId(R.id.page_info_history_row)).perform(click()); + onViewWaiting(allOf(withText(containsString("Jun 4, 2021")), isDisplayed())); + mRenderTestRule.render(getPageInfoView(), "PageInfo_HistorySubpage"); + } + + /** * Tests that the permissions page of the PageInfo UI is gone when there are no permissions * set. */
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsExportTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsExportTest.java index 9d964df..bebe0ff 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsExportTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsExportTest.java
@@ -19,7 +19,7 @@ import static androidx.test.espresso.intent.matcher.UriMatchers.hasHost; import static androidx.test.espresso.matcher.RootMatchers.withDecorView; import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA; -import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; import static androidx.test.espresso.matcher.ViewMatchers.withText; @@ -150,7 +150,7 @@ ReauthenticationManager.recordLastReauth( System.currentTimeMillis(), ReauthenticationManager.ReauthScope.BULK); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); Assert.assertNotNull(mTestHelper.getHandler().getExportTargetPath()); @@ -179,7 +179,7 @@ // Check that the warning dialog is displayed. onView(withText(R.string.settings_passwords_export_description)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); } /** @@ -214,7 +214,7 @@ // completed in the test. ReauthenticationManager.setSkipSystemReauth(true); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Now Chrome thinks it triggered the challenge and is waiting to be resumed. Once resumed @@ -254,11 +254,11 @@ openActionBarOverflowOrOptionsMenu( InstrumentationRegistry.getInstrumentation().getTargetContext()); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); onView(withText(R.string.password_export_set_lock_screen)) .inRoot(withDecorView(not(is(mainDecorView)))) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); } /** @@ -282,7 +282,7 @@ openActionBarOverflowOrOptionsMenu( InstrumentationRegistry.getInstrumentation().getTargetContext()); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Check that for re-triggering, the export menu item is enabled. @@ -309,7 +309,7 @@ openActionBarOverflowOrOptionsMenu( InstrumentationRegistry.getInstrumentation().getTargetContext()); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // The reauthentication dialog is skipped and the last reauthentication timestamp is not // reset. This looks like a failed reauthentication to PasswordSettings' onResume. @@ -347,7 +347,7 @@ // completed in the test. ReauthenticationManager.setSkipSystemReauth(true); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Check that Chrome indeed issued an (ignored) request to reauthenticate the user rather @@ -388,7 +388,7 @@ // Confirm the export warning to fire the sharing intent. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); intended(allOf(hasAction(equalTo(Intent.ACTION_CHOOSER)), @@ -438,7 +438,7 @@ // Confirm the export warning to fire the sharing intent. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); intended(allOf(hasAction(equalTo(Intent.ACTION_CHOOSER)), @@ -541,7 +541,7 @@ ReauthenticationManager.ReauthScope.BULK); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Call onResume to simulate that the user put Chrome into background by opening "recent @@ -581,7 +581,7 @@ // Verify that the warning dialog is shown and then dismiss it through pressing back (as // opposed to the cancel button). onView(withText(R.string.password_settings_export_action_title)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); Espresso.pressBack(); // Check that the cancellation succeeded by checking that the export menu is available and @@ -620,13 +620,13 @@ // Confirm the export warning to fire the sharing intent. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Before simulating the serialized passwords being received, check that the progress bar is // shown. onView(withText(R.string.settings_passwords_preparing_export)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); File tempFile = createFakeExportedPasswordsFile(); // Now pretend that passwords have been serialized. @@ -635,7 +635,7 @@ // Check that the progress bar is still shown, though, because the timer has not gone off // yet. onView(withText(R.string.settings_passwords_preparing_export)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); // Now mark the timer as gone off and check that the progress bar is hidden. allowProgressBarToBeHidden(); @@ -680,13 +680,13 @@ // Confirm the export warning to fire the sharing intent. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Before simulating the serialized passwords being received, check that the progress bar is // shown. onView(withText(R.string.settings_passwords_preparing_export)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); File tempFile = createFakeExportedPasswordsFile(); @@ -728,7 +728,7 @@ // Confirm the export warning to fire the sharing intent. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Simulate the minimal time for showing the progress bar to have passed, to ensure that it @@ -737,7 +737,7 @@ // Check that the progress bar is shown. onView(withText(R.string.settings_passwords_preparing_export)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); // Hit the Cancel button. onView(withText(R.string.cancel)).perform(click()); @@ -768,7 +768,7 @@ // Confirm the export warning. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Show an arbitrary error. This should replace the progress bar if that has been shown in @@ -778,7 +778,7 @@ // Check that the error prompt is showing. onView(withText(R.string.password_settings_export_error_title)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); // Hit the negative button on the error prompt. onView(withText(R.string.close)).perform(click()); @@ -810,7 +810,7 @@ // Confirm the export warning. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Show an arbitrary error but ensure that the positive button label is the one for "try @@ -823,7 +823,7 @@ // Check that there is again the export warning. onView(withText(R.string.password_settings_export_action_title)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); } /** @@ -849,7 +849,7 @@ // Confirm the export warning. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Show an arbitrary error but ensure that the positive button label is the one for the @@ -899,14 +899,14 @@ // Check that the confirmation dialog is showing and dismiss it. onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Check that now the error is displayed, instead of the progress bar. allowProgressBarToBeHidden(); onView(withText(R.string.settings_passwords_preparing_export)).check(doesNotExist()); onView(withText(R.string.password_settings_export_error_title)) - .check(matches(isDisplayed())); + .check(matches(isCompletelyDisplayed())); // Close the error dialog and abort the export. onView(withText(R.string.close)).perform(click()); @@ -929,7 +929,7 @@ // completed in the test. ReauthenticationManager.setSkipSystemReauth(true); onViewWaiting( - allOf(withText(R.string.password_settings_export_action_title), isDisplayed())) + allOf(withText(R.string.password_settings_export_action_title), isCompletelyDisplayed())) .perform(click()); // Now Chrome thinks it triggered the challenge and is waiting to be resumed. Once resumed
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifierTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifierTest.java index b0960645..28dc3d4 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifierTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/controller/trustedwebactivity/TwaVerifierTest.java
@@ -82,7 +82,7 @@ when(mIntentDataProvider.getTrustedWebActivityAdditionalOrigins()) .thenReturn(Collections.singletonList(ADDITIONAL_ORIGIN)); - when(mOriginVerifierFactory.create(anyString(), anyInt(), any(), any(), any())) + when(mOriginVerifierFactory.create(anyString(), anyInt(), any(), any())) .thenReturn(mOriginVerifier); when(mClientPackageNameProvider.get()).thenReturn("some.package.name");
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPickerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPickerTest.java index bea1239..ad95655e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPickerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/trustedwebactivity/DisclosureUiPickerTest.java
@@ -13,8 +13,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_INITIAL; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_SUBSEQUENT; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS_QUIET; import android.app.NotificationChannel; import android.os.Build; @@ -108,8 +108,8 @@ @Feature("TrustedWebActivities") public void picksSnackbar_whenInitialChannelIsDisabled() { setNotificationsEnabled(true); - setChannelEnabled(TWA_DISCLOSURE_INITIAL, false); - setChannelEnabled(TWA_DISCLOSURE_SUBSEQUENT, true); + setChannelEnabled(WEBAPPS, false); + setChannelEnabled(WEBAPPS_QUIET, true); mPicker.onFinishNativeInitialization(); verify(mSnackbar).showIfNeeded(); @@ -119,8 +119,8 @@ @Feature("TrustedWebActivities") public void picksSnackbar_whenSubsequentChannelIsDisabled() { setNotificationsEnabled(true); - setChannelEnabled(TWA_DISCLOSURE_INITIAL, true); - setChannelEnabled(TWA_DISCLOSURE_SUBSEQUENT, false); + setChannelEnabled(WEBAPPS, true); + setChannelEnabled(WEBAPPS_QUIET, false); mPicker.onFinishNativeInitialization(); verify(mSnackbar).showIfNeeded(); @@ -142,8 +142,8 @@ @Feature("TrustedWebActivities") public void picksNotification() { setNotificationsEnabled(true); - setChannelEnabled(TWA_DISCLOSURE_INITIAL, true); - setChannelEnabled(TWA_DISCLOSURE_SUBSEQUENT, true); + setChannelEnabled(WEBAPPS, true); + setChannelEnabled(WEBAPPS_QUIET, true); mPicker.onFinishNativeInitialization(); verify(mNotification).onStartWithNative();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotificationTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotificationTest.java index 865c391..4d9e299 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotificationTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/DisclosureNotificationTest.java
@@ -17,8 +17,8 @@ import static org.chromium.chrome.browser.browserservices.ui.TrustedWebActivityModel.DISCLOSURE_STATE_NOT_SHOWN; import static org.chromium.chrome.browser.browserservices.ui.TrustedWebActivityModel.DISCLOSURE_STATE_SHOWN; import static org.chromium.chrome.browser.browserservices.ui.TrustedWebActivityModel.PACKAGE_NAME; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_INITIAL; -import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.TWA_DISCLOSURE_SUBSEQUENT; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS; +import static org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId.WEBAPPS_QUIET; import android.content.Context; @@ -92,7 +92,7 @@ mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); NotificationWrapper notification = verifyAndGetNotification(); - assertEquals(TWA_DISCLOSURE_INITIAL, notification.getNotification().getChannelId()); + assertEquals(WEBAPPS, notification.getNotification().getChannelId()); } @Test @@ -101,7 +101,7 @@ mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); NotificationWrapper notification = verifyAndGetNotification(); - assertEquals(TWA_DISCLOSURE_SUBSEQUENT, notification.getNotification().getChannelId()); + assertEquals(WEBAPPS_QUIET, notification.getNotification().getChannelId()); } @Test
diff --git a/chrome/android/webapk/shell_apk/AndroidManifest.xml b/chrome/android/webapk/shell_apk/AndroidManifest.xml index 553e5ceb3..610dc845 100644 --- a/chrome/android/webapk/shell_apk/AndroidManifest.xml +++ b/chrome/android/webapk/shell_apk/AndroidManifest.xml
@@ -24,7 +24,7 @@ <uses-sdk android:minSdkVersion="21" - android:targetSdkVersion="31" /> + android:targetSdkVersion="29" /> <queries> <intent>
diff --git a/chrome/android/webapk/shell_apk/BUILD.gn b/chrome/android/webapk/shell_apk/BUILD.gn index 7aee241..8eca4de2 100644 --- a/chrome/android/webapk/shell_apk/BUILD.gn +++ b/chrome/android/webapk/shell_apk/BUILD.gn
@@ -265,7 +265,7 @@ android_manifest = _manifest_output android_manifest_dep = ":$_manifest_target_name" - target_sdk_version = 31 + target_sdk_version = 29 never_incremental = true # Force 32 bit mode on 64 bit devices.
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 9b3a4ce..777d27bd 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -3489,6 +3489,16 @@ <message name="IDS_TAB_SHARING_INFOBAR_STOP_BUTTON" desc="Text displayed on the button to stop sharing a tab."> Stop </message> + <message name="IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON" desc="Text displayed on an infobar button offering to change focus to another tab."> + Switch to tab <ph name="TAB_ORIGIN">$1<ex>meet.google.com</ex></ph> + </message> + <message name="IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURER_BUTTON" desc="Text displayed on an infobar button offering to change focus to the capturer if its hostname cannot be determined. (Otherwise, IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON will be used.)"> + Switch to capturing tab + </message> + <message name="IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURED_BUTTON" desc="Text displayed on an infobar button offering to change focus to the capturer if its hostname cannot be determined. (Otherwise, IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON will be used.)"> + Switch to captured tab + </message> + <!-- Task Manager Window --> <if expr="not is_android">
diff --git a/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON.png.sha1 b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON.png.sha1 new file mode 100644 index 0000000..0e9815c --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON.png.sha1
@@ -0,0 +1 @@ +290fec5cc889c015dbeacd791f5c71aeedc67a3e \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURED_BUTTON.png.sha1 b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURED_BUTTON.png.sha1 new file mode 100644 index 0000000..b80f93b --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURED_BUTTON.png.sha1
@@ -0,0 +1 @@ +234cd83c9ed395dbb3fd40b38ee23db32cbeed28 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURER_BUTTON.png.sha1 b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURER_BUTTON.png.sha1 new file mode 100644 index 0000000..89e5a6c --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURER_BUTTON.png.sha1
@@ -0,0 +1 @@ +73b15720228b88b5f99bfeb7d1bc1ceebe828b64 \ No newline at end of file
diff --git a/chrome/app/resources/chromium_strings_km.xtb b/chrome/app/resources/chromium_strings_km.xtb index 59fc1bb..393b9f5 100644 --- a/chrome/app/resources/chromium_strings_km.xtb +++ b/chrome/app/resources/chromium_strings_km.xtb
@@ -74,6 +74,7 @@ <translation id="328888136576916638">សោ Google API បានបាត់។ មុខងារមួយចំនួននៃ Chromium នឹងត្រូវបានបិទដំណើរការ។</translation> <translation id="3296368748942286671">បន្តដំណើរការកម្មវិធីផ្ទៃខាងក្រោយ នៅពេល Chromium ត្រូវបានបិទ</translation> <translation id="331951419404882060">Chromium OS មិនអាចធ្វើសមកម្មទិន្នន័យរបស់អ្នកទេដោយសារកំហុសឆ្គងការចូល។</translation> +<translation id="3349211344363550267">Chromium ណែនាំមិនឱ្យអ្នកទាញយក ឬបើកឯកសារនេះទេ</translation> <translation id="3350761136195634146">កម្រងព័ត៌មាន Chromium ដែលប្រើគណនីនេះមានរួចហើយ</translation> <translation id="3406848076815591792">ប្ដូរទៅកម្រងព័ត៌មាន Chromium ដែលមានស្រាប់ឬ?</translation> <translation id="3430503420100763906">អ្នកអាចបែងចែកព័ត៌មាននៅលើ Chromium ទាំងអស់របស់អ្នកបាន ដោយប្រើកម្រងព័ត៌មាន Chromium។ បង្កើតកម្រងព័ត៌មានសម្រាប់មិត្តភ័ក្តិ និងគ្រួសារ ឬបែងចែករវាងការងារ និងការកម្សាន្ត។</translation>
diff --git a/chrome/app/resources/chromium_strings_pa.xtb b/chrome/app/resources/chromium_strings_pa.xtb index 0419fd2..ff05881c 100644 --- a/chrome/app/resources/chromium_strings_pa.xtb +++ b/chrome/app/resources/chromium_strings_pa.xtb
@@ -73,6 +73,7 @@ <translation id="328888136576916638">Google API ਕੁੰਜੀਆਂ ਮੌਜੂਦ ਨਹੀਂ ਹਨ। Chromium ਦੀ ਕੁਝ ਫੰਕਸ਼ਨੈਲਿਟੀ ਬੰਦ ਕੀਤੀ ਜਾਵੇਗੀ।</translation> <translation id="3296368748942286671">ਪਿਛੋਕੜ ਐਪਸ ਚਲਾਉਣਾ ਜਾਰੀ ਰੱਖੋ ਜਦੋਂ Chromium ਨੂੰ ਬੰਦ ਕੀਤਾ ਜਾਏ</translation> <translation id="331951419404882060">Chromium OS ਸਾਈਨ-ਇਨ ਕਰਨ ਵੇਲੇ ਇੱਕ ਗੜਬੜ ਹੋਣ ਦੇ ਕਾਰਨ ਤੁਹਾਡਾ ਡਾਟਾ ਸਿੰਕ ਨਹੀਂ ਕਰ ਸਕਿਆ।</translation> +<translation id="3349211344363550267">Chromium ਵੱਲੋਂ ਸਿਫ਼ਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਕਿ ਤੁਸੀਂ ਇਸ ਫ਼ਾਈਲ ਨੂੰ ਨਾ ਤਾਂ ਡਾਊਨਲੋਡ ਕਰੋ ਅਤੇ ਨਾ ਹੀ ਖੋਲ੍ਹੋ</translation> <translation id="3350761136195634146">ਇਸ ਖਾਤੇ ਨਾਲ ਕੋਈ Chromium ਪ੍ਰੋਫਾਈਲ ਪਹਿਲਾਂ ਤੋਂ ਹੀ ਮੌਜੂਦ ਹੈ</translation> <translation id="3406848076815591792">ਕੀ ਮੌਜੂਦਾ Chromium ਪ੍ਰੋਫਾਈਲ 'ਤੇ ਜਾਣਾ ਹੈ?</translation> <translation id="3430503420100763906">Chromium ਪ੍ਰੋਫਾਈਲਾਂ ਨਾਲ ਤੁਸੀਂ ਆਪਣੀ ਸਾਰੀ Chromium ਸਮੱਗਰੀ ਨੂੰ ਵੱਖ ਕਰ ਸਕਦੇ ਹੋ। ਦੋਸਤਾਂ ਅਤੇ ਪਰਿਵਾਰ ਲਈ ਪ੍ਰੋਫਾਈਲਾਂ ਬਣਾਓ ਜਾਂ ਕਾਰਜ ਅਤੇ ਮੌਜ-ਮਸਤੀ ਵਿੱਚ ਵੰਡੋ।</translation>
diff --git a/chrome/app/resources/chromium_strings_sq.xtb b/chrome/app/resources/chromium_strings_sq.xtb index 9b499df..90f4d581 100644 --- a/chrome/app/resources/chromium_strings_sq.xtb +++ b/chrome/app/resources/chromium_strings_sq.xtb
@@ -73,6 +73,7 @@ <translation id="328888136576916638">Çelësat API të Google mungojnë. Disa funksione të Chromium do të çaktivizohen.</translation> <translation id="3296368748942286671">Vazhdo funksionimin e aplikacioneve në sfond kur Chromium është i mbyllur</translation> <translation id="331951419404882060">Sistemi operativ i Chromium nuk mundi të sinkronizonte të dhënat e tua për shkak të një gabimi në identifikim.</translation> +<translation id="3349211344363550267">Chromium rekomandon që të mos e shkarkosh apo hapësh këtë skedar</translation> <translation id="3350761136195634146">Ekziston tashmë një profil i Chromium me këtë llogari</translation> <translation id="3406848076815591792">Të kalohet te profili ekzistues i Chromium?</translation> <translation id="3430503420100763906">Me profilet e Chromium mund t'i mbash të ndara të gjitha gjërat e tua të Chromium. Krijo profile për miqtë dhe familjen ose ndaje punën nga argëtimi.</translation>
diff --git a/chrome/app/resources/generated_resources_fil.xtb b/chrome/app/resources/generated_resources_fil.xtb index 00aeea9b..b0a2abe 100644 --- a/chrome/app/resources/generated_resources_fil.xtb +++ b/chrome/app/resources/generated_resources_fil.xtb
@@ -467,6 +467,7 @@ <translation id="1507246803636407672">&Itapon</translation> <translation id="1508491105858779599">Itapat ang iyong daliri sa sensor para sa fingerprint upang i-unlock ang device.</translation> <translation id="1508575541972276599">Debian 9 (Stretch) ang kasalukuyang bersyon</translation> +<translation id="1509163368529404530">&I-restore ang grupo</translation> <translation id="1509281256533087115">I-access ang anumang <ph name="DEVICE_NAME_AND_VENDOR" /> sa pamamagitan ng USB</translation> <translation id="1509960214886564027">Posibleng masira ang mga feature sa maraming site</translation> <translation id="1510238584712386396">Launcher</translation> @@ -589,6 +590,7 @@ <translation id="1627408615528139100">Na-download na</translation> <translation id="1628948239858170093">I-scan ang file bago buksan?</translation> <translation id="1629314197035607094">Nag-expire ang password</translation> +<translation id="1629451755632656601">Payagan ang Google na maghanap ng mga naka-personalize na diskwento sa iyong mga cart?</translation> <translation id="1630300831289687074">Magagamit mo ang iyong Chromebook sa loob ng ilang sandali.</translation> <translation id="163072119192489970">Pinapayagang tapusin ang pagpapadala at pagtanggap ng data</translation> <translation id="1630768113285622200">Mag-restart at magpatuloy</translation> @@ -1306,6 +1308,7 @@ <translation id="236117173274098341">I-optimize</translation> <translation id="2361340419970998028">Ipinapadala ang feedback...</translation> <translation id="236141728043665931">Palaging i-block ang pag-access sa mikropono</translation> +<translation id="2363744066037724557">&I-restore ang window</translation> <translation id="2364498172489649528">Nakapasa</translation> <translation id="2365507699358342471">Makikita ng site na ito ang text at mga larawang kinopya sa clipboard.</translation> <translation id="2367972762794486313">Ipakita ang apps</translation> @@ -2689,6 +2692,7 @@ <translation id="3857807444929313943">Iangat, pagkatapos ay pindutin muli</translation> <translation id="3861638017150647085">Hindi available ang username na "<ph name="USERNAME" />"</translation> <translation id="3861977424605124250">Ipakita sa startup</translation> +<translation id="386239283124269513">&I-restore ang Grupo</translation> <translation id="3862788408946266506">Naka-install dapat sa kiosk mode ng Chrome OS ang app na may 'kiosk_only' na manifest attribute</translation> <translation id="3865414814144988605">Resolution</translation> <translation id="3866249974567520381">Paglalarawan</translation> @@ -5667,6 +5671,7 @@ <translation id="7225179976675429563">Nawawala ang uri ng network</translation> <translation id="7228479291753472782">Manipulahin ang mga setting na tumutukoy kung makakagamit ang mga website ng mga feature gaya ng geolocation, mikropono, camera, atbp.</translation> <translation id="7228523857728654909">Lock ng screen at pag-sign in</translation> +<translation id="7230222852462421043">&I-restore ang Window</translation> <translation id="7230787553283372882">I-customize ang laki ng iyong text</translation> <translation id="7232750842195536390">Hindi napalitan ang pangalan</translation> <translation id="7234010996000898150">Kinakansela ang pag-restore ng Linux</translation> @@ -6276,12 +6281,14 @@ <translation id="7853747251428735">Higit Pang Mga Too&l</translation> <translation id="7855678561139483478">Ilipat ang tab sa bagong window</translation> <translation id="7857093393627376423">Mga suhestyong text</translation> +<translation id="7857675386615530425">Hanapin ang bahagi ng page gamit ang Google Lens</translation> <translation id="7857949311770343000">Ito ba ang page ng bagong tab na inaasahan mo?</translation> <translation id="7858328180167661092"><ph name="APP_NAME" /> (Windows)</translation> <translation id="786073089922909430">Serbisyo: <ph name="ARC_PROCESS_NAME" /></translation> <translation id="7861215335140947162">&Mga download</translation> <translation id="7861846108263890455">Wika ng Google Account</translation> <translation id="7864539943188674973">Huwag Paganahin ang Bluetooth</translation> +<translation id="7866230141401327032">Hanapin ang Bahagi ng Page gamit ang Google Lens</translation> <translation id="786957569166715433"><ph name="DEVICE_NAME" /> - Nakapares</translation> <translation id="7870730066603611552">Suriin ang mga opsyon sa pag-sync pagkatapos ng pag-set up</translation> <translation id="7870790288828963061">Walang nahanap na mga Kiosk app na may mas bagong bersyon. Walang ia-update. Mangyaring alisin ang USB stick.</translation> @@ -6859,6 +6866,7 @@ <translation id="850875081535031620">Walang nahanap na mapaminsalang software</translation> <translation id="8509177919508253835">I-reset ang mga security key at gumawa ng mga PIN</translation> <translation id="8509646642152301857">Nabigo ang pag-download ng diksyunaryo ng pang-check ng pagbabaybay.</translation> +<translation id="8509967119010808787">Para maghanap sa iyong mga tab, mag-click dito</translation> <translation id="8512396579636492893">{COUNT,plural, =0{Walang nakitang mahinang password}=1{Nakakita ng {COUNT} mahinang password}one{Nakakita ng {COUNT} mahihinang password}other{Nakakita ng {COUNT} na mahihinang password}}</translation> <translation id="8512476990829870887">Tapusin ang Proseso</translation> <translation id="851263357009351303">Palaging hayaan ang <ph name="HOST" /> na magpakita ng mga larawan</translation>
diff --git a/chrome/app/resources/generated_resources_km.xtb b/chrome/app/resources/generated_resources_km.xtb index 4ba50b8b3..2883d0da 100644 --- a/chrome/app/resources/generated_resources_km.xtb +++ b/chrome/app/resources/generated_resources_km.xtb
@@ -252,6 +252,7 @@ <translation id="126768002343224824">16x</translation> <translation id="1272079795634619415">ឈប់</translation> <translation id="1272978324304772054">គណនីអ្នកប្រើនេះមិនមែនជាកម្មសិទ្ធិរបស់ដែន ដែលឧបករណ៍នេះបានចុះឈ្មោះទៅទេ។ ប្រសិនបើអ្នកចង់ចុះឈ្មោះទៅដែនផ្សេងទៀត អ្នកត្រូវឆ្លងកាតការសង្រ្គោះឧបករណ៍ជាមុនសិន។</translation> +<translation id="1273780413309681229">បើកការណែនាំអំពីការរៀបចំឡើងវិញ</translation> <translation id="1274997165432133392">ខុកឃី និងទិន្នន័យគេហទំព័រដ៏ទៃទៀត</translation> <translation id="1275718070701477396">បានជ្រើសរើស</translation> <translation id="1276994519141842946">មិនអាចលុប <ph name="APP_NAME" /> បានទេ</translation> @@ -410,6 +411,7 @@ <translation id="1442851588227551435">កំណត់សំបុត្រ Kerberos សកម្ម</translation> <translation id="1444628761356461360">ការកំណត់នេះត្រូវបានគ្រប់គ្រងដោយម្ចាស់ឧបករណ៍ <ph name="OWNER_EMAIL" />។</translation> <translation id="144518587530125858">មិនអាចដំណើរការ '<ph name="IMAGE_PATH" />' សម្រាប់ធីមទេ។</translation> +<translation id="1449191289887455076">ចុច “<ph name="CURRENTKEY" />” ម្ដងទៀត ដើម្បីបញ្ជាក់ការកំណត់ រួច<ph name="RESPONSE" /></translation> <translation id="1451375123200651445">គេហទំព័រ ឯកសារទោល</translation> <translation id="1453561711872398978">ផ្ញើ<ph name="BEGIN_LINK" /> កំណត់ហេតុនៃការជួសជុល<ph name="END_LINK" /> (បានណែនាំ)</translation> @@ -519,6 +521,7 @@ <translation id="15662109988763471">មិនមានម៉ាស៊ីនបោះពុម្ពដែលបានជ្រើសរើស ឬមិនត្រូវបានដំឡើងត្រឹមត្រូវទេ។ សូមពិនិត្យមើលម៉ាស៊ីនបោះពុម្ពរបស់អ្នក ឬសាកល្បងជ្រើសរើសម៉ាស៊ីនបោះពុម្ពផ្សេងទៀត។</translation> <translation id="1567135437923613642">បើកការពិសោធរំលេចពិសេស</translation> <translation id="1567387640189251553">ចាប់តាំងពីអ្នកបានបញ្ចូលពាក្យសម្ងាត់ចុងក្រោយរបស់អ្នក ក្ដារចុចមួយផ្សេងទៀតត្រូវបានភ្ជាប់។ វាអាចនឹងព្យាយាមលួចការចុចរបស់អ្នក។</translation> +<translation id="156793199942386351">បានកំណត់ '<ph name="CURRENTKEY" />' ទៅសកម្មភាព '<ph name="ACTION" />' រួចហើយ។ ចុចគ្រាប់ចុចណាមួយ ដើម្បី<ph name="RESPONSE" />។</translation> <translation id="1567993339577891801">ខនសូល JavaScript</translation> <translation id="1568323446248056064">បើកការកំណត់ឧបករណ៍បង្ហាញ</translation> <translation id="1572139610531470719"><ph name="WINDOW_TITLE" /> (ភ្ញៀវ)</translation> @@ -791,6 +794,7 @@ <translation id="1822140782238030981">ជាអ្នកប្រើប្រាស់ Chrome ហើយមែនទេ? សូមចូលគណនី</translation> <translation id="18245044880483936">ទិន្នន័យបម្រុងទុកនឹងមិនរាប់បញ្ចូលទៅក្នុងកម្រិតកំណត់នៃទំហំផ្ទុកថាសរបស់កូនអ្នកទេ។</translation> <translation id="1825565032302550710">ច្រកត្រូវតែនៅចន្លោះពី 1024 ទៅ 65535</translation> +<translation id="1826192255355608658">ធ្វើសមកាលកម្មចំណាំ ពាក្យសម្ងាត់ ប្រវត្តិនៃកម្មវិធីរុករកតាមអ៊ីនធឺណិត Chrome របស់អ្នក និងអ្វីៗជាច្រើនទៀត</translation> <translation id="1826516787628120939">កំពុងពិនិត្យមើល</translation> <translation id="1827738518074806965">វិចិត្រសាល</translation> <translation id="1828378091493947763">ឧបករណ៍នេះមិនស្គាល់កម្មវិធីជំនួយនេះទេ</translation> @@ -1314,6 +1318,7 @@ <translation id="2379281330731083556">បោះពុម្ពដោយប្រើប្រអប់ប្រព័ន្ធ... <ph name="SHORTCUT_KEY" /></translation> <translation id="2381756643783702095">សួរមុនពេលផ្ញើ (បានណែនាំ)</translation> <translation id="2382818385048255866">ពិនិត្យមើលកម្មវិធីបន្ថែមរបស់អ្នក</translation> +<translation id="2383270717570379869"><ph name="BEGIN_LINK_SEARCH" />ប្រវត្តិស្វែងរក<ph name="END_LINK_SEARCH" /> និង<ph name="BEGIN_LINK_GOOGLE" />ទម្រង់ផ្សេងទៀតនៃសកម្មភាព<ph name="END_LINK_GOOGLE" />អាចត្រូវបានរក្សាទុកនៅក្នុងគណនី Google របស់អ្នក នៅពេលអ្នកចូលគណនី។ អ្នកអាចលុបវាបានគ្រប់ពេល។</translation> <translation id="2387052489799050037">ចូលទំព័រដើម</translation> <translation id="2390347491606624519">មិនអាចភ្ជាប់ទៅប្រូកស៊ីបានទេ សូមចូលម្ដងទៀត</translation> <translation id="2390782873446084770">Wi-Fi Sync</translation> @@ -1478,6 +1483,7 @@ <translation id="2553440850688409052">លាក់កម្មវិធីជំនួយនេះ</translation> <translation id="2554553592469060349">ឯកសារដែលបានជ្រើសរើសធំពេក (ទំហំអតិបរមា៖ 3mb)។</translation> <translation id="2558896001721082624">បង្ហាញជម្រើសភាពងាយស្រួលជានិច្ចនៅក្នុងម៉ឺនុយប្រព័ន្ធ</translation> +<translation id="2564407282561292919">សម្អាតប្រវត្តិនៅក្នុងប្រអប់ស្វែងរក។ គណនី Google របស់អ្នកអាចមានទម្រង់ប្រវត្តិរុករកតាមអ៊ីនធឺណិតផ្សេងទៀតនៅ <ph name="BEGIN_LINK" />myactivity.google.com<ph name="END_LINK" />។</translation> <translation id="2564520396658920462">ប្រតិបត្តិការ JavaScript តាមរយៈ AppleScript ត្រូវបានបិទ។ ដើម្បីបើកវា នៅលើរបារម៉ឹនុយ សូមចូលទៅកាន់ ទិដ្ឋភាព > អ្នកអភិវឌ្ឍន៍ > អនុញ្ញាត JavaScript ពី Apple Events ។ សម្រាប់ព័ត៌មានបន្ថែម៖ https://support.google.com/chrome/?p=applescriptk</translation> <translation id="2564653188463346023">ពិនិត្យអក្ខរាវិរុទ្ធប្រសើរជាងមុន</translation> <translation id="2568774940984945469">ឧបករណ៍ផ្ទុករបាព័ត៌មាន</translation> @@ -1802,6 +1808,7 @@ <translation id="2907798539022650680">បានបរាជ័យក្នុងការភ្ជាប់ទៅ '<ph name="NAME" />'៖ <ph name="DETAILS" /> សារពីម៉ាស៊ីនមេ៖ <ph name="SERVER_MSG" /></translation> <translation id="2908162660801918428">បន្ថែមវិចិត្រសាលកំសាន្តតាមថតឯកសារ</translation> +<translation id="2908358077082926882">ចុច “<ph name="CURRENTKEY" />” ម្ដងទៀត ដើម្បីដកការកំណត់ រួច<ph name="RESPONSE" /></translation> <translation id="2910318910161511225">សូមភ្ជាប់បណ្តាញ រួចព្យាយាមម្តងទៀត</translation> <translation id="291056154577034373">មិនទាន់អាន</translation> <translation id="2910718431259223434">មានអ្វីមួយខុសប្រក្រតី។ សូមព្យាយាមម្ដងទៀត ឬទាក់ទងអ្នកគ្រប់គ្រង ឬម្ចាស់ឧបករណ៍របស់អ្នក។ លេខកូដបញ្ហា៖ <ph name="ERROR_CODE" />។</translation> @@ -2298,6 +2305,7 @@ <translation id="3462311546193741693">នាំអ្នកចេញពីគេហទំព័រភាគច្រើន។ អ្នកនឹងស្ថិតនៅក្នុងគណនី Google របស់អ្នកដដែល ទើបអាចសម្អាតទិន្នន័យដែលបានធ្វើសមកាលកម្មរបស់អ្នកបាន។</translation> <translation id="3462413494201477527">បោះបង់ការបង្កើតគណនី?</translation> <translation id="346298925039590474">អ្នកប្រើប្រាស់ទាំងអស់នៅលើឧបករណ៍នេះនឹងអាចប្រើបណ្ដាញទូរសព្ទចល័តនេះបាន</translation> +<translation id="3463235406897625623">មិនអាចលុបប៊ូតុងបិទបើកតែមួយ ដែលបានកំណត់សម្រាប់ការជ្រើសរើសបានទេ។ ចុចគ្រាប់ចុចណាមួយ ដើម្បី<ph name="RESPONSE" />។</translation> <translation id="3464145797867108663">បញ្ចូលកម្រងព័ត៌មានការងារ</translation> <translation id="346431825526753">នេះគឺជាគណនីសម្រាប់កុមារដែលគ្រប់គ្រងដោយ <ph name="CUSTODIAN_EMAIL" />។</translation> <translation id="3468298837301810372">ស្លាក</translation> @@ -2308,6 +2316,7 @@ <translation id="3473479545200714844">ឧបករណ៍ពង្រីកអេក្រង់</translation> <translation id="3474218480460386727">ប្រើ 99 តួ ឬតិចជាងនេះសម្រាប់ពាក្យថ្មី</translation> <translation id="3475843873335999118">សូមទោស នៅតែមិនស្គាល់ស្នាមម្រាមដៃរបស់អ្នកដដែល។ សូមបញ្ចូលពាក្យសម្ងាត់របស់អ្នក។</translation> +<translation id="3475986680293081450">គ្រាប់ចុចមិនត្រូវគ្នាទេ។ ចុចគ្រាប់ចុចណាមួយ ដើម្បី<ph name="RESPONSE" />។</translation> <translation id="3476303763173086583">បញ្ជូនទិន្នន័យប្រើប្រាស់ និងវិភាគ។ ជួយធ្វើឱ្យបទពិសោធន៍ប្រើប្រាស់ Android របស់កូនអ្នកប្រសើរឡើង ដោយបញ្ជូនទិន្នន័យនៃការវិភាគ ឧបករណ៍ និងការប្រើប្រាស់កម្មវិធីទៅ Google ដោយស្វ័យប្រវត្តិ។ សកម្មភាពនេះនឹងមិនត្រូវបានធ្វើឡើង ដើម្បីកំណត់អត្តសញ្ញាណកូនរបស់អ្នកនោះទេ តែការធ្វើបែបនេះនឹងជួយដល់ស្ថិរភាពកម្មវិធី និងប្រព័ន្ធ ព្រមទាំងការកែលម្អផ្សេងទៀត។ ទិន្នន័យប្រមូលបានមួយចំនួនក៏នឹងជួយដល់កម្មវិធី និងដៃគូ Google ដូចជាអ្នកអភិវឌ្ឍន៍ Android ផងដែរ។ <ph name="BEGIN_LINK1" />ការកំណត់<ph name="END_LINK1" />នេះត្រូវបានអនុវត្តដោយម្ចាស់។ ម្ចាស់អាចនឹងជ្រើសរើស ដើម្បីបញ្ជូនទិន្នន័យប្រើប្រាស់ និងវិភាគសម្រាប់ឧបករណ៍នេះទៅ Google ។ ប្រសិនបើការកំណត់សកម្មភាពកម្មវិធី និងគេហទំព័របន្ថែមត្រូវបានបើកសម្រាប់កូនរបស់អ្នក នោះទិន្នន័យនេះអាចត្រូវបានរក្សាទុកទៅក្នុងគណនី Google របស់គាត់។ <ph name="BEGIN_LINK2" />ស្វែងយល់បន្ថែម<ph name="END_LINK2" /></translation> <translation id="347670947055184738">អូ៎! ប្រព័ន្ធមិនអាចទាញយកគោលការណ៍សម្រាប់ឧបករណ៍របស់អ្នកបានទេ។</translation> <translation id="347785443197175480">បន្តអនុញ្ញាត <ph name="HOST" /> ឲ្យចូលប្រើកាមេរ៉ា និងម៉ៃក្រូហ្វូនរបស់អ្នក</translation> @@ -2366,6 +2375,7 @@ <translation id="3541823293333232175">បានកំណត់</translation> <translation id="3543393733900874979">ការធ្វើបច្ចុប្បន្នភាពបានបរាជ័យ (កំហុសឆ្គង៖ <ph name="ERROR_NUMBER" />)</translation> <translation id="3543597750097719865">ហត្ថលេខា X9.62 ECDSA ជាមួយ SHA-512</translation> +<translation id="3543651705416471414">សម្អាតការកំណត់ប៊ូតុងបិទបើកទាំងអស់</translation> <translation id="3544879808695557954">ឈ្មោះអ្នកប្រើប្រាស់ (ជាជម្រើស)</translation> <translation id="354602065659584722">បានលុបកម្មវិធីដែលបង្កគ្រោះថ្នាក់</translation> <translation id="3547954654003013442">ការកំណត់ប្រូកស៊ី</translation> @@ -2593,6 +2603,7 @@ <translation id="3778740492972734840">ឧបករណ៍អ្នកអភិវឌ្ឍន៍</translation> <translation id="3778868487658107119">សួរសំណួរ និងប្រាប់វាឲ្យធ្វើកិច្ចការ។ វាជា Google ផ្ទាល់ខ្លួនរបស់អ្នក ដែលត្រៀមជួយអ្នកជានិច្ច។</translation> <translation id="3781742599892759500">ការចូលប្រើមីក្រូហ្វូនសម្រាប់ Linux</translation> +<translation id="3782795641773236652">មិនមានប៊ូតុងបិទបើក ឬគ្រាប់ចុចដែលត្រូវបានកំណត់នៅឡើយទេ</translation> <translation id="378312418865624974">អានឧបករណ៍សម្គាល់ពិសេសសម្រាប់កុំព្យូទ័រនេះ</translation> <translation id="3784372983762739446">ឧបករណ៍ប៊្លូធូស</translation> <translation id="3784472333786002075">ខូគីគឺជាឯកសារដែលបង្កើតដោយគេហទំព័រ។ ខូគីមានពីរប្រភេទ៖ ខូគីភាគីទីមួយបង្កើតដោយគេហទំព័រដែលអ្នកចូលមើល។ គេហទំព័រនេះបង្ហាញនៅលើរបារអាសយដ្ឋាន។ ខូគីភាគីទីបីបង្កើតដោយគេហទំព័រផ្សេងទៀត។ គេហទំព័រទាំងនេះគឺជាម្ចាស់នៃខ្លឹមសារមួយចំនួន ដូចជាការផ្សាយពាណិជ្ជកម្ម ឬរូបភាព ដែលអ្នកឃើញនៅលើគេហទំព័រដែលអ្នកចូលមើលជាដើម។</translation> @@ -2871,6 +2882,7 @@ <translation id="406070391919917862">កម្មវិធីផ្ទៃខាងក្រោយ</translation> <translation id="4061374428807229313">ដើម្បីចែករំលែក សូមចុចកណ្ដុរខាងស្ដាំលើថតនៅក្នុងកម្មវិធី Files រួចជ្រើសរើស "ចែករំលែកជាមួយ Parallels Desktop"។</translation> <translation id="406213378265872299">សកម្មភាពដែលប្ដូរតាមបំណង</translation> +<translation id="4062561150282203854">ធ្វើសមកាលកម្មកម្មវិធី <ph name="DEVICE_TYPE" />, ការកំណត់របស់អ្នក និងអ្វីៗជាច្រើនទៀត</translation> <translation id="4064575710864784237">1x</translation> <translation id="4065876735068446555">បណ្តាញដែលអ្នកកំពុងប្រើ (<ph name="NETWORK_ID" />) អាចតម្រូវឲ្យអ្នកទៅកាន់ទំព័រចូលរបស់វា។</translation> <translation id="4066207411788646768">សូមពិនិត្យមើលការតភ្ជាប់របស់អ្នក ដើម្បីមើលឃើញម៉ាស៊ីនបោះពុម្ពដែលមាននៅក្នុងបណ្ដាញរបស់អ្នក</translation> @@ -2992,6 +3004,7 @@ <translation id="4217571870635786043">ការសរសេរតាមអាន</translation> <translation id="4220648711404560261">មានបញ្ហាបានកើតឡើង អំឡុងពេលបើកដំណើរការ។</translation> <translation id="4222772810963087151">ព័ត៌មានលម្អិតអំពីកំណែបង្កើត</translation> +<translation id="4225020013797061859">ចុចប៊ូតុងបិទបើក ឬគ្រាប់ចុចណាមួយ ដើម្បីកំណត់ "<ph name="ACTION" />"</translation> <translation id="4225397296022057997">នៅលើទំព័រទាំងអស់</translation> <translation id="4231095370974836764">ដំឡើងកម្មវិធី និងហ្គេមពី Google Play នៅលើ <ph name="DEVICE_TYPE" /> របស់អ្នក។ <ph name="LINK_BEGIN" />ស្វែងយល់បន្ថែម<ph name="LINK_END" /></translation> <translation id="4232375817808480934">កំណត់រចនាសម្ព័ន្ធ Kerberos</translation> @@ -3143,6 +3156,7 @@ <translation id="440653823335387109">ទំព័រដែលអ្នកបានអាន</translation> <translation id="4406883609789734330">អក្សររត់ក្នុងពេលជាក់ស្ដែង</translation> <translation id="4408599188496843485">ជំនួយ</translation> +<translation id="4409271659088619928">ម៉ាស៊ីនស្វែងរករបស់អ្នកគឺ <ph name="DSE" />។ មើលការណែនាំរបស់ម៉ាស៊ីនស្វែងរក ដើម្បីដឹងអំពីរបៀបលុបប្រវត្តិស្វែងរករបស់អ្នក ប្រសិនបើអាច។</translation> <translation id="4409697491990005945">ចន្លោះគែម</translation> <translation id="4410545552906060960">ប្រើលេខ (កូដ PIN) ជំនួសឱ្យពាក្យសម្ងាត់ ដើម្បីដោះសោឧបករណ៍របស់អ្នក។ ដើម្បីរៀបចំកូដ PIN របស់អ្នកនៅពេលក្រោយ សូមចូលទៅកាន់ការកំណត់។</translation> <translation id="4411578466613447185">អ្នកចុះហត្ថលេខាជាលេខកូដ</translation> @@ -3212,6 +3226,7 @@ <translation id="4480590691557335796">Chrome អាចរកឃើញកម្មវិធីដែលបង្កគ្រោះថ្នាក់នៅលើកុំព្យូទ័ររបស់អ្នក ហើយលុបវាចេញ</translation> <translation id="4481467543947557978">បុគ្គលិកបម្រើសេវាកម្ម</translation> <translation id="4481530544597605423">ឧបករណ៍ដែលឈប់ផ្គូផ្គង</translation> +<translation id="4481906837550700306">ការបើកការណែនាំអំពីការរៀបចំឡើងវិញនឹងសម្អាតប៊ូតុងបិទបើកដែលបានកំណត់របស់អ្នក។ តើអ្នកចង់បន្តដែរទេ?</translation> <translation id="4482990632723642375">ផ្ទាំងដែលបានបិទថ្មីៗ</translation> <translation id="4487489714832036847">Chromebook ប្រើកម្មវិធីជំនួសឱ្យកម្មវិធីប្រភេទចាស់។ ទាញយកកម្មវិធីសម្រាប់ផលិតភាព ការកម្សាន្ត និងអ្វីៗជាច្រើនទៀត។</translation> <translation id="4488257340342212116">អនុញ្ញាតឱ្យប្រើកាមេរ៉ារបស់អ្នក</translation> @@ -4501,6 +4516,7 @@ <translation id="5938002010494270685">អាចដំឡើងកំណែសោសុវត្ថិភាពបានហើយ</translation> <translation id="5939518447894949180">កំណត់ឡើងវិញ</translation> <translation id="5939719276406088041">មិនអាចបង្កើតផ្លូវកាត់បានទេ</translation> +<translation id="594048410531370124">មិនស្គាល់គ្រាប់ចុច។ ចុចគ្រាប់ចុចណាមួយ ដើម្បី<ph name="RESPONSE" />។</translation> <translation id="5941153596444580863">បន្ថែមបុគ្គល...</translation> <translation id="5941343993301164315">សូមចូលទៅ <ph name="TOKEN_NAME" />។</translation> <translation id="5941711191222866238">បង្រួម</translation> @@ -4527,6 +4543,7 @@ <translation id="5963117322306686970">ដើម្បីដាក់ផ្ទាំងចូលជាក្រុម សូមចុចកណ្ដុរខាងស្ដាំនៅលើផ្ទាំង</translation> <translation id="5963453369025043595"><ph name="NUM_HANDLES" /> (<ph name="NUM_KILOBYTES_LIVE" /> កម្រិតកំពូល)</translation> <translation id="5964113968897211042">{COUNT,plural, =0{បើកទាំងអស់នៅក្នុង&វិនដូថ្មី}=1{បើកនៅក្នុង&វិនដូថ្មី}other{បើកទាំងអស់ ({COUNT}) នៅក្នុង&វិនដូថ្មី}}</translation> +<translation id="5964328685964290415">ប្ដូរការរុករកទាំងអស់ទៅជា HTTPS និងព្រមានអ្នក មុនពេលផ្ទុកគេហទំព័រដែលមិនស្គាល់ HTTPS</translation> <translation id="5965661248935608907">វាក៏គ្រប់គ្រងអ្វីដែលទំព័របានបង្ហាញផងដែរ នៅពេលដែលអ្នកចុចប៊ូតុង ទំព័រដើម ឬស្វែងរកពីប្រអប់អូមនី។</translation> <translation id="5969419185858894314"><ph name="ORIGIN" /> អាចមើលឯកសារនៅក្នុង <ph name="FOLDERNAME" /></translation> <translation id="5969728632630673489">ការជូនដំណឹងអំពីផ្លូវកាត់ក្ដារចុចត្រូវបានច្រានចោល</translation> @@ -5820,6 +5837,7 @@ <translation id="7415454883318062233">ការរៀបចំបានបញ្ចប់</translation> <translation id="7416362041876611053">កំហុងឆ្គងបណ្តាញមិនស្គាល់។</translation> <translation id="741906494724992817">កម្មវិធីនេះមិនតម្រូវឲ្យមានការអនុញ្ញាតពិសេសទេ។</translation> +<translation id="7419565702166471774">ប្រើការតភ្ជាប់ដែលមានសុវត្ថិភាពជានិច្ច</translation> <translation id="7421067045979951561">ឧបករណ៍ដោះស្រាយប្រូតូកូល</translation> <translation id="742130257665691897">បានលុបចំណាំ</translation> <translation id="7421925624202799674">មើលប្រភពទំព័រ</translation> @@ -5841,6 +5859,7 @@ <translation id="7434969625063495310">មិនអាចបញ្ចូលម៉ាស៊ីនមេបោះពុម្ពបានទេ។ សូមពិនិត្យការកំណត់រចនាសម្ព័ន្ធរបស់ម៉ាស៊ីនមេ រួចព្យាយាមម្ដងទៀត។</translation> <translation id="7436921188514130341">អូ! មានបញ្ហាពេលកំពុងប្តូរឈ្មោះ។</translation> <translation id="7438495332316988804">អាចរកឃើញកម្មវិធីរុករកតាមអ៊ីនធឺណិតស្តង់ដារបានដោយវាយបញ្ចូលពាក្យ "Chrome" នៅក្នុងកម្មវិធីចាប់ផ្ដើម។</translation> +<translation id="7439446972050308922">ចំណូលចិត្តដែលអ្នកបានរក្សាទុកនឹងអាចប្រើបាននៅលើរាល់ឧបករណ៍ Chrome OS នៅពេលអ្នកចូលដោយប្រើគណនី Google របស់អ្នក។ អ្នកអាចជ្រើសរើសអ្វីដែលត្រូវធ្វើសមកាលកម្មនៅក្នុងការកំណត់។</translation> <translation id="7439519621174723623">បញ្ចូលឈ្មោះឧបករណ៍ ដើម្បីបន្ត</translation> <translation id="7441736921018636843">ដើម្បីប្ដូរការកំណត់នេះ <ph name="BEGIN_LINK" />សូមកំណត់សមកាលកម្មឡើងវិញ<ph name="END_LINK" /> ដើម្បីលុបឃ្លាសម្ងាត់សមកាលកម្មរបស់អ្នក</translation> <translation id="7441830548568730290">អ្នកប្រើផ្សេងទៀត</translation> @@ -5952,6 +5971,7 @@ <translation id="7557194624273628371">ការបញ្ជូនច្រកបន្តពី Linux</translation> <translation id="7557411183415085169">Linux នៅសល់ទំហំផ្ទុកក្នុងថាសតិច</translation> <translation id="7559719679815339381">សូមរង់ចាំ....កម្មវិធីបញ្ជរស្ថិតនៅក្នុងដំណើរការធ្វើបច្ចុប្បន្នភាព។ កុំដកបន្ទះ USB ចេញ។</translation> +<translation id="7560756177962144929">ធ្វើសមកាលកម្ម <ph name="DEVICE_TYPE" /> របស់អ្នក</translation> <translation id="7561196759112975576">ជានិច្ច</translation> <translation id="756445078718366910">បើកផ្ទាំងកម្មវិធីរុករក</translation> <translation id="7564847347806291057">បញ្ចប់ដំណើរការ</translation> @@ -5988,6 +6008,7 @@ <translation id="760197030861754408">ចូលទៅកាន់ <ph name="LANDING_PAGE" /> ដើម្បីភ្ជាប់</translation> <translation id="7602079150116086782">គ្មានផ្ទាំងពីឧបករណ៍ដ៏ទៃទេ</translation> <translation id="7602173054665172958">ការគ្រប់គ្រងការបោះពុម្ព</translation> +<translation id="7603785829538808504">គេហទំព័រខាងក្រោមប្រើការកំណត់ផ្ទាល់ខ្លួន</translation> <translation id="7604942372593434070">ចូលប្រើសកម្មភាពរុករករបស់អ្នក</translation> <translation id="7605594153474022051">សមកាលកម្មមិនដំណើរការទេ</translation> <translation id="7606992457248886637">អាជ្ញាធរ</translation> @@ -6574,6 +6595,8 @@ <translation id="8189750580333936930">Privacy Sandbox</translation> <translation id="8190193592390505034">កំពុងភ្ជាប់ទៅ <ph name="PROVIDER_NAME" /></translation> <translation id="8191230140820435481">គ្រប់គ្រងកម្មវិធី កម្មវិធីបន្ថែម និងធីមរបស់អ្នក</translation> +<translation id="819137301779081601">ចុចប៊ូតុងបិទបើកថ្មី ដើម្បីចាប់ផ្ដើមការកំណត់ +ចុចប៊ូតុងបិទបើកដែលបានកំណត់ ដើម្បីដកការកំណត់</translation> <translation id="8192944472786724289"><ph name="APP_NAME" /> ចង់ចែករំលែកខ្លឹមសារនៅលើអេក្រង់របស់អ្នក។</translation> <translation id="8195027750202970175">ទំហំផ្ទុករបស់ថាស</translation> <translation id="8198323535106903877">យើងនឹងដំឡើងកម្មវិធីទាំង <ph name="NUMBER_OF_APPS" /> នោះសម្រាប់អ្នក</translation> @@ -6606,6 +6629,7 @@ <translation id="8230446983261649357">កុំអនុញ្ញាតឱ្យគេហទំព័របង្ហាញរូបភាព</translation> <translation id="8234795456569844941">សូមជួយវិស្វកររបស់យើងក្នុងការដោះស្រាយបញ្ហានេះ។ ប្រាប់យើងអំពីអ្វីដែលបានកើតឡើង មុនពេលដែលអ្នកទទួលបានសារបញ្ហាអំពីកម្រងព័ត៌មាននេះ៖</translation> <translation id="8235418492073272647">ទំព័រដែលបានចែករំលែកពី <ph name="DEVICE_NAME" /></translation> +<translation id="8236911020904880539">ចាកចេញ</translation> <translation id="8236917170563564587">ចែករំលែកផ្ទាំងនេះជំនួសវិញ</translation> <translation id="8237647586961940482">ផ្កាឈូកចាស់ និងក្រហម</translation> <translation id="8239032431519548577">ការចុះឈ្មោះសហគ្រាសបានបញ្ចប់</translation> @@ -7140,6 +7164,7 @@ <translation id="8834039744648160717">ការកំណត់រចនាសម្ព័ន្ធបណ្តាញ ដែលគ្រប់គ្រងដោយ <ph name="USER_EMAIL" /> ។</translation> <translation id="8835786707922974220">សូមប្រាកដថា អ្នកអាចចូលប្រើពាក្យសម្ងាត់ដែលបានរក្សាទុករបស់អ្នកបានជានិច្ច</translation> <translation id="8836360711089151515"><ph name="MANAGER" /> តម្រូវឱ្យអ្នកបម្រុងទុកទិន្នន័យរបស់អ្នក និងបញ្ជូន <ph name="DEVICE_TYPE" /> នេះត្រឡប់ទៅវិញក្នុងរយៈពេល 1 សប្ដាហ៍។ <ph name="LINK_BEGIN" />សូមមើលព័ត៌មានលម្អិត<ph name="LINK_END" /></translation> +<translation id="8836782447513334597">បន្ត</translation> <translation id="8838601485495657486">ស្រអាប់</translation> <translation id="8838770651474809439">ហេមប៊ឺហ្គើរ</translation> <translation id="883911313571074303">ដាក់ចំណារលើរូបភាព</translation> @@ -7221,6 +7246,7 @@ <translation id="8912810933860534797">បើកការស្កេនស្វ័យប្រវត្តិ</translation> <translation id="8915370057835397490">កំពុងដំណើរការការផ្តល់យោបល់</translation> <translation id="8916476537757519021">ហ្វ្រេមរងអនាមិក៖ <ph name="SUBFRAME_SITE" /></translation> +<translation id="8917293713468567935"><ph name="BEGIN_LINK_GOOGLE" />ទម្រង់ផ្សេងទៀតនៃសកម្មភាព<ph name="END_LINK_GOOGLE" />អាចត្រូវបានរក្សាទុកនៅក្នុងគណនី Google របស់អ្នក នៅពេលអ្នកចូលគណនី។ អ្នកអាចលុបវាបានគ្រប់ពេល។</translation> <translation id="8918637186205009138"><ph name="DEVICE_TYPE" /> របស់ <ph name="GIVEN_NAME" /></translation> <translation id="8922624386829239660">រំកិលអេក្រង់ នៅពេលកណ្ដុរប៉ះគែមអេក្រង់</translation> <translation id="8923880975836399332">បៃតងចាស់</translation> @@ -7330,6 +7356,7 @@ <translation id="9030785788945687215">Gmail</translation> <translation id="9030855135435061269">មិនអាចប្រើ <ph name="PLUGIN_NAME" /> បានទៀតទេ</translation> <translation id="9031549947500880805">បម្រុងទុកទៅក្នុង Google ថាស។ ងាយស្រួលក្នុងការស្ដារទិន្នន័យរបស់អ្នក ឬប្ដូរឧបករណ៍បានគ្រប់ពេល។ ការបម្រុងទុករបស់អ្នករួមបញ្ចូលទាំងទិន្នន័យកម្មវិធី។</translation> +<translation id="9031811691986152304">ព្យាយាមម្ដងទៀត</translation> <translation id="9033765790910064284">មិនអីទេ បន្តចុះ</translation> <translation id="9033857511263905942">បិទភ្ជាប់</translation> <translation id="9037640663275993951">មិនអនុញ្ញាតឧបករណ៍ទេ</translation> @@ -7356,6 +7383,7 @@ <translation id="9062468308252555888">14x</translation> <translation id="9063208415146866933">មានបញ្ហាចាប់ពីជួរទី <ph name="ERROR_LINE_START" /> ដល់ជួរទី <ph name="ERROR_LINE_END" /></translation> <translation id="9063800855227801443">មិនអាចថតខ្លឹមសារសម្ងាត់បានទេ</translation> +<translation id="9064039204504614208">ចុចប៊ូតុងបិទបើក ដើម្បីកំណត់ “<ph name="ACTION" />” អ្នកអាចកំណត់ប៊ូតុងបិទបើកច្រើនឱ្យធ្វើសកម្មភាពនេះបាន</translation> <translation id="9064275926664971810">បើកដំណើរការបំពេញដោយស្វ័យប្រវត្តិ ដើម្បីបំពេញទម្រង់បែបបទគេហទំព័រដោយគ្រាន់តែចុចម្តងប៉ុណ្ណោះ</translation> <translation id="9065203028668620118">កែប្រែ</translation> <translation id="9066782832737749352">អត្ថបទទៅការនិយាយ</translation>
diff --git a/chrome/app/resources/generated_resources_mn.xtb b/chrome/app/resources/generated_resources_mn.xtb index ac247aa..25c97d5 100644 --- a/chrome/app/resources/generated_resources_mn.xtb +++ b/chrome/app/resources/generated_resources_mn.xtb
@@ -466,6 +466,7 @@ <translation id="1507246803636407672">& Хэрэгсэхгүй орхих</translation> <translation id="1508491105858779599">Төхөөрөмжийн түгжээг тайлахдаа хурууны хээ мэдрэгчид хуруугаа байрлуулна уу.</translation> <translation id="1508575541972276599">Одоогийн хувилбар нь Debian 9 (Stretch) байна</translation> +<translation id="1509163368529404530">&Бүлгийг сэргээх</translation> <translation id="1509281256533087115">Дурын <ph name="DEVICE_NAME_AND_VENDOR" />-д USB ашиглан нэвтрэх</translation> <translation id="1509960214886564027">Олон сайтын онцлогууд ажиллахгүй байж болзошгүй</translation> <translation id="1510238584712386396">Launcher</translation> @@ -584,6 +585,7 @@ <translation id="1627408615528139100">Аль хэдийн татсан</translation> <translation id="1628948239858170093">Файлыг нээхээс өмнө скан хийх үү?</translation> <translation id="1629314197035607094">Нууц үгний хугацаа хэтэрсэн</translation> +<translation id="1629451755632656601">Google-д таны сагсанд хувийн болгосон хямдрал олохыг зөвшөөрөх үү?</translation> <translation id="1630300831289687074">Та удахгүй Chromebook-ээ ашиглах боломжтой болно.</translation> <translation id="163072119192489970">Өгөгдөл илгээж мөн хүлээн авч дуусгахыг зөвшөөрсөн</translation> <translation id="1630768113285622200">Дахин эхлүүлээд, үргэлжлүүлэх</translation> @@ -1301,6 +1303,7 @@ <translation id="236117173274098341">Оновчлох</translation> <translation id="2361340419970998028">Санал хүсэлтийг илгээж байна...</translation> <translation id="236141728043665931">Үргэлж микрофоны хандалтыг хаа</translation> +<translation id="2363744066037724557">&Цонхыг сэргээх</translation> <translation id="2364498172489649528">Давсан</translation> <translation id="2365507699358342471">Энэ сайт түр санах ойд хуулсан текст, зургийг харах боломжтой.</translation> <translation id="2367972762794486313">Аппликейшнүүдийг харуулах</translation> @@ -2684,6 +2687,7 @@ <translation id="3857807444929313943">Дээшлүүлээд дахин хүрэх</translation> <translation id="3861638017150647085">"<ph name="USERNAME" />" хэрэглэгчийн нэр боломжгүй байна</translation> <translation id="3861977424605124250">Гарааны компанид харуулах</translation> +<translation id="386239283124269513">&Бүлгийг сэргээх</translation> <translation id="3862788408946266506">"Kiosk_only" тодорхойлогч файлын шинжтэй аппыг Chrome-н үйлдлийн системийн киоск горимд суулгах шаардлагатай</translation> <translation id="3865414814144988605">Нягтрал</translation> <translation id="3866249974567520381">Тодорхойлолт</translation> @@ -5661,6 +5665,7 @@ <translation id="7225179976675429563">Сүлжээний төрөл алга байна</translation> <translation id="7228479291753472782">Гео байршил, микрофон, камер зэрэг онцлог ашиглах боломжтой веб хуудасны тохиргоог тодорхойлдог.</translation> <translation id="7228523857728654909">Дэлгэцийн түгжээ болон нэвтрэлт</translation> +<translation id="7230222852462421043">&Цонхыг сэргээх</translation> <translation id="7230787553283372882">Текстийн хэмжээгээ өөрчлөх</translation> <translation id="7232750842195536390">Нэрийг өөрчилж чадсангүй</translation> <translation id="7234010996000898150">Linux-г сэргээхийг цуцалж байна</translation> @@ -6269,12 +6274,14 @@ <translation id="7853747251428735">Бусад хэрэгсэл</translation> <translation id="7855678561139483478">Табыг шинэ цонх руу зөөх</translation> <translation id="7857093393627376423">Текстийн зөвлөмж</translation> +<translation id="7857675386615530425">Хуудасны хэсгийг Google Дурангаар хай</translation> <translation id="7857949311770343000">Энэ таны хүссэн шинэ хуудас мөн үү?</translation> <translation id="7858328180167661092"><ph name="APP_NAME" /> (Windows)</translation> <translation id="786073089922909430">Үйлчилгээ: <ph name="ARC_PROCESS_NAME" /></translation> <translation id="7861215335140947162">&Татаж авалтууд</translation> <translation id="7861846108263890455">Google Бүртгэлийн хэл</translation> <translation id="7864539943188674973">Bluetooth-ийг идэвхгүй болго</translation> +<translation id="7866230141401327032">Хуудасны хэсгийг Google Дурангаар хай</translation> <translation id="786957569166715433"><ph name="DEVICE_NAME" /> - Холбосон</translation> <translation id="7870730066603611552">Синк хийх сонголтын тохируулгыг хянах</translation> <translation id="7870790288828963061">Шинэ хувилбар бүхий ямар ч Киоск апп олдсонгүй. Шинэчлэх ямар ч зүйл алга. USB дискээ салгана уу.</translation> @@ -6849,6 +6856,7 @@ <translation id="850875081535031620">Хортой программ олдсонгүй</translation> <translation id="8509177919508253835">Аюулгүй байдлын түлхүүрийг шинэчилж, ПИН үүсгэнэ үү</translation> <translation id="8509646642152301857">Зөв бичих дүрмийн алдаа шалгах толь бичгийг татаж авч чадсангүй.</translation> +<translation id="8509967119010808787">Табаа хайхын тулд энд товшино уу</translation> <translation id="8512396579636492893">{COUNT,plural, =0{Сул нууц үг олсонгүй}=1{{COUNT} сул нууц үг оллоо}other{{COUNT} сул нууц үг оллоо}}</translation> <translation id="8512476990829870887">Дуусгах явц</translation> <translation id="851263357009351303"><ph name="HOST" />-д зургуудыг харуулахыг үргэлж зөвшөөр</translation>
diff --git a/chrome/app/resources/generated_resources_pa.xtb b/chrome/app/resources/generated_resources_pa.xtb index c071d93..c34a76f 100644 --- a/chrome/app/resources/generated_resources_pa.xtb +++ b/chrome/app/resources/generated_resources_pa.xtb
@@ -253,6 +253,7 @@ <translation id="126768002343224824">16x</translation> <translation id="1272079795634619415">ਰੋਕੋ</translation> <translation id="1272978324304772054">ਇਹ ਵਰਤੋਂਕਾਰ ਖਾਤਾ ਉਸ ਡੋਮੇਨ ਨਾਲ ਸੰਬੰਧਿਤ ਨਹੀਂ ਹੈ ਜਿਸ ਨਾਲ ਡੀਵਾਈਸ ਦਰਜ ਕੀਤਾ ਗਿਆ ਹੈ। ਜੇਕਰ ਤੁਸੀਂ ਇੱਕ ਵੱਖ ਡੋਮੇਨ ਦਰਜ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ, ਤਾਂ ਤੁਹਾਨੂੰ ਪਹਿਲਾਂ ਡੀਵਾਈਸ ਰਿਕਵਰੀ 'ਤੇ ਜਾਣ ਦੀ ਲੋੜ ਹੈ।</translation> +<translation id="1273780413309681229">ਸੈੱਟਅੱਪ ਗਾਈਡ ਨੂੰ ਮੁੜ-ਚਲਾਓ</translation> <translation id="1274997165432133392">ਕੁਕੀਜ਼ ਅਤੇ ਹੋਰ ਸਾਈਟ ਡਾਟਾ</translation> <translation id="1275718070701477396">ਚੁਣਿਆ ਗਿਆ</translation> <translation id="1276994519141842946"><ph name="APP_NAME" /> ਨੂੰ ਅਣਸਥਾਪਤ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ</translation> @@ -411,6 +412,7 @@ <translation id="1442851588227551435">Kerberos ਟਿਕਟ ਨੂੰ ਕਿਰਿਆਸ਼ੀਲ 'ਤੇ ਸੈੱਟ ਕਰੋ</translation> <translation id="1444628761356461360">ਇਹ ਸੈਟਿੰਗ ਡੀਵਾਈਸ ਮਾਲਕ <ph name="OWNER_EMAIL" /> ਵੱਲੋਂ ਪ੍ਰਬੰਧਿਤ ਕੀਤੀ ਜਾਂਦੀ ਹੈ।</translation> <translation id="144518587530125858">ਥੀਮ ਲਈ '<ph name="IMAGE_PATH" />' ਨੂੰ ਲੋਡ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ।</translation> +<translation id="1449191289887455076">ਅਸਾਈਨਮੈਂਟ ਦੀ ਤਸਦੀਕ ਕਰਨ ਲਈ “<ph name="CURRENTKEY" />” ਨੂੰ ਦੁਬਾਰਾ ਦਬਾਓ ਅਤੇ <ph name="RESPONSE" /></translation> <translation id="1451375123200651445">ਵੈਬਪੇਜ, ਸਿੰਗਲ ਫਾਈਲ</translation> <translation id="1453561711872398978"><ph name="BEGIN_LINK" /> ਡੀਬੱਗ ਲੌਗ<ph name="END_LINK" /> ਭੇਜੋ (ਸਿਫ਼ਾਰਸ਼ੀ)</translation> @@ -520,6 +522,7 @@ <translation id="15662109988763471">ਚੁਣਿਆ ਗਿਆ ਪ੍ਰਿੰਟਰ ਉਪਲਬਧ ਨਹੀਂ ਹੈ ਜਾਂ ਸਹੀ ਢੰਗ ਨਾਲ ਸਥਾਪਤ ਨਹੀਂ ਕੀਤਾ ਗਿਆ ਹੈ। ਆਪਣੇ ਪ੍ਰਿੰਟਰ ਦੀ ਜਾਂਚ ਕਰੋ ਜਾਂ ਕੋਈ ਹੋਰ ਪ੍ਰਿੰਟਰ ਚੁਣਕੇ ਦੇਖੋ।</translation> <translation id="1567135437923613642">ਚੋਣਵੇਂ ਪ੍ਰਯੋਗ ਚਾਲੂ ਕਰੋ</translation> <translation id="1567387640189251553">ਤੁਹਾਡੇ ਵੱਲੋਂ ਪਿਛਲੀ ਵਾਰ ਆਪਣਾ ਪਾਸਵਰਡ ਦਾਖਲ ਕਰਨ ਤੋਂ ਬਾਅਦ ਕੋਈ ਵੱਖਰਾ ਕੀ-ਬੋਰਡ ਕਨੈਕਟ ਕੀਤਾ ਗਿਆ ਹੈ। ਹੋ ਸਕਦਾ ਹੈ ਕਿ ਇਹ ਤੁਹਾਡੇ ਕੀਸਟ੍ਰੋਕ ਚੋਰੀ ਕਰਨ ਦੀ ਕੋਸ਼ਿਸ਼ ਕਰ ਰਿਹਾ ਹੋਵੇ।</translation> +<translation id="156793199942386351">'<ph name="CURRENTKEY" />' ਨੂੰ ਪਹਿਲਾਂ ਹੀ '<ph name="ACTION" />' ਕਾਰਵਾਈ ਦੇ ਜ਼ਿੰਮੇ ਲਗਾ ਦਿੱਤਾ ਗਿਆ ਹੈ। <ph name="RESPONSE" /> ਲਈ ਕਿਸੇ ਵੀ ਕੁੰਜੀ ਨੂੰ ਦਬਾਓ।</translation> <translation id="1567993339577891801">JavaScript Console</translation> <translation id="1568323446248056064">ਡਿਸਪਲੇ ਡੀਵਾਈਸ ਸੈਟਿੰਗਾਂ ਖੋਲ੍ਹੋ</translation> <translation id="1572139610531470719"><ph name="WINDOW_TITLE" /> (ਮਹਿਮਾਨ)</translation> @@ -792,6 +795,7 @@ <translation id="1822140782238030981">ਕੀ ਪਹਿਲਾਂ ਤੋਂ ਹੀ ਇੱਕ Chrome ਵਰਤੋਂਕਾਰ ਹੋ? ਸਾਈਨ-ਇਨ ਕਰੋ</translation> <translation id="18245044880483936">ਬੈਕਅੱਪ ਡਾਟੇ ਨੂੰ ਤੁਹਾਡੇ ਬੱਚੇ ਦੇ 'ਡਰਾਈਵ' ਸਟੋਰੇਜ ਕੋਟੇ ਵਿੱਚ ਨਹੀਂ ਗਿਣਿਆ ਜਾਵੇਗਾ।</translation> <translation id="1825565032302550710">ਪੋਰਟ 1024 ਅਤੇ 65535 ਦੇ ਵਿਚਕਾਰ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ</translation> +<translation id="1826192255355608658">ਆਪਣੇ Chrome ਬ੍ਰਾਊਜ਼ਰ ਦੇ ਬੁੱਕਮਾਰਕਾਂ, ਪਾਸਵਰਡਾਂ ਅਤੇ ਇਤਿਹਾਸ ਅਤੇ ਹੋਰ ਵੀ ਬਹੁਤ ਕੁਝ ਦਾ ਸਮਕਾਲੀਕਰਨ ਕਰੋ</translation> <translation id="1826516787628120939">ਜਾਂਚ ਕਰ ਰਿਹਾ ਹੈ</translation> <translation id="1827738518074806965">ਕਲਾ ਗੈਲਰੀ</translation> <translation id="1828378091493947763">ਇਹ ਪਲੱਗਇਨ ਇਸ ਡੀਵਾਈਸ 'ਤੇ ਸਮਰਥਿਤ ਨਹੀਂ ਹੈ</translation> @@ -1315,6 +1319,7 @@ <translation id="2379281330731083556">ਸਿਸਟਮ ਵਿੰਡੋ ਵਰਤਦੇ ਹੋਏ ਪ੍ਰਿੰਟ ਕਰੋ... <ph name="SHORTCUT_KEY" /></translation> <translation id="2381756643783702095">ਭੇਜਣ ਤੋਂ ਪਹਿਲਾਂ ਪੁੱਛੋ (ਸਿਫ਼ਾਰਿਸ਼ ਕੀਤਾ)</translation> <translation id="2382818385048255866">ਆਪਣੀਆਂ ਐਕਸਟੈਂਸ਼ਨਾਂ ਦੀ ਜਾਂਚ ਕਰੋ</translation> +<translation id="2383270717570379869">ਸਾਈਨ-ਇਨ ਹੋਣ 'ਤੇ ਤੁਹਾਡੇ Google ਖਾਤੇ ਵਿੱਚ <ph name="BEGIN_LINK_SEARCH" />ਖੋਜ ਇਤਿਹਾਸ<ph name="END_LINK_SEARCH" /> ਅਤੇ <ph name="BEGIN_LINK_GOOGLE" />ਸਰਗਰਮੀ ਦੀਆਂ ਹੋਰ ਕਿਸਮਾਂ<ph name="END_LINK_GOOGLE" /> ਨੂੰ ਰੱਖਿਅਤ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਤੁਸੀਂ ਕਿਸੇ ਵੇਲੇ ਵੀ ਇਹਨਾਂ ਨੂੰ ਮਿਟਾ ਸਕਦੇ ਹੋ।</translation> <translation id="2387052489799050037">ਹੋਮ 'ਤੇ ਜਾਓ</translation> <translation id="2390347491606624519">ਪ੍ਰੌਕਸੀ ਨਾਲ ਕਨੈਕਟ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ, ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਸਾਈਨ-ਇਨ ਕਰੋ</translation> <translation id="2390782873446084770">ਵਾਈ-ਫਾਈ ਸਿੰਕ</translation> @@ -1479,6 +1484,7 @@ <translation id="2553440850688409052">ਇਹ ਪਲੱਗਇਨ ਲੁਕਾਓ</translation> <translation id="2554553592469060349">ਚੁਣੀ ਗਈ ਫਾਈਲ ਬਹੁਤ ਜ਼ਿਆਦਾ ਵੱਡੀ ਹੈ (ਅਧਿਕਤਮ ਆਕਾਰ: 3mb).</translation> <translation id="2558896001721082624">ਸਿਸਟਮ ਮੀਨੂ ਵਿੱਚ ਹਮੇਸ਼ਾਂ ਪਹੁੰਚਯੋਗਤਾ ਵਿਕਲਪ ਦਿਖਾਓ</translation> +<translation id="2564407282561292919">ਖੋਜ ਬਾਕਸ ਵਿੱਚ ਇਤਿਹਾਸ ਨੂੰ ਕਲੀਅਰ ਕਰਦਾ ਹੈ। ਤੁਹਾਡੇ Google ਖਾਤੇ ਵਿੱਚ <ph name="BEGIN_LINK" />myactivity.google.com<ph name="END_LINK" /> 'ਤੇ ਬ੍ਰਾਊਜ਼ਿੰਗ ਇਤਿਹਾਸ ਦੀਆਂ ਹੋਰ ਕਿਸਮਾਂ ਹੋ ਸਕਦੀਆਂ ਹਨ।</translation> <translation id="2564520396658920462">AppleScript ਦੇ ਰਾਹੀਂ JavaScript ਨੂੰ ਚਲਾਉਣਾ ਬੰਦ ਹੈ। ਇਸਨੂੰ ਮੀਨੂ ਬਾਰ ਤੋਂ ਚਲਾਉਣ ਲਈ, ਦ੍ਰਿਸ਼ > ਵਿਕਾਸਕਾਰ > Apple ਇਵੈਂਟਾਂ ਤੋਂ JavaScript ਚੱਲਣ ਦਿਓ 'ਤੇ ਜਾਓ। ਹੋਰ ਜਾਣਕਾਰੀ ਲਈ: https://support.google.com/chrome/?p=applescript</translation> <translation id="2564653188463346023">ਬਿਹਤਰ ਸ਼ਬਦ-ਜੋੜ ਜਾਂਚ</translation> <translation id="2568774940984945469">ਇੰਫੋਬਾਰ ਕੰਟੇਨਰ</translation> @@ -1802,6 +1808,7 @@ <translation id="2907619724991574506">ਸਟਾਰਟਅਪ URL</translation> <translation id="2907798539022650680">'<ph name="NAME" />' ਨਾਲ ਕਨੈਕਟ ਕਰਨ ਵਿੱਚ ਅਸਫਲ ਰਿਹਾ: <ph name="DETAILS" /> ਸਰਵਰ ਸੁਨੇਹਾ: <ph name="SERVER_MSG" /></translation> <translation id="2908162660801918428">ਡਾਇਰੈਕਟਰੀ ਦੁਆਰਾ ਮੀਡੀਆ ਗੈਲਰੀ ਜੋੜੋ</translation> +<translation id="2908358077082926882">ਅਸਾਈਨਮੈਂਟ ਹਟਾਉਣ ਲਈ “<ph name="CURRENTKEY" />” ਨੂੰ ਦੁਬਾਰਾ ਦਬਾਓ ਅਤੇ <ph name="RESPONSE" /></translation> <translation id="2910318910161511225">ਨੈੱਟਵਰਕ ਨਾਲ ਕਨੈਕਟ ਕਰੋ ਅਤੇ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ</translation> <translation id="291056154577034373">ਨਾ-ਪੜ੍ਹੇ</translation> <translation id="2910718431259223434">ਕੋਈ ਗੜਬੜ ਹੋ ਗਈ। ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ ਜਾਂ ਆਪਣੇ ਡੀਵਾਈਸ ਦੇ ਮਾਲਕ ਜਾਂ ਪ੍ਰਸ਼ਾਸਕ ਨੂੰ ਸੰਪਰਕ ਕਰੋ। ਗੜਬੜ ਕੋਡ: <ph name="ERROR_CODE" />।</translation> @@ -2298,6 +2305,7 @@ <translation id="3462311546193741693">ਤੁਹਾਨੂੰ ਲਗਭਗ ਸਾਰੀਆਂ ਸਾਈਟਾਂ ਤੋਂ ਸਾਈਨ-ਆਊਟ ਕਰ ਦਿੰਦਾ ਹੈ। ਤੁਸੀਂ ਆਪਣੇ 'Google ਖਾਤੇ' 'ਤੇ ਸਾਈਨ-ਇਨ ਰਹੋਗੇ ਤਾਂ ਜੋ ਤੁਹਾਡਾ ਸਮਕਾਲੀਕਿਰਤ ਡਾਟਾ ਕਲੀਅਰ ਕੀਤਾ ਜਾ ਸਕੇ।</translation> <translation id="3462413494201477527">ਕੀ ਖਾਤਾ ਸੈੱਟਅੱਪ ਰੱਦ ਕਰਨਾ ਹੈ?</translation> <translation id="346298925039590474">ਇਹ ਮੋਬਾਈਲ ਨੈੱਟਵਰਕ ਇਸ ਡੀਵਾਈਸ ਦੇ ਸਾਰੇ ਵਰਤੋਂਕਾਰਾਂ ਲਈ ਉਪਲਬਧ ਰਹੇਗਾ</translation> +<translation id="3463235406897625623">'ਚੁਣੋ' ਲਈ ਜ਼ਿੰਮੇ ਲਗਾਏ ਗਏ ਇੱਕੋ-ਇੱਕ ਸਵਿੱਚ ਨੂੰ ਹਟਾਇਆ ਨਹੀਂ ਜਾ ਸਕਦਾ। <ph name="RESPONSE" /> ਲਈ ਕਿਸੇ ਵੀ ਕੁੰਜੀ ਨੂੰ ਦਬਾਓ।</translation> <translation id="3464145797867108663">ਕਾਰਜ ਪ੍ਰੋਫਾਈਲ ਸ਼ਾਮਲ ਕਰੋ</translation> <translation id="346431825526753">ਇਹ <ph name="CUSTODIAN_EMAIL" /> ਵੱਲੋਂ ਪ੍ਰਬੰਧਿਤ ਕੀਤੇ ਬੱਚਿਆਂ ਦਾ ਇੱਕ ਖਾਤਾ ਹੈ।</translation> <translation id="3468298837301810372">ਲੇਬਲ</translation> @@ -2308,6 +2316,7 @@ <translation id="3473479545200714844">ਸਕ੍ਰੀਨ ਵਿਸਤਾਰਕ</translation> <translation id="3474218480460386727">ਨਵੇਂ ਸ਼ਬਦਾਂ ਲਈ 99 ਜਾਂ ਘੱਟ ਅੱਖਰ ਵਰਤੋ</translation> <translation id="3475843873335999118">ਮਾਫ਼ ਕਰਨਾ, ਤੁਹਾਡੇ ਫਿੰਗਰਪ੍ਰਿੰਟ ਦੀ ਅਜੇ ਪਛਾਣ ਨਹੀਂ ਹੋਈ। ਕਿਰਪਾ ਕਰਕੇ ਆਪਣਾ ਪਾਸਵਰਡ ਦਾਖਲ ਕਰੋ।</translation> +<translation id="3475986680293081450">ਕੁੰਜੀਆਂ ਮੇਲ ਨਹੀਂ ਖਾਂਦੀਆਂ। <ph name="RESPONSE" /> ਲਈ ਕਿਸੇ ਵੀ ਕੁੰਜੀ ਨੂੰ ਦਬਾਓ।</translation> <translation id="3476303763173086583">ਵਰਤੋਂ ਅਤੇ ਤਸ਼ਖੀਸ ਡਾਟਾ ਭੇਜੋ। Google ਨੂੰ ਸਵੈਚਲਿਤ ਤੌਰ 'ਤੇ ਤਸ਼ਖੀਸ, ਡੀਵਾਈਸ ਅਤੇ ਐਪ ਵਰਤੋਂ ਡਾਟਾ ਭੇਜ ਕੇ ਆਪਣੇ ਬੱਚੇ ਦਾ Android ਅਨੁਭਵ ਨੂੰ ਬਿਹਤਰ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਕਰੋ। ਇਸਦੀ ਵਰਤੋਂ ਤੁਹਾਡੇ ਬੱਚੇ ਦੀ ਪਛਾਣ ਕਰਨ ਲਈ ਨਹੀਂ ਕੀਤੀ ਜਾਵੇਗੀ ਅਤੇ ਸਿਸਟਮ ਅਤੇ ਐਪ ਸਥਿਰਤਾ ਅਤੇ ਹੋਰ ਚੀਜ਼ਾਂ ਨੂੰ ਬਿਹਤਰ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਮਿਲੇਗੀ। ਕੁਝ ਏਕੀਕ੍ਰਿਤ ਜਾਣਕਾਰੀ Google ਐਪਾਂ ਅਤੇ ਪਾਰਟਨਰਾਂ, ਜਿਵੇਂ ਕਿ Android ਵਿਕਾਸਕਾਰਾਂ, ਦੀ ਵੀ ਮਦਦ ਕਰੇਗੀ। ਇਹ <ph name="BEGIN_LINK1" />ਸੈਟਿੰਗ<ph name="END_LINK1" /> ਮਾਲਕ ਵੱਲੋਂ ਲਾਗੂ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਮਾਲਕ ਇਸ ਡੀਵਾਈਸ ਦੇ ਤਸ਼ਖੀਸ ਅਤੇ ਵਰਤੋਂ ਡਾਟੇ ਨੂੰ Google ਨੂੰ ਭੇਜਣਾ ਚੁਣ ਸਕਦਾ ਹੈ। ਜੇ ਤੁਹਾਡੇ ਬੱਚੇ ਲਈ ਵਧੀਕ 'ਵੈੱਬ ਅਤੇ ਐਪ ਸਰਗਰਮੀ' ਸੈਟਿੰਗ ਚਾਲੂ ਹੋਵੇ, ਤਾਂ ਇਹ ਡਾਟਾ ਉਸਦੇ Google ਖਾਤੇ ਵਿੱਚ ਰੱਖਿਅਤ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। <ph name="BEGIN_LINK2" />ਹੋਰ ਜਾਣੋ<ph name="END_LINK2" /></translation> <translation id="347670947055184738">ਓਹੋ! ਸਿਸਟਮ ਤੁਹਾਡੇ ਡੀਵਾਈਸ ਲਈ ਨੀਤੀ ਨੂੰ ਪ੍ਰਾਪਤ ਕਰਨ ਵਿੱਚ ਅਸਫਲ ਰਿਹਾ।</translation> <translation id="347785443197175480"><ph name="HOST" /> ਨੂੰ ਆਪਣੇ ਕੈਮਰੇ ਅਤੇ ਮਾਈਕ੍ਰੋਫੋਨ ਤੇ ਪਹੁੰਚ ਦੀ ਆਗਿਆ ਦੇਣਾ ਜਾਰੀ ਰੱਖੋ</translation> @@ -2366,6 +2375,7 @@ <translation id="3541823293333232175">ਜ਼ਿੰਮੇ ਲਗਾਇਆ ਗਿਆ</translation> <translation id="3543393733900874979">ਅੱਪਡੇਟ ਅਸਫਲ (ਗੜਬੜ: <ph name="ERROR_NUMBER" />)</translation> <translation id="3543597750097719865">SHA-512 ਨਾਲ X9.62 ECDSA ਹਸਤਾਖਰ</translation> +<translation id="3543651705416471414">ਸਾਰੇ ਸਵਿੱਚ ਅਸਾਈਨਮੈਂਟਾਂ ਨੂੰ ਕਲੀਅਰ ਕਰੋ</translation> <translation id="3544879808695557954">ਵਰਤੋਂਕਾਰ ਨਾਮ (ਵਿਕਲਪਿਕ)</translation> <translation id="354602065659584722">ਹਾਨੀਕਾਰਕ ਸਾਫਟਵੇਅਰ ਹਟਾਇਆ ਗਿਆ</translation> <translation id="3547954654003013442">ਪ੍ਰੌਕਸੀ ਸੈਟਿੰਗਾਂ</translation> @@ -2593,6 +2603,7 @@ <translation id="3778740492972734840">&ਵਿਕਾਸਕਾਰ ਟੂਲ</translation> <translation id="3778868487658107119">ਇਸਨੂੰ ਸਵਾਲ ਪੁੱਛੋ। ਇਸਨੂੰ ਕੰਮ ਕਰਨ ਲਈ ਕਹੋ। ਇਹ ਤੁਹਾਡਾ ਆਪਣਾ Google ਹੈ, ਜੋ ਹਮੇਸ਼ਾ ਮਦਦ ਲਈ ਤਿਆਰ ਹੈ।</translation> <translation id="3781742599892759500">Linux ਦੀ ਮਾਈਕ੍ਰੋਫ਼ੋਨ ਤੱਕ ਪਹੁੰਚ</translation> +<translation id="3782795641773236652">ਹਾਲੇ ਤੱਕ ਕਿਸੇ ਵੀ ਸਵਿੱਚ ਜਾਂ ਕੁੰਜੀ ਨੂੰ ਜ਼ਿੰਮੇ ਨਹੀਂ ਲਾਇਆ ਗਿਆ</translation> <translation id="378312418865624974">ਇਸ ਕੰਪਿਊਟਰ ਲਈ ਕਿਸੇ ਵਿਲੱਖਣ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪੜ੍ਹੋ</translation> <translation id="3784372983762739446">ਬਲੂਟੁੱਥ ਡੀਵਾਈਸਾਂ</translation> <translation id="3784472333786002075">ਕੁਕੀਜ਼ ਉਹ ਫ਼ਾਈਲਾਂ ਹਨ ਜੋ ਵੈੱਬਸਾਈਟਾਂ ਵੱਲੋਂ ਬਣਾਈਆਂ ਜਾਂਦੀਆਂ ਹਨ। ਕੁਕੀਜ਼ ਦੋ ਕਿਸਮਾਂ ਦੀਆਂ ਹੁੰਦੀਆਂ ਹਨ: ਪਹਿਲੀ-ਧਿਰ ਦੀਆਂ ਕੁਕੀਜ਼ ਤੁਹਾਡੇ ਵੱਲੋਂ ਦੇਖੀ ਸਾਈਟ ਵੱਲੋਂ ਬਣਾਈਆਂ ਜਾਂਦੀਆਂ ਹਨ। ਸਾਈਟ ਪਤਾ ਬਾਰ 'ਤੇ ਦਿਖਾਈ ਜਾਂਦੀ ਹੈ। ਤੀਜੀ-ਧਿਰ ਦੀਆਂ ਕੁਕੀਜ਼ ਹੋਰ ਸਾਈਟਾਂ ਵੱਲੋਂ ਬਣਾਈਆਂ ਜਾਂਦੀਆਂ ਹਨ। ਇਹ ਸਾਈਟਾਂ ਵਿਗਿਆਪਨਾਂ ਜਾਂ ਚਿੱਤਰਾਂ ਵਰਗੀ ਕੁਝ ਸਮੱਗਰੀ ਦੀਆਂ ਮਾਲਕ ਹੁੰਦੀਆਂ ਹਨ, ਜੋ ਤੁਸੀਂ ਵੈੱਬਸਾਈਟ 'ਤੇ ਦੇਖਦੇ ਹੋ।</translation> @@ -2871,6 +2882,7 @@ <translation id="406070391919917862">ਪਿਛੋਕੜ ਐਪਸ</translation> <translation id="4061374428807229313">ਸਾਂਝਾ ਕਰਨ ਲਈ, Files ਐਪ ਵਿੱਚ ਕਿਸੇ ਫੋਲਡਰ 'ਤੇ ਸੱਜਾ-ਕਲਿੱਕ ਕਰੋ, ਫਿਰ "Parallels Desktop ਨਾਲ ਸਾਂਝਾ ਕਰੋ" ਨੂੰ ਚੁਣੋ।</translation> <translation id="406213378265872299">ਵਿਉਂਤਬੱਧ ਕੀਤੇ ਵਿਵਹਾਰ</translation> +<translation id="4062561150282203854">ਆਪਣੀ <ph name="DEVICE_TYPE" /> ਦੀਆਂ ਐਪਾਂ, ਸੈਟਿੰਗਾਂ ਅਤੇ ਹੋਰ ਵੀ ਬਹੁਤ ਕੁਝ ਦਾ ਸਮਕਾਲੀਕਰਨ ਕਰੋ</translation> <translation id="4064575710864784237">1x</translation> <translation id="4065876735068446555">ਤੁਹਾਡੇ ਵੱਲੋਂ ਵਰਤਿਆ ਜਾ ਰਿਹਾ ਨੈੱਟਵਰਕ (<ph name="NETWORK_ID" />) ਇਹ ਚਾਹ ਸਕਦਾ ਹੈ ਕਿ ਤੁਸੀਂ ਇਸਦੇ ਲੌਗ-ਇਨ ਪੰਨੇ 'ਤੇ ਜਾਓ।</translation> <translation id="4066207411788646768">ਤੁਹਾਡੇ ਨੈੱਟਵਰਕ ਵਿੱਚ ਉਪਲਬਧ ਪ੍ਰਿੰਟਰ ਦੇਖਣ ਲਈ ਕਿਰਪਾ ਕਰਕੇ ਆਪਣੇ ਕਨੈਕਸ਼ਨ ਦੀ ਜਾਂਚ ਕਰੋ</translation> @@ -2992,6 +3004,7 @@ <translation id="4217571870635786043">ਬੋਲ ਅਨੁਸਾਰ ਲਿਖਤ</translation> <translation id="4220648711404560261">ਕਿਰਿਆਸ਼ੀਲ ਕਰਨ ਦੌਰਾਨ ਗੜਬੜ ਹੋ ਗਈ।</translation> <translation id="4222772810963087151">ਬਿਲਡ ਦੇ ਵੇਰਵੇ</translation> +<translation id="4225020013797061859">"<ph name="ACTION" />" ਨੂੰ ਜ਼ਿੰਮੇ ਲਾਉਣ ਲਈ ਕੋਈ ਸਵਿੱਚ ਜਾਂ ਕੁੰਜੀ ਦਬਾਓ</translation> <translation id="4225397296022057997">ਸਾਰੀਆਂ ਸਾਈਟਾਂ 'ਤੇ</translation> <translation id="4231095370974836764">ਆਪਣੇ <ph name="DEVICE_TYPE" /> 'ਤੇ Google Play ਤੋਂ ਐਪਾਂ ਅਤੇ ਗੇਮਾਂ ਸਥਾਪਤ ਕਰੋ। <ph name="LINK_BEGIN" />ਹੋਰ ਜਾਣੋ<ph name="LINK_END" /></translation> <translation id="4232375817808480934">Kerberos ਦਾ ਸੰਰੂਪਣ ਕਰੋ</translation> @@ -3143,6 +3156,7 @@ <translation id="440653823335387109">ਤੁਹਾਡੇ ਵੱਲੋਂ ਪੜ੍ਹੇ ਗਏ ਪੰਨੇ</translation> <translation id="4406883609789734330">ਲਾਈਵ ਸੁਰਖੀਆਂ</translation> <translation id="4408599188496843485">ਸ&ਹਾਇਤਾ</translation> +<translation id="4409271659088619928">ਤੁਹਾਡਾ ਖੋਜ ਇੰਜਣ <ph name="DSE" /> ਹੈ। ਲਾਗੂ ਹੋਣ 'ਤੇ, ਆਪਣਾ ਖੋਜ ਇਤਿਹਾਸ ਮਿਟਾਉਣ ਲਈ ਉਹਨਾਂ ਦੀਆਂ ਹਿਦਾਇਤਾਂ ਦੇਖੋ।</translation> <translation id="4409697491990005945">ਹਾਸ਼ੀਏ</translation> <translation id="4410545552906060960">ਆਪਣੇ ਡੀਵਾਈਸ ਨੂੰ ਅਣਲਾਕ ਕਰਨ ਲਈ ਪਾਸਵਰਡ ਦੀ ਬਜਾਏ ਨੰਬਰ (ਪਿੰਨ) ਵਰਤੋ। ਬਾਅਦ ਵਿੱਚ ਆਪਣਾ ਪਿੰਨ ਸੈੱਟ ਕਰਨ ਲਈ, ਸੈਟਿੰਗਾਂ 'ਤੇ ਜਾਓ।</translation> <translation id="4411578466613447185">ਕੋਡ ਸਾਈਨਰ</translation> @@ -3212,6 +3226,7 @@ <translation id="4480590691557335796">Chrome ਤੁਹਾਡੇ ਕੰਪਿਊਟਰ 'ਤੇ ਹਾਨੀਕਾਰਕ ਸਾਫ਼ਟਵੇਅਰ ਲੱਭ ਸਕਦਾ ਹੈ ਅਤੇ ਉਸਨੂੰ ਹਟਾ ਸਕਦਾ ਹੈ</translation> <translation id="4481467543947557978">ਸੇਵਾ ਕਰਮਚਾਰੀ</translation> <translation id="4481530544597605423">ਅਣ-ਜੋੜਾਬੱਧ ਕੀਤੀਆਂ ਡੀਵਾਈਸਾਂ</translation> +<translation id="4481906837550700306">ਸੈੱਟਅੱਪ ਗਾਈਡ ਨੂੰ ਮੁੜ-ਚਲਾਉਣ ਨਾਲ ਤੁਹਾਡੇ ਵੱਲੋਂ ਜ਼ਿੰਮੇ ਲਾਏ ਸਵਿੱਚ ਹਟ ਜਾਣਗੇ। ਕੀ ਤੁਸੀਂ ਜਾਰੀ ਰੱਖਣਾ ਚਾਹੁੰਦੇ ਹੋ?</translation> <translation id="4482990632723642375">ਹਾਲ ਹੀ ਵਿੱਚ ਬੰਦ ਕੀਤੀ ਗਈ ਟੈਬ</translation> <translation id="4487489714832036847">Chromebooks ਰਵਾਇਤੀ ਸਾਫ਼ਟਵੇਅਰ ਦੀ ਬਜਾਏ ਐਪਾਂ ਦੀ ਵਰਤੋਂ ਕਰਦੀਆਂ ਹਨ। ਉਤਪਾਦਕਤਾ, ਮਨੋਰੰਜਨ ਅਤੇ ਹੋਰ ਬਹੁਤ ਕੁਝ ਲਈ ਐਪਾਂ ਪ੍ਰਾਪਤ ਕਰੋ।</translation> <translation id="4488257340342212116">ਤੁਹਾਡੇ ਕੈਮਰੇ ਦੀ ਵਰਤੋਂ ਕਰਨ ਦੀ ਇਜਾਜ਼ਤ ਹੈ</translation> @@ -4500,6 +4515,7 @@ <translation id="5938002010494270685">ਸੁਰੱਖਿਆ ਅੱਪਗ੍ਰੇਡ ਉਪਲਬਧ ਹੈ</translation> <translation id="5939518447894949180">ਰੀਸੈਟ ਕਰੋ</translation> <translation id="5939719276406088041">ਸ਼ਾਰਟਕੱਟ ਬਣਾਇਆ ਨਹੀਂ ਜਾ ਸਕਦਾ</translation> +<translation id="594048410531370124">ਅਣ-ਪਛਾਤੀ ਕੁੰਜੀ। <ph name="RESPONSE" /> ਲਈ ਕਿਸੇ ਵੀ ਕੁੰਜੀ ਨੂੰ ਦਬਾਓ।</translation> <translation id="5941153596444580863">ਵਿਅਕਤੀ ਜੋੜੋ...</translation> <translation id="5941343993301164315">ਕਿਰਪਾ ਕਰਕੇ <ph name="TOKEN_NAME" /> 'ਤੇ ਸਾਈਨ-ਇਨ ਕਰੋ।</translation> <translation id="5941711191222866238">ਨਿਊਨਤਮ</translation> @@ -4526,6 +4542,7 @@ <translation id="5963117322306686970">ਟੈਬਾਂ ਨੂੰ ਗਰੁੱਪ ਵਿੱਚ ਇਕੱਠਾ ਕਰਨ ਲਈ, ਟੈਬ 'ਤੇ ਸੱਜਾ-ਕਲਿੱਕ ਕਰੋ</translation> <translation id="5963453369025043595"><ph name="NUM_HANDLES" /> (<ph name="NUM_KILOBYTES_LIVE" /> ਪੀਕ)</translation> <translation id="5964113968897211042">{COUNT,plural, =0{ਸਾਰੇ &ਨਵੀਂ ਵਿੰਡੋ ਵਿੱਚ ਖੋਲ੍ਹੋ}=1{&ਨਵੀਂ ਵਿੰਡੋ ਵਿੱਚ ਖੋਲ੍ਹੋ}other{ਸਾਰੇ ({COUNT}) &ਨਵੀਂ ਵਿੰਡੋ ਵਿੱਚ ਖੋਲ੍ਹੋ}}</translation> +<translation id="5964328685964290415">ਸਾਰੇ ਨੈਵੀਗੇਸ਼ਨਾਂ ਨੂੰ HTTPS 'ਤੇ ਅੱਪਗ੍ਰੇਡ ਕਰੋ ਅਤੇ ਇੰਝ ਕਰਨ ਨਾਲ ਤੁਹਾਨੂੰ ਉਹਨਾਂ ਸਾਈਟਾਂ ਦੇ ਲੋਡ ਹੋਣ ਤੋਂ ਪਹਿਲਾਂ ਚਿਤਾਵਨੀ ਮਿਲੇਗੀ ਜੋ ਇਸਦਾ ਸਮਰਥਨ ਨਹੀਂ ਕਰਦੀਆਂ</translation> <translation id="5965661248935608907">ਇਹ ਇਸ ਨੂੰ ਵੀ ਕੰਟਰੋਲ ਕਰਦਾ ਹੈ ਕਿ ਜਦੋਂ ਤੁਸੀਂ ਹੋਮ ਬਟਨ 'ਤੇ ਕਲਿੱਕ ਕਰਦੇ ਹੋ ਜਾਂ ਓਮਨੀਬਾਕਸ ਤੋਂ ਖੋਜ ਕਰਦੇ ਹੋ ਉਸ ਵੇਲੇ ਕਿਹੜਾ ਪੰਨਾ ਦਿਖਾਇਆ ਜਾਵੇ।</translation> <translation id="5969419185858894314"><ph name="ORIGIN" /> ਸਾਈਟ <ph name="FOLDERNAME" /> ਵਿਚਲੀਆਂ ਫ਼ਾਈਲਾਂ ਨੂੰ ਦੇਖ ਸਕਦੀ ਹੈ</translation> <translation id="5969728632630673489">ਕੀ-ਬੋਰਡ ਸ਼ਾਰਟਕੱਟ ਸੰਬੰਧੀ ਸੂਚਨਾ ਨੂੰ ਖਾਰਜ ਕੀਤਾ ਗਿਆ</translation> @@ -5819,6 +5836,7 @@ <translation id="7415454883318062233">ਸੈੱਟਅੱਪ ਪੂਰਾ ਹੋਇਆ</translation> <translation id="7416362041876611053">ਅਗਿਆਤ ਨੈੱਟਵਰਕ ਗੜਬੜ।</translation> <translation id="741906494724992817">ਇਸ ਐਪ ਲਈ ਕੋਈ ਖ਼ਾਸ ਇਜਾਜ਼ਤਾਂ ਦੀ ਲੋੜ ਨਹੀਂ ਹੈ।</translation> +<translation id="7419565702166471774">ਹਮੇਸ਼ਾਂ ਸੁਰੱਖਿਅਤ ਕਨੈਕਸ਼ਨਾਂ ਨੂੰ ਵਰਤੋ</translation> <translation id="7421067045979951561">ਪ੍ਰੋਟੋਕੋਲ ਹੈਂਡਲਰ</translation> <translation id="742130257665691897">ਬੁੱਕਮਾਰਕ ਹਟਾਏ ਗਏ</translation> <translation id="7421925624202799674">&ਸਫ਼ਾ ਸ੍ਰੋਤ ਦੇਖੋ</translation> @@ -5840,6 +5858,7 @@ <translation id="7434969625063495310">ਪ੍ਰਿੰਟ ਸਰਵਰ ਨੂੰ ਸ਼ਾਮਲ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ। ਕਿਰਪਾ ਕਰਕੇ ਸਰਵਰ ਦੇ ਸੰਰੂਪਣ ਦੀ ਜਾਂਚ ਕਰਕੇ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ।</translation> <translation id="7436921188514130341">ਓਹੋ! ਨਾਮ ਬਦਲਣ ਦੌਰਾਨ ਗੜਬੜ ਹੋ ਗਈ।</translation> <translation id="7438495332316988804">ਲਾਂਚਰ ਵਿੱਚ "Chrome" ਟਾਈਪ ਕਰਕੇ ਮਿਆਰੀ ਬ੍ਰਾਊਜ਼ਰ ਨੂੰ ਲੱਭਿਆ ਜਾ ਸਕਦਾ ਹੈ।</translation> +<translation id="7439446972050308922">ਆਪਣੇ Google ਖਾਤੇ ਨਾਲ ਸਾਈਨ-ਇਨ ਕਰਨ 'ਤੇ ਤੁਹਾਡੀਆਂ ਰੱਖਿਅਤ ਕੀਤੀਆਂ ਤਰਜੀਹਾਂ ਕਿਸੇ ਵੀ Chrome OS ਡੀਵਾਈਸ 'ਤੇ ਤਿਆਰ ਰਹਿਣਗੀਆਂ। ਤੁਸੀਂ ਸੈਟਿੰਗਾਂ ਵਿੱਚ ਇਹ ਚੁਣ ਸਕਦੇ ਹੋ ਕਿ ਕਿਸਦਾ ਸਮਕਾਲੀਕਰਨ ਕਰਨਾ ਹੈ।</translation> <translation id="7439519621174723623">ਜਾਰੀ ਰੱਖਣ ਲਈ ਇੱਕ ਡੀਵਾਈਸ ਦਾ ਨਾਮ ਸ਼ਾਮਲ ਕਰੋ</translation> <translation id="7441736921018636843">ਇਸ ਸੈਟਿੰਗ ਨੂੰ ਬਦਲਣ ਲਈ, ਆਪਣਾ ਸਮਕਾਲੀਕਰਨ ਪਾਸਫਰੇਜ਼ ਹਟਾਉਣ ਵਾਸਤੇ <ph name="BEGIN_LINK" />ਸਮਕਾਲੀਕਰਨ ਰੀਸੈੱਟ ਕਰੋ<ph name="END_LINK" /></translation> <translation id="7441830548568730290">ਹੋਰ ਵਰਤੋਂਕਾਰ</translation> @@ -5951,6 +5970,7 @@ <translation id="7557194624273628371">Linux ਪੋਰਟ ਫਾਰਵਰਡਿੰਗ</translation> <translation id="7557411183415085169">Linux ਵਿੱਚ ਡਿਸਕ ਜਗ੍ਹਾ ਬਹੁਤ ਘੱਟ ਬਚੀ ਹੈ</translation> <translation id="7559719679815339381">ਕਿਰਪਾ ਕਰਕੇ ਠਹਿਰੋ.... ਕਿਓਸਕ ਐਪ ਅੱਪਡੇਟ ਕੀਤੇ ਜਾਣ ਦੀ ਪ੍ਰਕਿਰਿਆ ਵਿੱਚ ਹੈ। USB ਸਟਿਕ ਨਾ ਹਟਾਓ।</translation> +<translation id="7560756177962144929">ਆਪਣੀ <ph name="DEVICE_TYPE" /> ਦਾ ਸਮਕਾਲੀਕਰਨ ਕਰੋ</translation> <translation id="7561196759112975576">ਹਮੇਸ਼ਾਂ</translation> <translation id="756445078718366910">ਬ੍ਰਾਊਜ਼ਰ Window ਖੋਲ੍ਹੋ</translation> <translation id="7564847347806291057">ਪ੍ਰਕਿਰਿਆ ਖ਼ਤਮ ਕਰੋ</translation> @@ -5987,6 +6007,7 @@ <translation id="760197030861754408">ਕਨੈਕਟ ਕਰਨ ਲਈ <ph name="LANDING_PAGE" /> ਤੇ ਜਾਓ।</translation> <translation id="7602079150116086782">ਹੋਰਾਂ ਡਿਵਾਈਸਾਂ ਤੋਂ ਕੋਈ ਟੈਬਸ ਨਹੀਂ</translation> <translation id="7602173054665172958">ਪ੍ਰਿੰਟ ਪ੍ਰਬੰਧਨ</translation> +<translation id="7603785829538808504">ਹੇਠਾਂ ਸੂਚੀਬੱਧ ਸਾਈਟਾਂ ਵਿੱਚ ਵਿਉਂਤੀ ਸੈਟਿੰਗ ਦਿੱਤੀ ਗਈ ਹੈ</translation> <translation id="7604942372593434070">ਆਪਣੀ ਬ੍ਰਾਊਜ਼ਿੰਗ ਸਰਗਰਮੀ 'ਤੇ ਪਹੁੰਚ ਕਰੋ</translation> <translation id="7605594153474022051">ਸਮਕਾਲੀਕਰਨ ਕੰਮ ਨਹੀਂ ਕਰ ਰਿਹਾ ਹੈ</translation> <translation id="7606992457248886637">ਅਧਿਕਾਰ</translation> @@ -6572,6 +6593,8 @@ <translation id="8189750580333936930">ਪ੍ਰਾਈਵੇਸੀ ਸੈਂਡਬਾਕਸ</translation> <translation id="8190193592390505034"><ph name="PROVIDER_NAME" /> ਨਾਲ ਕਨੈਕਟ ਕਰ ਰਿਹਾ ਹੈ</translation> <translation id="8191230140820435481">ਆਪਣੇ ਐਪਸ, ਐਕਸਟੈਂਸ਼ਨਾਂ ਅਤੇ ਵਿਸ਼ੇ ਵਿਵਸਥਿਤ ਕਰੋ</translation> +<translation id="819137301779081601">ਅਸਾਈਨਮੈਂਟ ਸ਼ੁਰੂ ਕਰਨ ਲਈ ਕੋਈ ਨਵਾਂ ਸਵਿੱਚ ਦਬਾਓ +ਅਸਾਈਨਮੈਂਟ ਹਟਾਉਣ ਲਈ ਕੋਈ ਜ਼ਿੰਮੇ ਲਾਇਆ ਸਵਿੱਚ ਦਬਾਓ</translation> <translation id="8192944472786724289"><ph name="APP_NAME" /> ਤੁਹਾਡੀ ਸਕ੍ਰੀਨ ਦੀਆਂ ਸਮੱਗਰੀਆਂ ਨੂੰ ਸਾਂਝਾ ਕਰਨਾ ਚਾਹੁੰਦੀ ਹੈ।</translation> <translation id="8195027750202970175">ਡਿਸਕ 'ਤੇ ਆਕਾਰ</translation> <translation id="8198323535106903877">ਅਸੀਂ ਤੁਹਾਡੇ ਲਈ ਉਹ <ph name="NUMBER_OF_APPS" /> ਐਪਾਂ ਸਥਾਪਤ ਕਰਾਂਗੇ</translation> @@ -6604,6 +6627,7 @@ <translation id="8230446983261649357">ਸਾਈਟਾਂ ਨੂੰ ਚਿੱਤਰ ਦਿਖਾਉਣ ਦੀ ਇਜਾਜ਼ਤ ਨਾ ਦਿਓ</translation> <translation id="8234795456569844941">ਕਿਰਪਾ ਕਰਕੇ ਸਾਡੇ ਇੰਜੀਨੀਅਰਾਂ ਨੂੰ ਇਸ ਸਮੱਸਿਆ ਦਾ ਹੱਲ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰੋ। ਸਾਨੂੰ ਦੱਸੋ ਕਿ ਤੁਹਾਨੂੰ ਪ੍ਰੋਫਾਈਲ ਗੜਬੜ ਸੁਨੇਹਾ ਮਿਲਣ ਤੋਂ ਠੀਕ ਪਹਿਲਾਂ ਕੀ ਹੋਇਆ ਸੀ:</translation> <translation id="8235418492073272647"><ph name="DEVICE_NAME" /> ਤੋਂ ਸਾਂਝਾ ਕੀਤਾ ਗਿਆ ਪੰਨਾ</translation> +<translation id="8236911020904880539">ਬਾਹਰ ਨਿਕਲੋ</translation> <translation id="8236917170563564587">ਇਸਦੀ ਬਜਾਏ ਇਹ ਟੈਬ ਸਾਂਝੀ ਕਰੋ</translation> <translation id="8237647586961940482">ਗੂੜ੍ਹਾ ਗੁਲਾਬੀ ਅਤੇ ਲਾਲ</translation> <translation id="8239032431519548577">ਐਂਟਰਪ੍ਰਾਈਜ਼ ਦਾਖਲਾ ਮੁਕੰਮਲ ਹੋਇਆ</translation> @@ -7139,6 +7163,7 @@ <translation id="8834039744648160717">ਨੈੱਟਵਰਕ ਸੰਰੂਪਣ <ph name="USER_EMAIL" /> ਦੁਆਰਾ ਕੰਟਰੋਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ।</translation> <translation id="8835786707922974220">ਪੱਕਾ ਕਰੋ ਕਿ ਤੁਸੀਂ ਆਪਣੇ ਰੱਖਿਅਤ ਕੀਤੇ ਪਾਸਵਰਡਾਂ ਤੱਕ ਹਮੇਸ਼ਾਂ ਪਹੁੰਚ ਕਰ ਸਕੋ</translation> <translation id="8836360711089151515"><ph name="MANAGER" /> ਲਈ ਤੁਹਾਨੂੰ ਆਪਣੇ ਡਾਟੇ ਦਾ ਬੈਕਅੱਪ ਲੈਣ ਅਤੇ 1 ਹਫ਼ਤੇ ਦੇ ਅੰਦਰ ਇਸ <ph name="DEVICE_TYPE" /> ਨੂੰ ਵਾਪਸ ਕਰਨ ਦੀ ਲੋੜ ਹੈ। <ph name="LINK_BEGIN" />ਵੇਰਵੇ ਦੇਖੋ<ph name="LINK_END" /></translation> +<translation id="8836782447513334597">ਜਾਰੀ ਰੱਖੋ</translation> <translation id="8838601485495657486">ਧੁੰਦਲਾ</translation> <translation id="8838770651474809439">ਹੈਮਬਰਗਰ</translation> <translation id="883911313571074303">ਚਿੱਤਰ ਐਨੋਟੇਟ ਕਰੋ</translation> @@ -7220,6 +7245,7 @@ <translation id="8912810933860534797">ਸਵੈਚਲਿਤ ਸਕੈਨ ਚਾਲੂ ਕਰੋ</translation> <translation id="8915370057835397490">ਸੁਝਾਅ ਲੋਡ ਕਰ ਰਿਹਾ ਹੈ</translation> <translation id="8916476537757519021">ਗੁਮਨਾਮ ਸਬਫ੍ਰੇਮ: <ph name="SUBFRAME_SITE" /></translation> +<translation id="8917293713468567935">ਸਾਈਨ-ਇਨ ਹੋਣ 'ਤੇ ਤੁਹਾਡੇ Google ਖਾਤੇ ਵਿੱਚ <ph name="BEGIN_LINK_GOOGLE" />ਸਰਗਰਮੀ ਦੀਆਂ ਹੋਰ ਕਿਸਮਾਂ<ph name="END_LINK_GOOGLE" /> ਨੂੰ ਰੱਖਿਅਤ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਤੁਸੀਂ ਕਿਸੇ ਵੇਲੇ ਵੀ ਇਹਨਾਂ ਨੂੰ ਮਿਟਾ ਸਕਦੇ ਹੋ।</translation> <translation id="8918637186205009138"><ph name="GIVEN_NAME" /> ਦਾ <ph name="DEVICE_TYPE" /></translation> <translation id="8922624386829239660">ਮਾਊਸ ਵੱਲੋਂ ਸਕ੍ਰੀਨ ਦੇ ਕਿਨਾਰਿਆਂ ਨੂੰ ਸਪਰਸ਼ ਕਰਨ 'ਤੇ ਸਕ੍ਰੀਨ ਨੂੰ ਹਿਲਾਓ</translation> <translation id="8923880975836399332">ਗੂੜ੍ਹਾ ਹਰਾ-ਨੀਲਾ</translation> @@ -7329,6 +7355,7 @@ <translation id="9030785788945687215">Gmail</translation> <translation id="9030855135435061269"><ph name="PLUGIN_NAME" /> ਹੁਣ ਸਮਰਥਿਤ ਨਹੀਂ ਹੈ</translation> <translation id="9031549947500880805">'Google ਡਰਾਈਵ' ਵਿੱਚ ਬੈਕਅੱਪ ਲਓ। ਕਿਸੇ ਵੇਲੇ ਵੀ ਅਸਾਨੀ ਨਾਲ ਆਪਣਾ ਡਾਟਾ ਮੁੜ-ਬਹਾਲ ਕਰੋ ਜਾਂ ਡੀਵਾਈਸਾਂ ਵਿਚਾਲੇ ਅਦਲਾ-ਬਦਲੀ ਕਰੋ। ਤੁਹਾਡੇ ਬੈਕਅੱਪ ਵਿੱਚ ਐਪ ਡਾਟਾ ਸ਼ਾਮਲ ਹੈ।</translation> +<translation id="9031811691986152304">ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ</translation> <translation id="9033765790910064284">ਫਿਰ ਵੀ ਜਾਰੀ ਰੱਖੋ</translation> <translation id="9033857511263905942">&ਪੇਸਟ ਕਰੋ</translation> <translation id="9037640663275993951">ਡੀਵਾਈਸ ਦੀ ਇਜਾਜ਼ਤ ਨਹੀਂ ਹੈ</translation> @@ -7355,6 +7382,8 @@ <translation id="9062468308252555888">14x</translation> <translation id="9063208415146866933"><ph name="ERROR_LINE_START" /> ਤੋਂ <ph name="ERROR_LINE_END" /> ਲਾਈਨਾਂ ਤੱਕ ਗੜਬੜ</translation> <translation id="9063800855227801443">ਗੁਪਤ ਸਮੱਗਰੀ ਨੂੰ ਕੈਪਚਰ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ</translation> +<translation id="9064039204504614208">“<ph name="ACTION" />” ਨੂੰ ਜ਼ਿੰਮੇ ਲਾਉਣ ਲਈ ਕੋਈ ਸਵਿੱਚ ਦਬਾਓ +ਤੁਸੀਂ ਇਸ ਕਾਰਵਾਈ ਲਈ ਇੱਕ ਤੋਂ ਵੱਧ ਸਵਿੱਚ ਜ਼ਿੰਮੇ ਲਗਾ ਸਕਦੇ ਹੋ</translation> <translation id="9064275926664971810">ਇੱਕੋ ਕਲਿੱਕ ਨਾਲ ਫ਼ਾਰਮਾਂ ਨੂੰ ਭਰਨ ਲਈ ਆਟੋਫਿਲ ਨੂੰ ਚਾਲੂ ਕਰੋ</translation> <translation id="9065203028668620118">ਸੰਪਾਦਿਤ ਕਰੋ</translation> <translation id="9066782832737749352">ਲਿਖਤ ਤੋਂ ਬੋਲੀ</translation>
diff --git a/chrome/app/resources/generated_resources_sq.xtb b/chrome/app/resources/generated_resources_sq.xtb index 5733655..daf8674 100644 --- a/chrome/app/resources/generated_resources_sq.xtb +++ b/chrome/app/resources/generated_resources_sq.xtb
@@ -250,6 +250,7 @@ <translation id="126768002343224824">16x</translation> <translation id="1272079795634619415">Ndalo</translation> <translation id="1272978324304772054">Kjo llogari përdoruesi nuk i përket domenit me të cilin është regjistruar kjo pajisje. Nëse do të regjistrohesh në një domen tjetër, së pari duhet të kontrollosh rikuperimin e pajisjes.</translation> +<translation id="1273780413309681229">Riekzekuto udhëzuesin e konfigurimit</translation> <translation id="1274997165432133392">Kukit dhe të dhënat e tjera të sajtit</translation> <translation id="1275718070701477396">Përzgjedhur</translation> <translation id="1276994519141842946"><ph name="APP_NAME" /> nuk mund të çinstalohej</translation> @@ -408,6 +409,7 @@ <translation id="1442851588227551435">Cakto biletë aktive Kerberos</translation> <translation id="1444628761356461360">Ky cilësim menaxhohet nga zotëruesi i pajisjes, <ph name="OWNER_EMAIL" /></translation> <translation id="144518587530125858">Nuk mundi të ngarkonte "<ph name="IMAGE_PATH" />" për temën.</translation> +<translation id="1449191289887455076">Shtyp përsëri "<ph name="CURRENTKEY" />" për të konfirmuar caktimin dhe <ph name="RESPONSE" />.</translation> <translation id="1451375123200651445">Faqja e uebit, një skedar i vetëm</translation> <translation id="1453561711872398978">Dërgo <ph name="BEGIN_LINK" />evidencat e korrigjimit<ph name="END_LINK" /> (rekomandohet)</translation> <translation id="1454223536435069390">&Nxirr një pamje të ekranit</translation> @@ -513,6 +515,7 @@ <translation id="15662109988763471">Printeri i zgjedhur nuk ofrohet ose nuk është instaluar si duhet. Kontrollo printerin ose provo të zgjedhësh një printer tjetër.</translation> <translation id="1567135437923613642">Aktivizo eksperimentet e veçanta</translation> <translation id="1567387640189251553">Është lidhur një tastierë tjetër që nga hera e fundit që fute fjalëkalimin tënd. Ajo ndoshta po përpiqet të regjistrojë goditjet e tasteve.</translation> +<translation id="156793199942386351">"<ph name="CURRENTKEY" />" i është caktuar tashmë veprimit "<ph name="ACTION" />". Shtyp një tast çfarëdo për të <ph name="RESPONSE" />.</translation> <translation id="1567993339577891801">Paneli i JavaScript</translation> <translation id="1568323446248056064">Hap cilësimet e ekranit të pajisjes</translation> <translation id="1572139610531470719"><ph name="WINDOW_TITLE" /> (vizitor)</translation> @@ -777,6 +780,7 @@ <translation id="1822140782238030981">Je tashmë një përdorues i Chrome? Identifikohu</translation> <translation id="18245044880483936">Të dhënat e rezervimit nuk do të llogariten në kuotën e hapësirës ruajtëse të "Diskut" të fëmijës tënd.</translation> <translation id="1825565032302550710">Porta duhet të jetë mes 1024 dhe 65535</translation> +<translation id="1826192255355608658">Sinkronizo faqeshënuesit, fjalëkalimet, historikun etj. të shfletuesit tënd Chrome</translation> <translation id="1826516787628120939">Po kontrollon</translation> <translation id="1827738518074806965">Galeri arti</translation> <translation id="1828378091493947763">Ky përbërës shtesë nuk mbështetet në këtë pajisje</translation> @@ -1297,6 +1301,7 @@ <translation id="2379281330731083556">Printo me dialogun e sistemit... <ph name="SHORTCUT_KEY" /></translation> <translation id="2381756643783702095">Pyet para dërgimit (rekomandohet)</translation> <translation id="2382818385048255866">Kontrollo shtesat e tua</translation> +<translation id="2383270717570379869"><ph name="BEGIN_LINK_SEARCH" />Historiku i kërkimeve<ph name="END_LINK_SEARCH" /> dhe <ph name="BEGIN_LINK_GOOGLE" />forma të tjera aktiviteti<ph name="END_LINK_GOOGLE" /> mund të ruhen në "Llogarinë tënde të Google" kur je i identifikuar. Mund t'i fshish në çdo kohë.</translation> <translation id="2387052489799050037">Shko tek ekrani bazë</translation> <translation id="2390347491606624519">Nuk mund të lidhet me përfaqësuesin. Identifikohu përsëri</translation> <translation id="2390782873446084770">Sinkronizimi i Wi-Fi</translation> @@ -1461,6 +1466,7 @@ <translation id="2553440850688409052">Fshihe këtë përbërës shtesë</translation> <translation id="2554553592469060349">Skedari i zgjedhur është tepër i madh (madhësia maksimale: 3 MB).</translation> <translation id="2558896001721082624">Shfaq gjithmonë opsionet e qasjes në menynë e sistemit</translation> +<translation id="2564407282561292919">Pastron historikun në kutinë e kërkimit. Llogaria jote e Google mund të ketë forma të tjera të historikut të shfletimit në <ph name="BEGIN_LINK" />myactivity.google.com<ph name="END_LINK" />.</translation> <translation id="2564520396658920462">Ekzekutimi i JavaScript nëpërmjet AppleScript është çaktivizuar. Për ta aktivizuar, nga shiriti i menysë, shko te Pamja > Zhvilluesi > Lejo JavaScript nga ngjarjet e Apple. Për më shumë informacione: https://support.google.com/chrome/?p=applescript</translation> <translation id="2564653188463346023">Kontroll i përmirësuar drejtshkrimor</translation> <translation id="2568774940984945469">Mbajtësi i shiritit të informacionit</translation> @@ -1784,6 +1790,7 @@ <translation id="2907798539022650680">Dështoi lidhja me "<ph name="NAME" />": <ph name="DETAILS" /> Mesazhi i serverit: <ph name="SERVER_MSG" /></translation> <translation id="2908162660801918428">Shto galerinë e medias sipas direktorisë</translation> +<translation id="2908358077082926882">Shtyp përsëri "<ph name="CURRENTKEY" />" për të hequr caktimin dhe <ph name="RESPONSE" />.</translation> <translation id="2910318910161511225">Lidhu me një rrjet dhe provo përsëri</translation> <translation id="291056154577034373">TË PALEXUARA</translation> <translation id="2910718431259223434">Ndodhi një gabim. Provo përsëri ose kontakto me zotëruesin e pajisjes ose administratorin. Kodi i gabimit: <ph name="ERROR_CODE" />.</translation> @@ -2280,6 +2287,7 @@ <translation id="3462311546193741693">Të nxjerr nga shumica e sajteve. Do të qëndrosh i identifikuar në "Llogarinë e Google" në mënyrë që të dhënat e tua të sinkronizuara të mund të pastrohen.</translation> <translation id="3462413494201477527">Të anulohet konfigurimi i llogarisë?</translation> <translation id="346298925039590474">Ky rrjet celular do të ofrohet për të gjithë përdoruesit e kësaj pajisjeje</translation> +<translation id="3463235406897625623">Nuk mund të hiqet çelësi i vetëm i caktuar për veprimin "Zgjidh". Shtyp një tast çfarëdo për të <ph name="RESPONSE" />.</translation> <translation id="3464145797867108663">Shto profilin e punës</translation> <translation id="346431825526753">Kjo është një llogari për fëmijë, e menaxhuar nga <ph name="CUSTODIAN_EMAIL" />.</translation> <translation id="3468298837301810372">Etiketa</translation> @@ -2290,6 +2298,7 @@ <translation id="3473479545200714844">Zmadhuesi i ekranit</translation> <translation id="3474218480460386727">Përdor 99 shkronja ose më pak për fjalët e reja</translation> <translation id="3475843873335999118">Na vjen keq, por gjurma e gishtit nuk njihet ende. Fut fjalëkalimin tënd.</translation> +<translation id="3475986680293081450">Tastet nuk përputhen. Shtyp një tast çfarëdo për të <ph name="RESPONSE" />.</translation> <translation id="3476303763173086583">Dërgo të dhënat e përdorimit dhe të diagnostikimit. Ndihmo në përmirësimin e përvojës së fëmijës tënd me Android duke dërguar automatikisht te Google të dhënat e diagnostikimit dhe të përdorimit të pajisjes dhe aplikacioneve. Këto nuk do të përdoren për të identifikuar fëmijën tënd dhe do të ndihmojnë për qëndrueshmërinë e sistemit dhe të aplikacioneve dhe për përmirësime të tjera. Disa të dhëna të përmbledhura do të ndihmojnë po ashtu aplikacionet dhe partnerët e Google, si p.sh. zhvilluesit e Android. Ky <ph name="BEGIN_LINK1" />cilësim<ph name="END_LINK1" /> zbatohet nga zotëruesi. Zotëruesi mund të zgjedhë të dërgojë te Google të dhënat e diagnostikimit dhe të përdorimit për këtë pajisje. Nëse cilësimi i "Aktivitetit shtesë të uebit dhe të aplikacioneve" është i aktivizuar për fëmijën tënd, këto të dhëna mund të ruhen në "Llogarinë e Google" të fëmijës. <ph name="BEGIN_LINK2" />Mëso më shumë<ph name="END_LINK2" /></translation> <translation id="347670947055184738">Mos! Sistemi nuk arriti të marrë politikën për pajisjen tënde.</translation> <translation id="347785443197175480">Vazhdo të lejosh <ph name="HOST" /> që të qaset te kamera dhe mikrofoni</translation> @@ -2348,6 +2357,7 @@ <translation id="3541823293333232175">U caktua</translation> <translation id="3543393733900874979">Përditësimi dështoi (gabim: <ph name="ERROR_NUMBER" />)</translation> <translation id="3543597750097719865">Nënshkrimi X9.62 ECDSA me SHA-512</translation> +<translation id="3543651705416471414">Pastro të gjitha caktimet e çelësave</translation> <translation id="3544879808695557954">Emri i përdoruesit (opsional)</translation> <translation id="354602065659584722">Softueri keqdashës u hoq</translation> <translation id="3547954654003013442">Cilësimet e përfaqësuesit</translation> @@ -2575,6 +2585,7 @@ <translation id="3778740492972734840">&Mjetet e zhvilluesit</translation> <translation id="3778868487658107119">Bëji pyetje. Thuaji që të bëjë gjëra. Është Google yt personal, gjithmonë gati për të të ndihmuar.</translation> <translation id="3781742599892759500">Qasja te mikrofoni i Linux</translation> +<translation id="3782795641773236652">Nuk është caktuar ende asnjë çelës apo tast</translation> <translation id="378312418865624974">Lexo një identifikues unik për këtë kompjuter</translation> <translation id="3784372983762739446">Pajisjet me Bluetooth</translation> <translation id="3784472333786002075">Kukit janë skedarë të krijuar nga sajtet e uebit. Ka dy lloje kukish: Kukit e palëve të para krijohen nga sajti që viziton ti. Sajti shfaqet në shiritin e adresës. Kukit e palëve të treta krijohen nga sajte të tjera. Këto sajte zotërojnë disa nga përmbajtjet, si p.sh. reklamat ose imazhet që ti shikon në sajtin e uebit që viziton.</translation> @@ -2853,6 +2864,7 @@ <translation id="406070391919917862">Aplikacionet e sfondit</translation> <translation id="4061374428807229313">Për të ndarë, kliko me të djathtin në një dosje në aplikacionin Files dhe më pas zgjidh "Ndaj me Parallels Desktop".</translation> <translation id="406213378265872299">Sjelljet e personalizuara</translation> +<translation id="4062561150282203854">Sinkronizo aplikacionet, cilësimet etj. të tua të <ph name="DEVICE_TYPE" /></translation> <translation id="4064575710864784237">1x</translation> <translation id="4065876735068446555">Rrjeti që po përdor (<ph name="NETWORK_ID" />) mund të kërkojë që të vizitosh faqen e tij të lidhjes.</translation> <translation id="4066207411788646768">Kontrollo lidhjen për të parë printerët e disponueshëm në rrjetin tënd</translation> @@ -2974,6 +2986,7 @@ <translation id="4217571870635786043">Diktimi</translation> <translation id="4220648711404560261">Ndodhi një gabim gjatë aktivizimit.</translation> <translation id="4222772810963087151">Detajet e versionit</translation> +<translation id="4225020013797061859">Shtyp një çelës ose tast për të caktuar "<ph name="ACTION" />"</translation> <translation id="4225397296022057997">Në të gjitha sajtet</translation> <translation id="4231095370974836764">Instalo aplikacione dhe lojëra nga Google Play në <ph name="DEVICE_TYPE" />. <ph name="LINK_BEGIN" />Mëso më shumë<ph name="LINK_END" /></translation> <translation id="4232375817808480934">Konfiguro Kerberos</translation> @@ -3125,6 +3138,7 @@ <translation id="440653823335387109">FAQET QË KE LEXUAR</translation> <translation id="4406883609789734330">Titra në çast</translation> <translation id="4408599188496843485">N&dihmë</translation> +<translation id="4409271659088619928">Motori yt i kërkimit është <ph name="DSE" />. Shiko udhëzimet e motorit të kërkimit për fshirjen e historikut të kërkimit, nëse është e vlefshme.</translation> <translation id="4409697491990005945">Kufijtë</translation> <translation id="4410545552906060960">Përdor një numër (PIN) në vend të një fjalëkalimi për të shkyçur pajisjen tënde. Për ta caktuar kodin PIN më vonë, shko te "Cilësimet".</translation> <translation id="4411578466613447185">Nënshkruesi i kodit</translation> @@ -3194,6 +3208,7 @@ <translation id="4480590691557335796">Chrome mund të gjejë një softuer keqdashës në kompjuterin tënd dhe ta heqë atë</translation> <translation id="4481467543947557978">punonjës shërbimi</translation> <translation id="4481530544597605423">Pajisjet e paçiftuara</translation> +<translation id="4481906837550700306">Riekzekutimi i udhëzuesit të konfigurimit do të pastrojë çelësat e tu të caktuar. Dëshiron të vazhdosh?</translation> <translation id="4482990632723642375">Skeda e mbyllur së fundi</translation> <translation id="4487489714832036847">Pajisjet Chromebook përdorin aplikacione në vend të softuerëve tradicionalë. Merr aplikacione për produktivitet, zbavitje etj.</translation> <translation id="4488257340342212116">Lejohen të përdorin kamerën</translation> @@ -4481,6 +4496,7 @@ <translation id="5938002010494270685">Ofrohet një përmirësim i sigurisë</translation> <translation id="5939518447894949180">Rivendos</translation> <translation id="5939719276406088041">Shkurtorja nuk mund të krijohet</translation> +<translation id="594048410531370124">Tast i panjohur. Shtyp një tast çfarëdo për të <ph name="RESPONSE" />.</translation> <translation id="5941153596444580863">Shto person...</translation> <translation id="5941343993301164315">Identifikohu në <ph name="TOKEN_NAME" />.</translation> <translation id="5941711191222866238">Minimizo</translation> @@ -4507,6 +4523,7 @@ <translation id="5963117322306686970">Për t'i grupuar skedat së bashku, kliko me butonin djathtas mbi një skedë</translation> <translation id="5963453369025043595"><ph name="NUM_HANDLES" /> (maksimumi <ph name="NUM_KILOBYTES_LIVE" />)</translation> <translation id="5964113968897211042">{COUNT,plural, =0{Hapi të gjitha në &dritare të re}=1{Hape në &dritare të re}other{Hapi të gjitha ({COUNT}) në &dritare të re}}</translation> +<translation id="5964328685964290415">Përmirëso të gjitha navigimet në HTTPS dhe paralajmëro përpara ngarkimit të faqeve që nuk e mbështetin</translation> <translation id="5965661248935608907">Ai kontrollon po ashtu se çfarë faqeje shfaqet kur klikon te butoni "Faqja kryesore" ose kur kërkon nga "Omnibox".</translation> <translation id="5969419185858894314"><ph name="ORIGIN" /> mund t'i shikojë skedarët në <ph name="FOLDERNAME" /></translation> <translation id="5969728632630673489">Njoftimi për shkurtoren e tastierës u shpërfill</translation> @@ -5800,6 +5817,7 @@ <translation id="7415454883318062233">Konfigurimi përfundoi</translation> <translation id="7416362041876611053">Gabim i panjohur i rrjetit.</translation> <translation id="741906494724992817">Ky aplikacion nuk kërkon leje të veçanta.</translation> +<translation id="7419565702166471774">Përdor gjithmonë lidhje të sigurta</translation> <translation id="7421067045979951561">përpunuesit e protokolleve</translation> <translation id="742130257665691897">Faqeshënuesit u hoqën</translation> <translation id="7421925624202799674">&Shiko burimin e faqes</translation> @@ -5821,6 +5839,7 @@ <translation id="7434969625063495310">Serveri i printimit nuk mund të shtohej. Kontrollo konfigurimin e serverit dhe provo përsëri.</translation> <translation id="7436921188514130341">Mos! Pati një gabim gjatë riemërtimit.</translation> <translation id="7438495332316988804">Shfletuesi standard mund të gjendet duke shkruar "Chrome" te "Nisësi".</translation> +<translation id="7439446972050308922">Preferencat e tua të ruajtura do të jenë gati në çdo pajisje me Chrome OS kur identifikohesh me "Llogarinë tënde të Google". Mund të zgjedhësh çfarë të sinkronizosh te "Cilësimet".</translation> <translation id="7439519621174723623">Shto një pajisje për të vazhduar</translation> <translation id="7441736921018636843">Për të ndryshuar këtë cilësim, <ph name="BEGIN_LINK" />rivendos sinkronizimin<ph name="END_LINK" /> për të hequr frazën e kalimit për sinkronizimin</translation> <translation id="7441830548568730290">Përdoruesit e tjerë</translation> @@ -5932,6 +5951,7 @@ <translation id="7557194624273628371">Transferimi i portës Linux</translation> <translation id="7557411183415085169">Linux ka pak hapësirë disku</translation> <translation id="7559719679815339381">Prit....Aplikacioni kioskë është në procesin e përditësimit. Mos e hiq memorien USB.</translation> +<translation id="7560756177962144929">Sinkronizo <ph name="DEVICE_TYPE" /> tënde</translation> <translation id="7561196759112975576">Gjithmonë</translation> <translation id="756445078718366910">Hap dritaren e shfletuesit</translation> <translation id="7564847347806291057">Përfundo procesin</translation> @@ -5968,6 +5988,7 @@ <translation id="760197030861754408">Shko te <ph name="LANDING_PAGE" /> për t'u lidhur.</translation> <translation id="7602079150116086782">Asnjë skedë nga pajisjet e tjera</translation> <translation id="7602173054665172958">Menaxhimi i printimit</translation> +<translation id="7603785829538808504">Sajtet e listuara më poshtë ndjekin një cilësim të personalizuar</translation> <translation id="7604942372593434070">Qasu në aktivitetin tënd të shfletimit</translation> <translation id="7605594153474022051">Sinkronizimi nuk po funksionon.</translation> <translation id="7606992457248886637">Autoritetet</translation> @@ -6552,6 +6573,8 @@ <translation id="8189750580333936930">Privacy Sandbox</translation> <translation id="8190193592390505034">Po lidhet me <ph name="PROVIDER_NAME" /></translation> <translation id="8191230140820435481">Menaxho aplikacionet e tua, shtesat dhe temat</translation> +<translation id="819137301779081601">Shtyp një çelës të ri për të nisur caktimin +Shtyp një çelës të caktuar për të hequr caktimin</translation> <translation id="8192944472786724289"><ph name="APP_NAME" /> dëshiron të ndajë përmbajtjen e ekranit tënd.</translation> <translation id="8195027750202970175">Madhësia në disk</translation> <translation id="8198323535106903877">Do t'i instalojmë ato <ph name="NUMBER_OF_APPS" /> aplikacione për ty</translation> @@ -6584,6 +6607,7 @@ <translation id="8230446983261649357">Mos i lejo sajtet që të shfaqin imazhe</translation> <translation id="8234795456569844941">Ndihmoji inxhinierët tanë ta rregullojnë këtë problem. Na trego se çfarë ndodhi përpara se të merrje mesazhin e gabimit të profilit:</translation> <translation id="8235418492073272647">Faqe e ndarë nga <ph name="DEVICE_NAME" /></translation> +<translation id="8236911020904880539">dil</translation> <translation id="8236917170563564587">Ndaj këtë skedë më mirë</translation> <translation id="8237647586961940482">Rozë e errët dhe e kuqe</translation> <translation id="8239032431519548577">Regjistrimi i ndërmarrjes përfundoi</translation> @@ -7118,6 +7142,7 @@ <translation id="8834039744648160717">Konfigurimi i rrjetit kontrollohet nga <ph name="USER_EMAIL" />.</translation> <translation id="8835786707922974220">Sigurohu që gjithmonë të mund të qasesh në fjalëkalimet e tua të ruajtura</translation> <translation id="8836360711089151515"><ph name="MANAGER" /> kërkon që t'i rezervosh të dhënat e tua dhe ta kthesh këtë pajisje <ph name="DEVICE_TYPE" /> brenda 1 jave. <ph name="LINK_BEGIN" />Shiko detajet<ph name="LINK_END" /></translation> +<translation id="8836782447513334597">vazhdo</translation> <translation id="8838601485495657486">E patejdukshme</translation> <translation id="8838770651474809439">Hamburger</translation> <translation id="883911313571074303">Shëno imazhin</translation> @@ -7199,6 +7224,7 @@ <translation id="8912810933860534797">Aktivizo skanimin automatik</translation> <translation id="8915370057835397490">Po ngarkon sugjerimin</translation> <translation id="8916476537757519021">Nënkorniza "e fshehtë": <ph name="SUBFRAME_SITE" /></translation> +<translation id="8917293713468567935"><ph name="BEGIN_LINK_GOOGLE" />Forma të tjera aktiviteti<ph name="END_LINK_GOOGLE" /> mund të ruhen në "Llogarinë tënde të Google" kur je i identifikuar. Mund t'i fshish në çdo kohë.</translation> <translation id="8918637186205009138"><ph name="DEVICE_TYPE" /> që ka <ph name="GIVEN_NAME" /></translation> <translation id="8922624386829239660">Lëvize ekranin kur miu prek këndet e ekranit</translation> <translation id="8923880975836399332">Gurkali e errët</translation> @@ -7308,6 +7334,7 @@ <translation id="9030785788945687215">Gmail</translation> <translation id="9030855135435061269"><ph name="PLUGIN_NAME" /> nuk mbështetet më</translation> <translation id="9031549947500880805">Rezervo në "Diskun e Google". Restauro të dhënat e tua ose ndërro me lehtësi pajisjen në çdo kohë. Rezervimi yt përfshin të dhënat e aplikacioneve.</translation> +<translation id="9031811691986152304">provo përsëri</translation> <translation id="9033765790910064284">Vazhdo gjithsesi</translation> <translation id="9033857511263905942">&Ngjite</translation> <translation id="9037640663275993951">Pajisja nuk lejohet</translation> @@ -7334,6 +7361,8 @@ <translation id="9062468308252555888">14x</translation> <translation id="9063208415146866933">Gabim nga rreshti <ph name="ERROR_LINE_START" /> deri në <ph name="ERROR_LINE_END" /></translation> <translation id="9063800855227801443">Nuk mund të regjistrojë përmbajtje konfidenciale</translation> +<translation id="9064039204504614208">Shtyp një çelës për të caktuar “<ph name="ACTION" />” +Mund të caktosh disa çelësa te ky veprim</translation> <translation id="9064275926664971810">Aktivizo plotësimin automatik për të plotësuar formularë me një klikim të vetëm</translation> <translation id="9065203028668620118">Redakto</translation> <translation id="9066782832737749352">Teksti në të folur</translation>
diff --git a/chrome/app/resources/generated_resources_uz.xtb b/chrome/app/resources/generated_resources_uz.xtb index f4f9ee8..da30182 100644 --- a/chrome/app/resources/generated_resources_uz.xtb +++ b/chrome/app/resources/generated_resources_uz.xtb
@@ -464,6 +464,7 @@ <translation id="1507246803636407672">&Bekor qilish</translation> <translation id="1508491105858779599">Qurilma qulfini ochish uchun barmog‘ingizni barmoq izi sensori ustiga qo‘ying.</translation> <translation id="1508575541972276599">Joriy versiya: Debian 9 (Stretch)</translation> +<translation id="1509163368529404530">Guruhni tiklash</translation> <translation id="1509281256533087115">USB orqali har qanday <ph name="DEVICE_NAME_AND_VENDOR" /> qurilmasiga kirish</translation> <translation id="1509960214886564027">Aksariyat saytlardagi funksiyalar ishalamay qolishi mumkin</translation> <translation id="1510238584712386396">Ishga tushirish paneli</translation> @@ -583,6 +584,7 @@ <translation id="1627408615528139100">Allaqachon yuklab olingan</translation> <translation id="1628948239858170093">Ochishdan oldin fayl tekshirilsinmi?</translation> <translation id="1629314197035607094">Parol eskirdi</translation> +<translation id="1629451755632656601">Google xarid savatlaringiz uchun shaxsiy chegirmalar qidirishiga ruxsat berilsinmi?</translation> <translation id="1630300831289687074">Tez orada Chromebook ishlatish imkoniga ega boʻlasiz.</translation> <translation id="163072119192489970">Axborot yuborish va qabul qilishni yakunlashga ruxsat berilgan</translation> <translation id="1630768113285622200">Oʻchirib yoqish va davom etish</translation> @@ -1292,6 +1294,7 @@ <translation id="236117173274098341">Takomillashtirish</translation> <translation id="2361340419970998028">Fikr-mulohaza yuborilmoqda…</translation> <translation id="236141728043665931">Mikrofonga ruxsat har doim taqiqlansin</translation> +<translation id="2363744066037724557">Oynani tiklash</translation> <translation id="2364498172489649528">Tugadi</translation> <translation id="2365507699358342471">Bu saytda klipbordga nusxalangan rasm va matnlar ko‘rinadi.</translation> <translation id="2367972762794486313">Ilovalarni ko‘rsatish</translation> @@ -2675,6 +2678,7 @@ <translation id="3857807444929313943">Barmoqni oling va qaytadan tekkizing</translation> <translation id="3861638017150647085">“<ph name="USERNAME" />” nomi band</translation> <translation id="3861977424605124250">Boshlanishida koʻrsatilsin</translation> +<translation id="386239283124269513">Guruhni tiklash</translation> <translation id="3862788408946266506">Manifest faylida “kiosk_only” atributi mavjud ilovalarni Chrome OS‘da faqatgina kiosk rejimida o‘rnatish mumkin</translation> <translation id="3865414814144988605">Piksellar sig‘imi</translation> <translation id="3866249974567520381">Tavsif</translation> @@ -5654,6 +5658,7 @@ <translation id="7225179976675429563">Tarmoq turi ko‘rsatilmagan</translation> <translation id="7228479291753472782">Saytlarning geo-ma’lumotlar, mikrofon, kamera va boshqa funksiyalarga ruxsat boshqaruvi sozlamalarni o‘zgartirish</translation> <translation id="7228523857728654909">Ekran qulfi va kirish</translation> +<translation id="7230222852462421043">Oynani tiklash</translation> <translation id="7230787553283372882">Matn hajmini sozlash</translation> <translation id="7232750842195536390">Nom o‘zgarmadi</translation> <translation id="7234010996000898150">Linux tasvirini tiklash bekor qilinmoqda</translation> @@ -6262,12 +6267,14 @@ <translation id="7853747251428735">Qo‘shimcha &vositalar</translation> <translation id="7855678561139483478">Varaqni yangi oynaga olish</translation> <translation id="7857093393627376423">Matn takliflari</translation> +<translation id="7857675386615530425">Sahifa qismidan Google Lens yordamida qidirish</translation> <translation id="7857949311770343000">Bu boshqa tezkor havolalar sahifasimi?</translation> <translation id="7858328180167661092"><ph name="APP_NAME" /> (Windows)</translation> <translation id="786073089922909430">Xizmat: <ph name="ARC_PROCESS_NAME" /></translation> <translation id="7861215335140947162">&Yuklanishlar</translation> <translation id="7861846108263890455">Google hisobi tili</translation> <translation id="7864539943188674973">Bluetooth funksiyasini o‘chirish</translation> +<translation id="7866230141401327032">Sahifa qismidan Google Lens yordamida qidirish</translation> <translation id="786957569166715433"><ph name="DEVICE_NAME" />: ulangan</translation> <translation id="7870730066603611552">Sinxronizatsiya sozlamalari seans boshlangandan keyin tekshirilsin</translation> <translation id="7870790288828963061">Kiosk-ilovalarining yangi versiyalari mavjud emas. Yangilanish shart emas. USB-xotira qurilmasini chiqarib oling.</translation> @@ -6843,6 +6850,7 @@ <translation id="850875081535031620">Birorta ham zararli dastur topilmadi</translation> <translation id="8509177919508253835">Elektron kalitlarni asliga qaytarish va PIN kodlar yaratish</translation> <translation id="8509646642152301857">Imlo lug‘atini yuklab olish amalga oshmadi.</translation> +<translation id="8509967119010808787">Varaqlardan qidirish uchun bu yerga bosing</translation> <translation id="8512396579636492893">{COUNT,plural, =0{Kuchsiz parollar topilmadi}=1{{COUNT} ta kuchsiz parol topildi}other{{COUNT} ta kuchsiz parol topildi}}</translation> <translation id="8512476990829870887">Jarayonni yakunlash</translation> <translation id="851263357009351303"><ph name="HOST" /> rasmlarni doim ko‘rsatsin</translation>
diff --git a/chrome/app/resources/google_chrome_strings_km.xtb b/chrome/app/resources/google_chrome_strings_km.xtb index 5d949427d..a3e4dc4 100644 --- a/chrome/app/resources/google_chrome_strings_km.xtb +++ b/chrome/app/resources/google_chrome_strings_km.xtb
@@ -12,6 +12,7 @@ <translation id="1125124144982679672">តើនរណាកំពុងប្រើ Chrome?</translation> <translation id="1142745911746664600">មិនអាចដំឡើងជំនាន់ Chrome បានទេ</translation> <translation id="1154147086299354128">&បើកនៅក្នុង Chrome</translation> +<translation id="1182414570724401860">Chrome ណែនាំមិនឱ្យអ្នកទាញយក ឬបើកឯកសារនេះទេ</translation> <translation id="1278833599417554002">ចាប់ផ្តើមឡើងវិញដើម្បីដំឡើងកំណែ &Chrome</translation> <translation id="1293325835983155583"><ph name="MANAGER" /> តម្រូវឱ្យអ្នកអាន និងយល់ព្រមតាមលក្ខខណ្ឌប្រើប្រាស់ខាងក្រោម មុនពេលប្រើឧបករណ៍នេះ។ លក្ខខណ្ឌទាំងនេះមិនបន្ថែម កែប្រែ ឬដាក់កំហិតលើលក្ខខណ្ឌ Google Chrome OS ទេ។</translation> <translation id="1302523850133262269">សូមរង់ចាំ ខណៈពេលដែល Chrome តំឡើងការធ្វើបច្ចុប្បន្នភាពប្រព័ន្ធចុងក្រោយបំផុត។</translation>
diff --git a/chrome/app/resources/google_chrome_strings_pa.xtb b/chrome/app/resources/google_chrome_strings_pa.xtb index 50e42cc..0fd2531d 100644 --- a/chrome/app/resources/google_chrome_strings_pa.xtb +++ b/chrome/app/resources/google_chrome_strings_pa.xtb
@@ -12,6 +12,7 @@ <translation id="1125124144982679672">Chrome ਕੌਣ ਵਰਤ ਰਿਹਾ ਹੈ?</translation> <translation id="1142745911746664600">Chrome ਅੱਪਡੇਟ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ</translation> <translation id="1154147086299354128">&Chrome ਵਿੱਚ ਖੋਲ੍ਹੋ</translation> +<translation id="1182414570724401860">Chrome ਵੱਲੋਂ ਸਿਫ਼ਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਕਿ ਤੁਸੀਂ ਇਸ ਫ਼ਾਈਲ ਨੂੰ ਨਾ ਤਾਂ ਡਾਊਨਲੋਡ ਕਰੋ ਅਤੇ ਨਾ ਹੀ ਖੋਲ੍ਹੋ</translation> <translation id="1278833599417554002">&Chrome ਨੂੰ ਅੱਪਡੇਟ ਕਰਨ ਲਈ ਮੁੜ-ਲਾਂਚ ਕਰੋ</translation> <translation id="1293325835983155583"><ph name="MANAGER" /> ਦੀ ਸ਼ਰਤ ਹੈ ਕਿ ਤੁਸੀਂ ਇਸ ਡੀਵਾਈਸ ਨੂੰ ਵਰਤਣ ਤੋਂ ਪਹਿਲਾਂ ਹੇਠਾਂ ਦਿੱਤੇ ਸੇਵਾ ਦੇ ਨਿਯਮ ਪੜ੍ਹ ਕੇ ਸਵੀਕਾਰ ਕਰੋ। ਇਹ ਨਿਯਮ Google Chrome OS ਦੇ ਨਿਯਮਾਂ ਦਾ ਵਿਸਤਾਰ ਨਹੀਂ ਕਰਦੇ, ਇਹਨਾਂ ਵਿੱਚ ਕੋਈ ਸੋਧ ਨਹੀਂ ਕਰਦੇ ਜਾਂ ਇਹਨਾਂ ਨੂੰ ਸੀਮਤ ਨਹੀਂ ਕਰਦੇ ਹਨ।</translation> <translation id="1302523850133262269">ਕਿਰਪਾ ਕਰਕੇ Chrome ਵੱਲੋਂ ਨਵੀਨਤਮ ਸਿਸਟਮ ਅੱਪਡੇਟਾਂ ਨੂੰ ਸਥਾਪਤ ਕੀਤੇ ਜਾਣ ਤੱਕ ਉਡੀਕ ਕਰੋ।</translation>
diff --git a/chrome/app/resources/google_chrome_strings_sq.xtb b/chrome/app/resources/google_chrome_strings_sq.xtb index 160ad79..096ec39e 100644 --- a/chrome/app/resources/google_chrome_strings_sq.xtb +++ b/chrome/app/resources/google_chrome_strings_sq.xtb
@@ -12,6 +12,7 @@ <translation id="1125124144982679672">Kush po e përdor Chrome?</translation> <translation id="1142745911746664600">Chrome nuk mund të përditësohet</translation> <translation id="1154147086299354128">&Hape në Chrome</translation> +<translation id="1182414570724401860">Chrome rekomandon që të mos e shkarkosh apo hapësh këtë skedar</translation> <translation id="1278833599417554002">Nise përsëri për të përditësuar &Chrome</translation> <translation id="1293325835983155583"><ph name="MANAGER" /> kërkon që të lexosh dhe të pranosh Kushtet e shërbimit më poshtë para se ta përdorësh këtë pajisje. Këto kushte nuk i zgjerojnë, modifikojnë apo kufizojnë kushtet e sistemit operativ të Google Chrome.</translation> <translation id="1302523850133262269">Prit ndërsa Chrome instalon përditësimet më të fundit të sistemit.</translation>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 22036958..c627980a 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1356,8 +1356,6 @@ "profiles/gaia_info_update_service_factory.h", "profiles/guest_mode_policy_handler.cc", "profiles/guest_mode_policy_handler.h", - "profiles/guest_signin_observer_factory.cc", - "profiles/guest_signin_observer_factory.h", "profiles/incognito_mode_policy_handler.cc", "profiles/incognito_mode_policy_handler.h", "profiles/off_the_record_profile_impl.cc", @@ -6645,7 +6643,7 @@ deps += [ "//components/safe_browsing/content/browser/download:download_stats", "//components/safe_browsing/content/common:file_type_policies", - "//components/safe_browsing/core/common/proto:download_file_types_proto", + "//components/safe_browsing/content/common/proto:download_file_types_proto", ] } }
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 3e888ebf..01d044b 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -263,8 +263,6 @@ "+components/safe_browsing/buildflags.h", "+components/safe_browsing/content/browser", "+components/safe_browsing/content/common", - # TODO(crbug.com/1216341): Determine how best to eliminate this (it's needed for a const value). - "!components/safe_browsing/content/renderer/threat_dom_details.h", "+components/safe_browsing/core/browser", "+components/safe_browsing/core/common", "+components/safe_search_api",
diff --git a/chrome/browser/accuracy_tips/accuracy_service_factory.cc b/chrome/browser/accuracy_tips/accuracy_service_factory.cc index 723813b..0a879032 100644 --- a/chrome/browser/accuracy_tips/accuracy_service_factory.cc +++ b/chrome/browser/accuracy_tips/accuracy_service_factory.cc
@@ -5,12 +5,17 @@ #include "chrome/browser/accuracy_tips/accuracy_service_factory.h" #include "base/feature_list.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/ui/page_info/chrome_accuracy_tip_ui.h" #include "components/accuracy_tips/accuracy_service.h" #include "components/accuracy_tips/accuracy_tip_ui.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/safe_browsing/core/browser/db/database_manager.h" #include "components/safe_browsing/core/common/features.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" // static accuracy_tips::AccuracyService* AccuracyServiceFactory::GetForProfile( @@ -35,5 +40,11 @@ content::BrowserContext* profile) const { DCHECK(base::FeatureList::IsEnabled(safe_browsing::kAccuracyTipsFeature)); auto ui = std::make_unique<ChromeAccuracyTipUI>(); - return new accuracy_tips::AccuracyService(std::move(ui)); + auto sb_database = + g_browser_process->safe_browsing_service() + ? g_browser_process->safe_browsing_service()->database_manager() + : nullptr; + return new accuracy_tips::AccuracyService( + std::move(ui), std::move(sb_database), content::GetUIThreadTaskRunner({}), + content::GetIOThreadTaskRunner({})); }
diff --git a/chrome/browser/android/browserservices/metrics/BUILD.gn b/chrome/browser/android/browserservices/metrics/BUILD.gn new file mode 100644 index 0000000..e17ec1b0 --- /dev/null +++ b/chrome/browser/android/browserservices/metrics/BUILD.gn
@@ -0,0 +1,16 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +android_library("java") { + sources = [ + "java/src/org/chromium/chrome/browser/browserservices/metrics/BrowserServicesTimingMetrics.java", + "java/src/org/chromium/chrome/browser/browserservices/metrics/OriginVerifierMetricsRecorder.java", + ] + deps = [ + "//base:base_java", + "//third_party/androidx:androidx_annotation_annotation_java", + ] +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/BrowserServicesMetrics.java b/chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/BrowserServicesTimingMetrics.java similarity index 63% rename from chrome/android/java/src/org/chromium/chrome/browser/browserservices/BrowserServicesMetrics.java rename to chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/BrowserServicesTimingMetrics.java index 904ca25..ad9319f2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/BrowserServicesMetrics.java +++ b/chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/BrowserServicesTimingMetrics.java
@@ -2,37 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.chrome.browser.browserservices; +package org.chromium.chrome.browser.browserservices.metrics; import android.os.SystemClock; import org.chromium.base.metrics.RecordHistogram; -import org.chromium.chrome.browser.browserservices.verification.OriginVerifier; /** * Class to contain metrics recording constants and behaviour for Browser Services. */ -public class BrowserServicesMetrics { - /** Implementation of {@link OriginVerifier.MetricsListener}. */ - public static class OriginVerifierMetricsListener implements OriginVerifier.MetricsListener { - @Override - public void recordVerificationResult(@OriginVerifier.VerificationResult int result) { - RecordHistogram.recordEnumeratedHistogram("BrowserServices.VerificationResult", result, - OriginVerifier.VerificationResult.NUM_ENTRIES); - } - - @Override - public void recordVerificationTime(long duration, boolean online) { - if (online) { - RecordHistogram.recordTimesHistogram( - "BrowserServices.VerificationTime.Online", duration); - } else { - RecordHistogram.recordTimesHistogram( - "BrowserServices.VerificationTime.Offline", duration); - } - } - } - +public class BrowserServicesTimingMetrics { /** * Returns a {@link TimingMetric} that records the amount of time spent querying the Android * system for ResolveInfos that will deal with a given URL when launching from a background @@ -81,5 +60,5 @@ } // Don't let anyone instantiate. - private BrowserServicesMetrics() {} + private BrowserServicesTimingMetrics() {} }
diff --git a/chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/OriginVerifierMetricsRecorder.java b/chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/OriginVerifierMetricsRecorder.java new file mode 100644 index 0000000..c026a49 --- /dev/null +++ b/chrome/browser/android/browserservices/metrics/java/src/org/chromium/chrome/browser/browserservices/metrics/OriginVerifierMetricsRecorder.java
@@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browserservices.metrics; + +import androidx.annotation.IntDef; + +import org.chromium.base.metrics.RecordHistogram; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Class to record Uma related to Origin Verifier + */ +public class OriginVerifierMetricsRecorder { + @IntDef({VerificationResult.ONLINE_SUCCESS, VerificationResult.ONLINE_FAILURE, + VerificationResult.OFFLINE_SUCCESS, VerificationResult.OFFLINE_FAILURE, + VerificationResult.HTTPS_FAILURE, VerificationResult.REQUEST_FAILURE, + VerificationResult.CACHED_SUCCESS}) + @Retention(RetentionPolicy.SOURCE) + public @interface VerificationResult { + // Don't reuse values or reorder values. If you add something new, change NUM_ENTRIES as + // well. + int ONLINE_SUCCESS = 0; + int ONLINE_FAILURE = 1; + int OFFLINE_SUCCESS = 2; + int OFFLINE_FAILURE = 3; + int HTTPS_FAILURE = 4; + int REQUEST_FAILURE = 5; + int CACHED_SUCCESS = 6; + int NUM_ENTRIES = 7; + } + + public static void recordVerificationResult(@VerificationResult int result) { + RecordHistogram.recordEnumeratedHistogram( + "BrowserServices.VerificationResult", result, VerificationResult.NUM_ENTRIES); + } + + public static void recordVerificationTime(long duration, boolean online) { + if (online) { + RecordHistogram.recordTimesHistogram( + "BrowserServices.VerificationTime.Online", duration); + } else { + RecordHistogram.recordTimesHistogram( + "BrowserServices.VerificationTime.Offline", duration); + } + } + + private OriginVerifierMetricsRecorder() {} +}
diff --git a/chrome/browser/android/browserservices/verification/BUILD.gn b/chrome/browser/android/browserservices/verification/BUILD.gn index 1f663c6..1b60ee2 100644 --- a/chrome/browser/android/browserservices/verification/BUILD.gn +++ b/chrome/browser/android/browserservices/verification/BUILD.gn
@@ -15,6 +15,7 @@ ] deps = [ "//base:base_java", + "//chrome/browser/android/browserservices/metrics:java", "//chrome/browser/flags:java", "//chrome/browser/preferences:java", "//chrome/browser/profiles/android:java",
diff --git a/chrome/browser/android/browserservices/verification/DEPS b/chrome/browser/android/browserservices/verification/DEPS index a0828cf2..7d9f8bff 100644 --- a/chrome/browser/android/browserservices/verification/DEPS +++ b/chrome/browser/android/browserservices/verification/DEPS
@@ -2,6 +2,7 @@ include_rules = [ "+base/android/java/src/org/chromium/base", + "+chrome/browser/android/browserservices/metrics", "+chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences", "+chrome/browser/profiles/android/java/src/org/chromium/chrome/browser/profiles", "+components/embedder_support/android/java/src/org/chromium/components/embedder_support/util",
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifier.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifier.java index 3ff7bba..73c3df5 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifier.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifier.java
@@ -4,12 +4,14 @@ package org.chromium.chrome.browser.browserservices.verification; +import static org.chromium.chrome.browser.browserservices.metrics.OriginVerifierMetricsRecorder.recordVerificationResult; +import static org.chromium.chrome.browser.browserservices.metrics.OriginVerifierMetricsRecorder.recordVerificationTime; + import android.content.pm.PackageManager; import android.net.Uri; import android.os.SystemClock; import android.text.TextUtils; -import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -26,6 +28,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; import org.chromium.base.task.PostTask; +import org.chromium.chrome.browser.browserservices.metrics.OriginVerifierMetricsRecorder.VerificationResult; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.components.digital_asset_links.RelationshipCheckResult; @@ -36,8 +39,6 @@ import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.WebContents; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; @@ -70,45 +71,12 @@ private long mNativeOriginVerifier; private final Map<Origin, Set<OriginVerificationListener>> mListeners = new HashMap<>(); private long mVerificationStartTime; - private final MetricsListener mMetricsListener; private final VerificationResultStore mVerificationResultStore; @Nullable private WebContents mWebContents; @Nullable private ExternalAuthUtils mExternalAuthUtils; - @IntDef({VerificationResult.ONLINE_SUCCESS, VerificationResult.ONLINE_FAILURE, - VerificationResult.OFFLINE_SUCCESS, VerificationResult.OFFLINE_FAILURE, - VerificationResult.HTTPS_FAILURE, VerificationResult.REQUEST_FAILURE, - VerificationResult.CACHED_SUCCESS}) - @Retention(RetentionPolicy.SOURCE) - public @interface VerificationResult { - // Don't reuse values or reorder values. If you add something new, change NUM_ENTRIES as - // well. - int ONLINE_SUCCESS = 0; - int ONLINE_FAILURE = 1; - int OFFLINE_SUCCESS = 2; - int OFFLINE_FAILURE = 3; - int HTTPS_FAILURE = 4; - int REQUEST_FAILURE = 5; - int CACHED_SUCCESS = 6; - int NUM_ENTRIES = 7; - } - - /** - * Interface for recording metrics. - */ - public interface MetricsListener { - /** Called with the result of every verification attempt. */ - default void recordVerificationResult(@VerificationResult int result) {} - - /** - * Records the time verification takes. This is not recorded for HTTPS_FAILURE, - * HTTPS_FAILURE or CACHED_SUCCESS. - */ - default void recordVerificationTime(long duration, boolean online) {} - } - /** Small helper class to post a result of origin verification. */ private class VerifiedCallback implements Runnable { private final Origin mOrigin; @@ -224,7 +192,7 @@ */ public OriginVerifier(String packageName, @Relation int relation, @Nullable WebContents webContents, @Nullable ExternalAuthUtils externalAuthUtils, - MetricsListener metricsListener, VerificationResultStore verificationResultStore) { + VerificationResultStore verificationResultStore) { mPackageName = packageName; PackageManager pm = ContextUtils.getApplicationContext().getPackageManager(); mSignatureFingerprint = @@ -233,7 +201,6 @@ mRelation = relation; mWebContents = webContents; mExternalAuthUtils = externalAuthUtils; - mMetricsListener = metricsListener; mVerificationResultStore = verificationResultStore; } @@ -270,7 +237,7 @@ if (TextUtils.isEmpty(scheme) || !UrlConstants.HTTPS_SCHEME.equals(scheme.toLowerCase(Locale.US))) { Log.i(TAG, "Verification failed for %s as not https.", origin); - mMetricsListener.recordVerificationResult(VerificationResult.HTTPS_FAILURE); + recordVerificationResult(VerificationResult.HTTPS_FAILURE); PostTask.runOrPostTask( UiThreadTaskTraits.DEFAULT, new VerifiedCallback(origin, false, null)); return; @@ -321,7 +288,7 @@ OriginVerifierJni.get().verifyOrigin(mNativeOriginVerifier, OriginVerifier.this, mPackageName, mSignatureFingerprint, origin.toString(), relationship); if (!requestSent) { - mMetricsListener.recordVerificationResult(VerificationResult.REQUEST_FAILURE); + recordVerificationResult(VerificationResult.REQUEST_FAILURE); PostTask.runOrPostTask( UiThreadTaskTraits.DEFAULT, new VerifiedCallback(origin, false, false)); } @@ -352,11 +319,11 @@ Origin origin = Origin.createOrThrow(originAsString); switch (result) { case RelationshipCheckResult.SUCCESS: - mMetricsListener.recordVerificationResult(VerificationResult.ONLINE_SUCCESS); + recordVerificationResult(VerificationResult.ONLINE_SUCCESS); originVerified(origin, true, true); break; case RelationshipCheckResult.FAILURE: - mMetricsListener.recordVerificationResult(VerificationResult.ONLINE_FAILURE); + recordVerificationResult(VerificationResult.ONLINE_FAILURE); originVerified(origin, false, true); break; case RelationshipCheckResult.NO_CONNECTION: @@ -395,7 +362,7 @@ if (online != null) { long duration = SystemClock.uptimeMillis() - mVerificationStartTime; - mMetricsListener.recordVerificationTime(duration, online); + recordVerificationTime(duration, online); } cleanUp(); @@ -422,9 +389,8 @@ boolean verified = mVerificationResultStore.isRelationshipSaved( new Relationship(mPackageName, mSignatureFingerprint, origin, mRelation)); - mMetricsListener.recordVerificationResult(verified - ? VerificationResult.OFFLINE_SUCCESS - : VerificationResult.OFFLINE_FAILURE); + recordVerificationResult(verified ? VerificationResult.OFFLINE_SUCCESS + : VerificationResult.OFFLINE_FAILURE); originVerified(origin, verified, false); }
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactory.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactory.java index 4f6d276..182389d 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactory.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactory.java
@@ -19,10 +19,5 @@ public interface OriginVerifierFactory { /** Creates an {@link OriginVerifier}. */ OriginVerifier create(String packageName, @CustomTabsService.Relation int relation, - @Nullable WebContents webContents, @Nullable ExternalAuthUtils externalAuthUtils, - OriginVerifier.MetricsListener metricsListener); - - /** Same as above, but provides a no-op metrics listener. */ - OriginVerifier create(String packageName, @CustomTabsService.Relation int relation, @Nullable WebContents webContents, @Nullable ExternalAuthUtils externalAuthUtils); }
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactoryImpl.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactoryImpl.java index 18a9cd5..83c6a90 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactoryImpl.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierFactoryImpl.java
@@ -24,16 +24,8 @@ @Override public OriginVerifier create(String packageName, @CustomTabsService.Relation int relation, - @Nullable WebContents webContents, @Nullable ExternalAuthUtils externalAuthUtils, - OriginVerifier.MetricsListener metricsListener) { - return new OriginVerifier(packageName, relation, webContents, externalAuthUtils, - metricsListener, VerificationResultStore.getInstance()); - } - - @Override - public OriginVerifier create(String packageName, @CustomTabsService.Relation int relation, @Nullable WebContents webContents, @Nullable ExternalAuthUtils externalAuthUtils) { - return create(packageName, relation, webContents, externalAuthUtils, - new OriginVerifier.MetricsListener() {}); + return new OriginVerifier(packageName, relation, webContents, externalAuthUtils, + VerificationResultStore.getInstance()); } }
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index d394cc0..41c345a 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -309,9 +309,12 @@ // should not default to Guest when the profile picker is shown. // TODO(https://crbug.com/1155158): Remove the ignore_profile_picker parameter // once the picker supports opening URLs. - return GetStartupProfilePath(/*current_directory=*/base::FilePath(), - *base::CommandLine::ForCurrentProcess(), - /*ignore_profile_picker=*/true); + StartupProfilePathInfo profile_path_info = + GetStartupProfilePath(/*current_directory=*/base::FilePath(), + *base::CommandLine::ForCurrentProcess(), + /*ignore_profile_picker=*/true); + DCHECK_EQ(profile_path_info.mode, StartupProfileMode::kBrowserWindow); + return profile_path_info.path; } // Open the urls in the last used browser. Loads the profile asynchronously if
diff --git a/chrome/browser/apps/app_service/app_service_metrics.cc b/chrome/browser/apps/app_service/app_service_metrics.cc index c4deb5b6..6dccd12f 100644 --- a/chrome/browser/apps/app_service/app_service_metrics.cc +++ b/chrome/browser/apps/app_service/app_service_metrics.cc
@@ -67,10 +67,11 @@ kShortcutCustomizationApp = 44, kShimlessRMAApp = 45, kOsFeedbackApp = 46, + kA4 = 47, // Add any new values above this one, and update kMaxValue to the highest // enumerator value. - kMaxValue = kOsFeedbackApp, + kMaxValue = kA4, }; void RecordDefaultAppLaunch(DefaultAppName default_app_name, @@ -209,7 +210,9 @@ void RecordAppLaunch(const std::string& app_id, apps::mojom::LaunchSource launch_source) { - if (app_id == extension_misc::kCalculatorAppId) { + if (app_id == web_app::kA4AppId) { + RecordDefaultAppLaunch(DefaultAppName::kA4, launch_source); + } else if (app_id == extension_misc::kCalculatorAppId) { RecordDefaultAppLaunch(DefaultAppName::kCalculator, launch_source); } else if (app_id == extension_misc::kTextEditorAppId) { RecordDefaultAppLaunch(DefaultAppName::kText, launch_source); @@ -247,7 +250,8 @@ } else if (app_id == extension_misc::kGoogleKeepAppId) { RecordDefaultAppLaunch(DefaultAppName::kKeep, launch_source); #if BUILDFLAG(IS_CHROMEOS_ASH) - } else if (app_id == extension_misc::kGooglePhotosAppId) { + } else if (app_id == extension_misc::kGooglePhotosAppId || + app_id == arc::kGooglePhotosAppId) { RecordDefaultAppLaunch(DefaultAppName::kPhotos, launch_source); } else if (app_id == arc::kPlayBooksAppId) { RecordDefaultAppLaunch(DefaultAppName::kPlayBooks, launch_source);
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 370e401..eb8acd6 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -712,12 +712,13 @@ guest_observer.Wait(); content::Source<content::NavigationController> source = guest_observer.source(); - EXPECT_TRUE(source->GetWebContents() + EXPECT_TRUE(source->DeprecatedGetWebContents() ->GetMainFrame() ->GetProcess() ->IsForGuestsOnly()); - content::WebContents* guest_web_contents = source->GetWebContents(); + content::WebContents* guest_web_contents = + source->DeprecatedGetWebContents(); return guest_web_contents; } @@ -1636,7 +1637,7 @@ content::Source<content::NavigationController> source = empty_guest_observer.source(); - EXPECT_TRUE(source->GetWebContents() + EXPECT_TRUE(source->DeprecatedGetWebContents() ->GetMainFrame() ->GetProcess() ->IsForGuestsOnly()); @@ -1651,7 +1652,8 @@ ASSERT_EQ(2u, guest_contents_list.size()); content::WebContents* new_window_guest_contents = guest_contents_list[0]; - content::WebContents* empty_guest_web_contents = source->GetWebContents(); + content::WebContents* empty_guest_web_contents = + source->DeprecatedGetWebContents(); ASSERT_EQ(empty_guest_web_contents, guest_contents_list[1]); ASSERT_NE(empty_guest_web_contents, new_window_guest_contents); content::WebContents* empty_guest_embedder = @@ -1980,7 +1982,7 @@ content::Source<content::NavigationController> source = guest_observer.source(); - EXPECT_TRUE(source->GetWebContents() + EXPECT_TRUE(source->DeprecatedGetWebContents() ->GetMainFrame() ->GetProcess() ->IsForGuestsOnly()); @@ -1988,7 +1990,7 @@ ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); content::WebContentsDestroyedWatcher destroyed_watcher( - source->GetWebContents()); + source->DeprecatedGetWebContents()); // Tell the embedder to kill the guest. EXPECT_TRUE(content::ExecuteScript(
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc index 6f85efd1..3770841 100644 --- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -318,12 +318,12 @@ guest_observer.Wait(); content::Source<content::NavigationController> source = guest_observer.source(); - EXPECT_TRUE(source->GetWebContents() + EXPECT_TRUE(source->DeprecatedGetWebContents() ->GetMainFrame() ->GetProcess() ->IsForGuestsOnly()); - guest_web_contents_ = source->GetWebContents(); + guest_web_contents_ = source->DeprecatedGetWebContents(); embedder_web_contents_ = GuestViewBase::FromWebContents(guest_web_contents_)-> embedder_web_contents();
diff --git a/chrome/browser/ash/arc/arc_optin_uma.cc b/chrome/browser/ash/arc/arc_optin_uma.cc index d05a0da2..95cd761 100644 --- a/chrome/browser/ash/arc/arc_optin_uma.cc +++ b/chrome/browser/ash/arc/arc_optin_uma.cc
@@ -196,6 +196,12 @@ proxy_bypassed); } +void UpdateAccountReauthReason(mojom::ReauthReason reason, + const Profile* profile) { + base::UmaHistogramEnumeration( + GetHistogramNameByUserType("Arc.Auth.Reauth.Reason", profile), reason); +} + void UpdateMainAccountResolutionStatus( const Profile* profile, mojom::MainAccountResolutionStatus status) {
diff --git a/chrome/browser/ash/arc/arc_optin_uma.h b/chrome/browser/ash/arc/arc_optin_uma.h index 4dc4c1b2..37f6e37 100644 --- a/chrome/browser/ash/arc/arc_optin_uma.h +++ b/chrome/browser/ash/arc/arc_optin_uma.h
@@ -260,6 +260,8 @@ const Profile* profile); void UpdateAuthCodeFetcherProxyBypassUMA(bool proxy_bypassed, const Profile* profile); +void UpdateAccountReauthReason(mojom::ReauthReason reason, + const Profile* profile); void UpdateMainAccountResolutionStatus( const Profile* profile, mojom::MainAccountResolutionStatus status);
diff --git a/chrome/browser/ash/arc/arc_support_host.cc b/chrome/browser/ash/arc/arc_support_host.cc index 69d398e..f338150 100644 --- a/chrome/browser/ash/arc/arc_support_host.cc +++ b/chrome/browser/ash/arc/arc_support_host.cc
@@ -40,7 +40,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/webui/web_ui_util.h" #include "ui/chromeos/devicetype_utils.h" -#include "ui/display/screen.h" using sync_pb::UserConsentTypes; @@ -445,9 +444,7 @@ DisconnectMessageHost(); message_host_ = message_host; message_host_->SetObserver(this); - display::Screen* screen = display::Screen::GetScreen(); - if (screen) - screen->AddObserver(this); + display_observer_.emplace(this); if (!Initialize()) { Close(); @@ -484,9 +481,7 @@ void ArcSupportHost::DisconnectMessageHost() { DCHECK(message_host_); - display::Screen* screen = display::Screen::GetScreen(); - if (screen) - screen->RemoveObserver(this); + display_observer_.reset(); message_host_->SetObserver(nullptr); message_host_ = nullptr; }
diff --git a/chrome/browser/ash/arc/arc_support_host.h b/chrome/browser/ash/arc/arc_support_host.h index d48d6e5..106f617 100644 --- a/chrome/browser/ash/arc/arc_support_host.h +++ b/chrome/browser/ash/arc/arc_support_host.h
@@ -252,6 +252,8 @@ // The instance is created and managed by Chrome. arc::ArcSupportMessageHost* message_host_ = nullptr; + absl::optional<display::ScopedOptionalDisplayObserver> display_observer_; + // The lifetime of the message_host_ is out of control from ARC. // Fields below are UI parameter cache in case the value is set before // connection to the ARC support Chrome app is established.
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service.cc b/chrome/browser/ash/arc/auth/arc_auth_service.cc index fff617e3..71eb9e3 100644 --- a/chrome/browser/ash/arc/auth/arc_auth_service.cc +++ b/chrome/browser/ash/arc/auth/arc_auth_service.cc
@@ -370,6 +370,10 @@ UpdateAuthAccountCheckStatus(status, profile_); } +void ArcAuthService::ReportAccountReauthReason(mojom::ReauthReason reason) { + UpdateAccountReauthReason(reason, profile_); +} + void ArcAuthService::ReportManagementChangeStatus( mojom::ManagementChangeStatus status) { UpdateSupervisionTransitionResultUMA(status);
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service.h b/chrome/browser/ash/arc/auth/arc_auth_service.h index 619a06e..7cb159f7 100644 --- a/chrome/browser/ash/arc/auth/arc_auth_service.h +++ b/chrome/browser/ash/arc/auth/arc_auth_service.h
@@ -79,6 +79,7 @@ mojom::ArcSignInAccountPtr account) override; void ReportMetrics(mojom::MetricsType metrics_type, int32_t value) override; void ReportAccountCheckStatus(mojom::AccountCheckStatus status) override; + void ReportAccountReauthReason(mojom::ReauthReason reason) override; void ReportManagementChangeStatus( mojom::ManagementChangeStatus status) override; void RequestPrimaryAccountInfo(
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager.h b/chrome/browser/ash/borealis/borealis_disk_manager.h index 69bbb6db..3c24459 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager.h +++ b/chrome/browser/ash/borealis/borealis_disk_manager.h
@@ -6,11 +6,14 @@ #define CHROME_BROWSER_ASH_BOREALIS_BOREALIS_DISK_MANAGER_H_ #include "base/callback.h" +#include "chrome/browser/ash/borealis/infra/described.h" #include "chrome/browser/ash/borealis/infra/expected.h" namespace borealis { class BorealisContext; +enum class BorealisGetDiskInfoResult; +enum class BorealisResizeDiskResult; // Service responsible for managing borealis' disk space. class BorealisDiskManager { @@ -31,20 +34,25 @@ // Gets information about the borealis disk and the host device, returns // information about how the disk could be resized or an error. virtual void GetDiskInfo( - base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)> + base::OnceCallback<void( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>)> callback) = 0; // Attempt to expand the VM disk by the number of bytes specified. Returns the // actual size increase in bytes, or an error. virtual void RequestSpace( uint64_t bytes_requested, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) = 0; + base::OnceCallback< + void(Expected<uint64_t, Described<BorealisResizeDiskResult>>)> + callback) = 0; // Attempt to shrink the VM disk by the number of bytes specified. Returns the // actual size decrease in bytes, or an error. virtual void ReleaseSpace( uint64_t bytes_to_release, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) = 0; + base::OnceCallback< + void(Expected<uint64_t, Described<BorealisResizeDiskResult>>)> + callback) = 0; // Assesses the disk and resizes it so that it fits within the desired // constraints. Returns an empty string on success or an error.
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.cc b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.cc index 9a0edcaf..3b23195 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.cc +++ b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.cc
@@ -4,7 +4,7 @@ #include "chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h" -#include "chrome/browser/ash/borealis/borealis_disk_manager.h" +#include "chrome/browser/ash/borealis/borealis_metrics.h" #include "chrome/browser/ash/borealis/borealis_util.h" namespace borealis { @@ -21,12 +21,15 @@ const std::string& origin_vm_name, const std::string& origin_container_name, base::OnceCallback<void(Expected<BorealisDiskManager::GetDiskInfoResponse, - std::string>)> callback) { + Described<BorealisGetDiskInfoResult>>)> + callback) { std::string error = ValidateRequest(origin_vm_name, origin_container_name); if (!error.empty()) { std::move(callback).Run( Expected<BorealisDiskManager::GetDiskInfoResponse, - std::string>::Unexpected(std::move(error))); + Described<BorealisGetDiskInfoResult>>:: + Unexpected(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kInvalidRequest, std::move(error)))); return; } disk_manager_delegate_->GetDiskInfo(std::move(callback)); @@ -36,11 +39,14 @@ const std::string& origin_vm_name, const std::string& origin_container_name, uint64_t bytes_requested, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) { + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) { std::string error = ValidateRequest(origin_vm_name, origin_container_name); if (!error.empty()) { std::move(callback).Run( - Expected<uint64_t, std::string>::Unexpected(std::move(error))); + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kInvalidRequest, std::move(error)))); return; } disk_manager_delegate_->RequestSpace(bytes_requested, std::move(callback)); @@ -50,11 +56,14 @@ const std::string& origin_vm_name, const std::string& origin_container_name, uint64_t bytes_to_release, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) { + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) { std::string error = ValidateRequest(origin_vm_name, origin_container_name); if (!error.empty()) { std::move(callback).Run( - Expected<uint64_t, std::string>::Unexpected(std::move(error))); + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kInvalidRequest, std::move(error)))); return; } disk_manager_delegate_->ReleaseSpace(bytes_to_release, std::move(callback));
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h index 0472cf6..0d40b19 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h +++ b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h
@@ -24,19 +24,22 @@ const std::string& origin_vm_name, const std::string& origin_container_name, base::OnceCallback<void(Expected<BorealisDiskManager::GetDiskInfoResponse, - std::string>)> callback); + Described<BorealisGetDiskInfoResult>>)> + callback); virtual void RequestSpace( const std::string& origin_vm_name, const std::string& origin_container_name, uint64_t bytes_requested, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback); + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback); virtual void ReleaseSpace( const std::string& origin_vm_name, const std::string& origin_container_name, uint64_t bytes_to_release, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback); + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback); virtual void SetDiskManagerDelegate(BorealisDiskManager* disk_manager); virtual void RemoveDiskManagerDelegate(BorealisDiskManager* disk_manager);
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher_unittest.cc b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher_unittest.cc index 33356b8b..d18675c2 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_disk_manager_dispatcher_unittest.cc
@@ -16,29 +16,33 @@ public: DiskManagerMock() = default; ~DiskManagerMock() override = default; - MOCK_METHOD( - void, - GetDiskInfo, - (base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)>), - ()); + MOCK_METHOD(void, + GetDiskInfo, + (base::OnceCallback< + void(Expected<GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>>)>), + ()); MOCK_METHOD(void, RequestSpace, (uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, ReleaseSpace, (uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, SyncDiskSize, (base::OnceCallback<void(std::string)>), ()); }; using DiskInfoCallbackFactory = NiceCallbackFactory<void( - Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string>)>; + Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>>)>; -using RequestDeltaCallbackFactory = - NiceCallbackFactory<void(Expected<uint64_t, std::string>)>; +using RequestDeltaCallbackFactory = NiceCallbackFactory<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>; TEST(BorealisDiskManagerDispatcherTest, GetDiskInfoFailsIfNamesDontMatch) { BorealisDiskManagerDispatcher dispatcher; @@ -47,8 +51,12 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kInvalidRequest); + })); dispatcher.SetDiskManagerDelegate(&disk_mock); dispatcher.GetDiskInfo("NOTBOREALIS", "penguin", callback_factory.BindOnce()); @@ -60,8 +68,12 @@ EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kInvalidRequest); + })); dispatcher.GetDiskInfo("borealis", "penguin", callback_factory.BindOnce()); } @@ -84,8 +96,11 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); })); dispatcher.SetDiskManagerDelegate(&disk_mock); @@ -99,8 +114,11 @@ EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); })); dispatcher.RequestSpace("borealis", "penguin", 1, @@ -126,8 +144,11 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); })); dispatcher.SetDiskManagerDelegate(&disk_mock); @@ -141,8 +162,11 @@ EXPECT_CALL(callback_factory, Call(testing::_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); })); dispatcher.ReleaseSpace("borealis", "penguin", 1,
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc b/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc index 9bcf22a..e3149e41 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc +++ b/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ash/borealis/borealis_context.h" #include "chrome/browser/ash/borealis/borealis_context_manager.h" #include "chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h" +#include "chrome/browser/ash/borealis/borealis_metrics.h" #include "chrome/browser/ash/borealis/borealis_service.h" #include "chrome/browser/ash/borealis/infra/transition.h" #include "chrome/browser/ash/crostini/crostini_util.h" @@ -25,6 +26,19 @@ #include "chromeos/dbus/concierge/concierge_service.pb.h" namespace borealis { +namespace { + +// Helper function for recording RequestSpace and ReleaseSpace result metrics. +void EmitResizeDiskMetric(bool is_expanding, + borealis::BorealisResizeDiskResult result) { + if (is_expanding) { + borealis::RecordBorealisDiskClientRequestSpaceResultHistogram(result); + } else { + borealis::RecordBorealisDiskClientReleaseSpaceResultHistogram(result); + } +} + +} // namespace struct Nothing {}; @@ -62,6 +76,7 @@ BorealisDiskManagerImpl::BorealisDiskManagerImpl(const BorealisContext* context) : context_(context), + request_count_(0), free_space_provider_(std::make_unique<FreeSpaceProvider>()), weak_factory_(this) { borealis::BorealisService::GetForProfile(context_->profile()) @@ -70,13 +85,16 @@ } BorealisDiskManagerImpl::~BorealisDiskManagerImpl() { + RecordBorealisDiskClientNumRequestsPerSessionHistogram(request_count_); borealis::BorealisService::GetForProfile(context_->profile()) ->DiskManagerDispatcher() .RemoveDiskManagerDelegate(this); } class BorealisDiskManagerImpl::BuildDiskInfo - : public Transition<BorealisDiskInfo, BorealisDiskInfo, std::string> { + : public Transition<BorealisDiskInfo, + BorealisDiskInfo, + Described<BorealisGetDiskInfoResult>> { public: explicit BuildDiskInfo( BorealisDiskManagerImpl::FreeSpaceProvider* free_space_provider, @@ -95,7 +113,9 @@ private: void HandleFreeSpaceResult(int64_t free_space) { if (free_space < 0) { - Fail("failed to get the amount of free disk space on the host"); + Fail(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kFailedGettingExpandableSpace, + "failed to get the amount of free disk space on the host")); return; } disk_info_->expandable_space = @@ -114,12 +134,16 @@ void HandleListVmDisksResult( absl::optional<vm_tools::concierge::ListVmDisksResponse> response) { if (!response) { - Fail("failed to get response from concierge"); + Fail(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kConciergeFailed, + "failed to get response from concierge")); return; } if (!response->success()) { - Fail("concierge failed to list vm disks, returned error: " + - response->failure_reason()); + Fail(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kConciergeFailed, + "concierge failed to list vm disks, returned error: " + + response->failure_reason())); return; } const std::string& vm_name = context_->vm_name(); @@ -127,7 +151,9 @@ std::find_if(response->images().begin(), response->images().end(), [&vm_name](const auto& a) { return a.name() == vm_name; }); if (image == response->images().end()) { - Fail("no VM found with name " + vm_name); + Fail(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kConciergeFailed, + "no VM found with name " + vm_name)); return; } @@ -149,14 +175,16 @@ class BorealisDiskManagerImpl::ResizeDisk : public Transition<BorealisDiskInfo, std::pair<BorealisDiskInfo, BorealisDiskInfo>, - std::string>, + Described<BorealisResizeDiskResult>>, public chromeos::ConciergeClient::DiskImageObserver { public: explicit ResizeDisk( int64_t space_delta, + bool client_request, BorealisDiskManagerImpl::FreeSpaceProvider* free_space_provider, const BorealisContext* context) : space_delta_(space_delta), + client_request_(client_request), free_space_provider_(free_space_provider), context_(context), weak_factory_(this) {} @@ -204,41 +232,58 @@ } } - void HandleDiskInfo(Expected<std::unique_ptr<BorealisDiskInfo>, std::string> - disk_info_or_error) { + void HandleDiskInfo( + Expected<std::unique_ptr<BorealisDiskInfo>, + Described<BorealisGetDiskInfoResult>> disk_info_or_error) { build_disk_info_transition_.reset(); if (!disk_info_or_error) { - Fail("BuildDiskInfo failed: " + disk_info_or_error.Error()); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kFailedToGetDiskInfo, + "BuildDiskInfo failed: " + disk_info_or_error.Error().description())); return; } original_disk_info_ = *disk_info_or_error.Value(); if (original_disk_info_.disk_type != vm_tools::concierge::DiskImageType::DISK_IMAGE_RAW) { - Fail("cannot resize disk: disk type '" + - base::NumberToString(original_disk_info_.disk_type) + - "' cannot be resized"); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kInvalidDiskType, + "cannot resize disk: disk type '" + + base::NumberToString(original_disk_info_.disk_type) + + "' cannot be resized")); return; } + // The information we get on sparse disks is accurate, but needs to be used // differently during a resize so that we can: // 1. convert the sparse disk to a parameter-conforming fixed size disk. // 2. verify that we resized the disk by the requested delta, on top of any // changes we needed to make because of the sparse->fixed conversion. ConvertToFixedIfNeeded(); - if (space_delta_ > 0 && - original_disk_info_.expandable_space < space_delta_) { - Fail("the space requested exceeds the space that is expandable"); - return; + if (space_delta_ > 0) { + if (client_request_) { + RecordBorealisDiskClientAvailableSpaceAtRequestHistogram( + original_disk_info_.available_space); + } + if (original_disk_info_.expandable_space < space_delta_) { + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kNotEnoughExpandableSpace, + "the space requested exceeds the space that is expandable")); + return; + } } if (space_delta_ < 0) { if (original_disk_info_.available_space + space_delta_ < kTargetBufferBytes) { - Fail("shrinking the disk would not leave enough space available"); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kWouldNotLeaveEnoughSpace, + "shrinking the disk would not leave enough space available")); return; } if (original_disk_info_.disk_size + space_delta_ <= original_disk_info_.min_size) { - Fail("cannot shrink the disk below its minimum size"); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kViolatesMinimumSize, + "cannot shrink the disk below its minimum size")); return; } } @@ -294,7 +339,8 @@ void GetUpdatedDiskInfo(std::string error) { if (!error.empty()) { - Fail(std::move(error)); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kConciergeFailed, std::move(error))); return; } DCHECK(!build_disk_info_transition_); @@ -306,10 +352,14 @@ weak_factory_.GetWeakPtr())); } - void HandleUpdatedDiskInfo(Expected<std::unique_ptr<BorealisDiskInfo>, - std::string> disk_info_or_error) { + void HandleUpdatedDiskInfo( + Expected<std::unique_ptr<BorealisDiskInfo>, + Described<BorealisGetDiskInfoResult>> disk_info_or_error) { if (!disk_info_or_error) { - Fail("GetUpdatedDiskInfo failed: " + disk_info_or_error.Error()); + Fail(Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kFailedGettingUpdate, + "GetUpdatedDiskInfo failed: " + + disk_info_or_error.Error().description())); return; } updated_disk_info_ = *disk_info_or_error.Value(); @@ -318,6 +368,8 @@ } int64_t space_delta_; + // Will emit additional metrics if the transition is for a client request. + bool client_request_; BorealisDiskManagerImpl::FreeSpaceProvider* free_space_provider_; std::string uuid_; BorealisDiskInfo original_disk_info_; @@ -345,10 +397,11 @@ } private: - void HandleDiskInfo(Expected<std::unique_ptr<BorealisDiskInfo>, std::string> - disk_info_or_error) { + void HandleDiskInfo( + Expected<std::unique_ptr<BorealisDiskInfo>, + Described<BorealisGetDiskInfoResult>> disk_info_or_error) { if (!disk_info_or_error) { - Fail("BuildDiskInfo failed: " + disk_info_or_error.Error()); + Fail("BuildDiskInfo failed: " + disk_info_or_error.Error().description()); return; } if (!disk_info_or_error.Value()->has_fixed_size) { @@ -371,8 +424,8 @@ Succeed(std::move(disk_info_or_error.Value())); return; } - resize_disk_transition_ = - std::make_unique<ResizeDisk>(delta, free_space_provider_, context_); + resize_disk_transition_ = std::make_unique<ResizeDisk>( + delta, /*client_request=*/false, free_space_provider_, context_); resize_disk_transition_->Begin( std::move(disk_info_or_error.Value()), base::BindOnce(&SyncDisk::HandleResizeAttempt, @@ -382,9 +435,9 @@ void HandleResizeAttempt( Expected<std::unique_ptr<std::pair<BorealisDiskInfo, BorealisDiskInfo>>, - std::string> disk_info_or_error) { + Described<BorealisResizeDiskResult>> disk_info_or_error) { if (!disk_info_or_error) { - Fail("resize failed: " + disk_info_or_error.Error()); + Fail("resize failed: " + disk_info_or_error.Error().description()); return; } if (!IsDiskSizeWithinBounds(disk_info_or_error.Value()->second)) { @@ -409,15 +462,17 @@ }; void BorealisDiskManagerImpl::GetDiskInfo( - base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)> + base::OnceCallback<void( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>)> callback) { auto disk_info = std::make_unique<BorealisDiskInfo>(); + request_count_++; if (build_disk_info_transition_) { - std::string error = "another GetDiskInfo request is in progress"; - LOG(ERROR) << error; std::move(callback).Run( - Expected<GetDiskInfoResponse, std::string>::Unexpected( - std::move(error))); + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>:: + Unexpected(Described<BorealisGetDiskInfoResult>( + BorealisGetDiskInfoResult::kAlreadyInProgress, + "another GetDiskInfo request is in progress"))); return; } @@ -430,17 +485,19 @@ } void BorealisDiskManagerImpl::BuildGetDiskInfoResponse( - base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)> + base::OnceCallback<void( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>)> callback, - Expected<std::unique_ptr<BorealisDiskInfo>, std::string> - disk_info_or_error) { + Expected<std::unique_ptr<BorealisDiskInfo>, + Described<BorealisGetDiskInfoResult>> disk_info_or_error) { build_disk_info_transition_.reset(); if (!disk_info_or_error) { - std::string error = "GetDiskInfo failed: " + disk_info_or_error.Error(); - LOG(ERROR) << error; + RecordBorealisDiskClientGetDiskInfoResultHistogram( + disk_info_or_error.Error().error()); std::move(callback).Run( - Expected<GetDiskInfoResponse, std::string>::Unexpected( - std::move(error))); + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>:: + Unexpected(Described<BorealisGetDiskInfoResult>( + std::move(disk_info_or_error.Error())))); return; } GetDiskInfoResponse response; @@ -448,30 +505,36 @@ int64_t(disk_info_or_error.Value()->available_space - kTargetBufferBytes), int64_t(0)); response.expandable_bytes = disk_info_or_error.Value()->expandable_space; - std::move(callback).Run(Expected<GetDiskInfoResponse, std::string>(response)); + RecordBorealisDiskClientGetDiskInfoResultHistogram( + BorealisGetDiskInfoResult::kSuccess); + std::move(callback).Run( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>( + response)); } void BorealisDiskManagerImpl::RequestSpaceDelta( int64_t target_delta, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) { + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) { + DCHECK(target_delta != 0); + bool expanding = target_delta > 0; if (resize_disk_transition_) { - std::string error = "another ResizeDisk request is in progress"; - LOG(ERROR) << error; - std::move(callback).Run(Expected<uint64_t, std::string>::Unexpected(error)); - return; - } - if (target_delta == 0) { - std::string error = "requested delta must not be 0"; - LOG(ERROR) << error; - std::move(callback).Run(Expected<uint64_t, std::string>::Unexpected(error)); + EmitResizeDiskMetric(expanding, + BorealisResizeDiskResult::kAlreadyInProgress); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kAlreadyInProgress, + "another ResizeDisk request is in progress"))); return; } auto disk_info = std::make_unique<BorealisDiskInfo>(); int64_t space_delta = target_delta + (target_delta > 0 ? kDiskRoundingBytes : 0); - resize_disk_transition_ = std::make_unique<ResizeDisk>( - space_delta, free_space_provider_.get(), context_); + resize_disk_transition_ = + std::make_unique<ResizeDisk>(space_delta, /*client_request=*/true, + free_space_provider_.get(), context_); resize_disk_transition_->Begin( std::move(disk_info), base::BindOnce(&BorealisDiskManagerImpl::OnRequestSpaceDelta, @@ -481,62 +544,102 @@ void BorealisDiskManagerImpl::OnRequestSpaceDelta( int64_t target_delta, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback, + base::OnceCallback< + void(Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback, Expected<std::unique_ptr<std::pair<BorealisDiskInfo, BorealisDiskInfo>>, - std::string> disk_info_or_error) { + Described<BorealisResizeDiskResult>> disk_info_or_error) { + bool expanding = target_delta > 0; resize_disk_transition_.reset(); if (!disk_info_or_error) { - std::string error = - "RequestSpaceDelta failed: " + disk_info_or_error.Error(); - LOG(ERROR) << error; - std::move(callback).Run(Expected<uint64_t, std::string>::Unexpected(error)); + EmitResizeDiskMetric(expanding, disk_info_or_error.Error().error()); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + std::move(disk_info_or_error.Error()))); return; } int64_t delta = disk_info_or_error.Value()->second.disk_size - disk_info_or_error.Value()->first.disk_size; - if (target_delta > 0) { + if (expanding) { if (delta < target_delta) { - std::string error = "RequestSpaceDelta failed: requested " + - base::NumberToString(target_delta) + - " bytes but got " + base::NumberToString(delta) + - " bytes"; - LOG(ERROR) << error; + EmitResizeDiskMetric(expanding, + BorealisResizeDiskResult::kFailedToFulfillRequest); std::move(callback).Run( - Expected<uint64_t, std::string>::Unexpected(error)); + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kFailedToFulfillRequest, + "requested " + base::NumberToString(target_delta) + + " bytes but got " + base::NumberToString(delta) + + " bytes"))); return; } - std::move(callback).Run(Expected<uint64_t, std::string>(delta)); } else { if (delta >= 0) { if (!disk_info_or_error.Value()->first.has_fixed_size && disk_info_or_error.Value()->second.has_fixed_size) { // We succeeded in trying to convert the disk to a fixed size. - std::move(callback).Run(Expected<uint64_t, std::string>(0)); + EmitResizeDiskMetric(expanding, BorealisResizeDiskResult::kSuccess); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>(0)); return; } - std::string error = "RequestSpaceDelta failed: failed to shrink the disk"; - LOG(ERROR) << error; + EmitResizeDiskMetric(expanding, + BorealisResizeDiskResult::kFailedToFulfillRequest); std::move(callback).Run( - Expected<uint64_t, std::string>::Unexpected(error)); + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kFailedToFulfillRequest, + "failed to shrink the disk"))); return; } - std::move(callback).Run(Expected<uint64_t, std::string>(abs(delta))); } + EmitResizeDiskMetric(expanding, BorealisResizeDiskResult::kSuccess); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>(abs(delta))); } void BorealisDiskManagerImpl::RequestSpace( uint64_t bytes_requested, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) { + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) { + request_count_++; + RecordBorealisDiskClientSpaceRequestedHistogram(bytes_requested); + if (bytes_requested == 0) { + EmitResizeDiskMetric( + /*is_expanding=*/true, BorealisResizeDiskResult::kInvalidRequest); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kInvalidRequest, + "requested_bytes must not be 0"))); + return; + } RequestSpaceDelta(bytes_requested, std::move(callback)); } void BorealisDiskManagerImpl::ReleaseSpace( uint64_t bytes_to_release, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback) { + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) { + request_count_++; + RecordBorealisDiskClientSpaceReleasedHistogram(bytes_to_release); + if (bytes_to_release == 0) { + EmitResizeDiskMetric( + /*is_expanding=*/false, BorealisResizeDiskResult::kInvalidRequest); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kInvalidRequest, + "bytes_to_release must not be 0"))); + return; + } if (bytes_to_release > std::numeric_limits<int64_t>::max()) { - std::string error = "ReleaseSpace failed: bytes_to_release overflowed"; - LOG(ERROR) << error; - std::move(callback).Run(Expected<uint64_t, std::string>::Unexpected(error)); + EmitResizeDiskMetric( + /*is_expanding=*/false, BorealisResizeDiskResult::kOverflowError); + std::move(callback).Run( + Expected<uint64_t, Described<BorealisResizeDiskResult>>::Unexpected( + Described<BorealisResizeDiskResult>( + BorealisResizeDiskResult::kOverflowError, + "bytes_to_release overflowed"))); return; } RequestSpaceDelta(int64_t(bytes_to_release) * -1, std::move(callback));
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_impl.h b/chrome/browser/ash/borealis/borealis_disk_manager_impl.h index d3bf4bfd..60414938 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_impl.h +++ b/chrome/browser/ash/borealis/borealis_disk_manager_impl.h
@@ -9,7 +9,6 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/ash/borealis/borealis_context_manager.h" #include "chrome/browser/ash/borealis/borealis_disk_manager.h" -#include "chrome/browser/ash/borealis/infra/expected.h" namespace borealis { // Amount of space, in bytes, that borealis needs to leave free on the host. @@ -33,17 +32,20 @@ BorealisDiskManagerImpl& operator=(const BorealisDiskManagerImpl&) = delete; ~BorealisDiskManagerImpl() override; - // TODO(174592560): add more explicit error handling when metrics are - // introduced. void GetDiskInfo( - base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)> + base::OnceCallback<void( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>)> callback) override; - void RequestSpace(uint64_t bytes_requested, - base::OnceCallback<void(Expected<uint64_t, std::string>)> - callback) override; - void ReleaseSpace(uint64_t bytes_to_release, - base::OnceCallback<void(Expected<uint64_t, std::string>)> - callback) override; + void RequestSpace( + uint64_t bytes_requested, + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) + override; + void ReleaseSpace( + uint64_t bytes_to_release, + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback) + override; // TODO(b/174592560): Since there are differing success criteria, we may wish // to split this into Expected<SuccessEnum, ErrorEnum> when we expand on the // error handling. @@ -77,10 +79,11 @@ // Handles the results of a GetDiskInfo request. void BuildGetDiskInfoResponse( - base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)> + base::OnceCallback<void( + Expected<GetDiskInfoResponse, Described<BorealisGetDiskInfoResult>>)> callback, - Expected<std::unique_ptr<BorealisDiskInfo>, std::string> - disk_info_or_error); + Expected<std::unique_ptr<BorealisDiskInfo>, + Described<BorealisGetDiskInfoResult>> disk_info_or_error); // Handles the RequestSpace and ReleaseSpace requests. |bytes_requested| from // RequestSpace becomes a positive delta that expands the disk and the @@ -89,19 +92,22 @@ // negative int64_t). void RequestSpaceDelta( int64_t target_delta, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback); + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback); void OnRequestSpaceDelta( int64_t target_delta, - base::OnceCallback<void(Expected<uint64_t, std::string>)> callback, + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)> callback, Expected<std::unique_ptr<std::pair<BorealisDiskInfo, BorealisDiskInfo>>, - std::string> disk_info_or_error); + Described<BorealisResizeDiskResult>> disk_info_or_error); void OnSyncDiskSize(base::OnceCallback<void(std::string)> callback, Expected<std::unique_ptr<BorealisDiskInfo>, std::string> disk_info_or_error); const BorealisContext* const context_; + int request_count_; std::unique_ptr<BuildDiskInfo> build_disk_info_transition_; std::unique_ptr<ResizeDisk> resize_disk_transition_; std::unique_ptr<SyncDisk> sync_disk_transition_;
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_unittest.cc b/chrome/browser/ash/borealis/borealis_disk_manager_unittest.cc index 90d6ac5..6c1900a 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_disk_manager_unittest.cc
@@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/callback_helpers.h" #include "base/test/bind.h" +#include "base/test/metrics/histogram_tester.h" #include "chrome/browser/ash/borealis/borealis_context.h" #include "chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h" #include "chrome/browser/ash/borealis/borealis_features.h" @@ -42,36 +43,39 @@ }; using DiskInfoCallbackFactory = StrictCallbackFactory<void( - Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string>)>; + Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>>)>; -using RequestDeltaCallbackFactory = - StrictCallbackFactory<void(Expected<uint64_t, std::string>)>; +using RequestDeltaCallbackFactory = StrictCallbackFactory<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>; using SyncDiskCallbackFactory = NiceCallbackFactory<void(std::string)>; class BorealisDiskDispatcherMock : public BorealisDiskManagerDispatcher { public: - MOCK_METHOD( - void, - GetDiskInfo, - (const std::string&, - const std::string&, - base::OnceCallback<void( - Expected<BorealisDiskManager::GetDiskInfoResponse, std::string>)>), - ()); + MOCK_METHOD(void, + GetDiskInfo, + (const std::string&, + const std::string&, + base::OnceCallback< + void(Expected<BorealisDiskManager::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>>)>), + ()); MOCK_METHOD(void, RequestSpace, (const std::string&, const std::string&, uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, ReleaseSpace, (const std::string&, const std::string&, uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, SetDiskManagerDelegate, @@ -157,6 +161,7 @@ std::unique_ptr<BorealisWindowManager> borealis_window_manager_; std::unique_ptr<base::RunLoop> run_loop_; content::BrowserTaskEnvironment task_environment_; + base::HistogramTester histogram_tester_; }; TEST_F(BorealisDiskManagerTest, GetDiskInfoFailsOnFreeSpaceProviderError) { @@ -168,10 +173,17 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kFailedGettingExpandableSpace); + })); disk_manager_->GetDiskInfo(callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientGetDiskInfoResultHistogram, + BorealisGetDiskInfoResult::kFailedGettingExpandableSpace, 1); } TEST_F(BorealisDiskManagerTest, GetDiskInfoFailsOnNoResponseFromConcierge) { @@ -187,10 +199,17 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kConciergeFailed); + })); disk_manager_->GetDiskInfo(callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientGetDiskInfoResultHistogram, + BorealisGetDiskInfoResult::kConciergeFailed, 1); } TEST_F(BorealisDiskManagerTest, @@ -209,8 +228,12 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kConciergeFailed); + })); disk_manager_->GetDiskInfo(callback_factory.BindOnce()); run_loop()->RunUntilIdle(); } @@ -230,8 +253,12 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kConciergeFailed); + })); disk_manager_->GetDiskInfo(callback_factory.BindOnce()); run_loop()->RunUntilIdle(); } @@ -250,8 +277,8 @@ DiskInfoCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { EXPECT_TRUE(response_or_error); // 3GB of disk space less 2GB of buffer is 1GB of available space. EXPECT_EQ(response_or_error.Value().available_bytes, 1 * kGiB); @@ -261,6 +288,9 @@ })); disk_manager_->GetDiskInfo(callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientGetDiskInfoResultHistogram, + BorealisGetDiskInfoResult::kSuccess, 1); } TEST_F(BorealisDiskManagerTest, GetDiskInfoFailsOnConcurrentAttempt) { @@ -278,12 +308,18 @@ DiskInfoCallbackFactory second_callback_factory; EXPECT_CALL(first_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_TRUE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_TRUE(response_or_error); + })); EXPECT_CALL(second_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_FALSE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisGetDiskInfoResult::kAlreadyInProgress); + })); disk_manager_->GetDiskInfo(first_callback_factory.BindOnce()); disk_manager_->GetDiskInfo(second_callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -309,8 +345,10 @@ DiskInfoCallbackFactory first_callback_factory; EXPECT_CALL(first_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_TRUE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_TRUE(response_or_error); + })); disk_manager_->GetDiskInfo(first_callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -325,22 +363,67 @@ DiskInfoCallbackFactory second_callback_factory; EXPECT_CALL(second_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, std::string> - response_or_error) { EXPECT_TRUE(response_or_error); })); + [](Expected<BorealisDiskManagerImpl::GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>> response_or_error) { + EXPECT_TRUE(response_or_error); + })); disk_manager_->GetDiskInfo(second_callback_factory.BindOnce()); run_loop()->RunUntilIdle(); } +TEST_F(BorealisDiskManagerTest, RequestSpaceFailsIf0SpaceRequested) { + RequestDeltaCallbackFactory callback_factory; + EXPECT_CALL(callback_factory, Call(_)) + .WillOnce(testing::Invoke( + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); + })); + disk_manager_->RequestSpace(0, callback_factory.BindOnce()); + run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kInvalidRequest, 1); +} + +TEST_F(BorealisDiskManagerTest, ReleaseSpaceFailsIf0SpaceReleased) { + RequestDeltaCallbackFactory callback_factory; + EXPECT_CALL(callback_factory, Call(_)) + .WillOnce(testing::Invoke( + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { + EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidRequest); + })); + disk_manager_->ReleaseSpace(0, callback_factory.BindOnce()); + run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kInvalidRequest, 1); +} + TEST_F(BorealisDiskManagerTest, ReleaseSpaceFailsIfRequestExceedsInt64) { RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kOverflowError); })); disk_manager_->ReleaseSpace(uint64_t(std::numeric_limits<int64_t>::max()) + 1, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientSpaceReleasedHistogram, + (uint64_t(std::numeric_limits<int64_t>::max()) + 1) / (1024 * 1024), 1); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kOverflowError, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsIfBuildDiskInfoFails) { @@ -358,11 +441,20 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kFailedToGetDiskInfo); })); disk_manager_->RequestSpace(1 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientSpaceRequestedHistogram, (1 * kGiB) / (1024 * 1024), + 1); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kFailedToGetDiskInfo, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsIfDiskTypeNotRaw) { @@ -381,11 +473,17 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kInvalidDiskType); })); disk_manager_->RequestSpace(1 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kInvalidDiskType, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsIfRequestTooHigh) { @@ -402,12 +500,21 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kNotEnoughExpandableSpace); })); // 6GB > 4GB of expandable space. disk_manager_->RequestSpace(6 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientAvailableSpaceAtRequestHistogram, + (3 * kGiB) / (1024 * 1024), 1); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kNotEnoughExpandableSpace, 1); } TEST_F(BorealisDiskManagerTest, @@ -425,13 +532,19 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kWouldNotLeaveEnoughSpace); })); // Release space is requesting a negative delta. 2GB > 1GB of unused available // space. disk_manager_->ReleaseSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kWouldNotLeaveEnoughSpace, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsIfRequestIsBelowMinimum) { @@ -448,12 +561,18 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kViolatesMinimumSize); })); // Release space is requesting a negative delta. 7GB-2GB < 6GB min_size. disk_manager_->ReleaseSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kViolatesMinimumSize, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsOnNoResizeDiskResponse) { @@ -470,11 +589,17 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kConciergeFailed); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kConciergeFailed, 1); } TEST_F(BorealisDiskManagerTest, RequestDeltaFailsOnFailedResizeDiskResponse) { @@ -496,8 +621,11 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kConciergeFailed); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -530,8 +658,11 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kConciergeFailed); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -565,11 +696,17 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kFailedGettingUpdate); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kFailedGettingUpdate, 1); } TEST_F(BorealisDiskManagerTest, RequestSpaceFailsIfResizeTooSmall) { @@ -605,11 +742,17 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kFailedToFulfillRequest); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kFailedToFulfillRequest, 1); } TEST_F(BorealisDiskManagerTest, ReleaseSpaceFailsIfDiskExpanded) { @@ -645,11 +788,17 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); + EXPECT_EQ(response_or_error.Error().error(), + BorealisResizeDiskResult::kFailedToFulfillRequest); })); disk_manager_->ReleaseSpace(1 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kFailedToFulfillRequest, 1); } TEST_F(BorealisDiskManagerTest, RequestSpaceSuccessful) { @@ -685,12 +834,16 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); EXPECT_EQ(response_or_error.Value(), 2 * kGiB); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientRequestSpaceResultHistogram, + BorealisResizeDiskResult::kSuccess, 1); } TEST_F(BorealisDiskManagerTest, ReleaseSpaceSuccessful) { @@ -726,12 +879,16 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); EXPECT_EQ(response_or_error.Value(), 1 * kGiB); })); disk_manager_->ReleaseSpace(1 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientReleaseSpaceResultHistogram, + BorealisResizeDiskResult::kSuccess, 1); } TEST_F(BorealisDiskManagerTest, RequestSpaceConvertsSparseDiskToFixed) { @@ -773,7 +930,8 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); EXPECT_EQ(response_or_error.Value(), 1 * kGiB); })); @@ -820,7 +978,8 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); EXPECT_EQ(response_or_error.Value(), 0); })); @@ -862,15 +1021,13 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { - EXPECT_TRUE(response_or_error); - })); + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); })); RequestDeltaCallbackFactory second_callback_factory; EXPECT_CALL(second_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { - EXPECT_FALSE(response_or_error); - })); + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_FALSE(response_or_error); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); disk_manager_->RequestSpace(2 * kGiB, second_callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -909,9 +1066,8 @@ RequestDeltaCallbackFactory callback_factory; EXPECT_CALL(callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { - EXPECT_TRUE(response_or_error); - })); + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); })); disk_manager_->RequestSpace(2 * kGiB, callback_factory.BindOnce()); run_loop()->RunUntilIdle(); @@ -943,7 +1099,8 @@ RequestDeltaCallbackFactory second_callback_factory; EXPECT_CALL(second_callback_factory, Call(_)) .WillOnce(testing::Invoke( - [](Expected<uint64_t, std::string> response_or_error) { + [](Expected<uint64_t, Described<BorealisResizeDiskResult>> + response_or_error) { EXPECT_TRUE(response_or_error); EXPECT_EQ(response_or_error.Value(), 1 * kGiB); })); @@ -1166,5 +1323,21 @@ run_loop()->RunUntilIdle(); } +TEST_F(BorealisDiskManagerTest, RequestsRecordedOnDestruction) { + EXPECT_CALL(*free_space_provider_, Get(_)) + .WillOnce(testing::Invoke([](base::OnceCallback<void(int64_t)> callback) { + std::move(callback).Run(-1); + })); + DiskInfoCallbackFactory callback_factory; + disk_manager_->GetDiskInfo(base::DoNothing()); + run_loop()->RunUntilIdle(); + + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientNumRequestsPerSessionHistogram, 1, 0); + disk_manager_.reset(); + histogram_tester_.ExpectUniqueSample( + kBorealisDiskClientNumRequestsPerSessionHistogram, 1, 1); +} + } // namespace } // namespace borealis
diff --git a/chrome/browser/ash/borealis/borealis_metrics.cc b/chrome/browser/ash/borealis/borealis_metrics.cc index b03ac29..5a24e20c 100644 --- a/chrome/browser/ash/borealis/borealis_metrics.cc +++ b/chrome/browser/ash/borealis/borealis_metrics.cc
@@ -8,6 +8,20 @@ namespace borealis { +const char kBorealisDiskClientGetDiskInfoResultHistogram[] = + "Borealis.Disk.Client.GetDiskInfoResult"; +const char kBorealisDiskClientRequestSpaceResultHistogram[] = + "Borealis.Disk.Client.RequestSpaceResult"; +const char kBorealisDiskClientReleaseSpaceResultHistogram[] = + "Borealis.Disk.Client.ReleaseSpaceResult"; +extern const char kBorealisDiskClientSpaceRequestedHistogram[] = + "Borealis.Disk.Client.SpaceRequested"; +extern const char kBorealisDiskClientSpaceReleasedHistogram[] = + "Borealis.Disk.Client.SpaceReleased"; +const char kBorealisDiskClientAvailableSpaceAtRequestHistogram[] = + "Borealis.Disk.Client.AvailableSpaceAtRequest"; +const char kBorealisDiskClientNumRequestsPerSessionHistogram[] = + "Borealis.Disk.Client.NumRequestsPerSesssion"; const char kBorealisInstallNumAttemptsHistogram[] = "Borealis.Install.NumAttempts"; const char kBorealisInstallResultHistogram[] = "Borealis.Install.Result"; @@ -74,6 +88,51 @@ shutdown_result); } +void RecordBorealisDiskClientGetDiskInfoResultHistogram( + BorealisGetDiskInfoResult get_disk_info_result) { + base::UmaHistogramEnumeration(kBorealisDiskClientGetDiskInfoResultHistogram, + get_disk_info_result); +} + +void RecordBorealisDiskClientRequestSpaceResultHistogram( + BorealisResizeDiskResult resize_disk_result) { + base::UmaHistogramEnumeration(kBorealisDiskClientRequestSpaceResultHistogram, + resize_disk_result); +} + +void RecordBorealisDiskClientReleaseSpaceResultHistogram( + BorealisResizeDiskResult resize_disk_result) { + base::UmaHistogramEnumeration(kBorealisDiskClientReleaseSpaceResultHistogram, + resize_disk_result); +} + +void RecordBorealisDiskClientSpaceRequestedHistogram(uint64_t bytes_requested) { + uint64_t megabytes_requested = bytes_requested / (1024 * 1024); + base::UmaHistogramCustomCounts(kBorealisDiskClientSpaceRequestedHistogram, + megabytes_requested, /*min=*/0, /*max=*/128000, + /*buckets=*/100); +} + +void RecordBorealisDiskClientSpaceReleasedHistogram(uint64_t bytes_released) { + uint64_t megabytes_released = bytes_released / (1024 * 1024); + base::UmaHistogramCustomCounts(kBorealisDiskClientSpaceReleasedHistogram, + megabytes_released, /*min=*/0, /*max=*/128000, + /*buckets=*/100); +} + +void RecordBorealisDiskClientAvailableSpaceAtRequestHistogram( + uint64_t available_bytes) { + uint64_t available_megabytes = available_bytes / (1024 * 1024); + base::UmaHistogramCustomCounts( + kBorealisDiskClientAvailableSpaceAtRequestHistogram, available_megabytes, + /*min=*/0, /*max=*/16000, /*buckets=*/100); +} + +void RecordBorealisDiskClientNumRequestsPerSessionHistogram(int num_requests) { + base::UmaHistogramCounts100(kBorealisDiskClientNumRequestsPerSessionHistogram, + num_requests); +} + } // namespace borealis std::ostream& operator<<(std::ostream& stream,
diff --git a/chrome/browser/ash/borealis/borealis_metrics.h b/chrome/browser/ash/borealis/borealis_metrics.h index 0795bb2b..6aa675e4 100644 --- a/chrome/browser/ash/borealis/borealis_metrics.h +++ b/chrome/browser/ash/borealis/borealis_metrics.h
@@ -9,6 +9,13 @@ namespace borealis { +extern const char kBorealisDiskClientGetDiskInfoResultHistogram[]; +extern const char kBorealisDiskClientRequestSpaceResultHistogram[]; +extern const char kBorealisDiskClientReleaseSpaceResultHistogram[]; +extern const char kBorealisDiskClientSpaceRequestedHistogram[]; +extern const char kBorealisDiskClientSpaceReleasedHistogram[]; +extern const char kBorealisDiskClientAvailableSpaceAtRequestHistogram[]; +extern const char kBorealisDiskClientNumRequestsPerSessionHistogram[]; extern const char kBorealisInstallNumAttemptsHistogram[]; extern const char kBorealisInstallResultHistogram[]; extern const char kBorealisInstallOverallTimeHistogram[]; @@ -67,6 +74,35 @@ // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. +enum class BorealisGetDiskInfoResult { + kSuccess = 0, + kAlreadyInProgress = 1, + kFailedGettingExpandableSpace = 2, + kConciergeFailed = 3, + kInvalidRequest = 4, + kMaxValue = kInvalidRequest, +}; + +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class BorealisResizeDiskResult { + kSuccess = 0, + kAlreadyInProgress = 1, + kFailedToGetDiskInfo = 2, + kInvalidDiskType = 3, + kNotEnoughExpandableSpace = 4, + kWouldNotLeaveEnoughSpace = 5, + kViolatesMinimumSize = 6, + kConciergeFailed = 7, + kFailedGettingUpdate = 8, + kInvalidRequest = 9, + kOverflowError = 10, + kFailedToFulfillRequest = 11, + kMaxValue = kFailedToFulfillRequest, +}; + +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. enum class BorealisShutdownResult { kSuccess = 0, kInProgress = 1, @@ -86,6 +122,17 @@ void RecordBorealisShutdownNumAttemptsHistogram(); void RecordBorealisShutdownResultHistogram( BorealisShutdownResult shutdown_result); +void RecordBorealisDiskClientGetDiskInfoResultHistogram( + BorealisGetDiskInfoResult get_disk_info_result); +void RecordBorealisDiskClientRequestSpaceResultHistogram( + BorealisResizeDiskResult resize_disk_result); +void RecordBorealisDiskClientReleaseSpaceResultHistogram( + BorealisResizeDiskResult resize_disk_result); +void RecordBorealisDiskClientSpaceRequestedHistogram(uint64_t bytes_requested); +void RecordBorealisDiskClientSpaceReleasedHistogram(uint64_t bytes_released); +void RecordBorealisDiskClientAvailableSpaceAtRequestHistogram( + uint64_t available_bytes); +void RecordBorealisDiskClientNumRequestsPerSessionHistogram(int num_requests); } // namespace borealis
diff --git a/chrome/browser/ash/borealis/borealis_task_unittest.cc b/chrome/browser/ash/borealis/borealis_task_unittest.cc index cb16262..d727fba 100644 --- a/chrome/browser/ash/borealis/borealis_task_unittest.cc +++ b/chrome/browser/ash/borealis/borealis_task_unittest.cc
@@ -33,20 +33,23 @@ public: DiskManagerMock() = default; ~DiskManagerMock() override = default; - MOCK_METHOD( - void, - GetDiskInfo, - (base::OnceCallback<void(Expected<GetDiskInfoResponse, std::string>)>), - ()); + MOCK_METHOD(void, + GetDiskInfo, + (base::OnceCallback< + void(Expected<GetDiskInfoResponse, + Described<BorealisGetDiskInfoResult>>)>), + ()); MOCK_METHOD(void, RequestSpace, (uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, ReleaseSpace, (uint64_t, - base::OnceCallback<void(Expected<uint64_t, std::string>)>), + base::OnceCallback<void( + Expected<uint64_t, Described<BorealisResizeDiskResult>>)>), ()); MOCK_METHOD(void, SyncDiskSize, (base::OnceCallback<void(std::string)>), ()); };
diff --git a/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.cc b/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.cc index 23d32b5..90f28cb9 100644 --- a/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.cc +++ b/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "chrome/browser/ash/borealis/borealis_disk_manager_dispatcher.h" +#include "chrome/browser/ash/borealis/borealis_metrics.h" #include "chrome/browser/ash/borealis/borealis_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chromeos/dbus/vm_disk_management/disk_management.pb.h" @@ -77,12 +78,12 @@ if (request.origin().vm_name().empty() || request.origin().container_name().empty() || request.origin().owner_id().empty()) { - std::string error = - "GetDiskInfoRequest failed: request has missing or incomplete origin"; - OnGetDiskInfo( - std::move(response), std::move(response_sender), - borealis::Expected<borealis::BorealisDiskManager::GetDiskInfoResponse, - std::string>::Unexpected(std::move(error))); + OnGetDiskInfo(std::move(response), std::move(response_sender), + ExpectedGetDiskInfoResponse::Unexpected( + borealis::Described<borealis::BorealisGetDiskInfoResult>( + borealis::BorealisGetDiskInfoResult::kInvalidRequest, + "GetDiskInfoRequest failed: request has missing or " + "incomplete origin"))); return; } @@ -118,11 +119,13 @@ if (request.origin().vm_name().empty() || request.origin().container_name().empty() || request.origin().owner_id().empty()) { - std::string error = - "RequestSpaceRequest failed: request has missing or incomplete origin"; - OnRequestSpace(std::move(response), std::move(response_sender), - borealis::Expected<uint64_t, std::string>::Unexpected( - std::move(error))); + OnRequestSpace( + std::move(response), std::move(response_sender), + ExpectedRequestDeltaResponse::Unexpected( + borealis::Described<borealis::BorealisResizeDiskResult>( + borealis::BorealisResizeDiskResult::kInvalidRequest, + "RequestSpaceRequest failed: request has missing or incomplete " + "origin"))); return; } @@ -159,11 +162,13 @@ if (request.origin().vm_name().empty() || request.origin().container_name().empty() || request.origin().owner_id().empty()) { - std::string error = - "ReleaseSpaceRequest failed: request has missing or incomplete origin"; - OnReleaseSpace(std::move(response), std::move(response_sender), - borealis::Expected<uint64_t, std::string>::Unexpected( - std::move(error))); + OnReleaseSpace( + std::move(response), std::move(response_sender), + ExpectedRequestDeltaResponse::Unexpected( + borealis::Described<borealis::BorealisResizeDiskResult>( + borealis::BorealisResizeDiskResult::kInvalidRequest, + "ReleaseSpaceRequest failed: request has missing or incomplete " + "origin"))); return; } @@ -181,12 +186,12 @@ void VmDiskManagementServiceProvider::OnGetDiskInfo( std::unique_ptr<dbus::Response> response, dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<borealis::BorealisDiskManager::GetDiskInfoResponse, - std::string> response_or_error) { + ExpectedGetDiskInfoResponse response_or_error) { vm_tools::disk_management::GetDiskInfoResponse payload; if (!response_or_error) { - LOG(ERROR) << "GetDiskInfoRequest failed: " << response_or_error.Error(); - payload.set_error(1); + LOG(ERROR) << "GetDiskInfoRequest failed: " + << response_or_error.Error().description(); + payload.set_error(int(response_or_error.Error().error())); } else { payload.set_available_space(response_or_error.Value().available_bytes); payload.set_expandable_space(response_or_error.Value().expandable_bytes); @@ -200,11 +205,12 @@ void VmDiskManagementServiceProvider::OnRequestSpace( std::unique_ptr<dbus::Response> response, dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<uint64_t, std::string> response_or_error) { + ExpectedRequestDeltaResponse response_or_error) { vm_tools::disk_management::RequestSpaceResponse payload; if (!response_or_error) { - LOG(ERROR) << "RequestSpaceRequest failed: " << response_or_error.Error(); - payload.set_error(1); + LOG(ERROR) << "RequestSpaceRequest failed: " + << response_or_error.Error().description(); + payload.set_error(int(response_or_error.Error().error())); } else { payload.set_space_granted(response_or_error.Value()); } @@ -217,11 +223,12 @@ void VmDiskManagementServiceProvider::OnReleaseSpace( std::unique_ptr<dbus::Response> response, dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<uint64_t, std::string> response_or_error) { + ExpectedRequestDeltaResponse response_or_error) { vm_tools::disk_management::ReleaseSpaceResponse payload; if (!response_or_error) { - LOG(ERROR) << "ReleaseSpaceRequest failed: " << response_or_error.Error(); - payload.set_error(1); + LOG(ERROR) << "ReleaseSpaceRequest failed: " + << response_or_error.Error().description(); + payload.set_error(int(response_or_error.Error().error())); } else { payload.set_space_released(response_or_error.Value()); }
diff --git a/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.h b/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.h index b046741..2b2e2d1 100644 --- a/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.h +++ b/chrome/browser/ash/dbus/vm/vm_disk_management_service_provider.h
@@ -12,6 +12,14 @@ #include "chromeos/dbus/services/cros_dbus_service.h" #include "dbus/exported_object.h" +using ExpectedGetDiskInfoResponse = borealis::Expected< + borealis::BorealisDiskManager::GetDiskInfoResponse, + borealis::Described<borealis::BorealisGetDiskInfoResult>>; + +using ExpectedRequestDeltaResponse = + borealis::Expected<uint64_t, + borealis::Described<borealis::BorealisResizeDiskResult>>; + namespace dbus { class MethodCall; } // namespace dbus @@ -49,19 +57,15 @@ dbus::ExportedObject::ResponseSender response_sender); // Callbacks for responding to certain D-Bus requests. - void OnGetDiskInfo( - std::unique_ptr<dbus::Response> response, - dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<borealis::BorealisDiskManager::GetDiskInfoResponse, - std::string> response_or_error); - void OnRequestSpace( - std::unique_ptr<dbus::Response> response, - dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<uint64_t, std::string> response_or_error); - void OnReleaseSpace( - std::unique_ptr<dbus::Response> response, - dbus::ExportedObject::ResponseSender response_sender, - borealis::Expected<uint64_t, std::string> response_or_error); + void OnGetDiskInfo(std::unique_ptr<dbus::Response> response, + dbus::ExportedObject::ResponseSender response_sender, + ExpectedGetDiskInfoResponse response_or_error); + void OnRequestSpace(std::unique_ptr<dbus::Response> response, + dbus::ExportedObject::ResponseSender response_sender, + ExpectedRequestDeltaResponse response_or_error); + void OnReleaseSpace(std::unique_ptr<dbus::Response> response, + dbus::ExportedObject::ResponseSender response_sender, + ExpectedRequestDeltaResponse response_or_error); base::WeakPtrFactory<VmDiskManagementServiceProvider> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index 9c92729..383c24f 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -632,10 +632,6 @@ // TODO(nkostylev): Fix this hack by improving Authenticator dependencies. authenticator_->SetConsumer(consumer); } - - for (auto& observer : authenticator_observer_list_) { - observer.OnAuthAttemptStarted(); - } return authenticator_; } @@ -988,16 +984,6 @@ session_state_observer_list_.RemoveObserver(observer); } -void UserSessionManager::AddUserAuthenticatorObserver( - ash::UserAuthenticatorObserver* observer) { - authenticator_observer_list_.AddObserver(observer); -} - -void UserSessionManager::RemoveUserAuthenticatorObserver( - ash::UserAuthenticatorObserver* observer) { - authenticator_observer_list_.RemoveObserver(observer); -} - void UserSessionManager::OnSessionRestoreStateChanged( Profile* user_profile, OAuth2LoginManager::SessionRestoreState state) {
diff --git a/chrome/browser/ash/login/session/user_session_manager.h b/chrome/browser/ash/login/session/user_session_manager.h index 816045d..9fdcc5b 100644 --- a/chrome/browser/ash/login/session/user_session_manager.h +++ b/chrome/browser/ash/login/session/user_session_manager.h
@@ -92,12 +92,6 @@ virtual ~UserSessionStateObserver(); }; -class UserAuthenticatorObserver : public base::CheckedObserver { - public: - // Called when authentication is started. - virtual void OnAuthAttemptStarted() {} -}; - // UserSessionManager is responsible for starting user session which includes: // * load and initialize Profile (including custom Profile preferences), // * mark user as logged in and notify observers, @@ -282,10 +276,6 @@ void AddSessionStateObserver(ash::UserSessionStateObserver* observer); void RemoveSessionStateObserver(ash::UserSessionStateObserver* observer); - void AddUserAuthenticatorObserver(ash::UserAuthenticatorObserver* observer); - void RemoveUserAuthenticatorObserver( - ash::UserAuthenticatorObserver* observer); - void ActiveUserChanged(user_manager::User* active_user) override; // Returns default IME state for user session. @@ -598,9 +588,6 @@ base::ObserverList<ash::UserSessionStateObserver>::Unchecked session_state_observer_list_; - base::ObserverList<ash::UserAuthenticatorObserver> - authenticator_observer_list_; - // Set of user_id for those users that we should restore authentication // session when notified about online state change. SigninSessionRestoreStateSet pending_signin_restore_sessions_;
diff --git a/chrome/browser/ash/web_applications/os_settings_web_app_info.cc b/chrome/browser/ash/web_applications/os_settings_web_app_info.cc index 864ec204..75b51a14 100644 --- a/chrome/browser/ash/web_applications/os_settings_web_app_info.cc +++ b/chrome/browser/ash/web_applications/os_settings_web_app_info.cc
@@ -49,7 +49,7 @@ } bool OSSettingsSystemAppDelegate::ShouldCaptureNavigations() const { - return false; + return true; } gfx::Size OSSettingsSystemAppDelegate::GetMinimumWindowSize() const {
diff --git a/chrome/browser/autofill/credit_card_accessory_controller_impl.cc b/chrome/browser/autofill/credit_card_accessory_controller_impl.cc index 305595c..a5011d68 100644 --- a/chrome/browser/autofill/credit_card_accessory_controller_impl.cc +++ b/chrome/browser/autofill/credit_card_accessory_controller_impl.cc
@@ -88,10 +88,10 @@ const CreditCard& card = data->card; UserInfo user_info(card.network()); - // TODO(crbug.com/1196021): Set the display text to be the formatted card - // number with spaces. - AddSimpleField(card.GetRawInfo(autofill::CREDIT_CARD_NUMBER), &user_info, - enabled); + std::u16string card_number = card.GetRawInfo(autofill::CREDIT_CARD_NUMBER); + user_info.add_field( + UserInfo::Field(card.FullDigitsForDisplay(), card_number, card_number, + /*id=*/std::string(), /*is_password=*/false, enabled)); AddCardDetailsToUserInfo(card, &user_info, data->cvc, enabled); return user_info;
diff --git a/chrome/browser/autofill/credit_card_accessory_controller_impl_unittest.cc b/chrome/browser/autofill/credit_card_accessory_controller_impl_unittest.cc index ce208e0e..4f43bbd 100644 --- a/chrome/browser/autofill/credit_card_accessory_controller_impl_unittest.cc +++ b/chrome/browser/autofill/credit_card_accessory_controller_impl_unittest.cc
@@ -312,19 +312,26 @@ ASSERT_TRUE(controller()); controller()->RefreshSuggestions(); + std::u16string card_number_for_display = card.FullDigitsForDisplay(); + std::u16string card_number_for_fill = + card.GetRawInfo(autofill::CREDIT_CARD_NUMBER); EXPECT_EQ(result, controller()->GetSheetData()); // Verify that the full card number and the cvc fields are added to the // accessory sheet data. - EXPECT_EQ( - result, - CreditCardAccessorySheetDataBuilder() - .AddUserInfo(kVisaCard) - .AppendSimpleField(card.GetRawInfo(autofill::CREDIT_CARD_NUMBER)) - .AppendSimpleField(card.Expiration2DigitMonthAsString()) - .AppendSimpleField(card.Expiration4DigitYearAsString()) - .AppendSimpleField(card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)) - .AppendSimpleField(cvc) - .Build()); + EXPECT_EQ(result, CreditCardAccessorySheetDataBuilder() + .AddUserInfo(kVisaCard) + .AppendField(/*display_text=*/card_number_for_display, + /*text_to_fill=*/card_number_for_fill, + /*a11y_description=*/card_number_for_fill, + /*id=*/std::string(), + /*is_obfuscated=*/false, + /*selectable=*/true) + .AppendSimpleField(card.Expiration2DigitMonthAsString()) + .AppendSimpleField(card.Expiration4DigitYearAsString()) + .AppendSimpleField( + card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)) + .AppendSimpleField(cvc) + .Build()); } TEST_F(CreditCardAccessoryControllerTest, UnmaskedCacheCardsReorderedToTheTop) { @@ -347,14 +354,21 @@ ASSERT_TRUE(controller()); controller()->RefreshSuggestions(); + std::u16string card_number_for_display = unmasked_card.FullDigitsForDisplay(); + std::u16string card_number_for_fill = + unmasked_card.GetRawInfo(autofill::CREDIT_CARD_NUMBER); EXPECT_EQ(result, controller()->GetSheetData()); // Verify that the unmasked card is at the top followed by the masked card. EXPECT_EQ( result, CreditCardAccessorySheetDataBuilder() .AddUserInfo(kVisaCard) - .AppendSimpleField( - unmasked_card.GetRawInfo(autofill::CREDIT_CARD_NUMBER)) + .AppendField(/*display_text=*/card_number_for_display, + /*text_to_fill=*/card_number_for_fill, + /*a11y_description=*/card_number_for_fill, + /*id=*/std::string(), + /*is_obfuscated=*/false, + /*selectable=*/true) .AppendSimpleField(unmasked_card.Expiration2DigitMonthAsString()) .AppendSimpleField(unmasked_card.Expiration4DigitYearAsString()) .AppendSimpleField( @@ -430,6 +444,9 @@ ASSERT_TRUE(controller()); controller()->RefreshSuggestions(); + std::u16string card_number_for_display = unmasked_card.FullDigitsForDisplay(); + std::u16string card_number_for_fill = + unmasked_card.GetRawInfo(autofill::CREDIT_CARD_NUMBER); EXPECT_EQ(result, controller()->GetSheetData()); // Verify that the unmasked virtual card is at the top followed by the masked // card. @@ -437,8 +454,12 @@ result, CreditCardAccessorySheetDataBuilder() .AddUserInfo(kVisaCard) - .AppendSimpleField( - unmasked_card.GetRawInfo(autofill::CREDIT_CARD_NUMBER)) + .AppendField(/*display_text=*/card_number_for_display, + /*text_to_fill=*/card_number_for_fill, + /*a11y_description=*/card_number_for_fill, + /*id=*/std::string(), + /*is_obfuscated=*/false, + /*selectable=*/true) .AppendSimpleField(unmasked_card.Expiration2DigitMonthAsString()) .AppendSimpleField(unmasked_card.Expiration4DigitYearAsString()) .AppendSimpleField(
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 8f25d9f0..ee9ca21 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -280,7 +280,7 @@ content::NavigationController* controller = content::Source<content::NavigationController>(source).ptr(); ++num_navigations_; - ++tab_navigation_map_[controller->GetWebContents()]; + ++tab_navigation_map_[controller->DeprecatedGetWebContents()]; if (waiting_for_navigation_ && num_navigations_to_wait_for_ == num_navigations_) { waiting_for_navigation_ = false; @@ -366,7 +366,7 @@ ASSERT_EQ(type, content::NOTIFICATION_LOAD_STOP); content::NavigationController* controller = content::Source<content::NavigationController>(source).ptr(); - WebContents* contents = controller->GetWebContents(); + WebContents* contents = controller->DeprecatedGetWebContents(); ASSERT_EQ(1u, tabs_needing_navigation_.count(contents)); ASSERT_EQ(0u, tabs_navigated_to_final_destination_.count(contents));
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 8dd7fe3..4930c38 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -353,11 +353,15 @@ #endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Initializes the primary profile, possibly doing some user prompting to pick -// a fallback profile. Returns the newly created profile, or NULL if startup -// should not continue. -Profile* CreatePrimaryProfile(const content::MainFunctionParams& parameters, - const base::FilePath& cur_dir, - const base::CommandLine& parsed_command_line) { +// a fallback profile. Returns either +// - kBrowserWindow mode with the newly created profile, +// - kProfilePicker mode indicating that the profile picker should be shown; +// the profile is a guest profile in this case, or +// - kError mode with a nullptr profile if startup should not continue. +StartupProfileInfo CreatePrimaryProfile( + const content::MainFunctionParams& parameters, + const base::FilePath& cur_dir, + const base::CommandLine& parsed_command_line) { TRACE_EVENT0("startup", "ChromeBrowserMainParts::CreateProfile"); base::Time start = base::Time::Now(); @@ -395,22 +399,23 @@ profile_list->Clear(); } - Profile* profile = nullptr; + StartupProfileInfo profile_info; #if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_ANDROID) - profile = ProfileManager::CreateInitialProfile(); + profile_info = {ProfileManager::CreateInitialProfile(), + StartupProfileMode::kBrowserWindow}; // TODO(port): fix this. See comments near the definition of |user_data_dir|. // It is better to CHECK-fail here than it is to silently exit because of // missing code in the above test. - CHECK(profile) << "Cannot get default profile."; + CHECK(profile_info.profile) << "Cannot get default profile."; #else - profile = GetStartupProfile(cur_dir, parsed_command_line); + profile_info = GetStartupProfile(cur_dir, parsed_command_line); - if (!profile && !last_used_profile_set) - profile = GetFallbackStartupProfile(); + if (profile_info.mode == StartupProfileMode::kError && !last_used_profile_set) + profile_info = GetFallbackStartupProfile(); - if (!profile) { + if (profile_info.mode == StartupProfileMode::kError) { ProfileErrorType error_type = profile_dir_specified ? ProfileErrorType::CREATE_FAILURE_SPECIFIED : ProfileErrorType::CREATE_FAILURE_ALL; @@ -419,13 +424,13 @@ // report when an error occurs? ShowProfileErrorDialog(error_type, IDS_COULDNT_STARTUP_PROFILE_ERROR, "Error creating primary profile."); - return nullptr; + return profile_info; } #endif // BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_ANDROID) UMA_HISTOGRAM_LONG_TIMES( "Startup.CreateFirstProfile", base::Time::Now() - start); - return profile; + return profile_info; } #if defined(OS_MAC) @@ -448,12 +453,14 @@ g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( command_line); - base::FilePath startup_profile_dir = + StartupProfilePathInfo startup_profile_path_info = GetStartupProfilePath(current_directory, command_line, /*ignore_profile_picker=*/false); + DCHECK_NE(startup_profile_path_info.mode, StartupProfileMode::kError); + StartupBrowserCreator::ProcessCommandLineAlreadyRunning( - command_line, current_directory, startup_profile_dir); + command_line, current_directory, startup_profile_path_info.path); // Record now as the last successful chrome start. if (ShouldRecordActiveUse(command_line)) @@ -1402,10 +1409,17 @@ // This step is costly and is already measured in Startup.CreateFirstProfile // and more directly Profile.CreateAndInitializeProfile. - profile_ = CreatePrimaryProfile(parameters(), /*cur_dir=*/base::FilePath(), - parsed_command_line()); - if (!profile_) - return content::RESULT_CODE_NORMAL_EXIT; + StartupProfileInfo profile_info = CreatePrimaryProfile( + parameters(), /*cur_dir=*/base::FilePath(), parsed_command_line()); + + switch (profile_info.mode) { + case StartupProfileMode::kBrowserWindow: + case StartupProfileMode::kProfilePicker: + profile_ = profile_info.profile; + break; + case StartupProfileMode::kError: + return content::RESULT_CODE_NORMAL_EXIT; + } #if defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) if (first_run::IsChromeFirstRun()) {
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 6197484..0fb495d 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -2933,6 +2933,8 @@ "policy/server_backed_state/server_backed_state_keys_broker.h", "policy/status_collector/activity_storage.cc", "policy/status_collector/activity_storage.h", + "policy/status_collector/affiliated_session_service.cc", + "policy/status_collector/affiliated_session_service.h", "policy/status_collector/app_info_generator.cc", "policy/status_collector/app_info_generator.h", "policy/status_collector/child_activity_storage.cc", @@ -2944,8 +2946,6 @@ "policy/status_collector/enterprise_activity_storage.cc", "policy/status_collector/enterprise_activity_storage.h", "policy/status_collector/interval_map.h", - "policy/status_collector/managed_session_service.cc", - "policy/status_collector/managed_session_service.h", "policy/status_collector/status_collector.cc", "policy/status_collector/status_collector.h", "policy/status_collector/status_collector_state.cc", @@ -4217,10 +4217,10 @@ "policy/server_backed_state/device_cloud_state_keys_uploader_unittest.cc", "policy/server_backed_state/server_backed_state_keys_broker_unittest.cc", "policy/status_collector/activity_storage_unittest.cc", + "policy/status_collector/affiliated_session_service_unittest.cc", "policy/status_collector/app_info_generator_unittest.cc", "policy/status_collector/enterprise_activity_storage_unittest.cc", "policy/status_collector/interval_map_unittest.cc", - "policy/status_collector/managed_session_service_unittest.cc", "policy/uploading/heartbeat_scheduler_unittest.cc", "policy/uploading/status_uploader_unittest.cc", "policy/uploading/system_log_uploader_unittest.cc",
diff --git a/chrome/browser/chromeos/boot_times_recorder.cc b/chrome/browser/chromeos/boot_times_recorder.cc index b59f289..c030e99 100644 --- a/chrome/browser/chromeos/boot_times_recorder.cc +++ b/chrome/browser/chromeos/boot_times_recorder.cc
@@ -60,7 +60,7 @@ static const char kBootTimes[] = "BootTimes"; RenderWidgetHost* GetRenderWidgetHost(NavigationController* tab) { - WebContents* web_contents = tab->GetWebContents(); + WebContents* web_contents = tab->DeprecatedGetWebContents(); if (web_contents) { RenderWidgetHostView* render_widget_host_view = web_contents->GetRenderWidgetHostView();
diff --git a/chrome/browser/chromeos/extensions/file_manager/system_notification_manager.cc b/chrome/browser/chromeos/extensions/file_manager/system_notification_manager.cc index 96e93f99..ee5b848a 100644 --- a/chrome/browser/chromeos/extensions/file_manager/system_notification_manager.cc +++ b/chrome/browser/chromeos/extensions/file_manager/system_notification_manager.cc
@@ -183,10 +183,15 @@ std::u16string title = l10n_util::GetStringUTF16(IDS_FILE_BROWSER_GRID_VIEW_FILES_TITLE); - GURL source_gurl(*status.source_url.get()); - std::u16string file_name = base::UTF8ToUTF16(source_gurl.ExtractFileName()); - std::u16string message = - l10n_util::GetStringFUTF16(IDS_FILE_BROWSER_COPY_FILE_NAME, file_name); + std::u16string message; + if (status.source_url) { + GURL source_gurl(*status.source_url); + message = l10n_util::GetStringFUTF16( + IDS_FILE_BROWSER_COPY_FILE_NAME, + base::UTF8ToUTF16(source_gurl.ExtractFileName())); + } else { + message = l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_ERROR_GENERIC); + } auto copy_operation = required_copy_space_.find(copy_id); switch (status.type) {
diff --git a/chrome/browser/chromeos/full_restore/OWNERS b/chrome/browser/chromeos/full_restore/OWNERS index b1c6d30c..582dabeb 100644 --- a/chrome/browser/chromeos/full_restore/OWNERS +++ b/chrome/browser/chromeos/full_restore/OWNERS
@@ -1,2 +1,3 @@ dominickn@chromium.org nancylingwang@chromium.org +per-file *arc*=sstan@chromium.org
diff --git a/chrome/browser/chromeos/full_restore/app_launch_handler.cc b/chrome/browser/chromeos/full_restore/app_launch_handler.cc index 5dbe0f8..6fd75f2 100644 --- a/chrome/browser/chromeos/full_restore/app_launch_handler.cc +++ b/chrome/browser/chromeos/full_restore/app_launch_handler.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/apps/app_service/browser_app_launcher.h" #include "chrome/browser/profiles/profile.h" #include "components/full_restore/full_restore_read_handler.h" +#include "components/services/app_service/public/cpp/types_util.h" #include "extensions/common/constants.h" namespace chromeos { @@ -86,13 +87,18 @@ } void AppLaunchHandler::OnAppUpdate(const apps::AppUpdate& update) { - // If the restore data has not been read yet, or the app is not ready, don't - // launch the app for the restoration. - if (!restore_data_ || !update.ReadinessChanged() || - update.Readiness() != apps::mojom::Readiness::kReady) { + if (!restore_data_ || !update.ReadinessChanged()) + return; + + if (!apps_util::IsInstalled(update.Readiness())) { + restore_data_->RemoveApp(update.AppId()); return; } + // If the app is not ready, don't launch the app for the restoration. + if (update.Readiness() != apps::mojom::Readiness::kReady) + return; + // If there is no restore data or the launch list for the app is empty, don't // launch the app. const auto& app_id_to_launch_list = restore_data_->app_id_to_launch_list();
diff --git a/chrome/browser/chromeos/full_restore/arc_app_launch_handler.cc b/chrome/browser/chromeos/full_restore/arc_app_launch_handler.cc index fad6214..3a78fca 100644 --- a/chrome/browser/chromeos/full_restore/arc_app_launch_handler.cc +++ b/chrome/browser/chromeos/full_restore/arc_app_launch_handler.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/arc/arc_util.h" +#include "chrome/browser/chromeos/full_restore/arc_window_handler.h" #include "chrome/browser/chromeos/full_restore/arc_window_utils.h" #include "chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.h" #include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h" @@ -24,40 +25,49 @@ namespace chromeos { namespace full_restore { -ArcAppLaunchHandler::ArcAppLaunchHandler(FullRestoreAppLaunchHandler* handler) - : handler_(handler), - cache_(apps::AppServiceProxyFactory::GetForProfile(handler_->profile_) - ->AppRegistryCache()) { +ArcAppLaunchHandler::ArcAppLaunchHandler() = default; +ArcAppLaunchHandler::~ArcAppLaunchHandler() = default; + +void ArcAppLaunchHandler::RestoreArcApps( + FullRestoreAppLaunchHandler* app_launch_handler) { + handler_ = app_launch_handler; + + window_handler_ = FullRestoreArcTaskHandler::GetForProfile(handler_->profile_) + ->window_handler(); + + LoadRestoreData(); + + if (windows_.empty() && no_stack_windows_.empty()) + return; + + DCHECK(apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile( + handler_->profile_)); + + apps::AppRegistryCache& cache = + apps::AppServiceProxyFactory::GetForProfile(handler_->profile_) + ->AppRegistryCache(); + // Observe AppRegistryCache to get the notification when the app is ready. - Observe(&cache_); + if (!app_registry_cache_observer_.IsObserving()) + app_registry_cache_observer_.Observe(&cache); - chromeos::ResourcedClient* client = chromeos::ResourcedClient::Get(); - if (client) - client->AddObserver(this); -} - -ArcAppLaunchHandler::~ArcAppLaunchHandler() { - chromeos::ResourcedClient* client = chromeos::ResourcedClient::Get(); - if (client) - client->RemoveObserver(this); -} - -void ArcAppLaunchHandler::RestoreApp(const std::string& app_id) { - bool is_ready = false; - cache_.ForOneApp(app_id, [&is_ready](const apps::AppUpdate& update) { - if (update.Readiness() == apps::mojom::Readiness::kReady) - is_ready = true; + // Add the app to `app_ids` if there is a launch list from the restore data + // for the app. + std::set<std::string> app_ids; + cache.ForEachApp([&app_ids, this](const apps::AppUpdate& update) { + if (update.Readiness() == apps::mojom::Readiness::kReady && + app_ids_.find(update.AppId()) != app_ids_.end()) { + app_ids.insert(update.AppId()); + } }); - if (is_ready) - LaunchApp(app_id); - else - app_ids_.insert(app_id); + for (const auto& app_id : app_ids) + PrepareAppLaunching(app_id); } void ArcAppLaunchHandler::OnAppUpdate(const apps::AppUpdate& update) { if (base::Contains(app_ids_, update.AppId())) - LaunchApp(update.AppId()); + PrepareAppLaunching(update.AppId()); } void ArcAppLaunchHandler::OnAppRegistryCacheWillBeDestroyed( @@ -65,7 +75,37 @@ apps::AppRegistryCache::Observer::Observe(nullptr); } -void ArcAppLaunchHandler::LaunchApp(const std::string& app_id) { +void ArcAppLaunchHandler::OnAppConnectionReady() { + if (chromeos::ResourcedClient::Get() && + !resourced_client_observer_.IsObserving()) { + resourced_client_observer_.Observe(chromeos::ResourcedClient::Get()); + } +} + +void ArcAppLaunchHandler::LoadRestoreData() { + apps::AppRegistryCache& cache = + apps::AppServiceProxyFactory::GetForProfile(handler_->profile_) + ->AppRegistryCache(); + + for (const auto& it : handler_->restore_data_->app_id_to_launch_list()) { + if (cache.GetAppType(it.first) != apps::mojom::AppType::kArc) + continue; + + app_ids_.insert(it.first); + for (const auto& data_it : it.second) { + if (data_it.second->activation_index.has_value()) { + windows_[data_it.second->activation_index.value()] = + std::make_pair(it.first, data_it.first); + } else { + no_stack_windows_.insert(std::make_pair(it.first, data_it.first)); + } + } + } +} + +void ArcAppLaunchHandler::PrepareAppLaunching(const std::string& app_id) { + app_ids_.erase(app_id); + const auto it = handler_->restore_data_->app_id_to_launch_list().find(app_id); if (it == handler_->restore_data_->app_id_to_launch_list().end()) return; @@ -80,13 +120,13 @@ auto* arc_handler = FullRestoreArcTaskHandler::GetForProfile(handler_->profile_); - for (const auto& data_id : it->second) { + for (const auto& data_it : it->second) { handler_->RecordRestoredAppLaunch(apps::AppTypeName::kArc); - DCHECK(data_id.second->event_flag.has_value()); + DCHECK(data_it.second->event_flag.has_value()); apps::mojom::WindowInfoPtr window_info = - HandleArcWindowInfo(data_id.second->GetAppWindowInfo()); + HandleArcWindowInfo(data_it.second->GetAppWindowInfo()); // Set an ARC session id to find the restore window id based on the new // created ARC task id in FullRestoreReadHandler. @@ -95,7 +135,7 @@ ->GetArcSessionId(); window_info->window_id = arc_session_id; ::full_restore::FullRestoreReadHandler::GetInstance() - ->SetArcSessionIdForWindowId(arc_session_id, data_id.first); + ->SetArcSessionIdForWindowId(arc_session_id, data_it.first); bool launch_ghost_window = false; #if BUILDFLAG(ENABLE_WAYLAND_SERVER) @@ -103,7 +143,7 @@ arc_handler->window_handler()) { handler_->RecordArcGhostWindowLaunch(/*is_arc_ghost_window=*/true); arc_handler->window_handler()->LaunchArcGhostWindow( - app_id, arc_session_id, data_id.second.get()); + app_id, arc_session_id, data_it.second.get()); launch_ghost_window = true; } else { handler_->RecordArcGhostWindowLaunch(/*is_arc_ghost_window=*/false); @@ -113,13 +153,13 @@ if (launch_ghost_window) continue; - if (data_id.second->intent.has_value()) { - proxy->LaunchAppWithIntent(app_id, data_id.second->event_flag.value(), - std::move(data_id.second->intent.value()), + if (data_it.second->intent.has_value()) { + proxy->LaunchAppWithIntent(app_id, data_it.second->event_flag.value(), + std::move(data_it.second->intent.value()), apps::mojom::LaunchSource::kFromFullRestore, std::move(window_info)); } else { - proxy->Launch(app_id, data_id.second->event_flag.value(), + proxy->Launch(app_id, data_it.second->event_flag.value(), apps::mojom::LaunchSource::kFromFullRestore, std::move(window_info)); }
diff --git a/chrome/browser/chromeos/full_restore/arc_app_launch_handler.h b/chrome/browser/chromeos/full_restore/arc_app_launch_handler.h index a64aa960..663a17e7 100644 --- a/chrome/browser/chromeos/full_restore/arc_app_launch_handler.h +++ b/chrome/browser/chromeos/full_restore/arc_app_launch_handler.h
@@ -8,6 +8,7 @@ #include <set> #include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" #include "chromeos/dbus/resourced/resourced_client.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" @@ -18,6 +19,7 @@ namespace chromeos { namespace full_restore { +class ArcWindowHandler; class FullRestoreAppLaunchHandler; // The ArcAppLaunchHandler class restores ARC apps during the system startup @@ -30,38 +32,63 @@ class ArcAppLaunchHandler : public apps::AppRegistryCache::Observer, public chromeos::ResourcedClient::Observer { public: - explicit ArcAppLaunchHandler(FullRestoreAppLaunchHandler* handler); + ArcAppLaunchHandler(); ArcAppLaunchHandler(const ArcAppLaunchHandler&) = delete; ArcAppLaunchHandler& operator=(const ArcAppLaunchHandler&) = delete; ~ArcAppLaunchHandler() override; - // Checks whether the app of `app_id` is ready. If yes, launch the app. - // Otherwise, add `app_id` to |app_ids|. - void RestoreApp(const std::string& app_id); + // Invoked when the restoration process can start. Reads the restore data, and + // add the ARC apps windows to `windows_` and `no_stack_windows_`. + void RestoreArcApps(FullRestoreAppLaunchHandler* app_launch_handler); // apps::AppRegistryCache::Observer: void OnAppUpdate(const apps::AppUpdate& update) override; void OnAppRegistryCacheWillBeDestroyed( apps::AppRegistryCache* cache) override; - protected: + void OnAppConnectionReady(); + + private: + // Reads the restore data, and add the ARC app windows to `windows_`, + // `no_stack_windows_` and `app_ids_`. + void LoadRestoreData(); + + // Creates the ghost windows or displays the icon with an overlaid spinner to + // provide visual feedback that the app cannot be launched immediately (due to + // ARC not being ready, or the system perforamcne concern) on Chrome OS. + void PrepareAppLaunching(const std::string& app_id); + // Override chromeos::ResourcedClient::Observer void OnMemoryPressure(chromeos::ResourcedClient::PressureLevel level, uint64_t reclaim_target_kb) override; - private: - void LaunchApp(const std::string& app_id); - FullRestoreAppLaunchHandler* handler_ = nullptr; - // If the ARC app is not ready, add it to `app_ids`. When the ARC app is - // ready, and can be restored, launch the app, and remove it from `app_ids`. + // The app id list to be restored. When the ARC app is ready in + // AppRegistryCache, launch the ghost window or spin the icon and remove it + // from `app_ids`. std::set<std::string> app_ids_; - apps::AppRegistryCache& cache_; + // The map from the window stack to the app id and the window id. This map is + // used to save the windows to be restored. + std::map<int32_t, std::pair<std::string, int32_t>> windows_; + + // ARC app windows without the window stack info. This set is used to save the + // windows to be restored. + std::set<std::pair<std::string, int32_t>> no_stack_windows_; + + ArcWindowHandler* window_handler_ = nullptr; chromeos::ResourcedClient::PressureLevel pressure_level_; + base::ScopedObservation<apps::AppRegistryCache, + apps::AppRegistryCache::Observer> + app_registry_cache_observer_{this}; + + base::ScopedObservation<chromeos::ResourcedClient, + chromeos::ResourcedClient::Observer> + resourced_client_observer_{this}; + base::WeakPtrFactory<ArcAppLaunchHandler> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.cc b/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.cc index 3c1e431..41fca11 100644 --- a/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.cc +++ b/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.cc
@@ -146,8 +146,11 @@ should_launch_browser_ = false; } - if (arc::IsArcAllowedForProfile(profile_)) - arc_app_launch_handler_ = std::make_unique<ArcAppLaunchHandler>(this); + if (FullRestoreArcTaskHandler::GetForProfile(profile_)) { + FullRestoreArcTaskHandler::GetForProfile(profile_) + ->arc_app_launch_handler() + ->RestoreArcApps(this); + } LaunchApps(); } @@ -178,8 +181,8 @@ void FullRestoreAppLaunchHandler::LaunchArcApp( const std::string& app_id, const ::full_restore::RestoreData::LaunchList& launch_list) { - if (arc_app_launch_handler_) - arc_app_launch_handler_->RestoreApp(app_id); + // TODO(crbug.com/1146900): Remove this function, because the implementation + // has been moved to ArcAppLaunchHandler. } void FullRestoreAppLaunchHandler::RecordRestoredAppLaunch(
diff --git a/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.h b/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.h index 5cc467d..3f61b3d 100644 --- a/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.h +++ b/chrome/browser/chromeos/full_restore/full_restore_app_launch_handler.h
@@ -22,8 +22,6 @@ namespace chromeos { namespace full_restore { -class ArcAppLaunchHandler; - // The FullRestoreAppLaunchHandler class calls FullRestoreReadHandler to read // the full restore data from the full restore data file on a background task // runner, and restore apps and web pages based on the user preference or the @@ -82,8 +80,6 @@ void RecordRestoredAppLaunch(apps::AppTypeName app_type_name) override; void RecordArcGhostWindowLaunch(bool is_arc_ghost_window) override; - std::unique_ptr<ArcAppLaunchHandler> arc_app_launch_handler_; - bool should_restore_ = false; bool should_launch_browser_ = false;
diff --git a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.cc b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.cc index f1189999..eb1b59f 100644 --- a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.cc +++ b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h" +#include "chrome/browser/chromeos/full_restore/arc_app_launch_handler.h" +#include "chrome/browser/chromeos/full_restore/arc_window_handler.h" #include "chrome/browser/chromeos/full_restore/arc_window_utils.h" #include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.h" #include "chrome/browser/profiles/profile.h" @@ -29,6 +31,8 @@ if (IsArcGhostWindowEnabled()) window_handler_ = std::make_unique<ArcWindowHandler>(); #endif + + arc_app_launch_handler_ = std::make_unique<ArcAppLaunchHandler>(); } FullRestoreArcTaskHandler::~FullRestoreArcTaskHandler() = default; @@ -61,6 +65,9 @@ if (window_handler_) window_handler_->OnAppInstanceConnected(); #endif + + if (arc_app_launch_handler_) + arc_app_launch_handler_->OnAppConnectionReady(); } } // namespace full_restore
diff --git a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h index 324deac..94e3dc6 100644 --- a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h +++ b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h
@@ -8,7 +8,6 @@ #include <utility> #include "base/scoped_observation.h" -#include "chrome/browser/chromeos/full_restore/arc_window_handler.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/common/buildflags.h" #include "components/keyed_service/core/keyed_service.h" @@ -18,6 +17,9 @@ namespace chromeos { namespace full_restore { +class ArcAppLaunchHandler; +class ArcWindowHandler; + // The FullRestoreArcTaskHandler class observes ArcAppListPrefs, and calls // FullRestoreSaveHandler to update the ARC app launch info when a task is // created or destroyed. @@ -40,6 +42,10 @@ ArcWindowHandler* window_handler() { return window_handler_.get(); } #endif + ArcAppLaunchHandler* arc_app_launch_handler() { + return arc_app_launch_handler_.get(); + } + // ArcAppListPrefs::Observer. void OnTaskCreated(int32_t task_id, const std::string& package_name, @@ -61,6 +67,8 @@ #if BUILDFLAG(ENABLE_WAYLAND_SERVER) std::unique_ptr<ArcWindowHandler> window_handler_; #endif + + std::unique_ptr<ArcAppLaunchHandler> arc_app_launch_handler_; }; } // namespace full_restore
diff --git a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.cc b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.cc index 3d53017..69994d081 100644 --- a/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.cc +++ b/chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler_factory.h" +#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h" #include "chrome/browser/profiles/profile.h" @@ -33,6 +34,7 @@ "FullRestoreArcTaskHandler", BrowserContextDependencyManager::GetInstance()) { DependsOn(ArcAppListPrefsFactory::GetInstance()); + DependsOn(apps::AppServiceProxyFactory::GetInstance()); } KeyedService* FullRestoreArcTaskHandlerFactory::BuildServiceInstanceFor(
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc index 83257b3e..97e2d6f 100644 --- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc +++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc
@@ -77,9 +77,7 @@ } void CRDHostDelegate::StartCRDHostAndGetCode( - const std::string& oauth_token, - const std::string& user_name, - bool terminate_upon_input, + const SessionParameters& parameters, DeviceCommandStartCRDSessionJob::AccessCodeCallback success_callback, DeviceCommandStartCRDSessionJob::ErrorCallback error_callback) { DCHECK(!host_); @@ -89,13 +87,18 @@ // Store all parameters for future connect call. base::Value connect_params(base::Value::Type::DICTIONARY); - connect_params.SetKey(remoting::kUserName, base::Value(user_name)); - connect_params.SetKey(remoting::kAuthServiceWithToken, - base::Value("oauth2:" + oauth_token)); - connect_params.SetKey(remoting::kSuppressUserDialogs, base::Value(true)); - connect_params.SetKey(remoting::kSuppressNotifications, base::Value(true)); - connect_params.SetKey(remoting::kTerminateUponInput, - base::Value(terminate_upon_input)); + connect_params.SetStringKey(remoting::kUserName, parameters.user_name); + connect_params.SetStringKey(remoting::kAuthServiceWithToken, + "oauth2:" + parameters.oauth_token); + connect_params.SetBoolKey(remoting::kTerminateUponInput, + parameters.terminate_upon_input); + // Note both |kSuppressUserDialogs| and |kSuppressNotifications| are + // controlled by |show_confirmation_dialog|. + connect_params.SetBoolKey(remoting::kSuppressUserDialogs, + !parameters.show_confirmation_dialog); + connect_params.SetBoolKey(remoting::kSuppressNotifications, + !parameters.show_confirmation_dialog); + connect_params_ = std::move(connect_params); remote_connected_ = false;
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.h b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.h index 07e20b91..be72b826 100644 --- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.h +++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.h
@@ -39,9 +39,7 @@ bool HasActiveSession() const override; void TerminateSession(base::OnceClosure callback) override; void StartCRDHostAndGetCode( - const std::string& oauth_token, - const std::string& user_name, - bool terminate_upon_input, + const SessionParameters& parameters, DeviceCommandStartCRDSessionJob::AccessCodeCallback success_callback, DeviceCommandStartCRDSessionJob::ErrorCallback error_callback) override;
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc index 4433f50a..7b45e03 100644 --- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc +++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc
@@ -24,6 +24,7 @@ namespace { using ::testing::HasSubstr; +using SessionParameters = CRDHostDelegate::SessionParameters; std::string FindStringKey(const base::Value& dictionary, const std::string& key) { @@ -34,15 +35,19 @@ return base::StringPrintf("Key '%s' not found", key.c_str()); } -#define EXPECT_STRING_KEY(dictionary, key, value) \ - EXPECT_EQ(FindStringKey(dictionary, key), value) \ - << "Wrong value for key '" << key << "'"; +#define EXPECT_STRING_KEY(dictionary, key, value) \ + ({ \ + EXPECT_EQ(FindStringKey(dictionary, key), value) \ + << "Wrong value for key '" << key << "'"; \ + }) -#define EXPECT_BOOL_KEY(dictionary, key, value) \ - absl::optional<bool> value_maybe = dictionary.FindBoolKey(key); \ - EXPECT_TRUE(value_maybe.has_value()) << "Missing key '" << key << "'"; \ - EXPECT_EQ(value_maybe.value_or(false), value) \ - << "Wrong value for key '" << key << "'"; +#define EXPECT_BOOL_KEY(dictionary, key, value) \ + ({ \ + absl::optional<bool> value_maybe = dictionary.FindBoolKey(key); \ + EXPECT_TRUE(value_maybe.has_value()) << "Missing key '" << key << "'"; \ + EXPECT_EQ(value_maybe.value_or(false), value) \ + << "Wrong value for key '" << key << "'"; \ + }) #define EXPECT_TYPE(dictionary, value) \ EXPECT_STRING_KEY(dictionary, remoting::kMessageType, value) @@ -283,11 +288,11 @@ CRDHostDelegateTest& operator=(const CRDHostDelegateTest&) = delete; ~CRDHostDelegateTest() override = default; - void StartCRDHostAndGetCode(const std::string& auth_token = "auth-token", - bool terminate_upon_input = false) { - delegate().StartCRDHostAndGetCode( - auth_token, "robot-account-user-name", terminate_upon_input, - response_.GetSuccessCallback(), response_.GetErrorCallback()); + void StartCRDHostAndGetCode( + const SessionParameters& parameters = SessionParameters()) { + delegate().StartCRDHostAndGetCode(parameters, + response_.GetSuccessCallback(), + response_.GetErrorCallback()); } // Helper object representing the response, which is either the access code @@ -357,17 +362,90 @@ } TEST_F(CRDHostDelegateTest, ShouldSendConnectMessageOnHelloResponse) { - StartCRDHostAndGetCode(/*auth_token=*/"the-auth-token", - /*terminate_upon_input=*/true); + StartCRDHostAndGetCode(); + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + host().WaitForMessageOfType(remoting::kConnectMessage); +} + +TEST_F(CRDHostDelegateTest, ShouldSendAuthTokenInConnectMessage) { + SessionParameters parameters; + parameters.oauth_token = "the-oauth-token"; + StartCRDHostAndGetCode(parameters); + host().WaitForHello(); host().PostMessageOfType("helloResponse"); base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); EXPECT_STRING_KEY(response, remoting::kAuthServiceWithToken, - "oauth2:the-auth-token"); + "oauth2:the-oauth-token"); +} + +TEST_F(CRDHostDelegateTest, ShouldSendUserNameInConnectMessage) { + SessionParameters parameters; + parameters.user_name = "the-user-name"; + StartCRDHostAndGetCode(parameters); + + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); + EXPECT_STRING_KEY(response, remoting::kUserName, "the-user-name"); +} + +TEST_F(CRDHostDelegateTest, ShouldSendTerminateUponInputTrueInConnectMessage) { + SessionParameters parameters; + parameters.terminate_upon_input = true; + StartCRDHostAndGetCode(parameters); + + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); EXPECT_BOOL_KEY(response, remoting::kTerminateUponInput, true); } +TEST_F(CRDHostDelegateTest, ShouldSendTerminateUponInputFalseInConnectMessage) { + SessionParameters parameters; + parameters.terminate_upon_input = false; + StartCRDHostAndGetCode(parameters); + + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); + EXPECT_BOOL_KEY(response, remoting::kTerminateUponInput, false); +} + +TEST_F(CRDHostDelegateTest, + ShouldSendShowConfirmationDialogTrueInConnectMessage) { + SessionParameters parameters; + parameters.show_confirmation_dialog = true; + StartCRDHostAndGetCode(parameters); + + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); + EXPECT_BOOL_KEY(response, remoting::kSuppressNotifications, false); + EXPECT_BOOL_KEY(response, remoting::kSuppressUserDialogs, false); +} + +TEST_F(CRDHostDelegateTest, + ShouldSendShowConfirmationDialogFalseInConnectMessage) { + SessionParameters parameters; + parameters.show_confirmation_dialog = false; + StartCRDHostAndGetCode(parameters); + + host().WaitForHello(); + host().PostMessageOfType("helloResponse"); + + base::Value response = host().WaitForMessageOfType(remoting::kConnectMessage); + EXPECT_BOOL_KEY(response, remoting::kSuppressNotifications, true); + EXPECT_BOOL_KEY(response, remoting::kSuppressUserDialogs, true); +} + TEST_F(CRDHostDelegateTest, ShouldSendAccessCodeToCallback) { StartCRDHostAndGetCode(); host().HandleHandshake();
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc index 677771e..8f99edce 100644 --- a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc +++ b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc
@@ -400,8 +400,13 @@ void DeviceCommandStartCRDSessionJob::OnOAuthTokenReceived( const std::string& token) { CRD_DVLOG(1) << "Received OAuth token, now retrieving CRD access code"; + Delegate::SessionParameters parameters{ + /*oauth_token=*/token, + /*user_name=*/GetRobotAccountUserName(), + /*terminate_upon_input=*/terminate_upon_input_, + /*show_confirmation_dialog=*/ShouldShowConfirmationDialog()}; delegate_->StartCRDHostAndGetCode( - token, GetRobotAccountUserName(), terminate_upon_input_, + parameters, base::BindOnce(&DeviceCommandStartCRDSessionJob::OnAccessCodeReceived, weak_factory_.GetWeakPtr()), base::BindOnce(&DeviceCommandStartCRDSessionJob::FinishWithError, @@ -428,6 +433,21 @@ return account_id.ToString(); } +bool DeviceCommandStartCRDSessionJob::ShouldShowConfirmationDialog() const { + switch (GetUserType()) { + case UserType::kAffiliatedUser: + case UserType::kManagedGuestSession: + return true; + case UserType::kAutoLaunchedKiosk: + case UserType::kNoUser: + case UserType::kNonAutoLaunchedKiosk: + case UserType::kOther: + return false; + } + NOTREACHED(); + return false; +} + DeviceOAuth2TokenService* DeviceCommandStartCRDSessionJob::oauth_service() const { return DeviceOAuth2TokenServiceFactory::Get();
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h index 9de587a..6550c13 100644 --- a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h +++ b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.h
@@ -52,6 +52,14 @@ // Delegate that will start a session with the CRD native host. class Delegate { public: + // Session parameters used to start the CRD host. + struct SessionParameters { + std::string oauth_token = ""; + std::string user_name = ""; + bool terminate_upon_input = false; + bool show_confirmation_dialog = false; + }; + virtual ~Delegate() = default; // Check if there exists an active CRD session. @@ -61,9 +69,7 @@ virtual void TerminateSession(base::OnceClosure callback) = 0; // Attempts to start CRD host and get Auth Code. - virtual void StartCRDHostAndGetCode(const std::string& oauth_token, - const std::string& user_name, - bool terminate_upon_input, + virtual void StartCRDHostAndGetCode(const SessionParameters& parameters, AccessCodeCallback success_callback, ErrorCallback error_callback) = 0; }; @@ -119,6 +125,8 @@ std::string GetRobotAccountUserName() const; + bool ShouldShowConfirmationDialog() const; + DeviceOAuth2TokenService* oauth_service() const; std::unique_ptr<OAuthTokenFetcher> oauth_token_fetcher_;
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_unittest.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_unittest.cc index e094310..f4e8bf71 100644 --- a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_unittest.cc +++ b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_unittest.cc
@@ -107,13 +107,18 @@ // Returns if TerminateSession() was called to terminate the active session. bool IsActiveSessionTerminated() const { return terminate_session_called_; } + // Returns the |SessionParameters| sent to the last StartCRDHostAndGetCode() + // call. + SessionParameters session_parameters() { + EXPECT_TRUE(received_session_parameters_.has_value()); + return received_session_parameters_.value_or(SessionParameters{}); + } + // DeviceCommandStartCRDSessionJob::Delegate implementation: bool HasActiveSession() const override; void TerminateSession(base::OnceClosure callback) override; void StartCRDHostAndGetCode( - const std::string& oauth_token, - const std::string& user_name, - bool terminate_upon_input, + const SessionParameters& parameters, DeviceCommandStartCRDSessionJob::AccessCodeCallback success_callback, DeviceCommandStartCRDSessionJob::ErrorCallback error_callback) override; @@ -121,6 +126,7 @@ bool has_active_session_ = false; bool access_code_success_ = true; bool terminate_session_called_ = false; + absl::optional<SessionParameters> received_session_parameters_; }; bool StubCRDHostDelegate::HasActiveSession() const { @@ -134,11 +140,11 @@ } void StubCRDHostDelegate::StartCRDHostAndGetCode( - const std::string& oauth_token, - const std::string& user_name, - bool terminate_upon_input, + const SessionParameters& parameters, DeviceCommandStartCRDSessionJob::AccessCodeCallback success_callback, DeviceCommandStartCRDSessionJob::ErrorCallback error_callback) { + received_session_parameters_ = parameters; + if (access_code_success_) { std::move(success_callback).Run(kTestAccessCode); } else { @@ -261,6 +267,14 @@ void SetOAuthToken(std::string value) { oauth_token_ = value; } + void SetTerminateUponInput(bool value) { terminate_upon_input_ = value; } + + void SetRobotAccountUserName(const std::string& user_name) { + DeviceOAuth2TokenService* token_service = + DeviceOAuth2TokenServiceFactory::Get(); + token_service->set_robot_account_id_for_testing(CoreAccountId(user_name)); + } + void ClearOAuthToken() { oauth_token_ = absl::nullopt; } void DeleteUserActivityDetector() { user_activity_detector_ = nullptr; } @@ -277,7 +291,7 @@ job().Init(base::TimeTicks::Now(), GenerateCommandProto( kUniqueID, base::TimeTicks::Now() - test_start_time_, - idleness_cutoff_, /*terminate_upon_input=*/false), + idleness_cutoff_, terminate_upon_input_), nullptr); if (oauth_token_) @@ -312,6 +326,7 @@ absl::optional<std::string> oauth_token_; base::TimeDelta idleness_cutoff_ = base::TimeDelta::FromSeconds(30); + bool terminate_upon_input_ = false; // Automatically installed as a singleton upon creation. std::unique_ptr<ui::UserActivityDetector> user_activity_detector_; @@ -590,6 +605,71 @@ EXPECT_ERROR(result, DeviceCommandStartCRDSessionJob::FAILURE_CRD_HOST_ERROR); } +TEST_F(DeviceCommandStartCRDSessionJobTest, ShouldPassOAuthTokenToDelegate) { + LogInAsAutoLaunchedKioskAppUser(); + SetOAuthToken("the-oauth-token"); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ("the-oauth-token", + crd_host_delegate().session_parameters().oauth_token); +} + +TEST_F(DeviceCommandStartCRDSessionJobTest, + ShouldPassRobotAccountNameToDelegate) { + LogInAsAutoLaunchedKioskAppUser(); + SetOAuthToken(kTestOAuthToken); + + SetRobotAccountUserName("robot-account"); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ("robot-account", + crd_host_delegate().session_parameters().user_name); +} + +TEST_F(DeviceCommandStartCRDSessionJobTest, + ShouldPassTerminateUponInputTrueToDelegate) { + LogInAsAutoLaunchedKioskAppUser(); + SetOAuthToken(kTestOAuthToken); + + SetTerminateUponInput(true); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ(true, + crd_host_delegate().session_parameters().terminate_upon_input); +} + +TEST_F(DeviceCommandStartCRDSessionJobTest, + ShouldPassTerminateUponInputFalseToDelegate) { + LogInAsAutoLaunchedKioskAppUser(); + SetOAuthToken(kTestOAuthToken); + + SetTerminateUponInput(false); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ(false, + crd_host_delegate().session_parameters().terminate_upon_input); +} + +TEST_F(DeviceCommandStartCRDSessionJobTest, + ShouldPassShowConfirmationDialogFalseToDelegateForKioskUsers) { + LogInAsAutoLaunchedKioskAppUser(); + SetOAuthToken(kTestOAuthToken); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ(false, + crd_host_delegate().session_parameters().show_confirmation_dialog); +} + // This test fixture enables the |kCRDForManagedUserSessions| feature flag, // and tests the additional functionality enabled by the flag. class DeviceCommandStartCRDSessionJobWithCRDForUserSessionsFeatureTest @@ -672,4 +752,28 @@ EXPECT_SUCCESS(result); } +TEST_F(DeviceCommandStartCRDSessionJobWithCRDForUserSessionsFeatureTest, + ShouldPassShowConfirmationDialogTrueToDelegateForManagedGuestUser) { + LogInAsManagedGuestSessionUser(); + SetOAuthToken(kTestOAuthToken); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ(true, + crd_host_delegate().session_parameters().show_confirmation_dialog); +} + +TEST_F(DeviceCommandStartCRDSessionJobWithCRDForUserSessionsFeatureTest, + ShouldPassShowConfirmationDialogTrueToDelegateForAffiliatedUser) { + LogInAsAffiliatedUser(); + SetOAuthToken(kTestOAuthToken); + + Result result = RunJobAndWaitForResult(); + EXPECT_SUCCESS(result); + + EXPECT_EQ(true, + crd_host_delegate().session_parameters().show_confirmation_dialog); +} + } // namespace policy
diff --git a/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.cc b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.cc new file mode 100644 index 0000000..5162988d --- /dev/null +++ b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.cc
@@ -0,0 +1,104 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h" + +#include "base/logging.h" +#include "chrome/browser/ash/profiles/profile_helper.h" + +namespace policy { + +namespace { + +constexpr base::TimeDelta kMinimumSuspendDuration = + base::TimeDelta::FromMinutes(1); + +bool IsPrimaryAndAffiliated(Profile* profile) { + user_manager::User* user = + chromeos::ProfileHelper::Get()->GetUserByProfile(profile); + bool is_primary = chromeos::ProfileHelper::Get()->IsPrimaryProfile(profile); + bool is_affiliated = user && user->IsAffiliated(); + if (!is_primary || !is_affiliated) { + VLOG(1) << "The profile for the primary user is not associated with an " + "affiliated user."; + } + return is_primary && is_affiliated; +} + +} // namespace + +AffiliatedSessionService::AffiliatedSessionService(base::Clock* clock) + : clock_(clock), session_manager_(session_manager::SessionManager::Get()) { + if (session_manager_) { + // To alleviate tight coupling in unit tests to DeviceStatusCollector. + session_manager_observation_.Observe(session_manager_); + is_session_locked_ = session_manager_->IsScreenLocked(); + } + power_manager_observation_.Observe(chromeos::PowerManagerClient::Get()); +} + +AffiliatedSessionService::~AffiliatedSessionService() = default; + +void AffiliatedSessionService::AddObserver( + AffiliatedSessionService::Observer* observer) { + observers_.AddObserver(observer); +} + +void AffiliatedSessionService::RemoveObserver( + AffiliatedSessionService::Observer* observer) { + observers_.RemoveObserver(observer); +} + +void AffiliatedSessionService::OnSessionStateChanged() { + bool is_session_locked = session_manager_->IsScreenLocked(); + if (is_session_locked_ == is_session_locked) { + return; + } + is_session_locked_ = is_session_locked; + + if (is_session_locked_) { + for (auto& observer : observers_) { + observer.OnLocked(); + } + } else { + for (auto& observer : observers_) { + observer.OnUnlocked(); + } + } +} + +void AffiliatedSessionService::OnUserProfileLoaded( + const AccountId& account_id) { + Profile* profile = + chromeos::ProfileHelper::Get()->GetProfileByAccountId(account_id); + if (!IsPrimaryAndAffiliated(profile)) { + return; + } + profile_observations_.AddObservation(profile); + for (auto& observer : observers_) { + observer.OnAffiliatedLogin(profile); + } +} + +void AffiliatedSessionService::OnProfileWillBeDestroyed(Profile* profile) { + is_session_locked_ = false; + if (!IsPrimaryAndAffiliated(profile)) { + return; + } + for (auto& observer : observers_) { + observer.OnAffiliatedLogout(profile); + } + profile_observations_.RemoveObservation(profile); +} + +void AffiliatedSessionService::SuspendDone(base::TimeDelta sleep_duration) { + if (sleep_duration < kMinimumSuspendDuration) { + return; + } + for (auto& observer : observers_) { + observer.OnResumeActive(clock_->Now() - sleep_duration); + } +} + +} // namespace policy
diff --git a/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h new file mode 100644 index 0000000..ca2b1b2 --- /dev/null +++ b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h
@@ -0,0 +1,88 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_AFFILIATED_SESSION_SERVICE_H_ +#define CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_AFFILIATED_SESSION_SERVICE_H_ + +#include "base/observer_list.h" +#include "base/observer_list_types.h" +#include "base/scoped_multi_source_observation.h" +#include "base/scoped_observation.h" +#include "base/time/clock.h" +#include "base/time/default_clock.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_observer.h" +#include "chromeos/dbus/power/power_manager_client.h" +#include "components/account_id/account_id.h" +#include "components/session_manager/core/session_manager.h" +#include "components/session_manager/core/session_manager_observer.h" + +namespace policy { + +class AffiliatedSessionService : public session_manager::SessionManagerObserver, + public ProfileObserver, + public chromeos::PowerManagerClient::Observer { + public: + class Observer : public base::CheckedObserver { + public: + // Occurs when an affiliated primary user has logged in. + virtual void OnAffiliatedLogin(Profile* profile) {} + + // Occurs when an affiliated primary user has logged out. + virtual void OnAffiliatedLogout(Profile* profile) {} + + // Occurs when the active user has locked the user session. + virtual void OnLocked() {} + + // Occurs when the active user has unlocked the user session. + virtual void OnUnlocked() {} + + // Occurs when the device recovers from a suspend state, where + // |suspend_time| is the time when the suspend state + // first occurred. Short duration suspends are not reported. + virtual void OnResumeActive(base::Time suspend_time) {} + }; + + explicit AffiliatedSessionService( + base::Clock* clock = base::DefaultClock::GetInstance()); + AffiliatedSessionService(const AffiliatedSessionService&) = delete; + AffiliatedSessionService& operator=(const AffiliatedSessionService&) = delete; + ~AffiliatedSessionService() override; + + void AddObserver(Observer* observer); + + void RemoveObserver(Observer* observer); + + // session_manager::SessionManagerObserver::Observer + void OnSessionStateChanged() override; + void OnUserProfileLoaded(const AccountId& account_id) override; + + // ProfileObserver + void OnProfileWillBeDestroyed(Profile* profile) override; + + // chromeos::PowerManagerClient::Observer + void SuspendDone(base::TimeDelta sleep_duration) override; + + private: + bool is_session_locked_; + + base::Clock* clock_; + + base::ObserverList<Observer> observers_; + + session_manager::SessionManager* const session_manager_; + + base::ScopedMultiSourceObservation<Profile, ProfileObserver> + profile_observations_{this}; + base::ScopedObservation<session_manager::SessionManager, + session_manager::SessionManagerObserver> + session_manager_observation_{this}; + base::ScopedObservation<chromeos::PowerManagerClient, + chromeos::PowerManagerClient::Observer> + power_manager_observation_{this}; +}; + +} // namespace policy + +#endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_AFFILIATED_SESSION_SERVICE_H_
diff --git a/chrome/browser/chromeos/policy/status_collector/managed_session_service_unittest.cc b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service_unittest.cc similarity index 73% rename from chrome/browser/chromeos/policy/status_collector/managed_session_service_unittest.cc rename to chrome/browser/chromeos/policy/status_collector/affiliated_session_service_unittest.cc index da195126..cffd115 100644 --- a/chrome/browser/chromeos/policy/status_collector/managed_session_service_unittest.cc +++ b/chrome/browser/chromeos/policy/status_collector/affiliated_session_service_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/policy/status_collector/managed_session_service.h" +#include "chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h" #include "base/test/simple_test_clock.h" #include "chrome/browser/ash/login/users/chrome_user_manager.h" @@ -17,9 +17,9 @@ namespace policy { -class ManagedSessionServiceTest +class AffiliatedSessionServiceTest : public ::testing::Test, - public policy::ManagedSessionService::Observer { + public policy::AffiliatedSessionService::Observer { protected: using SessionState = session_manager::SessionState; @@ -30,12 +30,12 @@ user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>( std::move(user_manager)); - managed_session_service_ = - std::make_unique<ManagedSessionService>(&test_clock_); + affiliated_session_service_ = + std::make_unique<AffiliatedSessionService>(&test_clock_); } void TearDown() override { - managed_session_service_.reset(); + affiliated_session_service_.reset(); chromeos::PowerManagerClient::Shutdown(); } @@ -54,8 +54,8 @@ return profile; } - ManagedSessionService* managed_session_service() { - return managed_session_service_.get(); + AffiliatedSessionService* affiliated_session_service() { + return affiliated_session_service_.get(); } session_manager::SessionManager* session_manager() { @@ -68,19 +68,14 @@ base::SimpleTestClock* test_clock() { return &test_clock_; } - void OnLoginFailure(const chromeos::AuthFailure& error) override { - auth_failure_ = error; - } - void OnLogin(Profile* profile) override { logged_in_ = profile; } - void OnLogout(Profile* profile) override { logged_out_ = profile; } + void OnAffiliatedLogin(Profile* profile) override { logged_in_ = profile; } + void OnAffiliatedLogout(Profile* profile) override { logged_out_ = profile; } void OnLocked() override { locked_ = true; } void OnUnlocked() override { unlocked_ = true; } void OnResumeActive(base::Time time) override { suspend_time_ = std::make_unique<base::Time>(time); } - chromeos::AuthFailure auth_failure_ = - chromeos::AuthFailure::AuthFailureNone(); Profile* logged_in_ = nullptr; Profile* logged_out_ = nullptr; bool locked_ = false; @@ -97,11 +92,11 @@ base::SimpleTestClock test_clock_; - std::unique_ptr<ManagedSessionService> managed_session_service_; + std::unique_ptr<AffiliatedSessionService> affiliated_session_service_; }; -TEST_F(ManagedSessionServiceTest, OnSessionStateChanged) { - managed_session_service()->AddObserver(this); +TEST_F(AffiliatedSessionServiceTest, OnSessionStateChanged) { + affiliated_session_service()->AddObserver(this); session_manager()->SetSessionState(SessionState::LOCKED); session_manager()->SetSessionState(SessionState::ACTIVE); @@ -134,49 +129,49 @@ EXPECT_TRUE(unlocked_); } -TEST_F(ManagedSessionServiceTest, OnUserProfileLoadedAffiliatedAndPrimary) { +TEST_F(AffiliatedSessionServiceTest, OnUserProfileLoadedAffiliatedAndPrimary) { AccountId affiliated_account_id = AccountId::FromUserEmail("user0@managed.com"); std::unique_ptr<TestingProfile> affiliated_profile = CreateProfile( affiliated_account_id, true /* affiliated */, true /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(affiliated_account_id); EXPECT_TRUE(affiliated_profile->IsSameOrParent(logged_in_)); } -TEST_F(ManagedSessionServiceTest, OnUserProfileLoadedAffiliated) { +TEST_F(AffiliatedSessionServiceTest, OnUserProfileLoadedAffiliated) { AccountId secondary_account_id = AccountId::FromUserEmail("user3@managed.com"); std::unique_ptr<TestingProfile> secondary_profile = CreateProfile( secondary_account_id, true /* affiliated */, false /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(secondary_account_id); - EXPECT_TRUE(secondary_profile->IsSameOrParent(logged_in_)); + EXPECT_EQ(logged_in_, nullptr); } -TEST_F(ManagedSessionServiceTest, OnUserProfileLoadedPrimary) { +TEST_F(AffiliatedSessionServiceTest, OnUserProfileLoadedPrimary) { AccountId unaffiliated_account_id = AccountId::FromUserEmail("user2@managed.com"); std::unique_ptr<TestingProfile> unaffiliated_profile = CreateProfile( unaffiliated_account_id, false /* affiliated */, true /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(unaffiliated_account_id); - EXPECT_TRUE(unaffiliated_profile->IsSameOrParent(logged_in_)); + EXPECT_EQ(logged_in_, nullptr); } -TEST_F(ManagedSessionServiceTest, +TEST_F(AffiliatedSessionServiceTest, OnProfileWillBeDestroyedAffiliatedAndPrimary) { AccountId affiliated_account_id = AccountId::FromUserEmail("user0@managed.com"); std::unique_ptr<TestingProfile> affiliated_profile = CreateProfile( affiliated_account_id, true /* affiliated */, true /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(affiliated_account_id); affiliated_profile->MaybeSendDestroyedNotification(); @@ -184,34 +179,34 @@ EXPECT_TRUE(affiliated_profile->IsSameOrParent(logged_out_)); } -TEST_F(ManagedSessionServiceTest, OnProfileWillBeDestroyedAffiliated) { +TEST_F(AffiliatedSessionServiceTest, OnProfileWillBeDestroyedAffiliated) { AccountId secondary_account_id = AccountId::FromUserEmail("user3@managed.com"); std::unique_ptr<TestingProfile> secondary_profile = CreateProfile( secondary_account_id, true /* affiliated */, false /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(secondary_account_id); secondary_profile->MaybeSendDestroyedNotification(); - EXPECT_TRUE(secondary_profile->IsSameOrParent(logged_in_)); + EXPECT_EQ(logged_out_, nullptr); } -TEST_F(ManagedSessionServiceTest, OnProfileWillBeDestroyedPrimary) { +TEST_F(AffiliatedSessionServiceTest, OnProfileWillBeDestroyedPrimary) { AccountId unaffiliated_account_id = AccountId::FromUserEmail("user2@managed.com"); std::unique_ptr<TestingProfile> unaffiliated_profile = CreateProfile( unaffiliated_account_id, false /* affiliated */, true /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); session_manager()->NotifyUserProfileLoaded(unaffiliated_account_id); unaffiliated_profile->MaybeSendDestroyedNotification(); - EXPECT_TRUE(unaffiliated_profile->IsSameOrParent(logged_in_)); + EXPECT_EQ(logged_out_, nullptr); } -TEST_F(ManagedSessionServiceTest, SuspendDone) { - managed_session_service()->AddObserver(this); +TEST_F(AffiliatedSessionServiceTest, SuspendDone) { + affiliated_session_service()->AddObserver(this); test_clock()->SetNow(base::Time::Now()); base::TimeDelta sleep_duration = base::TimeDelta::FromHours(2); @@ -220,13 +215,13 @@ EXPECT_EQ(*suspend_time_, test_clock()->Now() - sleep_duration); } -TEST_F(ManagedSessionServiceTest, RemoveObserver) { +TEST_F(AffiliatedSessionServiceTest, RemoveObserver) { AccountId account_id = AccountId::FromUserEmail("user0@managed.com"); std::unique_ptr<TestingProfile> profile = CreateProfile(account_id, true /* affiliated */, true /* login */); - managed_session_service()->AddObserver(this); + affiliated_session_service()->AddObserver(this); - managed_session_service()->RemoveObserver(this); + affiliated_session_service()->RemoveObserver(this); session_manager()->SetSessionState(SessionState::LOCKED); session_manager()->SetSessionState(SessionState::ACTIVE); @@ -241,14 +236,4 @@ EXPECT_FALSE(profile->IsSameOrParent(logged_out_)); } -TEST_F(ManagedSessionServiceTest, LoginFailure) { - managed_session_service()->AddObserver(this); - - managed_session_service()->OnAuthFailure(chromeos::AuthFailure( - chromeos::AuthFailure::FailureReason::OWNER_REQUIRED)); - - EXPECT_EQ(auth_failure_.reason(), - chromeos::AuthFailure::FailureReason::OWNER_REQUIRED); -} - } // namespace policy
diff --git a/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc b/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc index 0bacacc3..ae71d95 100644 --- a/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc +++ b/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/chromeos/policy/status_collector/app_info_generator.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" -#include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" #include "chrome/browser/web_applications/web_app_registrar.h" @@ -20,18 +19,6 @@ namespace { -bool IsPrimaryAndAffiliated(Profile* profile) { - user_manager::User* user = - chromeos::ProfileHelper::Get()->GetUserByProfile(profile); - bool is_primary = chromeos::ProfileHelper::Get()->IsPrimaryProfile(profile); - bool is_affiliated = user && user->IsAffiliated(); - if (!is_primary || !is_affiliated) { - VLOG(1) << "The profile for the primary user is not associated with an " - "affiliated user."; - } - return is_primary && is_affiliated; -} - em::AppInfo::Status ExtractStatus(const apps::mojom::Readiness readiness) { switch (readiness) { case apps::mojom::Readiness::kReady: @@ -90,15 +77,10 @@ AppInfoGenerator::AppInfoProvider::~AppInfoProvider() = default; AppInfoGenerator::AppInfoGenerator( - ManagedSessionService* managed_session_service, base::TimeDelta max_stored_past_activity_interval, base::Clock* clock) : max_stored_past_activity_interval_(max_stored_past_activity_interval), - clock_(*clock) { - if (managed_session_service) { - managed_session_observation_.Observe(managed_session_service); - } -} + clock_(*clock) {} AppInfoGenerator::AppInstances::AppInstances(const base::Time start_time_) : start_time(start_time_) {} @@ -170,11 +152,7 @@ SetIdleDurationsToOpen(); } -void AppInfoGenerator::OnLogin(Profile* profile) { - if (!IsPrimaryAndAffiliated(profile)) { - return; - } - +void AppInfoGenerator::OnAffiliatedLogin(Profile* profile) { if (!apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile)) { VLOG(1) << "No apps available. Will not track usage."; return; @@ -189,11 +167,7 @@ } } -void AppInfoGenerator::OnLogout(Profile* profile) { - if (!IsPrimaryAndAffiliated(profile)) { - return; - } - +void AppInfoGenerator::OnAffiliatedLogout(Profile* profile) { if (provider_) { if (should_report_) { provider_->app_service_proxy.InstanceRegistry().RemoveObserver(this);
diff --git a/chrome/browser/chromeos/policy/status_collector/app_info_generator.h b/chrome/browser/chromeos/policy/status_collector/app_info_generator.h index 89d0b601..c315a1b 100644 --- a/chrome/browser/chromeos/policy/status_collector/app_info_generator.h +++ b/chrome/browser/chromeos/policy/status_collector/app_info_generator.h
@@ -13,7 +13,7 @@ #include "base/time/default_clock.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/chromeos/policy/status_collector/activity_storage.h" -#include "chrome/browser/chromeos/policy/status_collector/managed_session_service.h" +#include "chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "components/prefs/pref_registry_simple.h" #include "components/services/app_service/public/cpp/instance.h" @@ -30,12 +30,11 @@ // A class that is responsible for collecting application inventory and usage // information. class AppInfoGenerator : public apps::InstanceRegistry::Observer, - public ManagedSessionService::Observer { + public AffiliatedSessionService::Observer { public: using Result = absl::optional<std::vector<enterprise_management::AppInfo>>; explicit AppInfoGenerator( - ManagedSessionService* managed_session_service, base::TimeDelta max_stored_past_activity_interval, base::Clock* clock = base::DefaultClock::GetInstance()); AppInfoGenerator(const AppInfoGenerator&) = delete; @@ -60,9 +59,9 @@ // up until the current time, so it may be reported. void OnWillReport(); - // ManagedSessionService::Observer - void OnLogin(Profile* profile) override; - void OnLogout(Profile* profile) override; + // AffiliatedSessionManager::Observer + void OnAffiliatedLogin(Profile* profile) override; + void OnAffiliatedLogout(Profile* profile) override; void OnLocked() override; void OnUnlocked() override; void OnResumeActive(base::Time suspend_time) override; @@ -123,10 +122,6 @@ base::TimeDelta max_stored_past_activity_interval_; const base::Clock& clock_; - - base::ScopedObservation<ManagedSessionService, - ManagedSessionService::Observer> - managed_session_observation_{this}; }; } // namespace policy
diff --git a/chrome/browser/chromeos/policy/status_collector/app_info_generator_unittest.cc b/chrome/browser/chromeos/policy/status_collector/app_info_generator_unittest.cc index cb504b0e..5b646ea 100644 --- a/chrome/browser/chromeos/policy/status_collector/app_info_generator_unittest.cc +++ b/chrome/browser/chromeos/policy/status_collector/app_info_generator_unittest.cc
@@ -166,24 +166,11 @@ GetInstanceRegistry().OnInstances(deltas); } - std::unique_ptr<TestingProfile> CreateProfile(const AccountId& account_id, - bool is_affiliated = true) { - TestingProfile::Builder profile_builder; - profile_builder.SetProfileName(account_id.GetUserEmail()); - auto profile = profile_builder.Build(); - user_manager_->AddUserWithAffiliationAndTypeAndProfile( - account_id, is_affiliated, user_manager::UserType::USER_TYPE_REGULAR, - profile.get()); - return profile; - } - void SetUp() override { auto user_manager = std::make_unique<ash::FakeChromeUserManager>(); - user_manager_ = user_manager.get(); user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>( std::move(user_manager)); - account_id_ = AccountId::FromUserEmail("affiliated@managed.com"); - profile_ = CreateProfile(account_id_); + profile_ = std::make_unique<TestingProfile>(); test_clock().SetNow(MakeLocalTime("25-MAR-2020 1:30am")); web_app::WebAppProviderFactory::GetInstance()->SetTestingFactoryAndUse( @@ -219,13 +206,13 @@ std::unique_ptr<AppInfoGenerator> GetGenerator( base::TimeDelta max_stored_past_activity_interval = base::TimeDelta::FromDays(0)) { - return std::make_unique<AppInfoGenerator>( - nullptr, max_stored_past_activity_interval, &test_clock()); + return std::make_unique<AppInfoGenerator>(max_stored_past_activity_interval, + &test_clock()); } std::unique_ptr<AppInfoGenerator> GetReadyGenerator() { auto generator = GetGenerator(); - generator->OnLogin(profile()); + generator->OnAffiliatedLogin(profile()); generator->OnReportingChanged(true); return generator; } @@ -252,10 +239,6 @@ Profile* profile() { return profile_.get(); } - ash::FakeChromeUserManager* user_manager() { return user_manager_; } - - AccountId account_id() { return account_id_; } - static auto EqActivity(const base::Time& start_time, const base::Time& end_time) { return AllOf( @@ -282,10 +265,8 @@ apps::ScopedOmitPluginVmAppsForTesting scoped_omit_plugin_vm_apps_for_testing_; content::BrowserTaskEnvironment task_environment_; - AccountId account_id_; std::unique_ptr<TestingProfile> profile_; web_app::WebAppRegistrarMutable* app_registrar_; - ash::FakeChromeUserManager* user_manager_; std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_; TestingPrefServiceSimple pref_service_; @@ -302,7 +283,6 @@ PushApp("c", "ThirdApp", apps::mojom::Readiness::kUninstalledByUser, "", apps::mojom::AppType::kCrostini); - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); auto result = generator->Generate(); @@ -317,7 +297,6 @@ } TEST_F(AppInfoGeneratorTest, GenerateWebApp) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("c", "App", apps::mojom::Readiness::kUninstalledByUser, "", apps::mojom::AppType::kWeb); @@ -342,7 +321,6 @@ } TEST_F(AppInfoGeneratorTest, MultipleInstances) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -369,54 +347,18 @@ } TEST_F(AppInfoGeneratorTest, ShouldNotReport) { - user_manager()->LoginUser(account_id(), true); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); auto generator = GetGenerator(); generator->OnReportingChanged(false); - generator->OnLogin(profile()); - auto result = generator->Generate(); - - EXPECT_FALSE(result.has_value()); -} - -TEST_F(AppInfoGeneratorTest, UnaffiliatedUser) { - auto unaffiliated_account_id = - AccountId::FromUserEmail("unaffiliated@unmanaged.com"); - auto unaffiliated_profile = - CreateProfile(unaffiliated_account_id, /* is_affiliated= */ false); - user_manager()->LoginUser(unaffiliated_account_id, true); - PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", - apps::mojom::AppType::kArc); - - auto generator = GetGenerator(); - generator->OnReportingChanged(true); - generator->OnLogin(unaffiliated_profile.get()); - auto result = generator->Generate(); - - EXPECT_FALSE(result.has_value()); -} - -TEST_F(AppInfoGeneratorTest, SecondaryUser) { - user_manager()->LoginUser(account_id(), true); - auto secondary_account_id = AccountId::FromUserEmail("secondary@managed.com"); - auto secondary_profile = - CreateProfile(secondary_account_id, /* is_affiliated= */ true); - user_manager()->LoginUser(secondary_account_id, true); - PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", - apps::mojom::AppType::kArc); - - auto generator = GetGenerator(); - generator->OnReportingChanged(true); - generator->OnLogin(secondary_profile.get()); + generator->OnAffiliatedLogin(profile()); auto result = generator->Generate(); EXPECT_FALSE(result.has_value()); } TEST_F(AppInfoGeneratorTest, OnReportedSuccessfully) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -446,7 +388,6 @@ } TEST_F(AppInfoGeneratorTest, OnWillReport) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -485,13 +426,12 @@ } TEST_F(AppInfoGeneratorTest, OnLogoutOnLogin) { - user_manager()->LoginUser(account_id(), true); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); auto generator = GetGenerator(); generator->OnReportingChanged(true); - generator->OnLogin(profile()); - generator->OnLogout(profile()); + generator->OnAffiliatedLogin(profile()); + generator->OnAffiliatedLogout(profile()); Instance app_instance("a"); test_clock().SetNow(MakeLocalTime("29-MAR-2020 1:30pm")); PushAppInstance(app_instance, apps::InstanceState::kStarted); @@ -503,7 +443,7 @@ EXPECT_FALSE(result.has_value()); - generator->OnLogin(profile()); + generator->OnAffiliatedLogin(profile()); test_clock().SetNow(MakeLocalTime("30-MAR-2020 2:30pm")); PushAppInstance(app_instance, apps::InstanceState::kStarted); @@ -522,7 +462,6 @@ } TEST_F(AppInfoGeneratorTest, OnLocked) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -545,7 +484,6 @@ } TEST_F(AppInfoGeneratorTest, OnUnlocked) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -574,7 +512,6 @@ } TEST_F(AppInfoGeneratorTest, OnResumeActive) { - user_manager()->LoginUser(account_id(), true); auto generator = GetReadyGenerator(); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); @@ -603,7 +540,6 @@ } TEST_F(AppInfoGeneratorTest, OnLoginRemoveOldUsage) { - user_manager()->LoginUser(account_id(), true); PushApp("a", "FirstApp", apps::mojom::Readiness::kDisabledByPolicy, "1.1", apps::mojom::AppType::kArc); PushApp("b", "SecondApp", apps::mojom::Readiness::kReady, "1.2", @@ -612,7 +548,7 @@ 1); // Exclude all past usage except for UTC today and yesterday. auto generator = GetGenerator(max_days_past); generator->OnReportingChanged(true); - generator->OnLogin(profile()); + generator->OnAffiliatedLogin(profile()); Instance app_instance1("a"); test_clock().SetNow(MakeLocalTime("28-MAR-2020 1:30am")); @@ -625,9 +561,9 @@ test_clock().SetNow(MakeLocalTime("29-MAR-2020 3:30am")); PushAppInstance(app_instance2, apps::InstanceState::kDestroyed); - generator->OnLogout(profile()); + generator->OnAffiliatedLogout(profile()); test_clock().SetNow(MakeLocalTime("30-MAR-2020 11:00am")); - generator->OnLogin(profile()); + generator->OnAffiliatedLogin(profile()); auto result = generator->Generate();
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc index 3d8f2a4..127983a4 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
@@ -1443,9 +1443,7 @@ graphics_status_fetcher_(graphics_status_fetcher), crash_report_info_fetcher_(crash_report_info_fetcher), power_manager_(chromeos::PowerManagerClient::Get()), - app_info_generator_(&managed_session_service_, - kMaxStoredPastActivityInterval, - clock_) { + app_info_generator_(kMaxStoredPastActivityInterval, clock_) { // protected fields of `StatusCollector`. max_stored_past_activity_interval_ = kMaxStoredPastActivityInterval; max_stored_future_activity_interval_ = kMaxStoredFutureActivityInterval; @@ -1549,7 +1547,8 @@ stats_reporting_pref_subscription_ = cros_settings_->AddSettingsObserver( chromeos::kStatsReportingPref, callback); - // TODO(b/191986061):: consider using ScopedObservation instead. + affiliated_session_service_.AddObserver(&app_info_generator_); + power_manager_->AddObserver(this); // Fetch the current values of the policies. @@ -1604,6 +1603,7 @@ DeviceStatusCollector::~DeviceStatusCollector() { power_manager_->RemoveObserver(this); + affiliated_session_service_.RemoveObserver(&app_info_generator_); } // static
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h index 7816073..b64d0cd7 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
@@ -211,8 +211,8 @@ static void RegisterPrefs(PrefRegistrySimple* registry); - ManagedSessionService* GetManagedSessionServiceForTesting() { - return &managed_session_service_; + AffiliatedSessionService* GetAffiliatedSessionServiceForTesting() { + return &affiliated_session_service_; } // How often to poll to see if the user is idle. @@ -480,7 +480,7 @@ base::CallbackListSubscription app_info_subscription_; base::CallbackListSubscription stats_reporting_pref_subscription_; - ManagedSessionService managed_session_service_; + AffiliatedSessionService affiliated_session_service_; AppInfoGenerator app_info_generator_;
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc index a8e183d8..4704e9e 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
@@ -947,7 +947,7 @@ options->crash_report_info_fetcher = base::BindRepeating(&GetEmptyCrashReportInfo); options->app_info_generator = std::make_unique<policy::AppInfoGenerator>( - nullptr, base::TimeDelta::FromDays(0)); + base::TimeDelta::FromDays(0)); return options; } @@ -3608,8 +3608,8 @@ MockRegularUserWithAffiliation(account_id, true); scoped_testing_cros_settings_.device_settings()->SetBoolean( chromeos::kReportDeviceAppInfo, true); - status_collector_->GetManagedSessionServiceForTesting()->OnUserProfileLoaded( - account_id); + status_collector_->GetAffiliatedSessionServiceForTesting() + ->OnUserProfileLoaded(account_id); auto* app_proxy = apps::AppServiceProxyFactory::GetForProfile(testing_profile_.get()); auto app1 = apps::mojom::App::New();
diff --git a/chrome/browser/chromeos/policy/status_collector/managed_session_service.cc b/chrome/browser/chromeos/policy/status_collector/managed_session_service.cc deleted file mode 100644 index 35184f3..0000000 --- a/chrome/browser/chromeos/policy/status_collector/managed_session_service.cc +++ /dev/null
@@ -1,110 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/policy/status_collector/managed_session_service.h" - -#include "base/logging.h" -#include "chrome/browser/ash/login/existing_user_controller.h" -#include "chrome/browser/ash/profiles/profile_helper.h" -#include "components/user_manager/user_manager.h" - -namespace policy { - -namespace { - -constexpr base::TimeDelta kMinimumSuspendDuration = - base::TimeDelta::FromMinutes(1); - -} // namespace - -ManagedSessionService::ManagedSessionService(base::Clock* clock) - : clock_(clock), session_manager_(session_manager::SessionManager::Get()) { - if (session_manager_) { - // To alleviate tight coupling in unit tests to DeviceStatusCollector. - session_manager_observation_.Observe(session_manager_); - is_session_locked_ = session_manager_->IsScreenLocked(); - } - if (user_manager::UserManager::IsInitialized()) { - authenticator_observation_.Observe(ash::UserSessionManager::GetInstance()); - } - power_manager_observation_.Observe(chromeos::PowerManagerClient::Get()); -} - -ManagedSessionService::~ManagedSessionService() { - if (ash::ExistingUserController::current_controller()) { - ash::ExistingUserController::current_controller() - ->RemoveLoginStatusConsumer(this); - } -} - -void ManagedSessionService::AddObserver( - ManagedSessionService::Observer* observer) { - observers_.AddObserver(observer); -} - -void ManagedSessionService::RemoveObserver( - ManagedSessionService::Observer* observer) { - observers_.RemoveObserver(observer); -} - -void ManagedSessionService::OnSessionStateChanged() { - bool is_session_locked = session_manager_->IsScreenLocked(); - if (is_session_locked_ == is_session_locked) { - return; - } - is_session_locked_ = is_session_locked; - - if (is_session_locked_) { - for (auto& observer : observers_) { - observer.OnLocked(); - } - } else { - for (auto& observer : observers_) { - observer.OnUnlocked(); - } - } -} - -void ManagedSessionService::OnUserProfileLoaded(const AccountId& account_id) { - Profile* profile = - chromeos::ProfileHelper::Get()->GetProfileByAccountId(account_id); - profile_observations_.AddObservation(profile); - for (auto& observer : observers_) { - observer.OnLogin(profile); - } -} - -void ManagedSessionService::OnProfileWillBeDestroyed(Profile* profile) { - is_session_locked_ = false; - for (auto& observer : observers_) { - observer.OnLogout(profile); - } - profile_observations_.RemoveObservation(profile); -} - -void ManagedSessionService::SuspendDone(base::TimeDelta sleep_duration) { - if (sleep_duration < kMinimumSuspendDuration) { - return; - } - for (auto& observer : observers_) { - observer.OnResumeActive(clock_->Now() - sleep_duration); - } -} - -void ManagedSessionService::OnAuthAttemptStarted() { - if (ash::ExistingUserController::current_controller()) { - ash::ExistingUserController::current_controller() - ->RemoveLoginStatusConsumer(this); - ash::ExistingUserController::current_controller()->AddLoginStatusConsumer( - this); - } -} - -void ManagedSessionService::OnAuthFailure(const chromeos::AuthFailure& error) { - for (auto& observer : observers_) { - observer.OnLoginFailure(error); - } -} - -} // namespace policy
diff --git a/chrome/browser/chromeos/policy/status_collector/managed_session_service.h b/chrome/browser/chromeos/policy/status_collector/managed_session_service.h deleted file mode 100644 index 52f6d4bb..0000000 --- a/chrome/browser/chromeos/policy/status_collector/managed_session_service.h +++ /dev/null
@@ -1,107 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_MANAGED_SESSION_SERVICE_H_ -#define CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_MANAGED_SESSION_SERVICE_H_ - -#include "base/observer_list.h" -#include "base/observer_list_types.h" -#include "base/scoped_multi_source_observation.h" -#include "base/scoped_observation.h" -#include "base/time/clock.h" -#include "base/time/default_clock.h" -#include "chrome/browser/ash/login/session/user_session_manager.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_observer.h" -#include "chromeos/dbus/power/power_manager_client.h" -#include "chromeos/login/auth/auth_status_consumer.h" -#include "components/account_id/account_id.h" -#include "components/session_manager/core/session_manager.h" -#include "components/session_manager/core/session_manager_observer.h" - -namespace policy { - -class ManagedSessionService : public session_manager::SessionManagerObserver, - public ProfileObserver, - public chromeos::PowerManagerClient::Observer, - public chromeos::AuthStatusConsumer, - public ash::UserAuthenticatorObserver { - public: - class Observer : public base::CheckedObserver { - public: - // Occurs when a user's login attempt fails. - virtual void OnLoginFailure(const chromeos::AuthFailure& error) {} - - // Occurs when a user has logged in. - virtual void OnLogin(Profile* profile) {} - - // Occurs when a user has logged out. - virtual void OnLogout(Profile* profile) {} - - // Occurs when the active user has locked the user session. - virtual void OnLocked() {} - - // Occurs when the active user has unlocked the user session. - virtual void OnUnlocked() {} - - // Occurs when the device recovers from a suspend state, where - // |suspend_time| is the time when the suspend state - // first occurred. Short duration suspends are not reported. - virtual void OnResumeActive(base::Time suspend_time) {} - }; - - explicit ManagedSessionService( - base::Clock* clock = base::DefaultClock::GetInstance()); - ManagedSessionService(const ManagedSessionService&) = delete; - ManagedSessionService& operator=(const ManagedSessionService&) = delete; - ~ManagedSessionService() override; - - void AddObserver(Observer* observer); - - void RemoveObserver(Observer* observer); - - // session_manager::SessionManagerObserver::Observer - void OnSessionStateChanged() override; - void OnUserProfileLoaded(const AccountId& account_id) override; - - // ProfileObserver - void OnProfileWillBeDestroyed(Profile* profile) override; - - // chromeos::PowerManagerClient::Observer - void SuspendDone(base::TimeDelta sleep_duration) override; - - void OnAuthSuccess(const ash::UserContext& user_context) override {} - - void OnAuthFailure(const chromeos::AuthFailure& error) override; - - void OnAuthAttemptStarted() override; - - private: - bool is_session_locked_; - - base::Clock* clock_; - - base::ObserverList<Observer> observers_; - - session_manager::SessionManager* const session_manager_; - - base::ScopedMultiSourceObservation<Profile, ProfileObserver> - profile_observations_{this}; - base::ScopedObservation<session_manager::SessionManager, - session_manager::SessionManagerObserver> - session_manager_observation_{this}; - base::ScopedObservation<chromeos::PowerManagerClient, - chromeos::PowerManagerClient::Observer> - power_manager_observation_{this}; - base::ScopedObservation< - ash::UserSessionManager, - ash::UserAuthenticatorObserver, - &ash::UserSessionManager::AddUserAuthenticatorObserver, - &ash::UserSessionManager::RemoveUserAuthenticatorObserver> - authenticator_observation_{this}; -}; - -} // namespace policy - -#endif // CHROME_BROWSER_CHROMEOS_POLICY_STATUS_COLLECTOR_MANAGED_SESSION_SERVICE_H_
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml b/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml index 3e6972e..72e636c4 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml +++ b/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml
@@ -25,9 +25,6 @@ android:layout_marginEnd="20dp" android:layout_marginBottom="20dp" android:background="@drawable/note_background_outline" - android:autoSizeTextType="uniform" - android:autoSizeMinTextSize="@dimen/min_text_size" - android:autoSizeMaxTextSize="@dimen/max_text_size" android:ellipsize="end" android:importantForAccessibility="no"/>
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/values/dimens.xml b/chrome/browser/content_creation/notes/internal/android/java/res/values/dimens.xml index cf7c409..c890b9a 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/res/values/dimens.xml +++ b/chrome/browser/content_creation/notes/internal/android/java/res/values/dimens.xml
@@ -7,8 +7,7 @@ <dimen name="note_width">280dp</dimen> <dimen name="note_side_padding">20dp</dimen> - <dimen name="max_text_size">26sp</dimen> - <dimen name="min_text_size">14sp</dimen> - <dimen name="note_corner_radius">12dp</dimen> + + <dimen name="focused_note_elevation">12dp</dimen> </resources>
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java index 1d2a061..098bce9 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java
@@ -35,7 +35,7 @@ * Dialog for the note creation. */ public class NoteCreationDialog extends DialogFragment { - private static final float FIRST_NOTE_PADDING_RATIO = 0.5f; + private static final float EXTREMITY_NOTE_PADDING_RATIO = 0.5f; private View mContentView; private String mUrlDomain; @@ -105,11 +105,13 @@ int first_visible = layoutManager.findFirstCompletelyVisibleItemPosition(); int last_visible = layoutManager.findLastCompletelyVisibleItemPosition(); + unFocus(mSelectedItemIndex); mSelectedItemIndex = (last_visible - first_visible) / 2 + first_visible; ((TextView) mContentView.findViewById(R.id.title)) .setText(carouselItems.get(mSelectedItemIndex) .model.get(NoteProperties.TEMPLATE) .localizedName); + focus(mSelectedItemIndex); } }); } @@ -161,24 +163,38 @@ template.footerStyle.apply(footerLink, footerTitle, footerIcon); - setLeftPadding(model.get(NoteProperties.IS_FIRST), parent.findViewById(R.id.item)); + setPadding(model.get(NoteProperties.IS_FIRST), model.get(NoteProperties.IS_LAST), + parent.findViewById(R.id.item)); } - // Adjust the left padding for carousel items, so that the first item is centered and the - // following item is slightlight peaking from the right. For that, set left padding exactly - // what is needed to push the first item to the center, but set a smaller padding for the - // following items. - private void setLeftPadding(boolean isFirst, View itemView) { + // Adjust the padding for carousel items so that: + // - When the first item is selected, it is centered and the following item is slightly peaking + // from the right. + // - When the last item is selected, it is cenetered and the previous item is + // slightly peaking from the left. + // For that, set left padding exactly what is needed to push the first item to the center, but + // set a smaller padding for the following items (except the last item which has more padding on + // the right). + private void setPadding(boolean isFirst, boolean isLast, View itemView) { int dialogWidth = mContentView.getWidth(); int templateWidth = getActivity().getResources().getDimensionPixelSize(R.dimen.note_width); - int paddingLeft = + int defaultPadding = getActivity().getResources().getDimensionPixelSize(R.dimen.note_side_padding); + int paddingLeft = defaultPadding; if (isFirst) { - paddingLeft = (int) ((dialogWidth - templateWidth) * FIRST_NOTE_PADDING_RATIO + 0.5f); + paddingLeft = + (int) ((dialogWidth - templateWidth) * EXTREMITY_NOTE_PADDING_RATIO + 0.5f); + } + + int paddingRight = defaultPadding; + if (isLast) { + paddingRight = + (int) ((dialogWidth - templateWidth) * EXTREMITY_NOTE_PADDING_RATIO + 0.5f); } MarginLayoutParams params = (MarginLayoutParams) itemView.getLayoutParams(); params.setMarginStart(paddingLeft); + params.setMarginEnd(paddingRight); itemView.setLayoutParams(params); itemView.requestLayout(); } @@ -195,4 +211,15 @@ private float getNoteCornerRadius() { return getActivity().getResources().getDimensionPixelSize(R.dimen.note_corner_radius); } + + private void focus(int index) { + View noteView = getNoteViewAt(index); + noteView.setElevation( + getActivity().getResources().getDimension(R.dimen.focused_note_elevation)); + } + + private void unFocus(int index) { + View noteView = getNoteViewAt(index); + noteView.setElevation(0); + } } \ No newline at end of file
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationMediator.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationMediator.java index 2a0c915..e161134 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationMediator.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationMediator.java
@@ -105,27 +105,34 @@ assert Looper.getMainLooper() == Looper.myLooper(); // Only add a template to the ModelList when a Typeface has successfully been loaded for it. + int index = 0; for (RequestTuple tuple : requestTuples) { TypefaceResponse response = getOrDefault(resultsMap, tuple.typefaceRequest, null); if (response == null) { // TODO (crbug.com/1194168): Log this case. + ++index; continue; } if (response.isError()) { // TODO (crbug.com/1194168): Log this case. + ++index; continue; } ListItem listItem = new ListItem(NoteProperties.NOTE_VIEW_TYPE, - buildModel(mListModel.size() == 0, tuple.template, response.typeface)); + buildModel(index == 0, index == (requestTuples.size() - 1), tuple.template, + response.typeface)); mListModel.add(listItem); + ++index; } } - private PropertyModel buildModel(boolean isFirst, NoteTemplate template, Typeface typeface) { + private PropertyModel buildModel( + boolean isFirst, boolean isLast, NoteTemplate template, Typeface typeface) { PropertyModel.Builder builder = new PropertyModel.Builder(NoteProperties.ALL_KEYS) .with(NoteProperties.IS_FIRST, isFirst) + .with(NoteProperties.IS_LAST, isLast) .with(NoteProperties.TEMPLATE, template) .with(NoteProperties.TYPEFACE, typeface);
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteProperties.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteProperties.java index 115408a..52e5788 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteProperties.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteProperties.java
@@ -14,9 +14,12 @@ /** The view type used by the recycler view to show the notes. */ public static final int NOTE_VIEW_TYPE = 1; - /** The template definition.*/ + /** Whether this note is the first one. */ static final WritableObjectPropertyKey<Boolean> IS_FIRST = new WritableObjectPropertyKey<>(); + /** Whether this note is the last one. */ + static final WritableObjectPropertyKey<Boolean> IS_LAST = new WritableObjectPropertyKey<>(); + /** The template definition.*/ static final WritableObjectPropertyKey<NoteTemplate> TEMPLATE = new WritableObjectPropertyKey<>(); @@ -24,5 +27,5 @@ /** The Typeface instance that has been loaded for the associated template. */ static final WritableObjectPropertyKey<Typeface> TYPEFACE = new WritableObjectPropertyKey<>(); - static final PropertyKey[] ALL_KEYS = new PropertyKey[] {IS_FIRST, TEMPLATE, TYPEFACE}; + static final PropertyKey[] ALL_KEYS = new PropertyKey[] {IS_FIRST, IS_LAST, TEMPLATE, TYPEFACE}; } \ No newline at end of file
diff --git a/chrome/browser/content_settings/mixed_content_settings_tab_helper.cc b/chrome/browser/content_settings/mixed_content_settings_tab_helper.cc index 92024b9e..4744221 100644 --- a/chrome/browser/content_settings/mixed_content_settings_tab_helper.cc +++ b/chrome/browser/content_settings/mixed_content_settings_tab_helper.cc
@@ -31,16 +31,15 @@ WebContents::FromRenderFrameHost(tab->GetOpener())); if (opener_settings && opener_settings->IsRunningInsecureContentAllowed(*tab->GetOpener())) { - AllowRunningOfInsecureContent(); + AllowRunningOfInsecureContent(*tab->GetOpener()); } } MixedContentSettingsTabHelper::~MixedContentSettingsTabHelper() {} -void MixedContentSettingsTabHelper::AllowRunningOfInsecureContent() { - // TODO(crbug.com/1061899): use render_frame_host->GetMainFrame() for the - // correct render_frame_host instead of going through web_contents(). - auto* main_frame = web_contents()->GetMainFrame(); +void MixedContentSettingsTabHelper::AllowRunningOfInsecureContent( + RenderFrameHost& render_frame_host) { + auto* main_frame = render_frame_host.GetMainFrame(); if (!base::Contains(settings_, main_frame)) { settings_[main_frame] = std::make_unique<PageSettings>(main_frame); }
diff --git a/chrome/browser/content_settings/mixed_content_settings_tab_helper.h b/chrome/browser/content_settings/mixed_content_settings_tab_helper.h index f5f84cc..3569e9a 100644 --- a/chrome/browser/content_settings/mixed_content_settings_tab_helper.h +++ b/chrome/browser/content_settings/mixed_content_settings_tab_helper.h
@@ -24,7 +24,8 @@ // WebContents/tab. This will stick around as long as the main frame's // RenderFrameHost stays the same. When the RenderFrameHost changes, we're // back to the default (mixed content resources are not allowed to run). - void AllowRunningOfInsecureContent(); + void AllowRunningOfInsecureContent( + content::RenderFrameHost& render_frame_host); bool IsRunningInsecureContentAllowed( content::RenderFrameHost& render_frame_host);
diff --git a/chrome/browser/content_settings/mixed_content_settings_tab_helper_browsertest.cc b/chrome/browser/content_settings/mixed_content_settings_tab_helper_browsertest.cc index e349de3..494a1ae 100644 --- a/chrome/browser/content_settings/mixed_content_settings_tab_helper_browsertest.cc +++ b/chrome/browser/content_settings/mixed_content_settings_tab_helper_browsertest.cc
@@ -113,3 +113,83 @@ // Mixed content should be blocked in the new page. EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); } + +// Tests that the prerending doesn't affect the mixed content's insecure status +// with the main frame. +IN_PROC_BROWSER_TEST_F(MixedContentSettingsTabHelperBrowserTest, + DoNotAffectInsecureOfPrimaryPageInPrerendering) { + GURL primary_url( + test_server()->GetURL("/content_setting_bubble/mixed_script.html")); + + auto* helper = MixedContentSettingsTabHelper::FromWebContents(web_contents()); + + // Loads a primary page that has mixed content. + EXPECT_TRUE(content::NavigateToURL(web_contents(), primary_url)); + + // Mixed content should be blocked in the page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); + + // Loads a page in the prerendering. + GURL prerender_url( + test_server()->GetURL("/content_setting_bubble/mixed_script.html")); + const int host_id = prerender_helper()->AddPrerender(prerender_url); + content::RenderFrameHost* prerender_rfh = + prerender_helper()->GetPrerenderedMainFrameHost(host_id); + + // Mixed content should be blocked in the prerendering page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*prerender_rfh)); + + helper->AllowRunningOfInsecureContent(*prerender_rfh); + + // Mixed content should be unblocked in the prerendering page. + EXPECT_TRUE(helper->IsRunningInsecureContentAllowed(*prerender_rfh)); + + // Mixed content should keep to be blocked in the primary page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); + + // Activates the page from the prerendering. + prerender_helper()->NavigatePrimaryPage(prerender_url); + + // Mixed content should keep to be unblocked in the new page. + EXPECT_TRUE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); +} + +// Tests that the activated page keeps the mixed content's secure status +// after the prerending page is activated. +IN_PROC_BROWSER_TEST_F(MixedContentSettingsTabHelperBrowserTest, + DoNotAffectSecureOfPrerenderingPage) { + GURL primary_url( + test_server()->GetURL("/content_setting_bubble/mixed_script.html")); + + auto* helper = MixedContentSettingsTabHelper::FromWebContents(web_contents()); + + // Loads a primary page that has mixed content. + EXPECT_TRUE(content::NavigateToURL(web_contents(), primary_url)); + + // Mixed content should be blocked in the activated page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); + + // Loads a page in the prerendering. + GURL prerender_url( + test_server()->GetURL("/content_setting_bubble/mixed_script.html")); + int host_id = prerender_helper()->AddPrerender(prerender_url); + content::RenderFrameHost* prerender_rfh = + prerender_helper()->GetPrerenderedMainFrameHost(host_id); + + // Mixed content should be blocked in the prerendering page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*prerender_rfh)); + + helper->AllowRunningOfInsecureContent(*current_frame_host()); + + // Mixed content should be unblocked in the activated page. + EXPECT_TRUE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); + + // Mixed content should keep to be blocked in the prerendering page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*prerender_rfh)); + + // Activates the page from the prerendering. + prerender_helper()->NavigatePrimaryPage(prerender_url); + + // Mixed content should keep to be blocked in the activated page. + EXPECT_FALSE(helper->IsRunningInsecureContentAllowed(*current_frame_host())); +}
diff --git a/chrome/browser/custom_handlers/OWNERS b/chrome/browser/custom_handlers/OWNERS index 0f2502b..066328c 100644 --- a/chrome/browser/custom_handlers/OWNERS +++ b/chrome/browser/custom_handlers/OWNERS
@@ -1,3 +1,5 @@ +file://components/permissions/PERMISSIONS_OWNERS + benwells@chromium.org dominickn@chromium.org mgiuca@chromium.org
diff --git a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc index fb0b1a3..810c754 100644 --- a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc +++ b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
@@ -46,19 +46,18 @@ } bool GetValue(const base::Value& value, gfx::Rect* rect) { - const base::DictionaryValue* dict; - if (!value.GetAsDictionary(&dict)) + if (!value.is_dict()) return false; - int x = 0; - int y = 0; - int width = 0; - int height = 0; - if (!dict->GetInteger("x", &x) || - !dict->GetInteger("y", &y) || - !dict->GetInteger("width", &width) || - !dict->GetInteger("height", &height)) + absl::optional<int> x = value.FindIntKey("x"); + absl::optional<int> y = value.FindIntKey("y"); + absl::optional<int> width = value.FindIntKey("width"); + absl::optional<int> height = value.FindIntKey("height"); + if (!x.has_value() || !y.has_value() || !width.has_value() || + !height.has_value()) { return false; - rect->SetRect(x, y, width, height); + } + + rect->SetRect(x.value(), y.value(), width.value(), height.value()); return true; }
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 181808e..f83585bb 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -100,8 +100,8 @@ #include "components/reputation/core/safety_tip_test_utils.h" #include "components/safe_browsing/buildflags.h" #include "components/safe_browsing/content/browser/safe_browsing_service_interface.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" #include "components/safe_browsing/core/common/proto/csd.pb.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/security_state/core/features.h" #include "components/security_state/core/security_state.h"
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 8b1a729..629d4a7 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -38,7 +38,7 @@ #include "components/safe_browsing/buildflags.h" #include "components/safe_browsing/content/browser/web_ui/safe_browsing_ui.h" #include "components/safe_browsing/content/common/file_type_policies.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_item_utils.h"
diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h index 44cde598..91e7403 100644 --- a/chrome/browser/download/download_item_model.h +++ b/chrome/browser/download/download_item_model.h
@@ -11,10 +11,11 @@ #include "base/compiler_specific.h" #include "base/macros.h" +#include "build/build_config.h" #include "chrome/browser/download/download_ui_model.h" #include "components/download/public/common/download_item.h" #include "components/safe_browsing/buildflags.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" // Implementation of DownloadUIModel that wrappers around a |DownloadItem*|. As // such, the caller is expected to ensure that the |download| passed into the
diff --git a/chrome/browser/download/download_target_determiner.h b/chrome/browser/download/download_target_determiner.h index e1ae248..da5ff63d 100644 --- a/chrome/browser/download/download_target_determiner.h +++ b/chrome/browser/download/download_target_determiner.h
@@ -19,7 +19,7 @@ #include "components/download/public/common/download_danger_type.h" #include "components/download/public/common/download_item.h" #include "components/download/public/common/download_path_reservation_tracker.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" #include "content/public/browser/download_manager_delegate.h" #include "ppapi/buildflags/buildflags.h"
diff --git a/chrome/browser/download/download_target_info.h b/chrome/browser/download/download_target_info.h index b0c4c03..3a6e884 100644 --- a/chrome/browser/download/download_target_info.h +++ b/chrome/browser/download/download_target_info.h
@@ -12,7 +12,7 @@ #include "components/download/public/common/download_interrupt_reasons.h" #include "components/download/public/common/download_item.h" #include "components/download/public/common/download_schedule.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" #include "third_party/abseil-cpp/absl/types/optional.h" struct DownloadTargetInfo {
diff --git a/chrome/browser/download/download_ui_model.h b/chrome/browser/download/download_ui_model.h index 668c7de..7c845b6e 100644 --- a/chrome/browser/download/download_ui_model.h +++ b/chrome/browser/download/download_ui_model.h
@@ -19,7 +19,7 @@ #include "components/download/public/common/download_item.h" #include "components/offline_items_collection/core/offline_item.h" #include "components/safe_browsing/buildflags.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" #if !defined(OS_ANDROID) #include "chrome/browser/download/download_commands.h"
diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc index 9518591..decae58 100644 --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc
@@ -146,8 +146,8 @@ return &set; } -const std::set<std::string>* ShellScriptMimeTypes() { - static std::set<std::string> set = {"text/x-sh", "application/x-shellscript"}; +const std::set<std::string>* PngMimeTypes() { + static std::set<std::string> set = {"image/png"}; return &set; } @@ -740,8 +740,9 @@ FakeBinaryUploadServiceStorage()->SetShouldAutomaticallyAuthorize(true); // Create the files with unsupported types. + std::string png_file_content = "\x89PNG\x0D\x0A\x1A\x0A"; ContentAnalysisDelegate::Data data; - CreateFilesForTest({"a.sh"}, {"file content"}, &data); + CreateFilesForTest({"a.png"}, {png_file_content}, &data); ASSERT_TRUE(ContentAnalysisDelegate::IsEnabled( browser()->profile(), GURL(kTestUrl), &data, FILE_ATTACHED)); @@ -750,13 +751,13 @@ validator.ExpectUnscannedFileEvent( /*url*/ "about:blank", /*filename*/ created_file_paths()[0].AsUTF8Unsafe(), - // printf "file content" | sha256sum | tr '[:lower:]' '[:upper:]' - /*sha*/ - "E0AC3601005DFA1864F5392AABAF7D898B1B5BAB854F1ACB4491BCD806B76B0C", + // printf "\x89PNG\x0D\x0A\x1A\x0A" | sha256sum | tr '[:lower:]' \ + // '[:upper:]' + "4C4B6A3BE1314AB86138BEF4314DDE022E600960D8689A2C8F8631802D20DAB6", /*trigger*/ SafeBrowsingPrivateEventRouter::kTriggerFileUpload, /*reason*/ "DLP_SCAN_UNSUPPORTED_FILE_TYPE", - /*mimetype*/ ShellScriptMimeTypes(), - /*size*/ std::string("file content").size(), + /*mimetype*/ PngMimeTypes(), + /*size*/ png_file_content.size(), /*result*/ expected_result() ? safe_browsing::EventResultToString( safe_browsing::EventResult::ALLOWED)
diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc index 94feffbc6..9d4546c 100644 --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc
@@ -138,12 +138,13 @@ void CreateFilesForTest( const std::vector<base::FilePath::StringType>& file_names, - ContentAnalysisDelegate::Data* data) { + ContentAnalysisDelegate::Data* data, + const std::string& content = "content") { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); for (const auto& file_name : file_names) { base::FilePath path = temp_dir_.GetPath().Append(file_name); base::File file(path, base::File::FLAG_CREATE | base::File::FLAG_WRITE); - file.WriteAtCurrentPos("content", 7); + file.WriteAtCurrentPos(content.data(), content.size()); data->paths.emplace_back(path); } } @@ -1362,11 +1363,13 @@ ASSERT_TRUE( ContentAnalysisDelegate::IsEnabled(profile(), url, &data, FILE_ATTACHED)); + // The file content bytes correspond to an unsupported type (png) so that + // sniffing doesn't indicate the file is supported. CreateFilesForTest( {FILE_PATH_LITERAL("foo.these"), FILE_PATH_LITERAL("foo.file"), FILE_PATH_LITERAL("foo.types"), FILE_PATH_LITERAL("foo.are"), FILE_PATH_LITERAL("foo.not"), FILE_PATH_LITERAL("foo.supported")}, - &data); + &data, /*content*/ "\x89PNG\x0D\x0A\x1A\x0A"); // Mark all files with failed scans. for (const auto& path : data.paths) { @@ -1412,11 +1415,13 @@ EXPECT_TRUE( ContentAnalysisDelegate::IsEnabled(profile(), url, &data, FILE_ATTACHED)); + // The file content bytes correspond to an unsupported type (png) so that + // sniffing doesn't indicate the file is supported. CreateFilesForTest( {FILE_PATH_LITERAL("foo.these"), FILE_PATH_LITERAL("foo.file"), FILE_PATH_LITERAL("foo.types"), FILE_PATH_LITERAL("foo.are"), FILE_PATH_LITERAL("foo.not"), FILE_PATH_LITERAL("foo.supported")}, - &data); + &data, /*content*/ "\x89PNG\x0D\x0A\x1A\x0A"); // Mark all files with failed scans. for (const auto& path : data.paths) { @@ -1452,14 +1457,16 @@ ContentAnalysisDelegate::IsEnabled(profile(), url, &data, FILE_ATTACHED)); // Only 3 of these file types are supported (bzip, cab and doc). They are - // mixed in the list so as to show that insertion order does not matter. + // mixed in the list so as to show that insertion order does not matter. The + // file content bytes correspond to an unsupported type (png) so that sniffing + // doesn't indicate the file is supported. CreateFilesForTest( {FILE_PATH_LITERAL("foo.bzip"), FILE_PATH_LITERAL("foo.these"), FILE_PATH_LITERAL("foo.file"), FILE_PATH_LITERAL("foo.types"), FILE_PATH_LITERAL("foo.cab"), FILE_PATH_LITERAL("foo.are"), FILE_PATH_LITERAL("foo.not"), FILE_PATH_LITERAL("foo.supported"), FILE_PATH_LITERAL("foo_no_extension"), FILE_PATH_LITERAL("foo.doc")}, - &data); + &data, /*content*/ "\x89PNG\x0D\x0A\x1A\x0A"); // Mark all files with failed scans. for (const auto& path : data.paths) { @@ -1499,9 +1506,11 @@ ASSERT_TRUE( ContentAnalysisDelegate::IsEnabled(profile(), url, &data, FILE_ATTACHED)); + // The file content bytes correspond to an unsupported type (png) so that + // sniffing doesn't indicate the file is supported. CreateFilesForTest({FILE_PATH_LITERAL("foo.unsupported_extension"), FILE_PATH_LITERAL("dlp_fail.doc")}, - &data); + &data, /*content*/ "\x89PNG\x0D\x0A\x1A\x0A"); // Mark DLP as failure. SetDLPResponse(FakeContentAnalysisDelegate::DlpResponse(
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index 43e0414..c88800ec 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -302,7 +302,7 @@ content::NavigationController* web_auth_flow_controller = content::Source<content::NavigationController>(source).ptr(); content::WebContents* web_contents = - web_auth_flow_controller->GetWebContents(); + web_auth_flow_controller->DeprecatedGetWebContents(); if (web_contents->GetLastCommittedURL() == url_) { // It is safe to keep the pointer here, because we know in a test, that
diff --git a/chrome/browser/extensions/navigation_observer.cc b/chrome/browser/extensions/navigation_observer.cc index 6dd7e848..f938714 100644 --- a/chrome/browser/extensions/navigation_observer.cc +++ b/chrome/browser/extensions/navigation_observer.cc
@@ -102,7 +102,7 @@ in_progress_prompt_navigation_controller_ = nav_controller; extension_install_prompt_ = std::make_unique<ExtensionInstallPrompt>( - nav_controller->GetWebContents()); + nav_controller->DeprecatedGetWebContents()); ExtensionInstallPrompt::PromptType type = ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(profile_, extension);
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index 1afd162..55d8dc7 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -313,7 +313,7 @@ content::NavigationController* controller = content::Source<content::NavigationController>(windowed_observer.source()) .ptr(); - content::WebContents* newtab = controller->GetWebContents(); + content::WebContents* newtab = controller->DeprecatedGetWebContents(); ASSERT_TRUE(newtab); EXPECT_EQ(content::PAGE_TYPE_ERROR,
diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index e58d96d..301ad49 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc
@@ -357,7 +357,7 @@ case IBD::TAB_SHARING_INFOBAR_DELEGATE: TabSharingInfoBarDelegate::Create(GetInfoBarManager(), u"example.com", u"application.com", false, true, - nullptr); + absl::nullopt, nullptr); break; default:
diff --git a/chrome/browser/media/webrtc/desktop_capture_devices_util.cc b/chrome/browser/media/webrtc/desktop_capture_devices_util.cc index 5be4e1ac..e2c845e 100644 --- a/chrome/browser/media/webrtc/desktop_capture_devices_util.cc +++ b/chrome/browser/media/webrtc/desktop_capture_devices_util.cc
@@ -279,7 +279,12 @@ if (media_id.type == content::DesktopMediaID::TYPE_WEB_CONTENTS && base::FeatureList::IsEnabled( features::kDesktopCaptureTabSharingInfobar)) { - notification_ui = TabSharingUI::Create(media_id, application_title); + content::GlobalRenderFrameHostId capturer_id; + if (web_contents && web_contents->GetMainFrame()) { + capturer_id = web_contents->GetMainFrame()->GetGlobalId(); + } + notification_ui = + TabSharingUI::Create(capturer_id, media_id, application_title); } else { notification_ui = ScreenCaptureNotificationUI::Create( GetStopSharingUIString(application_title, registered_extension_name,
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc index 0c1960e..5fb725b 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
@@ -520,13 +520,10 @@ } // namespace ChromeBrowserMainExtraPartsMetrics::ChromeBrowserMainExtraPartsMetrics() - : display_count_(0), is_screen_observer_(false) { -} + : display_count_(0) {} -ChromeBrowserMainExtraPartsMetrics::~ChromeBrowserMainExtraPartsMetrics() { - if (is_screen_observer_) - display::Screen::GetScreen()->RemoveObserver(this); -} +ChromeBrowserMainExtraPartsMetrics::~ChromeBrowserMainExtraPartsMetrics() = + default; void ChromeBrowserMainExtraPartsMetrics::PreProfileInit() { RecordMicroArchitectureStats(); @@ -769,9 +766,6 @@ #endif // defined(OS_WIN) auto* screen = display::Screen::GetScreen(); - screen->AddObserver(this); - is_screen_observer_ = true; - display_count_ = screen->GetNumDisplays(); base::UmaHistogramCounts100("Hardware.Display.Count.OnStartup", display_count_); @@ -780,6 +774,8 @@ RecordDisplayHDRStatus(display); } + display_observer_.emplace(this); + #if !defined(OS_ANDROID) metrics::BeginFirstWebContentsProfiling(); // Only instantiate the tab stats tracker if a local state exists. This is
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h index 383a1c91..ed2b4b8 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "build/build_config.h" #include "chrome/browser/chrome_browser_main_extra_parts.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/display/display_observer.h" class ChromeBrowserMainParts; @@ -57,9 +58,7 @@ // A cached value for the number of displays. int display_count_; - // True iff |this| instance is registered as an observer of the native - // screen. - bool is_screen_observer_; + absl::optional<display::ScopedDisplayObserver> display_observer_; #if defined(USE_OZONE) || defined(USE_X11) std::unique_ptr<ui::InputDeviceEventObserver> input_device_event_observer_;
diff --git a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.cc b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.cc index 0441ef9c..fd47235 100644 --- a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.cc +++ b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.cc
@@ -36,19 +36,12 @@ // state. Constructing the object like this starts off the state as empty. If // tabs/windows already exist when this object is created they need to be // added using the normal functions after creation. - auto* screen = display::Screen::GetScreen(); - // Make sure that this doesn't get created before setting up the global Screen - // instance. - DCHECK(screen); - screen->AddObserver(this); } TabUsageScenarioTracker::~TabUsageScenarioTracker() { - auto* screen = display::Screen::GetScreen(); // Make sure that this doesn't get destroyed after destroying the global // screen instance. - DCHECK(screen); - screen->RemoveObserver(this); + DCHECK(display::Screen::GetScreen()); } void TabUsageScenarioTracker::OnTabAdded(content::WebContents* web_contents) {
diff --git a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.h b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.h index ebd55f0..9b12cbb4 100644 --- a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.h +++ b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.h
@@ -88,6 +88,8 @@ // WebContents currently playing video fullscreen, nullptr if there's none. content::WebContents* content_with_media_playing_fullscreen_ = nullptr; + display::ScopedDisplayObserver display_observer_{this}; + // Used to verify that all access to |usage_scenario_data_store_| goes through // the same sequence as the one that created this object. SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java b/chrome/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java index 80f53e62..461131c 100644 --- a/chrome/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java +++ b/chrome/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java
@@ -72,9 +72,8 @@ ChannelId.MEDIA_PLAYBACK, ChannelId.SCREEN_CAPTURE, ChannelId.CONTENT_SUGGESTIONS, ChannelId.WEBAPP_ACTIONS, ChannelId.SITES, ChannelId.SHARING, ChannelId.UPDATES, ChannelId.COMPLETED_DOWNLOADS, ChannelId.PERMISSION_REQUESTS, - ChannelId.PERMISSION_REQUESTS_HIGH, ChannelId.ANNOUNCEMENT, - ChannelId.TWA_DISCLOSURE_INITIAL, ChannelId.TWA_DISCLOSURE_SUBSEQUENT, - ChannelId.PRICE_DROP}) + ChannelId.PERMISSION_REQUESTS_HIGH, ChannelId.ANNOUNCEMENT, ChannelId.WEBAPPS, + ChannelId.WEBAPPS_QUIET, ChannelId.PRICE_DROP}) @Retention(RetentionPolicy.SOURCE) public @interface ChannelId { String BROWSER = "browser"; @@ -93,8 +92,8 @@ String PERMISSION_REQUESTS = "permission_requests"; String PERMISSION_REQUESTS_HIGH = "permission_requests_high"; String ANNOUNCEMENT = "announcement"; - String TWA_DISCLOSURE_INITIAL = "twa_disclosure_initial"; - String TWA_DISCLOSURE_SUBSEQUENT = "twa_disclosure_subsequent"; + String WEBAPPS = "twa_disclosure_initial"; + String WEBAPPS_QUIET = "twa_disclosure_subsequent"; String WEBRTC_CAM_AND_MIC = "webrtc_cam_and_mic"; String PRICE_DROP = "shopping_price_drop_alerts"; String SECURITY_KEY = "security_key"; @@ -214,13 +213,13 @@ NotificationManager.IMPORTANCE_LOW, ChannelGroupId.GENERAL)); // Not added to startup channels as not all users will use Trusted Web Activities. - map.put(ChannelId.TWA_DISCLOSURE_INITIAL, - PredefinedChannel.createSilenced(ChannelId.TWA_DISCLOSURE_INITIAL, - R.string.twa_running_in_chrome_channel_name_initial, + map.put(ChannelId.WEBAPPS, + PredefinedChannel.createSilenced(ChannelId.WEBAPPS, + R.string.notification_category_webapps, NotificationManager.IMPORTANCE_MAX, ChannelGroupId.GENERAL)); - map.put(ChannelId.TWA_DISCLOSURE_SUBSEQUENT, - PredefinedChannel.create(ChannelId.TWA_DISCLOSURE_SUBSEQUENT, - R.string.twa_running_in_chrome_channel_name_subsequent, + map.put(ChannelId.WEBAPPS_QUIET, + PredefinedChannel.create(ChannelId.WEBAPPS_QUIET, + R.string.notification_category_webapps_quiet, NotificationManager.IMPORTANCE_MIN, ChannelGroupId.GENERAL)); // Not added to startup channels because we want this channel to be created on the first
diff --git a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc index d0b5603..11aa1495 100644 --- a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
@@ -168,8 +168,9 @@ } // Test that an empty embedded ad isn't reported at all. +// TODO(crbug.com/1226500): This test is flaky. IN_PROC_BROWSER_TEST_F(AdsPageLoadMetricsObserverBrowserTest, - OriginStatusMetricEmbeddedEmpty) { + DISABLED_OriginStatusMetricEmbeddedEmpty) { base::HistogramTester histogram_tester; ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL(
diff --git a/chrome/browser/performance_manager/background_tab_loading_policy_browsertest.cc b/chrome/browser/performance_manager/background_tab_loading_policy_browsertest.cc index d6c3b0c0..548643d9 100644 --- a/chrome/browser/performance_manager/background_tab_loading_policy_browsertest.cc +++ b/chrome/browser/performance_manager/background_tab_loading_policy_browsertest.cc
@@ -59,7 +59,7 @@ content::NavigationController* controller = &tab->GetController(); // If tab content is not in a loading state and doesn't need reload. if (!controller->NeedsReload() && !controller->GetPendingEntry() && - !controller->GetWebContents()->IsLoading()) { + !tab->IsLoading()) { return; }
diff --git a/chrome/browser/permissions/permission_request_manager_browsertest.cc b/chrome/browser/permissions/permission_request_manager_browsertest.cc index 509695e..b70466a 100644 --- a/chrome/browser/permissions/permission_request_manager_browsertest.cc +++ b/chrome/browser/permissions/permission_request_manager_browsertest.cc
@@ -356,14 +356,9 @@ // Prompts are only shown for active tabs and (on Desktop) hidden on tab // switching -// Flaky on Win and Linux bots crbug.com/1003747. -#if defined(OS_WIN) || defined(OS_LINUX) -#define MAYBE_MultipleTabs DISABLED_MultipleTabs -#else -#define MAYBE_MultipleTabs MultipleTabs -#endif +// Flaky on bots crbug.com/1003747. IN_PROC_BROWSER_TEST_F(PermissionRequestManagerBrowserTest, - MAYBE_MultipleTabs) { + DISABLED_MultipleTabs) { ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
diff --git a/chrome/browser/profile_resetter/brandcoded_default_settings.cc b/chrome/browser/profile_resetter/brandcoded_default_settings.cc index be79a83..f8531d5 100644 --- a/chrome/browser/profile_resetter/brandcoded_default_settings.cc +++ b/chrome/browser/profile_resetter/brandcoded_default_settings.cc
@@ -96,7 +96,7 @@ if (master_dictionary_ && master_dictionary_->GetList(pref_name, &value) && !value->empty()) { - return std::unique_ptr<base::ListValue>(value->DeepCopy()); + return value->CreateDeepCopy(); } return nullptr; }
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc index c220381..54d3fad 100644 --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -68,7 +68,6 @@ #include "chrome/browser/prefs/pref_metrics_service.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/profiles/gaia_info_update_service_factory.h" -#include "chrome/browser/profiles/guest_signin_observer_factory.h" #include "chrome/browser/profiles/renderer_updater_factory.h" #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" #include "chrome/browser/search_engines/template_url_fetcher_factory.h" @@ -253,9 +252,6 @@ AboutSigninInternalsFactory::GetInstance(); AccessContextAuditServiceFactory::GetInstance(); -#if !defined(OS_ANDROID) - GuestSigninObserverFactory::GetInstance(); -#endif AccountConsistencyModeManagerFactory::GetInstance(); AccountInvestigatorFactory::GetInstance(); AccountReconcilorFactory::GetInstance();
diff --git a/chrome/browser/profiles/guest_signin_observer_factory.cc b/chrome/browser/profiles/guest_signin_observer_factory.cc deleted file mode 100644 index a53b2d5..0000000 --- a/chrome/browser/profiles/guest_signin_observer_factory.cc +++ /dev/null
@@ -1,69 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/profiles/guest_signin_observer_factory.h" - -#include "base/memory/singleton.h" -#include "base/metrics/histogram_functions.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/identity_manager_factory.h" -#include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/signin/public/identity_manager/identity_manager.h" - -namespace { - -class GuestSigninObserver : public KeyedService, - public signin::IdentityManager::Observer { - public: - explicit GuestSigninObserver(Profile* profile) : profile_(profile) { - IdentityManagerFactory::GetForProfile(profile)->AddObserver(this); - } - - void Shutdown() override { - IdentityManagerFactory::GetForProfile(profile_)->RemoveObserver(this); - } - - void OnPrimaryAccountChanged( - const signin::PrimaryAccountChangeEvent& event) override { - switch (event.GetEventTypeFor(signin::ConsentLevel::kSignin)) { - case signin::PrimaryAccountChangeEvent::Type::kSet: - base::UmaHistogramBoolean("Profile.EphemeralGuest.Signin", true); - break; - case signin::PrimaryAccountChangeEvent::Type::kCleared: - base::UmaHistogramBoolean("Profile.EphemeralGuest.Signin", false); - break; - case signin::PrimaryAccountChangeEvent::Type::kNone: - break; - } - } - - private: - Profile* profile_; -}; - -} // namespace - -// static -GuestSigninObserverFactory* GuestSigninObserverFactory::GetInstance() { - return base::Singleton<GuestSigninObserverFactory>::get(); -} - -GuestSigninObserverFactory::GuestSigninObserverFactory() - : BrowserContextKeyedServiceFactory( - "GuestSigninObserver", - BrowserContextDependencyManager::GetInstance()) { - DependsOn(IdentityManagerFactory::GetInstance()); -} - -KeyedService* GuestSigninObserverFactory::BuildServiceInstanceFor( - content::BrowserContext* context) const { - Profile* profile(Profile::FromBrowserContext(context)); - if (profile->IsEphemeralGuestProfile()) - return new GuestSigninObserver(profile); - return nullptr; -} - -bool GuestSigninObserverFactory::ServiceIsCreatedWithBrowserContext() const { - return true; -}
diff --git a/chrome/browser/profiles/guest_signin_observer_factory.h b/chrome/browser/profiles/guest_signin_observer_factory.h deleted file mode 100644 index 902ea0d..0000000 --- a/chrome/browser/profiles/guest_signin_observer_factory.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PROFILES_GUEST_SIGNIN_OBSERVER_FACTORY_H_ -#define CHROME_BROWSER_PROFILES_GUEST_SIGNIN_OBSERVER_FACTORY_H_ - -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" - -namespace base { -template <typename T> -struct DefaultSingletonTraits; -} // namespace base - -// Factory for BrowserKeyedService GuestSigninObserver. -class GuestSigninObserverFactory : public BrowserContextKeyedServiceFactory { - public: - static GuestSigninObserverFactory* GetInstance(); - - private: - friend struct base::DefaultSingletonTraits<GuestSigninObserverFactory>; - - GuestSigninObserverFactory(); - - // BrowserContextKeyedServiceFactory: - KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const override; - bool ServiceIsCreatedWithBrowserContext() const override; - - DISALLOW_COPY_AND_ASSIGN(GuestSigninObserverFactory); -}; - -#endif // CHROME_BROWSER_PROFILES_GUEST_SIGNIN_OBSERVER_FACTORY_H_
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index e65099c..b325b2a 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc
@@ -633,18 +633,18 @@ if (local_state->HasPrefPath(prefs::kProfilesLastActive) && local_state->GetList(prefs::kProfilesLastActive)) { // Make a copy because the list might change in the calls to GetProfile. - std::unique_ptr<base::ListValue> profile_list( - local_state->GetList(prefs::kProfilesLastActive)->DeepCopy()); - for (const auto& entry : profile_list->GetList()) { - std::string profile_base_name; - if (!entry.GetAsString(&profile_base_name) || profile_base_name.empty() || - profile_base_name == + const base::Value profile_list = + local_state->GetList(prefs::kProfilesLastActive)->Clone(); + for (const auto& entry : profile_list.GetList()) { + const std::string* profile_base_name = entry.GetIfString(); + if (!profile_base_name || profile_base_name->empty() || + *profile_base_name == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) { LOG(WARNING) << "Invalid entry in " << prefs::kProfilesLastActive; continue; } Profile* profile = profile_manager->GetProfile( - profile_manager->user_data_dir().AppendASCII(profile_base_name)); + profile_manager->user_data_dir().AppendASCII(*profile_base_name)); if (profile) { // crbug.com/823338 -> CHECK that the profiles aren't guest or // incognito, causing a crash during session restore.
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb index d421d66..93160db 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb
@@ -1062,6 +1062,7 @@ <translation id="8653646212587894517">Ipakita ang listahan ng mga link</translation> <translation id="8656888282555543604">I-enable ang pag-log ng braille</translation> <translation id="8659501358298941449">Mga Drop-Down na Listahan</translation> +<translation id="8666733765751421568"><ph name="TYPE" /> sa dulo</translation> <translation id="867187640362843212">Heading 5</translation> <translation id="8693391540059827073">Ang aking paboritong panahon</translation> <translation id="8696284982970258155">HoneyDew</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_km.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_km.xtb index 716590c..8a143aba 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_km.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_km.xtb
@@ -206,6 +206,7 @@ <translation id="2428534162001909979">ម៉ឺនុយពាក្យបញ្ជា</translation> <translation id="242998846562331953">ចំណងជើងរង</translation> <translation id="2435422727584637732">ខៀវខ្ចី</translation> +<translation id="2438712309510062123">ណែនាំ</translation> <translation id="2450814015951372393">ប្រអប់ធីក</translation> <translation id="2461822463642141190">បច្ចុប្បន្ន</translation> <translation id="2462626033734746142">ប៊ូតុងក្រុមវិទ្យុ</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_mn.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_mn.xtb index 9bf35788..9151e34 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_mn.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_mn.xtb
@@ -1062,6 +1062,7 @@ <translation id="8653646212587894517">Холбоосуудын жагсаалтыг харуулна уу</translation> <translation id="8656888282555543604">Брайл нэвтрэлтийг идэвхжүүлэх</translation> <translation id="8659501358298941449">Эвхмэл жагсаалт</translation> +<translation id="8666733765751421568"><ph name="TYPE" />-н төгсөл</translation> <translation id="867187640362843212">Гарчиг 5</translation> <translation id="8693391540059827073">Миний дуртай улирал</translation> <translation id="8696284982970258155">Бага зэргийн цайвар цэнхэр</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_pa.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_pa.xtb index 092b0a5..534baea1 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_pa.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_pa.xtb
@@ -206,6 +206,7 @@ <translation id="2428534162001909979">ਕਮਾਂਡ ਮੀਨੂ</translation> <translation id="242998846562331953">ਉਪਸਿਰੇਲਖ</translation> <translation id="2435422727584637732">ਗੂੜ੍ਹਾ ਅਸਮਾਨੀ ਰੰਗਾ</translation> +<translation id="2438712309510062123">ਸੁਝਾਓ</translation> <translation id="2450814015951372393">ਚੈੱਕ-ਬਾਕਸ</translation> <translation id="2461822463642141190">ਮੌਜੂਦਾ</translation> <translation id="2462626033734746142">ਰੇਡੀਓ ਬਟਨ ਗਰੁੱਪ</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_sq.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_sq.xtb index 3cefa46..463d984 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_sq.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_sq.xtb
@@ -206,6 +206,7 @@ <translation id="2428534162001909979">Menytë e komandës</translation> <translation id="242998846562331953">Titrat</translation> <translation id="2435422727584637732">Blu Dodger</translation> +<translation id="2438712309510062123">Sugjero</translation> <translation id="2450814015951372393">Shëno kutinë</translation> <translation id="2461822463642141190">Rryma</translation> <translation id="2462626033734746142">Grupi i butonit të radios</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_uz.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_uz.xtb index 08158847..3d8b0dd 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_uz.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_uz.xtb
@@ -1061,6 +1061,7 @@ <translation id="8653646212587894517">Havolalar ro‘yxatini ko‘rsatish</translation> <translation id="8656888282555543604">Breyl jurnalini yoqish</translation> <translation id="8659501358298941449">Pastga ochiladigan roʻyxatlar</translation> +<translation id="8666733765751421568"><ph name="TYPE" /> oxiri</translation> <translation id="867187640362843212">5-darajali sarlavha</translation> <translation id="8693391540059827073">Sevimli faslim</translation> <translation id="8696284982970258155">Musaffo moviy</translation>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html index cd10d96f..2630a52 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_get_more.html
@@ -6,14 +6,15 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-get-more"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="assistant_get_more.css"> <link rel="stylesheet" href="assistant_shared_styles.css"> <oobe-adaptive-dialog id="get-more-dialog" role="dialog" hide-shadow
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html index 2e0c649..b755fd1 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_loading.html
@@ -7,16 +7,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> + <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/oobe_content_dialog.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-loading"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="assistant_loading.css"> <link rel="stylesheet" href="assistant_shared_styles.css"> <oobe-content-dialog id="loading-dialog" role="dialog" for-step="loading"
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html index cbbb133c..68975fb 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin.html
@@ -20,7 +20,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> @@ -33,7 +33,7 @@ <link rel="stylesheet" href="../login/oobe_screen.css"> <link rel="stylesheet" href="../login/oobe.css"> <link rel="stylesheet" href="setting_zippy.css"> -<style include="cr-icons cr-shared-style oobe-common"></style> +<style include="cr-icons cr-shared-style oobe-common-styles"></style> <script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/load_time_data.js"></script>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html index d3399d79..203bf73 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_optin_flow.html
@@ -12,14 +12,14 @@ <include src="setting_zippy.html"> <include src="voice_match_entry.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <dom-module id="assistant-optin-flow-element"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="../login/oobe_popup_overlay.css"> <link rel="stylesheet" href="assistant_shared_styles.css"> <link rel="stylesheet" href="assistant_value_prop.css">
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html index d4a1f9f..cd6067fb 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html
@@ -6,15 +6,16 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-related-info"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #intro-text { padding-bottom: 16px; }
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html index 8fb0b319d..938c211 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_third_party.html
@@ -6,15 +6,16 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-third-party"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="assistant_shared_styles.css"> <link rel="stylesheet" href="assistant_third_party.css"> <oobe-adaptive-dialog id="third-party-dialog" role="dialog" hide-shadow>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html index f045c4d..0b25348 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.html
@@ -7,15 +7,16 @@ <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-value-prop"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="assistant_shared_styles.css"> <link rel="stylesheet" href="assistant_value_prop.css"> <oobe-adaptive-dialog id="value-prop-dialog" role="dialog">
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html index db44b45e..ef2b0f0 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_voice_match.html
@@ -8,16 +8,17 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="assistant-voice-match"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="assistant_shared_styles.css"> <link rel="stylesheet" href="assistant_voice_match.css"> <oobe-adaptive-dialog id="voiceMatchIntroDialog" role="dialog"
diff --git a/chrome/browser/resources/chromeos/assistant_optin/setting_zippy.html b/chrome/browser/resources/chromeos/assistant_optin/setting_zippy.html index 9136e7c..e00902d 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/setting_zippy.html +++ b/chrome/browser/resources/chromeos/assistant_optin/setting_zippy.html
@@ -6,11 +6,11 @@ <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <dom-module id="setting-zippy"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="setting_zippy.css"> <link rel="stylesheet" href="assistant_shared_styles.css"> <template is="dom-if" if="[[expandStyle]]">
diff --git a/chrome/browser/resources/chromeos/assistant_optin/voice_match_entry.html b/chrome/browser/resources/chromeos/assistant_optin/voice_match_entry.html index 0be75d2..e0dc3ab 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/voice_match_entry.html +++ b/chrome/browser/resources/chromeos/assistant_optin/voice_match_entry.html
@@ -5,11 +5,11 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <dom-module id="voice-match-entry"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="assistant_shared_styles.css"> <link rel="stylesheet" href="voice_match_entry.css"> <div class="flex layout horizontal center" id="container">
diff --git a/chrome/browser/resources/chromeos/emoji_picker/constants.js b/chrome/browser/resources/chromeos/emoji_picker/constants.js index 544c60b..891aead 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/constants.js +++ b/chrome/browser/resources/chromeos/emoji_picker/constants.js
@@ -3,19 +3,24 @@ // found in the LICENSE file. // height and width should match the dialog size in EmojiPickerDialog. -export const EMOJI_PICKER_HEIGHT = 390; -export const EMOJI_PICKER_WIDTH = 340; -export const EMOJI_ICON_SIZE = 32; +export const EMOJI_PICKER_HEIGHT = 454; +export const EMOJI_PICKER_WIDTH = 372; +export const EMOJI_ICON_SIZE = 28; +export const EMOJI_SPACING = 10; export const EMOJI_PER_ROW = 9; export const GROUP_PER_ROW = 9; -export const EMOJI_PICKER_SIDE_PADDING = 14; -export const EMOJI_PICKER_TOP_PADDING = 8; +export const EMOJI_PICKER_SIDE_PADDING = 20; +export const EMOJI_PICKER_TOP_PADDING = 20; export const GROUP_ICON_SIZE = (EMOJI_PICKER_WIDTH - 2 * EMOJI_PICKER_SIDE_PADDING) / EMOJI_PER_ROW; export const EMOJI_PICKER_HEIGHT_PX = `${EMOJI_PICKER_HEIGHT}px`; export const EMOJI_PICKER_WIDTH_PX = `${EMOJI_PICKER_WIDTH}px`; export const EMOJI_SIZE_PX = `${EMOJI_ICON_SIZE}px`; +export const EMOJI_SPACING_PX = `${EMOJI_SPACING}px`; export const EMOJI_GROUP_SIZE_PX = `${GROUP_ICON_SIZE}px`; export const EMOJI_PICKER_SIDE_PADDING_PX = `${EMOJI_PICKER_SIDE_PADDING}px`; export const EMOJI_PICKER_TOP_PADDING_PX = `${EMOJI_PICKER_TOP_PADDING}px`; +export const EMOJI_PICKER_TOTAL_EMOJI_WIDTH_PX = + `${EMOJI_ICON_SIZE + EMOJI_SPACING}px`; +export const EMOJI_PICKER_TOTAL_EMOJI_WIDTH = EMOJI_ICON_SIZE + EMOJI_SPACING;
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_button.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_button.html index 72f05e4..81c9fc3e 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_button.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_button.html
@@ -3,8 +3,8 @@ --emoji-background: transparent; --emoji-hover-background: var(--cros-ink-ripple-color); height: var(--emoji-size); - width: var(--emoji-size); position: relative; + width: var(--emoji-size); } #emoji-button { @@ -14,7 +14,7 @@ cursor: pointer; display: block; font-family: 'Noto Color Emoji'; - font-size: 17px; + font-size: 17px; /*This gives emoji with height of 20px*/ height: 100%; line-height: var(--emoji-size); padding: 0;
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html index a48e3e4..fdfd1af 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.html
@@ -1,7 +1,10 @@ <style> :host { --emoji-group-clear-recents-icon-size: 16px; + /*These padding values being discussed with UX*/ --emoji-group-heading-size: 32px; + --emoji-group-heading-padding-bottom: 18px; + --emoji-group-heading-padding-top: 14px; margin-top: 10px; position: relative; } @@ -10,8 +13,8 @@ color: var(--cros-text-color-secondary); display: flex; font-size: 10pt; - padding-bottom: 0; - padding-top: 12px; + padding-bottom: var(--emoji-group-heading-padding-bottom); + padding-top: var(--emoji-group-heading-padding-top); } #heading:focus, #heading:active { @@ -27,6 +30,7 @@ #emoji { display: grid; + gap: var(--emoji-spacing); grid-auto-rows: max-content; grid-template-columns: repeat(var(--emoji-per-row), 1fr); justify-items: center; @@ -34,9 +38,7 @@ #show-clear { height: var(--emoji-group-heading-size); - left: calc((var(--emoji-picker-width) - - 2 * var(--emoji-picker-side-padding)) / 9 * 8 - + var(--emoji-picker-side-padding)); + left: var(--emoji-picker-last-emoji-left); margin: 0; width: var(--emoji-group-button-size); } @@ -50,12 +52,15 @@ cursor: pointer; font-family: 'Roboto', sans-serif; font-size: 12px; - height: var(--emoji-group-heading-size); + height: var(--emoji-size); outline: none; padding: 0; position: absolute; right: calc(2px + 2*var(--emoji-picker-side-padding) - var(--emoji-picker-width)); + top: calc(var(--emoji-group-heading-padding-top) + + var(--emoji-group-heading-padding-bottom) + + var(--emoji-group-heading-size)); white-space: nowrap; width: fit-content; z-index: 200;
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_group_button.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_group_button.html index e46f523..59ea6e3 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_group_button.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_group_button.html
@@ -1,15 +1,15 @@ <style> :host { display: flex; - flex-direction: column; - height: var(--emoji-group-button-size); + height: var(--emoji-size); + justify-content: center; scroll-snap-align: none; - width: var(--emoji-group-button-size); + width: var(--emoji-size); } #group-button { - --cr-icon-button-size: var(--emoji-group-button-size); - font-size: var(--emoji-group-button-size); + --cr-icon-button-size: 20px; + font-size: 20px; margin: 0; padding: 0; }
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html index 3fbe7e9..5abb937 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html
@@ -7,11 +7,16 @@ --emoji-picker-top-padding: 0; --emoji-picker-width: 0; --emoji-size: 0; + --emoji-spacing: 0; --emoji-per-row: 0; /* Values set in css only. */ --emoji-group-tabs-left: 0; --emoji-divider-color: var(--google-grey-200); --emoji-picker-bottom-padding: 14px; + --emoji-picker-last-emoji-left: calc(var(--emoji-picker-side-padding) + + var(--emoji-size) * (var(--emoji-per-row) - 1) + + var(--emoji-spacing) * (var(--emoji-per-row) - 1)); + --emoji-picker-group-highlight-bar-width: 24px; /* Actual properties of the emoji picker */ display: flex; flex-direction: column; @@ -47,12 +52,15 @@ } #tabs { - display: flex; - flex-shrink: 0; + display: grid; + grid-gap: var(--emoji-spacing); + grid-template-columns: repeat(18,1fr); left: var(--emoji-group-tabs-left); overflow-x: scroll; + padding-bottom: 10px; + padding-top: 18px; scroll-behavior: smooth; - scroll-padding: var(--emoji-group-button-size); + scroll-padding: var(--emoji-size); scroll-snap-type: x mandatory; width: 100%; } @@ -86,22 +94,20 @@ .chevron { background-color: var(--cros-bg-color); border-radius: 0; - height: var(--emoji-group-button-size); + height: var(--emoji--size); margin: 0; padding: 0; position: absolute; - width: var(--emoji-group-button-size); + width: var(--emoji-size); z-index: 2; } #right-chevron { - left: calc((var(--emoji-picker-width) - - 2 * var(--emoji-picker-side-padding)) / 9 * 8 - + var(--emoji-picker-side-padding)); + left: var(--emoji-picker-last-emoji-left); /* Icons may become visible to the right of this during scrolling without * the additional padding. */ - padding-inline-end: 5px; + padding-inline-end: var(--emoji-picker-side-padding); } #left-chevron { @@ -134,13 +140,17 @@ * time. */ left: 0; + padding-inline-end: calc((var(--emoji-size) + - var(--emoji-picker-group-highlight-bar-width)) / 2); + padding-inline-start: calc((var(--emoji-size) + - var(--emoji-picker-group-highlight-bar-width)) / 2); position: relative; - width: calc(312px / var(--emoji-per-row)); + width: var(--emoji-picker-group-highlight-bar-width); } .fake { flex-shrink: 0; - width: var(--emoji-group-button-size); + width: var(--emoji-size); } .sr-only { @@ -196,12 +206,9 @@ <div class="fake" tabindex="-1"> </div> - <div class="fake" + <div class="fake" id="RightChevronScrollTarget" tabindex="-1"> </div> - <emoji-group-button id="RightChevronScrollTarget" - icon="[[emojiGroupTabs[0].icon]]" tabindex="-1"> - </emoji-group-button> <cr-icon-button id="right-chevron" class="chevron" on-click="onRightChevronClick" iron-icon="emoji_picker:keyboard_arrow_right">
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js index f14a91b1..d738680 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js
@@ -11,7 +11,7 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {afterNextRender, html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {EMOJI_GROUP_SIZE_PX, EMOJI_ICON_SIZE, EMOJI_PER_ROW, EMOJI_PICKER_HEIGHT_PX, EMOJI_PICKER_SIDE_PADDING_PX, EMOJI_PICKER_TOP_PADDING_PX, EMOJI_PICKER_WIDTH_PX, EMOJI_SIZE_PX, GROUP_ICON_SIZE, GROUP_PER_ROW} from './constants.js'; +import {EMOJI_GROUP_SIZE_PX, EMOJI_ICON_SIZE, EMOJI_PER_ROW, EMOJI_PICKER_HEIGHT_PX, EMOJI_PICKER_SIDE_PADDING_PX, EMOJI_PICKER_TOP_PADDING_PX, EMOJI_PICKER_TOTAL_EMOJI_WIDTH, EMOJI_PICKER_TOTAL_EMOJI_WIDTH_PX, EMOJI_PICKER_WIDTH_PX, EMOJI_SIZE_PX, EMOJI_SPACING_PX, GROUP_ICON_SIZE, GROUP_PER_ROW} from './constants.js'; import {EmojiButton} from './emoji_button.js'; import {EmojiPickerApiProxy, EmojiPickerApiProxyImpl} from './emoji_picker_api_proxy.js'; import {createCustomEvent, EMOJI_BUTTON_CLICK, EMOJI_CLEAR_RECENTS_CLICK, EMOJI_DATA_LOADED, EMOJI_VARIANTS_SHOWN, EmojiVariantsShownEvent, GROUP_BUTTON_CLICK} from './events.js'; @@ -229,6 +229,7 @@ '--emoji-per-row': EMOJI_PER_ROW, '--emoji-picker-side-padding': EMOJI_PICKER_SIDE_PADDING_PX, '--emoji-picker-top-padding': EMOJI_PICKER_TOP_PADDING_PX, + '--emoji-spacing': EMOJI_SPACING_PX, }); } @@ -302,10 +303,10 @@ } onRightChevronClick() { - this.$.tabs.scrollLeft = GROUP_ICON_SIZE * 8; + this.$.tabs.scrollLeft = ((EMOJI_PICKER_TOTAL_EMOJI_WIDTH) * 8); this.scrollToGroup(GROUP_TABS[GROUP_PER_ROW - 1].groupId); this.groupTabsMoving = true; - this.$.bar.style.left = EMOJI_GROUP_SIZE_PX; + this.$.bar.style.left = EMOJI_PICKER_TOTAL_EMOJI_WIDTH_PX; } onLeftChevronClick() { @@ -315,7 +316,7 @@ if (this.history.emoji.length > 0) { this.$.bar.style.left = '0'; } else { - this.$.bar.style.left = '36px'; + this.$.bar.style.left = EMOJI_PICKER_TOTAL_EMOJI_WIDTH_PX; } } @@ -416,23 +417,24 @@ // Update the scroll position of the emoji groups so that active group is // visible. let tabscrollLeft = this.$.tabs.scrollLeft; - if (tabscrollLeft > GROUP_ICON_SIZE * (index - 0.5)) { + if (tabscrollLeft > EMOJI_PICKER_TOTAL_EMOJI_WIDTH * (index - 0.5)) { tabscrollLeft = 0; } - if (tabscrollLeft + GROUP_ICON_SIZE * (GROUP_PER_ROW - 2) < + if (tabscrollLeft + EMOJI_PICKER_TOTAL_EMOJI_WIDTH * (GROUP_PER_ROW - 2) < GROUP_ICON_SIZE * index) { // 5 = We want the seventh icon to be first. Then -1 for chevron, -1 for // 1 based indexing. - tabscrollLeft = GROUP_ICON_SIZE * (7); + tabscrollLeft = EMOJI_PICKER_TOTAL_EMOJI_WIDTH * (7); } if (updateTabsScroll) { this.$.tabs.scrollLeft = tabscrollLeft; this.$.bar.style.left = - ((index * GROUP_ICON_SIZE - tabscrollLeft)) + 'px'; + ((index * EMOJI_PICKER_TOTAL_EMOJI_WIDTH - tabscrollLeft)) + 'px'; } else { - this.$.bar.style.left = - ((index * GROUP_ICON_SIZE - this.$.tabs.scrollLeft)) + 'px'; + this.$.bar.style.left = ((index * EMOJI_PICKER_TOTAL_EMOJI_WIDTH - + this.$.tabs.scrollLeft)) + + 'px'; } } }
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_variants.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_variants.html index 495ab07..51e8b49 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_variants.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_variants.html
@@ -1,12 +1,13 @@ <style> :host { background: var(--cros-bg-color); - border-radius: 4px; + border-radius: 4px; /* TODO: might need to be 8 querying with UX */ box-shadow: var(--cr-elevation-2); display: grid; grid-template-columns: max-content max-content max-content; grid-template-rows: max-content max-content; height: fit-content; + padding: 4px 10px 4px 10px; position: relative; width: fit-content; /** Increase z-index so it is above variant selection triangles. */ @@ -24,7 +25,7 @@ #grid-skin-tone-top { display: flex; flex-direction: row; - + gap: var(--emoji-spacing); grid-column: 3; grid-row: 1; } @@ -53,6 +54,7 @@ .variant-row { display: flex; flex-direction: row; + gap: var(--emoji-spacing); height: var(--emoji-size); } </style>
diff --git a/chrome/browser/resources/chromeos/emoji_picker/index.html b/chrome/browser/resources/chromeos/emoji_picker/index.html index ad585a0..3709ab1 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/index.html +++ b/chrome/browser/resources/chromeos/emoji_picker/index.html
@@ -7,10 +7,12 @@ <script type="module" src="emoji_picker.js"></script> <style> html, - emoji-picker { + body { margin: 0; } </style> </head> +<body> <emoji-picker></emoji-picker> +<body> </html> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index e8ac011..839f4196 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -6,9 +6,8 @@ import("//chrome/test/base/js2gtest.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") -import("//ui/webui/resources/tools/generate_grd.gni") import("//tools/grit/preprocess_if_expr.gni") - +import("//ui/webui/resources/tools/generate_grd.gni") assert(is_chromeos, "OOBE UI is only available on ChromeOS builds") @@ -28,10 +27,9 @@ "grit/oobe_resources.h", "oobe_resources.pak", ] + # Some autogenerated files need to be served conditionally through this GRD. - deps = [ - ":preprocess_autogenerated_modules", - ] + deps = [ ":preprocess_autogenerated_modules" ] output_dir = "$root_gen_dir/chrome" } @@ -45,13 +43,12 @@ # ----------------------------------------------------------------------------- grit("modulized_resources") { defines = chrome_grit_defines + # This is necessary since the GRD is generated during build time. enable_input_discovery_for_gn_analyze = false source = "$target_gen_dir/oobe_modulized_resources.grd" - deps = [ - ":build_oobe_modulized_grd", - ] + deps = [ ":build_oobe_modulized_grd" ] outputs = [ "grit/oobe_modulized_resources.h", "grit/oobe_modulized_resources_map.h", @@ -73,12 +70,8 @@ "i18n_setup.js", ] input_files_base_dir = rebase_path(".", "//") - deps = [ - ":preprocess_autogenerated_modules" - ] - manifest_files = [ - "$target_gen_dir/$oobe_autogenerated_modules_manifest", - ] + deps = [ ":preprocess_autogenerated_modules" ] + manifest_files = [ "$target_gen_dir/$oobe_autogenerated_modules_manifest" ] } # Preprocess autogenerated files by copying them to an intermediate location @@ -86,11 +79,12 @@ # GRD file. # ----------------------------------------------------------------------------- preprocess_if_expr("preprocess_autogenerated_modules") { - deps = [":polymer3_elements"] + deps = [ ":polymer3_elements" ] in_folder = target_gen_dir out_folder = "$target_gen_dir/$oobe_preprocessed_folder" out_manifest = "$target_gen_dir/$oobe_autogenerated_modules_manifest" in_files = [ + "components/hd_iron_icon.m.js", "components/oobe_icons.m.js", "components/behaviors/oobe_dialog_host_behavior.m.js", "components/behaviors/oobe_focus_behavior.m.js", @@ -101,14 +95,14 @@ "components/buttons/oobe_next_button.m.js", "components/buttons/oobe_text_button.m.js", "components/oobe_vars/oobe_shared_vars_css.m.js", + "components/common_styles/common_styles.m.js", + "components/common_styles/oobe_dialog_host_styles.m.js", ] } # Main group for Polymer3 elements group("polymer3_elements") { - public_deps = [ - "components:polymer3_elements", - ] + public_deps = [ "components:polymer3_elements" ] } group("closure_compile") { @@ -116,7 +110,7 @@ ":closure_compile_local", ":closure_compile_local_with_externs", "components:closure_compile", - "os_install:closure_compile", + "screens/common:closure_compile", "screens/login:closure_compile", "screens/oobe:closure_compile", "test_api:closure_compile", @@ -514,4 +508,4 @@ js_library("i18n_setup") { deps = [ "//ui/webui/resources/js:load_time_data.m" ] -} \ No newline at end of file +}
diff --git a/chrome/browser/resources/chromeos/login/app_downloading.html b/chrome/browser/resources/chromeos/login/app_downloading.html index 5888baf..7e82a48 100644 --- a/chrome/browser/resources/chromeos/login/app_downloading.html +++ b/chrome/browser/resources/chromeos/login/app_downloading.html
@@ -7,16 +7,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> + <dom-module id="app-downloading-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #video-container video { height: 247px; margin-bottom: auto;
diff --git a/chrome/browser/resources/chromeos/login/arc_terms_of_service.html b/chrome/browser/resources/chromeos/login/arc_terms_of_service.html index f2645cd..f050821 100644 --- a/chrome/browser/resources/chromeos/login/arc_terms_of_service.html +++ b/chrome/browser/resources/chromeos/login/arc_terms_of_service.html
@@ -10,21 +10,22 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <link rel="stylesheet" href="chrome://resources/css/overlay.css"> <dom-module id="arc-tos-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #arcTosContainer p { color: rgba(0, 0, 0, 0.54); line-height: 20px;
diff --git a/chrome/browser/resources/chromeos/login/arc_terms_of_service.js b/chrome/browser/resources/chromeos/login/arc_terms_of_service.js index f1cc26d2..d3bc27d 100644 --- a/chrome/browser/resources/chromeos/login/arc_terms_of_service.js +++ b/chrome/browser/resources/chromeos/login/arc_terms_of_service.js
@@ -369,12 +369,13 @@ /** * Sets current metrics mode. - * @param {string} text Describes current metrics state. + * @param {string} textKey Key of the text which describes current metrics + * state. * @param {boolean} visible If metrics text is visible. */ - setMetricsMode(text, visible) { + setMetricsMode(textKey, visible) { this.isMetricsHidden = !visible; - this.metricsText = text; + this.metricsTextKey = textKey; }, /**
diff --git a/chrome/browser/resources/chromeos/login/checking_downloading_update.html b/chrome/browser/resources/chromeos/login/checking_downloading_update.html index 5ef8be1b..bea47b5e 100644 --- a/chrome/browser/resources/chromeos/login/checking_downloading_update.html +++ b/chrome/browser/resources/chromeos/login/checking_downloading_update.html
@@ -8,11 +8,12 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- UI for checking and downloading updates as part of the update process. @@ -47,7 +48,7 @@ <dom-module id="checking-downloading-update"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> .progress-message { color: var(--oobe-subheader-text-color); margin-top: 8px;
diff --git a/chrome/browser/resources/chromeos/login/components/BUILD.gn b/chrome/browser/resources/chromeos/login/components/BUILD.gn index 28ec3ce6..01c4612 100644 --- a/chrome/browser/resources/chromeos/login/components/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/BUILD.gn
@@ -11,7 +11,6 @@ deps = [ ":closure_compile_local", "buttons:closure_compile", - "hd_iron_icon:closure_compile", "oobe_adaptive_dialog:closure_compile", "oobe_carousel:closure_compile", "oobe_content_dialog:closure_compile", @@ -26,6 +25,7 @@ uses_legacy_modules = true deps = [ ":fake_oobe", + ":hd_iron_icon", ":html-echo", ":network_select_login", ":oobe_i18n_dropdown", @@ -37,20 +37,26 @@ group("closure_compile_module") { deps = [ - ":oobe_icons.m", "behaviors:closure_compile_module", "buttons:closure_compile_module", + "common_styles:closure_compile_module", "oobe_vars:closure_compile_module", + + # Local targets + ":hd_iron_icon.m", + ":oobe_icons.m", ] } group("polymer3_elements") { public_deps = [ - "buttons:polymer3_elements", - "oobe_vars:polymer3_elements", "behaviors:modulize", + "buttons:polymer3_elements", + "common_styles:polymer3_elements", + "oobe_vars:polymer3_elements", # Local targets + ":hd_iron_icon_module", ":oobe_icons_module" ] } @@ -113,14 +119,31 @@ js_library("html-echo") { } +js_library("hd_iron_icon") { +} + #### Polymer3 / JS Modules +js_library("hd_iron_icon.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/hd_iron_icon.m.js" ] + deps = [ + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] + extra_deps = [ ":hd_iron_icon_module" ] +} + js_library("oobe_icons.m") { sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/oobe_icons.m.js" ] deps = [] extra_deps = [ ":oobe_icons_module" ] } +polymer_modulizer("hd_iron_icon") { + js_file = "hd_iron_icon.js" + html_file = "hd_iron_icon.html" + html_type = "dom-module" +} + polymer_modulizer("oobe_icons") { js_file = "oobe_icons.m.js" html_file = "oobe_icons.html"
diff --git a/chrome/browser/resources/chromeos/login/components/buttons/oobe_back_button.html b/chrome/browser/resources/chromeos/login/components/buttons/oobe_back_button.html index 5a1b354..833b0b1 100644 --- a/chrome/browser/resources/chromeos/login/components/buttons/oobe_back_button.html +++ b/chrome/browser/resources/chromeos/login/components/buttons/oobe_back_button.html
@@ -8,7 +8,7 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="../oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="../behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> @@ -45,7 +45,7 @@ --> <dom-module id="oobe-back-button"> <template> - <style include="cr-icons cr-shared-style oobe-common"> + <style include="cr-icons cr-shared-style oobe-common-styles"> cr-button { --border-color: var(--oobe-button-border-color); --cr-button-height: var(--oobe-button-height);
diff --git a/chrome/browser/resources/chromeos/login/components/buttons/oobe_icon_button.html b/chrome/browser/resources/chromeos/login/components/buttons/oobe_icon_button.html index cfea4589..71d4ea9 100644 --- a/chrome/browser/resources/chromeos/login/components/buttons/oobe_icon_button.html +++ b/chrome/browser/resources/chromeos/login/components/buttons/oobe_icon_button.html
@@ -7,8 +7,8 @@ <link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/hd_iron_icon/hd_iron_icon.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="../oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="../behaviors/oobe_i18n_behavior.html"> @@ -38,7 +38,7 @@ --> <dom-module id="oobe-icon-button"> <template> - <style include="cr-icons cr-shared-style oobe-common"> + <style include="cr-icons cr-shared-style oobe-common-styles"> cr-button { --border-color: var(--oobe-button-border-color); --cr-button-height: var(--oobe-button-height);
diff --git a/chrome/browser/resources/chromeos/login/components/buttons/oobe_next_button.html b/chrome/browser/resources/chromeos/login/components/buttons/oobe_next_button.html index 6ce0d25..6e8095fb 100644 --- a/chrome/browser/resources/chromeos/login/components/buttons/oobe_next_button.html +++ b/chrome/browser/resources/chromeos/login/components/buttons/oobe_next_button.html
@@ -8,7 +8,7 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="../oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="../behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> @@ -46,7 +46,7 @@ <dom-module id="oobe-next-button"> <template> - <style include="cr-icons cr-shared-style oobe-common"> + <style include="cr-icons cr-shared-style oobe-common-styles"> cr-button { --border-color: var(--oobe-button-border-color); --cr-button-height: var(--oobe-button-height);
diff --git a/chrome/browser/resources/chromeos/login/components/buttons/oobe_text_button.html b/chrome/browser/resources/chromeos/login/components/buttons/oobe_text_button.html index 7562927..7b1261b 100644 --- a/chrome/browser/resources/chromeos/login/components/buttons/oobe_text_button.html +++ b/chrome/browser/resources/chromeos/login/components/buttons/oobe_text_button.html
@@ -7,7 +7,7 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="../oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="../behaviors/oobe_i18n_behavior.html"> @@ -38,7 +38,7 @@ --> <dom-module id="oobe-text-button"> <template> - <style include="cr-shared-style oobe-common"> + <style include="cr-shared-style oobe-common-styles"> cr-button { --border-color: var(--google-grey-300); --cr-button-height: var(--oobe-button-height);
diff --git a/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn b/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn new file mode 100644 index 0000000..d047a8711 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/common_styles/BUILD.gn
@@ -0,0 +1,45 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") +import("//tools/polymer/polymer.gni") + +js_type_check("closure_compile_module") { + is_polymer3 = true + deps = [ + ":common_styles.m", + ":oobe_dialog_host_styles.m", + ] +} + +group("polymer3_elements") { + public_deps = [ + ":common_styles_module", + ":oobe_dialog_host_styles_module", + ] +} + +js_library("common_styles.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/common_styles/common_styles.m.js" ] + deps = [] + extra_deps = [ ":common_styles_module" ] +} + +js_library("oobe_dialog_host_styles.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/common_styles/oobe_dialog_host_styles.m.js" ] + deps = [] + extra_deps = [ ":oobe_dialog_host_styles_module" ] +} + +polymer_modulizer("common_styles") { + js_file = "common_styles.m.js" + html_file = "common_styles.html" + html_type = "style-module" +} + +polymer_modulizer("oobe_dialog_host_styles") { + js_file = "oobe_dialog_host_styles.m.js" + html_file = "oobe_dialog_host_styles.html" + html_type = "style-module" +}
diff --git a/chrome/browser/resources/chromeos/login/components/common_styles/common_styles.html b/chrome/browser/resources/chromeos/login/components/common_styles/common_styles.html index 91bfceb..3ceeece 100644 --- a/chrome/browser/resources/chromeos/login/components/common_styles/common_styles.html +++ b/chrome/browser/resources/chromeos/login/components/common_styles/common_styles.html
@@ -5,7 +5,7 @@ <link rel="import" href="/components/oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> -<dom-module id="oobe-common"> +<dom-module id="oobe-common-styles"> <template> <style> <include src="../oobe_flex_layout.css"> @@ -65,11 +65,3 @@ </style> </template> </dom-module> - -<dom-module id="oobe-dialog-host"> - <template> - <style include="oobe-common"> - <include src="../oobe_dialog_host.css"> - </style> - </template> -</dom-module>
diff --git a/chrome/browser/resources/chromeos/login/components/common_styles/oobe_dialog_host_styles.html b/chrome/browser/resources/chromeos/login/components/common_styles/oobe_dialog_host_styles.html new file mode 100644 index 0000000..1efa6bc7 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/common_styles/oobe_dialog_host_styles.html
@@ -0,0 +1,69 @@ +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/oobe_vars/oobe_custom_vars_css.html"> +<link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> + +<dom-module id="oobe-dialog-host-styles"> + <template> + <style include="oobe-common-styles"> + + :host(:not([hidden])) { + display: flex; + min-height: 0; + } + + :host { + background-color: white; + border-radius: 4px; + box-shadow: unset; + flex-direction: column; + height: 100%; + min-height: 0; + position: relative; + width: 100%; + } + + .oobe-illustration { + max-height: 100%; + max-width: 100%; + object-fit: contain; + } + + .oobe-tos-webview { + border: 1px solid rgb(218, 220, 224); /* #DADCE0 */ + border-radius: 4px; + box-shadow: inset 0 0 4px 4px rgba(241, 243, 244, 0.5); /* #F1F3F4 */ + } + + .oobe-form { + /* 40px distance from subtitle (oobe forms spec) - 20px of footer-container */ + padding-top: 20px; + } + + /* Center-align both vertically and horizontally */ + .content-centered { + margin: auto; + } + + /* Center-align vertically in landscape mode */ + :host-context([orientation=horizontal]) .landscape-vertical-centered { + margin: auto 0; + } + + /* Align with header in landscape mode */ + :host-context([orientation=horizontal]) .landscape-header-aligned { + padding-top: calc(var(--oobe-adaptive-dialog-header-top-padding) + + var(--oobe-adaptive-dialog-title-top-padding) + + var(--oobe-adaptive-dialog-icon-size)); + } + + /* Center-align horizontally in portrait mode */ + :host-context([orientation=vertical]) .portrait-horizontal-centered { + margin: 0 auto; + } + </style> + </template> + </dom-module>
diff --git a/chrome/browser/resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.html b/chrome/browser/resources/chromeos/login/components/hd_iron_icon.html similarity index 88% rename from chrome/browser/resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.html rename to chrome/browser/resources/chromeos/login/components/hd_iron_icon.html index 1d499e5..c46d55f 100644 --- a/chrome/browser/resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.html +++ b/chrome/browser/resources/chromeos/login/components/hd_iron_icon.html
@@ -2,9 +2,10 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> +<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <!-- <iron-icon> that automatically displays one of the two icons depending on @@ -24,7 +25,7 @@ --> <dom-module id="hd-iron-icon"> <template> - <style include="oobe-common"> + <style include="oobe-common-styles"> @media all and (-webkit-max-device-pixel-ratio: 1.5) { #icon2x { display: none;
diff --git a/chrome/browser/resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.js b/chrome/browser/resources/chromeos/login/components/hd_iron_icon.js similarity index 100% rename from chrome/browser/resources/chromeos/login/components/hd_iron_icon/hd_iron_icon.js rename to chrome/browser/resources/chromeos/login/components/hd_iron_icon.js
diff --git a/chrome/browser/resources/chromeos/login/components/hd_iron_icon/BUILD.gn b/chrome/browser/resources/chromeos/login/components/hd_iron_icon/BUILD.gn deleted file mode 100644 index 1b723897..0000000 --- a/chrome/browser/resources/chromeos/login/components/hd_iron_icon/BUILD.gn +++ /dev/null
@@ -1,12 +0,0 @@ -# Copyright 2020 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//third_party/closure_compiler/compile_js.gni") - -js_type_check("closure_compile") { - deps = [ ":hd_iron_icon" ] -} - -js_library("hd_iron_icon") { -}
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/README.md b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/README.md index 1bb3b1c..dd889c2a 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/README.md +++ b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/README.md
@@ -17,7 +17,7 @@ rest buttons. It is intended to use `oobe-adaptive-dialog` along with style sheets: -`<style include="oobe-dialog-host"></style>`, and add `OobeDialogHostBehavior`. +`<style include="oobe-dialog-host-styles"></style>`, and add `OobeDialogHostBehavior`. Fonts and other styling for title, subtitle and regular text is applied separately outside of the `oobe-adaptive-dialog` implementation.
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog.html index 3a9d8fb..e1f2784 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog.html
@@ -8,10 +8,11 @@ <link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/behaviors/oobe_focus_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <link rel="import" href="/components/oobe_vars/oobe_custom_vars_css.html"> <link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> -<link rel="import" href="/components/behaviors/oobe_focus_behavior.html"> <!-- Simple OOBE dialog which should be used for OOBE UI elements. @@ -24,10 +25,10 @@ focused. 2. 'show-dialog' is fired. - Please include oobe-dialog-host shared style if you use oobe-adaptive-dialog. + Please include oobe-dialog-host-styles shared style if you use oobe-adaptive-dialog. Example: - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog on-show-dialog="onTestDialogShown_" has-buttons> <iron-icon ... slot="icon"> <h1 slot="title">Title</h1> @@ -59,7 +60,7 @@ --> <dom-module id="oobe-adaptive-dialog"> <template> - <style include="oobe-dialog-host cr-shared-style"> + <style include="oobe-dialog-host-styles cr-shared-style"> /* * Please check whether `multidevice_setup/ui_page.html` needs to be * updated when below css rules are changed.
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog_old.html b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog_old.html index cfdc94a..0fb7ee76 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog_old.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_adaptive_dialog/oobe_adaptive_dialog_old.html
@@ -8,9 +8,10 @@ <link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> <link rel="import" href="/components/behaviors/oobe_focus_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> <!-- oobe-dialog wrap which is used to unify usage of oobe-adaptive-dialog during @@ -18,7 +19,7 @@ --> <dom-module id="oobe-adaptive-dialog"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-dialog id="dialog" has-buttons hide-shadow$="[[hideShadow]]" no-lazy$="[[noLazy]]" no-header$="[[noHeader]]" no-footer-padding$="[[noFooterPadding]]"
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/README.md b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/README.md index 81d94b98..598fb84 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/README.md +++ b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/README.md
@@ -16,7 +16,7 @@ rest buttons. It is intended to use `oobe-content-dialog` along with style sheets: -`<style include="oobe-dialog-host"></style>`, and add `OobeDialogHostBehavior`. +`<style include="oobe-dialog-host-styles"></style>`, and add `OobeDialogHostBehavior`. Most of the uses of `oobe-content-dialog` are hosting `webview` which usually has its own title, subtitle and icon.
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog.html index a61e40c5..2cfd6ea 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog.html
@@ -7,10 +7,11 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> <link rel="import" href="/components/behaviors/oobe_focus_behavior.html"> <link rel="import" href="/components/behaviors/oobe_scrollable_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> <!-- Simple OOBE dialog which should be used for OOBE UI elements. @@ -23,10 +24,10 @@ focused. 2. 'show-dialog' is fired. - Please include oobe-dialog-host shared style if you use oobe-content-dialog. + Please include oobe-dialog-host-styles shared style if you use oobe-content-dialog. Example: - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-content-dialog on-show-dialog="onTestDialogShown_"> <div slot="content"> <div class="focus-on-show">...</div> @@ -52,7 +53,7 @@ --> <dom-module id="oobe-content-dialog"> <template> - <style include="oobe-dialog-host cr-shared-style"> + <style include="oobe-dialog-host-styles cr-shared-style"> :host { height: var(--oobe-adaptive-dialog-height); width: var(--oobe-adaptive-dialog-width);
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog_old.html b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog_old.html index 046223424..1d175de1 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog_old.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_content_dialog/oobe_content_dialog_old.html
@@ -7,9 +7,10 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> <link rel="import" href="/components/behaviors/oobe_focus_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> <!-- oobe-dialog wrap which is used to unify usage of oobe-content-dialog during @@ -17,7 +18,7 @@ --> <dom-module id="oobe-content-dialog"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-dialog id="dialog" has-buttons="[[!noButtons]]" hide-shadow$="[[hideShadow]]" no-lazy$="[[noLazy]]" no-header no-footer-padding$="[[noFooterPadding]]"
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html index cdc0dbcf..6e9129e 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_dialog/oobe_dialog.html
@@ -8,9 +8,10 @@ <link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/behaviors/oobe_scrollable_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- Simple OOBE dialog which should be used for OOBE UI elements. @@ -23,10 +24,10 @@ focused. 2. 'show-dialog' is fired. - Please include oobe-dialog-host shared style if you use oobe-dialog. + Please include oobe-dialog-host-styles shared style if you use oobe-dialog. Example: - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-dialog on-show-dialog="onTestDialogShown_" has-buttons> <iron-icon ... slot="oobe-icon"> <h1 slot="title">Title</h1> @@ -76,10 +77,10 @@ <dom-module id="oobe-dialog"> <template> <!-- - TODO(https://crbug.com/1143666): Do not use oobe-dialog-host. - Use oobe-dialog-common instead. + TODO(https://crbug.com/1143666): Do not use oobe-dialog-host-styles. + Use oobe-common-styles instead. --> - <style include="oobe-dialog-host cr-shared-style"> + <style include="oobe-dialog-host-styles cr-shared-style"> :host { --subtitle-line-height: 18px; @apply --oobe-default-font;
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_dialog_host.css b/chrome/browser/resources/chromeos/login/components/oobe_dialog_host.css deleted file mode 100644 index b7b1831..0000000 --- a/chrome/browser/resources/chromeos/login/components/oobe_dialog_host.css +++ /dev/null
@@ -1,58 +0,0 @@ -/* Copyright 2016 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. */ - -:host(:not([hidden])) { - display: flex; - min-height: 0; -} - -:host { - background-color: white; - border-radius: 4px; - box-shadow: unset; - flex-direction: column; - height: 100%; - min-height: 0; - position: relative; - width: 100%; -} - -.oobe-illustration { - max-height: 100%; - max-width: 100%; - object-fit: contain; -} - -.oobe-tos-webview { - border: 1px solid rgb(218, 220, 224); /* #DADCE0 */ - border-radius: 4px; - box-shadow: inset 0 0 4px 4px rgba(241, 243, 244, 0.5); /* #F1F3F4 */ -} - -.oobe-form { - /* 40px distance from subtitle (oobe forms spec) - 20px of footer-container */ - padding-top: 20px; -} - -/* Center-align both vertically and horizontally */ -.content-centered { - margin: auto; -} - -/* Center-align vertically in landscape mode */ -:host-context([orientation=horizontal]) .landscape-vertical-centered { - margin: auto 0; -} - -/* Align with header in landscape mode */ -:host-context([orientation=horizontal]) .landscape-header-aligned { - padding-top: calc(var(--oobe-adaptive-dialog-header-top-padding) - + var(--oobe-adaptive-dialog-title-top-padding) - + var(--oobe-adaptive-dialog-icon-size)); -} - -/* Center-align horizontally in portrait mode */ -:host-context([orientation=vertical]) .portrait-horizontal-centered { - margin: 0 auto; -}
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_loading_dialog/oobe_loading_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_loading_dialog/oobe_loading_dialog.html index e4bcab60..9ed94f1 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_loading_dialog/oobe_loading_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_loading_dialog/oobe_loading_dialog.html
@@ -8,15 +8,16 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/oobe_content_dialog.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="oobe-loading-dialog"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> paper-spinner-lite { height: 38px; margin-bottom: 28px;
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_modal_dialog.html b/chrome/browser/resources/chromeos/login/components/oobe_modal_dialog.html index 8e0adf1..c8b12f1 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_modal_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_modal_dialog.html
@@ -7,9 +7,9 @@ <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <!-- OOBE Modal Dialog @@ -29,7 +29,7 @@ --> <dom-module id="oobe-modal-dialog"> <template> - <style include="oobe-common"> + <style include="oobe-common-styles"> :host { flex: 1 1 auto; --cr-dialog-title-slot-padding-bottom:
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_slide/oobe_slide.html b/chrome/browser/resources/chromeos/login/components/oobe_slide/oobe_slide.html index 558eba1..3558890 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_slide/oobe_slide.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_slide/oobe_slide.html
@@ -4,7 +4,7 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- Simple OOBE polymer element which is used for displaying single slide in a @@ -22,7 +22,7 @@ --> <dom-module id="oobe-slide"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host { --oobe-slide-img-size: 200px; --oobe-slide-vertical-margin: 24px;
diff --git a/chrome/browser/resources/chromeos/login/components/progress_list_item/progress_list_item.html b/chrome/browser/resources/chromeos/login/components/progress_list_item/progress_list_item.html index f9634c5e..4e723e59 100644 --- a/chrome/browser/resources/chromeos/login/components/progress_list_item/progress_list_item.html +++ b/chrome/browser/resources/chromeos/login/components/progress_list_item/progress_list_item.html
@@ -7,8 +7,8 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <!-- Element for list of tasks with tri-state icon (pending, active, completed) @@ -29,7 +29,7 @@ --> <dom-module id="progress-list-item"> <template> - <style include="oobe-common"> + <style include="oobe-common-styles"> #container { height: 56px; }
diff --git a/chrome/browser/resources/chromeos/login/device_disabled.html b/chrome/browser/resources/chromeos/login/device_disabled.html index 5dd2904..fe11d034 100644 --- a/chrome/browser/resources/chromeos/login/device_disabled.html +++ b/chrome/browser/resources/chromeos/login/device_disabled.html
@@ -6,16 +6,17 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="device-disabled-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #message { @apply --oobe-default-font; color: var(--oobe-text-color);
diff --git a/chrome/browser/resources/chromeos/login/enterprise_enrollment.html b/chrome/browser/resources/chromeos/login/enterprise_enrollment.html index 03fe38c..a4552f4 100644 --- a/chrome/browser/resources/chromeos/login/enterprise_enrollment.html +++ b/chrome/browser/resources/chromeos/login/enterprise_enrollment.html
@@ -9,20 +9,21 @@ <link rel="import" href="chrome://resources/html/action_link.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> <dom-module id="enterprise-enrollment-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> host { padding: 0; }
diff --git a/chrome/browser/resources/chromeos/login/family_link_notice.html b/chrome/browser/resources/chromeos/login/family_link_notice.html index 07537097..c004c584 100644 --- a/chrome/browser/resources/chromeos/login/family_link_notice.html +++ b/chrome/browser/resources/chromeos/login/family_link_notice.html
@@ -10,17 +10,19 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> + <dom-module id="family-link-notice-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="familyLinkDialog" role="dialog" aria-label$="[[getDialogTitle_(locale, email_, domain_)]]"> <iron-icon slot="icon" icon="oobe-32:family"></iron-icon>
diff --git a/chrome/browser/resources/chromeos/login/fingerprint_setup.html b/chrome/browser/resources/chromeos/login/fingerprint_setup.html index 99a936a9..3b0eaa5 100644 --- a/chrome/browser/resources/chromeos/login/fingerprint_setup.html +++ b/chrome/browser/resources/chromeos/login/fingerprint_setup.html
@@ -9,18 +9,20 @@ <link rel="import" href="chrome://resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> + <dom-module id="fingerprint-setup-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #sensorLocationContainer { height: 242px; width: 352px;
diff --git a/chrome/browser/resources/chromeos/login/gaia_dialog.html b/chrome/browser/resources/chromeos/login/gaia_dialog.html index 4e88ac9..7412781 100644 --- a/chrome/browser/resources/chromeos/login/gaia_dialog.html +++ b/chrome/browser/resources/chromeos/login/gaia_dialog.html
@@ -6,13 +6,14 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> +<link rel="import" href="/components/oobe_content_dialog.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/oobe_content_dialog.html"> <!-- Element which handles Gaia webview. Including action buttons, back button @@ -28,7 +29,7 @@ --> <dom-module id="gaia-dialog"> <template> - <style include="oobe-dialog-host cr-shared-style"> + <style include="oobe-dialog-host-styles cr-shared-style"> /* -- WebviewScrollShadowsHelper -- * Variables that are used for displaying scroll shadows. **/
diff --git a/chrome/browser/resources/chromeos/login/gaia_header.html b/chrome/browser/resources/chromeos/login/gaia_header.html index 6451810e..c5eaafe5 100644 --- a/chrome/browser/resources/chromeos/login/gaia_header.html +++ b/chrome/browser/resources/chromeos/login/gaia_header.html
@@ -4,7 +4,7 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <!-- Blue header for New Gaia UI, contains blue avatar logo and user email. @@ -18,7 +18,7 @@ --> <dom-module id="gaia-header"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="gaia_header.css"> <img src="chrome://theme/IDR_LOGO_AVATAR_CIRCLE_BLUE_COLOR" alt class="self-start">
diff --git a/chrome/browser/resources/chromeos/login/gaia_input_form.html b/chrome/browser/resources/chromeos/login/gaia_input_form.html index ae9eac11..bbf67c2 100644 --- a/chrome/browser/resources/chromeos/login/gaia_input_form.html +++ b/chrome/browser/resources/chromeos/login/gaia_input_form.html
@@ -4,7 +4,7 @@ <link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <!-- A simple input form with a button. Being used for typing email or password. @@ -27,7 +27,7 @@ --> <dom-module id="gaia-input-form"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="gaia_input_form.css"> <div on-keydown="onKeyDown_"> <slot id="inputs" name="inputs"></slot>
diff --git a/chrome/browser/resources/chromeos/login/gesture_navigation.html b/chrome/browser/resources/chromeos/login/gesture_navigation.html index 5e1a51e..1c2ee987 100644 --- a/chrome/browser/resources/chromeos/login/gesture_navigation.html +++ b/chrome/browser/resources/chromeos/login/gesture_navigation.html
@@ -7,18 +7,20 @@ <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> + +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="gesture-navigation-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> .gesture-animation-container { overflow: hidden; width: min(480px, var(--oobe-adaptive-dialog-content-width));
diff --git a/chrome/browser/resources/chromeos/login/marketing_opt_in.html b/chrome/browser/resources/chromeos/login/marketing_opt_in.html index bc57021..f4dc038 100644 --- a/chrome/browser/resources/chromeos/login/marketing_opt_in.html +++ b/chrome/browser/resources/chromeos/login/marketing_opt_in.html
@@ -8,21 +8,21 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> - +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_icon_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="marketing-opt-in-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #legalFooter { margin-top: 20px; }
diff --git a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html index bc3b229..7269112 100644 --- a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html +++ b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html
@@ -14,6 +14,7 @@ <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <link rel="import" href="/components/throbber_notice/throbber_notice.html"> <!-- @@ -33,7 +34,7 @@ <dom-module id="multidevice-setup-first-run"> <template> <link rel="stylesheet" href="oobe_popup_overlay.css"> - <style include="multidevice-setup-shared oobe-common"> + <style include="multidevice-setup-shared oobe-common-styles"> multidevice-setup { --multidevice-setup-width: 100%; --iron-pages-overflow: auto;
diff --git a/chrome/browser/resources/chromeos/login/notification_card.html b/chrome/browser/resources/chromeos/login/notification_card.html index ef6d6d18..57f59bc 100644 --- a/chrome/browser/resources/chromeos/login/notification_card.html +++ b/chrome/browser/resources/chromeos/login/notification_card.html
@@ -10,7 +10,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <iron-iconset-svg name="notification-card" size="24"> <svg> @@ -42,7 +42,7 @@ --> <dom-module id="notification-card"> <template> - <style include="oobe-common"></style> + <style include="oobe-common-styles"></style> <link rel="stylesheet" href="notification_card.css"> <div id="container" class="vertical layout center fit"> <div class="flex vertical layout center center-justified">
diff --git a/chrome/browser/resources/chromeos/login/offline_ad_login.html b/chrome/browser/resources/chromeos/login/offline_ad_login.html index 3ceb9019..a75419b4 100644 --- a/chrome/browser/resources/chromeos/login/offline_ad_login.html +++ b/chrome/browser/resources/chromeos/login/offline_ad_login.html
@@ -9,15 +9,16 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- Offline UI for the AD Domain joining and User authentication. @@ -55,7 +56,7 @@ --> <dom-module id="offline-ad-login-element"> <template> - <style include="md-select oobe-dialog-host"> + <style include="md-select oobe-dialog-host-styles"> .select-title { color: var(--google-grey-900); font-size: 13px;
diff --git a/chrome/browser/resources/chromeos/login/oobe_a11y_option.html b/chrome/browser/resources/chromeos/login/oobe_a11y_option.html index 9ed6a5c..1e8e6f40 100644 --- a/chrome/browser/resources/chromeos/login/oobe_a11y_option.html +++ b/chrome/browser/resources/chromeos/login/oobe_a11y_option.html
@@ -2,11 +2,11 @@ <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> -<link rel="import" href="/components/common_styles.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> <dom-module id="oobe-a11y-option"> <template> - <style include="oobe-common"> + <style include="oobe-common-styles"> :host { display: flex; min-height: 0;
diff --git a/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html b/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html index 262503d..f367394 100644 --- a/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html +++ b/chrome/browser/resources/chromeos/login/oobe_adb_sideloading_screen.html
@@ -7,17 +7,18 @@ <link rel="import" href="chrome://resources/html/action_link.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="oobe-adb-sideloading-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <!-- Dialog for normal confirmation --> <oobe-adaptive-dialog id="enableAdbSideloadDialog" role="dialog"
diff --git a/chrome/browser/resources/chromeos/login/oobe_components_resources.grdp b/chrome/browser/resources/chromeos/login/oobe_components_resources.grdp index c2636ca5..f4c29f9 100644 --- a/chrome/browser/resources/chromeos/login/oobe_components_resources.grdp +++ b/chrome/browser/resources/chromeos/login/oobe_components_resources.grdp
@@ -26,9 +26,10 @@ <include name="IDR_OOBE_COMPONENTS_MULTI_STEP_BEHAVIOR_HTML" file="components/behaviors/multi_step_behavior.html" type="chrome_html" /> <include name="IDR_OOBE_COMPONENTS_MULTI_STEP_BEHAVIOR_JS" file="components/behaviors/multi_step_behavior.js" type="chrome_html" /> - <include name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_HTML" file="components/hd_iron_icon/hd_iron_icon.html" type="chrome_html" /> - <include name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_JS" file="components/hd_iron_icon/hd_iron_icon.js" type="chrome_html" /> + <include name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_HTML" file="components/hd_iron_icon.html" type="chrome_html" /> + <include name="IDR_OOBE_COMPONENTS_HD_IRON_ICON_JS" file="components/hd_iron_icon.js" type="chrome_html" /> + <include name="IDR_OOBE_COMPONENTS_DIALOG_HOST_STYLES_HTML" file="components/common_styles/oobe_dialog_host_styles.html" type="chrome_html" /> <include name="IDR_OOBE_COMPONENTS_OOBE_DIALOG_HTML" file="components/oobe_dialog/oobe_dialog.html" type="chrome_html" /> <include name="IDR_OOBE_COMPONENTS_OOBE_DIALOG_JS" file="components/oobe_dialog/oobe_dialog.js" type="chrome_html" /> <include name="IDR_OOBE_COMPONENTS_OOBE_LOADING_DIALOG_HTML" file="components/oobe_loading_dialog/oobe_loading_dialog.html" type="chrome_html" />
diff --git a/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html b/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html index 26eb78b..5f3a918 100644 --- a/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html +++ b/chrome/browser/resources/chromeos/login/oobe_enable_kiosk.html
@@ -7,15 +7,16 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="kiosk-enable-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="dialog" role="dialog" aria-label$="[[i18nDynamic(locale, 'kioskEnableWarningText')]]"
diff --git a/chrome/browser/resources/chromeos/login/oobe_reset.html b/chrome/browser/resources/chromeos/login/oobe_reset.html index 31d9e0e..e7cb54a0 100644 --- a/chrome/browser/resources/chromeos/login/oobe_reset.html +++ b/chrome/browser/resources/chromeos/login/oobe_reset.html
@@ -9,17 +9,18 @@ <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="oobe-reset-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #reset-revert-spinner { padding-inline-end: 5px; }
diff --git a/chrome/browser/resources/chromeos/login/oobe_resources.grd b/chrome/browser/resources/chromeos/login/oobe_resources.grd index 31a7586a..57bbf207 100644 --- a/chrome/browser/resources/chromeos/login/oobe_resources.grd +++ b/chrome/browser/resources/chromeos/login/oobe_resources.grd
@@ -15,19 +15,19 @@ <structure name="IDR_OS_INSTALL_OOBE_HTML" file="oobe.html" flattenhtml="true" type="chrome_html" variables="OOBE=oobe,OS_INSTALL=os_install" expand_variables="true" /> <structure name="IDR_OOBE_JS" file="oobe.js" flattenhtml="true" type="chrome_html" /> - <structure name="IDR_CUSTOM_ELEMENTS_OOBE_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=oobe" expand_variables="true" /> - <structure name="IDR_CUSTOM_ELEMENTS_OOBE_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=oobe" expand_variables="true" /> - <structure name="IDR_CUSTOM_ELEMENTS_LOGIN_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=login" expand_variables="true" /> - <structure name="IDR_CUSTOM_ELEMENTS_LOGIN_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=login" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OOBE_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=oobe,OS_INSTALL=stub" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OOBE_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=oobe,OS_INSTALL=stub" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_LOGIN_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=login,OS_INSTALL=stub" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_LOGIN_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=login,OS_INSTALL=stub" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OS_INSTALL_OOBE_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=oobe,OS_INSTALL=os_install" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OS_INSTALL_OOBE_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=oobe,OS_INSTALL=os_install" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OS_INSTALL_LOGIN_HTML" file="structure\components_common.html" flattenhtml="true" type="chrome_html" variables="OOBE=login,OS_INSTALL=os_install" expand_variables="true" /> + <structure name="IDR_CUSTOM_ELEMENTS_OS_INSTALL_LOGIN_JS" file="structure\components_common.js" flattenhtml="true" type="chrome_html" variables="OOBE=login,OS_INSTALL=os_install" expand_variables="true" /> <structure name="IDR_OOBE_DEBUGGER_JS" file="debug\debug.js" flattenhtml="true" type="chrome_html" /> <structure name="IDR_OOBE_DEBUGGER_STUB_JS" file="debug\no_debug.js" flattenhtml="true" type="chrome_html" /> <structure name="IDR_OOBE_COMPONENTS_COMMON_STYLES_HTML" file="components/common_styles/common_styles.html" type="chrome_html" flattenhtml="true"/> - - <!-- OS install components --> - <structure name="IDR_OOBE_COMPONENTS_OS_INSTALL_HTML" file="os_install/os_install.html" type="chrome_html" /> - <structure name="IDR_OOBE_COMPONENTS_OS_INSTALL_JS" file="os_install/os_install.js" type="chrome_html" /> </structures> <includes> <!-- Resources that are served under fixed paths -->
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_autolaunch.html b/chrome/browser/resources/chromeos/login/oobe_screen_autolaunch.html index 64a5ed7b0..3b46c9c 100644 --- a/chrome/browser/resources/chromeos/login/oobe_screen_autolaunch.html +++ b/chrome/browser/resources/chromeos/login/oobe_screen_autolaunch.html
@@ -2,17 +2,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="autolaunch-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #appName { color: #404040; font-size: 22px;
diff --git a/chrome/browser/resources/chromeos/login/oobe_update.html b/chrome/browser/resources/chromeos/login/oobe_update.html index ff6488c..0a41c21 100644 --- a/chrome/browser/resources/chromeos/login/oobe_update.html +++ b/chrome/browser/resources/chromeos/login/oobe_update.html
@@ -8,22 +8,23 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_carousel/oobe_carousel.html"> -<link rel="import" href="/components/oobe_slide/oobe_slide.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_carousel/oobe_carousel.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/oobe_slide/oobe_slide.html"> <dom-module id="oobe-update-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> .progress-message { color: var(--oobe-subheader-text-color); margin-top: 32px;
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.html b/chrome/browser/resources/chromeos/login/oobe_welcome.html index 70a7f0b..d135721 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.html
@@ -10,12 +10,13 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <iron-iconset-svg name="oobe-welcome-32" size="32"> <svg> @@ -40,7 +41,7 @@ <dom-module id="oobe-welcome-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host { --oobe-dialog-list-item-border: 1px solid var(--google-grey-200); --oobe-a11y-dialog-list-item-border: 1px solid var(--google-grey-200);
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html index 4d996e0..e07730b 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html
@@ -8,13 +8,13 @@ <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lottie/cr_lottie.html"> - -<link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_icon_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <link rel="import" href="/components/oobe_dialog/oobe_dialog.html"> +<link rel="import" href="/components/oobe_vars/oobe_shared_vars_css.html"> <!-- OOBE Welcome screen @@ -66,7 +66,7 @@ <dom-module id="oobe-welcome-dialog"> <template> - <style include="cr-shared-style oobe-dialog-host"> + <style include="cr-shared-style oobe-dialog-host-styles"> :host([is-new-layout_]) { box-sizing: border-box; height: var(--oobe-adaptive-dialog-height);
diff --git a/chrome/browser/resources/chromeos/login/parental_handoff.html b/chrome/browser/resources/chromeos/login/parental_handoff.html index 50ba77c..c384e57 100644 --- a/chrome/browser/resources/chromeos/login/parental_handoff.html +++ b/chrome/browser/resources/chromeos/login/parental_handoff.html
@@ -9,17 +9,18 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="parental-handoff-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="parentalHandoffDialog" role="dialog" aria-label$="[[i18nDynamic(locale, 'parentalHandoffDialogTitle', username_)]]"> <iron-icon slot="icon" icon="oobe-32:googleg"></iron-icon>
diff --git a/chrome/browser/resources/chromeos/login/pin_setup.html b/chrome/browser/resources/chromeos/login/pin_setup.html index 08f97bd..4636c7237 100644 --- a/chrome/browser/resources/chromeos/login/pin_setup.html +++ b/chrome/browser/resources/chromeos/login/pin_setup.html
@@ -11,19 +11,20 @@ <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="pin-setup-element"> <template> - <style include="cr-shared-style oobe-dialog-host"> + <style include="cr-shared-style oobe-dialog-host-styles"> setup-pin-keyboard { margin-top: 37px; }
diff --git a/chrome/browser/resources/chromeos/login/recommend_apps.html b/chrome/browser/resources/chromeos/login/recommend_apps.html index 9888645..8c66360 100644 --- a/chrome/browser/resources/chromeos/login/recommend_apps.html +++ b/chrome/browser/resources/chromeos/login/recommend_apps.html
@@ -6,17 +6,18 @@ <link rel="import" href="chrome://resources/cr_elements/cr_checkbox/cr_checkbox.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/throbber_notice/throbber_notice.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/throbber_notice/throbber_notice.html"> <dom-module id="recommend-apps-element"> <template> - <style include="oobe-dialog-host action-link"> + <style include="oobe-dialog-host-styles action-link"> #skipButton { color: rgba(0, 0, 0, 0.54); padding-inline-end: 6px;
diff --git a/chrome/browser/resources/chromeos/login/saml_confirm_password.html b/chrome/browser/resources/chromeos/login/saml_confirm_password.html index 53ff1aa..6d17bcf 100644 --- a/chrome/browser/resources/chromeos/login/saml_confirm_password.html +++ b/chrome/browser/resources/chromeos/login/saml_confirm_password.html
@@ -9,15 +9,16 @@ <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <!-- SAML password confirmation UI for the Gaia flow. @@ -27,7 +28,7 @@ --> <dom-module id="saml-confirm-password-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> </style> <style include="cr-shared-style"> #cancelConfirmDlg {
diff --git a/chrome/browser/resources/chromeos/login/screen_error_message.html b/chrome/browser/resources/chromeos/login/screen_error_message.html index 032c7c8..309efbf1 100644 --- a/chrome/browser/resources/chromeos/login/screen_error_message.html +++ b/chrome/browser/resources/chromeos/login/screen_error_message.html
@@ -6,15 +6,17 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> + <dom-module id="error-message-element"> <template> - <style include="oobe-common action-link"> + <style include="oobe-common-styles action-link"> .scrollable { overflow: auto; }
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.html b/chrome/browser/resources/chromeos/login/screen_gaia_signin.html index e0b77ea..08b056f 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.html +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.html
@@ -8,20 +8,21 @@ <link rel="import" href="chrome://resources/html/action_link.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/throbber_notice/throbber_notice.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/throbber_notice/throbber_notice.html"> <dom-module id="gaia-signin-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> [transparent] { opacity: 0; }
diff --git a/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html b/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html index 4880a1a..98bc936 100644 --- a/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html +++ b/chrome/browser/resources/chromeos/login/screen_signin_fatal_error.html
@@ -7,17 +7,18 @@ <link rel="import" href="chrome://resources/html/action_link.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="signin-fatal-error-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> </style> <oobe-adaptive-dialog id="signinFatalErrorDialog" role="dialog"> <iron-icon slot="icon" icon="oobe-32:alert"></iron-icon>
diff --git a/chrome/browser/resources/chromeos/login/screen_tpm_error.html b/chrome/browser/resources/chromeos/login/screen_tpm_error.html index f3451934..d330749 100644 --- a/chrome/browser/resources/chromeos/login/screen_tpm_error.html +++ b/chrome/browser/resources/chromeos/login/screen_tpm_error.html
@@ -9,17 +9,18 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="tpm-error-message-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="errorDialog" role="dialog" aria-label$="[[i18nDynamic(locale, 'errorTpmFailureTitle')]]"> <iron-icon slot="icon" icon="oobe-32:warning"></iron-icon>
diff --git a/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html b/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html index b337248..522d85f 100644 --- a/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html +++ b/chrome/browser/resources/chromeos/login/screen_wrong_hwid.html
@@ -6,17 +6,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="wrong-hwid-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog role="dialog"> <iron-icon slot="icon" icon="oobe-32:warning"></iron-icon> <h1 slot="title">
diff --git a/chrome/browser/resources/chromeos/login/os_install/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn similarity index 71% rename from chrome/browser/resources/chromeos/login/os_install/BUILD.gn rename to chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 22fc9a08..2749fe6 100644 --- a/chrome/browser/resources/chromeos/login/os_install/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn
@@ -11,7 +11,7 @@ group("closure_compile") { deps = [ ":closure_compile_local", - "../components:closure_compile", + "../../components:closure_compile", ] } @@ -25,9 +25,9 @@ js_library("os_install") { deps = [ - "../components/behaviors:login_screen_behavior", - "../components/behaviors:multi_step_behavior", - "../components/behaviors:oobe_dialog_host_behavior", - "../components/behaviors:oobe_i18n_behavior", + "../../components/behaviors:login_screen_behavior", + "../../components/behaviors:multi_step_behavior", + "../../components/behaviors:oobe_dialog_host_behavior", + "../../components/behaviors:oobe_i18n_behavior", ] }
diff --git a/chrome/browser/resources/chromeos/login/os_install/os_install.html b/chrome/browser/resources/chromeos/login/screens/common/os_install.html similarity index 95% rename from chrome/browser/resources/chromeos/login/os_install/os_install.html rename to chrome/browser/resources/chromeos/login/screens/common/os_install.html index cf050a6..c22a2398 100644 --- a/chrome/browser/resources/chromeos/login/os_install/os_install.html +++ b/chrome/browser/resources/chromeos/login/screens/common/os_install.html
@@ -7,17 +7,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://oobe/custom_elements.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="os-install-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="osInstallDialogIntro" role="dialog" for-step="intro" @@ -100,5 +101,4 @@ </div> </oobe-adaptive-dialog> </template> - <script src="os_install.js"></script> </dom-module>
diff --git a/chrome/browser/resources/chromeos/login/os_install/os_install.js b/chrome/browser/resources/chromeos/login/screens/common/os_install.js similarity index 100% rename from chrome/browser/resources/chromeos/login/os_install/os_install.js rename to chrome/browser/resources/chromeos/login/screens/common/os_install.js
diff --git a/chrome/browser/resources/chromeos/login/screens/login/active_directory_password_change.html b/chrome/browser/resources/chromeos/login/screens/login/active_directory_password_change.html index e441fcc..48fd10a 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/active_directory_password_change.html +++ b/chrome/browser/resources/chromeos/login/screens/login/active_directory_password_change.html
@@ -8,16 +8,18 @@ <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> + <!-- Offline UI for the Active Directory password change. @@ -30,7 +32,7 @@ --> <dom-module id="active-directory-password-change-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host-context([new-layout]) cr-input { padding-inline-end: 24px; padding-inline-start: 24px;
diff --git a/chrome/browser/resources/chromeos/login/screens/login/encryption_migration.html b/chrome/browser/resources/chromeos/login/screens/login/encryption_migration.html index 0c9e789..8ff0bd8 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/encryption_migration.html +++ b/chrome/browser/resources/chromeos/login/screens/login/encryption_migration.html
@@ -9,17 +9,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="encryption-migration-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> paper-progress { --paper-progress-active-color: var(--google-blue-500); height: 3px;
diff --git a/chrome/browser/resources/chromeos/login/screens/login/gaia_password_changed.html b/chrome/browser/resources/chromeos/login/screens/login/gaia_password_changed.html index d76bb0a..e614cf5 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/gaia_password_changed.html +++ b/chrome/browser/resources/chromeos/login/screens/login/gaia_password_changed.html
@@ -7,15 +7,16 @@ <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <!-- Password changed UI for the Gaia flow. @@ -34,7 +35,7 @@ --> <dom-module id="gaia-password-changed-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog role="dialog" for-step="password" id="passwordStep"> <iron-icon slot="icon" icon="oobe-32:avatar"></iron-icon> <h1 slot="title">[[email]]</h1>
diff --git a/chrome/browser/resources/chromeos/login/screens/login/management_transition.html b/chrome/browser/resources/chromeos/login/screens/login/management_transition.html index 83967bb..53026ff 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/management_transition.html +++ b/chrome/browser/resources/chromeos/login/screens/login/management_transition.html
@@ -4,15 +4,16 @@ <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="management-transition-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> paper-progress { --paper-progress-active-color: rgb(66, 133, 244); /*#4285F4*/ --paper-progress-container-color: rgb(206, 224, 252); /*#CEE0FC*/
diff --git a/chrome/browser/resources/chromeos/login/screens/login/offline_login.html b/chrome/browser/resources/chromeos/login/screens/login/offline_login.html index fe92d2a..f970f1e 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/offline_login.html +++ b/chrome/browser/resources/chromeos/login/screens/login/offline_login.html
@@ -9,12 +9,13 @@ <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> +<link rel="import" href="/components/oobe_content_dialog.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/oobe_content_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- Offline UI for the Login flow. @@ -47,7 +48,7 @@ --> <dom-module id="offline-login-element"> <template> - <style include="cr-shared-style oobe-dialog-host"> + <style include="cr-shared-style oobe-dialog-host-styles"> :host { --offline-login-dialog-width: 100%; --offline-login-animation-margin: 50%;
diff --git a/chrome/browser/resources/chromeos/login/screens/login/public_session_terms_of_service.html b/chrome/browser/resources/chromeos/login/screens/login/public_session_terms_of_service.html index 13877d4..94b6009 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/public_session_terms_of_service.html +++ b/chrome/browser/resources/chromeos/login/screens/login/public_session_terms_of_service.html
@@ -9,21 +9,22 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/throbber_notice/throbber_notice.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/throbber_notice/throbber_notice.html"> <dom-module id="terms-of-service-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <link rel="stylesheet" href="chrome://resources/css/throbber.css"> <!-- ERROR DIALOG -->
diff --git a/chrome/browser/resources/chromeos/login/screens/login/update_required_card.html b/chrome/browser/resources/chromeos/login/screens/login/update_required_card.html index 7dd51700..4408b67 100644 --- a/chrome/browser/resources/chromeos/login/screens/login/update_required_card.html +++ b/chrome/browser/resources/chromeos/login/screens/login/update_required_card.html
@@ -4,17 +4,18 @@ <link rel="import" href="chrome://resources/html/polymer.html"> +<link rel="import" href="chrome://resources/html/parse_html_subset.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="chrome://resources/html/parse_html_subset.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <!-- Update required card that informs user that current chromeos version does not @@ -24,7 +25,7 @@ --> <dom-module id="update-required-card-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host .content { padding: 24px 24px 16px; }
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html index d28f4a7a..0ba0d7b 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html
@@ -4,18 +4,19 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="demo-preferences-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host { --oobe-dialog-list-item-border: 1px solid rgb(235,235,235); /*#EBEBEB*/ --oobe-a11y-dialog-list-item-border: 1px solid var(--google-grey-200);
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/demo_setup.html b/chrome/browser/resources/chromeos/login/screens/oobe/demo_setup.html index 23d482b..96b0ddc 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/demo_setup.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/demo_setup.html
@@ -2,20 +2,21 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/progress_list_item/progress_list_item.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/progress_list_item/progress_list_item.html"> <dom-module id="demo-setup-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="demoSetupProgressDialog" role="dialog" aria-label$="[[i18nDynamic(locale, 'demoSetupProgressScreenTitle')]]" for-step="progress">
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/enable_debugging.html b/chrome/browser/resources/chromeos/login/screens/oobe/enable_debugging.html index 51f0082e..0952b489 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/enable_debugging.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/enable_debugging.html
@@ -9,18 +9,19 @@ <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <dom-module id="oobe-debugging-element"> <template> - <style include="oobe-dialog-host action-link"> + <style include="oobe-dialog-host-styles action-link"> #password-note { color: #c6c6c6; font-size: 12px;
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/hid_detection.html b/chrome/browser/resources/chromeos/login/screens/oobe/hid_detection.html index fbe3e5d..54778a5 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/hid_detection.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/hid_detection.html
@@ -4,12 +4,13 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <iron-iconset-svg name="oobe-hid-detection-20" size="20"> <svg> @@ -57,7 +58,7 @@ <dom-module id="hid-detection-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> .hid-selection-entry { border-bottom: 1px solid var(--google-grey-200); color: var(--google-grey-900);
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/oobe_eula.html b/chrome/browser/resources/chromeos/login/screens/oobe/oobe_eula.html index 3a15cf81..fa6d8ba 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/oobe_eula.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/oobe_eula.html
@@ -10,18 +10,19 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="oobe-eula-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> a { color: var(--google-blue-500); text-decoration: none;
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/oobe_network.html b/chrome/browser/resources/chromeos/login/screens/oobe/oobe_network.html index 11d91ef3..3dadcce 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/oobe_network.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/oobe_network.html
@@ -4,17 +4,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="oobe-network-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> network-select-login { --cr-network-row-height: var(--oobe-network-row-height); }
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/packaged_license.html b/chrome/browser/resources/chromeos/login/screens/oobe/packaged_license.html index fdb7e32..ec3d4e8 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/packaged_license.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/packaged_license.html
@@ -10,17 +10,18 @@ <link rel="import" href="chrome://oobe/custom_elements.html"> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/login_screen_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="packaged-license-element"> <template> - <style include="oobe-dialog-host"></style> + <style include="oobe-dialog-host-styles"></style> <oobe-adaptive-dialog id="packagedLicenseDialog" aria-label$="[[i18nDynamic(locale, 'oobePackagedLicenseTitle')]]" role="dialog">
diff --git a/chrome/browser/resources/chromeos/login/security_token_pin.html b/chrome/browser/resources/chromeos/login/security_token_pin.html index c505cfbd..dbd912c 100644 --- a/chrome/browser/resources/chromeos/login/security_token_pin.html +++ b/chrome/browser/resources/chromeos/login/security_token_pin.html
@@ -7,17 +7,18 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> +<link rel="import" href="/components/oobe_adaptive_dialog.html"> +<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/buttons/oobe_back_button.html"> <link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> <dom-module id="security-token-pin"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> #pinKeyboardContainer { margin-top: 30px; position: relative;
diff --git a/chrome/browser/resources/chromeos/login/structure/components_common.html b/chrome/browser/resources/chromeos/login/structure/components_common.html index 506300f..7f82220fc2 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_common.html +++ b/chrome/browser/resources/chromeos/login/structure/components_common.html
@@ -5,8 +5,8 @@ <!-- Common components --> <link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> <link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/hd_iron_icon/hd_iron_icon.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/hd_iron_icon.html"> <include src="../components/oobe_modal_dialog.html"> <include src="../components/html-echo.html"> @@ -56,5 +56,6 @@ <include src="../screen_error_message.html"> <include src="components_[OOBE].html"> +<include src="components_[OS_INSTALL].html"> <script src="chrome://oobe/custom_elements.js"></script>
diff --git a/chrome/browser/resources/chromeos/login/structure/components_common.js b/chrome/browser/resources/chromeos/login/structure/components_common.js index 43c9a11..821a1c9 100644 --- a/chrome/browser/resources/chromeos/login/structure/components_common.js +++ b/chrome/browser/resources/chromeos/login/structure/components_common.js
@@ -53,6 +53,7 @@ // <include src="../screen_error_message.js"> // <include src="components_[OOBE].js"> +// <include src="components_[OS_INSTALL].js"> // TODO(crbug.com/1111387) - Remove excessive logging. console.warn('loadCommonComponents() : Common components have loaded.'); }
diff --git a/chrome/browser/resources/chromeos/login/structure/components_os_install.html b/chrome/browser/resources/chromeos/login/structure/components_os_install.html new file mode 100644 index 0000000..2abf6e05 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/structure/components_os_install.html
@@ -0,0 +1,7 @@ +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<!-- Components that appear as a part of os install flow only --> + +<include src="../screens/common/os_install.html">
diff --git a/chrome/browser/resources/chromeos/login/structure/components_os_install.js b/chrome/browser/resources/chromeos/login/structure/components_os_install.js new file mode 100644 index 0000000..1b8b6d9 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/structure/components_os_install.js
@@ -0,0 +1,7 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// clang-format off + +// <include src="../screens/common/os_install.js">
diff --git a/chrome/browser/resources/chromeos/login/structure/components_stub.html b/chrome/browser/resources/chromeos/login/structure/components_stub.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/structure/components_stub.html
diff --git a/chrome/browser/resources/chromeos/login/structure/components_stub.js b/chrome/browser/resources/chromeos/login/structure/components_stub.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/structure/components_stub.js
diff --git a/chrome/browser/resources/chromeos/login/structure/screens_os_install.html b/chrome/browser/resources/chromeos/login/structure/screens_os_install.html index dba13f56..76d14057 100644 --- a/chrome/browser/resources/chromeos/login/structure/screens_os_install.html +++ b/chrome/browser/resources/chromeos/login/structure/screens_os_install.html
@@ -2,8 +2,6 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -<link rel="import" href="/os_install/os_install.html"> - <!-- Screens that can appear in OS install mode --> <os-install-element id="os-install" class="step hidden" hidden> </os-install-element>
diff --git a/chrome/browser/resources/chromeos/login/sync_consent.html b/chrome/browser/resources/chromeos/login/sync_consent.html index 761c337..134d3fd 100644 --- a/chrome/browser/resources/chromeos/login/sync_consent.html +++ b/chrome/browser/resources/chromeos/login/sync_consent.html
@@ -10,19 +10,20 @@ <link rel="import" href="chrome://oobe/sync-consent-icons.html"> </if> -<link rel="import" href="/components/buttons/oobe_text_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/hd_iron_icon/hd_iron_icon.html"> +<link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_text_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> +<link rel="import" href="/components/oobe_loading_dialog/oobe_loading_dialog.html"> <dom-module id="sync-consent-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :root { color: #333; }
diff --git a/chrome/browser/resources/chromeos/login/user_creation.html b/chrome/browser/resources/chromeos/login/user_creation.html index cea4969..9a363c7 100644 --- a/chrome/browser/resources/chromeos/login/user_creation.html +++ b/chrome/browser/resources/chromeos/login/user_creation.html
@@ -9,20 +9,22 @@ <link rel="import" href="chrome://resources/html/action_link.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> -<link rel="import" href="/components/buttons/oobe_back_button.html"> -<link rel="import" href="/components/buttons/oobe_next_button.html"> -<link rel="import" href="/components/common_styles.html"> -<link rel="import" href="/components/hd_iron_icon/hd_iron_icon.html"> +<link rel="import" href="/components/hd_iron_icon.html"> <link rel="import" href="/components/oobe_adaptive_dialog.html"> -<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/oobe_icons.html"> <link rel="import" href="/components/behaviors/login_screen_behavior.html"> <link rel="import" href="/components/behaviors/multi_step_behavior.html"> -<link rel="import" href="/components/oobe_icons.html"> +<link rel="import" href="/components/behaviors/oobe_dialog_host_behavior.html"> +<link rel="import" href="/components/behaviors/oobe_i18n_behavior.html"> +<link rel="import" href="/components/buttons/oobe_back_button.html"> +<link rel="import" href="/components/buttons/oobe_next_button.html"> +<link rel="import" href="/components/common_styles/common_styles.html"> +<link rel="import" href="/components/common_styles/oobe_dialog_host_styles.html"> + <dom-module id="user-creation-element"> <template> - <style include="oobe-dialog-host"> + <style include="oobe-dialog-host-styles"> :host { --radio-button-height: 120px; }
diff --git a/chrome/browser/resources/safe_browsing/README.md b/chrome/browser/resources/safe_browsing/README.md index 2e915811..81b6a67 100644 --- a/chrome/browser/resources/safe_browsing/README.md +++ b/chrome/browser/resources/safe_browsing/README.md
@@ -16,7 +16,7 @@ * Wait 1-3 day for this to run on Canary to verify it doesn't crash Chrome. * In a synced checkout, run the following to generate protos for all platforms and push them to GCS. Replace the arg with your build directory: - * % `components/safe_browsing/core/resources/push_file_type_proto.py -d + * % `components/safe_browsing/content/resources/push_file_type_proto.py -d out-gn/Debug` * It will ask you to double check its actions before proceeding. It will fail if you're not a member of @@ -42,7 +42,7 @@ * **Upload** the new version of the file types. * In a synced checkout, run the following to generate protos for all platforms and push them to GCS. Replace the arg with your build directory: - * % `components/safe_browsing/core/resources/push_file_type_proto.py -d + * % `components/safe_browsing/content/resources/push_file_type_proto.py -d out-gn/Debug` * Create a new cohort. * Under _Cohorts_, click _Manage_, then _Create Subcohort_ of Auto.
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request_unittest.cc b/chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request_unittest.cc index 78891ff3..363e62b 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request_unittest.cc +++ b/chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request_unittest.cc
@@ -415,8 +415,8 @@ base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - std::string normal_contents = "Normal file contents"; - base::FilePath file_path = temp_dir.GetPath().AppendASCII("normal.xyz"); + std::string normal_contents = "\x89PNG\x0D\x0A\x1A\x0A"; + base::FilePath file_path = temp_dir.GetPath().AppendASCII("normal.png"); base::WriteFile(file_path, normal_contents.data(), normal_contents.size()); auto request = MakeRequest(/*block_unsupported_types=*/true, file_path, @@ -446,11 +446,11 @@ EXPECT_TRUE(data.contents.empty()); EXPECT_EQ(file_path, data.path); EXPECT_EQ(data.size, normal_contents.size()); - // printf "Normal file contents" | sha256sum | tr '[:lower:]' '[:upper:]' + // printf "\x89PNG\x0D\x0A\x1A\x0A" | sha256sum | tr '[:lower:]' '[:upper:]' EXPECT_EQ(data.hash, - "29644C10BD036866FCFD2BDACFF340DB5DE47A90002D6AB0C42DE6A22C26158B"); + "4C4B6A3BE1314AB86138BEF4314DDE022E600960D8689A2C8F8631802D20DAB6"); EXPECT_EQ(request->digest(), data.hash); - EXPECT_EQ("text/plain", data.mime_type) + EXPECT_EQ("image/png", data.mime_type) << data.mime_type << " is not an expected mimetype"; } @@ -459,8 +459,8 @@ base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - std::string normal_contents = "Normal file contents"; - base::FilePath file_path = temp_dir.GetPath().AppendASCII("normal.xyz"); + std::string normal_contents = "\x89PNG\x0D\x0A\x1A\x0A"; + base::FilePath file_path = temp_dir.GetPath().AppendASCII("normal.png"); base::WriteFile(file_path, normal_contents.data(), normal_contents.size()); auto request = MakeRequest(/*block_unsupported_types=*/false, file_path, @@ -492,11 +492,11 @@ EXPECT_TRUE(data.contents.empty()); EXPECT_EQ(file_path, data.path); EXPECT_EQ(data.size, normal_contents.size()); - // printf "Normal file contents" | sha256sum | tr '[:lower:]' '[:upper:]' + // printf "\x89PNG\x0D\x0A\x1A\x0A" | sha256sum | tr '[:lower:]' '[:upper:]' EXPECT_EQ(data.hash, - "29644C10BD036866FCFD2BDACFF340DB5DE47A90002D6AB0C42DE6A22C26158B"); + "4C4B6A3BE1314AB86138BEF4314DDE022E600960D8689A2C8F8631802D20DAB6"); EXPECT_EQ(request->digest(), data.hash); - EXPECT_EQ("text/plain", data.mime_type) + EXPECT_EQ("image/png", data.mime_type) << data.mime_type << " is not an expected mimetype"; }
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc index 4dbde2e..ff25b2d 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc
@@ -667,7 +667,7 @@ result->set_status( enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS); ExpectContentAnalysisSynchronousResponse(/*is_advanced_protection=*/false, - sync_response, {"dlp", "malware"}); + sync_response, {"dlp"}); GURL url = embedded_test_server()->GetURL( "/safe_browsing/download_protection/signed.exe"); @@ -675,6 +675,7 @@ browser(), url, WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + WaitForDeepScanRequest(/*is_advanced_protection=*/false); WaitForDownloadToFinish(); // The file should be blocked.
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 6ddaaf4..b247fb20 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -62,7 +62,6 @@ #include "components/reputation/core/safety_tip_test_utils.h" #include "components/safe_browsing/content/browser/threat_details.h" #include "components/safe_browsing/content/common/safe_browsing.mojom.h" -#include "components/safe_browsing/content/renderer/threat_dom_details.h" #include "components/safe_browsing/core/browser/db/database_manager.h" #include "components/safe_browsing/core/browser/db/fake_database_manager.h" #include "components/safe_browsing/core/browser/db/util.h" @@ -443,8 +442,11 @@ public: SafeBrowsingBlockingPageBrowserTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { + // NOTE: Value copied from the renderer-side threat_dom_details.cc, as + // threat_dom_details.h can't be depended on from this browser-side code. + const char kTagAndAttributeParamName[] = "tag_attribute_csv"; std::map<std::string, std::string> parameters = { - {safe_browsing::kTagAndAttributeParamName, "div,foo,div,baz"}}; + {kTagAndAttributeParamName, "div,foo,div,baz"}}; base::test::ScopedFeatureList::FeatureAndParams tag_and_attribute( safe_browsing::kThreatDomDetailsTagAndAttributeFeature, parameters); scoped_feature_list_.InitWithFeaturesAndParameters({tag_and_attribute}, {});
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc index 34e7739..c501564 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc
@@ -161,15 +161,13 @@ TEST_F(SBNavigationObserverTest, BasicNavigationAndCommit) { // Navigation in current tab. - content::NavigationController* controller = - &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); + auto* web_contents = browser()->tab_strip_model()->GetWebContentsAt(0); browser()->OpenURL( content::OpenURLParams(GURL("http://foo/1"), content::Referrer(), WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); - CommitPendingLoad(controller); - SessionID tab_id = - sessions::SessionTabHelper::IdForTab(controller->GetWebContents()); + CommitPendingLoad(&web_contents->GetController()); + SessionID tab_id = sessions::SessionTabHelper::IdForTab(web_contents); auto* nav_list = navigation_event_list(); ASSERT_EQ(1U, nav_list->NavigationEventsSize()); VerifyNavigationEvent(GURL(), // source_url
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc index d4a8e871..d455b05 100644 --- a/chrome/browser/safe_browsing/ui_manager_unittest.cc +++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -344,7 +344,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDone, base::Unretained(&waiter)); - resource.callback_thread = content::GetUIThreadTaskRunner({}); + resource.callback_sequence = content::GetUIThreadTaskRunner({}); std::vector<security_interstitials::UnsafeResource> resources; resources.push_back(resource); SimulateBlockingPageDone(resources, true); @@ -367,7 +367,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDone, base::Unretained(&waiter)); - resource.callback_thread = content::GetUIThreadTaskRunner({}); + resource.callback_sequence = content::GetUIThreadTaskRunner({}); std::vector<security_interstitials::UnsafeResource> resources; resources.push_back(resource); SimulateBlockingPageDone(resources, false); @@ -390,7 +390,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDoneOnIO, base::Unretained(&waiter)); - resource.callback_thread = content::GetIOThreadTaskRunner({}); + resource.callback_sequence = content::GetIOThreadTaskRunner({}); std::vector<security_interstitials::UnsafeResource> resources; resources.push_back(resource); SimulateBlockingPageDone(resources, true); @@ -413,7 +413,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDoneOnIO, base::Unretained(&waiter)); - resource.callback_thread = content::GetIOThreadTaskRunner({}); + resource.callback_sequence = content::GetIOThreadTaskRunner({}); std::vector<security_interstitials::UnsafeResource> resources; resources.push_back(resource); SimulateBlockingPageDone(resources, false); @@ -537,7 +537,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDoneOnIO, base::Unretained(&waiter)); - resource.callback_thread = content::GetIOThreadTaskRunner({}); + resource.callback_sequence = content::GetIOThreadTaskRunner({}); std::vector<security_interstitials::UnsafeResource> resources; resources.push_back(resource); @@ -599,7 +599,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingCallbackWaiter::OnBlockingPageDone, base::Unretained(&waiter)); - resource.callback_thread = content::GetUIThreadTaskRunner({}); + resource.callback_sequence = content::GetUIThreadTaskRunner({}); SafeBrowsingUIManager::StartDisplayingBlockingPage(ui_manager(), resource); waiter.WaitForCallback(); EXPECT_FALSE(waiter.proceed());
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 20a5ce7c..74126f3 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -310,7 +310,7 @@ case content::NOTIFICATION_LOAD_START: { content::NavigationController* controller = content::Source<content::NavigationController>(source).ptr(); - web_contents_.push_back(controller->GetWebContents()); + web_contents_.push_back(controller->DeprecatedGetWebContents()); if (web_contents_.size() == num_tabs_) message_loop_runner_->Quit(); break;
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index 79612b4c..b0b6f12d 100644 --- a/chrome/browser/sessions/tab_restore_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -269,7 +269,7 @@ void EnsureTabFinishedRestoring(content::WebContents* tab) { content::NavigationController* controller = &tab->GetController(); if (!controller->NeedsReload() && !controller->GetPendingEntry() && - !controller->GetWebContents()->IsLoading()) + !tab->IsLoading()) return; content::WindowedNotificationObserver observer(
diff --git a/chrome/browser/share/android/java/res/drawable/webnote.xml b/chrome/browser/share/android/java/res/drawable/webnote.xml index 64dccec0..79cccdb 100644 --- a/chrome/browser/share/android/java/res/drawable/webnote.xml +++ b/chrome/browser/share/android/java/res/drawable/webnote.xml
@@ -3,9 +3,8 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" - android:tint="?attr/colorControlNormal" android:autoMirrored="true"> <path - android:fillColor="@android:color/white" + android:fillColor="@color/default_icon_color" android:pathData="M4,20h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2zM5,13v-2h14v2L5,13zM15,7v2L5,9L5,7h10zM19,15v2L5,17v-2h14z"/> </vector>
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java index c651c9e..1232f9c 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java
@@ -440,7 +440,7 @@ private FirstPartyOption createWebNotesStylizeFirstPartyOption() { String title = mTabProvider.get().getTitle(); return new FirstPartyOptionBuilder(ContentType.HIGHLIGHTED_TEXT) - .setIcon(R.drawable.webnote, R.string.sharing_webnotes_stylized) + .setIcon(R.drawable.webnote, R.string.sharing_webnotes_create_card) .setFeatureNameForMetrics("SharingHubAndroid.WebnotesStylize") .setOnClickCallback((view) -> { NoteCreationCoordinator coordinator = NoteCreationCoordinatorFactory.create(
diff --git a/chrome/browser/sharing/sharing_sync_preference.cc b/chrome/browser/sharing/sharing_sync_preference.cc index 03b80f9..d5f3537 100644 --- a/chrome/browser/sharing/sharing_sync_preference.cc +++ b/chrome/browser/sharing/sharing_sync_preference.cc
@@ -36,13 +36,13 @@ const char kSharingInfoSenderIdTargetInfo[] = "sender_id_target_info"; const char kSharingInfoEnabledFeatures[] = "enabled_features"; -base::DictionaryValue TargetInfoToValue( +base::Value TargetInfoToValue( const syncer::DeviceInfo::SharingTargetInfo& target_info) { std::string base64_p256dh, base64_auth_secret; base::Base64Encode(target_info.p256dh, &base64_p256dh); base::Base64Encode(target_info.auth_secret, &base64_auth_secret); - base::DictionaryValue result; + base::Value result(base::Value::Type::DICTIONARY); result.SetStringKey(kDeviceFcmToken, target_info.fcm_token); result.SetStringKey(kDeviceP256dh, base64_p256dh); result.SetStringKey(kDeviceAuthSecret, base64_auth_secret); @@ -112,13 +112,15 @@ absl::optional<std::vector<uint8_t>> SharingSyncPreference::GetVapidKey() const { - const base::DictionaryValue* vapid_key = - prefs_->GetDictionary(prefs::kSharingVapidKey); - std::string base64_private_key, private_key; - if (!vapid_key->GetString(kVapidECPrivateKey, &base64_private_key)) + const base::Value* vapid_key = prefs_->GetDictionary(prefs::kSharingVapidKey); + const std::string* base64_private_key = + vapid_key->FindStringKey(kVapidECPrivateKey); + + if (!base64_private_key) return absl::nullopt; - if (base::Base64Decode(base64_private_key, &private_key)) { + std::string private_key; + if (base::Base64Decode(*base64_private_key, &private_key)) { return std::vector<uint8_t>(private_key.begin(), private_key.end()); } else { LOG(ERROR) << "Could not decode stored vapid keys."; @@ -152,7 +154,7 @@ absl::optional<SharingSyncPreference::FCMRegistration> SharingSyncPreference::GetFCMRegistration() const { - const base::DictionaryValue* registration = + const base::Value* registration = prefs_->GetDictionary(prefs::kSharingFCMRegistration); const std::string* authorized_entity_ptr = registration->FindStringKey(kRegistrationAuthorizedEntity); @@ -198,12 +200,12 @@ if (device_info->sharing_info() == sharing_info) return; - base::DictionaryValue vapid_target_info = + base::Value vapid_target_info = TargetInfoToValue(sharing_info.vapid_target_info); - base::DictionaryValue sender_id_target_info = + base::Value sender_id_target_info = TargetInfoToValue(sharing_info.sender_id_target_info); - base::ListValue list_value; + base::Value list_value(base::Value::Type::LIST); for (SharingSpecificFields::EnabledFeatures feature : sharing_info.enabled_features) { list_value.Append(feature); @@ -237,7 +239,7 @@ // static absl::optional<syncer::DeviceInfo::SharingInfo> SharingSyncPreference::GetLocalSharingInfoForSync(PrefService* prefs) { - const base::DictionaryValue* registration = + const base::Value* registration = prefs->GetDictionary(prefs::kSharingLocalSharingInfo); const base::Value* vapid_target_info_value =
diff --git a/chrome/browser/sync/test/integration/password_manager_sync_test.cc b/chrome/browser/sync/test/integration/password_manager_sync_test.cc index c9f5c86..2aab82c 100644 --- a/chrome/browser/sync/test/integration/password_manager_sync_test.cc +++ b/chrome/browser/sync/test/integration/password_manager_sync_test.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_features_util.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" #include "components/password_manager/core/browser/password_store_factory_util.h" @@ -253,6 +254,12 @@ form.username_value = base::UTF8ToUTF16(username); form.password_value = base::UTF8ToUTF16(password); form.date_created = base::Time::Now(); + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = + base::flat_map<password_manager::InsecureType, + password_manager::InsecurityMetadata>(); return form; }
diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index 9ba20b1..a04b908 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "components/password_manager/core/browser/insecure_credentials_consumer.h" +#include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" #include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store_consumer.h" @@ -387,6 +388,11 @@ base::ASCIIToUTF16(base::StringPrintf("password%d", index)); form.date_created = base::Time::Now(); form.in_store = password_manager::PasswordForm::Store::kProfileStore; + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<password_manager::InsecureType, + password_manager::InsecurityMetadata>(); return form; }
diff --git a/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc index c05f18b6..08c5b79 100644 --- a/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc
@@ -9,16 +9,13 @@ #include "chrome/browser/sync/test/integration/passwords_helper.h" #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" -#include "components/password_manager/core/browser/password_store.h" +#include "components/password_manager/core/browser/password_store_interface.h" #include "content/public/test/browser_test.h" #include "testing/perf/perf_result_reporter.h" -using passwords_helper::AddLogin; using passwords_helper::CreateTestPasswordForm; using passwords_helper::GetPasswordCount; -using passwords_helper::GetPasswordStore; using passwords_helper::GetProfilePasswordStoreInterface; -using passwords_helper::UpdateLogin; using sync_timing_helper::TimeUntilQuiescence; static const int kNumPasswords = 150; @@ -66,8 +63,11 @@ void PasswordsSyncPerfTest::AddLogins(int profile, int num_logins) { for (int i = 0; i < num_logins; ++i) { - AddLogin(GetPasswordStore(profile), NextLogin()); + GetProfilePasswordStoreInterface(profile)->AddLogin(NextLogin()); } + // Don't proceed before all additions happen on the background thread. + // Call GetPasswordCount() because it blocks on the background thread. + GetPasswordCount(profile); } void PasswordsSyncPerfTest::UpdateLogins(int profile) { @@ -75,12 +75,18 @@ passwords_helper::GetLogins(GetProfilePasswordStoreInterface(profile)); for (auto& login : logins) { login->password_value = base::ASCIIToUTF16(NextPassword()); - UpdateLogin(GetPasswordStore(profile), *login); + GetProfilePasswordStoreInterface(profile)->UpdateLogin(*login); } + // Don't proceed before all updates happen on the background thread. + // Call GetPasswordCount() because it blocks on the background thread. + GetPasswordCount(profile); } void PasswordsSyncPerfTest::RemoveLogins(int profile) { passwords_helper::RemoveLogins(GetProfilePasswordStoreInterface(profile)); + // Don't proceed before all removals happen on the background thread. + // Call GetPasswordCount() because it blocks on the background thread. + GetPasswordCount(profile); } password_manager::PasswordForm PasswordsSyncPerfTest::NextLogin() {
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index a70bf7e..adc8838 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -66,8 +66,6 @@ void ThemeSyncableService::AddObserver( ThemeSyncableService::Observer* observer) { observer_list_.AddObserver(observer); - if (sync_processor_ || sync_started_for_testing_) - observer->OnThemeSyncStarted(startup_state_); } void ThemeSyncableService::RemoveObserver( @@ -77,9 +75,12 @@ void ThemeSyncableService::NotifyOnSyncStartedForTesting( ThemeSyncState startup_state) { - startup_state_ = startup_state; - sync_started_for_testing_ = true; - NotifyOnSyncStarted(); + NotifyOnSyncStarted(startup_state); +} + +absl::optional<ThemeSyncableService::ThemeSyncState> +ThemeSyncableService::GetThemeSyncStartState() { + return startup_state_; } void ThemeSyncableService::WaitUntilReadyToSync(base::OnceClosure done) { @@ -112,7 +113,7 @@ if (!GetThemeSpecificsFromCurrentTheme(¤t_specifics)) { // Current theme is unsyncable - don't overwrite from sync data, and don't // save the unsyncable theme to sync data. - NotifyOnSyncStarted(); + NotifyOnSyncStarted(ThemeSyncState::kFailed); return absl::nullopt; } @@ -124,8 +125,9 @@ if (sync_data->GetSpecifics().has_theme()) { if (!HasNonDefaultTheme(current_specifics) || HasNonDefaultTheme(sync_data->GetSpecifics().theme())) { - startup_state_ = MaybeSetTheme(current_specifics, *sync_data); - NotifyOnSyncStarted(); + ThemeSyncState startup_state = + MaybeSetTheme(current_specifics, *sync_data); + NotifyOnSyncStarted(startup_state); return absl::nullopt; } } @@ -134,8 +136,7 @@ // No theme specifics are found. Create one according to current theme. absl::optional<syncer::ModelError> error = ProcessNewTheme(syncer::SyncChange::ACTION_ADD, current_specifics); - startup_state_ = ThemeSyncState::kApplied; - NotifyOnSyncStarted(); + NotifyOnSyncStarted(ThemeSyncState::kApplied); return error; } @@ -411,7 +412,10 @@ return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); } -void ThemeSyncableService::NotifyOnSyncStarted() { +void ThemeSyncableService::NotifyOnSyncStarted(ThemeSyncState startup_state) { + // Keep the state for later calls to GetThemeSyncStartState(). + startup_state_ = startup_state; + for (Observer& observer : observer_list_) - observer.OnThemeSyncStarted(startup_state_); + observer.OnThemeSyncStarted(startup_state); }
diff --git a/chrome/browser/themes/theme_syncable_service.h b/chrome/browser/themes/theme_syncable_service.h index 049ff59..e7c907b 100644 --- a/chrome/browser/themes/theme_syncable_service.h +++ b/chrome/browser/themes/theme_syncable_service.h
@@ -46,7 +46,8 @@ class Observer : public base::CheckedObserver { public: // Called when theme sync gets started. Observers that register after theme - // sync gets started are called right away when they register. + // sync gets started are never called, they should check + // GetThemeSyncStartState() before registering, instead. virtual void OnThemeSyncStarted(ThemeSyncState state) = 0; }; @@ -64,6 +65,9 @@ void RemoveObserver(Observer* observer); void NotifyOnSyncStartedForTesting(ThemeSyncState startup_state); + // Returns the theme sync startup state or nullopt if it has not started yet. + absl::optional<ThemeSyncState> GetThemeSyncStartState(); + // syncer::SyncableService implementation. void WaitUntilReadyToSync(base::OnceClosure done) override; absl::optional<syncer::ModelError> MergeDataAndStartSyncing( @@ -111,7 +115,7 @@ syncer::SyncChange::SyncChangeType change_type, const sync_pb::ThemeSpecifics& theme_specifics); - void NotifyOnSyncStarted(); + void NotifyOnSyncStarted(ThemeSyncState startup_state); Profile* const profile_; ThemeService* const theme_service_; @@ -126,8 +130,7 @@ bool use_system_theme_by_default_; // Captures the state of theme sync after initial data merge. - ThemeSyncState startup_state_ = ThemeSyncState::kFailed; - bool sync_started_for_testing_ = false; + absl::optional<ThemeSyncState> startup_state_; base::ThreadChecker thread_checker_;
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc index decbf73..fd23550 100644 --- a/chrome/browser/translate/chrome_translate_client.cc +++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -90,15 +90,16 @@ ChromeTranslateClient::ChromeTranslateClient(content::WebContents* web_contents) : content::WebContentsObserver(web_contents) { + DCHECK(web_contents); if (translate::IsSubFrameTranslationEnabled()) { per_frame_translate_driver_ = std::make_unique<translate::PerFrameContentTranslateDriver>( - &web_contents->GetController(), + *web_contents, &web_contents->GetController(), UrlLanguageHistogramFactory::GetForBrowserContext( web_contents->GetBrowserContext())); } else { translate_driver_ = std::make_unique<translate::ContentTranslateDriver>( - &web_contents->GetController(), + *web_contents, &web_contents->GetController(), UrlLanguageHistogramFactory::GetForBrowserContext( web_contents->GetBrowserContext()), TranslateModelServiceFactory::GetOrBuildForKey(
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 36006b5..a4809b6 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2716,6 +2716,7 @@ "//ash/public/cpp", "//ash/public/cpp/app_list/vector_icons", "//ash/public/cpp/resources:ash_public_unscaled_resources", + "//ash/quick_pair/common", "//ash/services/recording/public/mojom", "//ash/shortcut_viewer", "//ash/webui/diagnostics_ui", @@ -2782,7 +2783,6 @@ "//chromeos/components/print_management", "//chromeos/components/proximity_auth", "//chromeos/components/quick_answers", - "//chromeos/components/quick_pair/common", "//chromeos/components/string_matching", "//chromeos/components/tether", "//chromeos/components/web_applications",
diff --git a/chrome/browser/ui/android/autofill/internal/BUILD.gn b/chrome/browser/ui/android/autofill/internal/BUILD.gn index d16857d3..655e5340 100644 --- a/chrome/browser/ui/android/autofill/internal/BUILD.gn +++ b/chrome/browser/ui/android/autofill/internal/BUILD.gn
@@ -11,6 +11,7 @@ ] sources = [ "java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java" ] deps = [ + ":java_resources", ":jni_headers", "//base:base_java", "//base:jni_java", @@ -18,6 +19,7 @@ "//ui/android:ui_java", ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.ui.autofill.internal" } generate_jni("jni_headers") { @@ -39,9 +41,19 @@ "//base:base_java_test_support", "//base:base_junit_test_support", "//base/test:test_support_java", + "//third_party/androidx:androidx_test_core_java", "//third_party/androidx:androidx_test_runner_java", "//third_party/junit:junit", "//third_party/mockito:mockito_java", "//ui/android:ui_full_java", ] } + +android_resources("java_resources") { + sources = [ "java/res/layout/autofill_error_dialog.xml" ] + deps = [ + "//chrome/android:chrome_app_java_resources", + "//components/browser_ui/styles/android:java_resources", + "//ui/android:ui_java_resources", + ] +}
diff --git a/chrome/browser/ui/android/autofill/internal/java/res/layout/autofill_error_dialog.xml b/chrome/browser/ui/android/autofill/internal/java/res/layout/autofill_error_dialog.xml new file mode 100644 index 0000000..39c036c --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/res/layout/autofill_error_dialog.xml
@@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<TextView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/error_message" + android:textAppearance="@style/TextAppearance.ErrorCaption" + style="@style/AlertDialogContent" + android:layout_width="match_parent" + android:layout_height="wrap_content"/>
diff --git a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java index e61c09b..138820f 100644 --- a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java +++ b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java
@@ -5,12 +5,16 @@ package org.chromium.chrome.browser.ui.autofill; import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.TextView; import androidx.core.content.res.ResourcesCompat; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.ui.autofill.internal.R; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.modaldialog.DialogDismissalCause; import org.chromium.ui.modaldialog.ModalDialogManager; @@ -70,11 +74,14 @@ */ @CalledByNative public void show(String title, String description, String buttonLabel, int titleIconId) { + View errorDialogContentView = + LayoutInflater.from(mContext).inflate(R.layout.autofill_error_dialog, null); + ((TextView) errorDialogContentView.findViewById(R.id.error_message)).setText(description); PropertyModel.Builder builder = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) .with(ModalDialogProperties.CONTROLLER, mModalDialogController) .with(ModalDialogProperties.TITLE, title) - .with(ModalDialogProperties.MESSAGE, description) + .with(ModalDialogProperties.CUSTOM_VIEW, errorDialogContentView) .with(ModalDialogProperties.NEGATIVE_BUTTON_DISABLED, true) .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, buttonLabel); if (titleIconId != 0) {
diff --git a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridgeTest.java b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridgeTest.java index 96fab39c..a54e100 100644 --- a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridgeTest.java +++ b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridgeTest.java
@@ -8,8 +8,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import android.content.Context; - +import androidx.test.core.app.ApplicationProvider; import androidx.test.filters.SmallTest; import org.junit.Assert; @@ -45,8 +44,6 @@ @Mock private AutofillErrorDialogBridge.Natives mNativeMock; - @Mock - private Context mContext; private AutofillErrorDialogBridge mAutofillErrorDialogBridge; private FakeModalDialogManager mModalDialogManager; @@ -83,8 +80,9 @@ public void setUp() { reset(mNativeMock); mModalDialogManager = new FakeModalDialogManager(); - mAutofillErrorDialogBridge = new AutofillErrorDialogBridge( - NATIVE_AUTOFILL_ERROR_DIALOG_VIEW, mModalDialogManager, mContext); + mAutofillErrorDialogBridge = + new AutofillErrorDialogBridge(NATIVE_AUTOFILL_ERROR_DIALOG_VIEW, + mModalDialogManager, ApplicationProvider.getApplicationContext()); mMocker.mock(AutofillErrorDialogBridgeJni.TEST_HOOKS, mNativeMock); }
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index fcffc60..718ed06 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -251,6 +251,12 @@ <message name="IDS_NOTIFICATION_CATEGORY_ANNOUNCEMENT" desc="Label for announcements notifications, within a list of notification categories. [CHAR_LIMIT=32]"> Announcements </message> + <message name="IDS_NOTIFICATION_CATEGORY_WEBAPPS" desc="Label for webapps notifications, within a list of notification categories [CHAR_LIMIT=32]"> + Web apps + </message> + <message name="IDS_NOTIFICATION_CATEGORY_WEBAPPS_QUIET" desc="Label for quiet webapps notifications that used for follow up notifications telling the user a TWA is running in Chrome. [CHAR_LIMIT=32]"> + Web apps (quiet) + </message> <message name="IDS_NOTIFICATION_CATEGORY_PERMISSION_REQUESTS" desc="Label for permission requests, within a list of notification categories. [CHAR_LIMIT=32]"> Permission requests </message> @@ -3740,12 +3746,6 @@ <message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message"> Got it </message> - <message name="IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_INITIAL" desc="Notification channel name for the initial, urgent priority notification telling the user a TWA is running in Chrome."> - Web apps - </message> - <message name="IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_SUBSEQUENT" desc="Notification channel name for follow up notifications telling the user a TWA is running in Chrome."> - Web apps (quiet) - </message> <message name="IDS_TWA_CLEAR_DATA_DIALOG_TITLE" desc="Title of the clear data dialog showing after user uninstalls or clears data of an app hosting a Trusted Web Activity"> <ph name="APP_NAME">%1$s<ex>YouTube</ex></ph> also has data in Chrome </message> @@ -4474,10 +4474,9 @@ Link to highlight </message> - <message name="IDS_SHARING_WEBNOTES_STYLIZED" desc="Label for stylized highlight creation button in the sharing hub."> - Stylize highlight + <message name="IDS_SHARING_WEBNOTES_CREATE_CARD" desc="Label for the button in sharing hub for creating card for the highlight text."> + Create card </message> - <message name="IDS_SHARING_COPIED" desc="Text shown in the toast notification when Copy is selected in the sharing hub."> Copied </message>
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_INITIAL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_NOTIFICATION_CATEGORY_WEBAPPS.png.sha1 similarity index 100% rename from chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_INITIAL.png.sha1 rename to chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_NOTIFICATION_CATEGORY_WEBAPPS.png.sha1
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_INITIAL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_NOTIFICATION_CATEGORY_WEBAPPS_QUIET.png.sha1 similarity index 100% copy from chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_INITIAL.png.sha1 copy to chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_NOTIFICATION_CATEGORY_WEBAPPS_QUIET.png.sha1
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_CREATE_CARD.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_CREATE_CARD.png.sha1 new file mode 100644 index 0000000..19e905e --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_CREATE_CARD.png.sha1
@@ -0,0 +1 @@ +973eaf1223954ff6e8f45883885aa9a1364bec2c \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_STYLIZED.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_STYLIZED.png.sha1 deleted file mode 100644 index b1ecd5bc..0000000 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_WEBNOTES_STYLIZED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -8972723b54e09b793ba71ab94dc7cad1cc6828b1 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_SUBSEQUENT.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_SUBSEQUENT.png.sha1 deleted file mode 100644 index b6ebf0d2..0000000 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME_CHANNEL_NAME_SUBSEQUENT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -dd654d769393beec4e6cb37a5049fa9bdd0b3f0c \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_fil.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_fil.xtb index 86efc5b9..ff387cf6 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_fil.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_fil.xtb
@@ -853,6 +853,7 @@ <translation id="6441734959916820584">Masyadong mahaba ang pangalan</translation> <translation id="6444421004082850253">{FILE_COUNT,plural, =1{# Larawan}one{# Larawan}other{# na Larawan}}</translation> <translation id="6447558397796644647">Hindi mahanap ang bookmark na iyon. Tingnan ang iyong spelling o magdagdag ng bagong bookmark.</translation> +<translation id="6459045781120991510">Mga Survey</translation> <translation id="6461962085415701688">Hindi mabuksan ang file</translation> <translation id="6464977750820128603">Puwede mong makita ang mga site na binibisita mo sa Chrome at puwede kang magtakda ng mga timer para sa mga ito.\n\nKumukuha ng impormasyon ang Google tungkol sa mga site kung saan ka nagtakda ng mga timer at inaalam nito kung gaano mo katagal binisita ang mga ito. Ginagamit ang impormasyong ito para pahusayin ang Digital Wellness.</translation> <translation id="6475951671322991020">I-download ang video</translation> @@ -969,6 +970,7 @@ <translation id="7242755609445462077">May istilong highlight <ph name="CURRENT_DATE" /></translation> <translation id="7248069434667874558">Tiyaking naka-on sa <ph name="TARGET_DEVICE_NAME" /> ang pag-sync sa Chrome</translation> <translation id="7252076891734325316">Ilapit ang iyong telepono sa computer</translation> +<translation id="727288900855680735">Isumite ang <ph name="ONE_TIME_CODE" /> sa <ph name="ORIGIN" />?</translation> <translation id="7274013316676448362">Naka-block na site</translation> <translation id="7286572596625053347">Palitan ang <ph name="LANGUAGE" />?</translation> <translation id="7290209999329137901">Hindi available ang pag-rename</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_mn.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_mn.xtb index ba458bd..fbe28d55 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_mn.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_mn.xtb
@@ -852,6 +852,7 @@ <translation id="6441734959916820584">Нэр хэт урт байна</translation> <translation id="6444421004082850253">{FILE_COUNT,plural, =1{# Зураг}other{# Зураг}}</translation> <translation id="6447558397796644647">Энэ хавчуургыг олох боломжгүй байна. Зөв бичгийн дүрмээ шалгах эсвэл шинэ хавчуурга нэмнэ үү.</translation> +<translation id="6459045781120991510">Судалгаа</translation> <translation id="6461962085415701688">Файлыг нээх боломжгүй байна</translation> <translation id="6464977750820128603">Та Chrome-д зочилдог сайтуудаа харах болон тэдгээрт цаг хэмжигч тохируулах боломжтой.\n\nGoogle таны цаг хэмжигч тохируулсан сайтууд болон тэдгээрт хэр удаан зочилдог талаарх мэдээллийг авдаг. Энэ мэдээллийг Дижитал хэрэглээг сайжруулах зорилгоор ашигладаг.</translation> <translation id="6475951671322991020">Видео татах</translation> @@ -968,6 +969,7 @@ <translation id="7242755609445462077">Стильжүүлсэн тодруулга <ph name="CURRENT_DATE" /></translation> <translation id="7248069434667874558"><ph name="TARGET_DEVICE_NAME" /> нь Chrome дээр синк хийхийг асаасан эсэхийг шалгана уу</translation> <translation id="7252076891734325316">Утсаа компьютертой ойр байрлуулна уу</translation> +<translation id="727288900855680735"><ph name="ONE_TIME_CODE" />-г <ph name="ORIGIN" />-д илгээх үү?</translation> <translation id="7274013316676448362">Блоклосон сайт</translation> <translation id="7286572596625053347"><ph name="LANGUAGE" />-г өөрчлөх үү?</translation> <translation id="7290209999329137901">Нэр өөрчлөх боломжгүй байна</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_uz.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_uz.xtb index 96b69796..2ebefa2 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_uz.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_uz.xtb
@@ -853,6 +853,7 @@ <translation id="6441734959916820584">Bu nom juda uzun</translation> <translation id="6444421004082850253">{FILE_COUNT,plural, =1{# ta rasm}other{# ta rasm}}</translation> <translation id="6447558397796644647">Bu bukmark topilmadi. Xatosiz kiritilganini tekshiring yoki yangi bukmark kiriting</translation> +<translation id="6459045781120991510">Soʻrovnomalar</translation> <translation id="6461962085415701688">Fayl ochilmadi</translation> <translation id="6464977750820128603">Chromeda ochilgan saytlarni koʻrish va ular uchun taymerlar sozlash mumkin.\n\nGooglega faqat taymer sozlangan saytlar va ular qancha vaqt ochilganligi haqidagi axborot yuboriladi. Bu axborot Raqamli qulaylikni yaxshilashga yordam beradi.</translation> <translation id="6475951671322991020">Videoni yuklab olish</translation> @@ -969,6 +970,7 @@ <translation id="7242755609445462077"><ph name="CURRENT_DATE" /> uslubiy belgilovi</translation> <translation id="7248069434667874558"><ph name="TARGET_DEVICE_NAME" /> sozlamalarida Chrome sinxronizatsiyasi yoniqligini tekshiring</translation> <translation id="7252076891734325316">Telefoningizni kompyuterga yaqin tuting</translation> +<translation id="727288900855680735"><ph name="ONE_TIME_CODE" /> kodi <ph name="ORIGIN" /> saytiga joylansinmi?</translation> <translation id="7274013316676448362">Bloklangan sayt</translation> <translation id="7286572596625053347"><ph name="LANGUAGE" /> almashtirilsinmi?</translation> <translation id="7290209999329137901">Qayta nomlash imkonsiz</translation>
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.cc index d689117..1b6d314 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.cc
@@ -22,6 +22,8 @@ #include "chrome/browser/ash/arc/arc_optin_uma.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" +#include "chrome/browser/chromeos/full_restore/arc_window_handler.h" +#include "chrome/browser/chromeos/full_restore/full_restore_arc_task_handler.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h" @@ -53,12 +55,22 @@ ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(observed_profile_); DCHECK(prefs); prefs->AddObserver(this); + + arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); + // arc::ArcSessionManager might not be set in tests. + if (arc_session_manager) + arc_session_manager->AddObserver(this); } AppServiceAppWindowArcTracker::~AppServiceAppWindowArcTracker() { ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(observed_profile_); DCHECK(prefs); prefs->RemoveObserver(this); + + arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); + // arc::ArcSessionManager may be released first. + if (arc_session_manager) + arc_session_manager->RemoveObserver(this); } void AppServiceAppWindowArcTracker::ActiveUserChanged( @@ -136,6 +148,11 @@ for (const auto task_id : task_ids_to_remove) OnTaskDestroyed(task_id); DCHECK(GetTaskIdsForApp(app_id).empty()); + + const std::vector<int> session_ids_to_remove = GetSessionIdsForApp(app_id); + for (const auto session_id : session_ids_to_remove) + OnSessionDestroyed(session_id); + DCHECK(GetSessionIdsForApp(app_id).empty()); } void AppServiceAppWindowArcTracker::OnTaskCreated( @@ -255,7 +272,8 @@ auto it_controller = app_shelf_group_to_controller_map_.find(app_shelf_id); if (it_controller != app_shelf_group_to_controller_map_.end()) { it_controller->second->RemoveTaskId(task_id); - if (!it_controller->second->HasAnyTasks()) { + if (!it_controller->second->HasAnyTasks() && + !it_controller->second->HasAnySessions()) { app_service_controller_->owner()->CloseItem( it_controller->second->shelf_id()); app_shelf_group_to_controller_map_.erase(app_shelf_id); @@ -447,8 +465,10 @@ ArcAppWindowInfo* const app_window_info = session_id_to_arc_app_window_info_[session_id].get(); const arc::ArcAppShelfId& app_shelf_id = app_window_info->app_shelf_id(); - if (base::Contains(app_shelf_group_to_controller_map_, app_shelf_id)) + if (base::Contains(app_shelf_group_to_controller_map_, app_shelf_id)) { + app_shelf_group_to_controller_map_[app_shelf_id]->AddSessionId(session_id); return; + } const ash::ShelfID shelf_id(app_shelf_id.ToString()); std::unique_ptr<AppServiceAppWindowShelfItemController> controller = @@ -465,6 +485,7 @@ app_service_controller_->owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); } + item_controller->AddSessionId(session_id); app_shelf_group_to_controller_map_[app_shelf_id] = item_controller; } @@ -478,6 +499,21 @@ opt_in_management_check_start_time_ = base::Time(); } +void AppServiceAppWindowArcTracker::OnArcPlayStoreEnabledChanged(bool enabled) { + if (enabled) + return; + + // If ARC was disabled, close the ghost window. + std::vector<int> session_ids; + for (const auto& it : session_id_to_arc_app_window_info_) + session_ids.push_back(it.first); + + for (const auto session_id : session_ids) + OnSessionDestroyed(session_id); + + DCHECK(session_id_to_arc_app_window_info_.empty()); +} + void AppServiceAppWindowArcTracker::HandlePlayStoreLaunch( ArcAppWindowInfo* app_window_info) { arc::Intent intent; @@ -540,6 +576,18 @@ return task_ids; } +std::vector<int> AppServiceAppWindowArcTracker::GetSessionIdsForApp( + const std::string& app_id) const { + std::vector<int> session_ids; + for (const auto& it : session_id_to_arc_app_window_info_) { + const ArcAppWindowInfo* app_window_info = it.second.get(); + if (app_window_info->app_shelf_id().app_id() == app_id) + session_ids.push_back(it.first); + } + + return session_ids; +} + void AppServiceAppWindowArcTracker::SetDescription(int32_t task_id, const std::string& title, gfx::ImageSkia icon) { @@ -594,3 +642,39 @@ return session_id_to_arc_app_window_info_[*session_id].get(); } + +void AppServiceAppWindowArcTracker::OnSessionDestroyed(int32_t session_id) { + auto it = session_id_to_arc_app_window_info_.find(session_id); + if (it == session_id_to_arc_app_window_info_.end()) + return; + + aura::Window* const window = it->second.get()->window(); + if (window) { + app_service_controller_->app_service_instance_helper()->OnInstances( + it->second.get()->app_shelf_id().app_id(), window, std::string(), + apps::InstanceState::kDestroyed); + app_service_controller_->UnregisterWindow(window); + } + + // Check if we may close controller now, at this point we can safely remove + // controllers without window. + const auto app_shelf_id = it->second->app_shelf_id(); + auto it_controller = app_shelf_group_to_controller_map_.find(app_shelf_id); + if (it_controller != app_shelf_group_to_controller_map_.end()) { + it_controller->second->RemoveSessionId(session_id); + if (!it_controller->second->HasAnyTasks() && + !it_controller->second->HasAnySessions()) { + app_service_controller_->owner()->CloseItem( + it_controller->second->shelf_id()); + app_shelf_group_to_controller_map_.erase(app_shelf_id); + } + } + session_id_to_arc_app_window_info_.erase(session_id); + + // Close the ghost window. + auto* arc_handler = + chromeos::full_restore::FullRestoreArcTaskHandler::GetForProfile( + observed_profile_); + if (arc_handler && arc_handler->window_handler()) + arc_handler->window_handler()->CloseWindow(session_id); +}
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.h b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.h index 0949a3183..81170fa 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.h +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_arc_tracker.h
@@ -122,6 +122,7 @@ // arc::ArcSessionManagerObserver: void OnArcOptInManagementCheckStarted() override; void OnArcSessionStopped(arc::ArcStopReason stop_reason) override; + void OnArcPlayStoreEnabledChanged(bool enabled) override; void HandlePlayStoreLaunch(ArcAppWindowInfo* app_window_info); @@ -130,7 +131,10 @@ // For consistency, always return the lowest such task ID. int GetTaskIdSharingLogicalWindow(int task_id); - std::vector<int> GetTaskIdsForApp(const std::string& arc_app_id) const; + std::vector<int> GetTaskIdsForApp(const std::string& app_id) const; + + // Returns session ids of all ghost windows for the app of `arc_app_id`. + std::vector<int> GetSessionIdsForApp(const std::string& app_id) const; // Invoked when the compressed data is converted to an ImageSkia. void OnIconLoaded(int32_t task_id, @@ -147,6 +151,10 @@ ArcAppWindowInfo* GetArcAppWindowInfo(aura::Window* window); + // Invoked when the app is removed to close the ghost window with + // `session_id`. + void OnSessionDestroyed(int32_t session_id); + Profile* const observed_profile_; AppServiceAppWindowShelfController* const app_service_controller_;
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.cc index 96a8233..df3a501 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.cc
@@ -183,12 +183,12 @@ for (const ui::BaseWindow* window : windows()) { auto session_id = arc::GetWindowSessionId(window->GetNativeWindow()); if (!session_id.has_value()) - return; + continue; auto app_launch_info = ::full_restore::GetArcAppLaunchInfo(arc_app_id, session_id.value()); if (!app_launch_info) - return; + continue; DCHECK(app_launch_info->event_flag.has_value()); @@ -220,6 +220,18 @@ return !task_ids_.empty(); } +void AppServiceAppWindowShelfItemController::AddSessionId(int session_id) { + session_ids_.insert(session_id); +} + +void AppServiceAppWindowShelfItemController::RemoveSessionId(int session_id) { + session_ids_.erase(session_id); +} + +bool AppServiceAppWindowShelfItemController::HasAnySessions() const { + return !session_ids_.empty(); +} + bool AppServiceAppWindowShelfItemController::IsChromeApp() { Profile* const profile = ChromeShelfController::instance()->profile(); return apps::AppServiceProxyFactory::GetForProfile(profile)
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.h b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.h index aa2573f..65cce1e 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.h +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_shelf_item_controller.h
@@ -50,6 +50,12 @@ void RemoveTaskId(int task_id); bool HasAnyTasks() const; + // ARC ghost windows introduce session ids to identify the ghost window. So + // below functions are added to handle session ids for ghost windows. + void AddSessionId(int session_id); + void RemoveSessionId(int session_id); + bool HasAnySessions() const; + private: bool IsChromeApp(); @@ -59,6 +65,7 @@ arc_prefs_observer_{this}; std::set<int> task_ids_; + std::set<int> session_ids_; }; #endif // CHROME_BROWSER_UI_ASH_SHELF_APP_SERVICE_APP_SERVICE_APP_WINDOW_SHELF_ITEM_CONTROLLER_H_
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 5f35b7583..434c9f2 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -1813,7 +1813,7 @@ content::NavigationController* controller = content::Source<content::NavigationController>(windowed_observer.source()) .ptr(); - WebContents* popup = controller->GetWebContents(); + WebContents* popup = controller->DeprecatedGetWebContents(); ASSERT_TRUE(popup); EXPECT_EQ(2, browser()->tab_strip_model()->count()); content::RenderViewHost* webui_rvh =
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index 1672779..6245c18 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -372,7 +372,8 @@ MixedContentSettingsTabHelper::FromWebContents(web_contents()); if (mixed_content_settings) { // Update browser side settings to allow active mixed content. - mixed_content_settings->AllowRunningOfInsecureContent(); + mixed_content_settings->AllowRunningOfInsecureContent( + *web_contents()->GetMainFrame()); } // Update renderer side settings to allow active mixed content.
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc index 118a91a..98a8c0d 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc +++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc
@@ -147,7 +147,7 @@ // listening. content::NavigationController* controller = content::Source<content::NavigationController>(source).ptr(); - content::WebContents* web_contents = controller->GetWebContents(); + content::WebContents* web_contents = controller->DeprecatedGetWebContents(); if (!infobars::ContentInfoBarManager::FromWebContents(web_contents)) return;
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index f802b87..6d44613 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -1398,9 +1398,10 @@ switches::kHideCrashRestoreBubble); } -base::FilePath GetStartupProfilePath(const base::FilePath& cur_dir, - const base::CommandLine& command_line, - bool ignore_profile_picker) { +StartupProfilePathInfo GetStartupProfilePath( + const base::FilePath& cur_dir, + const base::CommandLine& command_line, + bool ignore_profile_picker) { ProfileManager* profile_manager = g_browser_process->profile_manager(); const base::FilePath& user_data_dir = profile_manager->user_data_dir(); // If the browser is launched due to activation on Windows native notification, @@ -1410,7 +1411,8 @@ std::string profile_id = NotificationLaunchId::GetNotificationLaunchProfileId(command_line); if (!profile_id.empty()) { - return user_data_dir.Append(base::FilePath(base::UTF8ToWide(profile_id))); + return {user_data_dir.Append(base::FilePath(base::UTF8ToWide(profile_id))), + StartupProfileMode::kBrowserWindow}; } #endif // defined(OS_WIN) @@ -1419,12 +1421,15 @@ if (profiles::IsGuestModeRequested(command_line, g_browser_process->local_state(), /* show_warning= */ false)) { - return profiles::GetDefaultProfileDir(user_data_dir); + // TODO(crbug.com/1150326): return a guest profile instead. + return {profiles::GetDefaultProfileDir(user_data_dir), + StartupProfileMode::kBrowserWindow}; } if (command_line.HasSwitch(switches::kProfileDirectory)) { - return user_data_dir.Append( - command_line.GetSwitchValuePath(switches::kProfileDirectory)); + return {user_data_dir.Append( + command_line.GetSwitchValuePath(switches::kProfileDirectory)), + StartupProfileMode::kBrowserWindow}; } #if !BUILDFLAG(IS_CHROMEOS_ASH) @@ -1444,48 +1449,75 @@ // To indicate that we want to show the profile picker, return the guest // profile. However, we can only do this if the system profile (where the // profile picker lives) also exists (or is creatable). - // TODO(crbug.com/1150326): Refactor this to indicate more directly that - // profile picker should be shown (returning an enum, or so). - return ProfileManager::GetGuestProfilePath(); + // TODO(https://crbug.com/1150326): Return an empty path instead of a + // guest profile path. + return {ProfileManager::GetGuestProfilePath(), + StartupProfileMode::kProfilePicker}; } } #endif // !BUILDFLAG(IS_CHROMEOS_ASH) - return profile_manager->GetLastUsedProfileDir(); + return {profile_manager->GetLastUsedProfileDir(), + StartupProfileMode::kBrowserWindow}; } #if !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID) -Profile* GetStartupProfile(const base::FilePath& cur_dir, - const base::CommandLine& command_line) { +StartupProfileInfo GetStartupProfile(const base::FilePath& cur_dir, + const base::CommandLine& command_line) { ProfileManager* profile_manager = g_browser_process->profile_manager(); - base::FilePath profile_path = GetStartupProfilePath( + StartupProfilePathInfo path_info = GetStartupProfilePath( cur_dir, command_line, /*ignore_profile_picker=*/false); - Profile* profile = profile_manager->GetProfile(profile_path); - // If there is no entry in profile attributes storage, the profile is deleted, - // and we should show the user manager. Also, when using - // --new-profile-management, if the profile is locked we should show the user - // manager as well. When neither of these is true, we can safely start up with - // |profile|. - auto* storage = &profile_manager->GetProfileAttributesStorage(); - ProfileAttributesEntry* entry = - storage->GetProfileAttributesWithPath(profile_path); - if (entry && (!entry->IsSigninRequired() || !profile)) { - return profile; + switch (path_info.mode) { + case StartupProfileMode::kProfilePicker: { + // TODO(https://crbug.com/1150326): Return nullptr instead of a guest + // profile. + Profile* guest_profile = + profile_manager->GetProfile(ProfileManager::GetGuestProfilePath()); + if (guest_profile) + return {guest_profile, StartupProfileMode::kProfilePicker}; + else + return {nullptr, StartupProfileMode::kError}; + } + case StartupProfileMode::kError: + // No more info to add. + return {nullptr, StartupProfileMode::kError}; + case StartupProfileMode::kBrowserWindow: + // Try to acquire a profile below. + break; } - // We want to show the user manager. To indicate this, return the guest - // profile. However, we can only do this if the system profile (where the user - // manager lives) also exists (or is creatable). - // TODO(crbug.com/1150326): Refactor this to indicate more directly that - // profile picker should be shown (returning an enum, or so). - return profile_manager->GetProfile(ProfileManager::GetSystemProfilePath()) - ? profile_manager->GetProfile( - ProfileManager::GetGuestProfilePath()) - : nullptr; + // NOTE: GetProfile() does synchronous file I/O on the main thread. + Profile* profile = profile_manager->GetProfile(path_info.path); + + // There are several cases where we should show the profile picker: + // - if there is no entry in profile attributes storage, which means that the + // profile is deleted, + // - if the profile is locked, + // - if the profile has failed to load + // When neither of these is true, we can safely start up with `profile`. + auto* storage = &profile_manager->GetProfileAttributesStorage(); + ProfileAttributesEntry* entry = + storage->GetProfileAttributesWithPath(path_info.path); + if (entry && !entry->IsSigninRequired() && profile) { + return {profile, StartupProfileMode::kBrowserWindow}; + } + + // We want to show the profile picker. To indicate this, return the guest + // profile. However, we can only do this if the system profile (where the + // profile picker lives) also exists (or is creatable). + // TODO(https://crbug.com/1150326): Return nullptr instead of a guest profile. + Profile* guest_profile = + profile_manager->GetProfile(ProfileManager::GetGuestProfilePath()); + if (profile_manager->GetProfile(ProfileManager::GetSystemProfilePath()) && + guest_profile) { + return {guest_profile, StartupProfileMode::kProfilePicker}; + } + + return {nullptr, StartupProfileMode::kError}; } -Profile* GetFallbackStartupProfile() { +StartupProfileInfo GetFallbackStartupProfile() { ProfileManager* profile_manager = g_browser_process->profile_manager(); // The only known reason for profiles to fail initialization is being unable // to create the profile directory, and this has already happened in @@ -1501,28 +1533,29 @@ ProfileAttributesEntry* entry = storage->GetProfileAttributesWithPath(profile->GetPath()); if (!entry || !entry->IsSigninRequired()) - return profile; + return {profile, StartupProfileMode::kBrowserWindow}; } - // Couldn't initialize any last opened profiles. Try to show the user manager, - // which requires successful initialization of the guest and system profiles. + // Couldn't initialize any last opened profiles. Try to show the profile + // picker, which requires successful initialization of the guest and system + // profiles. Profile* guest_profile = profile_manager->GetProfile(ProfileManager::GetGuestProfilePath()); Profile* system_profile = profile_manager->GetProfile(ProfileManager::GetSystemProfilePath()); if (guest_profile && system_profile) - return guest_profile; + return {guest_profile, StartupProfileMode::kProfilePicker}; - // Couldn't show the user manager either. Try to open any profile that is not - // locked. + // Couldn't show the profile picker either. Try to open any profile that is + // not locked. for (ProfileAttributesEntry* entry : storage->GetAllProfilesAttributes()) { if (!entry->IsSigninRequired()) { Profile* profile = profile_manager->GetProfile(entry->GetPath()); if (profile) - return profile; + return {profile, StartupProfileMode::kBrowserWindow}; } } - return nullptr; + return {nullptr, StartupProfileMode::kError}; } #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID)
diff --git a/chrome/browser/ui/startup/startup_browser_creator.h b/chrome/browser/ui/startup/startup_browser_creator.h index f86b37b..a7abc5d 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.h +++ b/chrome/browser/ui/startup/startup_browser_creator.h
@@ -30,6 +30,42 @@ FORWARD_DECLARE_TEST(WebAppEngagementBrowserTest, CommandLineWindow); } // namespace web_app +// Indicates how Chrome should start up the first profile. +enum class StartupProfileMode { + // Regular startup with a browser window. + kBrowserWindow, + // Profile picker window should be shown on startup. + kProfilePicker, + // Chrome cannot start because no profiles are available. + kError +}; + +// Bundles the startup profile path together with a StartupProfileMode. +// Depending on the `mode` value, `path` is either: +// - regular profile path for kBrowserWindow; if the guest mode is requested, +// contains default profile path with kBrowserWindow mode +// - guest profile path for kProfilePicker, +// - empty path for kError +// TODO(https://crbug.com/1150326): return a guest profile path for the Guest +// mode and an empty path for kProfilePicker mode +struct StartupProfilePathInfo { + base::FilePath path; + StartupProfileMode mode; +}; + +// Bundles the startup profile together with a StartupProfileMode. +// Depending on the `mode` value, `profile` is either: +// - regular profile for kBrowserWindow; if the Guest mode is requested, +// contains default profile with kBrowserWindow mode +// - guest profile for kProfilePicker, +// - nullptr for kError +// TODO(https://crbug.com/1150326): return a guest profile for the Guest mode +// and return nullptr for kProfilePicker. +struct StartupProfileInfo { + Profile* profile; + StartupProfileMode mode; +}; + // class containing helpers for BrowserMain to spin up a new instance and // initialize the profile. class StartupBrowserCreator { @@ -249,25 +285,24 @@ // bypassing the profile picker, because the profile picker does not support it. // TODO(https://crbug.com/1155158): Remove this parameter once the picker // supports opening URLs. -base::FilePath GetStartupProfilePath(const base::FilePath& cur_dir, - const base::CommandLine& command_line, - bool ignore_profile_picker); +StartupProfilePathInfo GetStartupProfilePath( + const base::FilePath& cur_dir, + const base::CommandLine& command_line, + bool ignore_profile_picker); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID) // Returns the profile that should be loaded on process startup. This is either -// the profile returned by GetStartupProfilePath, or the guest profile if the -// above profile is locked. The guest profile denotes that we should open the -// user manager. Returns null if the above profile cannot be opened. In case of -// opening the user manager, returns null if either the guest profile or the -// system profile cannot be opened. -Profile* GetStartupProfile(const base::FilePath& cur_dir, - const base::CommandLine& command_line); +// the profile returned by GetStartupProfilePath, or the guest profile along +// with StartupProfileMode::kProfilePicker mode if the profile picker should be +// opened. Returns nullptr with kError if neither the regular profile nor the +// profile picker can be opened. +StartupProfileInfo GetStartupProfile(const base::FilePath& cur_dir, + const base::CommandLine& command_line); // Returns the profile that should be loaded on process startup when -// GetStartupProfile() returns null. As with GetStartupProfile(), returning the -// guest profile means the caller should open the user manager. This may return -// null if neither any profile nor the user manager can be opened. -Profile* GetFallbackStartupProfile(); +// GetStartupProfile() returns kError. This may return kError if neither any +// profile nor the profile picker can be opened. +StartupProfileInfo GetFallbackStartupProfile(); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID) #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 01bcbb5..7268157 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -2032,9 +2032,19 @@ EXPECT_EQ(GURL(kTargetUrl), web_contents->GetVisibleURL()); } +// TODO(crbug.com/1226532): This test is flaky on Windows 7 debug builds. +// Fix and reenable it. +#if defined(OS_WIN) && defined(_DEBUG) +#define MAYBE_MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl \ + DISABLED_MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl +#else +#define MAYBE_MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl \ + MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl +#endif + IN_PROC_BROWSER_TEST_F( StartupBrowserWebAppUrlHandlingTest, - MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl) { + MAYBE_MultipleProfiles_DialogAccepted_WebAppLaunch_InScopeUrl) { views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{}, "WebAppUrlHandlerIntentPickerView"); @@ -3188,10 +3198,12 @@ // Simulate a second start when the browser is already running. base::FilePath current_dir = base::FilePath(); base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - StartupBrowserCreator::ProcessCommandLineAlreadyRunning( - command_line, current_dir, + StartupProfilePathInfo startup_profile_path_info = GetStartupProfilePath(current_dir, command_line, - /*ignore_profile_picker=*/false)); + /*ignore_profile_picker=*/false); + EXPECT_EQ(startup_profile_path_info.mode, StartupProfileMode::kProfilePicker); + StartupBrowserCreator::ProcessCommandLineAlreadyRunning( + command_line, current_dir, startup_profile_path_info.path); base::RunLoop().RunUntilIdle(); // The picker is shown again if no profile was previously opened.
diff --git a/chrome/browser/ui/tab_sharing/OWNERS b/chrome/browser/ui/tab_sharing/OWNERS index eb004e66..3ba0bf2 100644 --- a/chrome/browser/ui/tab_sharing/OWNERS +++ b/chrome/browser/ui/tab_sharing/OWNERS
@@ -1,2 +1,3 @@ marinaciocea@chromium.org guidou@chromium.org +eladalon@chromium.org
diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.cc b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.cc index eb85bffa..6723d4eb 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.cc +++ b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.cc
@@ -7,14 +7,104 @@ #include <utility> #include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/infobars/confirm_infobar_creator.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_sharing/tab_sharing_ui.h" #include "chrome/grit/generated_resources.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/infobars/core/infobar.h" +#include "components/url_formatter/elide_url.h" #include "components/vector_icons/vector_icons.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/web_contents_delegate.h" +#include "net/base/url_util.h" #include "ui/base/l10n/l10n_util.h" +class TabSharingInfoBarDelegateButton { + public: + virtual ~TabSharingInfoBarDelegateButton() = default; + virtual void Click(infobars::InfoBar* infobar) = 0; + virtual std::u16string GetLabel() const = 0; +}; + +// Represents a button which, when clicked, changes the shared tab to be +// the current tab (the one associated with this infobar.) +class ShareTabInsteadButton : public TabSharingInfoBarDelegateButton { + public: + explicit ShareTabInsteadButton(TabSharingUI* ui) : ui_(ui) {} + + ~ShareTabInsteadButton() override = default; + + void Click(infobars::InfoBar* infobar) override { + DCHECK(ui_); // Not verified in ctor to keep tests simple. + ui_->StartSharing(infobar); + } + + std::u16string GetLabel() const override { + return l10n_util::GetStringUTF16(IDS_TAB_SHARING_INFOBAR_SHARE_BUTTON); + } + + private: + TabSharingUI* const ui_; +}; + +// Represents a button which, when clicked, changes the activated tab to be +// the one which was hard-coded into this infobar. The intended use for this +// class is for the captured tab to activate the capturing tab, and vice versa. +class SwitchToTabButton : public TabSharingInfoBarDelegateButton { + public: + SwitchToTabButton(content::GlobalRenderFrameHostId focus_target, + bool focus_target_is_captured) + : focus_target_(focus_target), + focus_target_is_captured_(focus_target_is_captured) {} + ~SwitchToTabButton() override = default; + + void Click(infobars::InfoBar* infobar) override { + content::RenderFrameHost* const rfh = + content::RenderFrameHost::FromID(focus_target_); + if (!rfh) { + return; + } + + content::WebContents* const web_contents = + content::WebContents::FromRenderFrameHost(rfh); + DCHECK(web_contents); + + web_contents->GetDelegate()->ActivateContents(web_contents); + Browser* const browser = chrome::FindBrowserWithWebContents(web_contents); + if (browser && browser->window()) { + browser->window()->Activate(); + } + } + + std::u16string GetLabel() const override { + content::RenderFrameHost* const rfh = + content::RenderFrameHost::FromID(focus_target_); + if (!rfh) { + return GetDefaultLabel(); + } + return l10n_util::GetStringFUTF16( + IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON, + url_formatter::FormatUrlForSecurityDisplay( + rfh->GetLastCommittedURL().GetOrigin(), + url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS)); + } + + private: + std::u16string GetDefaultLabel() const { + return l10n_util::GetStringUTF16( + focus_target_is_captured_ + ? IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURED_BUTTON + : IDS_TAB_SHARING_INFOBAR_SWITCH_TO_CAPTURER_BUTTON); + } + + const content::GlobalRenderFrameHostId focus_target_; + const bool focus_target_is_captured_; +}; + // static infobars::InfoBar* TabSharingInfoBarDelegate::Create( infobars::ContentInfoBarManager* infobar_manager, @@ -22,11 +112,12 @@ const std::u16string& app_name, bool shared_tab, bool can_share, + absl::optional<content::GlobalRenderFrameHostId> focus_target, TabSharingUI* ui) { DCHECK(infobar_manager); - return infobar_manager->AddInfoBar( - CreateConfirmInfoBar(base::WrapUnique(new TabSharingInfoBarDelegate( - shared_tab_name, app_name, shared_tab, can_share, ui)))); + return infobar_manager->AddInfoBar(CreateConfirmInfoBar(base::WrapUnique( + new TabSharingInfoBarDelegate(shared_tab_name, app_name, shared_tab, + can_share, focus_target, ui)))); } TabSharingInfoBarDelegate::TabSharingInfoBarDelegate( @@ -34,12 +125,21 @@ std::u16string app_name, bool shared_tab, bool can_share, + absl::optional<content::GlobalRenderFrameHostId> focus_target, TabSharingUI* ui) : shared_tab_name_(std::move(shared_tab_name)), app_name_(std::move(app_name)), shared_tab_(shared_tab), - can_share_(can_share), - ui_(ui) {} + ui_(ui) { + if (focus_target.has_value()) { + secondary_button_ = + std::make_unique<SwitchToTabButton>(*focus_target, shared_tab); + } else if (can_share) { + secondary_button_ = std::make_unique<ShareTabInsteadButton>(ui_); + } +} + +TabSharingInfoBarDelegate::~TabSharingInfoBarDelegate() = default; bool TabSharingInfoBarDelegate::EqualsDelegate( InfoBarDelegate* delegate) const { @@ -72,13 +172,16 @@ std::u16string TabSharingInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { - return l10n_util::GetStringUTF16((button == BUTTON_OK) - ? IDS_TAB_SHARING_INFOBAR_STOP_BUTTON - : IDS_TAB_SHARING_INFOBAR_SHARE_BUTTON); + if (button == BUTTON_OK) { + return l10n_util::GetStringUTF16(IDS_TAB_SHARING_INFOBAR_STOP_BUTTON); + } else { + DCHECK(secondary_button_); + return secondary_button_->GetLabel(); + } } int TabSharingInfoBarDelegate::GetButtons() const { - return shared_tab_ || !can_share_ ? BUTTON_OK : BUTTON_OK | BUTTON_CANCEL; + return secondary_button_ ? BUTTON_OK | BUTTON_CANCEL : BUTTON_OK; } bool TabSharingInfoBarDelegate::Accept() { @@ -87,7 +190,8 @@ } bool TabSharingInfoBarDelegate::Cancel() { - ui_->StartSharing(infobar()); + DCHECK(secondary_button_); + secondary_button_->Click(infobar()); return false; }
diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.h b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.h index 972a47b5..af3c390 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.h +++ b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.h
@@ -6,42 +6,61 @@ #define CHROME_BROWSER_UI_TAB_SHARING_TAB_SHARING_INFOBAR_DELEGATE_H_ #include "components/infobars/core/confirm_infobar_delegate.h" +#include "content/public/browser/global_routing_id.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace infobars { class ContentInfoBarManager; class InfoBar; } +class TabSharingInfoBarDelegateButton; class TabSharingUI; // Creates an infobar for sharing a tab using desktopCapture() API; one delegate // per tab. -// Layout for currently shared tab: +// +// 1. Layout for currently shared tab: // "Sharing this tab to |app_name_| [Stop]" -// Layout for all other tabs: +// +// 2. Layout for capturing/captured tab: +// "Sharing |shared_tab_name_| to |app_name_| [Stop] [Switch-Label]" +// Where [Switch-Label] is "Switch to tab <hostname>", with the hostname for +// in the captured tab being the capturer's, and vice versa. +// +// 3a. Layout for all other tabs: // "Sharing |shared_tab_name_| to |app_name_| [Stop] [Share this tab instead]" -// or if |shared_tab_name_| is empty: +// 3b. Or if |shared_tab_name_| is empty: // "Sharing a tab to |app_name_| [Stop] [Share this tab instead]" class TabSharingInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a tab sharing infobar. If |shared_tab| is true, it creates an - // infobar with "currently shared tab" layout (see class comment). If - // |can_share| is false, [Share this tab] button is not displayed. + // Creates a tab sharing infobar, which has 1-2 buttons. + // + // The primary button is for stopping the capture. It is always present. + // + // If |focus_target| has a value, the secondary button switches focus. + // Else, if |can_share|, the secondary button changes the capture target + // to be the tab associated with |this| object. + // Otherwise, there is no secondary button. static infobars::InfoBar* Create( infobars::ContentInfoBarManager* infobar_manager, const std::u16string& shared_tab_name, const std::u16string& app_name, bool shared_tab, bool can_share, + absl::optional<content::GlobalRenderFrameHostId> focus_target, TabSharingUI* ui); - ~TabSharingInfoBarDelegate() override = default; + + ~TabSharingInfoBarDelegate() override; private: - TabSharingInfoBarDelegate(std::u16string shared_tab_name, - std::u16string app_name, - bool shared_tab, - bool can_share, - TabSharingUI* ui); + TabSharingInfoBarDelegate( + std::u16string shared_tab_name, + std::u16string app_name, + bool shared_tab, + bool can_share, + absl::optional<content::GlobalRenderFrameHostId> focus_target, + TabSharingUI* ui); // ConfirmInfoBarDelegate: bool EqualsDelegate(InfoBarDelegate* delegate) const override; @@ -57,11 +76,12 @@ const std::u16string shared_tab_name_; const std::u16string app_name_; - bool shared_tab_; - bool can_share_; + const bool shared_tab_; // Creates and removes delegate's infobar; outlives delegate. - TabSharingUI* ui_; + TabSharingUI* const ui_; + + std::unique_ptr<TabSharingInfoBarDelegateButton> secondary_button_; }; #endif // CHROME_BROWSER_UI_TAB_SHARING_TAB_SHARING_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc index 9456b53..f8cdc05f 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc +++ b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc
@@ -10,6 +10,7 @@ #include "chrome/test/base/browser_with_test_window_test.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/infobars/core/infobar.h" +#include "components/url_formatter/elide_url.h" #include "components/vector_icons/vector_icons.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -40,28 +41,56 @@ public: TabSharingInfoBarDelegateTest() {} - infobars::InfoBar* CreateInfobar(std::u16string shared_tab_name, - std::u16string app_name, - bool shared_tab, - bool can_share, - int tab_index = 0) { + infobars::InfoBar* CreateInfobar( + std::u16string shared_tab_name, + std::u16string app_name, + bool shared_tab, + bool can_share, + int tab_index = 0, + absl::optional<content::GlobalRenderFrameHostId> focus_target = + absl::nullopt) { return TabSharingInfoBarDelegate::Create( infobars::ContentInfoBarManager::FromWebContents( browser()->tab_strip_model()->GetWebContentsAt(tab_index)), - shared_tab_name, app_name, shared_tab, can_share, + shared_tab_name, app_name, shared_tab, can_share, focus_target, tab_sharing_mock_ui()); } - ConfirmInfoBarDelegate* CreateDelegate(std::u16string shared_tab_name, - std::u16string app_name, - bool shared_tab, - bool can_share, - int tab_index = 0) { - infobars::InfoBar* infobar = CreateInfobar( - shared_tab_name, app_name, shared_tab, can_share, tab_index); + ConfirmInfoBarDelegate* CreateDelegate( + std::u16string shared_tab_name, + std::u16string app_name, + bool shared_tab, + bool can_share, + int tab_index = 0, + absl::optional<content::GlobalRenderFrameHostId> focus_target = + absl::nullopt) { + infobars::InfoBar* infobar = + CreateInfobar(shared_tab_name, app_name, shared_tab, can_share, + tab_index, focus_target); return static_cast<ConfirmInfoBarDelegate*>(infobar->delegate()); } + content::WebContents* GetWebContents(int tab) { + return browser()->tab_strip_model()->GetWebContentsAt(tab); + } + + content::GlobalRenderFrameHostId GetGlobalId(int tab) { + auto* const main_frame = GetWebContents(tab)->GetMainFrame(); + return main_frame ? main_frame->GetGlobalId() + : content::GlobalRenderFrameHostId(); + } + + std::u16string GetExpectedSwitchToMessageForTargetTab(int tab) { + return l10n_util::GetStringFUTF16( + IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON, + url_formatter::FormatUrlForSecurityDisplay( + GetWebContents(tab) + ->GetMainFrame() + ->GetLastCommittedURL() + .GetOrigin(), + url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS)); + } + MockTabSharingUIViews* tab_sharing_mock_ui() { return &mock_ui; } private: @@ -87,19 +116,44 @@ } // Test that the infobar on the shared tab has the correct layout: -// "|icon| Sharing this tab to |app| [Stop]" -TEST_F(TabSharingInfoBarDelegateTest, InfobarOnSharedTab) { - AddTab(browser(), GURL("about:blank")); +// "|icon| Sharing this tab to |app| [Switch to captured]" +TEST_F(TabSharingInfoBarDelegateTest, InfobarOnCapturingTab) { + AddTab(browser(), GURL("about:blank")); // Captured; index = 0. + AddTab(browser(), GURL("about:blank")); // Capturing; index = 1. ConfirmInfoBarDelegate* delegate = - CreateDelegate(std::u16string(), kAppName, true, true); + CreateDelegate(std::u16string(), kAppName, true, true, 1, GetGlobalId(0)); EXPECT_STREQ(delegate->GetVectorIcon().name, vector_icons::kScreenShareIcon.name); EXPECT_EQ(delegate->GetMessageText(), l10n_util::GetStringFUTF16( IDS_TAB_SHARING_INFOBAR_SHARING_CURRENT_TAB_LABEL, kAppName)); - EXPECT_EQ(delegate->GetButtons(), ConfirmInfoBarDelegate::BUTTON_OK); + EXPECT_EQ(delegate->GetButtons(), ConfirmInfoBarDelegate::BUTTON_OK | + ConfirmInfoBarDelegate::BUTTON_CANCEL); EXPECT_EQ(delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK), l10n_util::GetStringUTF16(IDS_TAB_SHARING_INFOBAR_STOP_BUTTON)); + EXPECT_EQ(delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL), + GetExpectedSwitchToMessageForTargetTab(1)); + EXPECT_FALSE(delegate->IsCloseable()); +} + +// Test that the infobar on the shared tab has the correct layout: +// "|icon| Sharing this tab to |app| [Switch to capturer]" +TEST_F(TabSharingInfoBarDelegateTest, InfobarOnCapturedTab) { + AddTab(browser(), GURL("about:blank")); // Captured; index = 0. + AddTab(browser(), GURL("about:blank")); // Capturing; index = 1. + ConfirmInfoBarDelegate* delegate = + CreateDelegate(std::u16string(), kAppName, true, true, 0, GetGlobalId(1)); + EXPECT_STREQ(delegate->GetVectorIcon().name, + vector_icons::kScreenShareIcon.name); + EXPECT_EQ(delegate->GetMessageText(), + l10n_util::GetStringFUTF16( + IDS_TAB_SHARING_INFOBAR_SHARING_CURRENT_TAB_LABEL, kAppName)); + EXPECT_EQ(delegate->GetButtons(), ConfirmInfoBarDelegate::BUTTON_OK | + ConfirmInfoBarDelegate::BUTTON_CANCEL); + EXPECT_EQ(delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK), + l10n_util::GetStringUTF16(IDS_TAB_SHARING_INFOBAR_STOP_BUTTON)); + EXPECT_EQ(delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL), + GetExpectedSwitchToMessageForTargetTab(0)); EXPECT_FALSE(delegate->IsCloseable()); }
diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_ui.h b/chrome/browser/ui/tab_sharing/tab_sharing_ui.h index 6008ec4..ac88e1c 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_ui.h +++ b/chrome/browser/ui/tab_sharing/tab_sharing_ui.h
@@ -8,6 +8,7 @@ #include <string> #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" +#include "content/public/browser/global_routing_id.h" namespace infobars { class InfoBar; @@ -19,6 +20,7 @@ ~TabSharingUI() override = default; static std::unique_ptr<TabSharingUI> Create( + content::GlobalRenderFrameHostId capturer, const content::DesktopMediaID& media_id, std::u16string app_name);
diff --git a/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc b/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc index b0292b0c..5420198 100644 --- a/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc +++ b/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc
@@ -114,7 +114,7 @@ void EnsureTabLoaded(content::WebContents* tab) { content::NavigationController* controller = &tab->GetController(); if (!controller->NeedsReload() && !controller->GetPendingEntry() && - !controller->GetWebContents()->IsLoading()) + !tab->IsLoading()) return; content::WindowedNotificationObserver observer(
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc index b1009d1..e9a5b6c 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
@@ -536,7 +536,7 @@ BackForwardMenuModel back_model(browser.get(), BackForwardMenuModel::ModelType::kBackward); - back_model.set_test_web_contents(controller().GetWebContents()); + back_model.set_test_web_contents(web_contents()); back_model.SetMenuModelDelegate(&favicon_delegate); SkBitmap new_icon_bitmap(CreateBitmap(SK_ColorRED));
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc index a0cfa00..25fa1d6 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc
@@ -92,6 +92,32 @@ return false; } +bool BrowserDesktopWindowTreeHostLinux::SupportsMouseLock() { + auto* wayland_extension = ui::GetWaylandExtension(*platform_window()); + if (!wayland_extension) + return false; + + return wayland_extension->SupportsPointerLock(); +} + +void BrowserDesktopWindowTreeHostLinux::LockMouse(aura::Window* window) { + DesktopWindowTreeHostLinux::LockMouse(window); + + if (SupportsMouseLock()) { + auto* wayland_extension = ui::GetWaylandExtension(*platform_window()); + wayland_extension->LockPointer(true /*enabled*/); + } +} + +void BrowserDesktopWindowTreeHostLinux::UnlockMouse(aura::Window* window) { + DesktopWindowTreeHostLinux::UnlockMouse(window); + + if (SupportsMouseLock()) { + auto* wayland_extension = ui::GetWaylandExtension(*platform_window()); + wayland_extension->LockPointer(false /*enabled*/); + } +} + void BrowserDesktopWindowTreeHostLinux::TabDraggingKindChanged( TabDragKind tab_drag_kind) { // If there's no tabs left, the browser window is about to close, so don't
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h index d96ec4a..a7abd0d 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h
@@ -56,6 +56,9 @@ void Init(const views::Widget::InitParams& params) override; void OnWidgetInitDone() override; void CloseNow() override; + bool SupportsMouseLock() override; + void LockMouse(aura::Window* window) override; + void UnlockMouse(aura::Window* window) override; // ui::X11ExtensionDelegate: bool IsOverrideRedirect(bool is_tiling_wm) const override;
diff --git a/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view.cc b/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view.cc index ea15785b..23dd437 100644 --- a/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view.cc +++ b/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view.cc
@@ -90,7 +90,7 @@ PageInfoBubbleViewBase::BUBBLE_ACCURACY_TIP, web_contents), close_callback_(std::move(close_callback)) { - DCHECK(status == accuracy_tips::AccuracyTipStatus::kMisinformation); + DCHECK(status == accuracy_tips::AccuracyTipStatus::kShowAccuracyTip); views::BubbleDialogDelegateView::CreateBubble(this);
diff --git a/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view_browsertest.cc index de09cc46..e685bcf 100644 --- a/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/accuracy_tip_bubble_view_browsertest.cc
@@ -81,8 +81,8 @@ ui_test_utils::NavigateToURL(browser(), GetUrl("badurl.com")); EXPECT_TRUE(IsUIShowing()); - histogram_tester()->ExpectUniqueSample("Privacy.AccuracyTip.PageStatus", - AccuracyTipStatus::kMisinformation, 1); + histogram_tester()->ExpectUniqueSample( + "Privacy.AccuracyTip.PageStatus", AccuracyTipStatus::kShowAccuracyTip, 1); } IN_PROC_BROWSER_TEST_F(AccuracyTipBubbleViewBrowserTest, PressIgnoreButton) { @@ -141,7 +141,7 @@ // DialogBrowserTest: void ShowUi(const std::string& name) override { ShowAccuracyTipDialog(browser()->tab_strip_model()->GetActiveWebContents(), - accuracy_tips::AccuracyTipStatus::kMisinformation, + accuracy_tips::AccuracyTipStatus::kShowAccuracyTip, base::DoNothing()); } };
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc index cba0e4a..e9ca6d5 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/location_icon_view.h" +#include "chrome/browser/ui/views/page_info/page_info_new_bubble_view.h" #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/common/chrome_features.h" @@ -25,6 +26,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/page_info/features.h" #include "components/page_info/page_info.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/safe_browsing/content/browser/password_protection/password_protection_test_util.h" @@ -122,11 +124,23 @@ } // namespace -class PageInfoBubbleViewBrowserTest : public InProcessBrowserTest { +class PageInfoBubbleViewBrowserTest + : public InProcessBrowserTest, + public ::testing::WithParamInterface<bool> { public: - PageInfoBubbleViewBrowserTest() = default; + PageInfoBubbleViewBrowserTest() { + feature_list_.InitWithFeatureState(page_info::kPageInfoV2Desktop, + is_page_info_v2_enabled()); + } + + PageInfoBubbleViewBrowserTest(const PageInfoBubbleViewBrowserTest& test) = + delete; + PageInfoBubbleViewBrowserTest& operator=( + const PageInfoBubbleViewBrowserTest& test) = delete; protected: + bool is_page_info_v2_enabled() const { return GetParam(); } + GURL GetSimplePageUrl() const { return ui_test_utils::GetTestUrl( base::FilePath(base::FilePath::kCurrentDirectory), @@ -155,12 +169,22 @@ run_loop.Run(); } - void TriggerReloadPromptOnClose() const { - PageInfoBubbleView* const page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); - ASSERT_NE(nullptr, page_info_bubble_view); + PageInfo* GetPresenter() const { + PageInfo* presenter = nullptr; + if (is_page_info_v2_enabled()) { + presenter = static_cast<PageInfoNewBubbleView*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()) + ->presenter_.get(); + } else { + presenter = static_cast<PageInfoBubbleView*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()) + ->presenter_.get(); + } + DCHECK(presenter); + return presenter; + } + void TriggerReloadPromptOnClose() const { // Set some dummy non-default permissions. This will trigger a reload prompt // when the bubble is closed. PageInfo::PermissionInfo permission; @@ -168,59 +192,76 @@ permission.setting = ContentSetting::CONTENT_SETTING_BLOCK; permission.default_setting = ContentSetting::CONTENT_SETTING_ASK; permission.source = content_settings::SettingSource::SETTING_SOURCE_USER; - page_info_bubble_view->OnPermissionChanged(permission); + GetPresenter()->OnSitePermissionChanged(permission.type, permission.setting, + permission.is_one_time); } void SetPageInfoBubbleIdentityInfo( const PageInfoUI::IdentityInfo& identity_info) { - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()) - ->SetIdentityInfo(identity_info); + auto* presenter = GetPresenter(); + EXPECT_TRUE(presenter->ui_for_testing()); + presenter->ui_for_testing()->SetIdentityInfo(identity_info); } std::u16string GetCertificateButtonTitle() const { // Only PageInfoBubbleViewBrowserTest can access certificate_button_ in // PageInfoBubbleView, or title() in HoverButton. - PageInfoBubbleView* page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); - return page_info_bubble_view->certificate_button_->title()->GetText(); + auto* certificate_button = static_cast<PageInfoHoverButton*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory:: + VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_CERTIFICATE_VIEWER)); + return certificate_button->title()->GetText(); } std::u16string GetCertificateButtonSubtitle() const { - PageInfoBubbleView* page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); - return page_info_bubble_view->certificate_button_->subtitle()->GetText(); + auto* certificate_button = static_cast<PageInfoHoverButton*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory:: + VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_CERTIFICATE_VIEWER)); + return certificate_button->subtitle()->GetText(); } const std::u16string GetPageInfoBubbleViewDetailText() { - PageInfoBubbleView* page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); - return page_info_bubble_view->details_text(); + auto* label = + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL); + return static_cast<views::StyledLabel*>(label)->GetText(); + } + + const std::u16string GetPageInfoBubbleViewSummaryText() { + auto* label = + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_SUMMARY_LABEL); + return static_cast<views::StyledLabel*>(label)->GetText(); + } + + const std::u16string GetSecurityInformationButtonText() { + auto* button = + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory:: + VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_SECURITY_INFORMATION); + return static_cast<PageInfoHoverButton*>(button)->title()->GetText(); } private: std::vector<PageInfoViewFactory::PageInfoViewID> expected_identifiers_; - - DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewBrowserTest); + base::test::ScopedFeatureList feature_list_; }; -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, ShowBubble) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ShowBubble) { OpenPageInfoBubble(browser()); EXPECT_EQ(PageInfoBubbleView::BUBBLE_PAGE_INFO, PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, ChromeURL) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ChromeURL) { ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); OpenPageInfoBubble(browser()); EXPECT_EQ(PageInfoBubbleView::BUBBLE_INTERNAL_PAGE, PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, ChromeExtensionURL) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ChromeExtensionURL) { ui_test_utils::NavigateToURL( browser(), GURL("chrome-extension://extension-id/options.html")); OpenPageInfoBubble(browser()); @@ -228,7 +269,7 @@ PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, ChromeDevtoolsURL) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ChromeDevtoolsURL) { ui_test_utils::NavigateToURL( browser(), GURL("devtools://devtools/bundled/inspector.html")); OpenPageInfoBubble(browser()); @@ -236,7 +277,7 @@ PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, ViewSourceURL) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ViewSourceURL) { ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); browser() ->tab_strip_model() @@ -250,7 +291,7 @@ // Test opening "Site Details" via Page Info from an ASCII origin does the // correct URL canonicalization. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, SiteSettingsLink) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, SiteSettingsLink) { GURL url = GURL("https://www.google.com/"); std::string expected_origin = "https%3A%2F%2Fwww.google.com"; EXPECT_EQ(GURL(chrome::kChromeUISiteDetailsPrefixURL + expected_origin), @@ -259,7 +300,7 @@ // Test opening "Site Details" via Page Info from a non-ASCII URL converts it to // an origin and does punycode conversion as well as URL canonicalization. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, SiteSettingsLinkWithNonAsciiUrl) { GURL url = GURL("http://🥄.ws/other/stuff.htm"); std::string expected_origin = "http%3A%2F%2Fxn--9q9h.ws"; @@ -269,7 +310,7 @@ // Test opening "Site Details" via Page Info from an origin with a non-default // (scheme, port) pair will specify port # in the origin passed to query params. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, SiteSettingsLinkWithNonDefaultPort) { GURL url = GURL("https://www.example.com:8372"); std::string expected_origin = "https%3A%2F%2Fwww.example.com%3A8372"; @@ -279,7 +320,7 @@ // Test opening "Site Details" via Page Info from about:blank goes to "Content // Settings" (the alternative is a blank origin being sent to "Site Details"). -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, SiteSettingsLinkWithAboutBlankURL) { EXPECT_EQ(GURL(chrome::kChromeUIContentSettingsURL), OpenSiteSettingsForUrl(browser(), GURL(url::kAboutBlankURL))); @@ -287,7 +328,7 @@ // Test opening page info bubble that matches // SB_THREAT_TYPE_ENTERPRISE_PASSWORD_REUSE threat type. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, VerifyEnterprisePasswordReusePageInfoBubble) { ASSERT_TRUE(embedded_test_server()->Start()); base::HistogramTester histograms; @@ -327,7 +368,8 @@ ASSERT_EQ(security_state::MALICIOUS_CONTENT_STATUS_ENTERPRISE_PASSWORD_REUSE, visible_security_state->malicious_content_status); ASSERT_EQ(l10n_util::GetStringUTF16( - IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_ENTERPRISE), + IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_ENTERPRISE) + + u" " + l10n_util::GetStringUTF16(IDS_LEARN_MORE), GetPageInfoBubbleViewDetailText()); // Verify these two buttons are showing. @@ -368,7 +410,7 @@ // Test opening page info bubble that matches // SB_THREAT_TYPE_SAVED_PASSWORD_REUSE threat type. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, VerifySavedPasswordReusePageInfoBubble) { ASSERT_TRUE(embedded_test_server()->Start()); base::HistogramTester histograms; @@ -442,7 +484,7 @@ visible_security_state->malicious_content_status); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ClosesOnUserNavigateToSamePage) { ui_test_utils::NavigateToURL(browser(), GetSimplePageUrl()); EXPECT_EQ(PageInfoBubbleView::BUBBLE_NONE, @@ -455,7 +497,7 @@ PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, ClosesOnUserNavigateToDifferentPage) { ui_test_utils::NavigateToURL(browser(), GetSimplePageUrl()); EXPECT_EQ(PageInfoBubbleView::BUBBLE_NONE, @@ -468,7 +510,7 @@ PageInfoBubbleView::GetShownBubbleType()); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, DoesntCloseOnSubframeNavigate) { ui_test_utils::NavigateToURL(browser(), GetIframePageUrl()); EXPECT_EQ(PageInfoBubbleView::BUBBLE_NONE, @@ -498,8 +540,12 @@ base::test::ScopedFeatureList feature_list; }; +INSTANTIATE_TEST_SUITE_P(All, + PageInfoBubbleViewBrowserTestWithAutoupgradesDisabled, + ::testing::Values(false, true)); + // Ensure changes to security state are reflected in an open PageInfo bubble. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTestWithAutoupgradesDisabled, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTestWithAutoupgradesDisabled, UpdatesOnSecurityStateChange) { net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); https_server.AddDefaultHandlers( @@ -513,17 +559,27 @@ views::BubbleDialogDelegateView* page_info = PageInfoBubbleView::GetPageInfoBubbleForTesting(); - EXPECT_EQ(page_info->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURE_SUMMARY)); + if (is_page_info_v2_enabled()) { + EXPECT_EQ(GetSecurityInformationButtonText(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURE_SUMMARY)); + } else { + EXPECT_EQ(page_info->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURE_SUMMARY)); + } ExecuteJavaScriptForTests("load_mixed();"); - EXPECT_EQ(page_info->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY)); + if (is_page_info_v2_enabled()) { + EXPECT_EQ(GetPageInfoBubbleViewSummaryText(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY)); + } else { + EXPECT_EQ(page_info->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY)); + } } // Ensure a page can both have an invalid certificate *and* be blocked by Safe // Browsing. Regression test for bug 869925. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, BlockedAndInvalidCert) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, BlockedAndInvalidCert) { net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); https_server.AddDefaultHandlers( base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); @@ -545,20 +601,31 @@ PageInfoBubbleView::GetPageInfoBubbleForTesting(); // Verify bubble complains of malware... - EXPECT_EQ(page_info->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + if (is_page_info_v2_enabled()) { + EXPECT_EQ(GetPageInfoBubbleViewSummaryText(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + } else { + EXPECT_EQ(page_info->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + } // ...and has a "Certificate (Invalid)" button. - const std::u16string invalid_parens = l10n_util::GetStringUTF16( - IDS_PAGE_INFO_CERTIFICATE_INVALID_PARENTHESIZED); - EXPECT_EQ(GetCertificateButtonTitle(), - l10n_util::GetStringFUTF16(IDS_PAGE_INFO_CERTIFICATE_BUTTON_TEXT, - invalid_parens)); + std::u16string invalid_text; + if (is_page_info_v2_enabled()) { + invalid_text = + l10n_util::GetStringUTF16(IDS_PAGE_INFO_CERTIFICATE_IS_NOT_VALID); + } else { + const std::u16string invalid_subtext = l10n_util::GetStringUTF16( + IDS_PAGE_INFO_CERTIFICATE_INVALID_PARENTHESIZED); + invalid_text = l10n_util::GetStringFUTF16( + IDS_PAGE_INFO_CERTIFICATE_BUTTON_TEXT, invalid_subtext); + } + EXPECT_EQ(GetCertificateButtonTitle(), invalid_text); } // Ensure a page that has an EV certificate *and* is blocked by Safe Browsing // shows the correct PageInfo UI. Regression test for crbug.com/1014240. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, MalwareAndEvCert) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, MalwareAndEvCert) { net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); https_server.AddDefaultHandlers( base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); @@ -587,8 +654,13 @@ PageInfoBubbleView::GetPageInfoBubbleForTesting(); // Verify bubble complains of malware... - EXPECT_EQ(page_info->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + if (is_page_info_v2_enabled()) { + EXPECT_EQ(GetPageInfoBubbleViewSummaryText(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + } else { + EXPECT_EQ(page_info->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_MALWARE_SUMMARY)); + } // ...and has the correct organization details in the Certificate button. EXPECT_EQ(GetCertificateButtonSubtitle(), @@ -701,7 +773,7 @@ // Test that when the PageInfo bubble is closed, focus is returned to the web // contents pane. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, MAYBE_FocusReturnsToContentOnClose) { content::WebContents* const web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -710,8 +782,8 @@ web_contents_focus_tracker.WaitForFocus(true); OpenPageInfoBubble(browser()); - PageInfoBubbleView* page_info_bubble_view = static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); + auto* page_info_bubble_view = + PageInfoBubbleView::GetPageInfoBubbleForTesting(); EXPECT_FALSE(web_contents_focus_tracker.focused()); page_info_bubble_view->GetWidget()->CloseWithReason( @@ -733,7 +805,7 @@ // displayed, focus is NOT returned to the web contents pane, but rather returns // to the location bar so accessibility users must tab through the reload prompt // before getting back to web contents (see https://crbug.com/910067). -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewBrowserTest, MAYBE_FocusDoesNotReturnToContentsOnReloadPrompt) { content::WebContents* const web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -744,8 +816,8 @@ web_contents_focus_tracker.WaitForFocus(true); OpenPageInfoBubble(browser()); - PageInfoBubbleView* page_info_bubble_view = static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); + auto* page_info_bubble_view = + PageInfoBubbleView::GetPageInfoBubbleForTesting(); EXPECT_FALSE(web_contents_focus_tracker.focused()); TriggerReloadPromptOnClose(); @@ -756,3 +828,8 @@ EXPECT_TRUE(location_bar_focus_tracker.focused()); EXPECT_FALSE(web_contents_focus_tracker.focused()); } + +// Run tests with kPageInfoV2Desktop flag enabled and disabled. +INSTANTIATE_TEST_SUITE_P(All, + PageInfoBubbleViewBrowserTest, + ::testing::Values(false, true));
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_dialog_browsertest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_dialog_browsertest.cc index 7058f20..abe8721 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_dialog_browsertest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_dialog_browsertest.cc
@@ -9,11 +9,14 @@ #include "chrome/browser/ui/test/test_browser_dialog.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_icon_view.h" +#include "chrome/browser/ui/views/page_info/page_info_main_view.h" +#include "chrome/browser/ui/views/page_info/page_info_new_bubble_view.h" #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/browser/content_settings_registry.h" +#include "components/page_info/features.h" #include "components/page_info/page_info.h" #include "components/safe_browsing/content/browser/password_protection/password_protection_test_util.h" #include "components/safe_browsing/core/browser/password_protection/metrics_util.h" @@ -60,16 +63,31 @@ } // namespace -class PageInfoBubbleViewDialogBrowserTest : public DialogBrowserTest { +class PageInfoBubbleViewDialogBrowserTest + : public DialogBrowserTest, + public ::testing::WithParamInterface<bool> { public: - PageInfoBubbleViewDialogBrowserTest() = default; + PageInfoBubbleViewDialogBrowserTest() { + feature_list_.InitWithFeatureState(page_info::kPageInfoV2Desktop, + is_page_info_v2_enabled()); + } + + PageInfoBubbleViewDialogBrowserTest( + const PageInfoBubbleViewDialogBrowserTest& test) = delete; + PageInfoBubbleViewDialogBrowserTest& operator=( + const PageInfoBubbleViewDialogBrowserTest& test) = delete; + + bool is_page_info_v2_enabled() const { return GetParam(); } // DialogBrowserTest: - void ShowUi(const std::string& name) override { + void ShowUi(const std::string& name_with_param_suffix) override { // Bubble dialogs' bounds may exceed the display's work area. // https://crbug.com/893292. set_should_verify_dialog_bounds(false); + const std::string& name = + name_with_param_suffix.substr(0, name_with_param_suffix.find("/")); + // All the possible test names. constexpr char kInsecure[] = "Insecure"; constexpr char kInternal[] = "Internal"; @@ -77,7 +95,9 @@ constexpr char kInternalViewSource[] = "InternalViewSource"; constexpr char kFile[] = "File"; constexpr char kSecure[] = "Secure"; + constexpr char kSecureSubpage[] = "SecureSubpage"; constexpr char kEvSecure[] = "EvSecure"; + constexpr char kEvSecureSubpage[] = "EvSecureSubpage"; constexpr char kMalware[] = "Malware"; constexpr char kDeceptive[] = "Deceptive"; constexpr char kUnwantedSoftware[] = "UnwantedSoftware"; @@ -99,6 +119,7 @@ // URL each IdentityInfo type would normally be associated with. const GURL https_url("https://example.com"); const GURL http_url("http://example.com"); + const std::string kSiteOrigin = "example.com"; GURL url = http_url; if (name == kSecure || name == kEvSecure || name == kMixedContentForm || @@ -127,13 +148,13 @@ if (name == kInsecure) { identity.identity_status = PageInfo::SITE_IDENTITY_STATUS_NO_CERT; } else if (name == kSecure || name == kAllowAllPermissions || - name == kBlockAllPermissions) { + name == kBlockAllPermissions || name == kSecureSubpage) { // Generate a valid mock HTTPS identity, with a certificate. identity.identity_status = PageInfo::SITE_IDENTITY_STATUS_CERT; constexpr char kGoodCertificateFile[] = "ok_cert.pem"; identity.certificate = net::ImportCertFromFile( net::GetTestCertsDirectory(), kGoodCertificateFile); - } else if (name == kEvSecure) { + } else if (name == kEvSecure || name == kEvSecureSubpage) { // Generate a valid mock EV HTTPS identity, with an EV certificate. Must // match conditions in PageInfoBubbleView::SetIdentityInfo() for setting // the certificate button subtitle. @@ -210,19 +231,31 @@ } ChosenObjectInfoList chosen_object_list; - - PageInfoBubbleView* page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); + PageInfo* presenter = GetPresenter(); + EXPECT_TRUE(presenter); + EXPECT_TRUE(presenter->ui_for_testing()); + auto* current_ui = presenter->ui_for_testing(); + views::View* bubble_view = + PageInfoBubbleView::GetPageInfoBubbleForTesting(); // Normally |PageInfoBubbleView| doesn't update the permissions already // shown if they change while it's still open. For this test, manually // force an update by clearing the existing permission views here. - page_info_bubble_view->GetFocusManager()->SetFocusedView(nullptr); - page_info_bubble_view->selector_rows_.clear(); - page_info_bubble_view->permissions_view_->RemoveAllChildViews(true); + bubble_view->GetFocusManager()->SetFocusedView(nullptr); - page_info_bubble_view->SetPermissionInfo(permissions_list, - std::move(chosen_object_list)); + if (is_page_info_v2_enabled()) { + auto* main_page = static_cast<PageInfoMainView*>(current_ui); + main_page->selector_rows_.clear(); + main_page->permissions_view_->RemoveAllChildViews(true); + + } else { + auto* page_info_bubble_view = + static_cast<PageInfoBubbleView*>(bubble_view); + page_info_bubble_view->selector_rows_.clear(); + page_info_bubble_view->permissions_view_->RemoveAllChildViews(true); + } + + current_ui->SetPermissionInfo(permissions_list, + std::move(chosen_object_list)); } if (name == kSignInSyncPasswordReuse || @@ -239,13 +272,21 @@ &placeholder_offsets); } + if (name == kSecureSubpage || name == kEvSecureSubpage) { + PageInfoNewBubbleView* bubble_view = static_cast<PageInfoNewBubbleView*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()); + bubble_view->OpenSecurityPage(); + } + if (name != kInsecure && name.find(kInternal) == std::string::npos && name != kFile) { + identity.site_identity = kSiteOrigin; // The bubble may be PageInfoBubbleView or InternalPageInfoBubbleView. The // latter is only used for |kInternal|, so it is safe to static_cast here. - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()) - ->SetIdentityInfo(identity); + PageInfo* presenter = GetPresenter(); + EXPECT_TRUE(presenter); + EXPECT_TRUE(presenter->ui_for_testing()); + presenter->ui_for_testing()->SetIdentityInfo(identity); } } @@ -263,70 +304,96 @@ return true; } + PageInfo* GetPresenter() { + if (is_page_info_v2_enabled()) { + return static_cast<PageInfoNewBubbleView*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()) + ->presenter_.get(); + } + + return static_cast<PageInfoBubbleView*>( + PageInfoBubbleView::GetPageInfoBubbleForTesting()) + ->presenter_.get(); + } + private: std::vector<PageInfoViewFactory::PageInfoViewID> expected_identifiers_; - - DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewDialogBrowserTest); + base::test::ScopedFeatureList feature_list_; }; // Shows the Page Info bubble for a HTTP page (specifically, about:blank). -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Insecure) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Insecure) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a HTTPS page. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Secure) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Secure) { ShowAndVerifyUi(); } -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_EvSecure) { +// Shows the Page Info bubble for a HTTPS page. +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, + InvokeUi_SecureSubpage) { + if (!is_page_info_v2_enabled()) + return; + ShowAndVerifyUi(); +} + +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_EvSecure) { + ShowAndVerifyUi(); +} + +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, + InvokeUi_EvSecureSubpage) { + if (!is_page_info_v2_enabled()) + return; ShowAndVerifyUi(); } // Shows the Page Info bubble for an internal page, e.g. chrome://settings. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Internal) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Internal) { ShowAndVerifyUi(); } // Shows the Page Info bubble for an extensions page. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_InternalExtension) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a chrome page that displays the source HTML. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_InternalViewSource) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a file:// URL. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_File) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_File) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a site flagged for malware by Safe Browsing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Malware) { +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Malware) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a site flagged for social engineering by Safe // Browsing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_Deceptive) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a site flagged for distributing unwanted // software by Safe Browsing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_UnwantedSoftware) { ShowAndVerifyUi(); } // Shows the Page Info bubble for a site flagged for malware that also has a bad // certificate. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_MalwareAndBadCert) { ShowAndVerifyUi(); } @@ -334,14 +401,14 @@ // Disabled because of flakiness: crbug.com/1208502. // Shows the Page Info bubble for an admin-provided cert when the page is // secure, but has a form that submits to an insecure url. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, DISABLED_InvokeUi_MixedContentForm) { ShowAndVerifyUi(); } // Shows the Page Info bubble for an admin-provided cert when the page is // secure, but it uses insecure resources (e.g. images). -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_MixedContent) { ShowAndVerifyUi(); } @@ -354,7 +421,7 @@ #else #define MAYBE_InvokeUi_AllowAllPermissions InvokeUi_AllowAllPermissions #endif -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, MAYBE_InvokeUi_AllowAllPermissions) { ShowAndVerifyUi(); } @@ -367,14 +434,14 @@ #else #define MAYBE_InvokeUi_BlockAllPermissions InvokeUi_BlockAllPermissions #endif -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, MAYBE_InvokeUi_BlockAllPermissions) { ShowAndVerifyUi(); } // Shows the Page Info bubble Safe Browsing warning after detecting the user has // re-used an existing password on a site, e.g. due to phishing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_SavedPasswordReuse) { ShowAndVerifyUi(); } @@ -382,14 +449,14 @@ // Shows the Page Info bubble Safe Browsing warning after detecting the // signed-in syncing user has re-used an existing password on a site, e.g. due // to phishing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_SignInSyncPasswordReuse) { ShowAndVerifyUi(); } // Shows the Page Info bubble Safe Browsing warning after detecting the // signed-in not syncing user has re-used an existing password on a site, e.g. // due to phishing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_SignInNonSyncPasswordReuse) { ShowAndVerifyUi(); } @@ -397,7 +464,12 @@ // Shows the Page Info bubble Safe Browsing warning after detecting the // enterprise user has re-used an existing password on a site, e.g. due to // phishing. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewDialogBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewDialogBrowserTest, InvokeUi_EnterprisePasswordReuse) { ShowAndVerifyUi(); } + +// Run tests with kPageInfoV2Desktop flag enabled and disabled. +INSTANTIATE_TEST_SUITE_P(All, + PageInfoBubbleViewDialogBrowserTest, + ::testing::Values(false, true));
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_sync_browsertest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_sync_browsertest.cc index 3efca19..6a92714 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_sync_browsertest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_sync_browsertest.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/page_info/features.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/safe_browsing/content/browser/password_protection/password_protection_test_util.h" #include "components/safe_browsing/core/browser/password_protection/metrics_util.h" @@ -86,11 +87,23 @@ } // namespace // This test suite tests functionality that requires Sync to be active. -class PageInfoBubbleViewSyncBrowserTest : public SyncTest { +class PageInfoBubbleViewSyncBrowserTest + : public SyncTest, + public ::testing::WithParamInterface<bool> { public: - PageInfoBubbleViewSyncBrowserTest() : SyncTest(SINGLE_CLIENT) {} + PageInfoBubbleViewSyncBrowserTest() : SyncTest(SINGLE_CLIENT) { + feature_list_.InitWithFeatureState(page_info::kPageInfoV2Desktop, + is_page_info_v2_enabled()); + } + + PageInfoBubbleViewSyncBrowserTest( + const PageInfoBubbleViewSyncBrowserTest& chip) = delete; + PageInfoBubbleViewSyncBrowserTest& operator=( + const PageInfoBubbleViewSyncBrowserTest& chip) = delete; protected: + bool is_page_info_v2_enabled() const { return GetParam(); } + void SetupSyncForAccount(Profile* profile) { syncer::SyncServiceImpl* sync_service = SyncServiceFactory::GetAsSyncServiceImplForProfile(profile); @@ -130,18 +143,18 @@ } const std::u16string GetPageInfoBubbleViewDetailText() { - PageInfoBubbleView* page_info_bubble_view = - static_cast<PageInfoBubbleView*>( - PageInfoBubbleView::GetPageInfoBubbleForTesting()); - return page_info_bubble_view->details_text(); + auto* label = + PageInfoBubbleView::GetPageInfoBubbleForTesting()->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL); + return static_cast<views::StyledLabel*>(label)->GetText(); } - DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewSyncBrowserTest); + base::test::ScopedFeatureList feature_list_; }; // Test opening page info bubble that matches // SB_THREAT_TYPE_GAIA_PASSWORD_REUSE threat type. -IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewSyncBrowserTest, +IN_PROC_BROWSER_TEST_P(PageInfoBubbleViewSyncBrowserTest, VerifySignInPasswordReusePageInfoBubble) { Profile* profile = browser()->profile(); // PageInfo calls GetPasswordProtectionReusedPasswordAccountType which checks @@ -187,7 +200,8 @@ security_state::MALICIOUS_CONTENT_STATUS_SIGNED_IN_SYNC_PASSWORD_REUSE, visible_security_state->malicious_content_status); ASSERT_EQ( - l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_SYNC), + l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_SYNC) + + u" " + l10n_util::GetStringUTF16(IDS_LEARN_MORE), GetPageInfoBubbleViewDetailText()); // Verify these two buttons are showing. @@ -223,3 +237,8 @@ EXPECT_EQ(security_state::MALICIOUS_CONTENT_STATUS_NONE, visible_security_state->malicious_content_status); } + +// Run tests with kPageInfoV2Desktop flag enabled and disabled. +INSTANTIATE_TEST_SUITE_P(All, + PageInfoBubbleViewSyncBrowserTest, + ::testing::Values(false, true));
diff --git a/chrome/browser/ui/views/page_info/page_info_main_view.h b/chrome/browser/ui/views/page_info/page_info_main_view.h index bb65eaa6..91fc08b 100644 --- a/chrome/browser/ui/views/page_info/page_info_main_view.h +++ b/chrome/browser/ui/views/page_info/page_info_main_view.h
@@ -56,6 +56,8 @@ const std::u16string details_text() const { return details_text_; } private: + friend class PageInfoBubbleViewDialogBrowserTest; + // Creates a view with vertical box layout that will used a container for // other views. std::unique_ptr<views::View> CreateContainerView() WARN_UNUSED_RESULT;
diff --git a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.cc b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.cc index b9e88ac8..830506e1 100644 --- a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.cc
@@ -83,6 +83,10 @@ views::Widget::ClosedReason::kCloseButtonClicked); } +void PageInfoNewBubbleView::DidChangeVisibleSecurityState() { + presenter_->UpdateSecurityState(); +} + void PageInfoNewBubbleView::OnWidgetDestroying(views::Widget* widget) { PageInfoBubbleViewBase::OnWidgetDestroying(widget);
diff --git a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h index 5fc63cd2..69cacc5 100644 --- a/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h +++ b/chrome/browser/ui/views/page_info/page_info_new_bubble_view.h
@@ -37,7 +37,13 @@ void OpenPermissionPage(ContentSettingsType type) override; void CloseBubble() override; + // WebContentsObserver: + void DidChangeVisibleSecurityState() override; + private: + friend class PageInfoBubbleViewBrowserTest; + friend class PageInfoBubbleViewDialogBrowserTest; + // PageInfoBubbleViewBase: gfx::Size CalculatePreferredSize() const override; void OnWidgetDestroying(views::Widget* widget) override;
diff --git a/chrome/browser/ui/views/page_info/page_info_security_content_view.cc b/chrome/browser/ui/views/page_info/page_info_security_content_view.cc index c906693..cb11ff1 100644 --- a/chrome/browser/ui/views/page_info/page_info_security_content_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_security_content_view.cc
@@ -136,6 +136,7 @@ }, this)); } + PreferredSizeChanged(); } void PageInfoSecurityContentView::ResetDecisionsClicked() {
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc index 774d9b5..c20022ba 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h" +#include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/page_info/page_info_main_view.h" #include "chrome/browser/ui/views/page_info/page_info_navigation_handler.h" @@ -152,6 +153,8 @@ base::Unretained(navigation_handler_)), vector_icons::kArrowBackIcon); views::InstallCircleHighlightPathGenerator(back_button.get()); + back_button->SetID(VIEW_ID_BACK_BUTTON); + back_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)); back_button->SetProperty(views::kInternalPaddingKey, back_button->GetInsets()); header->AddChildView(std::move(back_button)); @@ -173,6 +176,7 @@ auto close_button = views::BubbleFrameView::CreateCloseButton( base::BindRepeating(&PageInfoNavigationHandler::CloseBubble, base::Unretained(navigation_handler_))); + close_button->SetID(VIEW_ID_PAGE_INFO_CLOSE_BUTTON); close_button->SetVisible(true); close_button->SetProperty(views::kInternalPaddingKey, close_button->GetInsets());
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.h b/chrome/browser/ui/views/page_info/page_info_view_factory.h index 8f61b24..d8c8783 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.h +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.h
@@ -38,6 +38,11 @@ VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE, VIEW_ID_PAGE_INFO_BUTTON_IGNORE_WARNING, VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_SECURITY_INFORMATION, + VIEW_ID_PAGE_INFO_PERMISSION_VIEW, + VIEW_ID_PAGE_INFO_SECURITY_SUMMARY_LABEL, + VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL, + VIEW_ID_PAGE_INFO_BACK_BUTTON, + VIEW_ID_PAGE_INFO_CLOSE_BUTTON, }; // Creates a separator view with padding on top and bottom. Use with flex
diff --git a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc index 39e8ea1..9638411 100644 --- a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc
@@ -26,9 +26,11 @@ #include "chrome/browser/ui/views/location_bar/location_icon_view.h" #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" #include "chrome/browser/ui/views/page_info/page_info_bubble_view_base.h" +#include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/common/chrome_features.h" +#include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/lookalikes/core/features.h" @@ -401,8 +403,13 @@ NOTREACHED(); break; } - EXPECT_EQ(page_info->GetSecurityDescriptionType(), - PageInfoUI::SecurityDescriptionType::SAFETY_TIP); + content::WebContentsAddedObserver new_tab_observer; + static_cast<views::StyledLabel*>( + page_info->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL)) + ->ClickLinkForTesting(); + EXPECT_EQ(chrome::kSafetyTipHelpCenterURL, + new_tab_observer.GetWebContents()->GetURL()); } void CheckPageInfoDoesNotShowSafetyTipInfo(Browser* browser) { @@ -417,9 +424,13 @@ l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE)); if (PageInfoBubbleViewBase::GetShownBubbleType() == PageInfoBubbleViewBase::BubbleType::BUBBLE_PAGE_INFO) { - EXPECT_NE(static_cast<PageInfoBubbleView*>(page_info) - ->GetSecurityDescriptionType(), - PageInfoUI::SecurityDescriptionType::SAFETY_TIP); + content::WebContentsAddedObserver new_tab_observer; + static_cast<views::StyledLabel*>( + page_info->GetViewByID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL)) + ->ClickLinkForTesting(); + EXPECT_EQ(chrome::kPageInfoHelpCenterURL, + new_tab_observer.GetWebContents()->GetURL()); } }
diff --git a/chrome/browser/ui/views/page_info/security_information_view.cc b/chrome/browser/ui/views/page_info/security_information_view.cc index 7de3cdc1..77a271f3 100644 --- a/chrome/browser/ui/views/page_info/security_information_view.cc +++ b/chrome/browser/ui/views/page_info/security_information_view.cc
@@ -58,6 +58,8 @@ // labels after more UI is implemented. security_summary_label->SetTextContext( views::style::CONTEXT_DIALOG_BODY_TEXT); + security_summary_label->SetID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_SUMMARY_LABEL); security_summary_label_ = layout->AddView(std::move(security_summary_label), 1.0, 1.0, views::GridLayout::FILL, views::GridLayout::LEADING); @@ -72,6 +74,8 @@ start_secondary_row(); auto security_details_label = std::make_unique<views::StyledLabel>(); + security_details_label->SetID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_SECURITY_DETAILS_LABEL); security_details_label_ = layout->AddView(std::move(security_details_label), 1.0, 1.0, views::GridLayout::FILL, views::GridLayout::LEADING); @@ -237,9 +241,12 @@ (password_reuse_button_container_->width() - kSpacingBetweenButtons) >= (change_password_button_size + allowlist_password_reuse_button->CalculatePreferredSize().width()); + bool is_page_info_v2 = + base::FeatureList::IsEnabled(page_info::kPageInfoV2Desktop); auto layout = std::make_unique<views::BoxLayout>( - can_fit_in_one_line ? views::BoxLayout::Orientation::kHorizontal - : views::BoxLayout::Orientation::kVertical, + can_fit_in_one_line || is_page_info_v2 + ? views::BoxLayout::Orientation::kHorizontal + : views::BoxLayout::Orientation::kVertical, gfx::Insets(), kSpacingBetweenButtons); // Make buttons left-aligned. For RTL languages, buttons will automatically // become right-aligned.
diff --git a/chrome/browser/ui/views/profiles/profile_customization_bubble_sync_controller.cc b/chrome/browser/ui/views/profiles/profile_customization_bubble_sync_controller.cc index 8b57b7a..6b06b26 100644 --- a/chrome/browser/ui/views/profiles/profile_customization_bubble_sync_controller.cc +++ b/chrome/browser/ui/views/profiles/profile_customization_bubble_sync_controller.cc
@@ -131,13 +131,19 @@ return; } - // Observe also the sync service to abort waiting for theme sync if the user - // hits any error or if custom passphrase is needed. + absl::optional<ThemeSyncableService::ThemeSyncState> theme_state = + theme_service_->GetThemeSyncableService()->GetThemeSyncStartState(); + if (theme_state) { + // There's enough information to decide whether to show the bubble right on + // init, finish the flow. + OnThemeSyncStarted(*theme_state); + return; + } + + // Observe the sync service to abort waiting for theme sync if the user hits + // any error or if custom passphrase is needed. sync_observation_.Observe(sync_service_); - // If theme sync is finished now, this will result in calling - // OnThemeSyncStarted, finishing the process, and deleting this class, thus do - // this as the last call. theme_observation_.Observe(theme_service_->GetThemeSyncableService()); }
diff --git a/chrome/browser/ui/views/profiles/profile_picker_interactive_uitest.cc b/chrome/browser/ui/views/profiles/profile_picker_interactive_uitest.cc index 5d47f7d..4a19fb4 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_interactive_uitest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_interactive_uitest.cc
@@ -76,21 +76,13 @@ bool control = false; bool shift = false; bool command = true; - // Mac needs the widget to get focused (once again) for - // SendKeyPressToWindowSync to work. A test-only particularity, pressing the - // keybinding manually right in the run of the test actually replaces the - // need of this call. - ASSERT_TRUE( - ui_test_utils::ShowAndFocusNativeWindow(widget()->GetNativeWindow())); #else // Use Ctrl-Shift-W on other platforms. bool control = true; bool shift = true; bool command = false; #endif - ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( - widget()->GetNativeWindow(), ui::VKEY_W, control, shift, /*alt=*/false, - command)); + SendKeyPress(ui::VKEY_W, control, shift, /*alt=*/false, command); } void SendBackKeyboardCommand() { @@ -100,21 +92,30 @@ bool alt = false; bool command = true; ui::KeyboardCode key = ui::VKEY_OEM_4; - // Mac needs the widget to get focused (once again) for - // SendKeyPressToWindowSync to work. A test-only particularity, pressing the - // keybinding manually right in the run of the test actually replaces the - // need of this call. - ASSERT_TRUE( - ui_test_utils::ShowAndFocusNativeWindow(widget()->GetNativeWindow())); #else // Use Ctrl-left on other platforms. bool alt = true; bool command = false; ui::KeyboardCode key = ui::VKEY_LEFT; #endif + SendKeyPress(key, /*control=*/false, /*shift=*/false, alt, command); + } + + void SendKeyPress(ui::KeyboardCode key, + bool control, + bool shift, + bool alt, + bool command) { +#if defined(OS_MAC) + // Mac needs the widget to get focused (once again) for + // SendKeyPressToWindowSync to work. A test-only particularity, pressing the + // keybinding manually right in the run of the test actually replaces the + // need of this call. + ASSERT_TRUE( + ui_test_utils::ShowAndFocusNativeWindow(widget()->GetNativeWindow())); +#endif ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( - widget()->GetNativeWindow(), key, /*control=*/false, - /*shift=*/false, alt, command)); + widget()->GetNativeWindow(), key, control, shift, alt, command)); } base::test::ScopedFeatureList feature_list_; @@ -145,9 +146,8 @@ chrome::NOTIFICATION_APP_TERMINATING, content::NotificationService::AllSources()); // Send Cmd-Q. - ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( - widget()->GetNativeWindow(), ui::VKEY_Q, /*control=*/false, - /*shift=*/false, /*alt=*/false, /*command=*/true)); + SendKeyPress(ui::VKEY_Q, /*control=*/false, /*shift=*/false, /*alt=*/false, + /*command=*/true); // Check that Chrome is quitting. terminate_observer.Wait(); WaitForPickerClosed(); @@ -155,15 +155,8 @@ } #endif -// Flaky on Mac, see https://crbug.com/1216134 -#if defined(OS_MAC) -#define MAYBE_FullscreenWithKeyboard DISABLED_FullscreenWithKeyboard -#else -#define MAYBE_FullscreenWithKeyboard FullscreenWithKeyboard -#endif // Checks that the main picker view can switch to full screen. -IN_PROC_BROWSER_TEST_F(ProfilePickerInteractiveUiTest, - MAYBE_FullscreenWithKeyboard) { +IN_PROC_BROWSER_TEST_F(ProfilePickerInteractiveUiTest, FullscreenWithKeyboard) { // Open a new picker. ShowAndFocusPicker(ProfilePicker::EntryPoint::kProfileMenuManageProfiles); WaitForLoadStop(web_contents(), GURL("chrome://profile-picker")); @@ -183,9 +176,7 @@ bool command = false; ui::KeyboardCode key_code = ui::VKEY_F11; #endif - ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( - widget()->GetNativeWindow(), key_code, control, /*shift=*/false, - /*alt=*/false, command)); + SendKeyPress(key_code, control, /*shift=*/false, /*alt=*/false, command); // Fullscreen causes the bounds of the widget to change. bounds_waiter.Wait(); EXPECT_TRUE(widget()->IsFullscreen());
diff --git a/chrome/browser/ui/views/tab_sharing/OWNERS b/chrome/browser/ui/views/tab_sharing/OWNERS index eb004e66..3ba0bf2 100644 --- a/chrome/browser/ui/views/tab_sharing/OWNERS +++ b/chrome/browser/ui/views/tab_sharing/OWNERS
@@ -1,2 +1,3 @@ marinaciocea@chromium.org guidou@chromium.org +eladalon@chromium.org
diff --git a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.cc b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.cc index 071ee676..eef975a 100644 --- a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.cc +++ b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.cc
@@ -34,12 +34,15 @@ namespace { +using content::GlobalRenderFrameHostId; +using content::WebContents; + #if !BUILDFLAG(IS_CHROMEOS_ASH) const int kContentsBorderThickness = 5; const float kContentsBorderOpacity = 0.50; const SkColor kContentsBorderColor = gfx::kGoogleBlue500; -void InitContentsBorderWidget(content::WebContents* contents) { +void InitContentsBorderWidget(WebContents* contents) { Browser* browser = chrome::FindBrowserWithWebContents(contents); BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); if (browser_view->contents_border_widget()) @@ -75,7 +78,7 @@ } #endif -void SetContentsBorderVisible(content::WebContents* contents, bool visible) { +void SetContentsBorderVisible(WebContents* contents, bool visible) { // TODO(https://crbug.com/1030925) fix contents border on ChromeOS. #if !BUILDFLAG(IS_CHROMEOS_ASH) if (!contents) @@ -99,8 +102,8 @@ #endif } -std::u16string GetTabName(content::WebContents* tab) { - GURL url = tab->GetLastCommittedURL(); +std::u16string GetTabName(WebContents* tab) { + const GURL& url = tab->GetLastCommittedURL(); const std::u16string tab_name = network::IsUrlPotentiallyTrustworthy(url) ? base::UTF8ToUTF16(net::GetHostAndOptionalPort(url)) @@ -108,20 +111,29 @@ return tab_name.empty() ? tab->GetTitle() : tab_name; } +GlobalRenderFrameHostId GetGlobalId(WebContents* web_contents) { + auto* const main_frame = web_contents->GetMainFrame(); + return main_frame ? main_frame->GetGlobalId() : GlobalRenderFrameHostId(); +} + } // namespace // static std::unique_ptr<TabSharingUI> TabSharingUI::Create( + GlobalRenderFrameHostId capturer, const content::DesktopMediaID& media_id, std::u16string app_name) { - return base::WrapUnique(new TabSharingUIViews(media_id, app_name)); + return base::WrapUnique(new TabSharingUIViews(capturer, media_id, app_name)); } -TabSharingUIViews::TabSharingUIViews(const content::DesktopMediaID& media_id, +TabSharingUIViews::TabSharingUIViews(GlobalRenderFrameHostId capturer, + const content::DesktopMediaID& media_id, std::u16string app_name) - : shared_tab_media_id_(media_id), app_name_(std::move(app_name)) { - shared_tab_ = content::WebContents::FromRenderFrameHost( - content::RenderFrameHost::FromID( + : capturer_(capturer), + shared_tab_media_id_(media_id), + app_name_(std::move(app_name)) { + shared_tab_ = + WebContents::FromRenderFrameHost(content::RenderFrameHost::FromID( media_id.web_contents_id.render_process_id, media_id.web_contents_id.main_render_frame_id)); Observe(shared_tab_); @@ -157,7 +169,7 @@ SetContentsBorderVisible(shared_tab_, false); - content::WebContents* shared_tab = + WebContents* shared_tab = infobars::ContentInfoBarManager::WebContentsFromInfoBar(infobar); DCHECK(shared_tab); DCHECK_EQ(infobars_[shared_tab], infobar); @@ -215,7 +227,7 @@ } } -void TabSharingUIViews::TabChangedAt(content::WebContents* contents, +void TabSharingUIViews::TabChangedAt(WebContents* contents, int index, TabChangeType change_type) { // Sad tab cannot be shared so don't create an infobar for it. @@ -244,19 +256,16 @@ } void TabSharingUIViews::DidFinishNavigation(content::NavigationHandle* handle) { - // Only interested in committed navigations on the shared tab that result in - // changing the shared tab's name. // TODO(https://crbug.com/1218946): With MPArch there may be multiple main // frames. This caller was converted automatically to the primary main frame // to preserve its semantics. Follow up to confirm correctness. if (!handle->IsInPrimaryMainFrame() || !handle->HasCommitted() || - handle->IsSameDocument() || handle->GetWebContents() != shared_tab_ || - GetTabName(shared_tab_) == shared_tab_name_) { + handle->IsSameDocument() || handle->GetWebContents() != shared_tab_) { return; } shared_tab_name_ = GetTabName(shared_tab_); for (const auto& infobars_entry : infobars_) { - // Recreate infobars to reflect the new shared tab name. + // Recreate infobars to reflect the new shared tab's hostname. if (infobars_entry.first != shared_tab_) CreateInfobarForWebContents(infobars_entry.first); } @@ -279,8 +288,9 @@ browser_list->AddObserver(this); } -void TabSharingUIViews::CreateInfobarForWebContents( - content::WebContents* contents) { +void TabSharingUIViews::CreateInfobarForWebContents(WebContents* contents) { + DCHECK(contents); + auto infobars_entry = infobars_.find(contents); // Recreate the infobar if it already exists. if (infobars_entry != infobars_.end()) { @@ -290,10 +300,25 @@ auto* infobar_manager = infobars::ContentInfoBarManager::FromWebContents(contents); infobar_manager->AddObserver(this); + + const bool is_capturing_tab = (GetGlobalId(contents) == capturer_); + const bool is_captured_tab = (contents == shared_tab_); + + // Self-capture -> no switch-to button. + // Capturer -> switch-to-captured. + // Captured -> switch-to-capturer. + // Otherwise -> no switch-to button. + absl::optional<GlobalRenderFrameHostId> focus_target; + if (is_capturing_tab && !is_captured_tab) { + focus_target = absl::make_optional(GetGlobalId(shared_tab_)); + } else if (!is_capturing_tab && is_captured_tab) { + focus_target = absl::make_optional(capturer_); + } + infobars_[contents] = TabSharingInfoBarDelegate::Create( infobar_manager, shared_tab_name_, app_name_, shared_tab_ == contents /*shared_tab*/, - !source_callback_.is_null() /*can_share*/, this); + !source_callback_.is_null() /*can_share*/, focus_target, this); } void TabSharingUIViews::RemoveInfobarsForAllTabs() {
diff --git a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.h b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.h index 2b120b0..6378b70 100644 --- a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.h +++ b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views.h
@@ -35,7 +35,8 @@ public infobars::InfoBarManager::Observer, public content::WebContentsObserver { public: - TabSharingUIViews(const content::DesktopMediaID& media_id, + TabSharingUIViews(content::GlobalRenderFrameHostId capturer, + const content::DesktopMediaID& media_id, std::u16string app_name); ~TabSharingUIViews() override; @@ -84,6 +85,7 @@ void CreateTabCaptureIndicator(); std::map<content::WebContents*, infobars::InfoBar*> infobars_; + const content::GlobalRenderFrameHostId capturer_; content::DesktopMediaID shared_tab_media_id_; const std::u16string app_name_; content::WebContents* shared_tab_;
diff --git a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc index 568c64b9..b887d20 100644 --- a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc +++ b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc
@@ -12,15 +12,19 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/webui_url_constants.h" +#include "chrome/grit/generated_resources.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/infobars/core/infobar.h" +#include "components/url_formatter/elide_url.h" +#include "content/public/browser/global_routing_id.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" #include "content/public/test/browser_test.h" #include "testing/gmock/include/gmock/gmock.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/views/widget/widget.h" namespace { @@ -29,15 +33,45 @@ return browser->tab_strip_model()->GetWebContentsAt(tab); } +content::GlobalRenderFrameHostId GetGlobalId(Browser* browser, int tab) { + auto* const main_frame = GetWebContents(browser, tab)->GetMainFrame(); + return main_frame ? main_frame->GetGlobalId() + : content::GlobalRenderFrameHostId(); +} + infobars::ContentInfoBarManager* GetInfoBarManager(Browser* browser, int tab) { return infobars::ContentInfoBarManager::FromWebContents( GetWebContents(browser, tab)); } -std::u16string GetInfobarMessageText(Browser* browser, int tab) { +ConfirmInfoBarDelegate* GetDelegate(Browser* browser, int tab) { return static_cast<ConfirmInfoBarDelegate*>( - GetInfoBarManager(browser, tab)->infobar_at(0)->delegate()) - ->GetMessageText(); + GetInfoBarManager(browser, tab)->infobar_at(0)->delegate()); +} + +std::u16string GetInfobarMessageText(Browser* browser, int tab) { + return GetDelegate(browser, tab)->GetMessageText(); +} + +bool HasSecondaryButton(Browser* browser, int tab) { + return GetDelegate(browser, tab)->GetButtons() & + ConfirmInfoBarDelegate::InfoBarButton::BUTTON_CANCEL; +} + +std::u16string GetSecondaryButtonLabel(Browser* browser, int tab) { + DCHECK(HasSecondaryButton(browser, tab)); // Test error otherwise. + return GetDelegate(browser, tab) + ->GetButtonLabel(ConfirmInfoBarDelegate::InfoBarButton::BUTTON_CANCEL); +} + +std::u16string GetExpectedSwitchToMessage(Browser* browser, int tab) { + content::RenderFrameHost* const rfh = + GetWebContents(browser, tab)->GetMainFrame(); + return l10n_util::GetStringFUTF16( + IDS_TAB_SHARING_INFOBAR_SWITCH_TO_BUTTON, + url_formatter::FormatUrlForSecurityDisplay( + rfh->GetLastCommittedURL().GetOrigin(), + url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS)); } content::DesktopMediaID GetDesktopMediaID(Browser* browser, int tab) { @@ -65,19 +99,23 @@ tab, {TabStripModel::GestureType::kMouse}); } -constexpr int kNoSharedTabIndex = -1; +constexpr int kNullTabIndex = -1; +const std::u16string kShareThisTabInsteadMessage = u"Share this tab instead"; } // namespace class TabSharingUIViewsBrowserTest : public InProcessBrowserTest { public: TabSharingUIViewsBrowserTest() {} - void CreateUiAndStartSharing(Browser* browser, int tab) { + void CreateUiAndStartSharing(Browser* browser, + int capturing_tab, + int captured_tab) { // Explicitly activate the shared tab in testing. - ActivateTab(browser, tab); + ActivateTab(browser, captured_tab); - tab_sharing_ui_ = TabSharingUI::Create(GetDesktopMediaID(browser, tab), - u"example-sharing.com"); + tab_sharing_ui_ = TabSharingUI::Create( + GetGlobalId(browser, capturing_tab), + GetDesktopMediaID(browser, captured_tab), u"example-sharing.com"); tab_sharing_ui_->OnStarted( base::OnceClosure(), base::BindRepeating(&TabSharingUIViewsBrowserTest::OnStartSharing, @@ -86,12 +124,16 @@ // Verify that tab sharing infobars are displayed on all tabs, and content // border and tab capture indicator are only visible on the shared tab. Pass - // |kNoSharedTabIndex| for |shared_tab_index| to indicate the shared tab is + // |kNullTabIndex| for |captured_tab| to indicate the shared tab is // not in |browser|. void VerifyUi(Browser* browser, - int shared_tab_index, + int capturing_tab, + int captured_tab, size_t infobar_count = 1, bool has_border = true) { + DCHECK((capturing_tab != kNullTabIndex && captured_tab != kNullTabIndex) || + (capturing_tab == kNullTabIndex && captured_tab == kNullTabIndex)); + #if BUILDFLAG(IS_CHROMEOS_ASH) // TODO(https://crbug.com/1030925) fix contents border on ChromeOS. has_border = false; @@ -112,12 +154,28 @@ // Content border is only visible on the shared tab. if (has_border) { ActivateTab(browser, i); - EXPECT_EQ(i == shared_tab_index, contents_border->IsVisible()); + EXPECT_EQ(i == captured_tab, contents_border->IsVisible()); } // Tab capture indicator is only displayed on the shared tab. - EXPECT_EQ(i == shared_tab_index, + EXPECT_EQ(i == captured_tab, capture_indicator->IsBeingMirrored(GetWebContents(browser, i))); + + if (i == capturing_tab && i == captured_tab) { + EXPECT_FALSE(HasSecondaryButton(browser, i)); + } else if (i == capturing_tab) { + ASSERT_TRUE(HasSecondaryButton(browser, i)); + EXPECT_EQ(GetSecondaryButtonLabel(browser, i), + GetExpectedSwitchToMessage(browser, captured_tab)); + } else if (i == captured_tab) { + ASSERT_TRUE(HasSecondaryButton(browser, i)); + EXPECT_EQ(GetSecondaryButtonLabel(browser, i), + GetExpectedSwitchToMessage(browser, capturing_tab)); + } else if (infobar_manager->infobar_count() > 0) { + ASSERT_TRUE(HasSecondaryButton(browser, i)); + EXPECT_EQ(GetSecondaryButtonLabel(browser, i), + kShareThisTabInsteadMessage); + } } } @@ -145,23 +203,26 @@ IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, StartSharing) { AddTabs(browser(), 2); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); // Test that before sharing there are no infobars, content border or tab // capture indicator. - VerifyUi(browser(), kNoSharedTabIndex, 0 /*infobar_count*/, - false /*has_border*/); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0, + /*has_border=*/false); // Create UI and start sharing the tab at index 1. - CreateUiAndStartSharing(browser(), 1); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); // Test that infobars were created, and contents border and tab capture // indicator are displayed on the shared tab. - VerifyUi(browser(), 1); + VerifyUi(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, SwitchSharedTab) { AddTabs(browser(), 2); - CreateUiAndStartSharing(browser(), 1); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); // Share a different tab. ActivateTab(browser(), 2); @@ -169,23 +230,26 @@ GetInfoBarManager(browser(), 2)->infobar_at(0)); // Test that the UI has been updated. - VerifyUi(browser(), 2); + VerifyUi(browser(), /*capturing_tab=*/0, /*captured_tab=*/2); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, StopSharing) { - AddTabs(browser()); - CreateUiAndStartSharing(browser(), 1); + AddTabs(browser(), 2); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); tab_sharing_ui_views()->StopSharing(); // Test that the infobars have been removed, and the contents border and tab // capture indicator are no longer visible. - VerifyUi(browser(), kNoSharedTabIndex, 0 /*infobar_count*/); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, CloseTab) { AddTabs(browser(), 2); - CreateUiAndStartSharing(browser(), 1); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); // Close a tab different than the shared one and wait until it's actually // closed, then test that the UI has not changed. @@ -194,7 +258,7 @@ tab_strip_model->GetWebContentsAt(2)); tab_strip_model->CloseWebContentsAt(2, TabStripModel::CLOSE_NONE); tab_2_destroyed_watcher.Wait(); - VerifyUi(browser(), 1); + VerifyUi(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); // Close the shared tab and wait until it's actually closed, then verify that // sharing is stopped, i.e. the UI is removed. @@ -202,39 +266,50 @@ tab_strip_model->GetWebContentsAt(1)); tab_strip_model->CloseWebContentsAt(1, TabStripModel::CLOSE_NONE); tab_1_destroyed_watcher.Wait(); - VerifyUi(browser(), kNoSharedTabIndex, 0 /*infobar_count*/); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, CloseTabInIncognitoBrowser) { AddTabs(browser(), 2); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); // Start sharing a tab in an incognito browser. Browser* incognito_browser = CreateIncognitoBrowser(); - AddTabs(incognito_browser, 2); - CreateUiAndStartSharing(incognito_browser, 1); - VerifyUi(incognito_browser, 1); - VerifyUi(browser(), kNoSharedTabIndex, 1 /*infobar_count*/, - false /*has_border*/); + AddTabs(incognito_browser, 3); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(incognito_browser, /*capturing_tab=*/0, + /*captured_tab=*/1); + VerifyUi(incognito_browser, /*capturing_tab=*/0, /*captured_tab=*/1); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/1, + /*has_border=*/false); // Close a tab different than the shared one and test that the UI has not // changed. TabStripModel* tab_strip_model = incognito_browser->tab_strip_model(); tab_strip_model->CloseWebContentsAt(2, TabStripModel::CLOSE_NONE); - VerifyUi(incognito_browser, 1); - VerifyUi(browser(), kNoSharedTabIndex, 1, false); + VerifyUi(incognito_browser, /*capturing_tab=*/0, /*captured_tab=*/1); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/1, + /*has_border=*/false); // Close the shared tab in the incognito browser and test that the UI is // removed. incognito_browser->tab_strip_model()->CloseWebContentsAt( 1, TabStripModel::CLOSE_NONE); - VerifyUi(incognito_browser, kNoSharedTabIndex, 0 /*infobar_count*/); - VerifyUi(browser(), kNoSharedTabIndex, 0, false); + VerifyUi(incognito_browser, /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0, + /*has_border=*/false); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, KillTab) { AddTabs(browser(), 2); - CreateUiAndStartSharing(browser(), 1); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/1, /*captured_tab=*/2); // Kill a tab different than the shared one. content::WebContents* web_contents = GetWebContents(browser(), 0); @@ -256,7 +331,8 @@ IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, KillSharedTab) { AddTabs(browser(), 2); - CreateUiAndStartSharing(browser(), 1); + ASSERT_EQ(browser()->tab_strip_model()->count(), 3); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/0, /*captured_tab=*/1); // Kill the shared tab. content::WebContents* shared_tab_web_contents = GetWebContents(browser(), 1); @@ -269,13 +345,15 @@ shared_tab_crash_observer.Wait(); // Verify that killing the shared tab stopped sharing. - VerifyUi(browser(), kNoSharedTabIndex, 0); + VerifyUi(browser(), /*capturing_tab=*/kNullTabIndex, + /*captured_tab=*/kNullTabIndex, /*infobar_count=*/0); } IN_PROC_BROWSER_TEST_F(TabSharingUIViewsBrowserTest, InfobarLabelUpdatedOnNavigation) { - AddTabs(browser()); - CreateUiAndStartSharing(browser(), 0); + AddTabs(browser(), 1); + ASSERT_EQ(browser()->tab_strip_model()->count(), 2); + CreateUiAndStartSharing(browser(), /*capturing_tab=*/1, /*captured_tab=*/0); ASSERT_THAT(base::UTF16ToUTF8(GetInfobarMessageText(browser(), 1)), ::testing::HasSubstr(chrome::kChromeUINewTabHost)); @@ -293,13 +371,16 @@ MultipleTabSharingUIViewsBrowserTest() {} void CreateUIsAndStartSharing(Browser* browser, - int tab_index, - int tab_count) { - for (int i = 0; i < tab_count; ++i) { - int tab = tab_index + i; - ActivateTab(browser, tab); + int capturing_tab, + int captured_tab_first, + int captured_tab_last) { + for (int captured_tab = captured_tab_first; + captured_tab <= captured_tab_last; ++captured_tab) { + DCHECK_NE(captured_tab, capturing_tab); + ActivateTab(browser, captured_tab); tab_sharing_ui_views_.push_back(TabSharingUI::Create( - GetDesktopMediaID(browser, tab), u"example-sharing.com")); + GetGlobalId(browser, capturing_tab), + GetDesktopMediaID(browser, captured_tab), u"example-sharing.com")); tab_sharing_ui_views_[tab_sharing_ui_views_.size() - 1]->OnStarted( base::OnceClosure(), content::MediaStreamUI::SourceCallback()); } @@ -320,7 +401,9 @@ IN_PROC_BROWSER_TEST_F(MultipleTabSharingUIViewsBrowserTest, VerifyUi) { AddTabs(browser(), 3); - CreateUIsAndStartSharing(browser(), 1, 3); + ASSERT_EQ(browser()->tab_strip_model()->count(), 4); + CreateUIsAndStartSharing(browser(), /*capturing_tab=*/0, + /*captured_tab_first=*/1, /*captured_tab_last=*/3); // Check that all tabs have 3 infobars corresponding to the 3 sharing // sessions. @@ -331,7 +414,7 @@ // Check that all shared tabs display a tab capture indicator. auto capture_indicator = GetCaptureIndicator(); for (int i = 1; i < tab_count; ++i) - EXPECT_TRUE( + ASSERT_TRUE( capture_indicator->IsBeingMirrored(GetWebContents(browser(), i))); // Check that the border is only displayed on the last shared tab (known @@ -343,35 +426,39 @@ #else for (int i = 0; i < tab_count; ++i) { ActivateTab(browser(), i); - EXPECT_EQ(i == 3, contents_border->IsVisible()); + ASSERT_EQ(i == 3, contents_border->IsVisible()); } #endif } IN_PROC_BROWSER_TEST_F(MultipleTabSharingUIViewsBrowserTest, StopSharing) { AddTabs(browser(), 3); - CreateUIsAndStartSharing(browser(), 1, 3); + ASSERT_EQ(browser()->tab_strip_model()->count(), 4); + CreateUIsAndStartSharing(browser(), /*capturing_tab=*/0, + /*captured_tab_first=*/1, /*captured_tab_last=*/3); // Stop sharing tabs one by one and check that infobars are removed as well. size_t shared_tab_count = 3; while (shared_tab_count) { tab_sharing_ui_views(--shared_tab_count)->StopSharing(); for (int j = 0; j < browser()->tab_strip_model()->count(); ++j) - EXPECT_EQ(shared_tab_count, + ASSERT_EQ(shared_tab_count, GetInfoBarManager(browser(), j)->infobar_count()); } } IN_PROC_BROWSER_TEST_F(MultipleTabSharingUIViewsBrowserTest, CloseTabs) { AddTabs(browser(), 3); - CreateUIsAndStartSharing(browser(), 1, 3); + ASSERT_EQ(browser()->tab_strip_model()->count(), 4); + CreateUIsAndStartSharing(browser(), /*capturing_tab=*/0, + /*captured_tab_first=*/1, /*captured_tab_last=*/3); // Close shared tabs one by one and check that infobars are removed as well. TabStripModel* tab_strip_model = browser()->tab_strip_model(); while (tab_strip_model->count() > 1) { tab_strip_model->CloseWebContentsAt(1, TabStripModel::CLOSE_NONE); for (int i = 0; i < tab_strip_model->count(); ++i) - EXPECT_EQ(tab_strip_model->count() - 1u, + ASSERT_EQ(tab_strip_model->count() - 1u, GetInfoBarManager(browser(), i)->infobar_count()); } }
diff --git a/chrome/browser/ui/webui/chromeos/emoji/emoji_ui.cc b/chrome/browser/ui/webui/chromeos/emoji/emoji_ui.cc index be0f913e..3870d6f6 100644 --- a/chrome/browser/ui/webui/chromeos/emoji/emoji_ui.cc +++ b/chrome/browser/ui/webui/chromeos/emoji/emoji_ui.cc
@@ -25,7 +25,7 @@ #include <iostream> namespace { -constexpr gfx::Size kDefaultWindowSize(340, 390); +constexpr gfx::Size kDefaultWindowSize(372, 454); constexpr int kPaddingAroundCursor = 8; class EmojiiBubbleDialogView : public WebUIBubbleDialogView {
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index b0806fe..11657ec9 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -176,7 +176,8 @@ "components/oobe_vars/oobe_custom_vars_css.html"; constexpr char kOobeCustomVarsCssJsM[] = "components/oobe_vars/oobe_custom_vars_css.m.js"; -constexpr char kCommonStylesHTML[] = "components/common_styles.html"; +constexpr char kCommonStylesHTML[] = "components/common_styles/common_styles.html"; +constexpr char kDialogHostStylesHTML[] = "components/common_styles/oobe_dialog_host_styles.html"; constexpr char kI18nBehaviorHTML[] = "components/behaviors/oobe_i18n_behavior.html"; constexpr char kI18nBehaviorJS[] = "components/behaviors/oobe_i18n_behavior.js"; constexpr char kI18nSetupHTML[] = "components/behaviors/i18n_setup.html"; @@ -190,8 +191,8 @@ "components/behaviors/oobe_scrollable_behavior.html"; constexpr char kScrollableBehaviorJS[] = "components/behaviors/oobe_scrollable_behavior.js"; -constexpr char kHDIronIconHTML[] = "components/hd_iron_icon/hd_iron_icon.html"; -constexpr char kHDIronIconJS[] = "components/hd_iron_icon/hd_iron_icon.js"; +constexpr char kHDIronIconHTML[] = "components/hd_iron_icon.html"; +constexpr char kHDIronIconJS[] = "components/hd_iron_icon.js"; constexpr char kOobeAdaptiveDialogHTML[] = "components/oobe_adaptive_dialog.html"; constexpr char kOobeAdaptvieDialogJS[] = "components/oobe_adaptive_dialog.js"; @@ -210,9 +211,6 @@ constexpr char kThrobberNoticeHTML[] = "components/throbber_notice/throbber_notice.html"; constexpr char kThrobberNoticeJS[] = "components/throbber_notice/throbber_notice.js"; -constexpr char kOsInstallHTML[] = "os_install/os_install.html"; -constexpr char kOsInstallJS[] = "os_install/os_install.js"; - #if BUILDFLAG(GOOGLE_CHROME_BRANDING) constexpr char kLogo24PX1XSvgPath[] = "logo_24px-1x.svg"; constexpr char kLogo24PX2XSvgPath[] = "logo_24px-2x.svg"; @@ -333,13 +331,17 @@ void AddOobeDisplayTypeDefaultResources(content::WebUIDataSource* source) { if (switches::IsOsInstallAllowed()) { source->SetDefaultResource(IDR_OS_INSTALL_OOBE_HTML); + source->AddResourcePath(kCustomElementsHTMLPath, + IDR_CUSTOM_ELEMENTS_OS_INSTALL_OOBE_HTML); + source->AddResourcePath(kCustomElementsJSPath, + IDR_CUSTOM_ELEMENTS_OS_INSTALL_OOBE_JS); } else { source->SetDefaultResource(IDR_OOBE_HTML); + source->AddResourcePath(kCustomElementsHTMLPath, + IDR_CUSTOM_ELEMENTS_OOBE_HTML); + source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); } source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); - source->AddResourcePath(kCustomElementsHTMLPath, - IDR_CUSTOM_ELEMENTS_OOBE_HTML); - source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); } // Default and non-shared resource definition for kLoginDisplay display type. @@ -347,14 +349,19 @@ void AddLoginDisplayTypeDefaultResources(content::WebUIDataSource* source) { if (switches::IsOsInstallAllowed()) { source->SetDefaultResource(IDR_OS_INSTALL_LOGIN_HTML); + source->AddResourcePath(kCustomElementsHTMLPath, + IDR_CUSTOM_ELEMENTS_OS_INSTALL_LOGIN_HTML); + source->AddResourcePath(kCustomElementsJSPath, + IDR_CUSTOM_ELEMENTS_OS_INSTALL_LOGIN_JS); } else { source->SetDefaultResource(IDR_MD_LOGIN_HTML); + source->AddResourcePath(kCustomElementsHTMLPath, + IDR_CUSTOM_ELEMENTS_LOGIN_HTML); + source->AddResourcePath(kCustomElementsJSPath, + IDR_CUSTOM_ELEMENTS_LOGIN_JS); } source->AddResourcePath(kLoginJSPath, IDR_OOBE_JS); - source->AddResourcePath(kCustomElementsHTMLPath, - IDR_CUSTOM_ELEMENTS_LOGIN_HTML); - source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOGIN_JS); } // Creates a WebUIDataSource for chrome://oobe @@ -751,6 +758,8 @@ source->AddResourcePath(kCommonStylesHTML, IDR_OOBE_COMPONENTS_COMMON_STYLES_HTML); + source->AddResourcePath(kDialogHostStylesHTML, + IDR_OOBE_COMPONENTS_DIALOG_HOST_STYLES_HTML); source->AddResourcePath(kOobeSharedVarsCssHTML, IDR_OOBE_COMPONENTS_OOBE_SHARED_VARS_CSS_HTML); @@ -831,12 +840,6 @@ IDR_OOBE_COMPONENTS_THROBBER_NOTICE_HTML); source->AddResourcePath(kThrobberNoticeJS, IDR_OOBE_COMPONENTS_THROBBER_NOTICE_JS); - - if (switches::IsOsInstallAllowed()) { - source->AddResourcePath(kOsInstallHTML, - IDR_OOBE_COMPONENTS_OS_INSTALL_HTML); - source->AddResourcePath(kOsInstallJS, IDR_OOBE_COMPONENTS_OS_INSTALL_JS); - } } CoreOobeView* OobeUI::GetCoreOobeView() {
diff --git a/chrome/browser/ui/webui/nearby_internals/quick_pair/DEPS b/chrome/browser/ui/webui/nearby_internals/quick_pair/DEPS new file mode 100644 index 0000000..cd0a1e5 --- /dev/null +++ b/chrome/browser/ui/webui/nearby_internals/quick_pair/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+ash/quick_pair", +]
diff --git a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.cc b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.cc index e0327ed4..877100a 100644 --- a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.cc +++ b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/i18n/time_formatting.h" #include "base/values.h" -#include "chromeos/components/quick_pair/common/logging.h" namespace { // Keys in the JSON representation of a log message @@ -20,7 +19,7 @@ // Converts |log_message| to a raw dictionary value used as a JSON argument to // JavaScript functions. base::Value LogMessageToDictionary( - const chromeos::quick_pair::LogBuffer::LogMessage& log_message) { + const ash::quick_pair::LogBuffer::LogMessage& log_message) { base::Value dictionary(base::Value::Type::DICTIONARY); dictionary.SetStringKey(kLogMessageTextKey, log_message.text); dictionary.SetStringKey( @@ -57,7 +56,7 @@ } void QuickPairHandler::OnJavascriptAllowed() { - observation_.Observe(chromeos::quick_pair::LogBuffer::GetInstance()); + observation_.Observe(ash::quick_pair::LogBuffer::GetInstance()); } void QuickPairHandler::OnJavascriptDisallowed() { @@ -68,8 +67,7 @@ AllowJavascript(); const base::Value& callback_id = args->GetList()[0]; base::Value list(base::Value::Type::LIST); - for (const auto& log : - *chromeos::quick_pair::LogBuffer::GetInstance()->logs()) { + for (const auto& log : *ash::quick_pair::LogBuffer::GetInstance()->logs()) { list.Append(LogMessageToDictionary(log)); } ResolveJavascriptCallback(callback_id, list); @@ -80,7 +78,7 @@ } void QuickPairHandler::OnLogMessageAdded( - const chromeos::quick_pair::LogBuffer::LogMessage& log_message) { + const ash::quick_pair::LogBuffer::LogMessage& log_message) { FireWebUIListener("quick-pair-log-message-added", LogMessageToDictionary(log_message)); }
diff --git a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h index a8b2279..e3e5037 100644 --- a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h +++ b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h
@@ -5,17 +5,17 @@ #ifndef CHROME_BROWSER_UI_WEBUI_NEARBY_INTERNALS_QUICK_PAIR_QUICK_PAIR_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_NEARBY_INTERNALS_QUICK_PAIR_QUICK_PAIR_HANDLER_H_ +#include "ash/quick_pair/common/log_buffer.h" +#include "ash/quick_pair/common/logging.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" #include "base/values.h" -#include "chromeos/components/quick_pair/common/log_buffer.h" -#include "chromeos/components/quick_pair/common/logging.h" #include "content/public/browser/web_ui_message_handler.h" // WebUIMessageHandler for the Quick Pair debug page at // chrome://nearby-internals class QuickPairHandler : public content::WebUIMessageHandler, - public chromeos::quick_pair::LogBuffer::Observer { + public ash::quick_pair::LogBuffer::Observer { public: QuickPairHandler(); QuickPairHandler(const QuickPairHandler&) = delete; @@ -30,7 +30,7 @@ private: // LogBuffer::Observer void OnLogMessageAdded( - const chromeos::quick_pair::LogBuffer::LogMessage& log_message) override; + const ash::quick_pair::LogBuffer::LogMessage& log_message) override; void OnLogBufferCleared() override; // Message handler callback that returns the Log Buffer in dictionary form. @@ -44,8 +44,8 @@ void NotifyFastPairDiscovery(const base::ListValue* args); void NotifyFastPairPairing(const base::ListValue* args); - base::ScopedObservation<chromeos::quick_pair::LogBuffer, - chromeos::quick_pair::LogBuffer::Observer> + base::ScopedObservation<ash::quick_pair::LogBuffer, + ash::quick_pair::LogBuffer::Observer> observation_{this}; base::WeakPtrFactory<QuickPairHandler> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/webui/settings/search_engines_handler.cc b/chrome/browser/ui/webui/settings/search_engines_handler.cc index 5746440..8554df8b8 100644 --- a/chrome/browser/ui/webui/settings/search_engines_handler.cc +++ b/chrome/browser/ui/webui/settings/search_engines_handler.cc
@@ -229,12 +229,13 @@ template_url->GetExtensionId(), extensions::ExtensionRegistry::EVERYTHING); if (extension) { - base::DictionaryValue ext_info; - ext_info.SetBoolean("canBeDisabled", - !extensions::ExtensionSystem::Get(profile) - ->management_policy() - ->MustRemainEnabled(extension, nullptr)); - dict->SetKey("extension", std::move(ext_info)); + std::unique_ptr<base::DictionaryValue> ext_info = + extensions::util::GetExtensionInfo(extension); + ext_info->SetBoolean("canBeDisabled", + !extensions::ExtensionSystem::Get(profile) + ->management_policy() + ->MustRemainEnabled(extension, nullptr)); + dict->Set("extension", std::move(ext_info)); } } return dict;
diff --git a/chrome/browser/usb/usb_browsertest.cc b/chrome/browser/usb/usb_browsertest.cc index e241f21..cac172517 100644 --- a/chrome/browser/usb/usb_browsertest.cc +++ b/chrome/browser/usb/usb_browsertest.cc
@@ -27,6 +27,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/prerender_test_util.h" #include "content/public/test/test_navigation_observer.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -353,4 +354,51 @@ })())")); } +class WebUsbPrerenderinBrowserTest : public WebUsbTest { + public: + WebUsbPrerenderinBrowserTest() + : prerender_helper_( + base::BindRepeating(&WebUsbPrerenderinBrowserTest::web_contents, + base::Unretained(this))) {} + ~WebUsbPrerenderinBrowserTest() override = default; + + content::test::PrerenderTestHelper* prerender_helper() { + return &prerender_helper_; + } + + content::WebContents* web_contents() { + return browser()->tab_strip_model()->GetActiveWebContents(); + } + + void OnJsTestExecutionDone(base::Value value) { result_ = std::move(value); } + + bool HasResult() { return !!result_; } + + private: + absl::optional<base::Value> result_; + content::test::PrerenderTestHelper prerender_helper_; +}; + +IN_PROC_BROWSER_TEST_F(WebUsbPrerenderinBrowserTest, ShowChooserInPrerenderin) { + // Loads a page in the prerendering. + GURL prerender_url = embedded_test_server()->GetURL( + "localhost", "/simple_page.html?prerendering"); + const int host_id = prerender_helper()->AddPrerender(prerender_url); + content::RenderFrameHost* prerender_rfh = + prerender_helper()->GetPrerenderedMainFrameHost(host_id); + + EXPECT_FALSE(HasResult()); + prerender_rfh->ExecuteJavaScriptForTests( + u"((async () => {" + u" let devices = await navigator.usb.getDevices();" + u" return devices.map(device => device.serialNumber);" + u"})())", + base::BindOnce(&WebUsbPrerenderinBrowserTest::OnJsTestExecutionDone, + base::Unretained(this))); + + // Activate the prerendered page. + prerender_helper()->NavigatePrimaryPage(prerender_url); + EXPECT_TRUE(HasResult()); +} + } // namespace
diff --git a/chrome/browser/usb/web_usb_chooser.cc b/chrome/browser/usb/web_usb_chooser.cc index 225f89f..1bd99cb 100644 --- a/chrome/browser/usb/web_usb_chooser.cc +++ b/chrome/browser/usb/web_usb_chooser.cc
@@ -26,11 +26,10 @@ void WebUsbChooser::GetPermission( std::vector<device::mojom::UsbDeviceFilterPtr> device_filters, blink::mojom::WebUsbService::GetPermissionCallback callback) { - auto* web_contents = - content::WebContents::FromRenderFrameHost(render_frame_host_); - url::Origin origin = web_contents->GetMainFrame()->GetLastCommittedOrigin(); + url::Origin origin = + render_frame_host_->GetMainFrame()->GetLastCommittedOrigin(); auto* profile = - Profile::FromBrowserContext(web_contents->GetBrowserContext()); + Profile::FromBrowserContext(render_frame_host_->GetBrowserContext()); auto* context = UsbChooserContextFactory::GetForProfile(profile); if (!context->CanRequestObjectPermission(origin)) { std::move(callback).Run(nullptr);
diff --git a/chrome/browser/win/chrome_elf_init.cc b/chrome/browser/win/chrome_elf_init.cc index 165a770..c70a4ae 100644 --- a/chrome/browser/win/chrome_elf_init.cc +++ b/chrome/browser/win/chrome_elf_init.cc
@@ -115,30 +115,25 @@ BrowserBlacklistBeaconSetup(); } - // Make sure the registry key we read earlier in startup + // Make sure the early finch emergency "off switch" for // sandbox::MITIGATION_EXTENSION_POINT_DISABLE is set properly in reg. // Note: the very existence of this key signals elf to not enable // this mitigation on browser next start. - const std::wstring reg_path(install_static::GetRegistryPath().append( - elf_sec::kRegBrowserExtensionPointKeyName)); - base::win::RegKey browser_extension_point_registry_key( - HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); + const std::wstring finch_path(install_static::GetRegistryPath().append( + elf_sec::kRegSecurityFinchKeyName)); + base::win::RegKey finch_security_registry_key(HKEY_CURRENT_USER, + finch_path.c_str(), KEY_READ); - ExtensionPointEnableState extension_point_enable_state = - GetExtensionPointsEnableState(); - RecordExtensionPointsEnableState(extension_point_enable_state); - bool enable_extension_point_policy = - (extension_point_enable_state == EXTENSIONPOINT_ENABLED) && - base::FeatureList::IsEnabled( - sandbox::policy::features::kWinSboxDisableExtensionPoints); + RecordExtensionPointsEnableState(GetExtensionPointsEnableState()); - if (enable_extension_point_policy) { - if (!browser_extension_point_registry_key.Valid()) { - browser_extension_point_registry_key.Create(HKEY_CURRENT_USER, - reg_path.c_str(), KEY_WRITE); - } else { - if (browser_extension_point_registry_key.Valid()) - browser_extension_point_registry_key.DeleteKey(L""); + if (base::FeatureList::IsEnabled( + sandbox::policy::features::kWinSboxDisableExtensionPoints)) { + if (finch_security_registry_key.Valid()) + finch_security_registry_key.DeleteKey(L""); + } else { + if (!finch_security_registry_key.Valid()) { + finch_security_registry_key.Create(HKEY_CURRENT_USER, finch_path.c_str(), + KEY_WRITE); } } }
diff --git a/chrome/chrome_elf/chrome_elf_constants.cc b/chrome/chrome_elf/chrome_elf_constants.cc index 91ea5c4f..4601be4f 100644 --- a/chrome/chrome_elf/chrome_elf_constants.cc +++ b/chrome/chrome_elf/chrome_elf_constants.cc
@@ -17,7 +17,6 @@ namespace elf_sec { -const wchar_t kRegBrowserExtensionPointKeyName[] = - L"\\BrowserExtensionPointPolicy"; +const wchar_t kRegSecurityFinchKeyName[] = L"\\BrowserSboxFinch"; } // namespace elf_sec
diff --git a/chrome/chrome_elf/chrome_elf_constants.h b/chrome/chrome_elf/chrome_elf_constants.h index d10904b..d931e58a 100644 --- a/chrome/chrome_elf/chrome_elf_constants.h +++ b/chrome/chrome_elf/chrome_elf_constants.h
@@ -40,9 +40,9 @@ namespace elf_sec { -// The name of the registry key which controls the enablement of -// sandbox::MITIGATION_EXTENSION_POINT_DISABLE for the browser process. -extern const wchar_t kRegBrowserExtensionPointKeyName[]; +// The name of the registry key holding the finch "emergency-off" +// switch for sandbox::MITIGATION_EXTENSION_POINT_DISABLE. +extern const wchar_t kRegSecurityFinchKeyName[]; } // namespace elf_sec
diff --git a/chrome/chrome_elf/chrome_elf_main.cc b/chrome/chrome_elf/chrome_elf_main.cc index c2701327..4a2c09cf 100644 --- a/chrome/chrome_elf/chrome_elf_main.cc +++ b/chrome/chrome_elf/chrome_elf_main.cc
@@ -7,7 +7,6 @@ #include <assert.h> #include <windows.h> -#include "chrome/chrome_elf/chrome_elf_security.h" #include "chrome/chrome_elf/crash/crash_helper.h" #include "chrome/chrome_elf/third_party_dlls/beacon.h" #include "chrome/chrome_elf/third_party_dlls/main.h" @@ -65,9 +64,6 @@ if (install_static::IsBrowserProcess()) { __try { - // Disable third party extension points. - elf_security::EarlyBrowserSecurity(); - // Initialize the blocking of third-party DLLs if the initialization of // the safety beacon succeeds. if (third_party_dlls::LeaveSetupBeacon())
diff --git a/chrome/chrome_elf/chrome_elf_security.cc b/chrome/chrome_elf/chrome_elf_security.cc index 61a9b34..aaede62 100644 --- a/chrome/chrome_elf/chrome_elf_security.cc +++ b/chrome/chrome_elf/chrome_elf_security.cc
@@ -23,18 +23,16 @@ NTSTATUS ret_val = STATUS_SUCCESS; HANDLE handle = INVALID_HANDLE_VALUE; - // Check for kRegBrowserExtensionPointKeyName. We only disable extension - // points when this exists, for devices that have been vetted by our - // heuristic. - if (!nt::OpenRegKey(nt::HKCU, - install_static::GetRegistryPath() - .append(elf_sec::kRegBrowserExtensionPointKeyName) - .c_str(), - KEY_QUERY_VALUE, &handle, &ret_val)) { + // Check for kRegistrySecurityFinchPath. If it exists, + // we do NOT disable extension points. (Emergency off flag.) + if (nt::OpenRegKey(nt::HKCU, + install_static::GetRegistryPath() + .append(elf_sec::kRegSecurityFinchKeyName) + .c_str(), + KEY_QUERY_VALUE, &handle, &ret_val)) { + nt::CloseRegKey(handle); return; } - - nt::CloseRegKey(handle); #ifdef _DEBUG // The only failure expected is for the path not existing. if (ret_val != STATUS_OBJECT_NAME_NOT_FOUND)
diff --git a/chrome/chrome_elf/chrome_elf_util_unittest.cc b/chrome/chrome_elf/chrome_elf_util_unittest.cc index 123d8493..54ab3e9 100644 --- a/chrome/chrome_elf/chrome_elf_util_unittest.cc +++ b/chrome/chrome_elf/chrome_elf_util_unittest.cc
@@ -18,18 +18,18 @@ namespace { -bool SetExtensionPointEnabledFlag(bool creation) { +bool SetSecurityFinchFlag(bool creation) { bool success = true; - const std::wstring reg_path(install_static::GetRegistryPath().append( - elf_sec::kRegBrowserExtensionPointKeyName)); + const std::wstring finch_path(install_static::GetRegistryPath().append( + elf_sec::kRegSecurityFinchKeyName)); base::win::RegKey security_key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); if (creation) { if (ERROR_SUCCESS != - security_key.CreateKey(reg_path.c_str(), KEY_QUERY_VALUE)) + security_key.CreateKey(finch_path.c_str(), KEY_QUERY_VALUE)) success = false; } else { - if (ERROR_SUCCESS != security_key.DeleteKey(reg_path.c_str())) + if (ERROR_SUCCESS != security_key.DeleteKey(finch_path.c_str())) success = false; } @@ -92,12 +92,13 @@ registry_util::RegistryOverrideManager override_manager; ASSERT_NO_FATAL_FAILURE(RegRedirect(nt::HKCU, &override_manager)); - // First, ensure that the policy is not applied without the reg key. + // First, ensure that the emergency-off finch signal works. + EXPECT_TRUE(SetSecurityFinchFlag(true)); elf_security::EarlyBrowserSecurity(); EXPECT_FALSE(IsSecuritySet()); - EXPECT_TRUE(SetExtensionPointEnabledFlag(true)); + EXPECT_TRUE(SetSecurityFinchFlag(false)); - // Second, test that the process mitigation is set when the reg key exists. + // Second, test that the process mitigation is set when no finch signal. elf_security::EarlyBrowserSecurity(); EXPECT_TRUE(IsSecuritySet());
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index bbdb771..44c00238 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2045,7 +2045,7 @@ } if (safe_browsing_mode != 0) { - deps += [ "//components/safe_browsing/core/common/proto:download_file_types_proto" ] + deps += [ "//components/safe_browsing/content/common/proto:download_file_types_proto" ] } if (is_mac) {
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index 2c63353..9f7045e 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -164,7 +164,7 @@ NavigationController* controller, const GURL& url) { content::NavigationSimulator::NavigateAndCommitFromBrowser( - controller->GetWebContents(), url); + controller->DeprecatedGetWebContents(), url); } void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) {
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 539ab04..0b2c4c015 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc
@@ -505,7 +505,8 @@ const content::NotificationDetails& details) { NavigationController* controller = content::Source<NavigationController>(source).ptr(); - if (controller->GetWebContents()->GetURL() != url_) + NavigationEntry* entry = controller->GetVisibleEntry(); + if (!entry || entry->GetVirtualURL() != url_) return; WindowedNotificationObserver::Observe(type, source, details);
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc index 8c1a88f..effa435 100644 --- a/chrome/test/chromedriver/session_commands.cc +++ b/chrome/test/chromedriver/session_commands.cc
@@ -394,25 +394,32 @@ Status ConfigureHeadlessSession(Session* session, const Capabilities& capabilities) { - if (session->chrome->GetBrowserInfo()->is_headless) { + if (!session->chrome->GetBrowserInfo()->is_headless) { + // session is not headless + return Status(kOk); + } + if (capabilities.prefs) { std::string download_directory; - if (capabilities.prefs && - (capabilities.prefs->GetString("download.default_directory", - &download_directory) || - capabilities.prefs->GetStringWithoutPathExpansion( - "download.default_directory", &download_directory))) + if (capabilities.prefs->GetString("download.default_directory", + &download_directory)) { session->headless_download_directory = std::make_unique<std::string>(download_directory); - else - session->headless_download_directory = std::make_unique<std::string>("."); - WebView* first_view; - session->chrome->GetWebViewById(session->window, &first_view); - Status status = first_view->OverrideDownloadDirectoryIfNeeded( - *session->headless_download_directory); - return status; + } else { + std::string* download_directory_str = + capabilities.prefs->FindStringKey("download.default_directory"); + if (download_directory_str) { + session->headless_download_directory = + std::make_unique<std::string>(*download_directory_str); + } + } + } else { + session->headless_download_directory = std::make_unique<std::string>("."); } - // session is not headless - return Status(kOk); + WebView* first_view; + session->chrome->GetWebViewById(session->window, &first_view); + Status status = first_view->OverrideDownloadDirectoryIfNeeded( + *session->headless_download_directory); + return status; } } // namespace internal
diff --git a/chrome/test/chromedriver/test/run_java_tests.py b/chrome/test/chromedriver/test/run_java_tests.py index 92f9c08..facbba1 100755 --- a/chrome/test/chromedriver/test/run_java_tests.py +++ b/chrome/test/chromedriver/test/run_java_tests.py
@@ -6,6 +6,7 @@ """Runs the WebDriver Java acceptance tests.""" from __future__ import print_function +from __future__ import absolute_import import optparse import os import re
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index 4f73a854..bed0dca 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -12,6 +12,7 @@ # is updated in Devil. from __future__ import print_function +from __future__ import absolute_import import base64 import json import math @@ -26,11 +27,14 @@ import threading import time import unittest -import urllib -import urllib2 +import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse import uuid import imghdr import struct +from six.moves import map +from six.moves import range +from six.moves import zip _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) @@ -529,19 +533,19 @@ def testDefaultSession(self): driver = self.CreateDriver() - self.assertFalse(driver.capabilities.has_key('webSocketUrl')) + self.assertFalse('webSocketUrl' in driver.capabilities) self.assertRaises(Exception, websocket_connection.WebSocketConnection, _CHROMEDRIVER_SERVER_URL, driver.GetSessionId()) def testWebSocketUrlFalse(self): driver = self.CreateDriver(web_socket_url=False) - self.assertFalse(driver.capabilities.has_key('webSocketUrl')) + self.assertFalse('webSocketUrl' in driver.capabilities) self.assertRaises(Exception, websocket_connection.WebSocketConnection, _CHROMEDRIVER_SERVER_URL, driver.GetSessionId()) def testWebSocketUrlTrue(self): driver = self.CreateDriver(web_socket_url=True) - self.assertTrue(driver.capabilities.has_key('webSocketUrl')) + self.assertTrue('webSocketUrl' in driver.capabilities) self.assertNotEqual(None, driver.GetSessionId()) self.assertEquals(driver.capabilities['webSocketUrl'], self.composeWebSocketUrl(_CHROMEDRIVER_SERVER_URL, @@ -2356,7 +2360,7 @@ # the test HTTP server. path = os.path.join(chrome_paths.GetTestData(), 'chromedriver', 'page_with_frame.html') - url = 'file://' + urllib.pathname2url(path) + url = 'file://' + six.moves.urllib.request.pathname2url(path) self._driver.Load(url) frame = self._driver.FindElement('css selector', '#frm') self._driver.SwitchToFrame(frame) @@ -3922,20 +3926,20 @@ try: omaha_list = json.loads( - urllib2.urlopen('http://omahaproxy.appspot.com/all.json').read()) + six.moves.urllib.request.urlopen('http://omahaproxy.appspot.com/all.json').read()) for l in omaha_list: if l['os'] != 'android': continue for v in l['versions']: if (('stable' in v['channel'] and 'stable' in _ANDROID_PACKAGE_KEY) or ('beta' in v['channel'] and 'beta' in _ANDROID_PACKAGE_KEY)): - omaha = map(int, v['version'].split('.')) - device = map(int, - self._driver.capabilities['browserVersion'].split('.')) + omaha = list(map(int, v['version'].split('.'))) + device = list(map(int, + self._driver.capabilities['browserVersion'].split('.'))) self.assertTrue(omaha <= device) return raise RuntimeError('Malformed omaha JSON') - except urllib2.URLError as e: + except six.moves.urllib.error.URLError as e: print('Unable to fetch current version info from omahaproxy (%s)' % e) def testDeviceManagement(self): @@ -4117,7 +4121,7 @@ # selection. ports_generator = util.FindProbableFreePorts() for _ in range(3): - port = ports_generator.next() + port = next(ports_generator) port_flag = 'remote-debugging-port=%s' % port try: driver = self.CreateDriver(chrome_switches=[port_flag]) @@ -4551,7 +4555,7 @@ chrome_binary=_CHROME_BINARY, experimental_options={ self.UNEXPECTED_CHROMEOPTION_CAP : 1 }) driver.Quit() - except chromedriver.ChromeDriverException, e: + except chromedriver.ChromeDriverException as e: self.assertTrue(self.LOG_MESSAGE in e.message) finally: chromedriver_server.Kill() @@ -4651,7 +4655,7 @@ # selection. ports_generator = util.FindProbableFreePorts() for _ in range(3): - port = ports_generator.next() + port = next(ports_generator) temp_dir = util.MakeTempDir() print('temp dir is ' + temp_dir) cmd = [_CHROME_BINARY, @@ -4691,7 +4695,7 @@ # selection. ports_generator = util.FindProbableFreePorts() for _ in range(3): - port = ports_generator.next() + port = next(ports_generator) temp_dir = util.MakeTempDir() print('temp dir is ' + temp_dir) cmd = [_CHROME_BINARY, @@ -4759,7 +4763,7 @@ try: os.write(file_descriptor, '#!/bin/bash\nexit 0') os.close(file_descriptor) - os.chmod(path, 0777) + os.chmod(path, 0o777) exception_raised = False try: driver = chromedriver.ChromeDriver(_CHROMEDRIVER_SERVER_URL, @@ -5034,7 +5038,7 @@ parser.add_option( '', '--android-package', help=('Android package key. Possible values: ' + - str(_ANDROID_NEGATIVE_FILTER.keys()))) + str(list(_ANDROID_NEGATIVE_FILTER.keys())))) parser.add_option( '', '--isolated-script-test-output',
diff --git a/chrome/test/chromedriver/test/run_webdriver_tests.py b/chrome/test/chromedriver/test/run_webdriver_tests.py index 01223326..efa4fab1 100644 --- a/chrome/test/chromedriver/test/run_webdriver_tests.py +++ b/chrome/test/chromedriver/test/run_webdriver_tests.py
@@ -4,6 +4,7 @@ """WPT WebDriver tests runner.""" +from __future__ import absolute_import import pytest import os import argparse @@ -90,7 +91,7 @@ filter_list = isolated_script_test_filter.split('::') filtered_tests = [get_relative_subtest_path( test, finder, shard, port) for test in filter_list] - return filter(None, filtered_tests) + return [_f for _f in filtered_tests if _f] def get_relative_subtest_path(external_test_path, finder, shard, port): test_name, subtest_suffix = port.split_webdriver_test_name(
diff --git a/chrome/test/chromedriver/test/test_environment.py b/chrome/test/chromedriver/test/test_environment.py index d347b1c..d45cffd 100644 --- a/chrome/test/chromedriver/test/test_environment.py +++ b/chrome/test/chromedriver/test/test_environment.py
@@ -8,6 +8,7 @@ tests in various environments. """ +from __future__ import absolute_import import logging import os import sys @@ -31,7 +32,8 @@ ANDROID_TEST_HTTPS_PORT = 2411 _EXPECTATIONS = {} -execfile(os.path.join(_THIS_DIR, 'test_expectations'), _EXPECTATIONS) +exec(compile(open(os.path.join(_THIS_DIR, 'test_expectations'), "rb").read(), \ + os.path.join(_THIS_DIR, 'test_expectations'), 'exec'), _EXPECTATIONS) class BaseTestEnvironment(object):
diff --git a/chrome/test/chromedriver/test/unittest_util.py b/chrome/test/chromedriver/test/unittest_util.py index 6a3fcd1c..205b1c9 100644 --- a/chrome/test/chromedriver/test/unittest_util.py +++ b/chrome/test/chromedriver/test/unittest_util.py
@@ -4,6 +4,7 @@ """Utilities for dealing with the python unittest module.""" +from __future__ import absolute_import import fnmatch import sys import unittest @@ -81,7 +82,7 @@ def GetTestNamesFromSuite(suite): """Returns a list of every test name in the given suite.""" - return map(lambda x: GetTestName(x), GetTestsFromSuite(suite)) + return [GetTestName(x) for x in GetTestsFromSuite(suite)] def GetTestName(test):
diff --git a/chrome/test/chromedriver/test/webserver.py b/chrome/test/chromedriver/test/webserver.py index f2b93563..36d5fb9 100644 --- a/chrome/test/chromedriver/test/webserver.py +++ b/chrome/test/chromedriver/test/webserver.py
@@ -2,9 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import BaseHTTPServer +from __future__ import absolute_import +import six.moves.BaseHTTPServer import os -import SocketServer +import six.moves.socketserver import threading import ssl import sys @@ -57,7 +58,7 @@ return self._handler.headers.getheader(name) -class _BaseServer(BaseHTTPServer.HTTPServer): +class _BaseServer(six.moves.BaseHTTPServer.HTTPServer): """Internal server that throws if timed out waiting for a request.""" def __init__(self, on_request, server_cert_and_key_path=None): @@ -70,7 +71,7 @@ server_cert_and_key_path: path to a PEM file containing the cert and key. if it is None, start the server as an HTTP one. """ - class _Handler(BaseHTTPServer.BaseHTTPRequestHandler): + class _Handler(six.moves.BaseHTTPServer.BaseHTTPRequestHandler): """Internal handler that just asks the server to handle the request.""" def do_GET(self): @@ -85,17 +86,18 @@ def handle(self): try: - BaseHTTPServer.BaseHTTPRequestHandler.handle(self) + six.moves.BaseHTTPServer.BaseHTTPRequestHandler.handle(self) except: pass # Ignore socket errors. def finish(self): try: - BaseHTTPServer.BaseHTTPRequestHandler.finish(self) + six.moves.BaseHTTPServer.BaseHTTPRequestHandler.finish(self) except: pass # Ignore socket errors. - BaseHTTPServer.HTTPServer.__init__(self, ('127.0.0.1', 0), _Handler) + six.moves.BaseHTTPServer.HTTPServer.__init__(self, ('127.0.0.1', 0), \ + _Handler) if server_cert_and_key_path is not None: self._is_https_enabled = True @@ -116,7 +118,7 @@ return 'http' + postfix -class _ThreadingServer(SocketServer.ThreadingMixIn, _BaseServer): +class _ThreadingServer(six.moves.socketserver.ThreadingMixIn, _BaseServer): """_BaseServer enhanced to handle multiple requests simultaneously""" pass
diff --git a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_test.js b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_test.js index 264aa871..ee8dc9a 100644 --- a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_test.js +++ b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_test.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {GROUP_ICON_SIZE} from 'chrome://emoji-picker/constants.js'; +import {EMOJI_PICKER_TOTAL_EMOJI_WIDTH} from 'chrome://emoji-picker/constants.js'; import {EmojiButton} from 'chrome://emoji-picker/emoji_button.js'; import {EmojiPicker} from 'chrome://emoji-picker/emoji_picker.js'; import {EmojiPickerApiProxyImpl} from 'chrome://emoji-picker/emoji_picker_api_proxy.js'; @@ -77,7 +77,8 @@ test('Highlight bar should under emotions on start', () => { const button = findInEmojiPicker('#bar'); - assertCloseTo(GROUP_ICON_SIZE, parseFloat(button.style.left)); + assertCloseTo( + EMOJI_PICKER_TOTAL_EMOJI_WIDTH, parseFloat(button.style.left)); }); test('clicking second tab should activate it and scroll', async () => {
diff --git a/chromecast/public/media/decoder_config.h b/chromecast/public/media/decoder_config.h index a043291..85cb791 100644 --- a/chromecast/public/media/decoder_config.h +++ b/chromecast/public/media/decoder_config.h
@@ -227,7 +227,7 @@ }; // ---- Begin copy/paste from //ui/gfx/color_space.h ---- -// ---- Begin copy/paste from media/base/hdr_metadata.h ---- +// ---- Begin copy/paste from //ui/gfx/hdr_metadata.h ---- // SMPTE ST 2086 mastering metadata. struct MasteringMetadata { float primary_r_chromaticity_x = 0; @@ -243,6 +243,7 @@ MasteringMetadata(); MasteringMetadata(const MasteringMetadata& rhs); + MasteringMetadata& operator=(const MasteringMetadata& rhs); }; // HDR metadata common for HDR10 and WebM/VP9-based HDR formats. @@ -253,15 +254,18 @@ HDRMetadata(); HDRMetadata(const HDRMetadata& rhs); + HDRMetadata& operator=(const HDRMetadata& rhs); }; inline MasteringMetadata::MasteringMetadata() {} -inline MasteringMetadata::MasteringMetadata(const MasteringMetadata& rhs) = - default; +inline MasteringMetadata::MasteringMetadata(const MasteringMetadata&) = default; +inline MasteringMetadata& MasteringMetadata::operator=( + const MasteringMetadata&) = default; inline HDRMetadata::HDRMetadata() {} -inline HDRMetadata::HDRMetadata(const HDRMetadata& rhs) = default; -// ---- End copy/paste from media/base/hdr_metadata.h ---- +inline HDRMetadata::HDRMetadata(const HDRMetadata&) = default; +inline HDRMetadata& HDRMetadata::operator=(const HDRMetadata&) = default; +// ---- End copy/paste from //ui/gfx/hdr_metadata.h ---- constexpr int kChannelAll = -1;
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index eb909db4..65985104 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14070.0.0 \ No newline at end of file +14073.0.0 \ No newline at end of file
diff --git a/chromeos/components/BUILD.gn b/chromeos/components/BUILD.gn index e0cdee607..4255fb4 100644 --- a/chromeos/components/BUILD.gn +++ b/chromeos/components/BUILD.gn
@@ -36,7 +36,6 @@ "//chromeos/components/power:unit_tests", "//chromeos/components/proximity_auth:unit_tests", "//chromeos/components/quick_answers:unit_tests", - "//chromeos/components/quick_pair:unit_tests", "//chromeos/components/security_token_pin:unit_tests", "//chromeos/components/sensors:unit_tests", "//chromeos/components/smbfs:unit_tests",
diff --git a/chromeos/components/camera_app_ui/resources.h b/chromeos/components/camera_app_ui/resources.h index 1b3d899..b5f1e11 100644 --- a/chromeos/components/camera_app_ui/resources.h +++ b/chromeos/components/camera_app_ui/resources.h
@@ -49,6 +49,7 @@ {"error_msg_video_too_short", IDS_ERROR_MSG_VIDEO_TOO_SHORT}, {"expert_custom_video_parameters", IDS_EXPERT_CUSTOM_VIDEO_PARAMETERS}, {"expert_enable_expert_mode", IDS_EXPERT_ENABLE_EXPERT_MODE}, + {"expert_multistream_recording", IDS_EXPERT_MULTISTREAM_RECORDING}, {"expert_mode_button", IDS_EXPERT_MODE_BUTTON}, {"expert_preview_metadata", IDS_EXPERT_PREVIEW_METADATA}, {"expert_print_performance_logs", IDS_EXPERT_PRINT_PERFORMANCE_LOGS},
diff --git a/chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js b/chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js index f4a4242..e45022b 100644 --- a/chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js +++ b/chromeos/components/camera_app_ui/resources/js/device/constraints_preferrer.js
@@ -505,9 +505,11 @@ } /** - * @override + * @param {string} deviceId + * @return {!Array<!CaptureCandidate>} + * @private */ - getSortedCandidates(deviceId) { + getMultiStreamSortedCandidates_(deviceId) { /** @type {!Resolution} */ const prefR = this.getPrefResolution(deviceId) || new Resolution(0, -1); @@ -568,6 +570,73 @@ .flatMap(toVideoCandidate) .sort(this.getPreferResolutionSort_(prefR)); } + + /** + * @param {string} deviceId + * @return {!Array<!CaptureCandidate>} + * @private + */ + getSortedCandidates_(deviceId) { + /** + * Maps specified video resolution to object of resolution and all supported + * constant fps under that resolution or null fps for not support constant + * fps. The resolution-fpses are sorted by user preference of constant fps. + * @param {!Resolution} r + * @return {!Array<{r: !Resolution, fps: number}>} + */ + const getFpses = (r) => { + let /** !Array<?number> */ constFpses = [null]; + /** @type {!Array<number>} */ + const constFpsInfo = this.constFpsInfo_[deviceId][r]; + // The higher constant fps will be ignored if constant 30 and 60 presented + // due to currently lack of UI support for toggling it. + if (constFpsInfo.includes(30) && constFpsInfo.includes(60)) { + const prefFps = + this.prefFpses_[deviceId] && this.prefFpses_[deviceId][r] || 30; + constFpses = prefFps === 30 ? [30, 60] : [60, 30]; + } else { + constFpses = + [...constFpsInfo.filter((fps) => fps >= 30).sort().reverse(), null]; + } + return constFpses.map((fps) => ({r, fps})); + }; + + /** + * @param {!Resolution} r + * @param {number} fps + * @return {!MediaStreamConstraints} + */ + const toPreivewConstraints = ({width, height}, fps) => ({ + audio: {echoCancellation: false}, + video: { + deviceId: {exact: deviceId}, + frameRate: fps ? {exact: fps} : {min: 20, ideal: 30}, + width, + height, + }, + }); + + const prefR = this.getPrefResolution(deviceId) || new Resolution(0, -1); + return [...this.supportedResolutions_.get(deviceId)] + .flatMap(getFpses) + .map(({r, fps}) => ({ + resolution: r, + // For non-multistream recording, preview stream is used directly + // to do video recording. + previewCandidates: [toPreivewConstraints(r, fps)], + })) + .sort(this.getPreferResolutionSort_(prefR)); + } + + /** + * @override + */ + getSortedCandidates(deviceId) { + if (state.get(state.State.ENABLE_MULTISTREAM_RECORDING)) { + return this.getMultiStreamSortedCandidates_(deviceId); + } + return this.getSortedCandidates_(deviceId); + } } /**
diff --git a/chromeos/components/camera_app_ui/resources/js/state.js b/chromeos/components/camera_app_ui/resources/js/state.js index c39ddcdb1..4fad394 100644 --- a/chromeos/components/camera_app_ui/resources/js/state.js +++ b/chromeos/components/camera_app_ui/resources/js/state.js
@@ -17,6 +17,7 @@ CAMERA_CONFIGURING: 'camera-configuring', CAMERA_SWITCHING: 'camera-switching', CUSTOM_VIDEO_PARAMETERS: 'custom-video-parameters', + ENABLE_MULTISTREAM_RECORDING: 'enable-multistream-recording', ENABLE_PTZ: 'enable-ptz', EXPERT: 'expert', FPS_30: 'fps-30',
diff --git a/chromeos/components/camera_app_ui/resources/js/views/camera.js b/chromeos/components/camera_app_ui/resources/js/views/camera.js index 2b3b3eda..2a118d2 100644 --- a/chromeos/components/camera_app_ui/resources/js/views/camera.js +++ b/chromeos/components/camera_app_ui/resources/js/views/camera.js
@@ -373,6 +373,10 @@ state.addObserver(state.State.SCREEN_OFF_AUTO, handleScreenStateChange); state.addObserver(state.State.HAS_EXTERNAL_SCREEN, handleScreenStateChange); + state.addObserver(state.State.ENABLE_MULTISTREAM_RECORDING, () => { + this.start(); + }); + this.initVideoEncoderOptions_(); }
diff --git a/chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js index 16452a9..2e1af63 100644 --- a/chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js +++ b/chromeos/components/camera_app_ui/resources/js/views/camera/mode/video.js
@@ -177,21 +177,12 @@ } /** - * @param {!MediaStream} stream - * @return {!Resolution} - */ -function getResolution(stream) { - const {width, height} = stream.getVideoTracks()[0].getSettings(); - return new Resolution(width, height); -} - -/** * Video mode capture controller. */ export class Video extends ModeBase { /** * @param {!MediaStream} stream Preview stream. - * @param {!MediaStreamConstraints} captureConstraints + * @param {?MediaStreamConstraints} captureConstraints * @param {?Resolution} captureResolution * @param {!Facing} facing * @param {!VideoHandler} handler @@ -200,7 +191,7 @@ super(stream, facing); /** - * @const {!MediaStreamConstraints} + * @const {?MediaStreamConstraints} * @private */ this.captureConstraints_ = captureConstraints; @@ -209,7 +200,13 @@ * @const {!Resolution} * @private */ - this.captureResolution_ = captureResolution || getResolution(stream); + this.captureResolution_ = (() => { + if (captureResolution !== null) { + return captureResolution; + } + const {width, height} = stream.getVideoTracks()[0].getSettings(); + return new Resolution(width, height); + })(); /** * @const {!VideoHandler} @@ -363,8 +360,7 @@ const preference = encoderPreference.get(loadTimeData.getBoard()) || {profile: h264.Profile.HIGH, multiplier: 2}; const {profile, multiplier} = preference; - const {width, height, frameRate} = - this.captureStream_.stream.getVideoTracks()[0].getSettings(); + const {width, height, frameRate} = this.getVideoTrack_().getSettings(); const resolution = new Resolution(width, height); const bitrate = resolution.area * multiplier; const level = h264.getMinimalLevel(profile, bitrate, frameRate, resolution); @@ -380,6 +376,25 @@ } /** + * @return {!MediaStream} + * @private + */ + getRecordingStream_() { + if (this.captureStream_ !== null) { + return this.captureStream_.stream; + } + return this.stream_; + } + + /** + * Gets video track of recording stream. + * @return {!MediaStreamTrack} + */ + getVideoTrack_() { + return this.getRecordingStream_().getVideoTracks()[0]; + } + + /** * @override */ async start_() { @@ -393,13 +408,12 @@ throw new CanceledError('Recording sound is canceled'); } - if (this.captureStream_ === null) { + if (this.captureConstraints_ !== null && this.captureStream_ === null) { this.captureStream_ = await StreamManager.getInstance().openCaptureStream( this.captureConstraints_); } if (this.imageCapture_ === null) { - this.imageCapture_ = - new ImageCapture(this.captureStream_.stream.getVideoTracks()[0]); + this.imageCapture_ = new ImageCapture(this.getVideoTrack_()); } try { @@ -414,7 +428,7 @@ option.videoBitsPerSecond = param.bitrate; } this.mediaRecorder_ = - new MediaRecorder(this.captureStream_.stream, option); + new MediaRecorder(this.getRecordingStream_(), option); } catch (e) { toast.show(I18nString.ERROR_MSG_RECORD_START_FAILED); throw e; @@ -450,20 +464,17 @@ return; } - const settings = - this.captureStream_.stream.getVideoTracks()[0].getSettings(); - const resolution = new Resolution(settings.width, settings.height); state.set(PerfEvent.VIDEO_CAPTURE_POST_PROCESSING, true); try { await this.handler_.handleResultVideo(new VideoResult({ - resolution, + resolution: this.captureResolution_, duration: this.recordTime_.inMinutes(), videoSaver, everPaused: this.everPaused_, })); state.set( PerfEvent.VIDEO_CAPTURE_POST_PROCESSING, false, - {resolution, facing: this.facing_}); + {resolution: this.captureResolution_, facing: this.facing_}); } catch (e) { state.set( PerfEvent.VIDEO_CAPTURE_POST_PROCESSING, false, {hasError: true}); @@ -559,10 +570,10 @@ this.handler_ = handler; /** - * @type {!MediaStreamConstraints} + * @type {?MediaStreamConstraints} * @private */ - this.captureConstraints_; + this.captureConstraints_ = null; } /** @@ -571,16 +582,18 @@ async prepareDevice(constraints, resolution) { this.captureResolution_ = resolution; const deviceId = assertString(constraints.video.deviceId.exact); - this.captureConstraints_ = { - audio: constraints.audio, - video: { - deviceId: constraints.video.deviceId, - frameRate: constraints.video.frameRate, - }, - }; - if (resolution !== null) { - this.captureConstraints_.video.width = resolution.width; - this.captureConstraints_.video.height = resolution.height; + if (state.get(state.State.ENABLE_MULTISTREAM_RECORDING)) { + this.captureConstraints_ = { + audio: constraints.audio, + video: { + deviceId: constraints.video.deviceId, + frameRate: constraints.video.frameRate, + }, + }; + if (resolution !== null) { + this.captureConstraints_.video.width = resolution.width; + this.captureConstraints_.video.height = resolution.height; + } } const deviceOperator = await DeviceOperator.getInstance();
diff --git a/chromeos/components/camera_app_ui/resources/strings/camera_strings.grd b/chromeos/components/camera_app_ui/resources/strings/camera_strings.grd index 98b3d04..fd2a739f 100644 --- a/chromeos/components/camera_app_ui/resources/strings/camera_strings.grd +++ b/chromeos/components/camera_app_ui/resources/strings/camera_strings.grd
@@ -314,6 +314,9 @@ <message desc="Label for expert mode option: custom video parameters." name="IDS_EXPERT_CUSTOM_VIDEO_PARAMETERS"> Custom video parameters </message> + <message desc="Label for expert mode option: Multi-stream video recording." name="IDS_EXPERT_MULTISTREAM_RECORDING"> + Multistream video recording + </message> <message desc="Label for expert mode option: enable expert mode." name="IDS_EXPERT_ENABLE_EXPERT_MODE"> Enable expert mode </message>
diff --git a/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_MULTISTREAM_RECORDING.png.sha1 b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_MULTISTREAM_RECORDING.png.sha1 new file mode 100644 index 0000000..b2b6765c --- /dev/null +++ b/chromeos/components/camera_app_ui/resources/strings/camera_strings_grd/IDS_EXPERT_MULTISTREAM_RECORDING.png.sha1
@@ -0,0 +1 @@ +9c42828ce501b654580641b2599888a3526058d4 \ No newline at end of file
diff --git a/chromeos/components/camera_app_ui/resources/views/main.html b/chromeos/components/camera_app_ui/resources/views/main.html index d80e363..0134245 100644 --- a/chromeos/components/camera_app_ui/resources/views/main.html +++ b/chromeos/components/camera_app_ui/resources/views/main.html
@@ -480,6 +480,12 @@ <span i18n-text="expert_custom_video_parameters"></span> </label> <label class="menu-item inkdrop"> + <input class="icon" type="checkbox" tabindex="0" + data-state="enable-multistream-recording" + data-key="enableMultistreamRecording"> + <span i18n-text="expert_multistream_recording"></span> + </label> + <label class="menu-item inkdrop"> <input id="expert-enable-expert-mode" class="icon" type="checkbox" tabindex="0" data-state="expert" data-key="expert">
diff --git a/chromeos/components/help_app_ui/BUILD.gn b/chromeos/components/help_app_ui/BUILD.gn index d00289d..19387183 100644 --- a/chromeos/components/help_app_ui/BUILD.gn +++ b/chromeos/components/help_app_ui/BUILD.gn
@@ -97,7 +97,7 @@ js2gtest("browser_tests_js") { test_type = "mojo_lite_webui" - sources = [ "test/help_app_ui_gtest_browsertest.js" ] + sources = [ "test/help_app_ui_browsertest.js" ] defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] @@ -126,7 +126,6 @@ "test/driver.js", "test/driver_api.js", "test/guest_query_receiver.js", - "test/help_app_ui_browsertest.js", "test/help_app_guest_ui_browsertest.js", ] } @@ -149,7 +148,6 @@ deps = [ ":test_help_app_guest_ui_browsertest_js", ":test_help_app_ui_browsertest_js", - ":test_help_app_ui_gtest_browsertest_js", ] } @@ -179,17 +177,11 @@ ] } -js_library("test_help_app_ui_gtest_browsertest_js") { - testonly = true - sources = [ "test/help_app_ui_gtest_browsertest.js" ] - externs_list = - [ "//chromeos/components/web_applications/js2gtest_support.externs.js" ] - deps = [ ":test_help_app_ui_browsertest_js" ] -} - js_library("test_help_app_ui_browsertest_js") { testonly = true sources = [ "test/help_app_ui_browsertest.js" ] + externs_list = + [ "//chromeos/components/web_applications/js2gtest_support.externs.js" ] deps = [ ":test_driver_js", "//chromeos/components/help_app_ui/resources:browser_proxy",
diff --git a/chromeos/components/help_app_ui/help_app_ui.cc b/chromeos/components/help_app_ui/help_app_ui.cc index dcd9fb9..f67b371 100644 --- a/chromeos/components/help_app_ui/help_app_ui.cc +++ b/chromeos/components/help_app_ui/help_app_ui.cc
@@ -16,7 +16,6 @@ #include "chromeos/components/local_search_service/public/cpp/local_search_service_proxy.h" #include "chromeos/components/local_search_service/public/cpp/local_search_service_proxy_factory.h" #include "chromeos/components/local_search_service/public/mojom/types.mojom.h" -#include "chromeos/components/web_applications/webui_test_prod_util.h" #include "chromeos/grit/chromeos_help_app_resources.h" #include "chromeos/strings/grit/chromeos_strings.h" #include "components/content_settings/core/common/content_settings_types.h" @@ -38,8 +37,16 @@ source->SetDefaultResource(IDR_HELP_APP_HOST_INDEX_HTML); source->AddResourcePath("app_icon_192.png", IDR_HELP_APP_ICON_192); source->AddResourcePath("app_icon_512.png", IDR_HELP_APP_ICON_512); - source->AddResourcePath("browser_proxy.js", IDR_HELP_APP_BROWSER_PROXY_JS); - + source->AddResourcePath("help_app_index_scripts.js", + IDR_HELP_APP_INDEX_SCRIPTS_JS); + source->AddResourcePath("help_app.mojom-lite.js", + IDR_HELP_APP_HELP_APP_MOJOM_JS); + source->AddResourcePath("local_search_service_types.mojom-lite.js", + IDR_HELP_APP_LOCAL_SEARCH_SERVICE_TYPES_MOJOM_JS); + source->AddResourcePath("local_search_service_index.mojom-lite.js", + IDR_HELP_APP_LOCAL_SEARCH_SERVICE_INDEX_MOJOM_JS); + source->AddResourcePath("help_app_search.mojom-lite.js", + IDR_HELP_APP_SEARCH_MOJOM_JS); source->AddLocalizedString("appTitle", IDS_HELP_APP_EXPLORE); return source; } @@ -75,12 +82,6 @@ ContentSettingsType::SOUND, }); - if (MaybeConfigureTestableDataSource(host_source)) { - host_source->OverrideContentSecurityPolicy( - network::mojom::CSPDirectiveName::TrustedTypes, - std::string("trusted-types test-harness;")); - } - // Register common permissions for chrome-untrusted:// pages. // TODO(https://crbug.com/1113568): Remove this after common permissions are // granted by default.
diff --git a/chromeos/components/help_app_ui/help_app_untrusted_ui.cc b/chromeos/components/help_app_ui/help_app_untrusted_ui.cc index 48dc6282..9349b9e 100644 --- a/chromeos/components/help_app_ui/help_app_untrusted_ui.cc +++ b/chromeos/components/help_app_ui/help_app_untrusted_ui.cc
@@ -5,7 +5,6 @@ #include "chromeos/components/help_app_ui/help_app_untrusted_ui.h" #include "chromeos/components/help_app_ui/url_constants.h" -#include "chromeos/components/web_applications/webui_test_prod_util.h" #include "chromeos/grit/chromeos_help_app_bundle_resources.h" #include "chromeos/grit/chromeos_help_app_bundle_resources_map.h" #include "chromeos/grit/chromeos_help_app_resources.h" @@ -15,6 +14,7 @@ #include "content/public/browser/web_ui_data_source.h" #include "content/public/common/url_constants.h" #include "services/network/public/mojom/content_security_policy.mojom.h" +#include "ui/resources/grit/webui_generated_resources.h" namespace chromeos { @@ -29,15 +29,15 @@ // the other paths. source->SetDefaultResource(IDR_HELP_APP_APP_HTML); source->AddResourcePath("app_bin.js", IDR_HELP_APP_APP_BIN_JS); - source->AddResourcePath("receiver.js", IDR_HELP_APP_RECEIVER_JS); + source->AddResourcePath("load_time_data.js", IDR_WEBUI_JS_LOAD_TIME_DATA_JS); + source->AddResourcePath("help_app_app_scripts.js", + IDR_HELP_APP_APP_SCRIPTS_JS); source->DisableTrustedTypesCSP(); // Add all resources from chromeos_help_app_bundle.pak. source->AddResourcePaths(base::make_span( kChromeosHelpAppBundleResources, kChromeosHelpAppBundleResourcesSize)); - MaybeConfigureTestableDataSource(source); - // Add device and feature flags. populate_load_time_data_callback.Run(source); source->AddLocalizedString("appName", IDS_HELP_APP_EXPLORE);
diff --git a/chromeos/components/help_app_ui/resources/BUILD.gn b/chromeos/components/help_app_ui/resources/BUILD.gn index 346d199..3a3ac48 100644 --- a/chromeos/components/help_app_ui/resources/BUILD.gn +++ b/chromeos/components/help_app_ui/resources/BUILD.gn
@@ -2,14 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//chrome/browser/resources/tools/optimize_webui.gni") import("//chromeos/components/web_applications/system_apps.gni") import("//third_party/closure_compiler/compile_js.gni") assert(is_chromeos, "Help App is Chrome OS only") -stage_folder = "$target_gen_dir/stage" - group("closure_compile") { deps = [ ":closure_compile_app", @@ -17,60 +14,6 @@ ] } -# Move all files into a single folder so optimize_webui can generate a single -# file bundle. stage_static moves all static files from src/ into stage/ and -# stage_generated moves generated files from gen/ into stage/. -copy("stage_static") { - sources = [ - "//chromeos/components/system_apps/public/js/sandboxed_load_time_data.js", - "browser_proxy.js", - "message_types.js", - "receiver.js", - ] - outputs = [ stage_folder + "/{{source_file_part}}" ] -} - -copy("stage_generated") { - sources = [ - "$target_gen_dir/../../local_search_service/public/mojom/index.mojom-lite.js", - "$target_gen_dir/../../local_search_service/public/mojom/types.mojom-lite.js", - "$target_gen_dir/../../system_apps/public/js/message_pipe.m.js", - "$target_gen_dir/../help_app_ui.mojom-lite.js", - "$target_gen_dir/../search/search.mojom-lite.js", - ] - outputs = [ stage_folder + "/{{source_file_part}}" ] - deps = [ - "//chromeos/components/help_app_ui:mojo_bindings_js", - "//chromeos/components/help_app_ui/search:mojo_bindings_js__generator", - "//chromeos/components/local_search_service/public/mojom:mojom_js__generator", - "//chromeos/components/system_apps/public/js:modulize", - ] -} - -# Generate a bundle of all the JS needed for chrome://help-app. -optimize_webui("browser_proxy_rollup") { - host = "help-app" - js_out_files = [ "browser_proxy.rollup.js" ] - js_module_in_files = [ "browser_proxy.js" ] - input = rebase_path(stage_folder, root_build_dir) - deps = [ - ":stage_generated", - ":stage_static", - ] -} - -# Generate a bundle of all the JS needed for chrome-untrusted://help-app. -optimize_webui("receiver_rollup") { - host = "help-app" - js_out_files = [ "receiver.rollup.js" ] - js_module_in_files = [ "receiver.js" ] - input = rebase_path(stage_folder, root_build_dir) - deps = [ - ":stage_generated", - ":stage_static", - ] -} - js_type_check("closure_compile_index") { closure_flags = system_app_closure_flags_strict deps = [ ":browser_proxy" ] @@ -81,8 +24,6 @@ deps = [ ":receiver" ] } -# We don't use these libraries in our build process but have them so we can -# retain type checking via the above js_type_check rules. js_library("browser_proxy") { externs_list = [ # The privileged context can't access the app, but shares struct definitions @@ -95,7 +36,7 @@ "//chromeos/components/help_app_ui:mojo_bindings_js_library_for_compile", "//chromeos/components/help_app_ui/search:mojo_bindings_js_library_for_compile", "//chromeos/components/local_search_service/public/mojom:mojom_js_library_for_compile", - "//chromeos/components/system_apps/public/js:message_pipe.m", + "//chromeos/components/system_apps/public/js:message_pipe", ] } @@ -106,6 +47,6 @@ externs_list = [ "help_app.externs.js" ] deps = [ ":message_types", - "//chromeos/components/system_apps/public/js:message_pipe.m", + "//chromeos/components/system_apps/public/js:message_pipe", ] }
diff --git a/chromeos/components/help_app_ui/resources/app.html b/chromeos/components/help_app_ui/resources/app.html index 4ed8fca..4de93a2 100644 --- a/chromeos/components/help_app_ui/resources/app.html +++ b/chromeos/components/help_app_ui/resources/app.html
@@ -9,13 +9,8 @@ margin: 0; } </style> -<script src="/receiver.js" type="module"></script> -<!-- - Populates `window.loadTimeData.data`. Needs to be after - "receiver.js" which loads "sandboxed_load_time_data.js". But - module scripts do not block parsing, so these non-module scripts must be - loaded on the defer queue. ---> -<script src="/strings.js" defer></script> -<script src="/app_bin.js" defer></script> +<script src="/load_time_data.js"></script> +<script src="/strings.js"></script> +<script src="/app_bin.js"></script> +<script src="/help_app_app_scripts.js"></script> </html>
diff --git a/chromeos/components/help_app_ui/resources/browser_proxy.js b/chromeos/components/help_app_ui/resources/browser_proxy.js index 0634484..a71d1f00 100644 --- a/chromeos/components/help_app_ui/resources/browser_proxy.js +++ b/chromeos/components/help_app_ui/resources/browser_proxy.js
@@ -1,15 +1,6 @@ // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import './help_app_ui.mojom-lite.js'; -// The order here matters, types must be imported before index and search which -// rely on it. -import './types.mojom-lite.js'; -import './index.mojom-lite.js'; -import './search.mojom-lite.js'; - -import {MessagePipe} from './message_pipe.m.js'; -import {Message} from './message_types.js'; const help_app = { handler: new helpAppUi.mojom.PageHandlerRemote() @@ -21,7 +12,8 @@ // Set up an index remote to talk to Local Search Service. /** @type {!chromeos.localSearchService.mojom.IndexRemote} */ -const indexRemote = chromeos.localSearchService.mojom.Index.getRemote(); +const indexRemote = + chromeos.localSearchService.mojom.Index.getRemote(); /** * Talks to the search handler. Use for updating the content for launcher @@ -176,7 +168,7 @@ // Id of the best subheading that appears in positions. We consider // the subheading containing the most match positions to be the best. // "" means no subheading positions found. - let bestSubheadingId = ''; + let bestSubheadingId = ""; /** * Counts how many positions there are for each subheading id. * @type {!Object<string, number>} @@ -195,8 +187,8 @@ // best subheading. const newCount = (subheadingPosCounts[position.contentId] || 0) + 1; subheadingPosCounts[position.contentId] = newCount; - if (!bestSubheadingId || - newCount > subheadingPosCounts[bestSubheadingId]) { + if (!bestSubheadingId + || newCount > subheadingPosCounts[bestSubheadingId]) { bestSubheadingId = position.contentId; } } @@ -223,10 +215,12 @@ id: result.id, titlePositions, bodyPositions, - subheadingIndex: bestSubheadingId ? - Number(bestSubheadingId.substring(SUBHEADING_ID.length)) : - null, - subheadingPositions: bestSubheadingId ? subheadingPositions : null, + subheadingIndex: bestSubheadingId + ? Number(bestSubheadingId.substring(SUBHEADING_ID.length)) + : null, + subheadingPositions: bestSubheadingId + ? subheadingPositions + : null, }; }); return {results}; @@ -243,33 +237,29 @@ guestMessagePipe.registerHandler( Message.UPDATE_LAUNCHER_SEARCH_INDEX, async (message) => { - if (!(await isLauncherSearchEnabled)) { - return; - } + if (!(await isLauncherSearchEnabled)) return; const dataFromApp = /** @type {!Array<!helpApp.LauncherSearchableItem>} */ (message); /** @type {!Array<!chromeos.helpApp.mojom.SearchConcept>} */ - const dataToSend = dataFromApp.map( - searchableItem => ({ - id: truncate(searchableItem.id), - title: toString16(searchableItem.title), - mainCategory: toString16(searchableItem.mainCategoryName), - tags: searchableItem.tags.map(tag => toString16(tag)) - .filter(tag => tag.data.length > 0), - urlPathWithParameters: - truncate(searchableItem.urlPathWithParameters), - locale: truncate(searchableItem.locale), - })); + const dataToSend = dataFromApp.map(searchableItem => ({ + id: truncate(searchableItem.id), + title: toString16(searchableItem.title), + mainCategory: toString16(searchableItem.mainCategoryName), + tags: searchableItem.tags.map(tag => toString16(tag)) + .filter(tag => tag.data.length > 0), + urlPathWithParameters: truncate(searchableItem.urlPathWithParameters), + locale: truncate(searchableItem.locale), + })); // Filter out invalid items. No field can be empty except locale. const dataFiltered = dataToSend.filter(item => { - const valid = item.id && item.title && item.mainCategory && - item.tags.length > 0 && item.urlPathWithParameters; + const valid = item.id && item.title && item.mainCategory + && item.tags.length > 0 && item.urlPathWithParameters; // This is a google-internal histogram. If changing this, also change // the corresponding histograms file. if (!valid) { chrome.metricsPrivate.recordSparseHashable( - 'Discover.LauncherSearch.InvalidConceptInUpdate', item.id); + 'Discover.LauncherSearch.InvalidConceptInUpdate', item.id); } return valid; }); @@ -304,13 +294,7 @@ * @return {string} */ function truncate(s) { - if (typeof s !== 'string') { - return ''; - } - if (s.length <= MAX_STRING_LEN) { - return s; - } + if (typeof s !== 'string') return ''; + if (s.length <= MAX_STRING_LEN) return s; return s.substring(0, MAX_STRING_LEN); } - -export const TEST_ONLY = {guestMessagePipe};
diff --git a/chromeos/components/help_app_ui/resources/help_app_app_scripts.js b/chromeos/components/help_app_ui/resources/help_app_app_scripts.js new file mode 100644 index 0000000..9375725 --- /dev/null +++ b/chromeos/components/help_app_ui/resources/help_app_app_scripts.js
@@ -0,0 +1,9 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** @fileoverview Concatenation of the JS files we use in app.html. */ + +// <include src="../../system_apps/public/js/message_pipe.js"> +// <include src="message_types.js"> +// <include src="receiver.js">
diff --git a/chromeos/components/help_app_ui/resources/help_app_index_scripts.js b/chromeos/components/help_app_ui/resources/help_app_index_scripts.js new file mode 100644 index 0000000..b20808c --- /dev/null +++ b/chromeos/components/help_app_ui/resources/help_app_index_scripts.js
@@ -0,0 +1,9 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** @fileoverview Concatenation of the JS files we use in index.html. */ + +// <include src="../../system_apps/public/js/message_pipe.js"> +// <include src="message_types.js"> +// <include src="browser_proxy.js">
diff --git a/chromeos/components/help_app_ui/resources/help_app_resources.grd b/chromeos/components/help_app_ui/resources/help_app_resources.grd index 81212bb..aa91e6ff 100644 --- a/chromeos/components/help_app_ui/resources/help_app_resources.grd +++ b/chromeos/components/help_app_ui/resources/help_app_resources.grd
@@ -19,16 +19,23 @@ type="BINDATA" /> <include name="IDR_HELP_APP_ICON_512" file="app_icon_512.png" type="BINDATA" /> - <include name="IDR_HELP_APP_BROWSER_PROXY_JS" - file="${root_gen_dir}/chromeos/components/help_app_ui/resources/browser_proxy.rollup.js" - resource_path="browser_proxy.js" - use_base_dir="false" type="BINDATA" /> + <include name="IDR_HELP_APP_HELP_APP_MOJOM_JS" + file="${root_gen_dir}/chromeos/components/help_app_ui/help_app_ui.mojom-lite.js" + resource_path="help_app_ui.mojom-lite.js" use_base_dir="false" type="BINDATA" /> + <include name="IDR_HELP_APP_LOCAL_SEARCH_SERVICE_TYPES_MOJOM_JS" + file="${root_gen_dir}/chromeos/components/local_search_service/public/mojom/types.mojom-lite.js" + resource_path="local_search_service_types.mojom-lite.js" use_base_dir="false" type="BINDATA" /> + <include name="IDR_HELP_APP_LOCAL_SEARCH_SERVICE_INDEX_MOJOM_JS" + file="${root_gen_dir}/chromeos/components/local_search_service/public/mojom/index.mojom-lite.js" + resource_path="local_search_service_index.mojom-lite.js" use_base_dir="false" type="BINDATA" /> + <include name="IDR_HELP_APP_SEARCH_MOJOM_JS" + file="${root_gen_dir}/chromeos/components/help_app_ui/search/search.mojom-lite.js" + resource_path="help_app_search.mojom-lite.js" use_base_dir="false" type="BINDATA" /> + <include name="IDR_HELP_APP_INDEX_SCRIPTS_JS" file="help_app_index_scripts.js" flattenhtml="true" type="BINDATA" /> + <!-- Unprivileged guest contents. --> <include name="IDR_HELP_APP_APP_HTML" file="app.html" type="BINDATA" /> - <include name="IDR_HELP_APP_RECEIVER_JS" - file="${root_gen_dir}/chromeos/components/help_app_ui/resources/receiver.rollup.js" - resource_path="receiver.js" use_base_dir="false" - type="BINDATA" /> + <include name="IDR_HELP_APP_APP_SCRIPTS_JS" file="help_app_app_scripts.js" flattenhtml="true" type="BINDATA" /> </includes> </release> </grit>
diff --git a/chromeos/components/help_app_ui/resources/index.html b/chromeos/components/help_app_ui/resources/index.html index 478a8c1..58469fd 100644 --- a/chromeos/components/help_app_ui/resources/index.html +++ b/chromeos/components/help_app_ui/resources/index.html
@@ -25,8 +25,12 @@ </head> <body> <script src="chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js"></script> + <script src="/help_app.mojom-lite.js"></script> <script src="chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script> <script src="chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-lite.js"></script> - <script src="/browser_proxy.js" type="module"></script> + <script src="/local_search_service_types.mojom-lite.js"></script> + <script src="/local_search_service_index.mojom-lite.js"></script> + <script src="/help_app_search.mojom-lite.js"></script> + <script src="/help_app_index_scripts.js"></script> </body> </html>
diff --git a/chromeos/components/help_app_ui/resources/message_types.js b/chromeos/components/help_app_ui/resources/message_types.js index 0778de7..742fd72f 100644 --- a/chromeos/components/help_app_ui/resources/message_types.js +++ b/chromeos/components/help_app_ui/resources/message_types.js
@@ -11,7 +11,7 @@ * Enum for message types. * @enum {string} */ -export const Message = { +const Message = { OPEN_FEEDBACK_DIALOG: 'open-feedback-dialog', SHOW_PARENTAL_CONTROLS: 'show-parental-controls', ADD_OR_UPDATE_SEARCH_INDEX: 'add-or-update-search-index',
diff --git a/chromeos/components/help_app_ui/resources/receiver.js b/chromeos/components/help_app_ui/resources/receiver.js index ce22984..b5253791 100644 --- a/chromeos/components/help_app_ui/resources/receiver.js +++ b/chromeos/components/help_app_ui/resources/receiver.js
@@ -6,10 +6,6 @@ * @fileoverview * A script for the app inside the iframe. Implements a delegate. */ -import './sandboxed_load_time_data.js'; - -import {MessagePipe} from './message_pipe.m.js'; -import {Message} from './message_types.js'; /** A pipe through which we can send messages to the parent frame. */ const parentMessagePipe = new MessagePipe('chrome://help-app', window.parent); @@ -72,5 +68,3 @@ window.customLaunchData = { delegate: DELEGATE, }; - -export const TEST_ONLY = {parentMessagePipe};
diff --git a/chromeos/components/help_app_ui/test/driver.js b/chromeos/components/help_app_ui/test/driver.js index 138aae51..fcb35f60 100644 --- a/chromeos/components/help_app_ui/test/driver.js +++ b/chromeos/components/help_app_ui/test/driver.js
@@ -1,28 +1,26 @@ // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + // TODO(b/169279800): Pull out test code that media app and help app have in // common. -// Note we can only import from 'browser_proxy.js': other modules are rolled-up -// into it, and already loaded. -import {TEST_ONLY} from './browser_proxy.js'; -const {guestMessagePipe} = TEST_ONLY; - /** * Promise that signals the guest is ready to receive test messages (in addition * to messages handled by receiver.js). * @type {!Promise<undefined>} */ const testMessageHandlersReady = new Promise(resolve => { - guestMessagePipe.registerHandler('test-handlers-ready', resolve); + window.addEventListener('DOMContentLoaded', () => { + guestMessagePipe.registerHandler('test-handlers-ready', resolve); + }); }); /** * Runs the given `testCase` in the guest context. * @param {string} testCase */ -export async function runTestInGuest(testCase) { +async function runTestInGuest(testCase) { /** @type {!TestMessageRunTestCase} */ const message = {testCase}; await testMessageHandlersReady;
diff --git a/chromeos/components/help_app_ui/test/guest_query_receiver.js b/chromeos/components/help_app_ui/test/guest_query_receiver.js index 5e0de6a..58b93f7 100644 --- a/chromeos/components/help_app_ui/test/guest_query_receiver.js +++ b/chromeos/components/help_app_ui/test/guest_query_receiver.js
@@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {TEST_ONLY} from './receiver.js'; - -const {parentMessagePipe} = TEST_ONLY; - /** * Test cases registered by GUEST_TEST. * @type {!Map<string, function(): Promise<undefined>>} @@ -32,7 +28,7 @@ * @param {!string} testName * @param {!function(): Promise<undefined>} testCase */ -export function GUEST_TEST(testName, testCase) { +function GUEST_TEST(testName, testCase) { guestTestCases.set(testName, testCase); } @@ -45,23 +41,18 @@ */ async function signalTestHandlersReady() { const EXPECTED_ERROR = - /No handler registered for message type 'test-handlers-ready'/; - // Attempt to signal to the driver that we are ready to run tests, give up - // after 10 tries and assume something went wrong so we don't spam the error - // log too much. - let attempts = 10; - while (--attempts >= 0) { + `No handler registered for message type 'test-handlers-ready'`; + while (true) { try { await parentMessagePipe.sendMessage('test-handlers-ready', {}); return; } catch (/** @type {!GenericErrorResponse} */ e) { - if (!EXPECTED_ERROR.test(e.message)) { + if (e.message !== EXPECTED_ERROR) { console.error('Unexpected error in signalTestHandlersReady', e); return; } } } - console.error('signalTestHandlersReady failed to signal.'); } /** Installs the MessagePipe handlers for receiving test queries. */ @@ -89,3 +80,5 @@ } else { installTestHandlers(); } + +//# sourceURL=guest_query_receiver.js
diff --git a/chromeos/components/help_app_ui/test/help_app_guest_ui_browsertest.js b/chromeos/components/help_app_ui/test/help_app_guest_ui_browsertest.js index 6e39cff0..c3e51ff1 100644 --- a/chromeos/components/help_app_ui/test/help_app_guest_ui_browsertest.js +++ b/chromeos/components/help_app_ui/test/help_app_guest_ui_browsertest.js
@@ -4,8 +4,6 @@ /** @fileoverview Test suite for chrome-untrusted://help-app. */ -import {GUEST_TEST} from './guest_query_receiver.js'; - // Test that language is set correctly on the guest frame. GUEST_TEST('GuestHasLang', () => { assertEquals(document.documentElement.lang, 'en-US'); @@ -25,9 +23,7 @@ // 'Chrome' appears in the mock app's fake search results, and should appear // in the real app's search results. const response = await delegate.findInSearchIndex('Chrome'); - if (response && response.results && response.results.length > 0) { - break; - } + if (response && response.results && response.results.length > 0) break; await new Promise(resolve => {setTimeout(resolve, 50)}); } return delegate; @@ -38,37 +34,33 @@ GUEST_TEST('GuestCanSearchWithHeadings', async () => { const delegate = await waitForInitialIndexUpdate(); - await delegate.addOrUpdateSearchIndex([ - { - // Title match. No subheadings. - id: 'test-id-1', - title: 'Title with verycomplicatedsearchtoken', - body: 'Body text', - mainCategoryName: 'Help', - locale: 'en-US', - }, - { - // Subheading match. - id: 'test-id-2', - title: 'Title 2', - subheadings: [ - 'Subheading 1', - 'verycomplicatedsearchtoken in subheading. Verycomplicatedsearchtoken', - 'Another subheading with verycomplicatedsearchtoken', - ], - body: 'Body text', - mainCategoryName: 'Help', - locale: 'en-US', - }, - { - // Should not appear in the results. - id: 'test-id-3', - title: 'Title of irrelevant article', - body: 'Body text', - mainCategoryName: 'Help', - locale: 'en-US', - } - ]); + await delegate.addOrUpdateSearchIndex([{ + // Title match. No subheadings. + id: 'test-id-1', + title: 'Title with verycomplicatedsearchtoken', + body: 'Body text', + mainCategoryName: 'Help', + locale: 'en-US', + },{ + // Subheading match. + id: 'test-id-2', + title: 'Title 2', + subheadings: [ + 'Subheading 1', + 'verycomplicatedsearchtoken in subheading. Verycomplicatedsearchtoken', + 'Another subheading with verycomplicatedsearchtoken', + ], + body: 'Body text', + mainCategoryName: 'Help', + locale: 'en-US', + },{ + // Should not appear in the results. + id: 'test-id-3', + title: 'Title of irrelevant article', + body: 'Body text', + mainCategoryName: 'Help', + locale: 'en-US', + }]); // Keep polling until the index finishes updating or too much time has passed. /** @type {?helpApp.FindResponse} */ @@ -77,9 +69,7 @@ // This search query was chosen because it is unlikely to show any search // results for the real app's data. response = await delegate.findInSearchIndex('verycomplicatedsearchtoken'); - if (response && response.results && response.results.length > 0) { - break; - } + if (response && response.results && response.results.length > 0) break; await new Promise(resolve => {setTimeout(resolve, 50)}); } @@ -112,37 +102,33 @@ GUEST_TEST('GuestCanSearchWithCategories', async () => { const delegate = await waitForInitialIndexUpdate(); - await delegate.addOrUpdateSearchIndex([ - { - // Main category match. No subcategories. - id: 'test-id-1', - title: 'Title with of article', - body: 'Body text', - mainCategoryName: 'Verycomplicatedsearchtoken', - locale: 'en-US', - }, - { - // Subcategory match. - id: 'test-id-2', - title: 'Title 2', - subcategoryNames: [ - 'Subcategory 1', - 'verycomplicatedsearchtoken in subcategory. Verycomplicatedsearchtoken', - 'Another subcategory with verycomplicatedsearchtoken', - ], - body: 'Body text', - mainCategoryName: 'Help', - locale: 'en-US', - }, - { - // Should not appear in the results. - id: 'test-id-3', - title: 'Title of irrelevant article', - body: 'Body text', - mainCategoryName: 'Help', - locale: 'en-US', - } - ]); + await delegate.addOrUpdateSearchIndex([{ + // Main category match. No subcategories. + id: 'test-id-1', + title: 'Title with of article', + body: 'Body text', + mainCategoryName: 'Verycomplicatedsearchtoken', + locale: 'en-US', + },{ + // Subcategory match. + id: 'test-id-2', + title: 'Title 2', + subcategoryNames: [ + 'Subcategory 1', + 'verycomplicatedsearchtoken in subcategory. Verycomplicatedsearchtoken', + 'Another subcategory with verycomplicatedsearchtoken', + ], + body: 'Body text', + mainCategoryName: 'Help', + locale: 'en-US', + },{ + // Should not appear in the results. + id: 'test-id-3', + title: 'Title of irrelevant article', + body: 'Body text', + mainCategoryName: 'Help', + locale: 'en-US', + }]); // Keep polling until the index finishes updating or too much time has passed. /** @type {?helpApp.FindResponse} */ @@ -151,32 +137,30 @@ // This search query was chosen because it is unlikely to show any search // results for the real app's data. response = await delegate.findInSearchIndex('verycomplicatedsearchtoken'); - if (response && response.results && response.results.length > 0) { - break; - } + if (response && response.results && response.results.length > 0) break; await new Promise(resolve => {setTimeout(resolve, 50)}); } // Don't test the ordering of search results because they should have similar // relevance. chai.expect(response.results).to.have.deep.members([ - // This result only matches on the main category. - { - id: 'test-id-1', - titlePositions: [], - subheadingIndex: null, - subheadingPositions: null, - bodyPositions: [], - }, - // This result only matches on the second and third subcategories. - { - id: 'test-id-2', - titlePositions: [], - subheadingIndex: null, - subheadingPositions: null, - bodyPositions: [], - }, - ]); + // This result only matches on the main category. + { + id: 'test-id-1', + titlePositions: [], + subheadingIndex: null, + subheadingPositions: null, + bodyPositions: [], + }, + // This result only matches on the second and third subcategories. + { + id: 'test-id-2', + titlePositions: [], + subheadingIndex: null, + subheadingPositions: null, + bodyPositions: [], + }, + ]); }); // Test that the guest frame can clear the search index.
diff --git a/chromeos/components/help_app_ui/test/help_app_ui_browsertest.cc b/chromeos/components/help_app_ui/test/help_app_ui_browsertest.cc index 9b0fe03..81d6a954 100644 --- a/chromeos/components/help_app_ui/test/help_app_ui_browsertest.cc +++ b/chromeos/components/help_app_ui/test/help_app_ui_browsertest.cc
@@ -5,37 +5,20 @@ #include "chromeos/components/help_app_ui/test/help_app_ui_browsertest.h" #include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/memory/ref_counted_memory.h" -#include "base/path_service.h" -#include "chromeos/components/help_app_ui/help_app_ui.h" #include "chromeos/components/help_app_ui/url_constants.h" #include "chromeos/components/web_applications/test/sandboxed_web_ui_test_base.h" -// Path to test files loaded via the TestFileRequestFilter. -constexpr base::FilePath::CharType kTestFileLocation[] = - FILE_PATH_LITERAL("chromeos/components/help_app_ui/test"); +constexpr base::FilePath::CharType kHelpAppGuestTestApi[] = FILE_PATH_LITERAL( + "chromeos/components/help_app_ui/test/guest_query_receiver.js"); // Test cases that run in the guest context. -constexpr char kGuestTestCases[] = "help_app_guest_ui_browsertest.js"; - -// Paths requested on the media-app origin that should be delivered by the test -// handler. -constexpr const char* kTestFiles[] = { - kGuestTestCases, - "help_app_ui_browsertest.js", - "driver.js", - "guest_query_receiver.js", -}; +constexpr base::FilePath::CharType kGuestTestCases[] = FILE_PATH_LITERAL( + "chromeos/components/help_app_ui/test/help_app_guest_ui_browsertest.js"); HelpAppUiBrowserTest::HelpAppUiBrowserTest() : SandboxedWebUiAppTestBase(chromeos::kChromeUIHelpAppURL, chromeos::kChromeUIHelpAppUntrustedURL, - {}, - kGuestTestCases) { - ConfigureDefaultTestRequestHandler( - base::FilePath(kTestFileLocation), - {std::begin(kTestFiles), std::end(kTestFiles)}); -} + {base::FilePath(kHelpAppGuestTestApi), + base::FilePath(kGuestTestCases)}) {} HelpAppUiBrowserTest::~HelpAppUiBrowserTest() = default;
diff --git a/chromeos/components/help_app_ui/test/help_app_ui_browsertest.js b/chromeos/components/help_app_ui/test/help_app_ui_browsertest.js index f9885a1..53be207 100644 --- a/chromeos/components/help_app_ui/test/help_app_ui_browsertest.js +++ b/chromeos/components/help_app_ui/test/help_app_ui_browsertest.js
@@ -3,41 +3,93 @@ // found in the LICENSE file. /** - * @fileoverview Test suite for chrome://help-app. The tests are actually - * invoked in help_app_ui_gtest_browsertest.js, this file simply packages up - * each tests logic into a single object that file can import. - * - * To add a new test to this file, add the test function to - * `HelpAppUIBrowserTest` and then invoke in in gtest_browsertest.js. + * @fileoverview Test suite for chrome://help-app. */ -import {runTestInGuest} from './driver.js'; -const GUEST_ORIGIN = 'chrome-untrusted://help-app'; +GEN('#include "chromeos/components/help_app_ui/test/help_app_ui_browsertest.h"'); -/** @struct */ -const HelpAppUIBrowserTest = { - /** - * Expose the runTestInGuest function to help_app_ui_gtest_browsertest.js so - * it can call it. - * @type function(string): !Promise<undefined> - */ - runTestInGuest, +GEN('#include "ash/constants/ash_features.h"'); +GEN('#include "content/public/test/browser_test.h"'); + +const HOST_ORIGIN = 'chrome://help-app'; + +var HelpAppUIBrowserTest = class extends testing.Test { + /** @override */ + get browsePreload() { + return HOST_ORIGIN; + } + + /** @override */ + get extraLibraries() { + return [ + ...super.extraLibraries, + '//chromeos/components/help_app_ui/test/driver.js', + '//ui/webui/resources/js/assert.js', + ]; + } + + /** @override */ + get isAsync() { + return true; + } + + /** @override */ + get featureList() { + return { + enabled: [ + 'chromeos::features::kHelpAppLauncherSearch', + 'chromeos::features::kHelpAppSearchServiceIntegration', + ] + }; + } + + /** @override */ + get typedefCppFixture() { + return 'HelpAppUiBrowserTest'; + } + + /** @override */ + get runAccessibilityChecks() { + return false; + } }; -// Expose an old-style export for js2gtest. -window['HelpAppUIBrowserTest_for_js2gtest'] = HelpAppUIBrowserTest; - // Tests that chrome://help-app goes somewhere instead of 404ing or crashing. -HelpAppUIBrowserTest.HasChromeSchemeURL = () => { - const guest = - /** @type {!HTMLIFrameElement} */ (document.querySelector('iframe')); +TEST_F('HelpAppUIBrowserTest', 'HasChromeSchemeURL', () => { + const guest = /** @type {!HTMLIFrameElement} */ ( + document.querySelector('iframe')); assertEquals(document.location.origin, HOST_ORIGIN); assertEquals(guest.src, GUEST_ORIGIN + '/'); -}; + testDone(); +}); -// Tests that we have localized information in the HTML like title and lang. -HelpAppUIBrowserTest.HasTitleAndLang = () => { +// Tests that we have localised information in the HTML like title and lang. +TEST_F('HelpAppUIBrowserTest', 'HasTitleAndLang', () => { assertEquals(document.documentElement.lang, 'en'); assertEquals(document.title, 'Explore'); -}; + testDone(); +}); + +// Test cases injected into the guest context. +// See implementations in help_app_guest_ui_browsertest.js. + +TEST_F('HelpAppUIBrowserTest', 'GuestHasLang', async () => { + await runTestInGuest('GuestHasLang'); + testDone(); +}); + +TEST_F('HelpAppUIBrowserTest', 'GuestCanSearchWithHeadings', async () => { + await runTestInGuest('GuestCanSearchWithHeadings'); + testDone(); +}); + +TEST_F('HelpAppUIBrowserTest', 'GuestCanSearchWithCategories', async () => { + await runTestInGuest('GuestCanSearchWithCategories'); + testDone(); +}); + +TEST_F('HelpAppUIBrowserTest', 'GuestCanClearSearchIndex', async () => { + await runTestInGuest('GuestCanClearSearchIndex'); + testDone(); +});
diff --git a/chromeos/components/help_app_ui/test/help_app_ui_gtest_browsertest.js b/chromeos/components/help_app_ui/test/help_app_ui_gtest_browsertest.js deleted file mode 100644 index e7eb9f9..0000000 --- a/chromeos/components/help_app_ui/test/help_app_ui_gtest_browsertest.js +++ /dev/null
@@ -1,142 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview js2gtest wrapper for the chrome://help-app test suite. Actual - * test implementations live in help_app_ui_browsertest.js and - * help_app_guest_ui_browsertest.js. - */ -GEN('#include "chromeos/components/help_app_ui/test/help_app_ui_browsertest.h"'); - -GEN('#include "ash/constants/ash_features.h"'); -GEN('#include "content/public/test/browser_test.h"'); - -const HOST_ORIGIN = 'chrome://help-app'; - -// js2gtest fixtures require var here (https://crbug.com/1033337). -// eslint-disable-next-line no-var -var HelpAppUIGtestBrowserTest = class extends testing.Test { - /** @override */ - get browsePreload() { - return HOST_ORIGIN; - } - - /** @override */ - get isAsync() { - return true; - } - - /** @override */ - get featureList() { - return { - enabled: [ - 'chromeos::features::kHelpAppLauncherSearch', - 'chromeos::features::kHelpAppSearchServiceIntegration', - ] - }; - } - - /** @override */ - get typedefCppFixture() { - return 'HelpAppUiBrowserTest'; - } - - /** @override */ - get runAccessibilityChecks() { - return false; - } -}; - -async function GetTestHarness() { - const testHarnessPolicy = trustedTypes.createPolicy('test-harness', { - createScriptURL: () => './help_app_ui_browsertest.js', - }); - - const tests = - /** @type {!HTMLScriptElement} */ (document.createElement('script')); - tests.src = testHarnessPolicy.createScriptURL(''); - tests.type = 'module'; - await new Promise((resolve, reject) => { - tests.onload = resolve; - tests.onerror = reject; - document.body.appendChild(tests); - }); - - // When help_app_ui_browsertest.js loads, it will add this onto the window. - return window['HelpAppUIBrowserTest_for_js2gtest']; -} - -/** - * Small helper to run the `name` test function on the `HelpAppUIBrowserTest` - * object we get from `help_app_ui_browsertest.js`. - */ -async function runHelpAppTest(name, guest = false) { - const HelpAppUIBrowserTest = await GetTestHarness(); - try { - if (guest) { - await HelpAppUIBrowserTest.runTestInGuest(name); - } else { - await HelpAppUIBrowserTest[name](); - } - testDone(); - } catch (/* @type {Error} */ error) { - let message = 'exception'; - if (typeof error === 'object' && error !== null && error['message']) { - message = error['message']; - console.log(error['stack']); - } else { - console.log(error); - } - /** @type {function(*)} */ (testDone)([false, message]); - } -} - -function runHelpAppTestInGuest(name) { - return runHelpAppTest(name, true); -} - -// Ensure every test body has a `TEST_F` call in this file. -TEST_F('HelpAppUIGtestBrowserTest', 'ConsistencyCheck', async () => { - const HelpAppUIBrowserTest = await GetTestHarness(); - const bodies = - /** @type {{testCaseBodies: Object}} */ (HelpAppUIGtestBrowserTest) - .testCaseBodies; - for (const f in HelpAppUIBrowserTest) { - if (f === 'runTestInGuest') { - continue; - } - if (!(f in bodies || `DISABLED_${f}` in bodies)) { - console.error( - `HelpAppUIBrowserTest.${f} is missing a TEST_F and will not be run.`); - } - } - testDone(); -}); - -TEST_F('HelpAppUIGtestBrowserTest', 'HasChromeSchemeURL', () => { - runHelpAppTest('HasChromeSchemeURL'); -}); - -TEST_F('HelpAppUIGtestBrowserTest', 'HasTitleAndLang', () => { - runHelpAppTest('HasTitleAndLang'); -}); - -// Test cases injected into the guest context. -// See implementations in `help_app_guest_ui_browsertest.js`. - -TEST_F('HelpAppUIGtestBrowserTest', 'GuestHasLang', () => { - runHelpAppTestInGuest('GuestHasLang'); -}); - -TEST_F('HelpAppUIGtestBrowserTest', 'GuestCanSearchWithHeadings', () => { - runHelpAppTestInGuest('GuestCanSearchWithHeadings'); -}); - -TEST_F('HelpAppUIGtestBrowserTest', 'GuestCanSearchWithCategories', () => { - runHelpAppTestInGuest('GuestCanSearchWithCategories'); -}); - -TEST_F('HelpAppUIGtestBrowserTest', 'GuestCanClearSearchIndex', () => { - runHelpAppTestInGuest('GuestCanClearSearchIndex'); -});
diff --git a/chromeos/components/media_app_ui/resources/js/BUILD.gn b/chromeos/components/media_app_ui/resources/js/BUILD.gn index 8e34314..f10bd76 100644 --- a/chromeos/components/media_app_ui/resources/js/BUILD.gn +++ b/chromeos/components/media_app_ui/resources/js/BUILD.gn
@@ -15,7 +15,6 @@ copy("stage_static") { sources = [ "../../../../../ui/file_manager/image_loader/piex_loader.js", - "//chromeos/components/system_apps/public/js/sandboxed_load_time_data.js", "app_context_test_support.js", "error_reporter.js", "launch.js", @@ -23,6 +22,7 @@ "piex_module.js", "piex_module_loader.js", "receiver.js", + "sandboxed_load_time_data.js", ] outputs = [ stage_folder + "/{{source_file_part}}" ] } @@ -158,14 +158,17 @@ deps = [ "//ui/file_manager/image_loader:piex_loader" ] } +js_library("sandboxed_load_time_data") { +} + js_library("receiver") { externs_list = [ "media_app.externs.js" ] deps = [ ":app_context_test_support", ":message_types.m", ":piex_module_loader", + ":sandboxed_load_time_data", "//chromeos/components/system_apps/public/js:message_pipe.m", - "//chromeos/components/system_apps/public/js:sandboxed_load_time_data", ] }
diff --git a/chromeos/components/system_apps/public/js/sandboxed_load_time_data.js b/chromeos/components/media_app_ui/resources/js/sandboxed_load_time_data.js similarity index 67% rename from chromeos/components/system_apps/public/js/sandboxed_load_time_data.js rename to chromeos/components/media_app_ui/resources/js/sandboxed_load_time_data.js index b1cb2d5..101a94e 100644 --- a/chromeos/components/system_apps/public/js/sandboxed_load_time_data.js +++ b/chromeos/components/media_app_ui/resources/js/sandboxed_load_time_data.js
@@ -5,11 +5,10 @@ /** * @fileoverview Minimal version of load_time_data.js for chrome-untrusted:// * origins. They are sandboxed, so cannot use chrome://resources ("unable to - * load local resource") which load_time_data.js relies on through strings.js. - * Since we don't want to maintain a "mirror" of all the module dependencies on - * each chrome-untrusted:// origin. For simplicity, this version lacks all the - * validation done by load_time_data.js, and just aims to provide a compatible - * API. + * load local resource") and we don't want to maintain a "mirror" of all the + * module dependencies on each chrome-untrusted:// origin. For simplicity, this + * version lacks all the validation done by load_time_data.js, and just aims to + * provide a compatible API. */ const impl = {
diff --git a/chromeos/components/quick_pair/BUILD.gn b/chromeos/components/quick_pair/BUILD.gn deleted file mode 100644 index 57892b83..0000000 --- a/chromeos/components/quick_pair/BUILD.gn +++ /dev/null
@@ -1,18 +0,0 @@ -# Copyright 2021 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") - -source_set("unit_tests") { - testonly = true - - deps = [ - "//base/test:test_support", - "//chromeos/components/quick_pair/common:unit_tests", - "//chromeos/components/quick_pair/feature_status_tracker:unit_tests", - "//chromeos/components/quick_pair/keyed_service:unit_tests", - "//chromeos/components/quick_pair/scanning:unit_tests", - "//testing/gtest", - ] -}
diff --git a/chromeos/components/quick_pair/common/quick_pair_features.h b/chromeos/components/quick_pair/common/quick_pair_features.h deleted file mode 100644 index 03d0bbe..0000000 --- a/chromeos/components/quick_pair/common/quick_pair_features.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_ - -#include "base/feature_list.h" - -namespace chromeos { -namespace features { - -extern const base::Feature kFastPair; - -} // namespace features -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_COMMON_QUICK_PAIR_FEATURES_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h b/chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h deleted file mode 100644 index 6216a4f..0000000 --- a/chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_ - -#include "chromeos/components/quick_pair/feature_status_tracker/base_enabled_provider.h" - -namespace chromeos { -namespace quick_pair { - -// Exposes whether Google API keys are available on the current build. Since -// this cannot be changed at runtime, there is no need to register an observer. -class GoogleApiKeyAvailabilityProvider : public BaseEnabledProvider { - public: - GoogleApiKeyAvailabilityProvider(); - ~GoogleApiKeyAvailabilityProvider() override; -}; - -} // namespace quick_pair -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_GOOGLE_API_KEY_AVAILABILITY_PROVIDER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc b/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc deleted file mode 100644 index f3ff3bfd..0000000 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.cc +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h" - -namespace chromeos { -namespace quick_pair { - -MockFeatureStatusTracker::MockFeatureStatusTracker() = - default; - -MockFeatureStatusTracker::~MockFeatureStatusTracker() = - default; - -} // namespace quick_pair -} // namespace chromeos
diff --git a/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h b/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h deleted file mode 100644 index e2675300..0000000 --- a/chromeos/components/quick_pair/feature_status_tracker/mock_quick_pair_feature_status_tracker.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ -#define CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_ - -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace chromeos { -namespace quick_pair { - -class MockFeatureStatusTracker : public FeatureStatusTracker { - public: - MockFeatureStatusTracker(); - MockFeatureStatusTracker(const MockFeatureStatusTracker&) = - delete; - MockFeatureStatusTracker& operator=( - const MockFeatureStatusTracker&) = delete; - ~MockFeatureStatusTracker() override; - - MOCK_METHOD(void, - AddObserver, - (FeatureStatusTracker::Observer*), - (override)); - - MOCK_METHOD(void, - RemoveObserver, - (FeatureStatusTracker::Observer*), - (override)); - - MOCK_METHOD(bool, IsFastPairEnabled, (), (override)); -}; - -} // namespace quick_pair -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_QUICK_PAIR_FEATURE_STATUS_TRACKER_MOCK_QUICK_PAIR_FEATURE_STATUS_TRACKER_H_
diff --git a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc b/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc deleted file mode 100644 index aed37be..0000000 --- a/chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.cc +++ /dev/null
@@ -1,49 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/quick_pair/feature_status_tracker/quick_pair_feature_status_tracker_impl.h" - -#include <memory> - -#include "base/bind.h" -#include "chromeos/components/quick_pair/feature_status_tracker/bluetooth_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/fast_pair_enabled_provider.h" -#include "chromeos/components/quick_pair/feature_status_tracker/google_api_key_availability_provider.h" - -namespace chromeos { -namespace quick_pair { - -FeatureStatusTrackerImpl::FeatureStatusTrackerImpl() - : fast_pair_enabled_provider_(std::make_unique<FastPairEnabledProvider>( - std::make_unique<BluetoothEnabledProvider>(), - std::make_unique<GoogleApiKeyAvailabilityProvider>())) { - fast_pair_enabled_provider_->SetCallback(base::BindRepeating( - &FeatureStatusTrackerImpl::OnFastPairEnabledChanged, - weak_factory_.GetWeakPtr())); -} - -FeatureStatusTrackerImpl::~FeatureStatusTrackerImpl() = - default; - -void FeatureStatusTrackerImpl::AddObserver(Observer* observer) { - observers_.AddObserver(observer); -} - -void FeatureStatusTrackerImpl::RemoveObserver(Observer* observer) { - observers_.RemoveObserver(observer); -} - -bool FeatureStatusTrackerImpl::IsFastPairEnabled() { - return fast_pair_enabled_provider_->is_enabled(); -} - -void FeatureStatusTrackerImpl::OnFastPairEnabledChanged( - bool is_enabled) { - for (auto& observer : observers_) { - observer.OnFastPairEnabledChanged(is_enabled); - } -} - -} // namespace quick_pair -} // namespace chromeos
diff --git a/chromeos/components/quick_pair/scanning/BUILD.gn b/chromeos/components/quick_pair/scanning/BUILD.gn deleted file mode 100644 index cea9321..0000000 --- a/chromeos/components/quick_pair/scanning/BUILD.gn +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2021 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") - -source_set("scanning") { - sources = [ - "scanner_broker.h", - "scanner_broker_impl.cc", - "scanner_broker_impl.h", - ] - - deps = [ - "//base", - "//chromeos/components/quick_pair/common", - ] -} - -source_set("unit_tests") { - testonly = true - - deps = [ - "//chromeos/components/quick_pair/scanning/fast_pair:unit_tests", - "//testing/gtest", - ] -}
diff --git a/chromeos/components/quick_pair/scanning/fast_pair/BUILD.gn b/chromeos/components/quick_pair/scanning/fast_pair/BUILD.gn deleted file mode 100644 index 8edad25..0000000 --- a/chromeos/components/quick_pair/scanning/fast_pair/BUILD.gn +++ /dev/null
@@ -1,31 +0,0 @@ -# Copyright 2021 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_chromeos, "Quick Pair protocols (e.g. Fast Pair) are CrOS only") - -static_library("fast_pair_scanner") { - sources = [ - "fast_pair_scanner.h", - "fast_pair_scanner_impl.cc", - "fast_pair_scanner_impl.h", - ] - - deps = [ - "//base", - "//device/bluetooth", - ] -} - -source_set("unit_tests") { - testonly = true - sources = [ "fast_pair_scanner_unittest.cc" ] - - deps = [ - ":fast_pair_scanner", - "//base/test:test_support", - "//device/bluetooth", - "//device/bluetooth:mocks", - "//testing/gtest", - ] -}
diff --git a/chromeos/components/system_apps/public/js/BUILD.gn b/chromeos/components/system_apps/public/js/BUILD.gn index cc31c353..b246675 100644 --- a/chromeos/components/system_apps/public/js/BUILD.gn +++ b/chromeos/components/system_apps/public/js/BUILD.gn
@@ -10,9 +10,6 @@ js_library("message_pipe") { } -js_library("sandboxed_load_time_data") { -} - js_library("message_pipe.m") { sources = [ "$root_gen_dir/chromeos/components/system_apps/public/js/message_pipe.m.js",
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc index d531b15..9291094 100644 --- a/chromeos/dbus/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks_client.cc
@@ -146,6 +146,15 @@ return true; } +void MaybeGetStringFromDictionaryValue(const base::Value& dict, + const char* key, + std::string* result) { + DCHECK(dict.is_dict()); + const std::string* value = dict.FindStringKey(key); + if (value) + *result = *value; +} + // The CrosDisksClient implementation. class CrosDisksClientImpl : public CrosDisksClient { public: @@ -726,23 +735,24 @@ .value_or(is_virtual_); is_auto_mountable_ = properties->FindBoolKey(cros_disks::kIsAutoMountable) .value_or(is_auto_mountable_); - properties->GetStringWithoutPathExpansion(cros_disks::kStorageDevicePath, - &storage_device_path_); - properties->GetStringWithoutPathExpansion( - cros_disks::kDeviceFile, &file_path_); - properties->GetStringWithoutPathExpansion(cros_disks::kVendorId, &vendor_id_); - properties->GetStringWithoutPathExpansion( - cros_disks::kVendorName, &vendor_name_); - properties->GetStringWithoutPathExpansion( - cros_disks::kProductId, &product_id_); - properties->GetStringWithoutPathExpansion( - cros_disks::kProductName, &product_name_); - properties->GetStringWithoutPathExpansion( - cros_disks::kDriveModel, &drive_model_); - properties->GetStringWithoutPathExpansion(cros_disks::kIdLabel, &label_); - properties->GetStringWithoutPathExpansion(cros_disks::kIdUuid, &uuid_); - properties->GetStringWithoutPathExpansion(cros_disks::kFileSystemType, - &file_system_type_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kStorageDevicePath, + &storage_device_path_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kDeviceFile, + &file_path_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kVendorId, + &vendor_id_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kVendorName, + &vendor_name_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kProductId, + &product_id_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kProductName, + &product_name_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kDriveModel, + &drive_model_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kIdLabel, &label_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kIdUuid, &uuid_); + MaybeGetStringFromDictionaryValue(*properties, cros_disks::kFileSystemType, + &file_system_type_); bus_number_ = properties->FindIntKey(cros_disks::kBusNumber).value_or(bus_number_);
diff --git a/chromeos/geolocation/simple_geolocation_request.cc b/chromeos/geolocation/simple_geolocation_request.cc index 82dad13d..adda7e7 100644 --- a/chromeos/geolocation/simple_geolocation_request.cc +++ b/chromeos/geolocation/simple_geolocation_request.cc
@@ -225,9 +225,11 @@ position->timestamp = base::Time::Now(); if (error_object) { - if (!error_object->GetStringWithoutPathExpansion( - kMessageString, &(position->error_message))) { + std::string* error_message = error_object->FindStringKey(kMessageString); + if (!error_message) { position->error_message = "Server returned error without message."; + } else { + position->error_message = *error_message; } // Ignore result (code defaults to zero).
diff --git a/chromeos/resources/BUILD.gn b/chromeos/resources/BUILD.gn index 1d48c2fe..9e081af 100644 --- a/chromeos/resources/BUILD.gn +++ b/chromeos/resources/BUILD.gn
@@ -144,8 +144,6 @@ deps = [ "//chromeos/components/help_app_ui:mojo_bindings_js", - "//chromeos/components/help_app_ui/resources:browser_proxy_rollup", - "//chromeos/components/help_app_ui/resources:receiver_rollup", "//chromeos/components/help_app_ui/search:mojo_bindings_js", "//chromeos/components/local_search_service/public/mojom:mojom_js", ]
diff --git a/chromeos/strings/chromeos_strings_fil.xtb b/chromeos/strings/chromeos_strings_fil.xtb index eeba238..8ddc737 100644 --- a/chromeos/strings/chromeos_strings_fil.xtb +++ b/chromeos/strings/chromeos_strings_fil.xtb
@@ -32,6 +32,7 @@ <translation id="1499900233129743732">Pinapamahalaan ng <ph name="MANAGER" /> ang user na ito at puwede nitong pamahalaan ang mga setting at subaybayan ang aktibidad ng user sa remote na paraan.</translation> <translation id="150962533380566081">Di-wasto ang PUK.</translation> <translation id="1510238584712386396">Launcher</translation> +<translation id="1600964289716072707">Maglagay ng isa pang page sa scanner at piliin ang I-scan para idagdag ang page.</translation> <translation id="1621067168122174824">Patakbuhin ang pagsusuri sa Pag-charge</translation> <translation id="1641857168437328880">Document Feeder (Isang bahagi)</translation> <translation id="1644574205037202324">History</translation> @@ -285,6 +286,7 @@ <translation id="6766275201586212568">May mga hindi naisagawang pagresolba sa DNS</translation> <translation id="6768237774506518020">Mataas na rate ng hindi naisagawang pagresolba sa DNS</translation> <translation id="6853312040151791195">Rate ng Pag-discharge</translation> +<translation id="6905724422583748843">Bumalik sa <ph name="PAGE_NAME" /></translation> <translation id="6910312834584889076">Nakabukas ang takip ng scanner. Isara ang takip at subukan ulit.</translation> <translation id="6911383237894364323">Hindi makakonekta sa mga media server</translation> <translation id="6957231940976260713">Pangalan ng serbisyo</translation> @@ -329,6 +331,7 @@ <translation id="7769672763586021400">Model ID</translation> <translation id="7805768142964895445">Katayuan</translation> <translation id="7819857487979277519">PSK (WPA o RSN)</translation> +<translation id="7835501727204647447">I-install ang CloudReady</translation> <translation id="7881066108824108340">DNS</translation> <translation id="7882358943899516840">Uri ng provider</translation> <translation id="7936303884198020182">Walang nakitang name server</translation>
diff --git a/chromeos/strings/chromeos_strings_km.xtb b/chromeos/strings/chromeos_strings_km.xtb index f86e45d..256170c 100644 --- a/chromeos/strings/chromeos_strings_km.xtb +++ b/chromeos/strings/chromeos_strings_km.xtb
@@ -76,6 +76,7 @@ <translation id="2620436844016719705">ប្រព័ន្ធ</translation> <translation id="2740531572673183784">យល់ព្រម</translation> <translation id="2751739896257479635">ការផ្ទៀងផ្ទាត់ EAP ដំណាក់កាលទី 2</translation> +<translation id="2783010256799387990">ជាប់</translation> <translation id="2789486458103222910">យល់ព្រម</translation> <translation id="2805756323405976993">កម្មវិធី</translation> <translation id="2862104018715411648">ដាក់ឯកសាររបស់អ្នកនៅលើម៉ាស៊ីនស្កេន រួចជ្រើសរើស "ស្កេន" ដើម្បីចាប់ផ្ដើម</translation> @@ -138,6 +139,7 @@ <translation id="4227825898293920515">ពាក្យសម្ងាត់ផុតកំណត់ក្នុងរយៈពេល <ph name="TIME" /></translation> <translation id="4238516577297848345">មិនមានកិច្ចការបោះពុម្ពកំពុងដំណើរការទេ</translation> <translation id="4297501883039923494">បានឈប់ - មានបញ្ហាដែលមិនស្គាល់</translation> +<translation id="4300073214558989">រូបភាព <ph name="IMAGE_COUNT" /></translation> <translation id="4378373042927530923">មិនដំណើរការទេ</translation> <translation id="4382484599443659549">PDF</translation> <translation id="4425149324548788773">ដ្រាយរបស់ខ្ញុំ</translation> @@ -295,6 +297,7 @@ <translation id="7144878232160441200">ព្យាយាមម្តងទៀត</translation> <translation id="714876143603641390">ការតភ្ជាប់ Lan</translation> <translation id="7162487448488904999">សាលរូបភាព</translation> +<translation id="7172721935181587524">រូបភាព 1</translation> <translation id="7177485034254901881"><ph name="DEVICE_TYPE" /> នេះស្ថិតក្រោមការគ្រប់គ្រងរបស់ <ph name="MANAGER" />។ អ្នកគ្រប់គ្រងអាចកំណត់រចនាសម្ព័ន្ធឧបករណ៍នេះពីចម្ងាយបាន។</translation> <translation id="7216409898977639127">ក្រុមហ៊ុនផ្តល់សេវាទូរសព្ទ</translation> <translation id="7271040990581020067">បច្ចុប្បន្ននេះ ម៉ាស៊ីនស្កេនកំពុងស្ថិតក្នុងការប្រើប្រាស់។ សូមព្យាយាមម្ដងទៀតនៅពេលក្រោយ។</translation> @@ -344,6 +347,7 @@ <translation id="8294431847097064396">ប្រភព</translation> <translation id="8297006494302853456">ខ្សោយ</translation> <translation id="8302368968391049045">ជញ្ជាំងភ្លើង HTTPS</translation> +<translation id="8318753676953949627">មិនមានរូបភាពទេ</translation> <translation id="8347227221149377169">ការងារបោះពុម្ព</translation> <translation id="8352772353338965963">បន្ថែមគណនីមួយដើម្បីចូលពីគណនីច្រើន។ គណនីដែលចូលទាំងអស់អាចចូលប្រើដោយគ្មានពាក្យសម្ងាត់ ដូច្នេះលក្ខណពិសេសនេះគួរត្រូវបានប្រើជាមួយគណនីដែលគួរជឿជាក់តែប៉ុណ្ណោះ។</translation> <translation id="8364946094152050673">DNS នៅទទេ</translation>
diff --git a/chromeos/strings/chromeos_strings_mn.xtb b/chromeos/strings/chromeos_strings_mn.xtb index 346d822..d2cc82f01 100644 --- a/chromeos/strings/chromeos_strings_mn.xtb +++ b/chromeos/strings/chromeos_strings_mn.xtb
@@ -32,6 +32,7 @@ <translation id="1499900233129743732"><ph name="MANAGER" /> энэ хэрэглэгчийг удирддаг бөгөөд алсаас тохиргоог удирдаж, хэрэглэгчийн үйл ажиллагааг хянаж болзошгүй.</translation> <translation id="150962533380566081">PUK буруу байна.</translation> <translation id="1510238584712386396">Launcher</translation> +<translation id="1600964289716072707">Хуудас нэмэхийн тулд сканнер дээр өөр хуудас байрлуулж, Скан хийхийг сонгоно уу.</translation> <translation id="1621067168122174824">Цэнэглэх туршилтыг ажиллуулах</translation> <translation id="1641857168437328880">Документыг дамжуулах тавиур (Нэг талаар нь)</translation> <translation id="1644574205037202324">Түүх</translation> @@ -285,6 +286,7 @@ <translation id="6766275201586212568">DNS-н тайлал амжилтгүй</translation> <translation id="6768237774506518020">DNS-н тайллын алдааны өндөр хувь</translation> <translation id="6853312040151791195">Цэнэггүй болох хурд</translation> +<translation id="6905724422583748843"><ph name="PAGE_NAME" /> руу буцах</translation> <translation id="6910312834584889076">Сканнерын таг нээлттэй байна. Тагийг хаагаад, дахин оролдоно уу.</translation> <translation id="6911383237894364323">Медиа серверт холбогдох боломжгүй</translation> <translation id="6957231940976260713">Үйлчилгээний нэр</translation> @@ -329,6 +331,7 @@ <translation id="7769672763586021400">Загварын ID</translation> <translation id="7805768142964895445">Байр байдал</translation> <translation id="7819857487979277519">PSK (WPA эсвэл RSN)</translation> +<translation id="7835501727204647447">CloudReady-г суулгах</translation> <translation id="7881066108824108340">DNS</translation> <translation id="7882358943899516840">Нийлүүлэгчийн төрөл</translation> <translation id="7936303884198020182">DNS олдсонгүй</translation>
diff --git a/chromeos/strings/chromeos_strings_pa.xtb b/chromeos/strings/chromeos_strings_pa.xtb index 30059b27..9667959 100644 --- a/chromeos/strings/chromeos_strings_pa.xtb +++ b/chromeos/strings/chromeos_strings_pa.xtb
@@ -76,6 +76,7 @@ <translation id="2620436844016719705">ਸਿਸਟਮ</translation> <translation id="2740531572673183784">ਠੀਕ</translation> <translation id="2751739896257479635">EAP ਫੇਜ਼ 2 ਪ੍ਰਮਾਣੀਕਰਨ</translation> +<translation id="2783010256799387990">ਪਾਸ ਕੀਤਾ</translation> <translation id="2789486458103222910">ਠੀਕ ਹੈ</translation> <translation id="2805756323405976993">ਐਪਸ</translation> <translation id="2862104018715411648">ਆਪਣੇ ਦਸਤਾਵੇਜ਼ ਨੂੰ ਸਕੈਨਰ 'ਤੇ ਰੱਖੋ ਅਤੇ ਸ਼ੁਰੂਆਤ ਕਰਨ ਲਈ ਸਕੈਨ ਕਰੋ ਚੁਣੋ</translation> @@ -138,6 +139,7 @@ <translation id="4227825898293920515">ਪਾਸਵਰਡ ਦੀ ਮਿਆਦ <ph name="TIME" /> ਵਿੱਚ ਮੁੱਕ ਜਾਵੇਗੀ</translation> <translation id="4238516577297848345">ਕੋਈ ਪ੍ਰਿੰਟ ਜੌਬ ਪ੍ਰਕਿਰਿਆ-ਅਧੀਨ ਨਹੀਂ ਹੈ</translation> <translation id="4297501883039923494">ਬੰਦ ਹੋ ਗਿਆ - ਅਗਿਆਤ ਗੜਬੜ</translation> +<translation id="4300073214558989"><ph name="IMAGE_COUNT" /> ਚਿੱਤਰ</translation> <translation id="4378373042927530923">ਨੈੱਟਵਰਕ ਤਸ਼ਖੀਸ ਨਹੀਂ ਚੱਲੀ</translation> <translation id="4382484599443659549">PDF</translation> <translation id="4425149324548788773">My Drive</translation> @@ -295,6 +297,7 @@ <translation id="7144878232160441200">ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ</translation> <translation id="714876143603641390">LAN ਕਨੈਕਟੀਵਿਟੀ</translation> <translation id="7162487448488904999">ਗੈਲਰੀ</translation> +<translation id="7172721935181587524">1 ਚਿੱਤਰ</translation> <translation id="7177485034254901881"><ph name="MANAGER" /> ਵੱਲੋਂ ਇਸ <ph name="DEVICE_TYPE" /> ਦਾ ਪ੍ਰਬੰਧਨ ਕੀਤਾ ਜਾਂਦਾ ਹੈ। ਸ਼ਾਇਦ ਪ੍ਰਸ਼ਾਸਕ ਰਿਮੋਟਲੀ ਡੀਵਾਈਸ ਦਾ ਸੰਰੂਪਣ ਕਰ ਸਕਦੇ ਹਨ।</translation> <translation id="7216409898977639127">ਸੈਲਿਊਲਰ ਪ੍ਰਦਾਨਕ</translation> <translation id="7271040990581020067">ਫ਼ਿਲਹਾਲ ਸਕੈਨਰ ਵਰਤੋਂ ਵਿੱਚ ਹੈ। ਬਾਅਦ ਵਿੱਚ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ।</translation> @@ -344,6 +347,7 @@ <translation id="8294431847097064396">ਸ੍ਰੋਤ</translation> <translation id="8297006494302853456">ਕਮਜ਼ੋਰ</translation> <translation id="8302368968391049045">HTTPS ਫ਼ਾਇਰਵਾਲ</translation> +<translation id="8318753676953949627">ਕੋਈ ਚਿੱਤਰ ਨਹੀਂ</translation> <translation id="8347227221149377169">ਪ੍ਰਿੰਟ ਜੌਬਾਂ</translation> <translation id="8352772353338965963">ਬਹੁ-ਗਿਣਤੀ ਸਾਈਨ-ਇਨ ਲਈ ਇੱਕ ਖਾਤਾ ਸ਼ਾਮਲ ਕਰੋ। ਸਾਰੇ ਸਾਈਨ-ਇਨ ਕੀਤੇ ਖਾਤਿਆਂ ਤੱਕ ਬਿਨਾਂ ਕਿਸੇ ਪਾਸਵਰਡ ਦੇ ਪਹੁੰਚਿਆ ਜਾ ਸਕਦਾ ਹੈ, ਇਸਲਈ ਇਹ ਵਿਸ਼ੇਸ਼ਤਾ ਸਿਰਫ਼ ਭਰੋਸੇਯੋਗ ਖਾਤਿਆਂ ਨਾਲ ਵਰਤੀ ਜਾਣੀ ਚਾਹੀਦੀ ਹੈ।</translation> <translation id="8364946094152050673">ਖਾਲੀ ਨਾਮ ਸਰਵਰ</translation>
diff --git a/chromeos/strings/chromeos_strings_sq.xtb b/chromeos/strings/chromeos_strings_sq.xtb index af29975..b628f6e 100644 --- a/chromeos/strings/chromeos_strings_sq.xtb +++ b/chromeos/strings/chromeos_strings_sq.xtb
@@ -76,6 +76,7 @@ <translation id="2620436844016719705">Sistemi</translation> <translation id="2740531572673183784">Në rregull</translation> <translation id="2751739896257479635">Vërtetimi EAP i fazës 2</translation> +<translation id="2783010256799387990">KALOI</translation> <translation id="2789486458103222910">Në rregull</translation> <translation id="2805756323405976993">Aplikacionet</translation> <translation id="2862104018715411648">Vendose dokumentin tënd në skaner dhe zgjidh "Skano" për të filluar</translation> @@ -138,6 +139,7 @@ <translation id="4227825898293920515">Fjalëkalimi skadon për <ph name="TIME" /></translation> <translation id="4238516577297848345">Nuk ka printime në vazhdim</translation> <translation id="4297501883039923494">Ndaloi - Gabim i panjohur</translation> +<translation id="4300073214558989"><ph name="IMAGE_COUNT" /> imazhe</translation> <translation id="4378373042927530923">Nuk u ekzekutua</translation> <translation id="4382484599443659549">PDF</translation> <translation id="4425149324548788773">Disku im</translation> @@ -295,6 +297,7 @@ <translation id="7144878232160441200">Provo sërish</translation> <translation id="714876143603641390">Lidhshmëria e LAN-it</translation> <translation id="7162487448488904999">Galeria</translation> +<translation id="7172721935181587524">1 imazh</translation> <translation id="7177485034254901881">Kjo pajisje <ph name="DEVICE_TYPE" /> menaxhohet nga <ph name="MANAGER" />. Administratorët mund ta konfigurojnë në distancë pajisjen.</translation> <translation id="7216409898977639127">Operatori celular</translation> <translation id="7271040990581020067">Skaneri është aktualisht në përdorim. Provo përsëri më vonë.</translation> @@ -344,6 +347,7 @@ <translation id="8294431847097064396">Burimi</translation> <translation id="8297006494302853456">I dobët</translation> <translation id="8302368968391049045">Mur mbrojtës HTTPS</translation> +<translation id="8318753676953949627">Nuk ka imazhe</translation> <translation id="8347227221149377169">Printimet</translation> <translation id="8352772353338965963">Shto një llogari në identifikimin e shumëfishtë. Të gjitha llogaritë e identifikuara mund të qasen pa fjalëkalim, prandaj ky funksion duhet të përdoret vetëm me llogari të besuara.</translation> <translation id="8364946094152050673">Serverët DNS janë bosh</translation>
diff --git a/chromeos/strings/chromeos_strings_uz.xtb b/chromeos/strings/chromeos_strings_uz.xtb index 2e1e236..11ef3077 100644 --- a/chromeos/strings/chromeos_strings_uz.xtb +++ b/chromeos/strings/chromeos_strings_uz.xtb
@@ -32,6 +32,7 @@ <translation id="1499900233129743732"><ph name="MANAGER" /> bu foydalanuvchi faoliyatini masofadan kuzatishi va boshqarishi mumkin.</translation> <translation id="150962533380566081">PUK kod xato.</translation> <translation id="1510238584712386396">Ishga tushirish paneli</translation> +<translation id="1600964289716072707">Sahifa kiritish uchun boshqa sahifani skanerga joylash va Skanerlash tugmasini bosing.</translation> <translation id="1621067168122174824">Quvvatlanishini tekshirish</translation> <translation id="1641857168437328880">Hujjat tasmasi (bir tomonlama)</translation> <translation id="1644574205037202324">Tarix</translation> @@ -285,6 +286,7 @@ <translation id="6766275201586212568">DNS manzil ajratilmadi</translation> <translation id="6768237774506518020">DNS manzil ajratilmasligi juda yuqori</translation> <translation id="6853312040151791195">Quvvat sarflanishi tezligi</translation> +<translation id="6905724422583748843"><ph name="PAGE_NAME" /> sahifasiga qaytish</translation> <translation id="6910312834584889076">Skaner qopqogʻi yopilmagan. Qopqogʻini toping va qaytadan urining.</translation> <translation id="6911383237894364323">Media serverlarga ulana olmadi</translation> <translation id="6957231940976260713">Xizmat nomi</translation> @@ -329,6 +331,7 @@ <translation id="7769672763586021400">Model identifikatori</translation> <translation id="7805768142964895445">Holat</translation> <translation id="7819857487979277519">PSK (WPA yoki RSN)</translation> +<translation id="7835501727204647447">CloudReady oʻrnatish</translation> <translation id="7881066108824108340">DNS</translation> <translation id="7882358943899516840">Ta’minot turi</translation> <translation id="7936303884198020182">Nom serverlari topilmadi</translation>
diff --git a/chromeos/timezone/timezone_request.cc b/chromeos/timezone/timezone_request.cc index e7c971d..3c2a92d91 100644 --- a/chromeos/timezone/timezone_request.cc +++ b/chromeos/timezone/timezone_request.cc
@@ -201,9 +201,9 @@ return false; } - std::string status; + const std::string* status = response_object->FindStringKey(kStatusString); - if (!response_object->GetStringWithoutPathExpansion(kStatusString, &status)) { + if (!status) { PrintTimeZoneError(server_url, "Missing status attribute.", timezone); RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); return false; @@ -211,7 +211,7 @@ bool found = false; for (size_t i = 0; i < base::size(statusString2Enum); ++i) { - if (status != statusString2Enum[i].string) + if (*status != statusString2Enum[i].string) continue; timezone->status = statusString2Enum[i].value; @@ -221,7 +221,7 @@ if (!found) { PrintTimeZoneError( - server_url, "Bad status attribute value: '" + status + "'", timezone); + server_url, "Bad status attribute value: '" + *status + "'", timezone); RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); return false; } @@ -248,25 +248,31 @@ return false; } - if (!response_object->GetStringWithoutPathExpansion(kTimeZoneIdString, - &timezone->timeZoneId) && - status_ok) { + const std::string* time_zone_id = + response_object->FindStringKey(kTimeZoneIdString); + if (time_zone_id) { + timezone->timeZoneId = *time_zone_id; + } else if (status_ok) { PrintTimeZoneError(server_url, "Missing timeZoneId attribute.", timezone); RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); return false; } - if (!response_object->GetStringWithoutPathExpansion( - kTimeZoneNameString, &timezone->timeZoneName) && - status_ok) { + const std::string* time_zone_name = + response_object->FindStringKey(kTimeZoneNameString); + if (time_zone_name) { + timezone->timeZoneName = *time_zone_name; + } else if (status_ok) { PrintTimeZoneError(server_url, "Missing timeZoneName attribute.", timezone); RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); return false; } // "error_message" field is optional. Ignore result. - response_object->GetStringWithoutPathExpansion(kErrorMessageString, - &timezone->error_message); + const std::string* error_message = + response_object->FindStringKey(kErrorMessageString); + if (error_message) + timezone->error_message = *error_message; return true; }
diff --git a/components/accuracy_tips/BUILD.gn b/components/accuracy_tips/BUILD.gn index ca7e6a7..4404e12f 100644 --- a/components/accuracy_tips/BUILD.gn +++ b/components/accuracy_tips/BUILD.gn
@@ -17,6 +17,7 @@ deps = [ "//base", "//components/keyed_service/core", + "//components/safe_browsing/core/browser/db:database_manager", "//components/safe_browsing/core/common", "//content/public/browser", ] @@ -33,6 +34,8 @@ deps = [ ":accuracy_tips", "//base/test:test_support", + "//components/safe_browsing/core/browser/db:database_manager", + "//components/safe_browsing/core/browser/db:test_database_manager", "//components/safe_browsing/core/common", "//content/test:test_support", "//testing/gmock",
diff --git a/components/accuracy_tips/accuracy_service.cc b/components/accuracy_tips/accuracy_service.cc index b61678b..46be499e 100644 --- a/components/accuracy_tips/accuracy_service.cc +++ b/components/accuracy_tips/accuracy_service.cc
@@ -6,35 +6,146 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/callback_forward.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/histogram_functions.h" #include "base/time/time.h" #include "components/accuracy_tips/accuracy_tip_status.h" #include "components/accuracy_tips/accuracy_tip_ui.h" #include "components/accuracy_tips/features.h" +#include "components/safe_browsing/core/browser/db/database_manager.h" namespace accuracy_tips { -AccuracyService::AccuracyService(std::unique_ptr<AccuracyTipUI> ui) - : ui_(std::move(ui)), sample_url_(GURL(kSampleUrl.Get())) {} +using AccuracyCheckCallback = AccuracyService::AccuracyCheckCallback; + +class AccuracyTipSafeBrowsingClient + : public base::RefCountedThreadSafe<AccuracyTipSafeBrowsingClient>, + public safe_browsing::SafeBrowsingDatabaseManager::Client { + public: + AccuracyTipSafeBrowsingClient( + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> sb_database, + scoped_refptr<base::SequencedTaskRunner> ui_task_runner, + scoped_refptr<base::SequencedTaskRunner> io_task_runner) + : sb_database_(sb_database), + ui_task_runner_(std::move(ui_task_runner)), + io_task_runner_(std::move(io_task_runner)) {} + + void ShutdownOnIOThread(); + + // Check status of URL with SafeBrowsingDatabaseManager. Will call + // |callback| with result on UI thread. + void CheckAccuracyStatusOnIOThread(const GURL& url, + AccuracyCheckCallback callback); + // Replies to |callback| with |status| and ensure that this happens on the + // ui thread. + void ReplyOnUIThread(AccuracyCheckCallback callback, + AccuracyTipStatus status); + + // SafeBrowsingDatabaseManager::Client: + void OnCheckUrlForAccuracyTip(bool should_show_accuracy_tip) override; + + private: + friend class base::RefCountedThreadSafe<AccuracyTipSafeBrowsingClient>; + ~AccuracyTipSafeBrowsingClient() override = default; + + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> sb_database_; + scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; + scoped_refptr<base::SequencedTaskRunner> io_task_runner_; + AccuracyCheckCallback pending_callback_; // accessed on io thread! +}; + +void AccuracyTipSafeBrowsingClient::CheckAccuracyStatusOnIOThread( + const GURL& url, + AccuracyCheckCallback callback) { + DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); + if (pending_callback_) { + sb_database_->CancelCheck(this); + ReplyOnUIThread(std::move(pending_callback_), AccuracyTipStatus::kNone); + } + + pending_callback_ = std::move(callback); + if (sb_database_->CheckUrlForAccuracyTips(url, this)) { + ReplyOnUIThread(std::move(pending_callback_), AccuracyTipStatus::kNone); + } +} + +void AccuracyTipSafeBrowsingClient::OnCheckUrlForAccuracyTip( + bool should_show_accuracy_tip) { + DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); + DCHECK(pending_callback_); + ReplyOnUIThread(std::move(pending_callback_), + should_show_accuracy_tip ? AccuracyTipStatus::kShowAccuracyTip + : AccuracyTipStatus::kNone); +} + +void AccuracyTipSafeBrowsingClient::ReplyOnUIThread( + AccuracyCheckCallback callback, + AccuracyTipStatus status) { + DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); + ui_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), status)); +} + +void AccuracyTipSafeBrowsingClient::ShutdownOnIOThread() { + DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); + if (pending_callback_) + sb_database_->CancelCheck(this); + sb_database_ = nullptr; +} + +AccuracyService::AccuracyService( + std::unique_ptr<AccuracyTipUI> ui, + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> sb_database, + scoped_refptr<base::SequencedTaskRunner> ui_task_runner, + scoped_refptr<base::SequencedTaskRunner> io_task_runner) + : ui_(std::move(ui)), + ui_task_runner_(ui_task_runner), + io_task_runner_(io_task_runner), + sample_url_(GURL(kSampleUrl.Get())) { + if (sb_database) { + sb_client_ = base::MakeRefCounted<AccuracyTipSafeBrowsingClient>( + std::move(sb_database), std::move(ui_task_runner), + std::move(io_task_runner)); + } +} AccuracyService::~AccuracyService() = default; +void AccuracyService::Shutdown() { + if (sb_client_) { + io_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&AccuracyTipSafeBrowsingClient::ShutdownOnIOThread, + std::move(sb_client_))); + } +} + void AccuracyService::CheckAccuracyStatus(const GURL& url, AccuracyCheckCallback callback) { - // TODO(crbug.com/1210891): Implement check. + DCHECK(ui_task_runner_->RunsTasksInCurrentSequence()); if (sample_url_.is_valid() && url == sample_url_) { - std::move(callback).Run(AccuracyTipStatus::kMisinformation); + std::move(callback).Run(AccuracyTipStatus::kShowAccuracyTip); return; } - std::move(callback).Run(AccuracyTipStatus::kNone); + if (!sb_client_) { + std::move(callback).Run(AccuracyTipStatus::kNone); + return; + } + + io_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &AccuracyTipSafeBrowsingClient::CheckAccuracyStatusOnIOThread, + sb_client_, url, std::move(callback))); } void AccuracyService::MaybeShowAccuracyTip(content::WebContents* web_contents) { + DCHECK(ui_task_runner_->RunsTasksInCurrentSequence()); // TODO(crbug.com/1210891): Implement rate limiting. ui_->ShowAccuracyTip( - web_contents, AccuracyTipStatus::kMisinformation, + web_contents, AccuracyTipStatus::kShowAccuracyTip, base::BindOnce(&AccuracyService::OnAccuracyTipClosed, weak_factory_.GetWeakPtr(), base::TimeTicks::Now())); } @@ -42,6 +153,7 @@ void AccuracyService::OnAccuracyTipClosed( base::TimeTicks time_opened, AccuracyTipUI::Interaction interaction) { + DCHECK(ui_task_runner_->RunsTasksInCurrentSequence()); base::UmaHistogramEnumeration("Privacy.AccuracyTip.AccuracyTipInteraction", interaction); base::UmaHistogramMediumTimes("Privacy.AccuracyTip.AccuracyTipTimeOpen",
diff --git a/components/accuracy_tips/accuracy_service.h b/components/accuracy_tips/accuracy_service.h index e254d77..d9aebe1 100644 --- a/components/accuracy_tips/accuracy_service.h +++ b/components/accuracy_tips/accuracy_service.h
@@ -16,13 +16,23 @@ class WebContents; } +namespace safe_browsing { +class SafeBrowsingDatabaseManager; +} + namespace accuracy_tips { +class AccuracyTipSafeBrowsingClient; + // Checks accuracy information on URLs for AccuracyTips. // Handles rate-limiting and feature checks. class AccuracyService : public KeyedService { public: - explicit AccuracyService(std::unique_ptr<AccuracyTipUI> ui); + AccuracyService( + std::unique_ptr<AccuracyTipUI> ui, + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> sb_database, + scoped_refptr<base::SequencedTaskRunner> ui_task_runner, + scoped_refptr<base::SequencedTaskRunner> io_task_runner); ~AccuracyService() override; AccuracyService(const AccuracyService&) = delete; @@ -31,20 +41,27 @@ // Callback for accuracy check result. using AccuracyCheckCallback = base::OnceCallback<void(AccuracyTipStatus)>; - // Returns the accuracy status for |url|. + // Returns the accuracy status for |url|. Virtual for testing purposes. virtual void CheckAccuracyStatus(const GURL& url, AccuracyCheckCallback callback); // Shows an accuracy tip UI for web_contents after checking rate limits. + // Virtual for testing purposes. virtual void MaybeShowAccuracyTip(content::WebContents* web_contents); void SetSampleUrlForTesting(const GURL& url); + // KeyedService: + void Shutdown() override; + private: void OnAccuracyTipClosed(base::TimeTicks time_opened, AccuracyTipUI::Interaction interaction); std::unique_ptr<AccuracyTipUI> ui_; + scoped_refptr<AccuracyTipSafeBrowsingClient> sb_client_; + scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; + scoped_refptr<base::SequencedTaskRunner> io_task_runner_; GURL sample_url_; base::WeakPtrFactory<AccuracyService> weak_factory_{this};
diff --git a/components/accuracy_tips/accuracy_service_unittest.cc b/components/accuracy_tips/accuracy_service_unittest.cc index c64003e..9eb3bdc9 100644 --- a/components/accuracy_tips/accuracy_service_unittest.cc +++ b/components/accuracy_tips/accuracy_service_unittest.cc
@@ -5,16 +5,26 @@ #include "components/accuracy_tips/accuracy_service.h" #include <memory> +#include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial_params.h" +#include "base/run_loop.h" +#include "base/task/post_task.h" +#include "base/task/task_traits.h" +#include "base/test/bind.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" +#include "base/test/task_environment.h" #include "components/accuracy_tips/accuracy_tip_status.h" #include "components/accuracy_tips/features.h" +#include "components/safe_browsing/core/browser/db/database_manager.h" +#include "components/safe_browsing/core/browser/db/test_database_manager.h" #include "components/safe_browsing/core/common/features.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_; +using testing::Invoke; +using testing::Return; namespace accuracy_tips { @@ -26,6 +36,34 @@ base::OnceCallback<void(Interaction)>)); }; +class MockSafeBrowsingDatabaseManager + : public safe_browsing::TestSafeBrowsingDatabaseManager { + public: + MockSafeBrowsingDatabaseManager() + : TestSafeBrowsingDatabaseManager(base::ThreadTaskRunnerHandle::Get(), + base::ThreadTaskRunnerHandle::Get()) {} + + MOCK_METHOD2(CheckUrlForAccuracyTips, bool(const GURL&, Client*)); + + protected: + ~MockSafeBrowsingDatabaseManager() override = default; +}; + +// Handler to mark URLs as part of the AccuracyTips list. +bool IsOnList(const GURL& url, + safe_browsing::SafeBrowsingDatabaseManager::Client* client) { + client->OnCheckUrlForAccuracyTip(true); + return false; +} + +// Handler to simulate URLs that match the local hash but are not on the list. +bool IsLocalMatchButNotOnList( + const GURL& url, + safe_browsing::SafeBrowsingDatabaseManager::Client* client) { + client->OnCheckUrlForAccuracyTip(false); + return false; +} + class AccuracyServiceTest : public ::testing::Test { protected: AccuracyServiceTest() = default; @@ -33,31 +71,69 @@ void SetUp() override { feature_list.InitAndEnableFeatureWithParameters( safe_browsing::kAccuracyTipsFeature, - {{kSampleUrl.name, "https://badurl.com"}}); + {{kSampleUrl.name, "https://sampleurl.com"}}); + auto ui = std::make_unique<testing::StrictMock<MockAccuracyTipUI>>(); ui_ = ui.get(); - service_ = std::make_unique<AccuracyService>(std::move(ui)); + sb_database_ = base::MakeRefCounted<MockSafeBrowsingDatabaseManager>(); + service_ = std::make_unique<AccuracyService>( + std::move(ui), sb_database_, base::ThreadTaskRunnerHandle::Get(), + base::ThreadTaskRunnerHandle::Get()); } AccuracyService* service() { return service_.get(); } MockAccuracyTipUI* ui() { return ui_; } + MockSafeBrowsingDatabaseManager* sb_database() { return sb_database_.get(); } private: + base::test::SingleThreadTaskEnvironment environment; base::test::ScopedFeatureList feature_list; + std::unique_ptr<AccuracyService> service_; MockAccuracyTipUI* ui_; + scoped_refptr<MockSafeBrowsingDatabaseManager> sb_database_; }; TEST_F(AccuracyServiceTest, CheckAccuracyStatusForRandomSite) { + auto url = GURL("https://example.com"); base::MockOnceCallback<void(AccuracyTipStatus)> callback; EXPECT_CALL(callback, Run(AccuracyTipStatus::kNone)); - service()->CheckAccuracyStatus(GURL("https://example.com"), callback.Get()); + EXPECT_CALL(*sb_database(), CheckUrlForAccuracyTips(url, _)) + .WillOnce(Return(true)); + + service()->CheckAccuracyStatus(url, callback.Get()); + base::RunLoop().RunUntilIdle(); } TEST_F(AccuracyServiceTest, CheckAccuracyStatusForSampleUrl) { + auto url = GURL("https://sampleurl.com"); base::MockOnceCallback<void(AccuracyTipStatus)> callback; - EXPECT_CALL(callback, Run(AccuracyTipStatus::kMisinformation)); - service()->CheckAccuracyStatus(GURL("https://badurl.com"), callback.Get()); + EXPECT_CALL(callback, Run(AccuracyTipStatus::kShowAccuracyTip)); + + service()->CheckAccuracyStatus(url, callback.Get()); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(AccuracyServiceTest, CheckAccuracyStatusForUrlOnList) { + auto url = GURL("https://badurl.com"); + base::MockOnceCallback<void(AccuracyTipStatus)> callback; + EXPECT_CALL(callback, Run(AccuracyTipStatus::kShowAccuracyTip)); + EXPECT_CALL(*sb_database(), CheckUrlForAccuracyTips(url, _)) + .WillOnce(Invoke(&IsOnList)); + + service()->CheckAccuracyStatus(url, callback.Get()); + base::RunLoop().RunUntilIdle(); +} + +TEST_F(AccuracyServiceTest, CheckAccuracyStatusForLocalMatch) { + auto url = GURL("https://notactuallybadurl.com"); + base::MockOnceCallback<void(AccuracyTipStatus)> callback; + EXPECT_CALL(callback, Run(AccuracyTipStatus::kNone)); + EXPECT_CALL(*sb_database(), CheckUrlForAccuracyTips(url, _)) + .WillOnce(Invoke(&IsLocalMatchButNotOnList)); + + service()->CheckAccuracyStatus(url, callback.Get()); + base::RunLoop().RunUntilIdle(); } TEST_F(AccuracyServiceTest, ShowUI) {
diff --git a/components/accuracy_tips/accuracy_tip_status.h b/components/accuracy_tips/accuracy_tip_status.h index 3a92b13c..98120d5 100644 --- a/components/accuracy_tips/accuracy_tip_status.h +++ b/components/accuracy_tips/accuracy_tip_status.h
@@ -13,10 +13,10 @@ enum class AccuracyTipStatus { // No accuracy information for the site. kNone = 0, - // Site classified as being misleading. - kMisinformation = 1, + // Site is eligible for showing an accuracy tip. + kShowAccuracyTip = 1, - kMaxValue = kMisinformation, + kMaxValue = kShowAccuracyTip, }; } // namespace accuracy_tips
diff --git a/components/accuracy_tips/accuracy_web_contents_observer_unittest.cc b/components/accuracy_tips/accuracy_web_contents_observer_unittest.cc index ae06939..ab6e6f1e 100644 --- a/components/accuracy_tips/accuracy_web_contents_observer_unittest.cc +++ b/components/accuracy_tips/accuracy_web_contents_observer_unittest.cc
@@ -11,6 +11,7 @@ #include "components/accuracy_tips/accuracy_service.h" #include "components/accuracy_tips/accuracy_tip_status.h" #include "components/accuracy_tips/features.h" +#include "components/safe_browsing/core/browser/db/database_manager.h" #include "content/public/test/navigation_simulator.h" #include "content/public/test/test_renderer_host.h" #include "testing/gmock/include/gmock/gmock.h" @@ -29,13 +30,13 @@ std::move(callback).Run(AccuracyTipStatus::kNone); } void ReturnIsMisinformation(const GURL&, AccuracyCheckCallback callback) { - std::move(callback).Run(AccuracyTipStatus::kMisinformation); + std::move(callback).Run(AccuracyTipStatus::kShowAccuracyTip); } } // namespace class MockAccuracyService : public AccuracyService { public: - MockAccuracyService() : AccuracyService(nullptr) {} + MockAccuracyService() : AccuracyService(nullptr, nullptr, nullptr, nullptr) {} MOCK_METHOD2(CheckAccuracyStatus, void(const GURL&, AccuracyCheckCallback)); MOCK_METHOD1(MaybeShowAccuracyTip, void(content::WebContents*)); }; @@ -93,7 +94,7 @@ // Verify that there is no call to MaybeShowAccuracyTip if callback is invoked // after navigation to a different site. - std::move(callback).Run(AccuracyTipStatus::kMisinformation); + std::move(callback).Run(AccuracyTipStatus::kShowAccuracyTip); Mock::VerifyAndClearExpectations(service()); } @@ -109,7 +110,7 @@ // Invoke callback after webcontents is destroyed. DeleteContents(); - std::move(callback).Run(AccuracyTipStatus::kMisinformation); + std::move(callback).Run(AccuracyTipStatus::kShowAccuracyTip); } } // namespace accuracy_tips \ No newline at end of file
diff --git a/components/arc/compat_mode/arc_resize_lock_manager.cc b/components/arc/compat_mode/arc_resize_lock_manager.cc index 0ad2312..edaae04 100644 --- a/components/arc/compat_mode/arc_resize_lock_manager.cc +++ b/components/arc/compat_mode/arc_resize_lock_manager.cc
@@ -63,6 +63,10 @@ static void RunOnActivated(aura::Window* window, base::OnceClosure on_activated) { + // ash::Shell can be null in unittests. + if (!ash::Shell::HasInstance()) + return; + if (ash::Shell::Get()->activation_client()->GetActiveWindow() == window) { std::move(on_activated).Run(); return; @@ -188,10 +192,11 @@ bool is_first_launch = false; const std::string* app_id = window->GetProperty(ash::kAppIDKey); + DCHECK(app_id); // The state is |ArcResizeLockState::READY| only when we enable the resize // lock for an app for the first time. - if (app_id && pref_delegate_->GetResizeLockState(*app_id) == - mojom::ArcResizeLockState::READY) { + if (pref_delegate_->GetResizeLockState(*app_id) == + mojom::ArcResizeLockState::READY) { pref_delegate_->SetResizeLockState(*app_id, mojom::ArcResizeLockState::ON); is_first_launch = true; }
diff --git a/components/arc/compat_mode/arc_resize_lock_manager.h b/components/arc/compat_mode/arc_resize_lock_manager.h index 712e7a4..516b8028 100644 --- a/components/arc/compat_mode/arc_resize_lock_manager.h +++ b/components/arc/compat_mode/arc_resize_lock_manager.h
@@ -63,13 +63,14 @@ void ToggleResizeToggleMenu(views::Widget* widget); - private: - friend class ArcResizeLockManagerTest; - - // Virtual for testing. + protected: + // protected and virtual for testing. virtual void EnableResizeLock(aura::Window* window); virtual void DisableResizeLock(aura::Window* window); + private: + friend class ArcResizeLockManagerTest; + void UpdateCompatModeButton(aura::Window* window); ArcResizeLockPrefDelegate* pref_delegate_{nullptr};
diff --git a/components/arc/compat_mode/arc_resize_lock_manager_unittest.cc b/components/arc/compat_mode/arc_resize_lock_manager_unittest.cc index 24c672e..ca30ff3 100644 --- a/components/arc/compat_mode/arc_resize_lock_manager_unittest.cc +++ b/components/arc/compat_mode/arc_resize_lock_manager_unittest.cc
@@ -32,10 +32,12 @@ // ArcResizeLockManager: void EnableResizeLock(aura::Window* window) override { + ArcResizeLockManager::EnableResizeLock(window); DCHECK(!base::Contains(resize_lock_enabled_windows_, window)); resize_lock_enabled_windows_.push_back(window); } void DisableResizeLock(aura::Window* window) override { + ArcResizeLockManager::DisableResizeLock(window); DCHECK(base::Contains(resize_lock_enabled_windows_, window)); base::Erase(resize_lock_enabled_windows_, window); } @@ -44,12 +46,48 @@ std::vector<aura::Window*> resize_lock_enabled_windows_; }; +class TestArcResizeLockPrefDelegate : public ArcResizeLockPrefDelegate { + public: + ~TestArcResizeLockPrefDelegate() override = default; + + // ArcResizeLockPrefDelegate: + mojom::ArcResizeLockState GetResizeLockState( + const std::string& app_id) const override { + auto it = resize_lock_states.find(app_id); + if (it == resize_lock_states.end()) + return mojom::ArcResizeLockState::UNDEFINED; + + return it->second; + } + void SetResizeLockState(const std::string& app_id, + mojom::ArcResizeLockState state) override { + resize_lock_states[app_id] = state; + } + bool GetResizeLockNeedsConfirmation(const std::string& app_id) override { + return false; + } + void SetResizeLockNeedsConfirmation(const std::string& app_id, + bool is_needed) override {} + + private: + base::flat_map<std::string, mojom::ArcResizeLockState> resize_lock_states; + int GetShowSplashScreenDialogCount() const override { return 1; } + void SetShowSplashScreenDialogCount(int count) override {} +}; + DEFINE_UI_CLASS_PROPERTY_KEY(bool, kNonInterestedPropKey, false) } // namespace class ArcResizeLockManagerTest : public views::ViewsTestBase { public: + // views::ViewsTestBase: + void SetUp() override { + views::ViewsTestBase::SetUp(); + fake_arc_resize_lock_manager_.SetPrefDelegate( + &test_arc_resize_lock_pref_delegate); + } + aura::Window* CreateFakeWindow(bool is_arc) { aura::Window* window = new aura::Window(nullptr, aura::client::WINDOW_TYPE_NORMAL); @@ -70,8 +108,13 @@ return !!fake_arc_resize_lock_manager_.resize_toggle_menu_; } + TestArcResizeLockPrefDelegate* pref_delegate() { + return &test_arc_resize_lock_pref_delegate; + } + private: FakeArcResizeLockManager fake_arc_resize_lock_manager_; + TestArcResizeLockPrefDelegate test_arc_resize_lock_pref_delegate; }; TEST_F(ArcResizeLockManagerTest, ConstructDestruct) {} @@ -132,4 +175,34 @@ EXPECT_FALSE(IsResizeLockEnabled(non_arc_window)); } +// Test that the ArcResizeLockState is properly handled for the "first-time +// launch" app (whose state is ArcResizeLockState::READY). +TEST_F(ArcResizeLockManagerTest, ResizeLockStateForFirstTimeLaunch) { + auto* arc_window = CreateFakeWindow(true); + std::string app_id = "app-id"; + arc_window->SetProperty(ash::kAppIDKey, &app_id); + EXPECT_FALSE(IsResizeLockEnabled(arc_window)); + + // Test for RESIZE_LIMITED. + pref_delegate()->SetResizeLockState(app_id, mojom::ArcResizeLockState::READY); + arc_window->SetProperty(ash::kArcResizeLockTypeKey, + ash::ArcResizeLockType::RESIZE_LIMITED); + EXPECT_EQ(pref_delegate()->GetResizeLockState(app_id), + mojom::ArcResizeLockState::ON); + + // Test for RESIZABLE. + pref_delegate()->SetResizeLockState(app_id, mojom::ArcResizeLockState::READY); + arc_window->SetProperty(ash::kArcResizeLockTypeKey, + ash::ArcResizeLockType::RESIZABLE); + EXPECT_EQ(pref_delegate()->GetResizeLockState(app_id), + mojom::ArcResizeLockState::READY); + + // Test for FULLY_LOCKED. + pref_delegate()->SetResizeLockState(app_id, mojom::ArcResizeLockState::READY); + arc_window->SetProperty(ash::kArcResizeLockTypeKey, + ash::ArcResizeLockType::FULLY_LOCKED); + EXPECT_EQ(pref_delegate()->GetResizeLockState(app_id), + mojom::ArcResizeLockState::ON); +} + } // namespace arc
diff --git a/components/arc/mojom/auth.mojom b/components/arc/mojom/auth.mojom index 5ecfc81..f03e47c7 100644 --- a/components/arc/mojom/auth.mojom +++ b/components/arc/mojom/auth.mojom
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next MinVersion: 27 +// Next MinVersion: 28 module arc.mojom; @@ -219,6 +219,17 @@ // corresponding UMA callsite in Chrome arc::UpdateAuthAccountCheckStatus. }; +// These values describe the reason for reauth. +[Extensible] +enum ReauthReason { + // Device is provisioned but Android id is not set. + [MinVersion=27] ANDROID_ID_MISSING = 0, + + // Main account set in system properties is not found in Android + // Account Manager. + [MinVersion=27] MAIN_ACCOUNT_UNKNOWN = 1, +}; + [Extensible] enum MainAccountResolutionStatus { // No hash code was set for the main account. System contains no account of @@ -370,7 +381,7 @@ string gaia_id; }; -// Next Method ID: 20. +// Next Method ID: 21. interface AuthHost { // Notifies Chrome that the authorization flow is completed and provides // |result| and |account| that was authorized. @@ -444,6 +455,9 @@ // OS Account Manager's re-authentication UI. |account_name| is the Google // email id for the account. |account_name| cannot be null or empty. [MinVersion=20] HandleUpdateCredentialsRequest@17(string account_name); + + // Reports the reason for doing auth despite device being provisioned earlier. + [MinVersion=27] ReportAccountReauthReason@20(ReauthReason reason); }; // Next Method ID: 6
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.cc b/components/autofill/content/browser/content_autofill_driver_factory.cc index 7f4d6ce3..f7744e71 100644 --- a/components/autofill/content/browser/content_autofill_driver_factory.cc +++ b/components/autofill/content/browser/content_autofill_driver_factory.cc
@@ -102,7 +102,8 @@ if (!factory) return; - ContentAutofillDriver* driver = factory->DriverForFrame(render_frame_host); + ContentAutofillDriver* driver = + factory->GetOrCreateDriverForFrame(render_frame_host); if (driver) driver->BindPendingReceiver(std::move(pending_receiver)); } @@ -125,6 +126,15 @@ ContentAutofillDriver* ContentAutofillDriverFactory::DriverForFrame( content::RenderFrameHost* render_frame_host) { AutofillDriver* driver = DriverForKey(render_frame_host); + // This cast is safe because AutofillDriverFactory::AddForKey is protected + // and always called with ContentAutofillDriver instances within + // ContentAutofillDriverFactory. + return static_cast<ContentAutofillDriver*>(driver); +} + +ContentAutofillDriver* ContentAutofillDriverFactory::GetOrCreateDriverForFrame( + content::RenderFrameHost* render_frame_host) { + AutofillDriver* driver = DriverForKey(render_frame_host); // ContentAutofillDriver are created on demand here. if (!driver) { @@ -181,7 +191,7 @@ content::RenderFrameHost* render_frame_host = content::RenderFrameHost::FromID(id); if (render_frame_host) { - DriverForFrame(render_frame_host)->ProbablyFormSubmitted(); + GetOrCreateDriverForFrame(render_frame_host)->ProbablyFormSubmitted(); } } } @@ -192,7 +202,7 @@ (navigation_handle->IsInMainFrame() || navigation_handle->HasSubframeNavigationEntryCommitted())) { ContentAutofillDriver* driver = - DriverForFrame(navigation_handle->GetRenderFrameHost()); + GetOrCreateDriverForFrame(navigation_handle->GetRenderFrameHost()); if (!navigation_handle->IsSameDocument() && !navigation_handle->IsServedFromBackForwardCache()) { if (navigation_handle->IsInMainFrame()) { @@ -229,7 +239,7 @@ navigation_handle->GetPreviousRenderFrameHostId()) { return; } - AutofillDriver* driver = DriverForFrame(render_frame_host); + AutofillDriver* driver = GetOrCreateDriverForFrame(render_frame_host); if (!driver) return; static_cast<ContentAutofillDriver*>(driver)
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.h b/components/autofill/content/browser/content_autofill_driver_factory.h index e4a1303..8129f75 100644 --- a/components/autofill/content/browser/content_autofill_driver_factory.h +++ b/components/autofill/content/browser/content_autofill_driver_factory.h
@@ -85,6 +85,12 @@ content::NavigationHandle* navigation_handle) override; private: + // The creation of a driver is private to ensure that we don't accidentally + // register drivers while a frame is already deleted. Such a driver would not + // be unregistered properly. + ContentAutofillDriver* GetOrCreateDriverForFrame( + content::RenderFrameHost* render_frame_host); + std::string app_locale_; BrowserAutofillManager::AutofillDownloadManagerState enable_download_manager_; AutofillManager::AutofillManagerFactoryCallback
diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc index 0780018..bc00934f 100644 --- a/components/autofill/core/browser/autofill_download_manager.cc +++ b/components/autofill/core/browser/autofill_download_manager.cc
@@ -746,12 +746,10 @@ request_data.payload = std::move(payload); DVLOG(1) << "Sending Autofill Upload Request:\n" << upload; - if (log_manager_) { - log_manager_->Log() << LoggingScope::kAutofillServer + SafeLog(log_manager_) << LoggingScope::kAutofillServer << LogMessage::kSendAutofillUpload << Br{} << "Allow upload?: " << allow_upload << Br{} << "Data: " << Br{} << upload; - } if (!allow_upload) return false;
diff --git a/components/autofill/core/browser/autofill_experiments.cc b/components/autofill/core/browser/autofill_experiments.cc index 419c126..c4c7fa3 100644 --- a/components/autofill/core/browser/autofill_experiments.cc +++ b/components/autofill/core/browser/autofill_experiments.cc
@@ -38,18 +38,14 @@ namespace autofill { namespace { void LogCardUploadDisabled(LogManager* log_manager, std::string context) { - if (log_manager) { - log_manager->Log() << LoggingScope::kCreditCardUploadStatus + SafeLog(log_manager) << LoggingScope::kCreditCardUploadStatus << LogMessage::kCreditCardUploadDisabled << context << CTag{}; - } } void LogCardUploadEnabled(LogManager* log_manager) { - if (log_manager) { - log_manager->Log() << LoggingScope::kCreditCardUploadStatus + SafeLog(log_manager) << LoggingScope::kCreditCardUploadStatus << LogMessage::kCreditCardUploadEnabled << CTag{}; - } } } // namespace
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index ccdc323..94888beb5 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -406,10 +406,8 @@ FormStructure* AutofillManager::ParseForm(const FormData& form, const FormStructure* cached_form) { if (form_structures_.size() >= kAutofillManagerMaxFormCacheSize) { - if (log_manager_) { - log_manager_->Log() << LoggingScope::kAbortParsing + SafeLog(log_manager_) << LoggingScope::kAbortParsing << LogMessage::kAbortParsingTooManyForms << form; - } return nullptr; }
diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc index f224c6d..a5e36bb3 100644 --- a/components/autofill/core/browser/browser_autofill_manager.cc +++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -379,11 +379,9 @@ // Logs the reason for suppressing autofill suggestions to // chrome://autofill-internals. void LogSuppressReason(LogManager* log_manager, const std::string& reason) { - if (!log_manager) - return; - log_manager->Log() << LoggingScope::kFilling - << LogMessage::kSuggestionSuppressed - << " Reason: " << reason; + SafeLog(log_manager) << LoggingScope::kFilling + << LogMessage::kSuggestionSuppressed + << " Reason: " << reason; } } // namespace @@ -658,13 +656,11 @@ SubmissionSource source) { base::UmaHistogramEnumeration("Autofill.FormSubmission.PerProfileType", client()->GetProfileType()); - if (log_manager()) { - log_manager()->Log() << LoggingScope::kSubmission + SafeLog(log_manager()) << LoggingScope::kSubmission << LogMessage::kFormSubmissionDetected << Br{} << "known_success: " << known_success << Br{} << "source: " << SubmissionSourceToString(source) << Br{} << form; - } // Always upload page language metrics. LogLanguageMetrics(client()->GetLanguageState()); @@ -1681,6 +1677,7 @@ DCHECK(autofill_field); LogBuffer buffer; + buffer.set_active(log_manager() && log_manager()->IsLoggingActive()); buffer << "is credit card section: " << is_credit_card << Br{}; buffer << "is refill: " << is_refill << Br{}; buffer << *form_structure << Br{}; @@ -1868,11 +1865,9 @@ if (action == AutofillDriver::FORM_DATA_ACTION_FILL && !is_refill) personal_data_->RecordUseOf(profile_or_credit_card); - if (log_manager()) { - log_manager()->Log() << LoggingScope::kFilling + SafeLog(log_manager()) << LoggingScope::kFilling << LogMessage::kSendFillingData << Br{} << std::move(buffer); - } driver()->SendFormDataToRenderer(query_id, action, result, field.origin, field_type_map); }
diff --git a/components/autofill/core/browser/form_data_importer.cc b/components/autofill/core/browser/form_data_importer.cc index 665d60e..f14d00ff4 100644 --- a/components/autofill/core/browser/form_data_importer.cc +++ b/components/autofill/core/browser/form_data_importer.cc
@@ -55,7 +55,7 @@ bool IsValidFieldTypeAndValue(const ServerFieldTypeSet types_seen, ServerFieldType field_type, const std::u16string& value, - LogBuffer* import_log_buffer) { + LogBuffer& import_log_buffer) { // Abandon the import if two fields of the same type are encountered. // This indicates ambiguous data or miscategorization of types. // Make an exception for: @@ -74,23 +74,19 @@ ? field_type_group != FieldTypeGroup::kPhoneBilling && field_type_group != FieldTypeGroup::kPhoneHome : field_type != PHONE_HOME_NUMBER)) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Multiple fields of type " - << AutofillType::ServerFieldTypeToString(field_type) - << "." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Multiple fields of type " + << AutofillType::ServerFieldTypeToString(field_type) + << "." << CTag{}; return false; } // Abandon the import if an email address value shows up in a field that is // not an email address. if (field_type != EMAIL_ADDRESS && IsValidEmailAddress(value)) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Email address found in field of different type: " - << AutofillType::ServerFieldTypeToString(field_type) - << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Email address found in field of different type: " + << AutofillType::ServerFieldTypeToString(field_type) + << CTag{}; return false; } @@ -105,21 +101,21 @@ bool IsMinimumAddress(const AutofillProfile& profile, const std::string& variation_country_code, const std::string& app_locale, - LogBuffer* import_log_buffer) { + LogBuffer& import_log_buffer) { // Try to acquire the country code form the filled form. std::string country_code = base::UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); - if (import_log_buffer && !country_code.empty()) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormCountrySource - << "Country entry in form." << CTag{}; + if (!country_code.empty()) { + import_log_buffer << LogMessage::kImportAddressProfileFromFormCountrySource + << "Country entry in form." << CTag{}; } // As a fallback, use the finch state to get a country code. if (country_code.empty() && !variation_country_code.empty()) { country_code = variation_country_code; - if (import_log_buffer && !country_code.empty()) { - *import_log_buffer + if (!country_code.empty()) { + import_log_buffer << LogMessage::kImportAddressProfileFromFormCountrySource << "Variations service." << CTag{}; } @@ -128,8 +124,8 @@ // As the last resort, derive the country code from the app_locale. if (country_code.empty()) { country_code = AutofillCountry::CountryCodeForLocale(app_locale); - if (import_log_buffer && !country_code.empty()) { - *import_log_buffer + if (!country_code.empty()) { + import_log_buffer << LogMessage::kImportAddressProfileFromFormCountrySource << "App locale." << CTag{}; } @@ -138,18 +134,15 @@ AutofillCountry country(country_code, app_locale); // Include the details of the country to the log. - if (import_log_buffer) - *import_log_buffer << country; + import_log_buffer << country; // Check the |ADDRESS_HOME_LINE1| requirement. bool is_line1_missing = false; if (country.requires_line1() && profile.GetRawInfo(ADDRESS_HOME_LINE1).empty() && profile.GetRawInfo(ADDRESS_HOME_STREET_NAME).empty()) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Missing required ADDRESS_HOME_LINE1." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Missing required ADDRESS_HOME_LINE1." << CTag{}; is_line1_missing = true; } @@ -157,10 +150,8 @@ bool is_city_missing = false; if (country.requires_city() && profile.GetRawInfo(ADDRESS_HOME_CITY).empty()) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Missing required ADDRESS_HOME_CITY." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Missing required ADDRESS_HOME_CITY." << CTag{}; is_city_missing = true; } @@ -168,20 +159,16 @@ bool is_state_missing = false; if (country.requires_state() && profile.GetRawInfo(ADDRESS_HOME_STATE).empty()) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Missing required ADDRESS_HOME_STATE." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Missing required ADDRESS_HOME_STATE." << CTag{}; is_state_missing = true; } // Check the |ADDRESS_HOME_ZIP| requirement. bool is_zip_missing = false; if (country.requires_zip() && profile.GetRawInfo(ADDRESS_HOME_ZIP).empty()) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Missing required ADDRESS_HOME_ZIP." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Missing required ADDRESS_HOME_ZIP." << CTag{}; is_zip_missing = true; } @@ -189,12 +176,9 @@ if (country.requires_zip_or_state() && profile.GetRawInfo(ADDRESS_HOME_ZIP).empty() && profile.GetRawInfo(ADDRESS_HOME_STATE).empty()) { - if (import_log_buffer) { - *import_log_buffer - << LogMessage::kImportAddressProfileFromFormFailed - << "Missing required ADDRESS_HOME_ZIP or ADDRESS_HOME_STATE." - << CTag{}; - } + import_log_buffer + << LogMessage::kImportAddressProfileFromFormFailed + << "Missing required ADDRESS_HOME_ZIP or ADDRESS_HOME_STATE." << CTag{}; is_zip_or_state_requirement_violated = true; } @@ -356,7 +340,7 @@ const AutofillProfile& profile, const std::string& variation_country_code, const std::string& app_locale, - LogBuffer* import_log_buffer) { + LogBuffer& import_log_buffer) { // Check if the imported address qualifies as a minimum address. bool is_not_minimum_address = false; if (!IsMinimumAddress(profile, variation_country_code, app_locale, @@ -368,32 +352,28 @@ bool is_email_invalid = false; std::u16string email = profile.GetRawInfo(EMAIL_ADDRESS); if (!email.empty() && !IsValidEmailAddress(email)) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Invalid email address." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Invalid email address." << CTag{}; is_email_invalid = true; } // Reject profiles with an invalid |HOME_ADDRESS_STATE| entry. bool is_state_invalid = false; if (profile.IsPresentButInvalid(ADDRESS_HOME_STATE)) { - if (import_log_buffer) - *import_log_buffer - << LogMessage::kImportAddressProfileFromFormFailed - << "Invalid state as of AutofillProfile::IsPresentButInvalid()." - << CTag{}; + import_log_buffer + << LogMessage::kImportAddressProfileFromFormFailed + << "Invalid state as of AutofillProfile::IsPresentButInvalid()." + << CTag{}; is_state_invalid = true; } // Reject profiles with an invalid |HOME_ADDRESS_ZIP| entry. bool is_zip_invalid = false; if (profile.IsPresentButInvalid(ADDRESS_HOME_ZIP)) { - if (import_log_buffer) - *import_log_buffer - << LogMessage::kImportAddressProfileFromFormFailed - << "Invalid ZIP as of AutofillProfile::IsPresentButInvalid()." - << CTag{}; + import_log_buffer + << LogMessage::kImportAddressProfileFromFormFailed + << "Invalid ZIP as of AutofillProfile::IsPresentButInvalid()." + << CTag{}; is_zip_invalid = true; } @@ -463,6 +443,8 @@ bool FormDataImporter::ImportAddressProfiles(const FormStructure& form) { // Create a buffer to collect logging output for the autofill-internals. LogBuffer import_log_buffer; + LogManager* log_manager = client_->GetLogManager(); + import_log_buffer.set_active(log_manager && log_manager->IsLoggingActive()); import_log_buffer << LoggingScope::kAddressProfileFormImport; // Print the full form into the logging scope. import_log_buffer << LogMessage::kImportAddressProfileFromForm << form @@ -493,7 +475,7 @@ import_log_buffer << LogMessage::kImportAddressProfileFromFormSection << section << CTag{}; // Try to import an address profile from the form fields of this section. - if (ImportAddressProfileForSection(form, section, &import_log_buffer)) + if (ImportAddressProfileForSection(form, section, import_log_buffer)) num_complete_profiles++; // And close the div of the section import log. import_log_buffer << CTag{"div"}; @@ -505,7 +487,7 @@ AutofillMetrics::AddressProfileImportStatusMetric::REGULAR_IMPORT); } else if (sections.size() > 1) { // Try to import by combining all sections. - if (ImportAddressProfileForSection(form, "", &import_log_buffer)) { + if (ImportAddressProfileForSection(form, "", import_log_buffer)) { num_complete_profiles++; AutofillMetrics::LogAddressFormImportStatustMetric( AutofillMetrics::AddressProfileImportStatusMetric:: @@ -521,9 +503,7 @@ << num_complete_profiles << CTag{}; // Write log buffer to autofill-internals. - LogManager* log_manager = client_->GetLogManager(); - if (log_manager) - log_manager->Log() << std::move(import_log_buffer); + SafeLog(log_manager) << std::move(import_log_buffer); return num_complete_profiles > 0; } @@ -531,7 +511,7 @@ bool FormDataImporter::ImportAddressProfileForSection( const FormStructure& form, const std::string& section, - LogBuffer* import_log_buffer) { + LogBuffer& import_log_buffer) { // The candidate for profile import. There are many ways for the candidate to // be rejected (see everywhere this function returns false). AutofillProfile candidate_profile; @@ -610,11 +590,9 @@ if (server_field_type == EMAIL_ADDRESS && types_seen.count(server_field_type) && candidate_profile.GetRawInfo(EMAIL_ADDRESS) != value) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Multiple different email addresses present." - << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Multiple different email addresses present." + << CTag{}; has_multiple_distinct_email_addresses = true; } @@ -674,10 +652,8 @@ } // Check if the country code was still not determined correctly. if (candidate_profile.GetRawInfo(ADDRESS_HOME_COUNTRY).empty()) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Missing country." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Missing country." << CTag{}; has_invalid_country = true; } } @@ -692,10 +668,8 @@ !candidate_profile.SetInfoWithVerificationStatus( AutofillType(PHONE_HOME_WHOLE_NUMBER), constructed_number, app_locale_, VerificationStatus::kObserved)) { - if (import_log_buffer) { - *import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed - << "Invalid phone number." << CTag{}; - } + import_log_buffer << LogMessage::kImportAddressProfileFromFormFailed + << "Invalid phone number." << CTag{}; has_invalid_phone_number = true; } }
diff --git a/components/autofill/core/browser/form_data_importer.h b/components/autofill/core/browser/form_data_importer.h index ddba86c..f1c997c 100644 --- a/components/autofill/core/browser/form_data_importer.h +++ b/components/autofill/core/browser/form_data_importer.h
@@ -67,7 +67,7 @@ static bool IsValidLearnableProfile(const AutofillProfile& profile, const std::string& finch_country_code, const std::string& app_locale, - LogBuffer* import_log_buffer); + LogBuffer& import_log_buffer); // Cache the last four of the fetched virtual card so we don't offer saving // them. @@ -126,7 +126,7 @@ // performed on the union of all sections. bool ImportAddressProfileForSection(const FormStructure& form, const std::string& section, - LogBuffer* import_log_buffer); + LogBuffer& import_log_buffer); // Go through the |form| fields and attempt to extract a new credit card in // |imported_credit_card|, or update an existing card.
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index 427bb97..8e7d0a3 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -539,13 +539,17 @@ } LogBufferSubmitter LogRationalization(LogManager* log_manager) { - if (!log_manager) - return LogManager::DevNull(); - LogBufferSubmitter submitter = log_manager->Log(); + LogBufferSubmitter submitter = SafeLog(log_manager); submitter << LoggingScope::kRationalization << LogMessage::kRationalization; return submitter; } +LogBufferSubmitter LogAbortParsing(LogManager* log_manager) { + LogBufferSubmitter submitter = SafeLog(log_manager); + submitter << LoggingScope::kAbortParsing; + return submitter; +} + } // namespace class FormStructure::SectionedFieldsIndexes { @@ -1014,10 +1018,8 @@ bool FormStructure::ShouldBeParsed(LogManager* log_manager) const { // Exclude URLs not on the web via HTTP(S). if (!HasAllowedScheme(source_url_)) { - if (log_manager) { - log_manager->Log() << LoggingScope::kAbortParsing - << LogMessage::kAbortParsingNotAllowedScheme << *this; - } + LogAbortParsing(log_manager) + << LogMessage::kAbortParsingNotAllowedScheme << *this; return false; } @@ -1028,22 +1030,16 @@ (!all_fields_are_passwords() || active_field_count() < kRequiredFieldsForFormsWithOnlyPasswordFields) && !has_author_specified_types_) { - if (log_manager) { - log_manager->Log() << LoggingScope::kAbortParsing - << LogMessage::kAbortParsingNotEnoughFields - << active_field_count() << *this; - } + LogAbortParsing(log_manager) << LogMessage::kAbortParsingNotEnoughFields + << active_field_count() << *this; return false; } // Rule out search forms. if (MatchesPattern(base::UTF8ToUTF16(target_url_.path_piece()), kUrlSearchActionRe)) { - if (log_manager) { - log_manager->Log() << LoggingScope::kAbortParsing - << LogMessage::kAbortParsingUrlMatchesSearchRegex - << *this; - } + LogAbortParsing(log_manager) + << LogMessage::kAbortParsingUrlMatchesSearchRegex << *this; return false; } @@ -1053,8 +1049,8 @@ } if (!has_text_field && log_manager) { - log_manager->Log() << LoggingScope::kAbortParsing - << LogMessage::kAbortParsingFormHasNoTextfield << *this; + LogAbortParsing(log_manager) + << LogMessage::kAbortParsingFormHasNoTextfield << *this; } return has_text_field; @@ -2570,6 +2566,8 @@ } LogBuffer& operator<<(LogBuffer& buffer, const FormStructure& form) { + if (!buffer.active()) + return buffer; buffer << Tag{"div"} << Attrib{"class", "form"}; buffer << Tag{"table"}; buffer << Tr{} << "Form signature:"
diff --git a/components/autofill/core/browser/geo/autofill_country.cc b/components/autofill/core/browser/geo/autofill_country.cc index 2dc8e979..e034ba5 100644 --- a/components/autofill/core/browser/geo/autofill_country.cc +++ b/components/autofill/core/browser/geo/autofill_country.cc
@@ -82,6 +82,8 @@ // Prints a formatted log of a |AutofillCountry| to a |LogBuffer|. LogBuffer& operator<<(LogBuffer& buffer, const AutofillCountry& country) { + if (!buffer.active()) + return buffer; buffer << LogMessage::kImportAddressProfileFromFormAddressRequirements; buffer << Tag{"div"} << Attrib{"class", "country_data"}; buffer << Tag{"table"};
diff --git a/components/autofill/core/browser/logging/log_manager.cc b/components/autofill/core/browser/logging/log_manager.cc index 41fe08d..6664ed9 100644 --- a/components/autofill/core/browser/logging/log_manager.cc +++ b/components/autofill/core/browser/logging/log_manager.cc
@@ -111,4 +111,8 @@ return LogBufferSubmitter(nullptr, false); } +LogBufferSubmitter SafeLog(LogManager* log_manager) { + return log_manager ? log_manager->Log() : LogManager::DevNull(); +} + } // namespace autofill
diff --git a/components/autofill/core/browser/logging/log_manager.h b/components/autofill/core/browser/logging/log_manager.h index 1794f6a..7bd12bb 100644 --- a/components/autofill/core/browser/logging/log_manager.h +++ b/components/autofill/core/browser/logging/log_manager.h
@@ -56,12 +56,30 @@ base::RepeatingClosure notification_callback); // This is the preferred way to submitting log entries. + // + // In case you often find yourself writing the following code: + // if (log_manager) { + // log_manager->Log() << ...; + // } + // You can use + // SafeLog(log_manager) << ...; + // + // If you want to prefix all log messages, you can write the following: + // LogBufferSubmitter LogWithScope(LogManager* log_manager) { + // LogBufferSubmitter submitter = SafeLog(log_manager); + // submitter << LoggingScope::kMyLoggingScope; + // return submitter; + // } virtual LogBufferSubmitter Log() = 0; // Returns a LogBufferSubmitter that ignores all input. static LogBufferSubmitter DevNull(); }; +// Returns a LogBufferSubmitter for |log_buffer| if it is not null, otherwise +// LogManager::DevNull(); +LogBufferSubmitter SafeLog(LogManager* log_manager); + } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LOGGING_LOG_MANAGER_H_
diff --git a/components/autofill/core/browser/metrics/form_event_logger_base.cc b/components/autofill/core/browser/metrics/form_event_logger_base.cc index e7672cc..a099968 100644 --- a/components/autofill/core/browser/metrics/form_event_logger_base.cc +++ b/components/autofill/core/browser/metrics/form_event_logger_base.cc
@@ -258,6 +258,8 @@ void FormEventLoggerBase::RecordFunnelAndKeyMetrics() { LogBuffer funnel_rows; LogBuffer key_metrics_rows; + for (LogBuffer* buffer : {&funnel_rows, &key_metrics_rows}) + buffer->set_active(log_manager_ && log_manager_->IsLoggingActive()); funnel_rows << Tr{} << "Form Type: " << form_type_name_; key_metrics_rows << Tr{} << "Form Type: " << form_type_name_; @@ -351,14 +353,12 @@ << has_logged_will_submit_; } - if (log_manager_) { - log_manager_->Log() << LoggingScope::kMetrics << LogMessage::kFunnelMetrics + SafeLog(log_manager_) << LoggingScope::kMetrics << LogMessage::kFunnelMetrics << Tag{"table"} << std::move(funnel_rows) << CTag{"table"}; - log_manager_->Log() << LoggingScope::kMetrics << LogMessage::kKeyMetrics + SafeLog(log_manager_) << LoggingScope::kMetrics << LogMessage::kKeyMetrics << Tag{"table"} << std::move(key_metrics_rows) << CTag{"table"}; - } } void FormEventLoggerBase::RecordAblationMetrics() {
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 6a0b206..16c2f8d 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -722,13 +722,35 @@ if (is_off_the_record_) return; + if (!database_helper_->GetLocalDatabase()) + return; + + // If the profile is empty, remove it unconditionally. if (profile.IsEmpty(app_locale_)) { RemoveByGUID(profile.guid()); return; } - if (!database_helper_->GetLocalDatabase()) + // The profile is a duplicate of an existing profile if it has a distinct GUID + // but the same content. + auto duplicate_profile_iter = base::ranges::find_if( + web_profiles_, [&profile](const auto& other_profile) { + return profile.guid() != other_profile->guid() && + other_profile->Compare(profile) == 0; + }); + + // Remove the profile if it is a duplicate of another already existing + // profile. + if (duplicate_profile_iter != web_profiles_.end()) { + // Keep the more recently used version of the profile. + if (profile.use_date() > duplicate_profile_iter->get()->use_date()) { + UpdateProfileInDB(profile); + RemoveByGUID(duplicate_profile_iter->get()->guid()); + } else { + RemoveByGUID(profile.guid()); + } return; + } UpdateProfileInDB(profile); }
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 7fcf7c0e..a7796005f 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -6903,6 +6903,87 @@ AutofillProfile::CLIENT)); } +// Tests that the least recently used profile of two existing profiles is +// deleted, when an update of one of the profiles makes it a duplicate of the +// other, already existing profile. Here, the less recently used profile is +// edited to become a duplicate of the more recently used profile. +TEST_F(PersonalDataManagerTest, CreateDuplicateWithAnUpdate) { + TestAutofillClock test_clock; + test_clock.SetNow(kArbitraryTime); + + AutofillProfile more_recently_used_profile(test::GetFullProfile()); + AutofillProfile less_recently_used_profile(test::GetFullProfile2()); + + base::Time older_use_date = AutofillClock::Now(); + less_recently_used_profile.set_use_date(older_use_date); + test_clock.Advance(base::TimeDelta::FromDays(1)); + + // Set more recently used profile to have a use date that is newer than + // `older_use_date`. + base::Time newer_use_data = AutofillClock::Now(); + more_recently_used_profile.set_use_date(newer_use_data); + + AddProfileToPersonalDataManager(more_recently_used_profile); + AddProfileToPersonalDataManager(less_recently_used_profile); + + EXPECT_EQ(personal_data_->GetProfiles().size(), 2U); + + // Now make an update to less recently used profile that makes it a duplicate + // of the more recently used profile. + AutofillProfile updated_less_recently_used_profile = + more_recently_used_profile; + updated_less_recently_used_profile.set_guid( + less_recently_used_profile.guid()); + // Set the updated profile to have a older use date than it's duplicate. + updated_less_recently_used_profile.set_use_date(older_use_date); + UpdateProfileOnPersonalDataManager(updated_less_recently_used_profile); + + // Verify that the less recently used profile was removed. + ASSERT_EQ(personal_data_->GetProfiles().size(), 1U); + EXPECT_EQ(*personal_data_->GetProfiles()[0], more_recently_used_profile); + EXPECT_EQ(personal_data_->GetProfiles()[0]->use_date(), newer_use_data); +} + +// Tests that the least recently used profile of two existing profiles is +// deleted, when an update of one of the profiles makes it a duplicate of the +// other, already existing profile. Here, the more recently used profile is +// edited to become a duplicate of the less recently used profile. +TEST_F(PersonalDataManagerTest, + CreateDuplicateWithAnUpdate_UpdatedProfileWasMoreRecentlyUsed) { + TestAutofillClock test_clock; + test_clock.SetNow(kArbitraryTime); + + AutofillProfile less_recently_used_profile(test::GetFullProfile()); + AutofillProfile more_recently_used_profile(test::GetFullProfile2()); + + less_recently_used_profile.set_use_date(AutofillClock::Now()); + more_recently_used_profile.set_use_date(AutofillClock::Now()); + + AddProfileToPersonalDataManager(less_recently_used_profile); + AddProfileToPersonalDataManager(more_recently_used_profile); + + EXPECT_EQ(personal_data_->GetProfiles().size(), 2U); + + // Now make an update to profile2 that makes it a duplicate of profile1, + // but set the last use time to be more recent than the one of profile1. + AutofillProfile updated_more_recently_used_profile = + less_recently_used_profile; + updated_more_recently_used_profile.set_guid( + more_recently_used_profile.guid()); + // Set the updated profile to have a newer use date than it's duplicate. + test_clock.Advance(base::TimeDelta::FromDays(1)); + base::Time newer_use_data = AutofillClock::Now(); + updated_more_recently_used_profile.set_use_date(newer_use_data); + UpdateProfileOnPersonalDataManager(updated_more_recently_used_profile); + + // Verify that less recently used profile was removed. + ASSERT_EQ(personal_data_->GetProfiles().size(), 1U); + + EXPECT_EQ(*personal_data_->GetProfiles()[0], + updated_more_recently_used_profile); + EXPECT_EQ(personal_data_->GetProfiles()[0]->use_date(), newer_use_data); +} + TEST_F(PersonalDataManagerTest, GetAccountInfoForPaymentsServer) { // Make the IdentityManager return a non-empty AccountInfo when // GetPrimaryAccountInfo() is called.
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc index a80491b..8597717 100644 --- a/components/autofill/core/common/form_data.cc +++ b/components/autofill/core/common/form_data.cc
@@ -268,6 +268,8 @@ } LogBuffer& operator<<(LogBuffer& buffer, const FormData& form) { + if (!buffer.active()) + return buffer; buffer << Tag{"div"} << Attrib{"class", "form"}; buffer << Tag{"table"}; buffer << Tr{} << "Form name:" << form.name;
diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc index bdf2d18..38c8a75d 100644 --- a/components/autofill/core/common/form_field_data.cc +++ b/components/autofill/core/common/form_field_data.cc
@@ -484,6 +484,8 @@ } LogBuffer& operator<<(LogBuffer& buffer, const FormFieldData& field) { + if (!buffer.active()) + return buffer; buffer << Tag{"table"}; buffer << Tr{} << "Name:" << field.name; buffer << Tr{} << "Unique id:" << field.global_id();
diff --git a/components/autofill/core/common/logging/log_buffer.h b/components/autofill/core/common/logging/log_buffer.h index baf86250..5be9c65 100644 --- a/components/autofill/core/common/logging/log_buffer.h +++ b/components/autofill/core/common/logging/log_buffer.h
@@ -46,6 +46,14 @@ // LogBuffer buffer; // for (...) { buffer << something; } // LogBuffer() << std::move(buffer); +// +// You can override the streaming operator for your own class as follows: +// LogBuffer& operator<<(LogBuffer& buffer, const YourClass& obj) { +// if (!buffer.active()) +// return buf; +// buffer << obj.something; +// return buffer; +// } namespace autofill {
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index 5342ed08..6bcdd389 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -163,14 +163,6 @@ return script; } - static void RunOnce(SupportedScriptProto* proto) { - auto* run_once = proto->mutable_presentation() - ->mutable_precondition() - ->add_script_status_match(); - run_once->set_script(proto->path()); - run_once->set_status(SCRIPT_STATUS_NOT_RUN); - } - void SetupScripts(SupportsScriptResponseProto scripts) { std::string scripts_str; scripts.SerializeToString(&scripts_str); @@ -325,8 +317,7 @@ TEST_F(ControllerTest, FetchAndRunScriptsWithChip) { SupportsScriptResponseProto script_response; AddRunnableScript(&script_response, "script1"); - auto* script2 = AddRunnableScript(&script_response, "script2"); - RunOnce(script2); + AddRunnableScript(&script_response, "script2"); SetNextScriptResponse(script_response); testing::InSequence seq; @@ -350,11 +341,16 @@ .WillOnce(RunOnceCallback<5>(net::HTTP_OK, "")); EXPECT_TRUE(controller_->PerformUserAction(1)); - // Offering the remaining choice: script1 as script2 can only run once. + // Offering the same scripts again. EXPECT_EQ(AutofillAssistantState::PROMPT, controller_->GetState()); - EXPECT_THAT(controller_->GetUserActions(), - ElementsAre(Property(&UserAction::chip, - Field(&Chip::text, StrEq("script1"))))); + EXPECT_THAT( + controller_->GetUserActions(), + UnorderedElementsAre(Property(&UserAction::chip, + AllOf(Field(&Chip::text, StrEq("script1")), + Field(&Chip::type, NORMAL_ACTION))), + Property(&UserAction::chip, + AllOf(Field(&Chip::text, StrEq("script2")), + Field(&Chip::type, NORMAL_ACTION))))); } TEST_F(ControllerTest, ReportDirectActions) { @@ -688,8 +684,6 @@ SupportsScriptResponseProto script_response; auto* autostart = AddRunnableScript(&script_response, "runnable"); autostart->mutable_presentation()->set_autostart(true); - RunOnce(autostart); - SetRepeatedScriptResponse(script_response); Start("http://a.example.com/path"); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); @@ -706,7 +700,6 @@ SupportsScriptResponseProto script_response; auto* autostart = AddRunnableScript(&script_response, "runnable"); autostart->mutable_presentation()->set_autostart(true); - RunOnce(autostart); SetRepeatedScriptResponse(script_response); EXPECT_CALL(mock_observer_, OnUserActionsChanged(SizeIs(0u))) @@ -860,47 +853,6 @@ EXPECT_FALSE(controller_->GetProgressActiveStep().has_value()); } -TEST_F(ControllerTest, StateChanges) { - EXPECT_EQ(AutofillAssistantState::INACTIVE, GetUiDelegate()->GetState()); - - SupportsScriptResponseProto script_response; - auto* script1 = AddRunnableScript(&script_response, "script1"); - RunOnce(script1); - auto* script2 = AddRunnableScript(&script_response, "script2"); - RunOnce(script2); - SetNextScriptResponse(script_response); - - Start("http://a.example.com/path"); - EXPECT_THAT(states_, - ElementsAre(AutofillAssistantState::STARTING, - AutofillAssistantState::AUTOSTART_FALLBACK_PROMPT)); - - // Run script1: State should become RUNNING, as there's another script, then - // go back to prompt to propose that script. - states_.clear(); - ASSERT_THAT(controller_->GetUserActions(), SizeIs(2)); - EXPECT_TRUE(controller_->PerformUserAction(0)); - - EXPECT_EQ(AutofillAssistantState::PROMPT, GetUiDelegate()->GetState()); - EXPECT_THAT(states_, ElementsAre(AutofillAssistantState::RUNNING, - AutofillAssistantState::PROMPT)); - - // Run script2: State should become STOPPED, as there are no more runnable - // scripts. - states_.clear(); - ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); - EXPECT_TRUE(controller_->PerformUserAction(0)); - - EXPECT_EQ(AutofillAssistantState::STOPPED, GetUiDelegate()->GetState()); - EXPECT_THAT(states_, ElementsAre(AutofillAssistantState::RUNNING, - AutofillAssistantState::PROMPT, - AutofillAssistantState::STOPPED)); - - // The cancel button is removed and the feedback chip is displayed. - ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); - EXPECT_EQ(FEEDBACK_ACTION, controller_->GetUserActions().at(0).chip().type); -} - TEST_F(ControllerTest, AttachUIWhenStarting) { EXPECT_CALL(mock_client_, AttachUI()); Start();
diff --git a/components/autofill_assistant/browser/full_card_requester_unittest.cc b/components/autofill_assistant/browser/full_card_requester_unittest.cc index 5c0b5a3a..10b0187e 100644 --- a/components/autofill_assistant/browser/full_card_requester_unittest.cc +++ b/components/autofill_assistant/browser/full_card_requester_unittest.cc
@@ -15,12 +15,13 @@ #include "components/autofill/core/browser/payments/card_unmask_delegate.h" #include "components/autofill/core/browser/payments/test_payments_client.h" #include "components/autofill/core/browser/test_autofill_client.h" -#include "components/autofill/core/browser/test_autofill_driver.h" #include "components/autofill_assistant/browser/mock_personal_data_manager.h" #include "content/public/test/browser_task_environment.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_renderer_host.h" #include "content/public/test/web_contents_tester.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" namespace autofill_assistant { @@ -46,16 +47,18 @@ void SetUp() override { web_contents_ = content::WebContentsTester::CreateTestWebContents( &browser_context_, nullptr); - autofill_driver_ = - std::make_unique<testing::NiceMock<autofill::TestAutofillDriver>>(); autofill_client_.SetPrefs(autofill::test::PrefServiceForTesting()); autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( web_contents_.get(), &autofill_client_, "en-US", autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); autofill_client_.set_test_payments_client( std::make_unique<autofill::payments::TestPaymentsClient>( - autofill_driver_->GetURLLoaderFactory(), + test_url_loader_factory_.GetSafeWeakWrapper(), autofill_client_.GetIdentityManager(), &personal_data_manager_)); + // Navigate to a site so that the ContentAutofillDriverFactory creates a + // ContentAutofillDriver for the frame. + content::WebContentsTester::For(web_contents_.get()) + ->NavigateAndCommit(GURL("about:blank"), ui::PAGE_TRANSITION_TYPED); } protected: @@ -63,7 +66,7 @@ content::RenderViewHostTestEnabler rvh_test_enabler_; content::TestBrowserContext browser_context_; std::unique_ptr<content::WebContents> web_contents_; - std::unique_ptr<autofill::TestAutofillDriver> autofill_driver_; + ::network::TestURLLoaderFactory test_url_loader_factory_; MockAutofillClient autofill_client_; scoped_refptr<autofill::AutofillWebDataService> database_; MockPersonalDataManager personal_data_manager_;
diff --git a/components/autofill_assistant/browser/script_executor.cc b/components/autofill_assistant/browser/script_executor.cc index 9b4695d..84c9566 100644 --- a/components/autofill_assistant/browser/script_executor.cc +++ b/components/autofill_assistant/browser/script_executor.cc
@@ -70,7 +70,7 @@ const std::string& global_payload, const std::string& script_payload, ScriptExecutor::Listener* listener, - std::map<std::string, ScriptStatusProto>* scripts_state, + std::map<std::string, ScriptStatus>* scripts_state, const std::vector<std::unique_ptr<Script>>* ordered_interrupts, ScriptExecutorDelegate* delegate) : script_path_(script_path), @@ -101,7 +101,7 @@ #else DVLOG(2) << "Starting script " << script_path_; #endif - (*scripts_state_)[script_path_] = SCRIPT_STATUS_RUNNING; + (*scripts_state_)[script_path_] = ScriptStatus::RUNNING; DCHECK(user_data); user_data_ = user_data; @@ -932,7 +932,7 @@ void ScriptExecutor::RunCallbackWithResult(const Result& result) { DCHECK(callback_); (*scripts_state_)[script_path_] = - result.success ? SCRIPT_STATUS_SUCCESS : SCRIPT_STATUS_FAILURE; + result.success ? ScriptStatus::SUCCESS : ScriptStatus::FAILURE; std::move(callback_).Run(result); } @@ -1213,7 +1213,7 @@ interrupt->precondition->Check( delegate_->GetCurrentURL(), batch_element_checker_.get(), - *delegate_->GetTriggerContext(), *main_script_->scripts_state_, + *delegate_->GetTriggerContext(), base::BindOnce(&WaitForDomOperation::OnPreconditionCheckDone, weak_ptr_factory_.GetWeakPtr(), interrupt->handle.path));
diff --git a/components/autofill_assistant/browser/script_executor.h b/components/autofill_assistant/browser/script_executor.h index ad04166..394e5f9 100644 --- a/components/autofill_assistant/browser/script_executor.h +++ b/components/autofill_assistant/browser/script_executor.h
@@ -40,6 +40,23 @@ public ScriptExecutorDelegate::NavigationListener, public ScriptExecutorDelegate::Listener { public: + // States a script can end up in. + enum class ScriptStatus { + // Never explicitly set. Reading this value means the enum field is either + // not set or set to a value not listed here. + UNKNOWN, + // The script finished successfully. + SUCCESS, + // The script failed. + FAILURE, + // The user cancelled the script. + CANCELLED, + // The script is currently running. + RUNNING, + // The script was not run. + NOT_RUN, + }; + // Listens to events on ScriptExecutor. // TODO(b/806868): Make global_payload a part of callback instead of the // listener. @@ -66,7 +83,7 @@ const std::string& global_payload, const std::string& script_payload, ScriptExecutor::Listener* listener, - std::map<std::string, ScriptStatusProto>* scripts_state, + std::map<std::string, ScriptStatus>* scripts_state, const std::vector<std::unique_ptr<Script>>* ordered_interrupts, ScriptExecutorDelegate* delegate); ~ScriptExecutor() override; @@ -465,7 +482,7 @@ // change while the script is running, as a result of OnScriptListChanged // being called. const std::vector<std::unique_ptr<Script>>* const ordered_interrupts_; - std::map<std::string, ScriptStatusProto>* const scripts_state_; + std::map<std::string, ScriptStatus>* const scripts_state_; RunScriptCallback callback_; std::vector<std::unique_ptr<Action>> actions_; std::vector<ProcessedActionProto> processed_actions_;
diff --git a/components/autofill_assistant/browser/script_executor_unittest.cc b/components/autofill_assistant/browser/script_executor_unittest.cc index b56dc51c..f8ba8205 100644 --- a/components/autofill_assistant/browser/script_executor_unittest.cc +++ b/components/autofill_assistant/browser/script_executor_unittest.cc
@@ -159,7 +159,7 @@ Script script_; StrictMock<MockService> mock_service_; NiceMock<MockWebController> mock_web_controller_; - std::map<std::string, ScriptStatusProto> scripts_state_; + std::map<std::string, ScriptExecutor::ScriptStatus> scripts_state_; std::vector<std::unique_ptr<Script>> ordered_interrupts_; std::string last_global_payload_; @@ -892,8 +892,9 @@ EXPECT_THAT(scripts_state_, IsEmpty()); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_RUNNING))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::RUNNING))); } TEST_F(ScriptExecutorTest, UpdateScriptStateOnError) { @@ -903,8 +904,9 @@ Run(Field(&ScriptExecutor::Result::success, false))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_FAILURE))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::FAILURE))); } TEST_F(ScriptExecutorTest, UpdateScriptStateOnSuccess) { @@ -919,8 +921,9 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); } TEST_F(ScriptExecutorTest, ForwardLastPayloadOnSuccess) { @@ -1020,10 +1023,12 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::SUCCESS))); // The first script to call OnGetNextActions is the interrupt, which starts // with a tell. @@ -1064,12 +1069,15 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt1", SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt2", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt1", ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt2", ScriptExecutor::ScriptStatus::SUCCESS))); } TEST_F(ScriptExecutorTest, RunSameInterruptMultipleTimes) { @@ -1177,8 +1185,9 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); EXPECT_THAT(scripts_state_, Not(Contains(Pair(StrEq("interrupt"), _)))); } @@ -1203,8 +1212,9 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); EXPECT_THAT(scripts_state_, Not(Contains(Pair(StrEq("interrupt"), _)))); } @@ -1233,10 +1243,12 @@ Run(Field(&ScriptExecutor::Result::success, false))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_FAILURE))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_FAILURE))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::FAILURE))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::FAILURE))); } TEST_F(ScriptExecutorTest, InterruptReturnsShutdown) { @@ -1265,10 +1277,12 @@ ScriptExecutor::SHUTDOWN)))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::SUCCESS))); } TEST_F(ScriptExecutorTest, RunInterruptDuringPrompt) { @@ -1309,10 +1323,12 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::SUCCESS))); // Expected scenario: // - show prompt (enter PROMPT state) @@ -1410,14 +1426,17 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); for (int try_count = 0; - try_count < 10 && scripts_state_[kScriptPath] == SCRIPT_STATUS_RUNNING; + try_count < 10 && + scripts_state_[kScriptPath] == ScriptExecutor::ScriptStatus::RUNNING; try_count++) { task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1000)); } - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::SUCCESS))); EXPECT_THAT( delegate_.GetStateHistory(), @@ -1526,10 +1545,12 @@ Run(Field(&ScriptExecutor::Result::success, true))); executor_->Run(&user_data_, executor_callback_.Get()); - EXPECT_THAT(scripts_state_, - Contains(Pair(kScriptPath, SCRIPT_STATUS_SUCCESS))); - EXPECT_THAT(scripts_state_, - Contains(Pair("interrupt", SCRIPT_STATUS_SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair(kScriptPath, ScriptExecutor::ScriptStatus::SUCCESS))); + EXPECT_THAT( + scripts_state_, + Contains(Pair("interrupt", ScriptExecutor::ScriptStatus::SUCCESS))); EXPECT_TRUE(should_update_scripts_); EXPECT_THAT(scripts_update_, SizeIs(1));
diff --git a/components/autofill_assistant/browser/script_precondition.cc b/components/autofill_assistant/browser/script_precondition.cc index 9b3865b..3603a6b3 100644 --- a/components/autofill_assistant/browser/script_precondition.cc +++ b/components/autofill_assistant/browser/script_precondition.cc
@@ -55,7 +55,6 @@ // reject them. return std::make_unique<ScriptPrecondition>( script_precondition_proto.domain(), std::move(path_pattern), - script_precondition_proto.script_status_match(), script_precondition_proto.script_parameter_match(), script_precondition_proto.element_condition()); } @@ -66,10 +65,8 @@ const GURL& url, BatchElementChecker* batch_checks, const TriggerContext& context, - const std::map<std::string, ScriptStatusProto>& executed_scripts, base::OnceCallback<void(bool)> callback) { - if (!MatchDomain(url) || !MatchPath(url) || !MatchParameters(context) || - !MatchScriptStatus(executed_scripts)) { + if (!MatchDomain(url) || !MatchPath(url) || !MatchParameters(context)) { std::move(callback).Run(false); return; } @@ -81,15 +78,12 @@ ScriptPrecondition::ScriptPrecondition( const google::protobuf::RepeatedPtrField<std::string>& domain_match, std::vector<std::unique_ptr<re2::RE2>> path_pattern, - const google::protobuf::RepeatedPtrField<ScriptStatusMatchProto>& - status_match, const google::protobuf::RepeatedPtrField<ScriptParameterMatchProto>& parameter_match, const ElementConditionProto& element_condition) : domain_match_(domain_match.begin(), domain_match.end()), path_pattern_(std::move(path_pattern)), parameter_match_(parameter_match.begin(), parameter_match.end()), - status_match_(status_match.begin(), status_match.end()), element_precondition_(element_condition) {} bool ScriptPrecondition::MatchDomain(const GURL& url) const { @@ -127,28 +121,4 @@ return true; } -bool ScriptPrecondition::MatchScriptStatus( - const std::map<std::string, ScriptStatusProto>& executed_scripts) const { - for (const auto& status_match : status_match_) { - auto status = SCRIPT_STATUS_NOT_RUN; - auto iter = executed_scripts.find(status_match.script()); - if (iter != executed_scripts.end()) { - status = iter->second; - } - bool has_same_status = status_match.status() == status; - switch (status_match.comparator()) { - case ScriptStatusMatchProto::DIFFERENT: - if (has_same_status) - return false; - break; - case ScriptStatusMatchProto::EQUAL: - default: - if (!has_same_status) - return false; - break; - } - } - return true; -} - } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/script_precondition.h b/components/autofill_assistant/browser/script_precondition.h index cb2a304f..45ea069 100644 --- a/components/autofill_assistant/browser/script_precondition.h +++ b/components/autofill_assistant/browser/script_precondition.h
@@ -41,8 +41,6 @@ ScriptPrecondition( const google::protobuf::RepeatedPtrField<std::string>& domain_match, std::vector<std::unique_ptr<re2::RE2>> path_pattern, - const google::protobuf::RepeatedPtrField<ScriptStatusMatchProto>& - status_match, const google::protobuf::RepeatedPtrField<ScriptParameterMatchProto>& parameter_match, const ElementConditionProto& must_match); @@ -57,15 +55,12 @@ void Check(const GURL& url, BatchElementChecker* batch_checks, const TriggerContext& context, - const std::map<std::string, ScriptStatusProto>& executed_scripts, base::OnceCallback<void(bool)> callback); private: bool MatchDomain(const GURL& url) const; bool MatchPath(const GURL& url) const; bool MatchParameters(const TriggerContext& context) const; - bool MatchScriptStatus( - const std::map<std::string, ScriptStatusProto>& executed_scripts) const; // Domain (exact match) excluding the last '/' character. std::set<std::string> domain_match_; @@ -76,9 +71,6 @@ // Condition on parameters, identified by name, as found in the intent. std::vector<ScriptParameterMatchProto> parameter_match_; - // Conditions regarding the execution status of passed scripts. - std::vector<ScriptStatusMatchProto> status_match_; - ElementPrecondition element_precondition_; DISALLOW_COPY_AND_ASSIGN(ScriptPrecondition);
diff --git a/components/autofill_assistant/browser/script_precondition_unittest.cc b/components/autofill_assistant/browser/script_precondition_unittest.cc index 524ef708..97a1e00 100644 --- a/components/autofill_assistant/browser/script_precondition_unittest.cc +++ b/components/autofill_assistant/browser/script_precondition_unittest.cc
@@ -83,8 +83,7 @@ DirectCallback callback; BatchElementChecker batch_checks; - precondition->Check(url_, &batch_checks, *trigger_context_, - executed_scripts_, callback.Get()); + precondition->Check(url_, &batch_checks, *trigger_context_, callback.Get()); batch_checks.Run(&mock_web_controller_); return callback.GetResultOrDie(); } @@ -92,7 +91,6 @@ GURL url_; MockWebController mock_web_controller_; std::unique_ptr<TriggerContext> trigger_context_; - std::map<std::string, ScriptStatusProto> executed_scripts_; }; TEST_F(ScriptPreconditionTest, NoConditions) { @@ -179,72 +177,6 @@ EXPECT_EQ(nullptr, ScriptPrecondition::FromProto("unused", proto)); } -TEST_F(ScriptPreconditionTest, WrongScriptStatusEqualComparator) { - ScriptPreconditionProto proto; - - ScriptStatusMatchProto* script_status_match = proto.add_script_status_match(); - script_status_match->set_script("previous_script_success"); - script_status_match->set_comparator(ScriptStatusMatchProto::EQUAL); - script_status_match->set_status(SCRIPT_STATUS_NOT_RUN); - executed_scripts_["previous_script_success"] = SCRIPT_STATUS_SUCCESS; - - EXPECT_FALSE(Check(proto)); -} - -TEST_F(ScriptPreconditionTest, WrongScriptStatusDifferentComparator) { - ScriptPreconditionProto proto; - - ScriptStatusMatchProto* script_status_match = proto.add_script_status_match(); - script_status_match->set_script("previous_script_success"); - script_status_match->set_comparator(ScriptStatusMatchProto::DIFFERENT); - script_status_match->set_status(SCRIPT_STATUS_NOT_RUN); - executed_scripts_["previous_script_success"] = SCRIPT_STATUS_SUCCESS; - - EXPECT_TRUE(Check(proto)); -} - -TEST_F(ScriptPreconditionTest, WrongScriptStatusComparatorNotSet) { - ScriptPreconditionProto proto; - - ScriptStatusMatchProto* script_status_match = proto.add_script_status_match(); - script_status_match->set_script("previous_script_success"); - script_status_match->set_comparator(ScriptStatusMatchProto::EQUAL); - script_status_match->set_status(SCRIPT_STATUS_NOT_RUN); - executed_scripts_["previous_script_success"] = SCRIPT_STATUS_SUCCESS; - - EXPECT_FALSE(Check(proto)); -} - -TEST_F(ScriptPreconditionTest, WrongScriptStatus) { - ScriptPreconditionProto proto; - - ScriptStatusMatchProto* script_status_match = proto.add_script_status_match(); - script_status_match->set_script("previous_script_success"); - script_status_match->set_comparator(ScriptStatusMatchProto::EQUAL); - script_status_match->set_status(SCRIPT_STATUS_NOT_RUN); - executed_scripts_["previous_script_success"] = SCRIPT_STATUS_SUCCESS; - - EXPECT_FALSE(Check(proto)); -} - -TEST_F(ScriptPreconditionTest, MultipleScriptStatus) { - ScriptPreconditionProto proto; - - ScriptStatusMatchProto* previous1 = proto.add_script_status_match(); - previous1->set_script("previous1"); - previous1->set_comparator(ScriptStatusMatchProto::EQUAL); - previous1->set_status(SCRIPT_STATUS_SUCCESS); - - ScriptStatusMatchProto* previous2 = proto.add_script_status_match(); - previous2->set_script("previous2"); - previous2->set_comparator(ScriptStatusMatchProto::DIFFERENT); - previous2->set_status(SCRIPT_STATUS_NOT_RUN); - - executed_scripts_["previous1"] = SCRIPT_STATUS_SUCCESS; - - EXPECT_FALSE(Check(proto)); -} - TEST_F(ScriptPreconditionTest, ParameterMustExist) { ScriptPreconditionProto proto; ScriptParameterMatchProto* match = proto.add_script_parameter_match();
diff --git a/components/autofill_assistant/browser/script_tracker.cc b/components/autofill_assistant/browser/script_tracker.cc index 12bd019..ad13d2a 100644 --- a/components/autofill_assistant/browser/script_tracker.cc +++ b/components/autofill_assistant/browser/script_tracker.cc
@@ -85,7 +85,6 @@ script->precondition->Check( url, batch_element_checker_.get(), *delegate_->GetTriggerContext(), - scripts_state_, base::BindOnce(&ScriptTracker::OnPreconditionCheck, weak_ptr_factory_.GetWeakPtr(), script->handle.path)); } @@ -153,14 +152,6 @@ base::Base64Encode(last_script_payload_js, &last_script_payload_js); dict.SetKey("last-script-payload", base::Value(last_script_payload_js)); - std::vector<base::Value> scripts_state_js; - for (const auto& entry : scripts_state_) { - base::Value script_js = base::Value(base::Value::Type::DICTIONARY); - script_js.SetKey(entry.first, base::Value(entry.second)); - scripts_state_js.push_back(std::move(script_js)); - } - dict.SetKey("executed-scripts", base::Value(scripts_state_js)); - std::vector<base::Value> available_scripts_js; for (const std::unique_ptr<Script>& script : available_scripts_) available_scripts_js.push_back(base::Value(script->handle.path));
diff --git a/components/autofill_assistant/browser/script_tracker.h b/components/autofill_assistant/browser/script_tracker.h index d326515..e99954d 100644 --- a/components/autofill_assistant/browser/script_tracker.h +++ b/components/autofill_assistant/browser/script_tracker.h
@@ -154,7 +154,11 @@ std::vector<std::unique_ptr<Script>> interrupts_; // List of scripts that have been executed and their corresponding statuses. - std::map<std::string, ScriptStatusProto> scripts_state_; + // + // TODO(b/192823175): Note that this map's only remaining use is in tests and + // can be removed once the testing code has been refactored to no longer + // depend on this field. + std::map<std::string, ScriptExecutor::ScriptStatus> scripts_state_; std::unique_ptr<BatchElementChecker> batch_element_checker_;
diff --git a/components/autofill_assistant/browser/script_tracker_unittest.cc b/components/autofill_assistant/browser/script_tracker_unittest.cc index 60836b71..a383bef 100644 --- a/components/autofill_assistant/browser/script_tracker_unittest.cc +++ b/components/autofill_assistant/browser/script_tracker_unittest.cc
@@ -100,13 +100,6 @@ ->mutable_element_condition() ->mutable_match() = ToSelectorProto(selector); } - ScriptStatusMatchProto dont_run_twice_precondition; - dont_run_twice_precondition.set_script(path); - dont_run_twice_precondition.set_comparator(ScriptStatusMatchProto::EQUAL); - dont_run_twice_precondition.set_status(SCRIPT_STATUS_NOT_RUN); - *script->mutable_presentation() - ->mutable_precondition() - ->add_script_status_match() = dont_run_twice_precondition; } const std::vector<ScriptHandle>& runnable_scripts() { @@ -246,32 +239,6 @@ EXPECT_EQ(2, runnable_scripts_changed_); } -TEST_F(ScriptTrackerTest, CheckScriptsAgainAfterScriptEnd) { - InitScriptProto(AddScript(), "script 1", "script1", "exists"); - InitScriptProto(AddScript(), "script 2", "script2", "exists"); - SetAndCheckScripts(); - - // Both scripts are runnable - EXPECT_EQ(1, runnable_scripts_changed_); - EXPECT_THAT(runnable_script_paths(), - UnorderedElementsAre("script1", "script2")); - - // run 'script 1' - base::MockCallback<ScriptExecutor::RunScriptCallback> execute_callback; - EXPECT_CALL(execute_callback, - Run(Field(&ScriptExecutor::Result::success, true))); - - tracker_.ExecuteScript("script1", &user_data_, - std::make_unique<TriggerContext>(), - execute_callback.Get()); - tracker_.CheckScripts(); - - // The 2nd time the scripts are checked, automatically after the script runs, - // 'script1' isn't runnable anymore, because it's already been run. - EXPECT_EQ(2, runnable_scripts_changed_); - EXPECT_THAT(runnable_script_paths(), ElementsAre("script2")); -} - TEST_F(ScriptTrackerTest, CheckScriptsAfterDOMChange) { EXPECT_CALL(mock_web_controller_, OnFindElement(Selector({"maybe_exists"}), _))
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 4803327..7271d6e 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -377,41 +377,6 @@ reserved 3; } -enum ScriptStatusProto { - // Never explicitly set. Reading this value means the enum field is either - // not set or set to a value not listed here. - UNKNOWN_SCRIPT_STATUS = 0; - // The script finished successfully. - SCRIPT_STATUS_SUCCESS = 1; - // The script failed. - SCRIPT_STATUS_FAILURE = 2; - // The user cancelled the script. - SCRIPT_STATUS_CANCELLED = 3; - // The script is currently running. - SCRIPT_STATUS_RUNNING = 4; - // The script was not run. - SCRIPT_STATUS_NOT_RUN = 5; -} - -// Condition on the status of a previous script run. -message ScriptStatusMatchProto { - enum Comparator { - UNSPECIFIED = 0; - EQUAL = 1; - DIFFERENT = 2; - } - - // Required. Path of the script whose status should be checked. - optional string script = 1; - - // Required. The status the script should have for the condition to hold. - optional ScriptStatusProto status = 2; - - // Optional. The comparison performed when checking the status. It will be - // interpreted as EQUAL if not set. - optional Comparator comparator = 3; -} - message ScriptPreconditionProto { // Pattern of the path parts of the URL, including query and '#''. repeated string path_pattern = 5; @@ -420,12 +385,11 @@ // Combined with AND: all matches must be true for precondition to hold. repeated ScriptParameterMatchProto script_parameter_match = 7; - repeated ScriptStatusMatchProto script_status_match = 8; // Script can only run if the given condition match. optional ElementConditionProto element_condition = 10; - reserved 3, 9; + reserved 3, 8, 9; } message ScriptParameterMatchProto {
diff --git a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java index 146c55b..760e722 100644 --- a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java +++ b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java
@@ -56,9 +56,10 @@ @CalledByNative private static TextStyle createTextStyle(String fontName, @ColorInt int fontColor, int weight, - boolean allCaps, int alignment, @ColorInt int highlightColor, int highlightStyle) { + boolean allCaps, int alignment, int minTextSizeSP, int maxTextSizeSP, + @ColorInt int highlightColor, int highlightStyle) { return new TextStyle(fontName, fontColor, weight, allCaps, - TextAlignment.fromInteger(alignment), highlightColor, + TextAlignment.fromInteger(alignment), minTextSizeSP, maxTextSizeSP, highlightColor, HighlightStyle.fromInteger(highlightStyle)); }
diff --git a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java index bd70bd6..e7dea95 100644 --- a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java +++ b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java
@@ -7,10 +7,12 @@ import android.text.Spannable; import android.text.SpannableString; import android.text.style.LeadingMarginSpan; +import android.util.TypedValue; import android.view.View; import android.widget.TextView; import androidx.annotation.ColorInt; +import androidx.core.widget.TextViewCompat; import org.chromium.components.content_creation.notes.ui.TextHighlightSpan; @@ -27,18 +29,23 @@ private final @ColorInt int mFontColor; private final boolean mAllCaps; private final TextAlignment mAlignment; + private final int mMinTextSizeSP; + private final int mMaxTextSizeSP; private final @ColorInt int mHighlightColor; private final HighlightStyle mHighlightStyle; /** Constructor. */ public TextStyle(String fontName, @ColorInt int fontColor, int weight, boolean allCaps, - TextAlignment alignment, @ColorInt int highlightColor, HighlightStyle highlightStyle) { + TextAlignment alignment, int minTextSizeSP, int maxTextSizeSP, + @ColorInt int highlightColor, HighlightStyle highlightStyle) { this.fontName = fontName; this.weight = weight; this.mFontColor = fontColor; this.mAllCaps = allCaps; this.mAlignment = alignment; + this.mMinTextSizeSP = minTextSizeSP; + this.mMaxTextSizeSP = maxTextSizeSP; this.mHighlightColor = highlightColor; this.mHighlightStyle = highlightStyle; } @@ -60,6 +67,9 @@ textView.setAllCaps(this.mAllCaps); textView.setGravity(TextAlignment.toGravity(this.mAlignment)); + TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(textView, mMinTextSizeSP, + mMaxTextSizeSP, /*autoSizeStepGranularity=*/1, TypedValue.COMPLEX_UNIT_SP); + if (this.hasHighlight()) { int start = 0; int end = text.length();
diff --git a/components/content_creation/notes/android/note_template_conversion_bridge.cc b/components/content_creation/notes/android/note_template_conversion_bridge.cc index 838515a..80dc1006 100644 --- a/components/content_creation/notes/android/note_template_conversion_bridge.cc +++ b/components/content_creation/notes/android/note_template_conversion_bridge.cc
@@ -40,6 +40,8 @@ env, ConvertUTF8ToJavaString(env, text_style.font_name()), text_style.font_color(), text_style.weight(), text_style.all_caps(), static_cast<uint16_t>(text_style.alignment()), + static_cast<uint16_t>(text_style.min_text_size_sp()), + static_cast<uint16_t>(text_style.max_text_size_sp()), text_style.highlight_color(), static_cast<uint16_t>(text_style.highlight_style())); }
diff --git a/components/content_creation/notes/core/templates/template_constants.cc b/components/content_creation/notes/core/templates/template_constants.cc index f1ca76a..922ed4b 100644 --- a/components/content_creation/notes/core/templates/template_constants.cc +++ b/components/content_creation/notes/core/templates/template_constants.cc
@@ -13,6 +13,9 @@ const uint16_t k400Weight = 400; const uint16_t k700Weight = 700; +const int kDefaultMinTextSizeSP = 14; +const int kDefaultMaxTextSizeSP = 26; + const char kBebasNeueFontName[] = "Bebas Neue"; const char kMansalvaFontName[] = "Mansalva"; const char kRobotoCondensedFontName[] = "Roboto Condensed"; @@ -65,7 +68,8 @@ Background(/*color=*/kGrey900Color), TextStyle(kSourceSerifProFontName, /*font_color=*/kWhiteColor, k700Weight, - /*all_caps=*/false, TextAlignment::kStart), + /*all_caps=*/false, TextAlignment::kStart, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateDarkBackgroundFooterStyle()); } @@ -78,7 +82,8 @@ "templates/FriendlyBackground@2x.png"), TextStyle(kRockSaltFontName, /*font_color=*/kGrey900Color, k400Weight, - /*all_caps=*/false, TextAlignment::kStart), + /*all_caps=*/false, TextAlignment::kStart, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -89,7 +94,8 @@ Background(/*color=*/kGreen50Color), TextStyle(kSourceSerifProFontName, /*font_color=*/kGreen900Color, k400Weight, - /*all_caps=*/false, TextAlignment::kStart), + /*all_caps=*/false, TextAlignment::kStart, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -101,7 +107,8 @@ Background(/*color=*/kYellow400Color), TextStyle(kRobotoCondensedFontName, /*font_color=*/kBlackColor, k400Weight, - /*all_caps=*/true, TextAlignment::kStart), + /*all_caps=*/true, TextAlignment::kStart, kDefaultMinTextSizeSP, + kDefaultMaxTextSizeSP), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -114,6 +121,7 @@ TextStyle(kBebasNeueFontName, /*font_color=*/kBlackColor, k400Weight, /*all_caps=*/true, TextAlignment::kCenter, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP, /*highlight_color=*/kWhiteColor, HighlightStyle::kHalf), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -128,7 +136,8 @@ /*content_background=*/Background(/*color=*/kWhiteColor), TextStyle(kSourceSerifProFontName, /*font_color=*/kBlackColor, k400Weight, - /*all_caps=*/false, TextAlignment::kCenter), + /*all_caps=*/false, TextAlignment::kCenter, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -139,7 +148,8 @@ Background(/*color=*/kRed500Color), TextStyle(kBebasNeueFontName, /*font_color=*/kYellow400Color, k400Weight, - /*all_caps=*/true, TextAlignment::kStart, + /*all_caps=*/true, TextAlignment::kStart, kDefaultMinTextSizeSP, + kDefaultMaxTextSizeSP, /*highlight_color=*/kBlue900Color, HighlightStyle::kFull), /*footer_style=*/CreateDarkBackgroundFooterStyle()); } @@ -152,7 +162,8 @@ Background(/*color=*/kBlackColor), TextStyle(kBebasNeueFontName, /*font_color=*/kWhiteColor, k400Weight, - /*all_caps=*/true, TextAlignment::kCenter), + /*all_caps=*/true, TextAlignment::kCenter, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateDarkBackgroundFooterStyle()); } @@ -164,6 +175,7 @@ TextStyle(kBebasNeueFontName, /*font_color=*/kBlackColor, k400Weight, /*all_caps=*/true, TextAlignment::kCenter, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP, /*highlight_color=*/kLightYellowColor, HighlightStyle::kHalf), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -176,7 +188,8 @@ LinearGradientDirection::kTopToBottom), TextStyle(kMansalvaFontName, /*font_color=*/kWhiteColor, k400Weight, - /*all_caps=*/false, TextAlignment::kStart), + /*all_caps=*/false, TextAlignment::kStart, + kDefaultMinTextSizeSP, kDefaultMaxTextSizeSP), /*footer_style=*/CreateDarkBackgroundFooterStyle()); }
diff --git a/components/content_creation/notes/core/templates/template_types.cc b/components/content_creation/notes/core/templates/template_types.cc index 2988048..769e318a 100644 --- a/components/content_creation/notes/core/templates/template_types.cc +++ b/components/content_creation/notes/core/templates/template_types.cc
@@ -53,12 +53,16 @@ ARGBColor font_color, uint16_t weight, bool all_caps, - TextAlignment alignment) + TextAlignment alignment, + int min_text_size_sp, + int max_text_size_sp) : font_name_(font_name), font_color_(font_color), weight_(weight), all_caps_(all_caps), alignment_(alignment), + min_text_size_sp_(min_text_size_sp), + max_text_size_sp_(max_text_size_sp), highlight_color_(0U), highlight_style_(HighlightStyle::kNone) {} @@ -67,6 +71,8 @@ uint16_t weight, bool all_caps, TextAlignment alignment, + int min_text_size_sp, + int max_text_size_sp, ARGBColor highlight_color, HighlightStyle highlight_style) : font_name_(font_name), @@ -74,9 +80,22 @@ weight_(weight), all_caps_(all_caps), alignment_(alignment), + min_text_size_sp_(min_text_size_sp), + max_text_size_sp_(max_text_size_sp), highlight_color_(highlight_color), highlight_style_(highlight_style) {} +TextStyle::TextStyle(const TextStyle& text_style) + : font_name_(text_style.font_name()), + font_color_(text_style.font_color()), + weight_(text_style.weight()), + all_caps_(text_style.all_caps()), + alignment_(text_style.alignment()), + min_text_size_sp_(text_style.min_text_size_sp()), + max_text_size_sp_(text_style.max_text_size_sp()), + highlight_color_(text_style.highlight_color()), + highlight_style_(text_style.highlight_style()) {} + FooterStyle::FooterStyle(ARGBColor text_color, ARGBColor logo_color) : text_color_(text_color), logo_color_(logo_color) {}
diff --git a/components/content_creation/notes/core/templates/template_types.h b/components/content_creation/notes/core/templates/template_types.h index 88d49863..abcd241 100644 --- a/components/content_creation/notes/core/templates/template_types.h +++ b/components/content_creation/notes/core/templates/template_types.h
@@ -92,21 +92,29 @@ ARGBColor font_color, uint16_t weight, bool all_caps, - TextAlignment alignment); + TextAlignment alignment, + int minTextSize, + int maxTextSize); explicit TextStyle(const std::string& font_name, ARGBColor font_color, uint16_t weight, bool all_caps, TextAlignment alignment, + int minTextSize, + int maxTextSize, ARGBColor highlight_color, HighlightStyle highlight_style); + explicit TextStyle(const TextStyle& text_style); + const std::string& font_name() const { return font_name_; } ARGBColor font_color() const { return font_color_; } uint16_t weight() const { return weight_; } bool all_caps() const { return all_caps_; } TextAlignment alignment() const { return alignment_; } + int min_text_size_sp() const { return min_text_size_sp_; } + int max_text_size_sp() const { return max_text_size_sp_; } ARGBColor highlight_color() const { return highlight_color_; } HighlightStyle highlight_style() const { return highlight_style_; } @@ -116,6 +124,8 @@ uint16_t weight_; bool all_caps_; TextAlignment alignment_; + int min_text_size_sp_; + int max_text_size_sp_; ARGBColor highlight_color_; HighlightStyle highlight_style_; };
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index c4c6303..8116c0b 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -106,11 +106,9 @@ ->SharedMainThreadContextProvider(); DCHECK(context_provider_); context_provider_->AddObserver(this); - display::Screen::GetScreen()->AddObserver(this); } SurfaceTreeHost::~SurfaceTreeHost() { - display::Screen::GetScreen()->RemoveObserver(this); context_provider_->RemoveObserver(this); SetRootSurface(nullptr);
diff --git a/components/exo/surface_tree_host.h b/components/exo/surface_tree_host.h index 0efbbdde..771d9abd 100644 --- a/components/exo/surface_tree_host.h +++ b/components/exo/surface_tree_host.h
@@ -159,6 +159,8 @@ scoped_refptr<viz::ContextProvider> context_provider_; + display::ScopedDisplayObserver display_observer_{this}; + int64_t display_id_ = display::kInvalidDisplayId; base::WeakPtrFactory<SurfaceTreeHost> weak_ptr_factory_{this};
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc index a8bce06..5f98844 100644 --- a/components/exo/wayland/server.cc +++ b/components/exo/wayland/server.cc
@@ -156,7 +156,6 @@ #endif wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, bind_subcompositor); - display::Screen::GetScreen()->AddObserver(this); for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) OnDisplayAdded(display); wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, @@ -267,7 +266,6 @@ } Server::~Server() { - display::Screen::GetScreen()->RemoveObserver(this); // TODO(https://crbug.com/1124106): Investigate if we can eliminate Shutdown // methods. serial_tracker_->Shutdown();
diff --git a/components/exo/wayland/server.h b/components/exo/wayland/server.h index 5bec03a..fc9d5c83 100644 --- a/components/exo/wayland/server.h +++ b/components/exo/wayland/server.h
@@ -77,6 +77,7 @@ base::flat_map<int64_t, std::unique_ptr<WaylandDisplayOutput>> outputs_; std::unique_ptr<WaylandDataDeviceManager> data_device_manager_data_; std::unique_ptr<WaylandSeat> seat_data_; + display::ScopedDisplayObserver display_observer_{this}; #if BUILDFLAG(IS_CHROMEOS_ASH) std::unique_ptr<WaylandKeyboardExtension> zcr_keyboard_extension_data_;
diff --git a/components/exo/wayland/wayland_display_observer.cc b/components/exo/wayland/wayland_display_observer.cc index 638663e..1ed76665 100644 --- a/components/exo/wayland/wayland_display_observer.cc +++ b/components/exo/wayland/wayland_display_observer.cc
@@ -20,7 +20,6 @@ wl_resource* output_resource) : output_(output), output_resource_(output_resource) { output_->RegisterOutput(output_resource_); - display::Screen::GetScreen()->AddObserver(this); // Adding itself as an observer will send the initial display metrics. AddObserver(this); @@ -28,7 +27,6 @@ WaylandDisplayHandler::~WaylandDisplayHandler() { output_->UnregisterOutput(output_resource_); - display::Screen::GetScreen()->RemoveObserver(this); } void WaylandDisplayHandler::AddObserver(WaylandDisplayObserver* observer) {
diff --git a/components/exo/wayland/wayland_display_observer.h b/components/exo/wayland/wayland_display_observer.h index bf7ecbc..d5101c07 100644 --- a/components/exo/wayland/wayland_display_observer.h +++ b/components/exo/wayland/wayland_display_observer.h
@@ -64,6 +64,8 @@ base::ObserverList<WaylandDisplayObserver> observers_; + display::ScopedDisplayObserver display_observer_{this}; + DISALLOW_COPY_AND_ASSIGN(WaylandDisplayHandler); };
diff --git a/components/exo/wayland/zcr_remote_shell.cc b/components/exo/wayland/zcr_remote_shell.cc index 07ecbf1..668adc39 100644 --- a/components/exo/wayland/zcr_remote_shell.cc +++ b/components/exo/wayland/zcr_remote_shell.cc
@@ -944,7 +944,6 @@ output_provider_(output_provider) { WMHelperChromeOS* helper = WMHelperChromeOS::GetInstance(); helper->AddTabletModeObserver(this); - display::Screen::GetScreen()->AddObserver(this); helper->AddFrameThrottlingObserver(); layout_mode_ = helper->InTabletMode() @@ -971,7 +970,6 @@ ~WaylandRemoteShell() override { WMHelperChromeOS* helper = WMHelperChromeOS::GetInstance(); helper->RemoveTabletModeObserver(this); - display::Screen::GetScreen()->RemoveObserver(this); helper->RemoveFrameThrottlingObserver(); } @@ -1465,6 +1463,8 @@ base::flat_map<wl_resource*, BoundsChangeData> pending_bounds_changes_; + display::ScopedDisplayObserver display_observer_{this}; + base::WeakPtrFactory<WaylandRemoteShell> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(WaylandRemoteShell);
diff --git a/components/metrics/test/test_metrics_service_client.cc b/components/metrics/test/test_metrics_service_client.cc index 7e10ae38..5c0070a 100644 --- a/components/metrics/test/test_metrics_service_client.cc +++ b/components/metrics/test/test_metrics_service_client.cc
@@ -5,6 +5,7 @@ #include "components/metrics/test/test_metrics_service_client.h" #include <memory> +#include <utility> #include "base/callback.h" #include "base/containers/contains.h" @@ -16,15 +17,8 @@ // static const char TestMetricsServiceClient::kBrandForTesting[] = "brand_for_testing"; -TestMetricsServiceClient::TestMetricsServiceClient() - : version_string_("5.0.322.0-64-devel"), - product_(ChromeUserMetricsExtension::CHROME), - reporting_is_managed_(false), - is_extended_stable_channel_(false), - enable_default_(EnableMetricsDefault::DEFAULT_UNKNOWN), - storage_limits_(MetricsServiceClient::GetStorageLimits()) {} - -TestMetricsServiceClient::~TestMetricsServiceClient() {} +TestMetricsServiceClient::TestMetricsServiceClient() = default; +TestMetricsServiceClient::~TestMetricsServiceClient() = default; metrics::MetricsService* TestMetricsServiceClient::GetMetricsService() { return nullptr;
diff --git a/components/metrics/test/test_metrics_service_client.h b/components/metrics/test/test_metrics_service_client.h index 6c7e41d..6d7eefa 100644 --- a/components/metrics/test/test_metrics_service_client.h +++ b/components/metrics/test/test_metrics_service_client.h
@@ -7,9 +7,9 @@ #include <stdint.h> +#include <set> #include <string> -#include "base/macros.h" #include "components/metrics/metrics_log_store.h" #include "components/metrics/metrics_log_uploader.h" #include "components/metrics/metrics_service_client.h" @@ -24,6 +24,8 @@ static const char kBrandForTesting[]; TestMetricsServiceClient(); + TestMetricsServiceClient(const TestMetricsServiceClient&) = delete; + TestMetricsServiceClient& operator=(const TestMetricsServiceClient&) = delete; ~TestMetricsServiceClient() override; // MetricsServiceClient: @@ -78,19 +80,18 @@ private: std::string client_id_; - std::string version_string_; - int32_t product_; - bool reporting_is_managed_; - bool is_extended_stable_channel_; - EnableMetricsDefault enable_default_; + std::string version_string_{"5.0.322.0-64-devel"}; + int32_t product_ = ChromeUserMetricsExtension::CHROME; + bool reporting_is_managed_ = false; + bool is_extended_stable_channel_ = false; + EnableMetricsDefault enable_default_ = EnableMetricsDefault::DEFAULT_UNKNOWN; bool should_reset_client_ids_on_cloned_install_ = false; - MetricsLogStore::StorageLimits storage_limits_; + MetricsLogStore::StorageLimits storage_limits_ = + MetricsServiceClient::GetStorageLimits(); std::set<uint64_t> allowed_user_ids_; // A weak ref to the last created TestMetricsLogUploader. TestMetricsLogUploader* uploader_ = nullptr; - - DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); }; } // namespace metrics
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java index 40294b85..e6eb5f9 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java
@@ -20,6 +20,7 @@ import android.widget.Button; import androidx.annotation.IntDef; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.AlertDialog; import androidx.core.view.ViewCompat; @@ -220,7 +221,7 @@ final Intent instantAppIntent = mDelegate.getInstantAppIntentForUrl(mFullUrl.getSpec()); viewParams.instantAppButtonClickCallback = () -> { try { - mWindowAndroid.getActivity().get().startActivity(instantAppIntent); + getActivity().startActivity(instantAppIntent); RecordUserAction.record("Android.InstantApps.LaunchedFromWebsiteSettingsPopup"); } catch (ActivityNotFoundException e) { mView.disableInstantAppButton(); @@ -256,7 +257,7 @@ this, mView.getCookiesRowView(), mDelegate, mFullUrl.getSpec()); if (PageInfoFeatures.PAGE_INFO_HISTORY.isEnabled()) { mHistoryController = mDelegate.createHistoryController( - this, mView.getHistoryRowView(), mFullUrl.getSpec()); + this, mView.getHistoryRowView(), mFullUrl.getHost()); setupForgetSiteButton(mView.getForgetSiteButton()); } @@ -538,4 +539,10 @@ mSubpageController = null; }); } + + @Override + @Nullable + public Activity getActivity() { + return mWindowAndroid.getActivity().get(); + } }
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoControllerDelegate.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoControllerDelegate.java index 516eba68..f3848de 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoControllerDelegate.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoControllerDelegate.java
@@ -182,7 +182,7 @@ */ @Nullable public abstract PageInfoSubpageController createHistoryController( - PageInfoMainController mainController, PageInfoRowView rowView, String url); + PageInfoMainController mainController, PageInfoRowView rowView, String host); /** * @return Returns the browser context associated with this dialog. @@ -210,4 +210,6 @@ public abstract boolean isAccessibilityEnabled(); public abstract FragmentManager getFragmentManager(); + + public abstract boolean isIncognito(); }
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoMainController.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoMainController.java index 817a12e..42ef6ef 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoMainController.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoMainController.java
@@ -4,6 +4,10 @@ package org.chromium.components.page_info; +import android.app.Activity; + +import androidx.annotation.Nullable; + import org.chromium.components.embedder_support.browser_context.BrowserContextHandle; /** @@ -28,13 +32,13 @@ */ void recordAction(@PageInfoAction int action); - /** - * Refreshes the permissions of the page info. - */ + /** Refreshes the permissions of the page info. */ void refreshPermissions(); - /** - * @return A BrowserContext for this dialog. - */ + /** @return A BrowserContext for this dialog. */ BrowserContextHandle getBrowserContext(); + + /** @return The Activity associated with the controller. */ + @Nullable + Activity getActivity(); }
diff --git a/components/page_info/page_info.h b/components/page_info/page_info.h index c9e9d65..983f475 100644 --- a/components/page_info/page_info.h +++ b/components/page_info/page_info.h
@@ -276,6 +276,8 @@ // Exposed for testing. static std::vector<ContentSettingsType> GetAllPermissionsForTesting(); + PageInfoUI* ui_for_testing() const { return ui_; } + private: FRIEND_TEST_ALL_PREFIXES(PageInfoTest, NonFactoryDefaultAndRecentlyChangedPermissionsShown);
diff --git a/components/page_load_metrics/browser/BUILD.gn b/components/page_load_metrics/browser/BUILD.gn index 71de6cd0..4b31ec7 100644 --- a/components/page_load_metrics/browser/BUILD.gn +++ b/components/page_load_metrics/browser/BUILD.gn
@@ -24,8 +24,8 @@ "observers/early_hints_page_load_metrics_observer.h", "observers/layout_page_load_metrics_observer.cc", "observers/layout_page_load_metrics_observer.h", - "observers/prerender_page_load_metrics_observer.cc", - "observers/prerender_page_load_metrics_observer.h", + "observers/prerender_features_page_load_metrics_observer.cc", + "observers/prerender_features_page_load_metrics_observer.h", "observers/use_counter/ukm_features.cc", "observers/use_counter_page_load_metrics_observer.cc", "observers/use_counter_page_load_metrics_observer.h", @@ -106,7 +106,7 @@ "observers/early_hints_page_load_metrics_observer_unittest.cc", "observers/page_load_metrics_observer_content_test_harness.cc", "observers/page_load_metrics_observer_content_test_harness.h", - "observers/prerender_page_load_metrics_observer_unittest.cc", + "observers/prerender_features_page_load_metrics_observer_unittest.cc", "observers/use_counter_page_load_metrics_observer_unittest.cc", "page_load_metrics_memory_tracker_unittest.cc", "page_load_metrics_util_unittest.cc",
diff --git a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.cc b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.cc similarity index 91% rename from components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.cc rename to components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.cc index ad1c207..1fa65a4 100644 --- a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.cc +++ b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h" +#include "components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h" #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" #include "content/public/browser/web_contents.h" @@ -26,12 +26,12 @@ } // namespace -void PrerenderPageLoadMetricsObserver::OnFirstContentfulPaintInPage( +void PrerenderFeaturesPageLoadMetricsObserver::OnFirstContentfulPaintInPage( const page_load_metrics::mojom::PageLoadTiming& timing) { did_fcp_ = true; } -void PrerenderPageLoadMetricsObserver::OnStorageAccessed( +void PrerenderFeaturesPageLoadMetricsObserver::OnStorageAccessed( const GURL& url, const GURL& first_party_url, bool blocked_by_policy, @@ -69,7 +69,7 @@ } } -void PrerenderPageLoadMetricsObserver::RecordFeatureUse( +void PrerenderFeaturesPageLoadMetricsObserver::RecordFeatureUse( blink::mojom::WebFeature feature) { page_load_metrics::MetricsWebContentsObserver::RecordFeatureUsage( GetDelegate().GetWebContents()->GetMainFrame(), feature);
diff --git a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h similarity index 86% rename from components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h rename to components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h index 223640d..7fd6d08b 100644 --- a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h +++ b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_PAGE_LOAD_METRICS_OBSERVER_H_ -#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_PAGE_LOAD_METRICS_OBSERVER_H_ +#ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_FEATURES_PAGE_LOAD_METRICS_OBSERVER_H_ +#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_FEATURES_PAGE_LOAD_METRICS_OBSERVER_H_ #include "components/page_load_metrics/browser/page_load_metrics_observer.h" @@ -17,10 +17,10 @@ // normal page loads which, when if used during prerendering, may result in // cancelling or freezing the prerender, to help estimate the effect on // coverage. -class PrerenderPageLoadMetricsObserver +class PrerenderFeaturesPageLoadMetricsObserver : public page_load_metrics::PageLoadMetricsObserver { public: - PrerenderPageLoadMetricsObserver() = default; + PrerenderFeaturesPageLoadMetricsObserver() = default; // page_load_metrics::PageLoadMetricsObserver implementation: void OnFirstContentfulPaintInPage( @@ -38,4 +38,4 @@ bool did_session_storage_ = false; }; -#endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_PAGE_LOAD_METRICS_OBSERVER_H_ +#endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_PRERENDER_FEATURES_PAGE_LOAD_METRICS_OBSERVER_H_
diff --git a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer_unittest.cc b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer_unittest.cc similarity index 88% rename from components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer_unittest.cc rename to components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer_unittest.cc index b82e1ac..9767e49f 100644 --- a/components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer_unittest.cc +++ b/components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h" +#include "components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h" #include <memory> @@ -19,15 +19,16 @@ const char kOtherOriginUrl[] = "https://b.test"; const char kFeaturesHistogramName[] = "Blink.UseCounter.Features"; -class PrerenderPageLoadMetricsObserverTest +class PrerenderFeaturesPageLoadMetricsObserverTest : public page_load_metrics::PageLoadMetricsObserverContentTestHarness { protected: void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { - // PrerenderPageLoadMetricsObserver requires + // PrerenderFeaturesPageLoadMetricsObserver requires // UseCounterPageLoadMetricsObserver to log UseCounter to UMA. tracker->AddObserver(std::make_unique<UseCounterPageLoadMetricsObserver>()); - tracker->AddObserver(std::make_unique<PrerenderPageLoadMetricsObserver>()); + tracker->AddObserver( + std::make_unique<PrerenderFeaturesPageLoadMetricsObserver>()); } void SimulateFirstContentfulPaint() { @@ -76,7 +77,7 @@ } }; -TEST_F(PrerenderPageLoadMetricsObserverTest, NoLocalStorage) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, NoLocalStorage) { NavigateAndCommit(GURL(kDefaultTestUrl)); EXPECT_EQ(GetPageVisits(), 1); @@ -84,7 +85,7 @@ EXPECT_EQ(GetLocalStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, LocalStorageBeforeFcp) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, LocalStorageBeforeFcp) { NavigateAndCommit(GURL(kDefaultTestUrl)); // Access local storage. @@ -106,7 +107,7 @@ EXPECT_EQ(GetLocalStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, LocalStorageAfterFcp) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, LocalStorageAfterFcp) { NavigateAndCommit(GURL(kDefaultTestUrl)); // Reach FCP. @@ -122,7 +123,7 @@ EXPECT_EQ(GetLocalStorageAfterFcpCount(), 1); } -TEST_F(PrerenderPageLoadMetricsObserverTest, ThirdPartyLocalStorage) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, ThirdPartyLocalStorage) { NavigateAndCommit(GURL(kDefaultTestUrl)); tester()->SimulateStorageAccess( @@ -135,7 +136,7 @@ EXPECT_EQ(GetLocalStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, NoSessionStorage) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, NoSessionStorage) { NavigateAndCommit(GURL(kDefaultTestUrl)); EXPECT_EQ(GetPageVisits(), 1); @@ -143,7 +144,7 @@ EXPECT_EQ(GetSessionStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, SessionStorageBeforeFcp) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, SessionStorageBeforeFcp) { NavigateAndCommit(GURL(kDefaultTestUrl)); // Access session storage. @@ -165,7 +166,7 @@ EXPECT_EQ(GetSessionStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, SessionStorageAfterFcp) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, SessionStorageAfterFcp) { NavigateAndCommit(GURL(kDefaultTestUrl)); // Reach FCP. @@ -181,7 +182,7 @@ EXPECT_EQ(GetSessionStorageAfterFcpCount(), 1); } -TEST_F(PrerenderPageLoadMetricsObserverTest, ThirdPartySessionStorage) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, ThirdPartySessionStorage) { NavigateAndCommit(GURL(kDefaultTestUrl)); tester()->SimulateStorageAccess( @@ -194,7 +195,7 @@ EXPECT_EQ(GetSessionStorageAfterFcpCount(), 0); } -TEST_F(PrerenderPageLoadMetricsObserverTest, MultipleStorage) { +TEST_F(PrerenderFeaturesPageLoadMetricsObserverTest, MultipleStorage) { NavigateAndCommit(GURL(kDefaultTestUrl)); // Access local storage.
diff --git a/components/page_load_metrics/browser/page_load_metrics_embedder_base.cc b/components/page_load_metrics/browser/page_load_metrics_embedder_base.cc index d067aa0..a7343e8 100644 --- a/components/page_load_metrics/browser/page_load_metrics_embedder_base.cc +++ b/components/page_load_metrics/browser/page_load_metrics_embedder_base.cc
@@ -10,7 +10,7 @@ #include "components/page_load_metrics/browser/observers/core/uma_page_load_metrics_observer.h" #include "components/page_load_metrics/browser/observers/early_hints_page_load_metrics_observer.h" #include "components/page_load_metrics/browser/observers/layout_page_load_metrics_observer.h" -#include "components/page_load_metrics/browser/observers/prerender_page_load_metrics_observer.h" +#include "components/page_load_metrics/browser/observers/prerender_features_page_load_metrics_observer.h" #include "components/page_load_metrics/browser/observers/use_counter_page_load_metrics_observer.h" #include "components/page_load_metrics/browser/page_load_tracker.h" @@ -31,7 +31,8 @@ tracker->AddObserver(std::make_unique<LayoutPageLoadMetricsObserver>()); tracker->AddObserver(std::make_unique<UseCounterPageLoadMetricsObserver>()); tracker->AddObserver(std::make_unique<EarlyHintsPageLoadMetricsObserver>()); - tracker->AddObserver(std::make_unique<PrerenderPageLoadMetricsObserver>()); + tracker->AddObserver( + std::make_unique<PrerenderFeaturesPageLoadMetricsObserver>()); } // Allow the embedder to register any embedder-specific observers RegisterEmbedderObservers(tracker);
diff --git a/components/password_manager/core/browser/insecure_credentials_table.cc b/components/password_manager/core/browser/insecure_credentials_table.cc index 1127ec985..44ecee5 100644 --- a/components/password_manager/core/browser/insecure_credentials_table.cc +++ b/components/password_manager/core/browser/insecure_credentials_table.cc
@@ -8,6 +8,8 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/strings/stringprintf.h" +#include "components/password_manager/core/browser/password_form.h" +#include "components/password_manager/core/browser/password_store_sync.h" #include "sql/database.h" #include "sql/statement.h" @@ -61,6 +63,11 @@ InsecureCredential::~InsecureCredential() = default; +bool InsecureCredential::SameMetadata( + const InsecurityMetadata& metadata) const { + return create_time == metadata.create_time && is_muted == metadata.is_muted; +} + bool operator==(const InsecureCredential& lhs, const InsecureCredential& rhs) { return lhs.signon_realm == rhs.signon_realm && lhs.username == rhs.username && lhs.create_time == rhs.create_time && @@ -115,6 +122,47 @@ return result && db_->GetLastChangeCount(); } +bool InsecureCredentialsTable::InsertOrReplace(FormPrimaryKey parent_key, + InsecureType type, + InsecurityMetadata metadata) { + DCHECK(db_); + DCHECK(db_->DoesTableExist(kTableName)); + + sql::Statement s(db_->GetCachedStatement( + SQL_FROM_HERE, + base::StringPrintf("INSERT OR REPLACE INTO %s (parent_id, " + "insecurity_type, create_time, is_muted) " + "VALUES (?, ?, ?, ?)", + kTableName) + .c_str())); + s.BindInt(0, parent_key.value()); + s.BindInt(1, static_cast<int>(type)); + s.BindInt64(2, + metadata.create_time.ToDeltaSinceWindowsEpoch().InMicroseconds()); + s.BindBool(3, metadata.is_muted.value()); + + bool result = s.Run(); + return result && db_->GetLastChangeCount(); +} + +bool InsecureCredentialsTable::RemoveRow(FormPrimaryKey parent_key, + InsecureType insecure_type) { + DCHECK(db_); + DCHECK(db_->DoesTableExist(kTableName)); + + sql::Statement s(db_->GetCachedStatement( + SQL_FROM_HERE, + base::StringPrintf( + "DELETE FROM %s WHERE parent_id = ? AND insecurity_type = ?", + kTableName) + .c_str())); + s.BindInt(0, parent_key.value()); + s.BindInt(1, static_cast<int>(insecure_type)); + + bool result = s.Run(); + return result && db_->GetLastChangeCount(); +} + bool InsecureCredentialsTable::RemoveRows( const std::string& signon_realm, const std::u16string& username,
diff --git a/components/password_manager/core/browser/insecure_credentials_table.h b/components/password_manager/core/browser/insecure_credentials_table.h index 53067d1..38918bc 100644 --- a/components/password_manager/core/browser/insecure_credentials_table.h +++ b/components/password_manager/core/browser/insecure_credentials_table.h
@@ -47,6 +47,8 @@ InsecureCredential& operator=(InsecureCredential&& rhs); ~InsecureCredential(); + bool SameMetadata(const InsecurityMetadata& metadata) const; + // The primary key of an affected Login. FormPrimaryKey parent_key{-1}; // The signon_realm of the website where the credentials were compromised. @@ -80,6 +82,15 @@ // if the SQL completed successfully and an item was created. bool AddRow(const InsecureCredential& compromised_credentials); + // Adds information about the insecure credential if it doesn't exist. + // If it does, it removes the previous entry and adds the new one. + bool InsertOrReplace(FormPrimaryKey parent_key, + InsecureType type, + InsecurityMetadata metadata); + + // Removes the row corresponding to |parent_key| and |insecure_type|. + bool RemoveRow(FormPrimaryKey parent_key, InsecureType insecure_type); + // Removes information about the credentials compromised for |username| on // |signon_realm|. |reason| is the reason why the credentials are removed from // the table. Returns true if the SQL completed successfully.
diff --git a/components/password_manager/core/browser/insecure_credentials_table_unittest.cc b/components/password_manager/core/browser/insecure_credentials_table_unittest.cc index 11d92d1..e9d3728 100644 --- a/components/password_manager/core/browser/insecure_credentials_table_unittest.cc +++ b/components/password_manager/core/browser/insecure_credentials_table_unittest.cc
@@ -16,6 +16,7 @@ #include "build/build_config.h" #include "components/os_crypt/os_crypt_mocker.h" #include "components/password_manager/core/browser/login_database.h" +#include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/safe_browsing/core/common/features.h" #include "sql/database.h" @@ -202,6 +203,46 @@ EXPECT_THAT(db()->GetRows(test_data().signon_realm), IsEmpty()); } +TEST_F(InsecureCredentialsTableTest, RemoveRowMultipleTypes) { + EXPECT_THAT(login_db()->AddLogin(test_form()), SizeIs(1)); + InsecureCredential leaked = test_data(); + leaked.insecure_type = InsecureType::kLeaked; + InsecureCredential phished = test_data(); + phished.insecure_type = InsecureType::kPhished; + EXPECT_TRUE(db()->AddRow(leaked)); + EXPECT_TRUE(db()->AddRow(phished)); + + EXPECT_THAT(db()->GetRows(test_data().signon_realm), + UnorderedElementsAre(leaked, phished)); + EXPECT_THAT(GetParentIds(db()->GetAllRows()), ElementsAre(1, 1)); + + EXPECT_TRUE(db()->RemoveRow(FormPrimaryKey(1), InsecureType::kPhished)); + EXPECT_THAT(db()->GetRows(test_data().signon_realm), ElementsAre(leaked)); +} + +TEST_F(InsecureCredentialsTableTest, UpdateRow) { + EXPECT_THAT(login_db()->AddLogin(test_form()), SizeIs(1)); + + InsecureCredential insecure_credential = test_data(); + insecure_credential.is_muted = IsMuted(false); + insecure_credential.parent_key = FormPrimaryKey(1); + EXPECT_TRUE(db()->AddRow(insecure_credential)); + + EXPECT_THAT(db()->GetRows(test_data().signon_realm), + UnorderedElementsAre(insecure_credential)); + EXPECT_THAT(GetParentIds(db()->GetAllRows()), ElementsAre(1)); + + InsecurityMetadata new_metadata(insecure_credential.create_time, + IsMuted(true)); + InsecureCredential new_insecure_credential = insecure_credential; + new_insecure_credential.is_muted = IsMuted(true); + EXPECT_TRUE(db()->InsertOrReplace(insecure_credential.parent_key, + insecure_credential.insecure_type, + new_metadata)); + EXPECT_THAT(db()->GetRows(test_data().signon_realm), + ElementsAre(new_insecure_credential)); +} + TEST_F(InsecureCredentialsTableTest, ReportMetricsBeforeBulkCheck) { EXPECT_THAT(login_db()->AddLogin(test_form()), SizeIs(1)); EXPECT_TRUE(db()->AddRow(test_data()));
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc index ab464c0..68bb077 100644 --- a/components/password_manager/core/browser/login_database.cc +++ b/components/password_manager/core/browser/login_database.cc
@@ -15,6 +15,7 @@ #include "base/bind.h" #include "base/check_op.h" +#include "base/containers/flat_map.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" @@ -31,11 +32,13 @@ #include "build/build_config.h" #include "components/os_crypt/os_crypt.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" +#include "components/password_manager/core/browser/insecure_credentials_table.h" #include "components/password_manager/core/browser/password_bubble_experiment.h" #include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_util.h" +#include "components/password_manager/core/browser/password_store_change.h" #include "components/password_manager/core/browser/psl_matching_helper.h" #include "components/password_manager/core/browser/sql_table_builder.h" #include "components/sync/protocol/entity_metadata.pb.h" @@ -1276,28 +1279,41 @@ return PasswordStoreChangeList(); } - PasswordStoreChangeList list; - if (db_.GetLastChangeCount()) { - bool password_changed = - form.password_value != old_primary_key_password.decrypted_password; - - InsecureCredentialsChanged insecure_changed( - password_changed ? insecure_credentials_table().RemoveRows( - form.signon_realm, form.username_value, - RemoveInsecureCredentialsReason::kUpdate) - : false); - - PasswordForm form_with_encrypted_password = form; - form_with_encrypted_password.encrypted_password = encrypted_password; - FillFormInStore(&form_with_encrypted_password); - list.emplace_back(PasswordStoreChange::UPDATE, - std::move(form_with_encrypted_password), - FormPrimaryKey(old_primary_key_password.primary_key), - password_changed, insecure_changed); - } else if (error) { - *error = UpdateLoginError::kNoUpdatedRecords; + // If no rows changed due to this command, it means that there was no row to + // update, so there is no point trying to update insecure credentials data. + if (db_.GetLastChangeCount() == 0) { + if (error) { + *error = UpdateLoginError::kNoUpdatedRecords; + } + return PasswordStoreChangeList(); } + bool password_changed = + form.password_value != old_primary_key_password.decrypted_password; + + InsecureCredentialsChanged insecure_changed(false); + // TODO(crbug.com/1223022): It should be the responsibility of the caller to + // set `password_issues` to empty instead of leaving it nullopt in this case. + // Remove this once all `UpdateLogin` calls have been checked. + if (password_changed && !form.password_issues.has_value()) { + insecure_changed = UpdateInsecureCredentials( + FormPrimaryKey(old_primary_key_password.primary_key), + base::flat_map<InsecureType, InsecurityMetadata>()); + } else if (form.password_issues.has_value()) { + insecure_changed = UpdateInsecureCredentials( + FormPrimaryKey(old_primary_key_password.primary_key), + form.password_issues.value()); + } + + PasswordStoreChangeList list; + PasswordForm form_with_encrypted_password = form; + form_with_encrypted_password.encrypted_password = encrypted_password; + FillFormInStore(&form_with_encrypted_password); + list.emplace_back(PasswordStoreChange::UPDATE, + std::move(form_with_encrypted_password), + FormPrimaryKey(old_primary_key_password.primary_key), + password_changed, insecure_changed); + return list; } @@ -1516,11 +1532,12 @@ std::vector<InsecureCredential> insecure_credentials = insecure_credentials_table_.GetRows(FormPrimaryKey(*primary_key)); + base::flat_map<InsecureType, InsecurityMetadata> issues; for (const auto& insecure_credential : insecure_credentials) { - form->password_issues[insecure_credential.insecure_type] = - InsecurityMetadata(insecure_credential.create_time, - insecure_credential.is_muted); + issues[insecure_credential.insecure_type] = InsecurityMetadata( + insecure_credential.create_time, insecure_credential.is_muted); } + form->password_issues = std::move(issues); return ENCRYPTION_RESULT_SUCCESS; } @@ -2162,4 +2179,27 @@ : PasswordForm::Store::kProfileStore; } +InsecureCredentialsChanged LoginDatabase::UpdateInsecureCredentials( + FormPrimaryKey primary_key, + const base::flat_map<InsecureType, InsecurityMetadata>& password_issues) { + bool changed = false; + for (const auto& password_issue : password_issues) { + changed = insecure_credentials_table_.InsertOrReplace( + primary_key, password_issue.first, password_issue.second) || + changed; + } + + // If an insecure type has been removed from the form it has to be removed + // from the database. This can currently happen for phished entries. + for (auto insecure_type : {InsecureType::kLeaked, InsecureType::kPhished, + InsecureType::kWeak, InsecureType::kReused}) { + if (password_issues.find(insecure_type) == password_issues.end()) { + changed = + insecure_credentials_table_.RemoveRow(primary_key, insecure_type) || + changed; + } + } + return InsecureCredentialsChanged(changed); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/login_database.h b/components/password_manager/core/browser/login_database.h index 8b42e6435..8a9d430b 100644 --- a/components/password_manager/core/browser/login_database.h +++ b/components/password_manager/core/browser/login_database.h
@@ -337,6 +337,13 @@ // kAccountStore depending on the value of `is_account_store_`. void FillFormInStore(PasswordForm* form) const; + // Updates data in the `insecure_credentials_table_` with the password issues + // data from `password_issues`. Returns whether any insecure credential entry + // was changed. + InsecureCredentialsChanged UpdateInsecureCredentials( + FormPrimaryKey primary_key, + const base::flat_map<InsecureType, InsecurityMetadata>& password_issues); + const base::FilePath db_path_; const IsAccountStore is_account_store_;
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc index 43836016..86a5926 100644 --- a/components/password_manager/core/browser/login_database_unittest.cc +++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -10,6 +10,7 @@ #include <memory> #include <utility> +#include "base/containers/flat_map.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" @@ -36,12 +37,15 @@ #include "sql/test/test_helpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "url/origin.h" using autofill::GaiaIdHash; using base::ASCIIToUTF16; using base::UTF16ToASCII; +using ::testing::ElementsAre; using ::testing::Eq; +using ::testing::IsEmpty; using ::testing::Ne; using ::testing::Pointee; using ::testing::SizeIs; @@ -56,12 +60,21 @@ } PasswordStoreChangeList UpdateChangeForForm(const PasswordForm& form, - const bool password_changed) { + bool password_changed) { return PasswordStoreChangeList( 1, PasswordStoreChange(PasswordStoreChange::UPDATE, form, FormPrimaryKey(1), password_changed)); } +PasswordStoreChangeList UpdateChangeForForm(const PasswordForm& form, + bool password_changed, + bool insecure_changed) { + return PasswordStoreChangeList( + 1, PasswordStoreChange(PasswordStoreChange::UPDATE, form, + FormPrimaryKey(1), password_changed, + InsecureCredentialsChanged(insecure_changed))); +} + PasswordStoreChangeList RemoveChangeForForm(const PasswordForm& form) { return PasswordStoreChangeList( 1, PasswordStoreChange(PasswordStoreChange::REMOVE, form)); @@ -90,6 +103,10 @@ form.in_store = PasswordForm::Store::kProfileStore; form.moving_blocked_for_list.push_back(GaiaIdHash::FromGaiaId("user1")); form.moving_blocked_for_list.push_back(GaiaIdHash::FromGaiaId("user2")); + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); return form; } @@ -546,6 +563,13 @@ form.in_store = PasswordForm::Store::kProfileStore; form2.in_store = PasswordForm::Store::kProfileStore; + // |password_issues| is also expected to be set to empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + form2.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + // Match against desktop. PasswordFormDigest form_request = {PasswordForm::Scheme::kHtml, "https://foo.com/", @@ -587,6 +611,14 @@ form.in_store = PasswordForm::Store::kProfileStore; form_with_port.in_store = PasswordForm::Store::kProfileStore; + // |password_issues| should also be set to empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + form_with_port.password_issues = + base::flat_map<InsecureType, InsecurityMetadata>(); + // Match localhost with and without port. PasswordFormDigest form_request(PasswordForm::Scheme::kHtml, "http://localhost/", @@ -701,6 +733,13 @@ form.in_store = PasswordForm::Store::kProfileStore; form2.in_store = PasswordForm::Store::kProfileStore; + // |password_issues| should also be set to empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + form2.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + // Match against the first one. PasswordFormDigest form_request = {PasswordForm::Scheme::kHtml, form.signon_realm, form.url}; @@ -731,6 +770,12 @@ // When we retrieve the form from the store, it should have |in_store| set. form.in_store = PasswordForm::Store::kProfileStore; + // |password_issues| should also be set to empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + // Match against. PasswordFormDigest form_request = {PasswordForm::Scheme::kHtml, "https://example.com/", @@ -1108,6 +1153,11 @@ form.federation_origin = url::Origin::Create(GURL("https://accounts.google.com/")); form.skip_zero_click = true; + + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); EXPECT_EQ(AddChangeForForm(form), db().AddLogin(form)); // Get all non-blocklisted logins (should be none). @@ -1230,6 +1280,12 @@ PasswordForm expected_form(completed_form); // When we retrieve the form from the store, it should have |in_store| set. expected_form.in_store = PasswordForm::Store::kProfileStore; + // And |password_issues| should be empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + expected_form.password_issues = + base::flat_map<InsecureType, InsecurityMetadata>(); EXPECT_EQ(expected_form, *result[0]); result.clear(); } @@ -1278,6 +1334,15 @@ complete_form.in_store = PasswordForm::Store::kProfileStore; incomplete_form.in_store = PasswordForm::Store::kProfileStore; + // And |password_issues| should be set to empty. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + complete_form.password_issues = + base::flat_map<InsecureType, InsecurityMetadata>(); + incomplete_form.password_issues = + base::flat_map<InsecureType, InsecurityMetadata>(); + // Both still exist now. EXPECT_TRUE(db().GetAutofillableLogins(&result)); ASSERT_EQ(2U, result.size()); @@ -1361,6 +1426,12 @@ // When we retrieve the form from the store, it should have |in_store| set. form.in_store = PasswordForm::Store::kProfileStore; + // And |password_issues| should be empty + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + std::vector<std::unique_ptr<PasswordForm>> result; EXPECT_TRUE(db().GetLogins(PasswordFormDigest(form), &result)); ASSERT_EQ(1U, result.size()); @@ -1398,6 +1469,11 @@ // When we retrieve the form from the store, it should have |in_store| set. form.in_store = PasswordForm::Store::kProfileStore; + // And |password_issues| should be empty + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); std::vector<std::unique_ptr<PasswordForm>> result; ASSERT_TRUE(db().GetLogins(PasswordFormDigest(form), &result)); @@ -2407,6 +2483,14 @@ // Delete undecryptable logins and make sure we can get valid logins. EXPECT_EQ(DatabaseCleanupResult::kSuccess, db.DeleteUndecryptableLogins()); EXPECT_TRUE(db.GetAutofillableLogins(&result)); + + // Autofillable logins will come back with insecure data so add that to the + // expected forms. + // TODO(crbug.com/1223022): Once all places that operate changes on forms + // via UpdateLogin properly set |password_issues|, setting them to an empty + // map should be part of the default constructor. + form1.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); + form3.password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); EXPECT_THAT(result, UnorderedElementsAre(Pointee(form1), Pointee(form3))); RunUntilIdle(); @@ -2597,10 +2681,13 @@ IsMuted(false)}; InsecureCredential credential2 = credential1; credential2.insecure_type = InsecureType::kPhished; - form.password_issues[InsecureType::kLeaked] = + + base::flat_map<InsecureType, InsecurityMetadata> issues; + issues[InsecureType::kLeaked] = InsecurityMetadata(credential1.create_time, credential1.is_muted); - form.password_issues[InsecureType::kPhished] = + issues[InsecureType::kPhished] = InsecurityMetadata(credential2.create_time, credential2.is_muted); + form.password_issues = std::move(issues); db().insecure_credentials_table().AddRow(credential1); db().insecure_credentials_table().AddRow(credential2); @@ -2673,35 +2760,107 @@ testing::Pair(FormPrimaryKey(3), Pointee(form3)))); } -TEST_F(LoginDatabaseTest, UpdatingPasswordRemovesInsecureCredentials) { +TEST_F(LoginDatabaseTest, UpdateLoginWithAddedInsecureCredential) { PasswordForm form = GenerateExamplePasswordForm(); - ignore_result(db().AddLogin(form)); - InsecureCredential credential1{form.signon_realm, form.username_value, - base::Time(), InsecureType::kLeaked, - IsMuted(false)}; - InsecureCredential credential2 = credential1; - credential2.insecure_type = InsecureType::kPhished; + InsecureCredential insecure_credential{form.signon_realm, form.username_value, + base::Time(), InsecureType::kLeaked, + IsMuted(false)}; + base::flat_map<InsecureType, InsecurityMetadata> issues; + issues[InsecureType::kLeaked] = InsecurityMetadata( + insecure_credential.create_time, insecure_credential.is_muted); + form.password_issues = std::move(issues); - db().insecure_credentials_table().AddRow(credential1); - db().insecure_credentials_table().AddRow(credential2); - - EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), - testing::UnorderedElementsAre(credential1, credential2)); - - // Verify that changing other fields doesn't involve insecure credentials - // removal. - form.times_used = 92; - EXPECT_EQ(UpdateChangeForForm(form, /*password_changed=*/false), + EXPECT_EQ(UpdateChangeForForm(form, /*password_changed=*/false, + /*insecure_changed=*/true), db().UpdateLogin(form, nullptr)); EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), - testing::UnorderedElementsAre(credential1, credential2)); + ElementsAre(insecure_credential)); +} +TEST_F(LoginDatabaseTest, UpdateLoginWithNoInsecureCredentialInformation) { + PasswordForm form = GenerateExamplePasswordForm(); + ignore_result(db().AddLogin(form)); + InsecureCredential insecure_credential{form.signon_realm, form.username_value, + base::Time(), InsecureType::kLeaked, + IsMuted(false)}; + base::flat_map<InsecureType, InsecurityMetadata> issues; + issues[InsecureType::kLeaked] = InsecurityMetadata( + insecure_credential.create_time, insecure_credential.is_muted); + form.password_issues = std::move(issues); + + ASSERT_EQ(UpdateChangeForForm(form, /*password_changed=*/false, + /*insecure_changed=*/true), + db().UpdateLogin(form, nullptr)); + ASSERT_THAT(db().insecure_credentials_table().GetAllRows(), + ElementsAre(insecure_credential)); + + PasswordForm no_info_form = form; + form.password_issues = absl::nullopt; + EXPECT_EQ(UpdateChangeForForm(no_info_form, /*password_changed=*/false, + /*insecure_changed=*/false), + db().UpdateLogin(no_info_form, nullptr)); + EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), + ElementsAre(insecure_credential)); +} + +TEST_F(LoginDatabaseTest, UpdateLoginWithUpdatedInsecureCredential) { + PasswordForm form = GenerateExamplePasswordForm(); + ignore_result(db().AddLogin(form)); + InsecureCredential insecure_credential{form.signon_realm, form.username_value, + base::Time(), InsecureType::kLeaked, + IsMuted(false)}; + base::flat_map<InsecureType, InsecurityMetadata> issues; + issues[InsecureType::kLeaked] = + InsecurityMetadata(base::Time(), IsMuted(false)); + form.password_issues = std::move(issues); + + ASSERT_EQ(UpdateChangeForForm(form, /*password_changed=*/false, + /*insecure_changed=*/true), + db().UpdateLogin(form, nullptr)); + ASSERT_THAT(db().insecure_credentials_table().GetAllRows(), + ElementsAre(insecure_credential)); + + (*form.password_issues)[InsecureType::kLeaked].is_muted = IsMuted(true); + EXPECT_EQ(UpdateChangeForForm(form, /*password_changed=*/false, + /*insecure_changed=*/true), + db().UpdateLogin(form, nullptr)); + insecure_credential.is_muted = IsMuted(true); + EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), + ElementsAre(insecure_credential)); +} + +TEST_F(LoginDatabaseTest, UpdateLoginWithRemovedInsecureCredentialEntry) { + PasswordForm form = GenerateExamplePasswordForm(); + ignore_result(db().AddLogin(form)); + InsecureCredential leaked{form.signon_realm, form.username_value, + base::Time(), InsecureType::kLeaked, + IsMuted(false)}; + InsecureCredential phished{form.signon_realm, form.username_value, + base::Time(), InsecureType::kPhished, + IsMuted(false)}; + leaked.parent_key = phished.parent_key = FormPrimaryKey(1); + base::flat_map<InsecureType, InsecurityMetadata> issues; + issues[InsecureType::kLeaked] = + InsecurityMetadata(base::Time(), IsMuted(false)); + issues[InsecureType::kPhished] = + InsecurityMetadata(base::Time(), IsMuted(false)); + form.password_issues = std::move(issues); + + ASSERT_EQ(UpdateChangeForForm(form, /*password_changed=*/false, + /*insecure_changed=*/true), + db().UpdateLogin(form, nullptr)); + ASSERT_THAT(db().insecure_credentials_table().GetAllRows(), + UnorderedElementsAre(leaked, phished)); + + // Complete password_issues removal can usually only happen when the password + // is changed. form.password_value = u"new_password"; - EXPECT_EQ(UpdateChangeForForm(form, /*password_changed=*/true), + form.password_issues->clear(); + EXPECT_EQ(UpdateChangeForForm(form, /*password_changed=*/true, + /*insecure_changed=*/true), db().UpdateLogin(form, nullptr)); - EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), - testing::IsEmpty()); + EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), IsEmpty()); } TEST_F(LoginDatabaseTest, @@ -2720,15 +2879,13 @@ EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), testing::UnorderedElementsAre(credential1, credential2)); - - form.times_used++; + form.password_value = u"new_password"; PasswordStoreChangeList list; list.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form)); list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); EXPECT_EQ(list, db().AddLogin(form)); - EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), - testing::IsEmpty()); + EXPECT_THAT(db().insecure_credentials_table().GetAllRows(), IsEmpty()); } class LoginDatabaseForAccountStoreTest : public testing::Test {
diff --git a/components/password_manager/core/browser/password_form.cc b/components/password_manager/core/browser/password_form.cc index db6294f3..19c086a 100644 --- a/components/password_manager/core/browser/password_form.cc +++ b/components/password_manager/core/browser/password_form.cc
@@ -169,9 +169,13 @@ hashes.push_back(gaia_id_hash.ToBase64()); } + target->SetString("moving_blocked_for_list", base::JoinString(hashes, ", ")); + + if (!form.password_issues.has_value()) + return; std::vector<base::Value> password_issues; - password_issues.reserve(form.password_issues.size()); - for (const auto& issue : form.password_issues) { + password_issues.reserve(form.password_issues->size()); + for (const auto& issue : form.password_issues.value()) { base::Value issue_value(base::Value::Type::DICTIONARY); issue_value.SetStringPath("insecurity_type", ToString(issue.first)); issue_value.SetPath("create_time", @@ -180,7 +184,7 @@ static_cast<bool>(issue.second.is_muted)); password_issues.push_back(std::move(issue_value)); } - target->SetString("moving_blocked_for_list", base::JoinString(hashes, ", ")); + target->SetPath("password_issues ", base::Value(password_issues)); } @@ -246,6 +250,12 @@ return !password_value.empty() || !new_password_value.empty(); } +bool PasswordForm::IsInsecureCredential(InsecureType type) { + if (!password_issues.has_value()) + return false; + return password_issues->find(type) != password_issues->end(); +} + bool ArePasswordFormUniqueKeysEqual(const PasswordForm& left, const PasswordForm& right) { return (left.signon_realm == right.signon_realm && left.url == right.url &&
diff --git a/components/password_manager/core/browser/password_form.h b/components/password_manager/core/browser/password_form.h index 0b676b6e..8d8dc882 100644 --- a/components/password_manager/core/browser/password_form.h +++ b/components/password_manager/core/browser/password_form.h
@@ -60,6 +60,8 @@ IsMuted is_muted{false}; }; +bool operator==(const InsecurityMetadata& lhs, const InsecurityMetadata& rhs); + // The PasswordForm struct encapsulates information about a login form, // which can be an HTML form or a dialog with username/password text fields. // @@ -366,7 +368,10 @@ // A mapping from the credential insecurity type (e.g. leaked, phished), // to its metadata (e.g. time it was discovered, whether alerts are muted). - base::flat_map<InsecureType, InsecurityMetadata> password_issues; + // Forms retrieved for the store always have a `password_issues` value. + // NOTE: If it is known that there are no issues, this should be an empty map. + absl::optional<base::flat_map<InsecureType, InsecurityMetadata>> + password_issues; // Return true if we consider this form to be a change password form and not // a signup form. It's based on local heuristics and may be inaccurate. @@ -397,6 +402,10 @@ // Returns true when |password_value| or |new_password_value| are non-empty. bool HasNonEmptyPasswordValue() const; + // Utility method to check whether the form represents an insecure credential + // of insecure type `type`. + bool IsInsecureCredential(InsecureType type); + PasswordForm(); PasswordForm(const PasswordForm& other); PasswordForm(PasswordForm&& other);
diff --git a/components/password_manager/core/browser/password_manager_test_utils.cc b/components/password_manager/core/browser/password_manager_test_utils.cc index de18ce60..1bbe84e 100644 --- a/components/password_manager/core/browser/password_manager_test_utils.cc +++ b/components/password_manager/core/browser/password_manager_test_utils.cc
@@ -14,6 +14,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/password_manager/core/browser/hash_password_manager.h" +#include "components/password_manager/core/browser/password_form.h" namespace password_manager { @@ -58,6 +59,7 @@ url::Origin::Create(GURL("https://accounts.google.com/login")); } form->in_store = PasswordForm::Store::kProfileStore; + form->password_issues = base::flat_map<InsecureType, InsecurityMetadata>(); return form; }
diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index f4e23f4..f507ccb 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc
@@ -26,6 +26,7 @@ #include "components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h" #include "components/password_manager/core/browser/form_parsing/form_parser.h" #include "components/password_manager/core/browser/insecure_credentials_consumer.h" +#include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" #include "components/password_manager/core/browser/password_reuse_detector.h" #include "components/password_manager/core/browser/password_reuse_manager.h"
diff --git a/components/payments/content/android/java/res/layout/secure_payment_confirmation_authn_ui.xml b/components/payments/content/android/java/res/layout/secure_payment_confirmation_authn_ui.xml index 63626dc..97208a7 100644 --- a/components/payments/content/android/java/res/layout/secure_payment_confirmation_authn_ui.xml +++ b/components/payments/content/android/java/res/layout/secure_payment_confirmation_authn_ui.xml
@@ -27,7 +27,7 @@ android:importantForAccessibility="no" android:layout_height="wrap_content" android:layout_width="match_parent" - android:scaleType="centerCrop"/> + android:scaleType="centerInside"/> <!-- "Verify your purchase" label. --> <TextView
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/JniPaymentApp.java b/components/payments/content/android/java/src/org/chromium/components/payments/JniPaymentApp.java index c214d6b1..36eb907 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/JniPaymentApp.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/JniPaymentApp.java
@@ -18,6 +18,7 @@ import org.chromium.payments.mojom.PaymentMethodData; import org.chromium.payments.mojom.PaymentOptions; import org.chromium.payments.mojom.PaymentRequestDetailsUpdate; +import org.chromium.payments.mojom.PaymentResponse; import org.chromium.payments.mojom.PaymentShippingOption; import java.nio.ByteBuffer; @@ -230,6 +231,13 @@ return mPaymentAppType; } + @Override + public PaymentResponse setAppSpecificResponseFields(PaymentResponse response) { + byte[] byteResult = JniPaymentAppJni.get().setAppSpecificResponseFields( + mNativeObject, response.serialize()); + return PaymentResponse.deserialize(ByteBuffer.wrap(byteResult)); + } + @NativeMethods interface Natives { String[] getInstrumentMethodNames(long nativeJniPaymentApp); @@ -256,5 +264,6 @@ long getUkmSourceId(long nativeJniPaymentApp); void setPaymentHandlerHost(long nativeJniPaymentApp, PaymentHandlerHost paymentHandlerHost); void freeNativeObject(long nativeJniPaymentApp); + byte[] setAppSpecificResponseFields(long nativeJniPaymentApp, ByteBuffer paymentResponse); } }
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentApp.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentApp.java index 7b040cd..c05ed37 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentApp.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentApp.java
@@ -16,6 +16,7 @@ import org.chromium.payments.mojom.PaymentMethodData; import org.chromium.payments.mojom.PaymentOptions; import org.chromium.payments.mojom.PaymentRequestDetailsUpdate; +import org.chromium.payments.mojom.PaymentResponse; import org.chromium.payments.mojom.PaymentShippingOption; import java.util.List; @@ -330,4 +331,15 @@ public boolean isPreferred() { return false; } + + /** + * Updates the response IPC structure with the fields that are unique to this type of payment + * app. Used when JSON serialization of payment method specific data is not being used. The + * payment apps who need to set the fields should override this method. + * @param response The PaymentResponse to whom the fields are set. + * @return The PaymentResponse whose fields has been set. + */ + public PaymentResponse setAppSpecificResponseFields(PaymentResponse response) { + return response; + } }
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java index 1d077c217..6e6d2e7 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java
@@ -690,6 +690,10 @@ ErrorStrings.PAYMENT_APP_INVALID_RESPONSE, PaymentErrorReason.NOT_SUPPORTED); // Intentionally do not early-return. } + if (response.methodName.equals(MethodStrings.SECURE_PAYMENT_CONFIRMATION)) { + assert mInvokedPaymentApp.getInstrumentMethodNames().contains(response.methodName); + mInvokedPaymentApp.setAppSpecificResponseFields(response); + } if (mClient != null) { mClient.onPaymentResponse(response); }
diff --git a/components/payments/content/android/jni_payment_app.cc b/components/payments/content/android/jni_payment_app.cc index 92e398f..df0bf57 100644 --- a/components/payments/content/android/jni_payment_app.cc +++ b/components/payments/content/android/jni_payment_app.cc
@@ -194,6 +194,20 @@ env, jpayment_handler_host)); } +base::android::ScopedJavaLocalRef<jbyteArray> +JniPaymentApp::SetAppSpecificResponseFields( + JNIEnv* env, + const JavaParamRef<jobject>& jpayment_response) { + mojom::PaymentResponsePtr response; + bool success = + android::DeserializeFromJavaByteBuffer(env, jpayment_response, &response); + DCHECK(success); + mojom::PaymentResponsePtr result = + payment_app_->SetAppSpecificResponseFields(std::move(response)); + return base::android::ToJavaByteArray( + env, mojom::PaymentResponse::Serialize(&result)); +} + void JniPaymentApp::FreeNativeObject(JNIEnv* env) { delete this; }
diff --git a/components/payments/content/android/jni_payment_app.h b/components/payments/content/android/jni_payment_app.h index 4e12d41..6694ca1 100644 --- a/components/payments/content/android/jni_payment_app.h +++ b/components/payments/content/android/jni_payment_app.h
@@ -80,6 +80,10 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& jpayment_handler_host); + base::android::ScopedJavaLocalRef<jbyteArray> SetAppSpecificResponseFields( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& jpayment_response); + void FreeNativeObject(JNIEnv* env); private:
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 3eae6333..5d03441a 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -575,7 +575,7 @@ 'NotificationsBlockedForUrls', 'SensorsAllowedForUrls', 'SensorsBlockedForUrls', - "WebUsbAllowDevicesForUrls", + 'WebUsbAllowDevicesForUrls', 'WebUsbAskForUrls', 'WebUsbBlockedForUrls', 'SerialAskForUrls', @@ -1295,7 +1295,7 @@ }, { 'name': 'NewTabPageLocation', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['file://components/policy/resources/OWNERS', 'okalitova@chromium.org'], 'type': 'string', 'schema': { 'type': 'string' }, 'supported_on': ['chrome.*:58-', 'chrome_os:58-'], @@ -5750,7 +5750,7 @@ }, { 'name': 'DefaultCookiesSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['dullweber@google.com', 'file://components/content_settings/OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -5794,7 +5794,7 @@ }, { 'name': 'DefaultImagesSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -5827,7 +5827,7 @@ }, { 'name': 'DefaultJavaScriptSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -5901,7 +5901,7 @@ }, { 'name': 'DefaultPopupsSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -5939,7 +5939,7 @@ }, { 'name': 'DefaultNotificationsSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -5977,7 +5977,7 @@ }, { 'name': 'DefaultGeolocationSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -6016,7 +6016,7 @@ }, { 'name': 'DefaultMediaStreamSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -6050,7 +6050,7 @@ }, { 'name': 'DefaultWebBluetoothGuardSetting', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'int-enum', 'schema': { 'type': 'integer', @@ -6873,7 +6873,7 @@ }, { 'name': 'CookiesAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['dullweber@google.com', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -6902,7 +6902,7 @@ }, { 'name': 'CookiesBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['dullweber@google.com', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -6931,7 +6931,7 @@ }, { 'name': 'CookiesSessionOnlyForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['dullweber@google.com', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -6960,7 +6960,7 @@ }, { 'name': 'ImagesAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -6985,7 +6985,7 @@ }, { 'name': 'ImagesBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7010,7 +7010,7 @@ }, { 'name': 'JavaScriptAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7033,7 +7033,7 @@ }, { 'name': 'JavaScriptBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7056,7 +7056,7 @@ }, { 'name': 'KeygenAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7080,7 +7080,7 @@ }, { 'name': 'KeygenBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/content_settings/OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7272,7 +7272,7 @@ }, { 'name': 'PluginsAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7296,7 +7296,7 @@ }, { 'name': 'PluginsBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7320,7 +7320,7 @@ }, { 'name': 'PopupsAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7348,7 +7348,7 @@ }, { 'name': 'RegisteredProtocolHandlers', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://chrome/browser/custom_handlers/OWNERS'], 'type': 'dict', 'schema': { 'type': 'array', @@ -7389,7 +7389,7 @@ }, { 'name': 'PopupsBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7417,7 +7417,7 @@ }, { 'name': 'NotificationsAllowedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7434,13 +7434,13 @@ 'tags': [], 'desc': '''Setting the policy lets you set a list of URL patterns that specify the sites that can display notifications. - Leaving the policy unset means <ph name="DEFAULT_JAVA_SCRIPT_SETTING_POLICY_NAME">DefaultJavaScriptSetting</ph> applies for all sites, if it's set. If not, the user's personal setting applies. + Leaving the policy unset means <ph name="DEFAULT_NOTIFICATIONS_SETTING_POLICY_NAME">DefaultNotificationsSetting</ph> applies for all sites, if it's set. If not, the user's personal setting applies. For detailed information on valid <ph name="URL_LABEL">url</ph> patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns. <ph name="WILDCARD_VALUE">*</ph> is not an accepted value for this policy.''', }, { 'name': 'NotificationsBlockedForUrls', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['engedy@chromium.org', 'file://components/permissions/PERMISSIONS_OWNERS'], 'type': 'list', 'schema': { 'type': 'array', @@ -7457,7 +7457,7 @@ 'tags': [], 'desc': '''Setting the policy lets you set a list of URL patterns that specify the sites that can't display notifications. - Leaving the policy unset means <ph name="DEFAULT_JAVA_SCRIPT_SETTING_POLICY_NAME">DefaultJavaScriptSetting</ph> applies for all sites, if it's set. If not, the user's personal setting applies. + Leaving the policy unset means <ph name="DEFAULT_NOTIFICATIONS_SETTING_POLICY_NAME">DefaultNotificationsSetting</ph> applies for all sites, if it's set. If not, the user's personal setting applies. For detailed information on valid <ph name="URL_LABEL">url</ph> patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns. <ph name="WILDCARD_VALUE">*</ph> is not an accepted value for this policy.''', },
diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn index 9b87aa1..37d5f26 100644 --- a/components/resources/BUILD.gn +++ b/components/resources/BUILD.gn
@@ -54,8 +54,9 @@ # TODO(crbug/1056278): Enable this on Fuchsia if (safe_browsing_mode > 0 && !is_fuchsia) { - deps += - [ "//components/safe_browsing/core/resources:make_file_types_protobuf" ] + deps += [ + "//components/safe_browsing/content/resources:make_file_types_protobuf", + ] } }
diff --git a/components/resources/safe_browsing_resources.grdp b/components/resources/safe_browsing_resources.grdp index cdbeddc9..8248aed3 100644 --- a/components/resources/safe_browsing_resources.grdp +++ b/components/resources/safe_browsing_resources.grdp
@@ -5,6 +5,6 @@ <include name="IDR_SAFE_BROWSING_JS" file="..\..\components\safe_browsing\content\browser\web_ui\resources\safe_browsing.js" type="BINDATA" /> <!-- TODO(crbug/1056278): Enable this on Fuchsia --> <if expr="safe_browsing_mode != 0 and not is_fuchsia"> - <include name="IDR_DOWNLOAD_FILE_TYPES_PB" file="${root_gen_dir}\components\safe_browsing\core\resources\download_file_types.pb" use_base_dir="false" type="BINDATA" compress="gzip" /> + <include name="IDR_DOWNLOAD_FILE_TYPES_PB" file="${root_gen_dir}\components\safe_browsing\content\resources\download_file_types.pb" use_base_dir="false" type="BINDATA" compress="gzip" /> </if> </grit-part>
diff --git a/components/safe_browsing/README.md b/components/safe_browsing/README.md new file mode 100644 index 0000000..6a13174 --- /dev/null +++ b/components/safe_browsing/README.md
@@ -0,0 +1,16 @@ +//components/safe_browsing is a layered component +(https://sites.google.com/a/chromium.org/dev/developers/design-documents/layered-components-design) +to enable it to be shared cleanly on iOS. + +The component has the following structure: + +* core/: shared code that does not depend on either {src/content, src/ios} or {./content, +./ios} + * browser/: Browser process code + * common/: Code shared by the browser and the renderer (on platforms other than + iOS) +* content/: non-iOS code layered above core/ that integrates with the Content API + * browser/: Browser process code + * common/: Code shared by the browser and the renderer + * renderer/: Renderer process code +* ios/: iOS-specific code layered above core/ that integrates with //ios/web
diff --git a/components/safe_browsing/content/common/BUILD.gn b/components/safe_browsing/content/common/BUILD.gn index 13203b5..002af4a 100644 --- a/components/safe_browsing/content/common/BUILD.gn +++ b/components/safe_browsing/content/common/BUILD.gn
@@ -40,7 +40,7 @@ public_deps = [ "//base", - "//components/safe_browsing/core/common/proto:download_file_types_proto", + "//components/safe_browsing/content/common/proto:download_file_types_proto", ] deps = [
diff --git a/components/safe_browsing/content/common/file_type_policies.h b/components/safe_browsing/content/common/file_type_policies.h index 325614a..f34717f 100644 --- a/components/safe_browsing/content/common/file_type_policies.h +++ b/components/safe_browsing/content/common/file_type_policies.h
@@ -11,7 +11,7 @@ #include "base/files/file_path.h" #include "base/gtest_prod_util.h" #include "base/synchronization/lock.h" -#include "components/safe_browsing/core/common/proto/download_file_types.pb.h" +#include "components/safe_browsing/content/common/proto/download_file_types.pb.h" namespace safe_browsing {
diff --git a/components/safe_browsing/content/common/proto/BUILD.gn b/components/safe_browsing/content/common/proto/BUILD.gn new file mode 100644 index 0000000..1a63e14 --- /dev/null +++ b/components/safe_browsing/content/common/proto/BUILD.gn
@@ -0,0 +1,13 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//components/safe_browsing/buildflags.gni") +import("//third_party/protobuf/proto_library.gni") + +# TODO(crbug/1056278): Enable this on Fuchsia +if (safe_browsing_mode != 0 && !is_fuchsia) { + proto_library("download_file_types_proto") { + sources = [ "download_file_types.proto" ] + } +}
diff --git a/components/safe_browsing/core/common/proto/download_file_types.proto b/components/safe_browsing/content/common/proto/download_file_types.proto similarity index 100% rename from components/safe_browsing/core/common/proto/download_file_types.proto rename to components/safe_browsing/content/common/proto/download_file_types.proto
diff --git a/components/safe_browsing/core/resources/BUILD.gn b/components/safe_browsing/content/resources/BUILD.gn similarity index 89% rename from components/safe_browsing/core/resources/BUILD.gn rename to components/safe_browsing/content/resources/BUILD.gn index 69c81f6..7819b76 100644 --- a/components/safe_browsing/core/resources/BUILD.gn +++ b/components/safe_browsing/content/resources/BUILD.gn
@@ -18,7 +18,7 @@ output_basename = "download_file_types.pb" python_path_root = "$root_out_dir/pyproto" python_path_safe_browsing = - "$python_path_root/components/safe_browsing/core/common/proto" + "$python_path_root/components/safe_browsing/content/common/proto" # Pick an architecture to generate for. These string match those # in the python script. @@ -40,7 +40,7 @@ inputs = [ input_filename ] deps = [ - "//components/safe_browsing/core/common/proto:download_file_types_proto", + "//components/safe_browsing/content/common/proto:download_file_types_proto", "//third_party/protobuf:py_proto", ] @@ -73,12 +73,12 @@ output_basename = "download_file_types.pb" python_path_root = "$root_build_dir/pyproto" python_path_safe_browsing = - "$python_path_root/components/safe_browsing/core/common/proto" + "$python_path_root/components/safe_browsing/content/common/proto" inputs = [ input_filename ] deps = [ - "//components/safe_browsing/core/common/proto:download_file_types_proto", + "//components/safe_browsing/content/common/proto:download_file_types_proto", "//third_party/protobuf:py_proto", ]
diff --git a/components/safe_browsing/core/resources/PRESUBMIT.py b/components/safe_browsing/content/resources/PRESUBMIT.py similarity index 100% rename from components/safe_browsing/core/resources/PRESUBMIT.py rename to components/safe_browsing/content/resources/PRESUBMIT.py
diff --git a/components/safe_browsing/core/resources/download_file_types.asciipb b/components/safe_browsing/content/resources/download_file_types.asciipb similarity index 100% rename from components/safe_browsing/core/resources/download_file_types.asciipb rename to components/safe_browsing/content/resources/download_file_types.asciipb
diff --git a/components/safe_browsing/core/resources/gen_file_type_proto.py b/components/safe_browsing/content/resources/gen_file_type_proto.py similarity index 100% rename from components/safe_browsing/core/resources/gen_file_type_proto.py rename to components/safe_browsing/content/resources/gen_file_type_proto.py
diff --git a/components/safe_browsing/core/resources/push_file_type_proto.py b/components/safe_browsing/content/resources/push_file_type_proto.py similarity index 97% rename from components/safe_browsing/core/resources/push_file_type_proto.py rename to components/safe_browsing/content/resources/push_file_type_proto.py index 0168f0b..9769b4e 100755 --- a/components/safe_browsing/core/resources/push_file_type_proto.py +++ b/components/safe_browsing/content/resources/push_file_type_proto.py
@@ -17,7 +17,7 @@ DEST_BUCKET = 'gs://chrome-component-file-type-policies' -RESOURCE_SUBDIR = 'components/safe_browsing/core/resources' +RESOURCE_SUBDIR = 'components/safe_browsing/content/resources' def main():
diff --git a/components/safe_browsing/core/browser/db/allowlist_checker_client.cc b/components/safe_browsing/core/browser/db/allowlist_checker_client.cc index 9cb8314..d024c86c 100644 --- a/components/safe_browsing/core/browser/db/allowlist_checker_client.cc +++ b/components/safe_browsing/core/browser/db/allowlist_checker_client.cc
@@ -103,7 +103,7 @@ : callback_for_result_(std::move(callback_for_result)), database_manager_(database_manager), default_does_match_allowlist_(default_does_match_allowlist) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Set a timer to fail open, i.e. call it "allowlisted", if the full // check takes too long. @@ -114,7 +114,7 @@ } AllowlistCheckerClient::~AllowlistCheckerClient() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } // SafeBrowsingDatabaseMananger::Client impl @@ -129,7 +129,7 @@ } void AllowlistCheckerClient::OnCheckUrlResult(bool did_match_allowlist) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); timer_.Stop(); // The callback can only be invoked by other code paths if this object is not @@ -142,7 +142,7 @@ } void AllowlistCheckerClient::OnTimeout() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); database_manager_->CancelCheck(this); OnCheckUrlResult(default_does_match_allowlist_); }
diff --git a/components/safe_browsing/core/browser/db/allowlist_checker_client.h b/components/safe_browsing/core/browser/db/allowlist_checker_client.h index 6fdbfe9a..27a1c5d6 100644 --- a/components/safe_browsing/core/browser/db/allowlist_checker_client.h +++ b/components/safe_browsing/core/browser/db/allowlist_checker_client.h
@@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "base/timer/timer.h" #include "components/safe_browsing/core/browser/db/database_manager.h" #include "url/gurl.h" @@ -77,7 +77,7 @@ // Called when the call to CheckCsdAllowlistUrl times out. void OnTimeout(); - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); // For setting up timeout behavior. base::OneShotTimer timer_;
diff --git a/components/safe_browsing/core/browser/db/allowlist_checker_client_unittest.cc b/components/safe_browsing/core/browser/db/allowlist_checker_client_unittest.cc index 18afd620..bfcc344 100644 --- a/components/safe_browsing/core/browser/db/allowlist_checker_client_unittest.cc +++ b/components/safe_browsing/core/browser/db/allowlist_checker_client_unittest.cc
@@ -9,7 +9,7 @@ #include "base/run_loop.h" #include "base/test/mock_callback.h" #include "base/test/task_environment.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "components/safe_browsing/core/browser/db/test_database_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -29,8 +29,9 @@ class MockSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager { public: MockSafeBrowsingDatabaseManager() - : TestSafeBrowsingDatabaseManager(base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get()) {} + : TestSafeBrowsingDatabaseManager( + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get()) {} MOCK_METHOD1(CancelCheck, void(SafeBrowsingDatabaseManager::Client*));
diff --git a/components/safe_browsing/core/browser/db/database_manager_unittest.cc b/components/safe_browsing/core/browser/db/database_manager_unittest.cc index 515cc6ed..3af3e57 100644 --- a/components/safe_browsing/core/browser/db/database_manager_unittest.cc +++ b/components/safe_browsing/core/browser/db/database_manager_unittest.cc
@@ -15,11 +15,11 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" -#include "base/single_thread_task_runner.h" +#include "base/sequenced_task_runner.h" #include "base/synchronization/waitable_event.h" #include "base/test/bind.h" #include "base/test/task_environment.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "components/safe_browsing/core/browser/db/test_database_manager.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/db/v4_test_util.h" @@ -71,8 +71,8 @@ &test_url_loader_factory_); db_manager_ = new TestSafeBrowsingDatabaseManager( - base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get()); + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get()); db_manager_->StartOnIOThread(test_shared_loader_factory_, GetTestV4ProtocolConfig()); }
diff --git a/components/safe_browsing/core/browser/db/v4_database.cc b/components/safe_browsing/core/browser/db/v4_database.cc index 892551e..a31159ab 100644 --- a/components/safe_browsing/core/browser/db/v4_database.cc +++ b/components/safe_browsing/core/browser/db/v4_database.cc
@@ -14,7 +14,7 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/task_runner_util.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "components/safe_browsing/core/common/proto/webui.pb.h" using base::TimeTicks; @@ -64,8 +64,8 @@ DCHECK(base_path.IsAbsolute()); DCHECK(!list_infos.empty()); - const scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner = - base::ThreadTaskRunnerHandle::Get(); + const scoped_refptr<base::SequencedTaskRunner> callback_task_runner = + base::SequencedTaskRunnerHandle::Get(); db_task_runner->PostTask( FROM_HERE, base::BindOnce(&V4Database::CreateOnTaskRunner, db_task_runner, base_path, list_infos, callback_task_runner, @@ -77,7 +77,7 @@ const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, const base::FilePath& base_path, const ListInfos& list_infos, - const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner, + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, NewDatabaseReadyCallback new_db_callback) { DCHECK(db_task_runner->RunsTasksInCurrentSequence()); @@ -131,25 +131,25 @@ db_task_runner_(db_task_runner), pending_store_updates_(0) { DCHECK(db_task_runner->RunsTasksInCurrentSequence()); - // This method executes on the DB task runner, whereas |io_thread_checker_| is - // meant to verify methods that should execute on the IO thread. Detach that - // thread checker here; it will be bound to the IO thread in - // InitializeOnIOThread(). - DETACH_FROM_THREAD(io_thread_checker_); + // This method executes on the DB sequence, whereas |io_sequence_checker_| + // is meant to verify methods that should execute on the IO sequence. Detach + // that sequence checker here; it will be bound to the IO sequence in + // InitializeOnIOSequence(). + DETACH_FROM_SEQUENCE(io_sequence_checker_); } -void V4Database::InitializeOnIOThread() { - // This invocation serves to bind |io_thread_checker_| to the IO thread after - // its having been detached from the DB task runner in this object's +void V4Database::InitializeOnIOSequence() { + // This invocation serves to bind |io_sequence_checker_| to the IO sequence + // after its having been detached from the DB sequence in this object's // constructor. - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); } // static void V4Database::Destroy(std::unique_ptr<V4Database> v4_database) { V4Database* v4_database_raw = v4_database.release(); if (v4_database_raw) { - DCHECK_CALLED_ON_VALID_THREAD(v4_database_raw->io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(v4_database_raw->io_sequence_checker_); v4_database_raw->weak_factory_on_io_.InvalidateWeakPtrs(); v4_database_raw->db_task_runner_->DeleteSoon(FROM_HERE, v4_database_raw); } @@ -162,16 +162,16 @@ void V4Database::ApplyUpdate( std::unique_ptr<ParsedServerResponse> parsed_server_response, DatabaseUpdatedCallback db_updated_callback) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); DCHECK(!pending_store_updates_); DCHECK(db_updated_callback_.is_null()); db_updated_callback_ = db_updated_callback; - // Post the V4Store update task on the task runner but get the callback on the - // current thread. - const scoped_refptr<base::SingleThreadTaskRunner> current_task_runner = - base::ThreadTaskRunnerHandle::Get(); + // Post the V4Store update task on the DB sequence but get the callback on the + // current sequence. + const scoped_refptr<base::SequencedTaskRunner> current_task_runner = + base::SequencedTaskRunnerHandle::Get(); for (std::unique_ptr<ListUpdateResponse>& response : *parsed_server_response) { ListIdentifier identifier(*response); @@ -203,7 +203,7 @@ void V4Database::UpdatedStoreReady(ListIdentifier identifier, std::unique_ptr<V4Store> new_store) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); DCHECK(pending_store_updates_); if (new_store) { (*store_map_)[identifier].swap(new_store); @@ -229,7 +229,7 @@ bool V4Database::AreAnyStoresAvailable( const StoresToCheck& stores_to_check) const { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); for (const ListIdentifier& identifier : stores_to_check) { if (IsStoreAvailable(identifier)) return true; @@ -239,7 +239,7 @@ bool V4Database::AreAllStoresAvailable( const StoresToCheck& stores_to_check) const { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); for (const ListIdentifier& identifier : stores_to_check) { if (!IsStoreAvailable(identifier)) return false; @@ -251,7 +251,7 @@ const FullHash& full_hash, const StoresToCheck& stores_to_check, StoreAndHashPrefixes* matched_store_and_hash_prefixes) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); matched_store_and_hash_prefixes->clear(); for (const ListIdentifier& identifier : stores_to_check) { if (!IsStoreAvailable(identifier)) @@ -268,7 +268,7 @@ void V4Database::ResetStores( const std::vector<ListIdentifier>& stores_to_reset) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); for (const ListIdentifier& identifier : stores_to_reset) { store_map_->at(identifier)->Reset(); } @@ -276,7 +276,7 @@ void V4Database::VerifyChecksum( DatabaseReadyForUpdatesCallback db_ready_for_updates_callback) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); // Make a threadsafe copy of store_map_ w/raw pointers that we can hand to // the DB thread. The V4Stores ptrs are guaranteed to be valid because their @@ -298,7 +298,7 @@ void V4Database::OnChecksumVerified( DatabaseReadyForUpdatesCallback db_ready_for_updates_callback, const std::vector<ListIdentifier>& stores_to_reset) { - DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(io_sequence_checker_); std::move(db_ready_for_updates_callback).Run(stores_to_reset); }
diff --git a/components/safe_browsing/core/browser/db/v4_database.h b/components/safe_browsing/core/browser/db/v4_database.h index 99b08ba..42bba4b0 100644 --- a/components/safe_browsing/core/browser/db/v4_database.h +++ b/components/safe_browsing/core/browser/db/v4_database.h
@@ -14,9 +14,8 @@ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/sequence_checker.h" #include "base/sequenced_task_runner.h" -#include "base/single_thread_task_runner.h" -#include "base/threading/thread_checker.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/db/v4_store.h" #include "components/safe_browsing/core/common/proto/webui.pb.h" @@ -108,7 +107,7 @@ // the database creation is complete, it runs the NewDatabaseReadyCallback on // the same thread as it was called. // NOTE: Within |new_db_callback| the client should invoke - // V4Database::InitializeOnIOThread() on the IO thread. + // V4Database::InitializeOnIOSequence() on the IO thread. static void Create( const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, const base::FilePath& base_path, @@ -116,7 +115,7 @@ NewDatabaseReadyCallback new_db_callback); // Initialize state that lives on the IO thread. - void InitializeOnIOThread(); + void InitializeOnIOSequence(); // Destroys the provided v4_database on its task_runner since this may be a // long operation. @@ -209,7 +208,7 @@ const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, const base::FilePath& base_path, const ListInfos& list_infos, - const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner, + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, NewDatabaseReadyCallback callback); // Makes the passed |factory| the factory used to instantiate a V4Database. @@ -235,8 +234,9 @@ bool IsStoreAvailable(const ListIdentifier& identifier) const; - // Used to verify that certain methods are called on the IO thread. - THREAD_CHECKER(io_thread_checker_); + // Used to verify that certain methods are called on the client-designated IO + // sequence (see InitializeOnIOSequence()). + SEQUENCE_CHECKER(io_sequence_checker_); const scoped_refptr<base::SequencedTaskRunner> db_task_runner_;
diff --git a/components/safe_browsing/core/browser/db/v4_local_database_manager.cc b/components/safe_browsing/core/browser/db/v4_local_database_manager.cc index 487dbf0b..f17211a 100644 --- a/components/safe_browsing/core/browser/db/v4_local_database_manager.cc +++ b/components/safe_browsing/core/browser/db/v4_local_database_manager.cc
@@ -702,7 +702,7 @@ std::unique_ptr<V4Database> v4_database) { DCHECK(io_task_runner()->RunsTasksInCurrentSequence()); - v4_database->InitializeOnIOThread(); + v4_database->InitializeOnIOSequence(); // The following check is needed because it is possible that by the time the // database is ready, StopOnIOThread has been called.
diff --git a/components/safe_browsing/core/browser/db/v4_local_database_manager_unittest.cc b/components/safe_browsing/core/browser/db/v4_local_database_manager_unittest.cc index 8959415..cdfe86c 100644 --- a/components/safe_browsing/core/browser/db/v4_local_database_manager_unittest.cc +++ b/components/safe_browsing/core/browser/db/v4_local_database_manager_unittest.cc
@@ -19,7 +19,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "build/branding_buildflags.h" #include "build/build_config.h" #include "components/safe_browsing/core/browser/db/v4_database.h" @@ -62,7 +62,7 @@ const std::vector<std::string>&, FullHashCallback callback) override { // Async, since the real manager might use a fetcher. - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), full_hash_infos_)); } @@ -114,8 +114,8 @@ bool stores_available, int64_t store_file_size) { // Mimics V4Database::Create - const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner = - base::ThreadTaskRunnerHandle::Get(); + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner = + base::SequencedTaskRunnerHandle::Get(); db_task_runner->PostTask( FROM_HERE, base::BindOnce(&FakeV4Database::CreateOnTaskRunner, db_task_runner, @@ -160,7 +160,7 @@ const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, std::unique_ptr<StoreMap> store_map, const StoreAndHashPrefixes& store_and_hash_prefixes, - const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner, + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, NewDatabaseReadyCallback new_db_callback, bool stores_available, int64_t store_file_size) { @@ -309,8 +309,8 @@ scoped_refptr<base::SequencedTaskRunner> task_runner) : V4LocalDatabaseManager(base_path, extended_reporting_level_callback, - base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get(), task_runner), perform_full_hash_check_called_(false) {} @@ -354,8 +354,8 @@ v4_local_database_manager_ = base::WrapRefCounted(new V4LocalDatabaseManager( base_dir_.GetPath(), erl_callback_, - base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get(), task_runner_)); + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get(), task_runner_)); StartLocalDatabaseManager(); } @@ -415,8 +415,8 @@ v4_local_database_manager_ = base::WrapRefCounted(new V4LocalDatabaseManager( base_dir_.GetPath(), erl_callback_, - base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get(), task_runner_)); + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get(), task_runner_)); StartLocalDatabaseManager(); }
diff --git a/components/safe_browsing/core/browser/db/v4_store.cc b/components/safe_browsing/core/browser/db/v4_store.cc index 265ba9f4..13941bfb 100644 --- a/components/safe_browsing/core/browser/db/v4_store.cc +++ b/components/safe_browsing/core/browser/db/v4_store.cc
@@ -362,7 +362,7 @@ void V4Store::ApplyUpdate( std::unique_ptr<ListUpdateResponse> response, - const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner, + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, UpdatedStoreReadyCallback callback) { base::ElapsedThreadTimer thread_timer; std::unique_ptr<V4Store> new_store(
diff --git a/components/safe_browsing/core/browser/db/v4_store.h b/components/safe_browsing/core/browser/db/v4_store.h index dbadd52c..76aa0b9 100644 --- a/components/safe_browsing/core/browser/db/v4_store.h +++ b/components/safe_browsing/core/browser/db/v4_store.h
@@ -14,7 +14,6 @@ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" -#include "base/single_thread_task_runner.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/common/proto/webui.pb.h" @@ -196,7 +195,7 @@ int64_t file_size() const { return file_size_; } void ApplyUpdate(std::unique_ptr<ListUpdateResponse> response, - const scoped_refptr<base::SingleThreadTaskRunner>& runner, + const scoped_refptr<base::SequencedTaskRunner>& runner, UpdatedStoreReadyCallback callback); // Records (in kilobytes) and returns the size of the file on disk for this
diff --git a/components/safe_browsing/core/browser/password_protection/password_protection_service_base.cc b/components/safe_browsing/core/browser/password_protection/password_protection_service_base.cc index e1d5071..adb2984 100644 --- a/components/safe_browsing/core/browser/password_protection/password_protection_service_base.cc +++ b/components/safe_browsing/core/browser/password_protection/password_protection_service_base.cc
@@ -15,7 +15,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_reuse_detector.h" #include "components/safe_browsing/core/browser/db/database_manager.h" @@ -126,7 +126,7 @@ PasswordProtectionRequest* request, RequestOutcome outcome, std::unique_ptr<LoginReputationClientResponse> response) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(request); if (response) { @@ -205,7 +205,7 @@ } void PasswordProtectionServiceBase::CancelPendingRequests() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto it = pending_requests_.begin(); it != pending_requests_.end();) { PasswordProtectionRequest* request = it->get(); // These are the requests for whom we're still waiting for verdicts. @@ -243,7 +243,7 @@ void PasswordProtectionServiceBase::OnURLsDeleted( history::HistoryService* history_service, const history::DeletionInfo& deletion_info) { - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindRepeating(&PasswordProtectionServiceBase:: RemoveUnhandledSyncPasswordReuseOnURLsDeleted,
diff --git a/components/safe_browsing/core/browser/password_protection/password_protection_service_base.h b/components/safe_browsing/core/browser/password_protection/password_protection_service_base.h index 4681a70..de33159 100644 --- a/components/safe_browsing/core/browser/password_protection/password_protection_service_base.h +++ b/components/safe_browsing/core/browser/password_protection/password_protection_service_base.h
@@ -13,8 +13,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" +#include "base/sequence_checker.h" #include "base/task/cancelable_task_tracker.h" -#include "base/threading/thread_checker.h" #include "build/build_config.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_service_observer.h" @@ -423,7 +423,7 @@ virtual gfx::Size GetCurrentContentAreaSize() const = 0; #endif - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); std::vector<std::string> saved_passwords_matching_domains_;
diff --git a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc index 736695e4..16e28b42 100644 --- a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc +++ b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc
@@ -9,7 +9,7 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/strcat.h" #include "base/strings/string_piece.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" @@ -204,7 +204,7 @@ } void RealTimeUrlLookupServiceBase::HandleLookupError() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); consecutive_failures_++; // Any successful lookup clears both |consecutive_failures_| as well as @@ -238,7 +238,7 @@ } void RealTimeUrlLookupServiceBase::HandleLookupSuccess() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetFailures(); // |did_successful_lookup_since_last_backoff_| is set to true only when we @@ -247,7 +247,7 @@ } bool RealTimeUrlLookupServiceBase::IsInBackoffMode() const { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool in_backoff = backoff_timer_.IsRunning(); RecordBooleanWithAndWithoutSuffix("SafeBrowsing.RT.Backoff.State", GetMetricSuffix(), in_backoff); @@ -255,14 +255,14 @@ } void RealTimeUrlLookupServiceBase::ResetFailures() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); consecutive_failures_ = 0; backoff_timer_.Stop(); } std::unique_ptr<RTLookupResponse> RealTimeUrlLookupServiceBase::GetCachedRealTimeUrlVerdict(const GURL& url) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); std::unique_ptr<RTLookupResponse::ThreatInfo> cached_threat_info = std::make_unique<RTLookupResponse::ThreatInfo>(); @@ -297,7 +297,7 @@ const GURL& url, RTLookupResponse response) { if (response.threat_info_size() > 0) { - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&VerdictCacheManager::CacheRealTimeUrlVerdict, base::Unretained(cache_manager_), url, response, base::Time::Now())); @@ -309,7 +309,7 @@ RTLookupRequestCallback request_callback, RTLookupResponseCallback response_callback, scoped_refptr<base::SequencedTaskRunner> callback_task_runner) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(url.is_valid()); // Check cache. @@ -341,7 +341,7 @@ RTLookupRequestCallback request_callback, RTLookupResponseCallback response_callback, scoped_refptr<base::SequencedTaskRunner> callback_task_runner) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); std::unique_ptr<RTLookupRequest> request = FillRequestProto(url); RecordRequestPopulationWithAndWithoutSuffix( "SafeBrowsing.RT.Request.UserPopulation", GetMetricSuffix(), @@ -407,7 +407,7 @@ base::TimeTicks request_start_time, scoped_refptr<base::SequencedTaskRunner> response_callback_task_runner, std::unique_ptr<std::string> response_body) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = pending_requests_.find(url_loader); DCHECK(it != pending_requests_.end()) << "Request not found";
diff --git a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.h b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.h index 18a71ee..99b1fbb 100644 --- a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.h +++ b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.h
@@ -11,7 +11,7 @@ #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "components/keyed_service/core/keyed_service.h" @@ -214,7 +214,7 @@ // Fills in fields in |RTLookupRequest|. std::unique_ptr<RTLookupRequest> FillRequestProto(const GURL& url); - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); // Count of consecutive failures to complete URL lookup requests. When it // reaches |kMaxFailuresToEnforceBackoff|, we enter the backoff mode. It gets
diff --git a/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc b/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc index edd4d77e..9818f1a 100644 --- a/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc +++ b/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc
@@ -9,7 +9,7 @@ #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/safe_browsing/buildflags.h" @@ -643,7 +643,7 @@ base::MockCallback<RTLookupResponseCallback> response_callback; rt_service()->StartLookup(url, request_callback.Get(), response_callback.Get(), - base::ThreadTaskRunnerHandle::Get()); + base::SequencedTaskRunnerHandle::Get()); // |request_callback| should not be called. EXPECT_CALL(request_callback, Run(_, _)).Times(0); @@ -679,7 +679,7 @@ // Check token is attached. EXPECT_EQ("access_token_string", token); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -716,7 +716,7 @@ // indicates that token fetches are not configured in the client. EXPECT_EQ("", token); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -740,7 +740,7 @@ base::MockCallback<RTLookupResponseCallback> response_callback; rt_service()->StartLookup(url, request_callback.Get(), response_callback.Get(), - base::ThreadTaskRunnerHandle::Get()); + base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(request_callback, Run(_, _)).Times(1); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ false, @@ -764,7 +764,7 @@ base::MockCallback<RTLookupResponseCallback> response_callback; rt_service()->StartLookup(url, request_callback.Get(), response_callback.Get(), - base::ThreadTaskRunnerHandle::Get()); + base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ false, /* is_cached_response */ false, _)); @@ -811,7 +811,7 @@ EXPECT_EQ(kTestUrl, request->referrer_chain().Get(0).url()); EXPECT_EQ(kTestReferrerUrl, request->referrer_chain().Get(1).url()); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); task_environment_.RunUntilIdle(); } @@ -843,7 +843,7 @@ // Check referrer chain is attached. EXPECT_EQ(0, request->referrer_chain().size()); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -903,7 +903,7 @@ .Get(1) .is_subframe_referrer_url_removed()); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -961,7 +961,7 @@ EXPECT_FALSE( request->referrer_chain().Get(1).is_subframe_url_removed()); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -1003,7 +1003,7 @@ EXPECT_EQ(1, request->referrer_chain().size()); EXPECT_EQ(kTestUrl, request->referrer_chain().Get(0).url()); }), - response_callback.Get(), base::ThreadTaskRunnerHandle::Get()); + response_callback.Get(), base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(response_callback, Run(/* is_rt_lookup_successful */ true, /* is_cached_response */ false, _)); @@ -1019,7 +1019,7 @@ base::MockCallback<RTLookupResponseCallback> response_callback; rt_service()->StartLookup(url, request_callback.Get(), response_callback.Get(), - base::ThreadTaskRunnerHandle::Get()); + base::SequencedTaskRunnerHandle::Get()); EXPECT_CALL(request_callback, Run(_, _)).Times(1); EXPECT_CALL(response_callback, Run(_, _, _)).Times(0);
diff --git a/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.cc b/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.cc index ba2c5b7..e12a1058 100644 --- a/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.cc +++ b/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.cc
@@ -6,8 +6,8 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/sequence_checker.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" namespace safe_browsing { @@ -25,11 +25,11 @@ int SafeBrowsingTokenFetchTracker::StartTrackingTokenFetch( SafeBrowsingTokenFetcher::Callback on_token_fetched_callback, OnTokenFetchTimeoutCallback on_token_fetch_timeout_callback) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); const int request_id = requests_sent_; requests_sent_++; callbacks_[request_id] = std::move(on_token_fetched_callback); - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&SafeBrowsingTokenFetchTracker::OnTokenFetchTimeout, weak_ptr_factory_.GetWeakPtr(), request_id,
diff --git a/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.h b/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.h index e9f31ea7..8927c89a 100644 --- a/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.h +++ b/components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.h
@@ -10,7 +10,7 @@ #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "build/build_config.h" #include "components/safe_browsing/core/browser/safe_browsing_token_fetcher.h" @@ -57,7 +57,7 @@ OnTokenFetchTimeoutCallback on_token_fetch_timeout_callback); void Finish(int request_id, const std::string& access_token); - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); // The count of requests sent. This is used as an ID for requests. int requests_sent_ = 0;
diff --git a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.cc b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.cc index b9577c0..a832b19 100644 --- a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.cc +++ b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.cc
@@ -8,7 +8,7 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros_local.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/trace_event/trace_event.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/realtime/policy_engine.h" @@ -131,7 +131,7 @@ // This object is used exclusively on the IO thread but may be constructed on // the UI thread. - DETACH_FROM_THREAD(thread_checker_); + DETACH_FROM_SEQUENCE(sequence_checker_); } SafeBrowsingUrlCheckerImpl::SafeBrowsingUrlCheckerImpl( @@ -158,11 +158,11 @@ // This object is used exclusively on the IO thread but may be constructed on // the UI thread. - DETACH_FROM_THREAD(thread_checker_); + DETACH_FROM_SEQUENCE(sequence_checker_); } SafeBrowsingUrlCheckerImpl::~SafeBrowsingUrlCheckerImpl() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (state_ == STATE_CHECKING_URL) { if (can_check_db_) { @@ -210,7 +210,7 @@ resource.callback = base::BindRepeating(&SafeBrowsingUrlCheckerImpl::OnBlockingPageComplete, weak_factory_.GetWeakPtr()); - resource.callback_thread = base::ThreadTaskRunnerHandle::Get(); + resource.callback_sequence = base::SequencedTaskRunnerHandle::Get(); resource.web_contents_getter = web_contents_getter_; resource.web_state_getter = web_state_getter_; resource.threat_source = is_from_real_time_check @@ -336,7 +336,7 @@ void SafeBrowsingUrlCheckerImpl::CheckUrlImpl(const GURL& url, const std::string& method, Notifier notifier) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(1) << "SafeBrowsingUrlCheckerImpl checks URL: " << url; urls_.emplace_back(url, method, std::move(notifier), @@ -346,7 +346,7 @@ } void SafeBrowsingUrlCheckerImpl::ProcessUrls() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_NE(STATE_BLOCKED, state_); if (!base::FeatureList::IsEnabled(kDelayedWarnings)) { DCHECK_NE(STATE_DELAYED_BLOCKING_PAGE, state_); @@ -404,7 +404,7 @@ TRACE_EVENT_ASYNC_BEGIN1("safe_browsing", "CheckUrl", this, "url", url.spec()); - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&SafeBrowsingUrlCheckerImpl::OnCheckBrowseUrlResult, weak_factory_.GetWeakPtr(), url, threat_type, @@ -446,7 +446,7 @@ // Full-hash matched locally so queue a call to // |OnCheckUrlForHighConfidenceAllowlist| to trigger the hash-based // checking. - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&SafeBrowsingUrlCheckerImpl:: OnCheckUrlForHighConfidenceAllowlist, @@ -457,7 +457,7 @@ // No match found locally or |can_check_db_| is false. Queue the call // to |OnCheckUrlForHighConfidenceAllowlist| to perform the full URL // lookup. - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&SafeBrowsingUrlCheckerImpl:: OnCheckUrlForHighConfidenceAllowlist, @@ -559,7 +559,7 @@ void SafeBrowsingUrlCheckerImpl::OnCheckUrlForHighConfidenceAllowlist( bool did_match_allowlist) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool is_expected_request_destination = (network::mojom::RequestDestination::kDocument == request_destination_) || ((network::mojom::RequestDestination::kIframe == request_destination_ || @@ -579,7 +579,8 @@ FROM_HERE, base::BindOnce(&SafeBrowsingUrlCheckerImpl::StartLookupOnUIThread, weak_factory_.GetWeakPtr(), url, url_lookup_service_on_ui_, - database_manager_, base::ThreadTaskRunnerHandle::Get())); + database_manager_, + base::SequencedTaskRunnerHandle::Get())); } void SafeBrowsingUrlCheckerImpl::SetWebUIToken(int token) { @@ -617,7 +618,7 @@ } void SafeBrowsingUrlCheckerImpl::PerformHashBasedCheck(const GURL& url) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!can_check_db_ || database_manager_->CheckBrowseUrl( url, url_checker_delegate_->GetThreatTypes(), this)) { @@ -638,7 +639,7 @@ void SafeBrowsingUrlCheckerImpl::OnRTLookupRequest( std::unique_ptr<RTLookupRequest> request, std::string oauth_token) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); LogRTLookupRequest(*request, oauth_token); } @@ -647,7 +648,7 @@ bool is_rt_lookup_successful, bool is_cached_response, std::unique_ptr<RTLookupResponse> response) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool is_expected_request_destination = (network::mojom::RequestDestination::kDocument == request_destination_) || ((network::mojom::RequestDestination::kIframe == request_destination_ || @@ -684,7 +685,7 @@ void SafeBrowsingUrlCheckerImpl::LogRTLookupRequest( const RTLookupRequest& request, const std::string& oauth_token) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!webui_delegate_) return; @@ -701,7 +702,7 @@ void SafeBrowsingUrlCheckerImpl::LogRTLookupResponse( const RTLookupResponse& response) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!webui_delegate_) return;
diff --git a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h index 3cba01c3..db281e3 100644 --- a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h +++ b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "base/timer/timer.h" #include "components/safe_browsing/core/browser/db/database_manager.h" #include "components/safe_browsing/core/common/proto/realtimeapi.pb.h" @@ -266,7 +266,7 @@ bool is_cached_safe_url; }; - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); const net::HttpRequestHeaders headers_; const int load_flags_; const network::mojom::RequestDestination request_destination_;
diff --git a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl_unittest.cc b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl_unittest.cc index 59a1b3d..27f6ed1 100644 --- a/components/safe_browsing/core/browser/safe_browsing_url_checker_impl_unittest.cc +++ b/components/safe_browsing/core/browser/safe_browsing_url_checker_impl_unittest.cc
@@ -11,7 +11,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/mock_callback.h" #include "base/test/task_environment.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "components/safe_browsing/core/browser/db/test_database_manager.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/realtime/url_lookup_service.h" @@ -37,8 +37,9 @@ class MockSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager { public: MockSafeBrowsingDatabaseManager() - : TestSafeBrowsingDatabaseManager(base::ThreadTaskRunnerHandle::Get(), - base::ThreadTaskRunnerHandle::Get()) {} + : TestSafeBrowsingDatabaseManager( + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get()) {} // SafeBrowsingDatabaseManager implementation. // Checks the threat type of |gurl| previously set by |SetThreatTypeForUrl|. // It crashes if the threat type of |gurl| is not set in advance. @@ -52,7 +53,7 @@ return true; } if (!urls_delayed_callback_[url]) { - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&MockSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, this, gurl, client)); @@ -93,7 +94,7 @@ std::string url = gurl.spec(); DCHECK(base::Contains(urls_delayed_callback_, url)); DCHECK_EQ(true, urls_delayed_callback_[url]); - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&MockSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, this, gurl, urls_client_[url])); @@ -259,7 +260,7 @@ /*has_user_gesture=*/false, url_checker_delegate_, mock_web_contents_getter.Get(), real_time_lookup_enabled, /*can_rt_check_subresource_url=*/false, can_check_safe_browsing_db, - base::ThreadTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get(), real_time_lookup_enabled ? url_lookup_service_->GetWeakPtr() : nullptr, /*webui_delegate_=*/nullptr); }
diff --git a/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.cc b/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.cc index dccc4ea3..3c962eb 100644 --- a/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.cc +++ b/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.cc
@@ -28,7 +28,7 @@ void SafeBrowsingPrimaryAccountTokenFetcher::Start( Callback callback) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // NOTE: base::Unretained() is safe below as this object owns // |token_fetch_tracker_|, and the callback will not be invoked after
diff --git a/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.h b/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.h index f246ecef..5e4ab2e1 100644 --- a/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.h +++ b/components/safe_browsing/core/browser/sync/safe_browsing_primary_account_token_fetcher.h
@@ -9,7 +9,7 @@ #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "components/safe_browsing/core/browser/safe_browsing_token_fetch_tracker.h" #include "components/safe_browsing/core/browser/safe_browsing_token_fetcher.h" #include "components/signin/public/identity_manager/access_token_info.h" @@ -44,7 +44,7 @@ signin::AccessTokenInfo access_token_info); void OnTokenTimeout(int request_id); - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); // Reference to the identity manager to fetch from. signin::IdentityManager* identity_manager_;
diff --git a/components/safe_browsing/core/browser/verdict_cache_manager.cc b/components/safe_browsing/core/browser/verdict_cache_manager.cc index ba43cbfc..0e25e02 100644 --- a/components/safe_browsing/core/browser/verdict_cache_manager.cc +++ b/components/safe_browsing/core/browser/verdict_cache_manager.cc
@@ -11,7 +11,7 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" #include "components/history/core/browser/history_service_observer.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" @@ -679,7 +679,7 @@ void VerdictCacheManager::OnURLsDeleted( history::HistoryService* history_service, const history::DeletionInfo& deletion_info) { - base::ThreadTaskRunnerHandle::Get()->PostTask( + base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindRepeating( &VerdictCacheManager::RemoveContentSettingsOnURLsDeleted, GetWeakPtr(), deletion_info.IsAllHistory(),
diff --git a/components/safe_browsing/core/common/features.cc b/components/safe_browsing/core/common/features.cc index 6a3bdae..774af6b 100644 --- a/components/safe_browsing/core/common/features.cc +++ b/components/safe_browsing/core/common/features.cc
@@ -51,7 +51,7 @@ "ClientSideDetectionReferrerChain", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kFileAnalysisMimeTypeSniff{ - "FileAnalysisMimeTypeSniff", base::FEATURE_DISABLED_BY_DEFAULT}; + "FileAnalysisMimeTypeSniff", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kClientSideDetectionWithToken{ "SafeBrowsingCSDRequestWithToken", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/components/safe_browsing/core/common/proto/BUILD.gn b/components/safe_browsing/core/common/proto/BUILD.gn index 9da95b12..cd74381 100644 --- a/components/safe_browsing/core/common/proto/BUILD.gn +++ b/components/safe_browsing/core/common/proto/BUILD.gn
@@ -35,12 +35,3 @@ sources = [ "client_model.proto" ] deps = [ ":csd_proto" ] } - -# These files have no content/ dependency, but we still aren't building them on -# on iOS since we don't ship download protection on that platform. -# TODO(crbug/1056278): Enable this on Fuchsia -if (safe_browsing_mode != 0 && !is_ios && !is_fuchsia) { - proto_library("download_file_types_proto") { - sources = [ "download_file_types.proto" ] - } -}
diff --git a/components/security_interstitials/core/unsafe_resource.cc b/components/security_interstitials/core/unsafe_resource.cc index 2d272dfa..36ad55b66 100644 --- a/components/security_interstitials/core/unsafe_resource.cc +++ b/components/security_interstitials/core/unsafe_resource.cc
@@ -64,8 +64,8 @@ if (callback.is_null()) return; - DCHECK(callback_thread); - callback_thread->PostTask( + DCHECK(callback_sequence); + callback_sequence->PostTask( from_here, base::BindOnce(callback, proceed, showed_interstitial)); }
diff --git a/components/security_interstitials/core/unsafe_resource.h b/components/security_interstitials/core/unsafe_resource.h index c678490..fc3e70c 100644 --- a/components/security_interstitials/core/unsafe_resource.h +++ b/components/security_interstitials/core/unsafe_resource.h
@@ -9,7 +9,7 @@ #include "base/callback.h" #include "base/memory/ref_counted.h" -#include "base/single_thread_task_runner.h" +#include "base/sequenced_task_runner.h" #include "components/safe_browsing/core/browser/db/hit_report.h" #include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "services/network/public/mojom/fetch_api.mojom.h" @@ -49,7 +49,7 @@ // committed. bool IsMainPageLoadBlocked() const; - // Checks if |callback| is not null and posts it to |callback_thread|. + // Checks if |callback| is not null and posts it to |callback_sequence|. void DispatchCallback(const base::Location& from_here, bool proceed, bool showed_interstitial) const; @@ -64,8 +64,8 @@ safe_browsing::SBThreatType threat_type; safe_browsing::ThreatMetadata threat_metadata; network::mojom::RequestDestination request_destination; - UrlCheckCallback callback; // This is called back on |callback_thread|. - scoped_refptr<base::SingleThreadTaskRunner> callback_thread; + UrlCheckCallback callback; // This is called back on |callback_sequence|. + scoped_refptr<base::SequencedTaskRunner> callback_sequence; // TODO(crbug.com/1073315): |web_state_getter| is only used on iOS, and // |web_contents_getter| is used on all other platforms. This struct should // be refactored to use only the common functionality can be shared across
diff --git a/components/signin/ios/browser/features.h b/components/signin/ios/browser/features.h index 60945ce..e3522a6 100644 --- a/components/signin/ios/browser/features.h +++ b/components/signin/ios/browser/features.h
@@ -9,9 +9,6 @@ namespace signin { -// Features to trigger the startup sign-in promo at boot. -extern const base::Feature kForceStartupSigninPromo; - // This feature simplify sign-out UI in the account table view. extern const base::Feature kSimplifySignOutIOS;
diff --git a/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java index 1cd81df9..945aa78 100644 --- a/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java +++ b/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
@@ -34,7 +34,6 @@ import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.ThreadUtils; -import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.metrics.RecordHistogram; import org.chromium.components.externalauth.ExternalAuthUtils; @@ -87,7 +86,7 @@ long startTime = SystemClock.elapsedRealtime(); Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE); - recordElapsedTimeHistogram("Signin.AndroidGetAccountsTime_AccountManager", + RecordHistogram.recordTimesHistogram("Signin.AndroidGetAccountsTime_AccountManager", SystemClock.elapsedRealtime() - startTime); return accounts; } @@ -151,19 +150,6 @@ return CapabilityResponse.EXCEPTION; } - /** - * Records a histogram value for how long time an action has taken using - * {@link RecordHistogram#recordTimesHistogram(String, long))} if the browser - * process has been initialized. - * - * @param histogramName the name of the histogram. - * @param elapsedMs the elapsed time in milliseconds. - */ - protected static void recordElapsedTimeHistogram(String histogramName, long elapsedMs) { - if (!LibraryLoader.getInstance().isInitialized()) return; - RecordHistogram.recordTimesHistogram(histogramName, elapsedMs); - } - // No permission is needed on 23+ and Chrome always has MANAGE_ACCOUNTS permission on lower APIs @SuppressLint("MissingPermission") @Override
diff --git a/components/strings/components_strings_fil.xtb b/components/strings/components_strings_fil.xtb index a8767b6c..804ca1c 100644 --- a/components/strings/components_strings_fil.xtb +++ b/components/strings/components_strings_fil.xtb
@@ -103,6 +103,7 @@ <translation id="1307966114820526988">Mga Hindi na Ginagamit na Feature</translation> <translation id="131405271941274527">Gusto ng <ph name="URL" /> na magpadala at makatanggap ng impormasyon kapag na-tap mo ang iyong telepono sa isang NFC device</translation> <translation id="1314509827145471431">Bind right</translation> +<translation id="1319245136674974084">Huwag nang magtanong ulit para sa app na ito</translation> <translation id="1320233736580025032">Prc1 (Envelope)</translation> <translation id="132301787627749051">Maghanap ng larawan sa clipboard</translation> <translation id="1323433172918577554">Magpakita Nang Higit Pa</translation> @@ -744,6 +745,7 @@ <translation id="3655670868607891010">Kung madalas mo itong nakikita, subukan ang mga ito <ph name="HELP_LINK" />.</translation> <translation id="3658742229777143148">Rebisyon</translation> <translation id="3664782872746246217">Mga Keyword:</translation> +<translation id="3671540257457995106">Payagan ang pag-resize?</translation> <translation id="3676592649209844519">Device ID:</translation> <translation id="3677008721441257057">Ang ibig mo bang sabihin ay <a href="#" id="dont-proceed-link"><ph name="DOMAIN" /></a>?</translation> <translation id="3678029195006412963">Hindi malagdaan ang kahilingan</translation> @@ -1104,6 +1106,7 @@ <translation id="4953689047182316270">Tumugon sa Mga Kaganapan ng Pagiging Accessible</translation> <translation id="4955242332710481440">A5-Extra</translation> <translation id="4958444002117714549">Palawakin ang listahan</translation> +<translation id="4968522289500246572">Idinisenyo ang app na ito para sa mobile at posibleng hindi ma-resize nang maayos. Posibleng makaranas ng mga isyu o mag-restart ang app.</translation> <translation id="4973922308112707173">Dual punch top</translation> <translation id="4974590756084640048">Muling i-enable ang mga babala</translation> <translation id="4984088539114770594">Gamitin ang mikropono?</translation> @@ -1152,6 +1155,7 @@ <translation id="5123063207673082822">Weekend</translation> <translation id="5125394840236832993">B-Plus</translation> <translation id="5126510351761255129">I-verify ang iyong card</translation> +<translation id="512670116361803001">Posibleng hindi ma-resize nang maayos ang <ph name="APP_NAME" />. Gamitin ang mga preset na laki ng window para mapigilang makaranas ng mga isyu ang app.</translation> <translation id="5135404736266831032">Pamahalaan ang mga address...</translation> <translation id="5138014172396933048">Hindi available sa ngayon ang virtual card, makipag-ugnayan sa iyong bangko</translation> <translation id="5138227688689900538">Magpakita ng mas kaunti</translation> @@ -1518,6 +1522,7 @@ <translation id="647261751007945333">Mga patakaran sa device</translation> <translation id="6476284679642588870">Pamahalaan ang mga paraan ng pagbabayad</translation> <translation id="6489534406876378309">Simulang mag-upload ng mga pag-crash</translation> +<translation id="6493924760403974580">Ganitong laki lang ang sinusuportahan ng app na ito.</translation> <translation id="6499038740797743453">I-reset ang password?</translation> <translation id="6502991525169604759">Hindi kasama ang iyong mga pagbabago</translation> <translation id="6508722015517270189">I-restart ang Chrome</translation> @@ -2172,6 +2177,7 @@ <translation id="8975263830901772334">Mga pangalan ng mga file na pini-print mo</translation> <translation id="8978053250194585037">May <ph name="BEGIN_LINK" />na-detect na phishing<ph name="END_LINK" /> sa <ph name="SITE" /> kamakailan ang Ligtas na Pag-browse sa Google. Nagpapanggap ang mga phishing site bilang ibang website upang linlangin ka.</translation> <translation id="8983003182662520383">Mga Paraan ng Pagbabayad at Address Gamit ang Google Pay</translation> +<translation id="8983369100812962543">Puwede mo na ngayong i-resize ang app</translation> <translation id="8987927404178983737">Buwan</translation> <translation id="8989148748219918422"><ph name="ORGANIZATION" /> [<ph name="COUNTRY" />]</translation> <translation id="899688752321268742">Gustong malaman ng <ph name="URL" /> kung kailan mo aktibong ginagamit ang device na ito</translation>
diff --git a/components/strings/components_strings_mn.xtb b/components/strings/components_strings_mn.xtb index 7d00feba..2e5ca0e 100644 --- a/components/strings/components_strings_mn.xtb +++ b/components/strings/components_strings_mn.xtb
@@ -103,6 +103,7 @@ <translation id="1307966114820526988">Хуучирсан онцлог</translation> <translation id="131405271941274527">Таныг NFC төхөөрөмж дээр утсаараа товших үед <ph name="URL" /> нь мэдээлэл илгээх, хүлээн авах хүсэлтэй байна</translation> <translation id="1314509827145471431">Баруун ирмэг дагуу үдэж хавтаслах</translation> +<translation id="1319245136674974084">Энэ аппад дахин бүү асуу</translation> <translation id="1320233736580025032">Prc1 (Дугтуй)</translation> <translation id="132301787627749051">Түр санах ойн зургийг хайх</translation> <translation id="1323433172918577554">Дэлгэрэнгүй харуулах</translation> @@ -745,6 +746,7 @@ <translation id="3655670868607891010">Хэрэв та энэ мессежийг хэт олон удаа харж байга бол <ph name="HELP_LINK" />-ийг үзээрэй.</translation> <translation id="3658742229777143148">Засвар хийгдсэн</translation> <translation id="3664782872746246217">Түлхүүр үг:</translation> +<translation id="3671540257457995106">Хэмжээг өөрчлөхийг зөвшөөрөх үү?</translation> <translation id="3676592649209844519">Төхөөрөмжийн ID:</translation> <translation id="3677008721441257057">Та <a href="#" id="dont-proceed-link"><ph name="DOMAIN" /></a> руу очихыг хүссэн үү?</translation> <translation id="3678029195006412963">Хүсэлт тавих боломжгүй байна</translation> @@ -1105,6 +1107,7 @@ <translation id="4953689047182316270">Хүртээмжийн үйл ажиллагаанд хариу өгөх</translation> <translation id="4955242332710481440">A5-Нэмэлт</translation> <translation id="4958444002117714549">Жагсаалтыг өргөжүүлэх</translation> +<translation id="4968522289500246572">Энэ апп мобайлд зориулагдсан бөгөөд үүний хэмжээ сайн өөрчлөгдөхгүй байж магадгүй. Энэ апп асуудалтай тулгарч эсвэл дахин эхэлж магадгүй.</translation> <translation id="4973922308112707173">Дээд буланд хоёр нүх цоолох</translation> <translation id="4974590756084640048">Сануулгыг дахин идэвхжүүлэх</translation> <translation id="4984088539114770594">Микрофон ашиглах уу?</translation> @@ -1153,6 +1156,7 @@ <translation id="5123063207673082822">Амралтын өдөр</translation> <translation id="5125394840236832993">B-Нэмэх</translation> <translation id="5126510351761255129">Картаа баталгаажуулах</translation> +<translation id="512670116361803001"><ph name="APP_NAME" />-н хэмжээ сайн өөрчлөгдөхгүй байж магадгүй. Аппыг асуудалтай тулгарахаас сэргийлэхийн тулд урьдчилан тохируулсан цонхны хэмжээг ашиглана уу.</translation> <translation id="5135404736266831032">Хаягийг удирдах...</translation> <translation id="5138014172396933048">Виртуал карт яг одоо боломжгүй байна. Банктайгаа холбогдоно уу</translation> <translation id="5138227688689900538">Хураангуйлж харуулах</translation> @@ -1518,6 +1522,7 @@ <translation id="647261751007945333">Төхөөрөмжийн тохиргоонууд</translation> <translation id="6476284679642588870">Төлбөрийн хэрэгсэл удирдах</translation> <translation id="6489534406876378309">Гэмтлүүдийг ачаалж эхэл</translation> +<translation id="6493924760403974580">Энэ апп зөвхөн энэ хэмжээг дэмждэг.</translation> <translation id="6499038740797743453">Нууц үгийг шинэчлэх үү?</translation> <translation id="6502991525169604759">Таны өөрчлөлтгүйгээр</translation> <translation id="6508722015517270189">Chrome-г дахин эхлүүлэх</translation> @@ -2172,6 +2177,7 @@ <translation id="8975263830901772334">Таны хэвлэх файлуудын нэр</translation> <translation id="8978053250194585037">Google-н аюулгүй хайлт саяхан <ph name="SITE" />-с <ph name="BEGIN_LINK" />фишинг олж илрүүллээ<ph name="END_LINK" />. Фишинг сайтууд нь таныг хууран мэхлэх зорилгоор бусад сайт мэт харагдана.</translation> <translation id="8983003182662520383">Google Pay-г ашиглаж буй төлбөрийн хэрэгсэл болон хаяг</translation> +<translation id="8983369100812962543">Та одоо энэ аппын хэмжээг өөрчлөх боломжтой</translation> <translation id="8987927404178983737">Сар</translation> <translation id="8989148748219918422"><ph name="ORGANIZATION" /> [ <ph name="COUNTRY" /> ]</translation> <translation id="899688752321268742"><ph name="URL" /> таныг энэ төхөөрөмжийг хэзээ идэвхтэй ашиглаж буйг мэдэхийг хүсэж байна</translation>
diff --git a/components/strings/components_strings_uz.xtb b/components/strings/components_strings_uz.xtb index 8e24b96..7e36d1c 100644 --- a/components/strings/components_strings_uz.xtb +++ b/components/strings/components_strings_uz.xtb
@@ -103,6 +103,7 @@ <translation id="1307966114820526988">Eskirgan funksiyalar</translation> <translation id="131405271941274527"><ph name="URL" /> sayti NFC orqali axborot almashinishga ruxsat soʻramoqda</translation> <translation id="1314509827145471431">Oʻng chekkasini belgilash</translation> +<translation id="1319245136674974084">Bu ilova uchun boshqa soʻralmasin</translation> <translation id="1320233736580025032">Prc1 (Envelope)</translation> <translation id="132301787627749051">Klipborddagi rasmni qidirish</translation> <translation id="1323433172918577554">Yana</translation> @@ -739,6 +740,7 @@ <translation id="3655670868607891010">Agar bu muammo tez-tez qaytarilib tursa, yechimini <ph name="HELP_LINK" /> sahifasidan izlang.</translation> <translation id="3658742229777143148">Versiya</translation> <translation id="3664782872746246217">Kalit soʻzlar:</translation> +<translation id="3671540257457995106">Oʻlchami oʻzgaraversinmi?</translation> <translation id="3676592649209844519">Qurilma identifikatori:</translation> <translation id="3677008721441257057"><a href="#" id="dont-proceed-link"><ph name="DOMAIN" /></a> saytini nazarda tutdingizmi?</translation> <translation id="3678029195006412963">So‘rovni imzolab bo‘lmadi</translation> @@ -1099,6 +1101,7 @@ <translation id="4953689047182316270">Maxsus imkoniyatlar ishlatilishi</translation> <translation id="4955242332710481440">A5-Extra</translation> <translation id="4958444002117714549">Ro‘yxatni yoyish</translation> +<translation id="4968522289500246572">Bu ilova mobil qurilmalar uchun ishlab chiqilgan va oʻlchami bexato oʻzgarmasligi mumkin. Ishlashida xato chiqishi yoki qaytadan ishga tushishi mumkin.</translation> <translation id="4973922308112707173">Yuqoridan 2 ta teshik ochish</translation> <translation id="4974590756084640048">Ogohlantirishlarni qaytadan yoqish</translation> <translation id="4984088539114770594">Mikrofon ishlatilsinmi?</translation> @@ -1147,6 +1150,7 @@ <translation id="5123063207673082822">Dam olish kunlari</translation> <translation id="5125394840236832993">B-Plus</translation> <translation id="5126510351761255129">Kartangizni tasdiqlang</translation> +<translation id="512670116361803001"><ph name="APP_NAME" /> oʻlchami xato oʻzgarishi mumkin. Ilova bexato ishlashi uchun oyna oʻlchami andozalaridan foydalaning.</translation> <translation id="5135404736266831032">Manzillar...</translation> <translation id="5138014172396933048">Hozirda virtual karta mavjud emas. Bankka murojaat qiling</translation> <translation id="5138227688689900538">Kamroq chiqsin</translation> @@ -1512,6 +1516,7 @@ <translation id="647261751007945333">Qurilma qoidalari</translation> <translation id="6476284679642588870">Toʻlov usullarini boshqarish</translation> <translation id="6489534406876378309">Nosozliklar haqidagi ma’lumotlarni yuklashni boshlash</translation> +<translation id="6493924760403974580">Bu ilova faqat shu oʻlchamda ishlaydi.</translation> <translation id="6499038740797743453">Parolni o‘zgartirish</translation> <translation id="6502991525169604759">Tahriringiz saqlanmagan</translation> <translation id="6508722015517270189">Chrome’ni qaytadan ishga tushiring</translation> @@ -2166,6 +2171,7 @@ <translation id="8975263830901772334">Chop etiladigan fayllar nomlari</translation> <translation id="8978053250194585037">Google saytlar xavfsizligini tekshirish xizmati <ph name="SITE" /> saytida fishing harakatlarini aniqladi. Bunday <ph name="BEGIN_LINK" />fishing saytlar<ph name="END_LINK" /> sizga kerakli sahifalarni ko‘rsatib shaxsiy ma’lumotlaringizni o‘girlashi mumkin.</translation> <translation id="8983003182662520383">Google Pay xizmatidagi bank kartalari va manzillar</translation> +<translation id="8983369100812962543">Endi ilova oʻlchamini oʻzgartirish mumkin</translation> <translation id="8987927404178983737">Oy</translation> <translation id="8989148748219918422"><ph name="ORGANIZATION" /> [<ph name="COUNTRY" />]</translation> <translation id="899688752321268742"><ph name="URL" /> qurilmadan foydalanish axborotiga kirmoqchi</translation>
diff --git a/components/sync/driver/resources/PRESUBMIT.py b/components/sync/driver/resources/PRESUBMIT.py index 402a9e2..35dad21 100644 --- a/components/sync/driver/resources/PRESUBMIT.py +++ b/components/sync/driver/resources/PRESUBMIT.py
@@ -22,7 +22,6 @@ old_sys_path = sys.path[:] cwd = input_api.PresubmitLocalPath() sys.path += [input_api.os_path.join(cwd, '..', '..', '..', '..', 'tools')] - # TODO(crbug.com/1212015): This does not work in Python3 yet: from web_dev_style import presubmit_support results += presubmit_support.CheckStyle(input_api, output_api) finally:
diff --git a/components/test/data/autofill_assistant/html/bottomsheet_behaviour_target_website.html b/components/test/data/autofill_assistant/html/bottomsheet_behaviour_target_website.html index 5f99396..427fbd9 100644 --- a/components/test/data/autofill_assistant/html/bottomsheet_behaviour_target_website.html +++ b/components/test/data/autofill_assistant/html/bottomsheet_behaviour_target_website.html
@@ -11,6 +11,13 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bottomsheet Behaviour Test</title> + <script> + var removeTouchArea = function(event) { + var touch_area = event.target; + touch_area.parentNode.removeChild(touch_area); + } + </script> + <style> body { margin: 0; @@ -22,14 +29,13 @@ height: 2em; background-color: lightgreen; } - p { - height: 5em; - } .top { background-color: lightblue; + height: 5em; } .bottom { background-color: yellow; + height: 5em; } .cast { height: 100px; @@ -47,6 +53,12 @@ <p class="top">Top text hidden</p> <div class="cast"></div> <div class="blank">Blank</div> - <p id="bottom" class="bottom">Bottom text</p> + <div id="bottom" class="bottom">Bottom + <div> + <p id="touch_area" ontouchend="removeTouchArea(event)" onmouseup="removeTouchArea(event)"> + Touchable Area</p> + <br> + </div> + </div> </body> </html>
diff --git a/components/translate/content/browser/content_translate_driver.cc b/components/translate/content/browser/content_translate_driver.cc index 8b81f40..e711f9d 100644 --- a/components/translate/content/browser/content_translate_driver.cc +++ b/components/translate/content/browser/content_translate_driver.cc
@@ -57,10 +57,11 @@ } // namespace ContentTranslateDriver::ContentTranslateDriver( + content::WebContents& web_contents, content::NavigationController* nav_controller, language::UrlLanguageHistogram* url_language_histogram, translate::TranslateModelService* translate_model_service) - : content::WebContentsObserver(nav_controller->GetWebContents()), + : content::WebContentsObserver(&web_contents), navigation_controller_(nav_controller), translate_manager_(nullptr), max_reload_check_attempts_(kMaxTranslateLoadCheckAttempts), @@ -118,15 +119,13 @@ } void ContentTranslateDriver::OnTranslateEnabledChanged() { - content::WebContents* web_contents = navigation_controller_->GetWebContents(); for (auto& observer : translation_observers_) - observer.OnTranslateEnabledChanged(web_contents); + observer.OnTranslateEnabledChanged(web_contents()); } void ContentTranslateDriver::OnIsPageTranslatedChanged() { - content::WebContents* web_contents = navigation_controller_->GetWebContents(); for (auto& observer : translation_observers_) - observer.OnIsPageTranslatedChanged(web_contents); + observer.OnIsPageTranslatedChanged(web_contents()); } void ContentTranslateDriver::TranslatePage(int page_seq_no, @@ -156,20 +155,19 @@ } const std::string& ContentTranslateDriver::GetContentsMimeType() { - return navigation_controller_->GetWebContents()->GetContentsMimeType(); + return web_contents()->GetContentsMimeType(); } const GURL& ContentTranslateDriver::GetLastCommittedURL() { - return navigation_controller_->GetWebContents()->GetLastCommittedURL(); + return web_contents()->GetLastCommittedURL(); } const GURL& ContentTranslateDriver::GetVisibleURL() { - return navigation_controller_->GetWebContents()->GetVisibleURL(); + return web_contents()->GetVisibleURL(); } ukm::SourceId ContentTranslateDriver::GetUkmSourceId() { - return ukm::GetSourceIdForWebContentsDocument( - navigation_controller_->GetWebContents()); + return ukm::GetSourceIdForWebContentsDocument(web_contents()); } bool ContentTranslateDriver::HasCurrentPage() { @@ -180,7 +178,7 @@ content::OpenURLParams params(url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false); - navigation_controller_->GetWebContents()->OpenURL(params); + web_contents()->OpenURL(params); } void ContentTranslateDriver::InitiateTranslationIfReload(
diff --git a/components/translate/content/browser/content_translate_driver.h b/components/translate/content/browser/content_translate_driver.h index d2931a6..b314e62 100644 --- a/components/translate/content/browser/content_translate_driver.h +++ b/components/translate/content/browser/content_translate_driver.h
@@ -56,7 +56,8 @@ } }; - ContentTranslateDriver(content::NavigationController* nav_controller, + ContentTranslateDriver(content::WebContents& web_contents, + content::NavigationController* nav_controller, language::UrlLanguageHistogram* url_language_histogram, TranslateModelService* translate_model_service); ~ContentTranslateDriver() override;
diff --git a/components/translate/content/browser/per_frame_content_translate_driver.cc b/components/translate/content/browser/per_frame_content_translate_driver.cc index 918cd408..29a1cdaa 100644 --- a/components/translate/content/browser/per_frame_content_translate_driver.cc +++ b/components/translate/content/browser/per_frame_content_translate_driver.cc
@@ -127,9 +127,11 @@ } PerFrameContentTranslateDriver::PerFrameContentTranslateDriver( + content::WebContents& web_contents, content::NavigationController* nav_controller, language::UrlLanguageHistogram* url_language_histogram) - : ContentTranslateDriver(nav_controller, + : ContentTranslateDriver(web_contents, + nav_controller, url_language_histogram, /*translate_model_service=*/nullptr) {}
diff --git a/components/translate/content/browser/per_frame_content_translate_driver.h b/components/translate/content/browser/per_frame_content_translate_driver.h index d857a4c..83a276c8 100644 --- a/components/translate/content/browser/per_frame_content_translate_driver.h +++ b/components/translate/content/browser/per_frame_content_translate_driver.h
@@ -40,6 +40,7 @@ class PerFrameContentTranslateDriver : public ContentTranslateDriver { public: PerFrameContentTranslateDriver( + content::WebContents& web_contents, content::NavigationController* nav_controller, language::UrlLanguageHistogram* url_language_histogram); ~PerFrameContentTranslateDriver() override;
diff --git a/components/translate/content/browser/per_frame_content_translate_driver_unittest.cc b/components/translate/content/browser/per_frame_content_translate_driver_unittest.cc index 7d4d665..b4351368 100644 --- a/components/translate/content/browser/per_frame_content_translate_driver_unittest.cc +++ b/components/translate/content/browser/per_frame_content_translate_driver_unittest.cc
@@ -33,7 +33,7 @@ void SetUp() override { content::RenderViewHostTestHarness::SetUp(); driver_ = std::make_unique<PerFrameContentTranslateDriver>( - &(web_contents()->GetController()), + *web_contents(), &(web_contents()->GetController()), nullptr /* url_language_histogram */); driver_->AddLanguageDetectionObserver(&observer_); }
diff --git a/components/viz/service/display/display.h b/components/viz/service/display/display.h index f13cd01fa..f3f6ea4 100644 --- a/components/viz/service/display/display.h +++ b/components/viz/service/display/display.h
@@ -206,7 +206,7 @@ mojo::PendingReceiver<gfx::mojom::DelegatedInkPointRenderer> pending_receiver); - private: + protected: friend class DisplayTest; // PresentationGroupTiming stores rendering pipeline stage timings associated // with a call to Display::DrawAndSwap along with a list of
diff --git a/components/viz/service/display/overlay_candidate.cc b/components/viz/service/display/overlay_candidate.cc index 03afc4b84..c9f376d 100644 --- a/components/viz/service/display/overlay_candidate.cc +++ b/components/viz/service/display/overlay_candidate.cc
@@ -136,7 +136,7 @@ const DrawQuad* quad, const gfx::RectF& primary_rect, OverlayCandidate* candidate, - bool allow_delegated_quads) { + bool is_delegated_context) { // It is currently not possible to set a color conversion matrix on an HW // overlay plane. // TODO(https://crbug.com/792757): Remove this check once the bug is resolved. @@ -172,8 +172,15 @@ return FromStreamVideoQuad(resource_provider, surface_damage_rect_list, StreamVideoDrawQuad::MaterialCast(quad), candidate); + case DrawQuad::Material::kSolidColor: + if (!is_delegated_context) + return false; + return candidate->FromSolidColorQuad( + resource_provider, surface_damage_rect_list, + SolidColorDrawQuad::MaterialCast(quad), primary_rect, candidate); + case DrawQuad::Material::kTiledContent: - if (!allow_delegated_quads) + if (!is_delegated_context) return false; return candidate->FromTileQuad( resource_provider, surface_damage_rect_list, @@ -299,21 +306,27 @@ ResourceId resource_id, bool y_flipped, OverlayCandidate* candidate) { - if (!resource_provider->IsOverlayCandidate(resource_id)) + if (resource_id != kInvalidResourceId && + !resource_provider->IsOverlayCandidate(resource_id)) return false; + if (quad->visible_rect.IsEmpty()) return false; - candidate->format = resource_provider->GetBufferFormat(resource_id); - candidate->color_space = resource_provider->GetColorSpace(resource_id); - if (!base::Contains(kOverlayFormats, candidate->format)) - return false; + if (resource_id != kInvalidResourceId) { + candidate->format = resource_provider->GetBufferFormat(resource_id); + candidate->color_space = resource_provider->GetColorSpace(resource_id); + if (!base::Contains(kOverlayFormats, candidate->format)) + return false; + } const SharedQuadState* sqs = quad->shared_quad_state; + gfx::OverlayTransform overlay_transform = GetOverlayTransform(sqs->quad_to_target_transform, y_flipped); if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) return false; + candidate->transform = overlay_transform; auto& transform = sqs->quad_to_target_transform; candidate->display_rect = gfx::RectF(quad->rect); @@ -329,9 +342,26 @@ candidate->damage_area_estimate = GetDamageRect(quad, surface_damage_rect_list).size().GetArea(); candidate->resource_id = resource_id; - candidate->transform = overlay_transform; - candidate->mailbox = resource_provider->GetMailbox(resource_id); + if (resource_id != kInvalidResourceId) { + candidate->mailbox = resource_provider->GetMailbox(resource_id); + } + + return true; +} + +// static +bool OverlayCandidate::FromSolidColorQuad( + DisplayResourceProvider* resource_provider, + SurfaceDamageRectList* surface_damage_rect_list, + const SolidColorDrawQuad* quad, + const gfx::RectF& primary_rect, + OverlayCandidate* candidate) { + if (!FromDrawQuadResource(resource_provider, surface_damage_rect_list, quad, + kInvalidResourceId, false, candidate)) { + return false; + } + candidate->solid_color = quad->color; return true; }
diff --git a/components/viz/service/display/overlay_candidate.h b/components/viz/service/display/overlay_candidate.h index aaa0ff57..7758b15 100644 --- a/components/viz/service/display/overlay_candidate.h +++ b/components/viz/service/display/overlay_candidate.h
@@ -30,6 +30,7 @@ namespace viz { class DisplayResourceProvider; +class SolidColorDrawQuad; class StreamVideoDrawQuad; class TextureDrawQuad; class VideoHoleDrawQuad; @@ -45,7 +46,7 @@ const DrawQuad* quad, const gfx::RectF& primary_rect, OverlayCandidate* candidate, - bool allow_delegated_quads = false); + bool is_delegated_context = false); // Returns true if |quad| will not block quads underneath from becoming // an overlay. static bool IsInvisibleQuad(const DrawQuad* quad); @@ -115,6 +116,12 @@ // marked as being backed by a SurfaceTexture or not. If so, it's not really // promotable to an overlay. bool is_backed_by_surface_texture = false; + // Crop within the buffer to be placed inside |display_rect| before + // |clip_rect| was applied. Valid only for surface control. + gfx::RectF unclipped_uv_rect = gfx::RectF(0.f, 0.f, 1.f, 1.f); + // |display_rect| before |clip_rect| was applied. Valid only for surface + // control. + gfx::RectF unclipped_display_rect = gfx::RectF(0.f, 0.f, 1.f, 1.f); #endif // Stacking order of the overlay plane relative to the main surface, @@ -143,6 +150,9 @@ // if a protected surface can still be displayed. Non-zero when valid. uint32_t hw_protected_validation_id = 0; + // for solid color quads only + absl::optional<SkColor> solid_color; + private: static bool FromDrawQuadResource( DisplayResourceProvider* resource_provider, @@ -162,6 +172,13 @@ const TileDrawQuad* quad, const gfx::RectF& primary_rect, OverlayCandidate* candidate); + static bool FromSolidColorQuad( + DisplayResourceProvider* resource_provider, + SurfaceDamageRectList* surface_damage_rect_list, + const SolidColorDrawQuad* quad, + const gfx::RectF& primary_rect, + OverlayCandidate* candidate); + static bool FromStreamVideoQuad( DisplayResourceProvider* resource_provider, SurfaceDamageRectList* surface_damage_rect_list,
diff --git a/components/viz/service/display/overlay_processor_delegated.cc b/components/viz/service/display/overlay_processor_delegated.cc index 701ba44..5ef9d4a 100644 --- a/components/viz/service/display/overlay_processor_delegated.cc +++ b/components/viz/service/display/overlay_processor_delegated.cc
@@ -92,6 +92,14 @@ auto viewport_src = gfx::ToEnclosedRect(gfx::ScaleRect( candidate.uv_rect, candidate.resource_size_in_pixels.width(), candidate.resource_size_in_pixels.height())); + + if (it->material == DrawQuad::Material::kSolidColor) { + DBG_DRAW_RECT("delegated.overlay.color", candidate.display_rect); + candidates->push_back(candidate); + candidate_quads.push_back(it); + continue; + } + // Because of the device scale factor (2) we check against a rounded empty // rect. // TODO(https://crbug.com/1218678) : Move and generalize this fix in
diff --git a/components/viz/service/display/overlay_processor_surface_control.cc b/components/viz/service/display/overlay_processor_surface_control.cc index 35d4b81..3caa583 100644 --- a/components/viz/service/display/overlay_processor_surface_control.cc +++ b/components/viz/service/display/overlay_processor_surface_control.cc
@@ -84,6 +84,9 @@ display_inverse.TransformRect(&orig_display_rect); display_inverse.TransformRect(&display_rect); + candidate.unclipped_display_rect = orig_display_rect; + candidate.unclipped_uv_rect = candidate.uv_rect; + candidate.display_rect = gfx::RectF(gfx::ToEnclosingRect(display_rect)); candidate.uv_rect = cc::MathUtil::ScaleRectProportional( candidate.uv_rect, orig_display_rect, candidate.display_rect);
diff --git a/components/viz/service/display/skia_renderer.cc b/components/viz/service/display/skia_renderer.cc index bcd01e14..1ac9a1c6 100644 --- a/components/viz/service/display/skia_renderer.cc +++ b/components/viz/service/display/skia_renderer.cc
@@ -2276,6 +2276,10 @@ // Only Wayland uses this code path. auto& locks = pending_overlay_locks_.back(); for (auto& overlay : current_frame()->overlay_list) { + // Solid Color quads do not have associated resource buffers. + if (overlay.solid_color.has_value()) + continue; + // Resources will be unlocked after the next SwapBuffers() is completed. locks.emplace_back(resource_provider(), overlay.resource_id); auto& lock = locks.back();
diff --git a/components/viz/service/display/surface_aggregator.cc b/components/viz/service/display/surface_aggregator.cc index 1f41839..7efd27e 100644 --- a/components/viz/service/display/surface_aggregator.cc +++ b/components/viz/service/display/surface_aggregator.cc
@@ -476,6 +476,12 @@ sqs->de_jelly_delta_y == 0; } +const ResolvedFrameData* SurfaceAggregator::GetLatestFrameData( + const SurfaceId& surface_id) { + auto* surface = manager_->GetSurfaceForId(surface_id); + return GetResolvedFrame(surface, /*inside_aggregation=*/false); +} + const ResolvedFrameData* SurfaceAggregator::GetResolvedFrame( const SurfaceRange& range) { // Find latest in flight surface and cache that result for the duration of @@ -487,15 +493,18 @@ .first; } - return GetResolvedFrame(iter->second); + return GetResolvedFrame(iter->second, /*inside_aggregation=*/true); } const ResolvedFrameData* SurfaceAggregator::GetResolvedFrame( const SurfaceId& surface_id) { - return GetResolvedFrame(manager_->GetSurfaceForId(surface_id)); + return GetResolvedFrame(manager_->GetSurfaceForId(surface_id), + /*inside_aggregation=*/true); } -const ResolvedFrameData* SurfaceAggregator::GetResolvedFrame(Surface* surface) { +const ResolvedFrameData* SurfaceAggregator::GetResolvedFrame( + Surface* surface, + bool inside_aggregation) { if (!surface || !surface->HasActiveFrame()) { // If there is no resolved surface or the surface has no active frame there // is no resolved frame data to return. @@ -520,17 +529,18 @@ // SurfaceObserver signals the surface has been destroyed instead. if (resolved_frame.surface_id() != surface->surface_id()) { resolved_frames_.erase(iter); - return GetResolvedFrame(surface); + return GetResolvedFrame(surface, inside_aggregation); } // Mark the frame as used this aggregation so it persists. - bool first_use = resolved_frame.MarkAsUsed(); + bool first_use = inside_aggregation ? resolved_frame.MarkAsUsed() : true; if (first_use) { // If there is a new CompositorFrame for `surface` compute resolved frame // data for the new resolved CompositorFrame. if (resolved_frame.frame_index() != surface->GetActiveFrameIndex() || surface->HasSurfaceAnimationDamage()) { + DCHECK(inside_aggregation); base::ElapsedTimer timer; ProcessResolvedFrame(resolved_frame); stats_->declare_resources_time += timer.Elapsed(); @@ -1833,7 +1843,8 @@ PrewalkResult prewalk_result; // Get the resolved frame for the root surface after `prewalk_timer` is // started so the work is counted in the same histograms as before. - const ResolvedFrameData& resolved_frame = *GetResolvedFrame(surface); + const ResolvedFrameData& resolved_frame = + *GetResolvedFrame(surface, /*inside_aggregation=*/true); gfx::Rect prewalk_damage_rect = PrewalkSurface( resolved_frame, /*in_moved_pixel_rp=*/false, /*parent_pass=*/AggregatedRenderPassId(),
diff --git a/components/viz/service/display/surface_aggregator.h b/components/viz/service/display/surface_aggregator.h index 1a22ca3..4c1a3a56 100644 --- a/components/viz/service/display/surface_aggregator.h +++ b/components/viz/service/display/surface_aggregator.h
@@ -66,6 +66,12 @@ gfx::OverlayTransform display_transform, const gfx::Rect& target_damage = gfx::Rect(), int64_t display_trace_id = -1); + + // Returns latest frame data after previous Aggregate() call. This only valid + // until next CompositorFrame is processed, so should be called directly after + // Aggregate() to make sure no CompositorFrame did arrive between the calls. + const ResolvedFrameData* GetLatestFrameData(const SurfaceId& surface_id); + void ReleaseResources(const SurfaceId& surface_id); const SurfaceIndexMap& previous_contained_surfaces() const { return previous_contained_surfaces_; @@ -109,7 +115,8 @@ // CompositorFrame. const ResolvedFrameData* GetResolvedFrame(const SurfaceRange& range); const ResolvedFrameData* GetResolvedFrame(const SurfaceId& surface_id); - const ResolvedFrameData* GetResolvedFrame(Surface* surface); + const ResolvedFrameData* GetResolvedFrame(Surface* surface, + bool inside_aggregation); void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, float parent_device_scale_factor,
diff --git a/components/viz/service/display_embedder/output_presenter.cc b/components/viz/service/display_embedder/output_presenter.cc index 08f449b6..7a59842 100644 --- a/components/viz/service/display_embedder/output_presenter.cc +++ b/components/viz/service/display_embedder/output_presenter.cc
@@ -84,11 +84,11 @@ return result; } -void OutputPresenter::Image::EndWriteSkia() { +void OutputPresenter::Image::EndWriteSkia(bool force_flush) { // The Flush now takes place in finishPaintCurrentBuffer on the CPU side. - // check if end_semaphores is not empty then flash here + // check if end_semaphores is not empty then flush here DCHECK(scoped_skia_write_access_); - if (!end_semaphores_.empty()) { + if (!end_semaphores_.empty() || force_flush) { GrFlushInfo flush_info = { .fNumSemaphores = end_semaphores_.size(), .fSignalSemaphores = end_semaphores_.data(), @@ -115,9 +115,9 @@ } } -std::unique_ptr<OutputPresenter::Image> -OutputPresenter::AllocateBackgroundImage(gfx::ColorSpace color_space, - gfx::Size image_size) { +std::unique_ptr<OutputPresenter::Image> OutputPresenter::AllocateSingleImage( + gfx::ColorSpace color_space, + gfx::Size image_size) { return nullptr; }
diff --git a/components/viz/service/display_embedder/output_presenter.h b/components/viz/service/display_embedder/output_presenter.h index 9358d35..8ea99ec 100644 --- a/components/viz/service/display_embedder/output_presenter.h +++ b/components/viz/service/display_embedder/output_presenter.h
@@ -50,7 +50,7 @@ void BeginWriteSkia(); SkSurface* sk_surface(); std::vector<GrBackendSemaphore> TakeEndWriteSkiaSemaphores(); - void EndWriteSkia(); + void EndWriteSkia(bool force_flush = false); void PreGrContextSubmit(); virtual void BeginPresent() = 0; @@ -89,7 +89,9 @@ gfx::ColorSpace color_space, gfx::Size image_size, size_t num_images) = 0; - virtual std::unique_ptr<Image> AllocateBackgroundImage( + // This function exists because the Fuchsia call to 'AllocateImages' does not + // support single image allocation. + virtual std::unique_ptr<Image> AllocateSingleImage( gfx::ColorSpace color_space, gfx::Size image_size); virtual void SwapBuffers(SwapCompletionCallback completion_callback,
diff --git a/components/viz/service/display_embedder/output_presenter_gl.cc b/components/viz/service/display_embedder/output_presenter_gl.cc index 17e0d06..7e6fa43c 100644 --- a/components/viz/service/display_embedder/output_presenter_gl.cc +++ b/components/viz/service/display_embedder/output_presenter_gl.cc
@@ -321,9 +321,9 @@ return images; } -std::unique_ptr<OutputPresenter::Image> -OutputPresenterGL::AllocateBackgroundImage(gfx::ColorSpace color_space, - gfx::Size image_size) { +std::unique_ptr<OutputPresenter::Image> OutputPresenterGL::AllocateSingleImage( + gfx::ColorSpace color_space, + gfx::Size image_size) { auto image = std::make_unique<PresenterImageGL>(); if (!image->Initialize(shared_image_factory_, shared_image_representation_factory_, image_size,
diff --git a/components/viz/service/display_embedder/output_presenter_gl.h b/components/viz/service/display_embedder/output_presenter_gl.h index 7bf8c8b7..70120b7f 100644 --- a/components/viz/service/display_embedder/output_presenter_gl.h +++ b/components/viz/service/display_embedder/output_presenter_gl.h
@@ -49,8 +49,8 @@ gfx::ColorSpace color_space, gfx::Size image_size, size_t num_images) final; - std::unique_ptr<Image> AllocateBackgroundImage(gfx::ColorSpace color_space, - gfx::Size image_size) final; + std::unique_ptr<Image> AllocateSingleImage(gfx::ColorSpace color_space, + gfx::Size image_size) final; void SwapBuffers(SwapCompletionCallback completion_callback, BufferPresentedCallback presentation_callback) final; void PostSubBuffer(const gfx::Rect& rect,
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc index e24b20fa..ade332cf 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
@@ -275,12 +275,61 @@ } } +#if defined(USE_OZONE) +const gpu::Mailbox SkiaOutputDeviceBufferQueue::GetImageMailboxForColor( + const SkColor& color) { + // Currently the Wayland protocol does not have protocol to support solid + // color quads natively as surfaces. Here we create tiny 4x4 image buffers + // in the color space of the frame buffer and clear them to the quad's solid + // color. These freshly created buffers are then treated like any other + // overlay via the mailbox interface. + std::unique_ptr<OutputPresenter::Image> solid_color = nullptr; + // First try for an existing same color image. + auto it = solid_color_cache_.find(color); + if (it != solid_color_cache_.end()) { + // This is a prefect color match so use this directly. + solid_color = std::move(it->second); + solid_color_cache_.erase(it); + } else { + // Try to reuse an existing image even if the color is different. + // Only do this if there are more cached images than those in flight (a + // sensible upper bound). + if (!solid_color_cache_.empty() && + solid_color_cache_.size() > solid_color_images_.size()) { + auto it = solid_color_cache_.begin(); + solid_color = std::move(it->second); + solid_color_cache_.erase(it); + } else { + // Worst case allocate a new image. This definitely will occur on startup. + solid_color = + presenter_->AllocateSingleImage(color_space_, gfx::Size(4, 4)); + } + solid_color->BeginWriteSkia(); + solid_color->sk_surface()->getCanvas()->clear(color); + solid_color->EndWriteSkia(/*force_flush*/ true); + } + DCHECK(solid_color); + auto image_mailbox = solid_color->skia_representation()->mailbox(); + solid_color_images_.insert(std::make_pair( + image_mailbox, std::make_pair(color, std::move(solid_color)))); + return image_mailbox; +} + +#endif void SkiaOutputDeviceBufferQueue::ScheduleOverlays( SkiaOutputSurface::OverlayList overlays) { DCHECK(pending_overlay_mailboxes_.empty()); std::vector<OutputPresenter::ScopedOverlayAccess*> accesses(overlays.size()); for (size_t i = 0; i < overlays.size(); ++i) { - const auto& overlay = overlays[i]; + auto& overlay = overlays[i]; + +#if defined(USE_OZONE) + // TODO(petermcneeley) : Remove this code when http://crbug/1204102 is done. + if (overlay.solid_color.has_value()) { + overlay.mailbox = GetImageMailboxForColor(overlay.solid_color.value()); + } +#endif + if (!overlay.mailbox.IsSharedImage()) continue; @@ -468,6 +517,17 @@ it->Unref(); } +#if defined(USE_OZONE) + for (const auto& mailbox : overlay_mailboxes) { + auto it = solid_color_images_.find(mailbox); + if (it != solid_color_images_.end()) { + solid_color_cache_.insert( + std::make_pair(it->second.first, std::move(it->second.second))); + solid_color_images_.erase(it); + } + } +#endif + // Code below can destroy last representation of the overlay shared image. On // MacOS it needs context to be current. #if defined(OS_APPLE) @@ -488,7 +548,7 @@ return false; if (overlay.IsInUseByWindowServer()) return false; -#if defined(OS_APPLE) +#if defined(OS_APPLE) || defined(USE_OZONE) // Right now, only macOS needs to return maliboxes of released overlays, so // SkiaRenderer can unlock resources for them. released_overlays.push_back(overlay.mailbox()); @@ -547,7 +607,7 @@ if (needs_background_image_ && !background_image_) { background_image_ = - presenter_->AllocateBackgroundImage(color_space, gfx::Size(4, 4)); + presenter_->AllocateSingleImage(color_space, gfx::Size(4, 4)); background_image_is_scheduled_ = false; }
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h index 27349a2..477373f 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h
@@ -6,6 +6,7 @@ #define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SKIA_OUTPUT_DEVICE_BUFFER_QUEUE_H_ #include <memory> +#include <unordered_map> #include <utility> #include <vector> @@ -129,6 +130,18 @@ // key. base::flat_set<OverlayData, OverlayDataComparator> overlays_; +#if defined(USE_OZONE) + const gpu::Mailbox GetImageMailboxForColor(const SkColor& color); + + // All in-flight solid color images are held in this container until a swap + // buffer with the identifying mailbox releases them. + base::flat_map<gpu::Mailbox, + std::pair<SkColor, std::unique_ptr<OutputPresenter::Image>>> + solid_color_images_; + + std::unordered_multimap<SkColor, std::unique_ptr<OutputPresenter::Image>> + solid_color_cache_; +#endif // Set to true if no image is to be used for the primary plane of this frame. bool current_frame_has_no_primary_plane_ = false; // Whether the platform needs an occluded background image. Wayland needs it
diff --git a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h index a334dd9..acd3b0c 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h +++ b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.h
@@ -102,6 +102,8 @@ // Cached copy of the tooltip text, to avoid redundant calls. std::u16string tooltip_text_; + display::ScopedDisplayObserver display_observer_{this}; + // The receiver for this object (only used when remotely instantiated). mojo::AssociatedReceiver<mojom::RenderWidgetHostNSView> receiver_{this};
diff --git a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm index be51243ec..d032f20a 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge.mm
@@ -23,7 +23,6 @@ RenderWidgetHostNSViewBridge::RenderWidgetHostNSViewBridge( mojom::RenderWidgetHostNSViewHost* host, RenderWidgetHostNSViewHostHelper* host_helper) { - display::Screen::GetScreen()->AddObserver(this); cocoa_view_.reset([[RenderWidgetHostViewCocoa alloc] initWithHost:host @@ -46,7 +45,6 @@ withObject:nil afterDelay:0]; cocoa_view_.autorelease(); - display::Screen::GetScreen()->RemoveObserver(this); popup_window_.reset(); }
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index b128a07..64236f48 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -53,6 +53,7 @@ "//base:clang_profiling_buildflags", "//base/third_party/dynamic_annotations", "//base/tracing/protos:chrome_track_event_resources", + "//base/util/enum_set:enum_set", "//build:branding_buildflags", "//build:chromecast_buildflags", "//build:chromeos_buildflags", @@ -737,6 +738,8 @@ "devtools/devtools_stream_file.h", "devtools/devtools_stream_pipe.cc", "devtools/devtools_stream_pipe.h", + "devtools/devtools_throttle_handle.cc", + "devtools/devtools_throttle_handle.h", "devtools/devtools_traceable_screenshot.cc", "devtools/devtools_traceable_screenshot.h", "devtools/devtools_url_loader_interceptor.cc",
diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index 28e338d..da775d1e 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc
@@ -9053,10 +9053,9 @@ RenderFrameHostImpl* rfh_a = current_frame_host(); RenderFrameDeletedObserver delete_observer_rfh_a(rfh_a); // Ensure that there are no lingering requests from page load itself. - EXPECT_FALSE(rfh_a->scheduler_tracked_features() & - (1ull << static_cast<size_t>( - blink::scheduler::WebSchedulerTrackedFeature:: - kOutstandingNetworkRequestFetch))); + EXPECT_FALSE(rfh_a->scheduler_tracked_features().Has( + blink::scheduler::WebSchedulerTrackedFeature:: + kOutstandingNetworkRequestFetch)); // 2) Create a fetch() request. ExecuteScriptAsync(rfh_a, "fetch('/fetch');"); @@ -9089,10 +9088,9 @@ RenderFrameHostImpl* rfh_a = current_frame_host(); RenderFrameDeletedObserver delete_observer_rfh_a(rfh_a); // Ensure that there are no lingering requests from page load itself. - EXPECT_FALSE(rfh_a->scheduler_tracked_features() & - (1ull << static_cast<size_t>( - blink::scheduler::WebSchedulerTrackedFeature:: - kOutstandingNetworkRequestXHR))); + EXPECT_FALSE(rfh_a->scheduler_tracked_features().Has( + blink::scheduler::WebSchedulerTrackedFeature:: + kOutstandingNetworkRequestXHR)); // 2) Create a XMLHttpRequest. EXPECT_TRUE(ExecJs(rfh_a, R"(
diff --git a/content/browser/devtools/devtools_instrumentation.cc b/content/browser/devtools/devtools_instrumentation.cc index 4fa51ade..4a32236 100644 --- a/content/browser/devtools/devtools_instrumentation.cc +++ b/content/browser/devtools/devtools_instrumentation.cc
@@ -392,6 +392,16 @@ } } +void ThrottleForServiceWorkerAgentHost( + ServiceWorkerDevToolsAgentHost* agent_host, + DevToolsAgentHostImpl* requesting_agent_host, + scoped_refptr<DevToolsThrottleHandle> throttle_handle) { + for (auto* target_handler : + protocol::TargetHandler::ForAgentHost(requesting_agent_host)) { + target_handler->AddThrottle(agent_host, throttle_handle); + } +} + std::vector<std::unique_ptr<NavigationThrottle>> CreateNavigationThrottles( NavigationHandle* navigation_handle) { FrameTreeNode* frame_tree_node = @@ -423,6 +433,42 @@ return result; } +void ThrottleMainScriptFetch( + ServiceWorkerContextWrapper* wrapper, + int64_t version_id, + const GlobalRenderFrameHostId& requesting_frame_id, + scoped_refptr<DevToolsThrottleHandle> throttle_handle) { + ServiceWorkerDevToolsAgentHost* agent_host = + ServiceWorkerDevToolsManager::GetInstance() + ->GetDevToolsAgentHostForNewInstallingWorker(wrapper, version_id); + DCHECK(agent_host); + + // TODO(ahemery): We should probably also add the possibility for Browser wide + // agents to throttle the request. + + // If we have a requesting_frame_id, we should have a frame and a frame tree + // node. However since the lifetime of these objects can be complex, we check + // at each step that we indeed can go reach all the way to the FrameTreeNode. + if (!requesting_frame_id) + return; + + RenderFrameHostImpl* requesting_frame = + RenderFrameHostImpl::FromID(requesting_frame_id); + if (!requesting_frame) + return; + + FrameTreeNode* ftn = requesting_frame->frame_tree_node(); + DCHECK(ftn); + + DevToolsAgentHostImpl* requesting_agent_host = + RenderFrameDevToolsAgentHost::GetFor(ftn); + if (!requesting_agent_host) + return; + + ThrottleForServiceWorkerAgentHost(agent_host, requesting_agent_host, + throttle_handle); +} + bool ShouldWaitForDebuggerInWindowOpen() { for (auto* browser_agent_host : BrowserDevToolsAgentHost::Instances()) { for (auto* target_handler :
diff --git a/content/browser/devtools/devtools_instrumentation.h b/content/browser/devtools/devtools_instrumentation.h index 065ee660..eec7a23 100644 --- a/content/browser/devtools/devtools_instrumentation.h +++ b/content/browser/devtools/devtools_instrumentation.h
@@ -11,6 +11,7 @@ #include <vector> +#include "content/browser/devtools/devtools_throttle_handle.h" #include "content/common/content_export.h" #include "content/public/browser/certificate_request_result_type.h" #include "content/public/browser/global_routing_id.h" @@ -177,6 +178,23 @@ std::vector<std::unique_ptr<NavigationThrottle>> CreateNavigationThrottles( NavigationHandle* navigation_handle); +// When registering a new ServiceWorker with PlzServiceWorker, the main script +// fetch happens before starting the worker. This means that we need to give +// TargetHandlers the opportunity to attach to newly created ServiceWorker +// before the script fetch begins if they specified blocking auto-attach +// properties. The `throttle` controls when the script fetch resumes. +// +// Note on the input parameters: +// - `wrapper` and `version_id` are used to identify an existing newly +// installing service worker agent. It is expected to exist. +// - `requesting_frame_id` is required, because the auto attacher is the one of +// the frame registering the worker. +void ThrottleMainScriptFetch( + ServiceWorkerContextWrapper* wrapper, + int64_t version_id, + const GlobalRenderFrameHostId& requesting_frame_id, + scoped_refptr<DevToolsThrottleHandle> throttle_handle); + bool ShouldWaitForDebuggerInWindowOpen(); void WillStartDragging(FrameTreeNode* main_frame_tree_node,
diff --git a/content/browser/devtools/devtools_session.cc b/content/browser/devtools/devtools_session.cc index 53cd6bc8..c85694c8 100644 --- a/content/browser/devtools/devtools_session.cc +++ b/content/browser/devtools/devtools_session.cc
@@ -419,7 +419,7 @@ } } -void DevToolsSession::ClearPendingMessages() { +void DevToolsSession::ClearPendingMessages(bool did_crash) { for (auto it = pending_messages_.begin(); it != pending_messages_.end();) { const PendingMessage& message = *it; if (SpanEquals(crdtp::SpanFrom("Page.reload"), @@ -428,11 +428,13 @@ continue; } // Send error to the client and remove the message from pending. + std::string error_message = + did_crash ? kTargetCrashedMessage : kTargetClosedMessage; SendProtocolResponse( message.call_id, crdtp::CreateErrorResponse( message.call_id, - crdtp::DispatchResponse::ServerError(kTargetCrashedMessage))); + crdtp::DispatchResponse::ServerError(error_message))); it = pending_messages_.erase(it); } }
diff --git a/content/browser/devtools/devtools_session.h b/content/browser/devtools/devtools_session.h index 6b4eb27..e196817 100644 --- a/content/browser/devtools/devtools_session.h +++ b/content/browser/devtools/devtools_session.h
@@ -63,7 +63,7 @@ void DispatchProtocolMessage(base::span<const uint8_t> message); void SuspendSendingMessagesToAgent(); void ResumeSendingMessagesToAgent(); - void ClearPendingMessages(); + void ClearPendingMessages(bool did_crash); using HandlersMap = base::flat_map<std::string,
diff --git a/content/browser/devtools/devtools_throttle_handle.cc b/content/browser/devtools/devtools_throttle_handle.cc new file mode 100644 index 0000000..97ad7dc --- /dev/null +++ b/content/browser/devtools/devtools_throttle_handle.cc
@@ -0,0 +1,17 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/devtools/devtools_throttle_handle.h" + +namespace content { + +DevToolsThrottleHandle::DevToolsThrottleHandle( + base::OnceCallback<void()> throttle_callback) + : throttle_callback_(std::move(throttle_callback)) {} + +DevToolsThrottleHandle::~DevToolsThrottleHandle() { + std::move(throttle_callback_).Run(); +} + +} // namespace content
diff --git a/content/browser/devtools/devtools_throttle_handle.h b/content/browser/devtools/devtools_throttle_handle.h new file mode 100644 index 0000000..72cd9ca5 --- /dev/null +++ b/content/browser/devtools/devtools_throttle_handle.h
@@ -0,0 +1,32 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_ +#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_ + +#include "base/callback.h" +#include "base/memory/scoped_refptr.h" + +namespace content { + +// A simple class that holds the callback that unthrottles either a SW or a +// navigation. It is refcounted and runs `throttle_callback` when destroyed. +class DevToolsThrottleHandle : public base::RefCounted<DevToolsThrottleHandle> { + public: + explicit DevToolsThrottleHandle(base::OnceCallback<void()> throttle_callback); + + DevToolsThrottleHandle(const DevToolsThrottleHandle&) = delete; + DevToolsThrottleHandle& operator=(const DevToolsThrottleHandle&) = delete; + + private: + friend class RefCounted<DevToolsThrottleHandle>; + + ~DevToolsThrottleHandle(); + + base::OnceCallback<void()> throttle_callback_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_THROTTLE_HANDLE_H_
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc index 7652a067..e54cd0c 100644 --- a/content/browser/devtools/protocol/page_handler.cc +++ b/content/browser/devtools/protocol/page_handler.cc
@@ -1643,35 +1643,21 @@ CreateNotRestoredExplanation( const BackForwardCacheCanStoreDocumentResult::NotStoredReasons not_stored_reasons, - const uint64_t blocklisted_features) { + const blink::scheduler::WebSchedulerTrackedFeatures blocklisted_features) { auto reasons = std::make_unique< protocol::Array<Page::BackForwardCacheNotRestoredExplanation>>(); - for (size_t i = 0; - i <= static_cast<size_t>( - BackForwardCacheMetrics::NotRestoredReason::kMaxValue); - i++) { - if (!not_stored_reasons.test(i)) { - // Reason at index i does not exist. - continue; - } - auto reason = static_cast<BackForwardCacheMetrics::NotRestoredReason>(i); + for (BackForwardCacheMetrics::NotRestoredReason reason : not_stored_reasons) { if (reason == BackForwardCacheMetrics::NotRestoredReason::kBlocklistedFeatures) { - DCHECK(blocklisted_features); - for (uint32_t j = 0; - j <= static_cast<uint32_t>(WebSchedulerTrackedFeature::kMaxValue); - ++j) { - // Add the blocklisted reason if the blocklisted reason exists. - if (blocklisted_features & (1ULL << j)) { - blink::scheduler::WebSchedulerTrackedFeature feature = - static_cast<blink::scheduler::WebSchedulerTrackedFeature>(j); - reasons->emplace_back( - Page::BackForwardCacheNotRestoredExplanation::Create() - .SetType(MapBlocklistedFeatureToType(feature)) - .SetReason(BlocklistedFeatureToProtocol(feature)) - .Build()); - } + DCHECK(!blocklisted_features.Empty()); + for (blink::scheduler::WebSchedulerTrackedFeature feature : + blocklisted_features) { + reasons->emplace_back( + Page::BackForwardCacheNotRestoredExplanation::Create() + .SetType(MapBlocklistedFeatureToType(feature)) + .SetReason(BlocklistedFeatureToProtocol(feature)) + .Build()); } } else { reasons->emplace_back(
diff --git a/content/browser/devtools/protocol/target_handler.cc b/content/browser/devtools/protocol/target_handler.cc index 0fde55e..bcf4f686 100644 --- a/content/browser/devtools/protocol/target_handler.cc +++ b/content/browser/devtools/protocol/target_handler.cc
@@ -305,6 +305,8 @@ private: void CleanupPointers(); + base::WeakPtrFactory<TargetHandler::Throttle> weak_factory_{this}; + DISALLOW_COPY_AND_ASSIGN(Throttle); }; @@ -413,11 +415,13 @@ devtools_session_->ResumeSendingMessagesToAgent(); } - void SetThrottle(Throttle* throttle) { throttle_ = throttle; } + void SetThrottle(scoped_refptr<DevToolsThrottleHandle> throttle) { + throttle_ = throttle; + } void ResumeIfThrottled() { if (throttle_) - throttle_->Clear(); + throttle_.reset(); } void SendMessageToAgentHost(base::span<const uint8_t> message) { @@ -434,7 +438,7 @@ const std::string* method; if (value.has_value() && (method = value->FindStringKey(kMethod)) && *method == kResumeMethod) { - throttle_->Clear(); + throttle_.reset(); } } @@ -514,7 +518,7 @@ std::string id_; bool flatten_protocol_; DevToolsSession* devtools_session_ = nullptr; - Throttle* throttle_ = nullptr; + scoped_refptr<DevToolsThrottleHandle> throttle_; DISALLOW_COPY_AND_ASSIGN(Session); }; @@ -546,10 +550,10 @@ void TargetHandler::Throttle::SetThrottledAgentHost( DevToolsAgentHost* agent_host) { agent_host_ = agent_host; - if (agent_host_) { - target_handler_->auto_attached_sessions_[agent_host_.get()]->SetThrottle( - this); - } + target_handler_->AddThrottle( + agent_host_.get(), + base::MakeRefCounted<DevToolsThrottleHandle>(base::BindOnce( + &TargetHandler::Throttle::Clear, weak_factory_.GetWeakPtr()))); } const char* TargetHandler::Throttle::GetNameForLogging() { @@ -1131,5 +1135,17 @@ } } +void TargetHandler::AddThrottle( + DevToolsAgentHost* agent_host, + scoped_refptr<DevToolsThrottleHandle> throttle_handle) { + if (!agent_host) + return; + + if (auto_attached_sessions_[agent_host]) { + auto_attached_sessions_[agent_host]->SetThrottle( + std::move(throttle_handle)); + } +} + } // namespace protocol } // namespace content
diff --git a/content/browser/devtools/protocol/target_handler.h b/content/browser/devtools/protocol/target_handler.h index 2aee1fe..f1282b6 100644 --- a/content/browser/devtools/protocol/target_handler.h +++ b/content/browser/devtools/protocol/target_handler.h
@@ -11,6 +11,7 @@ #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/memory/weak_ptr.h" +#include "content/browser/devtools/devtools_throttle_handle.h" #include "content/browser/devtools/protocol/devtools_domain_handler.h" #include "content/browser/devtools/protocol/target.h" #include "content/browser/devtools/protocol/target_auto_attacher.h" @@ -59,6 +60,7 @@ void DidFinishNavigation(NavigationHandle* navigation_handle); std::unique_ptr<NavigationThrottle> CreateThrottleForNavigation( NavigationHandle* navigation_handle); + void UpdatePortals(); bool ShouldThrottlePopups() const; @@ -113,6 +115,11 @@ BrowserContext* browser_context, network::mojom::NetworkContextParams* network_context_params); + // Adds a throttle for an auto attaching session. If none is known for this + // `agent_host`, is a no-op. + void AddThrottle(DevToolsAgentHost* agent_host, + scoped_refptr<DevToolsThrottleHandle> throttle_handle); + private: class Session; class Throttle;
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index 79df787..de731a2 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -577,7 +577,7 @@ if (render_frame_alive_ && render_frame_crashed_) { render_frame_crashed_ = false; for (DevToolsSession* session : sessions()) - session->ClearPendingMessages(); + session->ClearPendingMessages(/*did_crash=*/true); for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetReloadedAfterCrash(); }
diff --git a/content/browser/devtools/service_worker_devtools_agent_host.cc b/content/browser/devtools/service_worker_devtools_agent_host.cc index 78fc1bd4..7d56b58 100644 --- a/content/browser/devtools/service_worker_devtools_agent_host.cc +++ b/content/browser/devtools/service_worker_devtools_agent_host.cc
@@ -117,6 +117,11 @@ version_doomed_time_ = base::Time::Now(); } +void ServiceWorkerDevToolsAgentHost::WorkerMainScriptFetchingFailed() { + for (DevToolsSession* session : sessions()) + session->ClearPendingMessages(/*did_crash=*/false); +} + ServiceWorkerDevToolsAgentHost::~ServiceWorkerDevToolsAgentHost() { ServiceWorkerDevToolsManager::GetInstance()->AgentHostDestroyed(this); } @@ -291,4 +296,10 @@ return cross_origin_embedder_policy_; } +void ServiceWorkerDevToolsAgentHost::set_should_pause_on_start( + bool should_pause_on_start) { + DCHECK(base::FeatureList::IsEnabled(features::kPlzServiceWorker)); + should_pause_on_start_ = should_pause_on_start; +} + } // namespace content
diff --git a/content/browser/devtools/service_worker_devtools_agent_host.h b/content/browser/devtools/service_worker_devtools_agent_host.h index 84210067..eec87e4e 100644 --- a/content/browser/devtools/service_worker_devtools_agent_host.h +++ b/content/browser/devtools/service_worker_devtools_agent_host.h
@@ -72,6 +72,12 @@ void WorkerVersionInstalled(); void WorkerVersionDoomed(); + // This a niche function used when failing a ServiceWorker main script fetch + // with PlzServiceWorker. Since the worker did not have the opportunity to + // boot up, some messages will be left unanswered. This makes sure they are + // answered with an error message, avoid time outs in WPTs. + void WorkerMainScriptFetchingFailed(); + const GURL& scope() const { return scope_; } const base::UnguessableToken& devtools_worker_token() const { return devtools_worker_token_; @@ -90,6 +96,9 @@ return context_wrapper_.get(); } + bool should_pause_on_start() { return should_pause_on_start_; } + void set_should_pause_on_start(bool should_pause_on_start); + private: ~ServiceWorkerDevToolsAgentHost() override; void UpdateIsAttached(bool attached); @@ -119,6 +128,16 @@ GURL scope_; base::Time version_installed_time_; base::Time version_doomed_time_; + + // `should_pause_on_start_` is set by DevTools auto-attachers if any that + // asked for execution to be paused so that they could attach asynchronously + // to the new ServiceWorker target. If true, we throttle the main script fetch + // and pause the renderer when starting. + // Note: This is only used with PlzServiceWorker. If PlzServiceWorker is off, + // this state is not stored but passed directly into the starting parameters + // of the ServiceWorker as `should_wait_for_debugger`. + bool should_pause_on_start_ = false; + absl::optional<network::CrossOriginEmbedderPolicy> cross_origin_embedder_policy_; mojo::Remote<network::mojom::CrossOriginEmbedderPolicyReporter>
diff --git a/content/browser/devtools/service_worker_devtools_manager.cc b/content/browser/devtools/service_worker_devtools_manager.cc index 0dadf5a..7a44ec2 100644 --- a/content/browser/devtools/service_worker_devtools_manager.cc +++ b/content/browser/devtools/service_worker_devtools_manager.cc
@@ -4,6 +4,7 @@ #include "content/browser/devtools/service_worker_devtools_manager.h" +#include "content/browser/devtools/devtools_instrumentation.h" #include "content/browser/devtools/protocol/network_handler.h" #include "content/browser/devtools/protocol/page_handler.h" #include "content/browser/devtools/service_worker_devtools_agent_host.h" @@ -59,20 +60,27 @@ if (it.second->GetBrowserContext() == browser_context) result->push_back(it.second.get()); } + for (auto& it : new_installing_hosts_) { + if (it->GetBrowserContext() == browser_context) + result->push_back(it.get()); + } } void ServiceWorkerDevToolsManager::WorkerMainScriptFetchingStarting( scoped_refptr<ServiceWorkerContextWrapper> context_wrapper, int64_t version_id, const GURL& url, - const GURL& scope) { + const GURL& scope, + const GlobalRenderFrameHostId& requesting_frame_id, + scoped_refptr<DevToolsThrottleHandle> throttle_handle) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // Verify that we are not getting a similar host that's already in a stopped // state. This should never happen, we are installing a new SW, we cannot // have the same one that was started and stopped. + ServiceWorkerContextWrapper* context_wrapper_ptr = context_wrapper.get(); scoped_refptr<ServiceWorkerDevToolsAgentHost> agent_host = - TakeStoppedHost(context_wrapper.get(), version_id); + TakeStoppedHost(context_wrapper_ptr, version_id); DCHECK(!agent_host); scoped_refptr<ServiceWorkerDevToolsAgentHost> host = @@ -82,14 +90,45 @@ /*cross_origin_embedder_policy=*/absl::nullopt, /*coep_reporter=*/mojo::NullRemote(), base::UnguessableToken::Create()); + + ServiceWorkerDevToolsAgentHost* host_ptr = host.get(); new_installing_hosts_.insert(std::move(host)); + + for (auto& observer : observer_list_) { + bool should_pause_on_start = false; + observer.WorkerCreated(host_ptr, &should_pause_on_start); + if (should_pause_on_start) { + host_ptr->set_should_pause_on_start(true); + } + } + + // Now that we have a devtools target, we need to give devtools the + // opportunity to attach to it before we do the actual fetch. We pass it a + // callback that will be called once we have all the handlers ready. + if (host_ptr->should_pause_on_start()) { + devtools_instrumentation::ThrottleMainScriptFetch( + context_wrapper_ptr, version_id, requesting_frame_id, throttle_handle); + } } void ServiceWorkerDevToolsManager::WorkerMainScriptFetchingFailed( scoped_refptr<ServiceWorkerContextWrapper> context_wrapper, int64_t version_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - TakeNewInstallingHost(context_wrapper.get(), version_id); + scoped_refptr<ServiceWorkerDevToolsAgentHost> host = + TakeNewInstallingHost(context_wrapper.get(), version_id); + + // While not strictly required, some WPTs expect all messages to be answered + // before finishing and will loop until they get an answer. This call makes + // sure all pending messages are answered with an error when we fail the + // main script fetch. + host->WorkerMainScriptFetchingFailed(); + + // This observer call should trigger the destruction of the + // ServiceWorkerDevToolsAgentHost by removing the scoped_ptr references held + // by auto-attachers. + for (auto& observer : observer_list_) + observer.WorkerDestroyed(host.get()); } void ServiceWorkerDevToolsManager::WorkerStarting( @@ -123,20 +162,8 @@ agent_host = TakeNewInstallingHost(context_wrapper.get(), version_id); if (agent_host) { live_hosts_[worker_id] = agent_host; - - // TODO(https://crbug.com/1211358): This is too late for handlers to attach. - // We have already fetched the main script at this stage. Moving this to - // WorkerMainScriptFetchingStarting also requires throttling the fetch to - // allow clients to attach. - *pause_on_start = debug_service_worker_on_start_; - for (auto& observer : observer_list_) { - bool should_pause_on_start = false; - observer.WorkerCreated(agent_host.get(), &should_pause_on_start); - if (should_pause_on_start) - *pause_on_start = true; - } - agent_host->WorkerStarted(worker_process_id, worker_route_id); + *pause_on_start = agent_host->should_pause_on_start(); *devtools_worker_token = agent_host->devtools_worker_token(); return; }
diff --git a/content/browser/devtools/service_worker_devtools_manager.h b/content/browser/devtools/service_worker_devtools_manager.h index aae390c..73161ee 100644 --- a/content/browser/devtools/service_worker_devtools_manager.h +++ b/content/browser/devtools/service_worker_devtools_manager.h
@@ -15,7 +15,9 @@ #include "base/no_destructor.h" #include "base/observer_list.h" #include "base/unguessable_token.h" +#include "content/browser/devtools/devtools_throttle_handle.h" #include "content/common/content_export.h" +#include "content/public/browser/global_routing_id.h" #include "services/network/public/cpp/cross_origin_embedder_policy.h" #include "services/network/public/mojom/cross_origin_embedder_policy.mojom-forward.h" #include "services/network/public/mojom/url_response_head.mojom-forward.h" @@ -64,12 +66,15 @@ std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>* result); // This function signals the beginning of a main script fetch for a non - // installed worker. This is currently only used for plzServiceWorker. + // installed worker. This is currently only used for PlzServiceWorker. void WorkerMainScriptFetchingStarting( scoped_refptr<ServiceWorkerContextWrapper> context_wrapper, int64_t version_id, const GURL& url, - const GURL& scope); + const GURL& scope, + const GlobalRenderFrameHostId& requesting_frame_id, + scoped_refptr<DevToolsThrottleHandle> throttle_handle); + // This function is called when a new worker installation failed to fetch // the main script. It cleans up internal state. void WorkerMainScriptFetchingFailed(
diff --git a/content/browser/permissions/permission_service_context.cc b/content/browser/permissions/permission_service_context.cc index 3a878566..52d9f72 100644 --- a/content/browser/permissions/permission_service_context.cc +++ b/content/browser/permissions/permission_service_context.cc
@@ -46,7 +46,8 @@ } void OnPermissionStatusChanged(blink::mojom::PermissionStatus status) { - observer_->OnPermissionStatusChange(status); + if (observer_.is_connected()) + observer_->OnPermissionStatusChange(status); } void set_id(PermissionController::SubscriptionId id) { id_ = id; }
diff --git a/content/browser/prerender/prerender_browsertest.cc b/content/browser/prerender/prerender_browsertest.cc index 8551820..9939f0a 100644 --- a/content/browser/prerender/prerender_browsertest.cc +++ b/content/browser/prerender/prerender_browsertest.cc
@@ -372,6 +372,31 @@ EXPECT_FALSE(HasHostForUrl(kPrerenderingUrl)); } +// Tests that clicking a link can activate a prerender. +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, ActivateOnLinkClick) { + const GURL kInitialUrl = GetUrl("/simple_links.html"); + const GURL kPrerenderingUrl = GetUrl("/title2.html"); + + // Navigate to an initial page which has a link to `kPrerenderingUrl`. + ASSERT_TRUE(NavigateToURL(shell(), kInitialUrl)); + + // Start prerendering `kPrerenderingUrl`. + const int prerender_host_id = AddPrerender(kPrerenderingUrl); + test::PrerenderHostObserver prerender_observer(*web_contents(), + prerender_host_id); + + // Click the link. It should activate the prerendered page. + TestNavigationObserver nav_observer(web_contents()); + const std::string kLinkClickScript = R"( + const link = document.querySelector('#same_site_link'); + link.click(); + )"; + EXPECT_TRUE(ExecJs(web_contents(), kLinkClickScript)); + nav_observer.WaitForNavigationFinished(); + EXPECT_EQ(web_contents()->GetURL(), kPrerenderingUrl); + EXPECT_TRUE(prerender_observer.was_activated()); +} + IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, ResponseHeaders) { const GURL kInitialUrl = GetUrl("/empty.html"); const GURL kPrerenderingUrl = GetUrl("/set-header?X-Foo: bar");
diff --git a/content/browser/prerender/prerender_host.cc b/content/browser/prerender/prerender_host.cc index 1517172..1229486 100644 --- a/content/browser/prerender/prerender_host.cc +++ b/content/browser/prerender/prerender_host.cc
@@ -141,13 +141,15 @@ void NotifyNavigationEntriesDeleted() override {} void ActivateAndShowRepostFormWarningDialog() override {} bool ShouldPreserveAbortedURLs() override { return false; } - WebContents* GetWebContents() override { return &web_contents_; } + WebContents* DeprecatedGetWebContents() override { return GetWebContents(); } void UpdateOverridingUserAgent() override {} NavigationControllerImpl& GetNavigationController() { return frame_tree_->controller(); } + WebContents* GetWebContents() { return &web_contents_; } + ActivateResult Activate(NavigationRequest& navigation_request) { // There should be no ongoing main-frame navigation during activation. // TODO(https://crbug.com/1190644): Make sure sub-frame navigations are @@ -454,10 +456,10 @@ return false; } - if (potential_activation.request_context_type != - begin_params_->request_context_type) { - return false; - } + // TODO(https://crbug.com/1181763): Determine if we should compare + // `request_context_type`. Just checking for equality is bad because + // the prerender has type LOCATION and a link click would have type + // HYPERLINK. if (potential_activation.request_destination != begin_params_->request_destination) {
diff --git a/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc b/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc index 97e607ba..f4728ce 100644 --- a/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc +++ b/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc
@@ -4,6 +4,7 @@ #include "content/browser/renderer_host/back_forward_cache_can_store_document_result.h" +#include "base/containers/contains.h" #include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/strings/string_util.h" @@ -17,14 +18,10 @@ using blink::scheduler::WebSchedulerTrackedFeature; -std::string DescribeFeatures(uint64_t blocklisted_features) { +std::string DescribeFeatures(BlockListedFeatures blocklisted_features) { std::vector<std::string> features; - for (uint32_t i = 0; - i <= static_cast<uint32_t>(WebSchedulerTrackedFeature::kMaxValue); ++i) { - if (blocklisted_features & (1ULL << i)) { - features.push_back(blink::scheduler::FeatureToHumanReadableString( - static_cast<WebSchedulerTrackedFeature>(i))); - } + for (WebSchedulerTrackedFeature feature : blocklisted_features) { + features.push_back(blink::scheduler::FeatureToHumanReadableString(feature)); } return base::JoinString(features, ", "); } @@ -33,16 +30,16 @@ bool BackForwardCacheCanStoreDocumentResult::HasNotStoredReason( BackForwardCacheMetrics::NotRestoredReason reason) const { - return not_stored_reasons_.test(static_cast<size_t>(reason)); + return not_stored_reasons_.Has(reason); } void BackForwardCacheCanStoreDocumentResult::AddNotStoredReason( BackForwardCacheMetrics::NotRestoredReason reason) { - not_stored_reasons_.set(static_cast<size_t>(reason)); + not_stored_reasons_.Put(reason); } bool BackForwardCacheCanStoreDocumentResult::CanStore() const { - return not_stored_reasons_.none(); + return not_stored_reasons_.Empty(); } namespace { @@ -58,18 +55,14 @@ } // namespace std::string BackForwardCacheCanStoreDocumentResult::ToString() const { - using Reason = BackForwardCacheMetrics::NotRestoredReason; - if (CanStore()) return "Yes"; std::vector<std::string> reason_strs; - for (int i = 0; i <= static_cast<int>(Reason::kMaxValue); i++) { - if (!not_stored_reasons_.test(static_cast<size_t>(i))) - continue; - - reason_strs.push_back(NotRestoredReasonToString(static_cast<Reason>(i))); + for (BackForwardCacheMetrics::NotRestoredReason reason : + not_stored_reasons_) { + reason_strs.push_back(NotRestoredReasonToString(reason)); } return "No: " + base::JoinString(reason_strs, ", "); @@ -200,10 +193,10 @@ } void BackForwardCacheCanStoreDocumentResult::NoDueToFeatures( - uint64_t features) { + BlockListedFeatures features) { AddNotStoredReason( BackForwardCacheMetrics::NotRestoredReason::kBlocklistedFeatures); - blocklisted_features_ |= features; + blocklisted_features_.PutAll(features); } void BackForwardCacheCanStoreDocumentResult:: @@ -217,8 +210,8 @@ void BackForwardCacheCanStoreDocumentResult::AddReasonsFrom( const BackForwardCacheCanStoreDocumentResult& other) { - not_stored_reasons_ |= other.not_stored_reasons_; - blocklisted_features_ |= other.blocklisted_features(); + not_stored_reasons_.PutAll(other.not_stored_reasons_); + blocklisted_features_.PutAll(other.blocklisted_features()); for (const BackForwardCache::DisabledReason& reason : other.disabled_reasons()) { disabled_reasons_.insert(reason);
diff --git a/content/browser/renderer_host/back_forward_cache_can_store_document_result.h b/content/browser/renderer_host/back_forward_cache_can_store_document_result.h index f432caf..cfa2f053 100644 --- a/content/browser/renderer_host/back_forward_cache_can_store_document_result.h +++ b/content/browser/renderer_host/back_forward_cache_can_store_document_result.h
@@ -8,21 +8,25 @@ #include <bitset> #include <set> +#include "base/util/enum_set/enum_set.h" #include "content/browser/renderer_host/back_forward_cache_metrics.h" #include "content/browser/renderer_host/should_swap_browsing_instance.h" +#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" namespace content { +using BlockListedFeatures = blink::scheduler::WebSchedulerTrackedFeatures; + // Represents the result whether the page could be stored in the back-forward // cache with the reasons. // TODO(rakina): Rename this to use "Page" instead of "Document", to follow // the naming of BackForwardCacheImpl::CanStorePageNow(). class CONTENT_EXPORT BackForwardCacheCanStoreDocumentResult { public: - using NotStoredReasons = - std::bitset<static_cast<size_t>( - BackForwardCacheMetrics::NotRestoredReason::kMaxValue) + - 1ul>; + using NotStoredReasons = base::util::EnumSet< + BackForwardCacheMetrics::NotRestoredReason, + BackForwardCacheMetrics::NotRestoredReason::kMinValue, + BackForwardCacheMetrics::NotRestoredReason::kMaxValue>; BackForwardCacheCanStoreDocumentResult(); BackForwardCacheCanStoreDocumentResult( @@ -37,7 +41,7 @@ BackForwardCacheMetrics::NotRestoredReason reason) const; void No(BackForwardCacheMetrics::NotRestoredReason reason); - void NoDueToFeatures(uint64_t features); + void NoDueToFeatures(BlockListedFeatures features); // TODO(hajimehoshi): Replace the arbitrary strings with base::Location / // FROM_HERE for privacy reasons. @@ -50,7 +54,9 @@ const NotStoredReasons& not_stored_reasons() const { return not_stored_reasons_; } - uint64_t blocklisted_features() const { return blocklisted_features_; } + BlockListedFeatures blocklisted_features() const { + return blocklisted_features_; + } const std::set<BackForwardCache::DisabledReason>& disabled_reasons() const { return disabled_reasons_; @@ -64,7 +70,7 @@ BackForwardCacheMetrics::NotRestoredReason reason) const; NotStoredReasons not_stored_reasons_; - uint64_t blocklisted_features_ = 0; + BlockListedFeatures blocklisted_features_; std::set<BackForwardCache::DisabledReason> disabled_reasons_; };
diff --git a/content/browser/renderer_host/back_forward_cache_impl.cc b/content/browser/renderer_host/back_forward_cache_impl.cc index 1758593..b5e0d623 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.cc +++ b/content/browser/renderer_host/back_forward_cache_impl.cc
@@ -18,6 +18,7 @@ #include "base/trace_event/typed_macros.h" #include "build/build_config.h" #include "content/browser/bad_message.h" +#include "content/browser/renderer_host/back_forward_cache_can_store_document_result.h" #include "content/browser/renderer_host/frame_tree_node.h" #include "content/browser/renderer_host/navigation_request.h" #include "content/browser/renderer_host/render_frame_host_delegate.h" @@ -45,6 +46,7 @@ namespace { using blink::scheduler::WebSchedulerTrackedFeature; +using blink::scheduler::WebSchedulerTrackedFeatures; // The default number of entries the BackForwardCache can hold per tab. static constexpr size_t kDefaultBackForwardCacheSize = 1; @@ -161,29 +163,29 @@ return unload_support.Get(); } -uint64_t SupportedFeaturesBitmaskImpl() { +WebSchedulerTrackedFeatures SupportedFeaturesImpl() { + WebSchedulerTrackedFeatures features; if (!IsBackForwardCacheEnabled()) - return 0; + return features; static constexpr base::FeatureParam<std::string> supported_features( &features::kBackForwardCache, "supported_features", ""); std::vector<std::string> tokens = base::SplitString(supported_features.Get(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - uint64_t mask = 0; for (const std::string& token : tokens) { auto feature = blink::scheduler::StringToFeature(token); DCHECK(feature.has_value()) << "invalid feature string: " << token; if (feature.has_value()) { - mask |= blink::scheduler::FeatureToBit(feature.value()); + features.Put(feature.value()); } } - return mask; + return features; } -uint64_t SupportedFeaturesBitmask() { - static uint64_t mask = SupportedFeaturesBitmaskImpl(); - return mask; +WebSchedulerTrackedFeatures SupportedFeatures() { + static WebSchedulerTrackedFeatures features = SupportedFeaturesImpl(); + return features; } bool IgnoresOutstandingNetworkRequestForTesting() { @@ -209,75 +211,66 @@ enum RequestedFeatures { kAll, kOnlySticky }; -uint64_t GetDisallowedFeatures(RenderFrameHostImpl* rfh, - RequestedFeatures requested_features) { +BlockListedFeatures GetDisallowedFeatures( + RenderFrameHostImpl* rfh, + RequestedFeatures requested_features) { // TODO(https://crbug.com/1015784): Finalize disallowed feature list, and test // for each disallowed feature. - constexpr uint64_t kAlwaysDisallowedFeatures = - FeatureToBit(WebSchedulerTrackedFeature::kAppBanner) | - FeatureToBit(WebSchedulerTrackedFeature::kBroadcastChannel) | - FeatureToBit(WebSchedulerTrackedFeature::kContainsPlugins) | - FeatureToBit(WebSchedulerTrackedFeature::kDedicatedWorkerOrWorklet) | - FeatureToBit(WebSchedulerTrackedFeature::kIdleManager) | - FeatureToBit(WebSchedulerTrackedFeature::kIndexedDBConnection) | - FeatureToBit(WebSchedulerTrackedFeature::kKeyboardLock) | - FeatureToBit( - WebSchedulerTrackedFeature::kOutstandingIndexedDBTransaction) | - FeatureToBit(WebSchedulerTrackedFeature::kPaymentManager) | - FeatureToBit(WebSchedulerTrackedFeature::kPictureInPicture) | - FeatureToBit(WebSchedulerTrackedFeature::kPortal) | - FeatureToBit(WebSchedulerTrackedFeature::kPrinting) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedAudioCapturePermission) | - FeatureToBit(WebSchedulerTrackedFeature:: - kRequestedBackForwardCacheBlockedSensors) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedBackgroundWorkPermission) | - FeatureToBit(WebSchedulerTrackedFeature::kRequestedMIDIPermission) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedNotificationsPermission) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedVideoCapturePermission) | - FeatureToBit(WebSchedulerTrackedFeature::kSharedWorker) | - FeatureToBit(WebSchedulerTrackedFeature::kWebOTPService) | - FeatureToBit(WebSchedulerTrackedFeature::kSpeechRecognizer) | - FeatureToBit(WebSchedulerTrackedFeature::kSpeechSynthesis) | - FeatureToBit(WebSchedulerTrackedFeature::kWebDatabase) | - FeatureToBit(WebSchedulerTrackedFeature::kWebHID) | - FeatureToBit(WebSchedulerTrackedFeature::kWebLocks) | - FeatureToBit(WebSchedulerTrackedFeature::kWebRTC) | - FeatureToBit(WebSchedulerTrackedFeature::kWebShare) | - FeatureToBit(WebSchedulerTrackedFeature::kWebSocket) | - FeatureToBit(WebSchedulerTrackedFeature::kWebXR) | - FeatureToBit( - WebSchedulerTrackedFeature::kMediaSessionImplOnServiceCreated); + constexpr WebSchedulerTrackedFeatures kAlwaysDisallowedFeatures( + WebSchedulerTrackedFeature::kAppBanner, + WebSchedulerTrackedFeature::kBroadcastChannel, + WebSchedulerTrackedFeature::kContainsPlugins, + WebSchedulerTrackedFeature::kDedicatedWorkerOrWorklet, + WebSchedulerTrackedFeature::kIdleManager, + WebSchedulerTrackedFeature::kIndexedDBConnection, + WebSchedulerTrackedFeature::kKeyboardLock, + WebSchedulerTrackedFeature::kOutstandingIndexedDBTransaction, + WebSchedulerTrackedFeature::kPaymentManager, + WebSchedulerTrackedFeature::kPictureInPicture, + WebSchedulerTrackedFeature::kPortal, + WebSchedulerTrackedFeature::kPrinting, + WebSchedulerTrackedFeature::kRequestedAudioCapturePermission, + WebSchedulerTrackedFeature::kRequestedBackForwardCacheBlockedSensors, + WebSchedulerTrackedFeature::kRequestedBackgroundWorkPermission, + WebSchedulerTrackedFeature::kRequestedMIDIPermission, + WebSchedulerTrackedFeature::kRequestedNotificationsPermission, + WebSchedulerTrackedFeature::kRequestedVideoCapturePermission, + WebSchedulerTrackedFeature::kSharedWorker, + WebSchedulerTrackedFeature::kWebOTPService, + WebSchedulerTrackedFeature::kSpeechRecognizer, + WebSchedulerTrackedFeature::kSpeechSynthesis, + WebSchedulerTrackedFeature::kWebDatabase, + WebSchedulerTrackedFeature::kWebHID, + WebSchedulerTrackedFeature::kWebLocks, + WebSchedulerTrackedFeature::kWebRTC, + WebSchedulerTrackedFeature::kWebShare, + WebSchedulerTrackedFeature::kWebSocket, + WebSchedulerTrackedFeature::kWebXR, + WebSchedulerTrackedFeature::kMediaSessionImplOnServiceCreated); - uint64_t result = kAlwaysDisallowedFeatures; + WebSchedulerTrackedFeatures result = kAlwaysDisallowedFeatures; if (!IsContentInjectionSupported()) { - result |= FeatureToBit(WebSchedulerTrackedFeature::kIsolatedWorldScript) | - FeatureToBit(WebSchedulerTrackedFeature::kInjectedStyleSheet); + result.Put(WebSchedulerTrackedFeature::kIsolatedWorldScript); + result.Put(WebSchedulerTrackedFeature::kInjectedStyleSheet); } if (!IgnoresOutstandingNetworkRequestForTesting()) { - result |= - FeatureToBit( - WebSchedulerTrackedFeature::kOutstandingNetworkRequestOthers) | - FeatureToBit( - WebSchedulerTrackedFeature::kOutstandingNetworkRequestFetch) | - FeatureToBit(WebSchedulerTrackedFeature::kOutstandingNetworkRequestXHR); + result.Put(WebSchedulerTrackedFeature::kOutstandingNetworkRequestOthers); + result.Put(WebSchedulerTrackedFeature::kOutstandingNetworkRequestFetch); + result.Put(WebSchedulerTrackedFeature::kOutstandingNetworkRequestXHR); } if (!IsFileSystemSupported()) { - result |= FeatureToBit(WebSchedulerTrackedFeature::kWebFileSystem); + result.Put(WebSchedulerTrackedFeature::kWebFileSystem); } if (requested_features == RequestedFeatures::kOnlySticky) { // Remove all non-sticky features from |result|. - result &= blink::scheduler::StickyFeaturesBitmask(); + result = Intersection(result, blink::scheduler::StickyFeatures()); } - result &= ~SupportedFeaturesBitmask(); + result.RemoveAll(SupportedFeatures()); return result; } @@ -613,9 +606,12 @@ // TODO(rakina): Once we move cache-control tracking to RenderFrameHostImpl, // change this part to use the information stored in RenderFrameHostImpl // instead. - uint64_t cache_control_no_store_feature = FeatureToBit( + + BlockListedFeatures cache_control_no_store_feature( WebSchedulerTrackedFeature::kMainResourceHasCacheControlNoStore); - if (rfh->scheduler_tracked_features() & cache_control_no_store_feature) { + if (!Intersection(rfh->scheduler_tracked_features(), + cache_control_no_store_feature) + .Empty()) { result.NoDueToFeatures(cache_control_no_store_feature); } @@ -705,9 +701,10 @@ // cache, we should only consider "sticky" features here - features that // will always result in a page becoming ineligible for back-forward cache // since the first time it's used. - if (uint64_t banned_features = - GetDisallowedFeatures(rfh, RequestedFeatures::kOnlySticky) & - rfh->scheduler_tracked_features()) { + WebSchedulerTrackedFeatures banned_features = + Intersection(GetDisallowedFeatures(rfh, RequestedFeatures::kOnlySticky), + rfh->scheduler_tracked_features()); + if (!banned_features.Empty()) { if (!ShouldIgnoreBlocklists()) { result->NoDueToFeatures(banned_features); } @@ -730,9 +727,10 @@ // in CanStoreRenderFrameHostLater, we are checking all banned features here // (not only the "sticky" features), because this time we're making a decision // on whether we should store a page in the back-forward cache or not. - if (uint64_t banned_features = - GetDisallowedFeatures(rfh, RequestedFeatures::kAll) & - rfh->scheduler_tracked_features()) { + WebSchedulerTrackedFeatures banned_features = + Intersection(GetDisallowedFeatures(rfh, RequestedFeatures::kAll), + rfh->scheduler_tracked_features()); + if (!banned_features.Empty()) { bool should_ignore_features_for_now = CheckFeatureUsageOnlyAfterAck() && !rfh->render_view_host()->DidReceiveBackForwardCacheAck(); @@ -1053,10 +1051,8 @@ } bool BackForwardCacheImpl::IsMediaSessionImplOnServiceCreatedAllowed() { - return (SupportedFeaturesBitmask() & - FeatureToBit( - WebSchedulerTrackedFeature::kMediaSessionImplOnServiceCreated)) != - 0; + return SupportedFeatures().Has( + WebSchedulerTrackedFeature::kMediaSessionImplOnServiceCreated); } void BackForwardCacheImpl::WillCommitNavigationToCachedEntry(
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.cc b/content/browser/renderer_host/back_forward_cache_metrics.cc index 7c14ed3..59e46ca 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.cc +++ b/content/browser/renderer_host/back_forward_cache_metrics.cc
@@ -21,6 +21,7 @@ #include "content/public/browser/reload_type.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" +#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" #include "url/gurl.h" #include "url/origin.h" @@ -135,7 +136,7 @@ // the navigation and other logged data. bool served_from_bfcache_not_match = navigation->IsServedFromBackForwardCache() && - page_store_result_->not_stored_reasons().to_ullong() != 0ULL; + !page_store_result_->not_stored_reasons().Empty(); bool browsing_instance_not_swapped_not_match = page_store_result_->HasNotStoredReason( NotRestoredReason::kBrowsingInstanceNotSwapped) && @@ -147,7 +148,7 @@ bool blocklisted_features_not_match = page_store_result_->HasNotStoredReason( NotRestoredReason::kBlocklistedFeatures) && - page_store_result_->blocklisted_features() == 0ULL; + page_store_result_->blocklisted_features().Empty(); if (served_from_bfcache_not_match || browsing_instance_not_swapped_not_match || disable_for_rfh_not_match || blocklisted_features_not_match) { @@ -211,9 +212,11 @@ ukm::ConvertToSourceId( last_committed_cross_document_main_frame_navigation_id_, ukm::SourceIdType::NAVIGATION_ID)); - builder.SetMainFrameFeatures(main_frame_features_); - builder.SetSameOriginSubframesFeatures(same_origin_frames_features_); - builder.SetCrossOriginSubframesFeatures(cross_origin_frames_features_); + builder.SetMainFrameFeatures(main_frame_features_.ToEnumBitmask()); + builder.SetSameOriginSubframesFeatures( + same_origin_frames_features_.ToEnumBitmask()); + builder.SetCrossOriginSubframesFeatures( + cross_origin_frames_features_.ToEnumBitmask()); // DidStart notification might be missing for some same-document // navigations. It's good that we don't care about the time in the cache // in that case. @@ -228,10 +231,10 @@ builder.SetBackForwardCache_IsServedFromBackForwardCache( navigation->IsServedFromBackForwardCache()); builder.SetBackForwardCache_NotRestoredReasons( - page_store_result_->not_stored_reasons().to_ullong()); + page_store_result_->not_stored_reasons().ToEnumBitmask()); builder.SetBackForwardCache_BlocklistedFeatures( - static_cast<int64_t>(page_store_result_->blocklisted_features())); + page_store_result_->blocklisted_features().ToEnumBitmask()); if (browsing_instance_swap_result_) { builder.SetBackForwardCache_BrowsingInstanceNotSwappedReason( @@ -265,9 +268,9 @@ RenderFrameHostImpl* main_frame) { DCHECK(!main_frame->GetParent()); - main_frame_features_ = 0; - same_origin_frames_features_ = 0; - cross_origin_frames_features_ = 0; + main_frame_features_.Clear(); + same_origin_frames_features_.Clear(); + cross_origin_frames_features_.Clear(); CollectFeatureUsageFromSubtree(main_frame, main_frame->GetLastCommittedOrigin()); @@ -276,14 +279,15 @@ void BackForwardCacheMetrics::CollectFeatureUsageFromSubtree( RenderFrameHostImpl* rfh, const url::Origin& main_frame_origin) { - uint64_t features = rfh->scheduler_tracked_features(); + blink::scheduler::WebSchedulerTrackedFeatures features = + rfh->scheduler_tracked_features(); if (!rfh->GetParent()) { - main_frame_features_ |= features; + main_frame_features_.PutAll(features); } else if (rfh->GetLastCommittedOrigin().IsSameOriginWith( main_frame_origin)) { - same_origin_frames_features_ |= features; + same_origin_frames_features_.PutAll(features); } else { - cross_origin_frames_features_ |= features; + cross_origin_frames_features_.PutAll(features); } for (size_t i = 0; i < rfh->child_count(); ++i) { @@ -316,7 +320,7 @@ // This should not happen, but record this as an 'unknown' reason just in // case. - if (page_store_result_->not_stored_reasons().none() && + if (page_store_result_->not_stored_reasons().Empty() && !navigation->IsServedFromBackForwardCache()) { page_store_result_->No(NotRestoredReason::kUnknown); // TODO(altimin): Add a (D)CHECK here, but this code is reached in @@ -355,11 +359,8 @@ UMA_HISTOGRAM_ENUMERATION( "BackForwardCache.AllSites.HistoryNavigationOutcome", outcome); - for (size_t i = 0; i <= static_cast<int>(NotRestoredReason::kMaxValue); i++) { - if (!page_store_result_->not_stored_reasons().test(i)) - continue; + for (NotRestoredReason reason : page_store_result_->not_stored_reasons()) { DCHECK(!navigation->IsServedFromBackForwardCache()); - NotRestoredReason reason = static_cast<NotRestoredReason>(i); if (back_forward_cache_allowed) { UMA_HISTOGRAM_ENUMERATION( "BackForwardCache.HistoryNavigationOutcome.NotRestoredReason", @@ -379,24 +380,17 @@ } } - for (int i = 0; - i <= static_cast<int>( - blink::scheduler::WebSchedulerTrackedFeature::kMaxValue); - i++) { - blink::scheduler::WebSchedulerTrackedFeature feature = - static_cast<blink::scheduler::WebSchedulerTrackedFeature>(i); - if (page_store_result_->blocklisted_features() & - blink::scheduler::FeatureToBit(feature)) { - if (back_forward_cache_allowed) { - UMA_HISTOGRAM_ENUMERATION( - "BackForwardCache.HistoryNavigationOutcome.BlocklistedFeature", - feature); - } + for (blink::scheduler::WebSchedulerTrackedFeature feature : + page_store_result_->blocklisted_features()) { + if (back_forward_cache_allowed) { UMA_HISTOGRAM_ENUMERATION( - "BackForwardCache.AllSites.HistoryNavigationOutcome." - "BlocklistedFeature", + "BackForwardCache.HistoryNavigationOutcome.BlocklistedFeature", feature); } + UMA_HISTOGRAM_ENUMERATION( + "BackForwardCache.AllSites.HistoryNavigationOutcome." + "BlocklistedFeature", + feature); } for (const BackForwardCache::DisabledReason& reason :
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.h b/content/browser/renderer_host/back_forward_cache_metrics.h index a23ac3b..5ed7c13 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.h +++ b/content/browser/renderer_host/back_forward_cache_metrics.h
@@ -17,6 +17,7 @@ #include "content/common/content_export.h" #include "content/public/browser/back_forward_cache.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" namespace url { class Origin; @@ -41,6 +42,7 @@ // Please keep in sync with BackForwardCacheNotRestoredReason in // tools/metrics/histograms/enums.xml. These values should not be renumbered. enum class NotRestoredReason : uint8_t { + kMinValue = 0, kNotMainFrame = 0, // BackForwardCache is disabled due to low memory device, base::Feature or // command line. Note that the more specific NotRestoredReasons @@ -259,15 +261,15 @@ // Should not be confused with NavigationEntryId. int64_t last_committed_cross_document_main_frame_navigation_id_ = -1; - uint64_t main_frame_features_ = 0; + blink::scheduler::WebSchedulerTrackedFeatures main_frame_features_; // We record metrics for same-origin frames and cross-origin frames // differently as we might want to apply different policies for them, // especially for the things around web platform compatibility (e.g. ignore // unload handlers in cross-origin iframes but not in same-origin). The // details are still subject to metrics, however. NOTE: This is not related to // which process these frames are hosted in. - uint64_t same_origin_frames_features_ = 0; - uint64_t cross_origin_frames_features_ = 0; + blink::scheduler::WebSchedulerTrackedFeatures same_origin_frames_features_; + blink::scheduler::WebSchedulerTrackedFeatures cross_origin_frames_features_; absl::optional<base::TimeTicks> started_navigation_timestamp_; absl::optional<base::TimeTicks> navigated_away_from_main_document_timestamp_;
diff --git a/content/browser/renderer_host/back_forward_cache_metrics_browsertest.cc b/content/browser/renderer_host/back_forward_cache_metrics_browsertest.cc index b3e60af..0905270 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics_browsertest.cc +++ b/content/browser/renderer_host/back_forward_cache_metrics_browsertest.cc
@@ -38,10 +38,6 @@ namespace { -constexpr uint64_t kRequestedGeolocationPermissionFeature = - static_cast<uint64_t>(blink::scheduler::WebSchedulerTrackedFeature:: - kRequestedGeolocationPermission); - ukm::SourceId ToSourceId(int64_t navigation_id) { return ukm::ConvertToSourceId(navigation_id, ukm::SourceIdType::NAVIGATION_ID); @@ -50,15 +46,16 @@ // Some features are present in almost all page loads (especially the ones // which are related to the document finishing loading). // We ignore them to make tests easier to read and write. -constexpr uint64_t kFeaturesToIgnoreMask = - 1ull << static_cast<size_t>( - blink::scheduler::WebSchedulerTrackedFeature::kDocumentLoaded) | - 1ull << static_cast<size_t>(blink::scheduler::WebSchedulerTrackedFeature:: - kOutstandingNetworkRequestFetch) | - 1ull << static_cast<size_t>(blink::scheduler::WebSchedulerTrackedFeature:: - kOutstandingNetworkRequestXHR) | - 1ull << static_cast<size_t>(blink::scheduler::WebSchedulerTrackedFeature:: - kOutstandingNetworkRequestOthers); + +constexpr blink::scheduler::WebSchedulerTrackedFeatures kFeaturesToIgnore = + blink::scheduler::WebSchedulerTrackedFeatures( + blink::scheduler::WebSchedulerTrackedFeature::kDocumentLoaded, + blink::scheduler::WebSchedulerTrackedFeature:: + kOutstandingNetworkRequestFetch, + blink::scheduler::WebSchedulerTrackedFeature:: + kOutstandingNetworkRequestXHR, + blink::scheduler::WebSchedulerTrackedFeature:: + kOutstandingNetworkRequestOthers); using UkmMetrics = ukm::TestUkmRecorder::HumanReadableUkmMetrics; using UkmEntry = ukm::TestUkmRecorder::HumanReadableUkmEntry; @@ -417,14 +414,14 @@ "CrossOriginSubframesFeatures"})) { FeatureUsage feature_usage; feature_usage.source_id = entry.source_id; - feature_usage.main_frame_features = - entry.metrics.at("MainFrameFeatures") & ~kFeaturesToIgnoreMask; + feature_usage.main_frame_features = entry.metrics.at("MainFrameFeatures") & + ~kFeaturesToIgnore.ToEnumBitmask(); feature_usage.same_origin_subframes_features = entry.metrics.at("SameOriginSubframesFeatures") & - ~kFeaturesToIgnoreMask; + ~kFeaturesToIgnore.ToEnumBitmask(); feature_usage.cross_origin_subframes_features = entry.metrics.at("CrossOriginSubframesFeatures") & - ~kFeaturesToIgnoreMask; + ~kFeaturesToIgnore.ToEnumBitmask(); result.push_back(feature_usage); } return result; @@ -587,13 +584,14 @@ EXPECT_TRUE(NavigateToURL(shell(), url)); - EXPECT_EQ( - static_cast<WebContentsImpl*>(shell()->web_contents()) - ->GetMainFrame() - ->scheduler_tracked_features() & - ~kFeaturesToIgnoreMask, - 1ull << static_cast<size_t>(blink::scheduler::WebSchedulerTrackedFeature:: - kDedicatedWorkerOrWorklet)); + EXPECT_EQ(base::util::Difference( + static_cast<WebContentsImpl*>(shell()->web_contents()) + ->GetMainFrame() + ->scheduler_tracked_features(), + kFeaturesToIgnore), + blink::scheduler::WebSchedulerTrackedFeatures( + blink::scheduler::WebSchedulerTrackedFeature:: + kDedicatedWorkerOrWorklet)); } // TODO(https://crbug.com/154571): Shared workers are not available on Android. @@ -608,11 +606,12 @@ EXPECT_TRUE(NavigateToURL(shell(), url)); - EXPECT_EQ(static_cast<WebContentsImpl*>(shell()->web_contents()) + EXPECT_EQ(base::util::Difference( + static_cast<WebContentsImpl*>(shell()->web_contents()) ->GetMainFrame() - ->scheduler_tracked_features() & - ~kFeaturesToIgnoreMask, - 1ull << static_cast<uint32_t>( + ->scheduler_tracked_features(), + kFeaturesToIgnore), + blink::scheduler::WebSchedulerTrackedFeatures( blink::scheduler::WebSchedulerTrackedFeature::kSharedWorker)); } @@ -629,8 +628,9 @@ resolve.bind(this, "failure")) }); )")); - EXPECT_TRUE(main_frame->scheduler_tracked_features() & - (1 << kRequestedGeolocationPermissionFeature)); + EXPECT_TRUE(main_frame->scheduler_tracked_features().Has( + blink::scheduler::WebSchedulerTrackedFeature:: + kRequestedGeolocationPermission)); } class RecordBackForwardCacheMetricsWithoutEnabling
diff --git a/content/browser/renderer_host/clipboard_host_impl.cc b/content/browser/renderer_host/clipboard_host_impl.cc index 52f54a3..cc54ad8d 100644 --- a/content/browser/renderer_host/clipboard_host_impl.cc +++ b/content/browser/renderer_host/clipboard_host_impl.cc
@@ -112,8 +112,7 @@ ClipboardHostImpl::ClipboardHostImpl( RenderFrameHost* render_frame_host, mojo::PendingReceiver<blink::mojom::ClipboardHost> receiver) - : DocumentServiceBase(render_frame_host, std::move(receiver)), - clipboard_(ui::Clipboard::GetForCurrentThread()) { + : DocumentServiceBase(render_frame_host, std::move(receiver)) { clipboard_writer_ = std::make_unique<ui::ScopedClipboardWriter>( ui::ClipboardBuffer::kCopyPaste, std::make_unique<ui::DataTransferEndpoint>( @@ -134,15 +133,17 @@ void ClipboardHostImpl::GetSequenceNumber(ui::ClipboardBuffer clipboard_buffer, GetSequenceNumberCallback callback) { - std::move(callback).Run(clipboard_->GetSequenceNumber(clipboard_buffer)); + std::move(callback).Run( + ui::Clipboard::GetForCurrentThread()->GetSequenceNumber( + clipboard_buffer)); } void ClipboardHostImpl::ReadAvailableTypes( ui::ClipboardBuffer clipboard_buffer, ReadAvailableTypesCallback callback) { std::vector<std::u16string> types; - clipboard_->ReadAvailableTypes(clipboard_buffer, CreateDataEndpoint().get(), - &types); + ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( + clipboard_buffer, CreateDataEndpoint().get(), &types); // If files are available, do not include other types such as text/plain // which contain the full path on some platforms (http://crbug.com/1214108). std::u16string filenames_type = base::UTF8ToUTF16(ui::kMimeTypeURIList); @@ -155,42 +156,43 @@ void ClipboardHostImpl::IsFormatAvailable(blink::mojom::ClipboardFormat format, ui::ClipboardBuffer clipboard_buffer, IsFormatAvailableCallback callback) { + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); bool result = false; auto data_endpoint = CreateDataEndpoint(); switch (format) { case blink::mojom::ClipboardFormat::kPlaintext: - result = clipboard_->IsFormatAvailable( + result = clipboard->IsFormatAvailable( ui::ClipboardFormatType::GetPlainTextType(), clipboard_buffer, data_endpoint.get()); #if defined(OS_WIN) - result |= clipboard_->IsFormatAvailable( + result |= clipboard->IsFormatAvailable( ui::ClipboardFormatType::GetPlainTextAType(), clipboard_buffer, data_endpoint.get()); #endif break; case blink::mojom::ClipboardFormat::kHtml: result = - clipboard_->IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), - clipboard_buffer, data_endpoint.get()); + clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), + clipboard_buffer, data_endpoint.get()); break; case blink::mojom::ClipboardFormat::kSmartPaste: - result = clipboard_->IsFormatAvailable( + result = clipboard->IsFormatAvailable( ui::ClipboardFormatType::GetWebKitSmartPasteType(), clipboard_buffer, data_endpoint.get()); break; case blink::mojom::ClipboardFormat::kBookmark: #if defined(OS_WIN) || defined(OS_MAC) result = - clipboard_->IsFormatAvailable(ui::ClipboardFormatType::GetUrlType(), - clipboard_buffer, data_endpoint.get()); + clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetUrlType(), + clipboard_buffer, data_endpoint.get()); #else result = false; #endif break; case blink::mojom::ClipboardFormat::kRtf: result = - clipboard_->IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), - clipboard_buffer, data_endpoint.get()); + clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), + clipboard_buffer, data_endpoint.get()); break; } std::move(callback).Run(result); @@ -202,18 +204,19 @@ std::move(callback).Run(std::u16string()); return; } + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string result; auto data_dst = CreateDataEndpoint(); - if (clipboard_->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), - clipboard_buffer, data_dst.get())) { - clipboard_->ReadText(clipboard_buffer, data_dst.get(), &result); + if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), + clipboard_buffer, data_dst.get())) { + clipboard->ReadText(clipboard_buffer, data_dst.get(), &result); } else { #if defined(OS_WIN) - if (clipboard_->IsFormatAvailable( + if (clipboard->IsFormatAvailable( ui::ClipboardFormatType::GetPlainTextAType(), clipboard_buffer, data_dst.get())) { std::string ascii; - clipboard_->ReadAsciiText(clipboard_buffer, data_dst.get(), &ascii); + clipboard->ReadAsciiText(clipboard_buffer, data_dst.get(), &ascii); result = base::ASCIIToUTF16(ascii); } #endif @@ -239,13 +242,14 @@ std::move(callback).Run(std::u16string(), GURL(), 0, 0); return; } + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string markup; std::string src_url_str; uint32_t fragment_start = 0; uint32_t fragment_end = 0; auto data_dst = CreateDataEndpoint(); - clipboard_->ReadHTML(clipboard_buffer, data_dst.get(), &markup, &src_url_str, - &fragment_start, &fragment_end); + clipboard->ReadHTML(clipboard_buffer, data_dst.get(), &markup, &src_url_str, + &fragment_start, &fragment_end); std::string data = base::UTF16ToUTF8(markup); PasteIfPolicyAllowed( @@ -270,7 +274,8 @@ return; } std::u16string markup; - clipboard_->ReadSvg(clipboard_buffer, /*data_dst=*/nullptr, &markup); + ui::Clipboard::GetForCurrentThread()->ReadSvg(clipboard_buffer, + /*data_dst=*/nullptr, &markup); std::string data = base::UTF16ToUTF8(markup); PasteIfPolicyAllowed(clipboard_buffer, ui::ClipboardFormatType::GetSvgType(), @@ -293,7 +298,8 @@ } std::string result; auto data_dst = CreateDataEndpoint(); - clipboard_->ReadRTF(clipboard_buffer, data_dst.get(), &result); + ui::Clipboard::GetForCurrentThread()->ReadRTF(clipboard_buffer, + data_dst.get(), &result); std::string data = result; PasteIfPolicyAllowed(clipboard_buffer, ui::ClipboardFormatType::GetRtfType(), @@ -315,10 +321,11 @@ return; } auto data_dst = CreateDataEndpoint(); - clipboard_->ReadPng(clipboard_buffer, data_dst.get(), - base::BindOnce(&ClipboardHostImpl::OnReadPng, - weak_ptr_factory_.GetWeakPtr(), - clipboard_buffer, std::move(callback))); + ui::Clipboard::GetForCurrentThread()->ReadPng( + clipboard_buffer, data_dst.get(), + base::BindOnce(&ClipboardHostImpl::OnReadPng, + weak_ptr_factory_.GetWeakPtr(), clipboard_buffer, + std::move(callback))); } void ClipboardHostImpl::OnReadPng(ui::ClipboardBuffer clipboard_buffer, @@ -346,10 +353,11 @@ return; } auto data_dst = CreateDataEndpoint(); - clipboard_->ReadImage(clipboard_buffer, data_dst.get(), - base::BindOnce(&ClipboardHostImpl::OnReadImage, - weak_ptr_factory_.GetWeakPtr(), - clipboard_buffer, std::move(callback))); + ui::Clipboard::GetForCurrentThread()->ReadImage( + clipboard_buffer, data_dst.get(), + base::BindOnce(&ClipboardHostImpl::OnReadImage, + weak_ptr_factory_.GetWeakPtr(), clipboard_buffer, + std::move(callback))); } void ClipboardHostImpl::OnReadImage(ui::ClipboardBuffer clipboard_buffer, @@ -379,9 +387,10 @@ return; } + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::vector<ui::FileInfo> filenames; auto data_dst = CreateDataEndpoint(); - clipboard_->ReadFilenames(clipboard_buffer, data_dst.get(), &filenames); + clipboard->ReadFilenames(clipboard_buffer, data_dst.get(), &filenames); std::string data = ui::FileInfosToURIList(filenames); // This code matches the drag-and-drop DataTransfer code in @@ -404,7 +413,7 @@ std::move(files.begin(), files.end(), std::back_inserter(result->files)); PerformPasteIfContentAllowed( - clipboard_->GetSequenceNumber(clipboard_buffer), + clipboard->GetSequenceNumber(clipboard_buffer), ui::ClipboardFormatType::GetFilenamesType(), std::move(data), base::BindOnce( [](blink::mojom::ClipboardFilesPtr result, ReadFilesCallback callback, @@ -427,7 +436,8 @@ } std::u16string result; auto data_dst = CreateDataEndpoint(); - clipboard_->ReadCustomData(clipboard_buffer, type, data_dst.get(), &result); + ui::Clipboard::GetForCurrentThread()->ReadCustomData(clipboard_buffer, type, + data_dst.get(), &result); std::string data = base::UTF16ToUTF8(result); PasteIfPolicyAllowed( @@ -504,8 +514,8 @@ web_contents = delegate ? delegate->GetAsWebContents() : nullptr; ui::DataTransferPolicyController::Get()->PasteIfAllowed( - clipboard_->GetSource(clipboard_buffer), CreateDataEndpoint().get(), - web_contents, std::move(policy_cb)); + ui::Clipboard::GetForCurrentThread()->GetSource(clipboard_buffer), + CreateDataEndpoint().get(), web_contents, std::move(policy_cb)); return; } std::move(policy_cb).Run(/*is_allowed=*/true); @@ -519,8 +529,9 @@ bool is_allowed) { if (is_allowed) { PerformPasteIfContentAllowed( - clipboard_->GetSequenceNumber(clipboard_buffer), data_type, - std::move(data), std::move(callback)); + ui::Clipboard::GetForCurrentThread()->GetSequenceNumber( + clipboard_buffer), + data_type, std::move(data), std::move(callback)); } else { // If not allowed, then don't proceed with content checks. std::move(callback).Run(ClipboardPasteContentAllowed(false));
diff --git a/content/browser/renderer_host/clipboard_host_impl.h b/content/browser/renderer_host/clipboard_host_impl.h index 7644f36..da2a301 100644 --- a/content/browser/renderer_host/clipboard_host_impl.h +++ b/content/browser/renderer_host/clipboard_host_impl.h
@@ -214,7 +214,6 @@ std::unique_ptr<ui::DataTransferEndpoint> CreateDataEndpoint(); - ui::Clipboard* const clipboard_; // Not owned std::unique_ptr<ui::ScopedClipboardWriter> clipboard_writer_; // Outstanding is allowed requests per clipboard contents. Maps a clipboard
diff --git a/content/browser/renderer_host/clipboard_host_impl_unittest.cc b/content/browser/renderer_host/clipboard_host_impl_unittest.cc index a134480a3..98bee02 100644 --- a/content/browser/renderer_host/clipboard_host_impl_unittest.cc +++ b/content/browser/renderer_host/clipboard_host_impl_unittest.cc
@@ -106,10 +106,17 @@ return remote_; } + // Re-creates the system clipboard and returns the previous clipboard. + std::unique_ptr<ui::Clipboard> DeleteAndRecreateClipboard() { + auto original_clipboard = ui::Clipboard::TakeForCurrentThread(); + clipboard_ = ui::TestClipboard::CreateForCurrentThread(); + return original_clipboard; + } + ui::Clipboard* system_clipboard() { return clipboard_; } private: - ui::Clipboard* const clipboard_; + ui::Clipboard* clipboard_; mojo::Remote<blink::mojom::ClipboardHost> remote_; }; @@ -166,6 +173,18 @@ EXPECT_TRUE(gfx::BitmapsAreEqual(bitmap, actual)); } +TEST_F(ClipboardHostImplTest, DoesNotCacheClipboard) { + uint64_t unused_sequence_number; + mojo_clipboard()->GetSequenceNumber(ui::ClipboardBuffer::kCopyPaste, + &unused_sequence_number); + + DeleteAndRecreateClipboard(); + + // This shouldn't crash after the original ui::Clipboard is gone. + mojo_clipboard()->GetSequenceNumber(ui::ClipboardBuffer::kCopyPaste, + &unused_sequence_number); +} + TEST_F(ClipboardHostImplTest, IsPasteContentAllowedRequest_AddCallback) { ClipboardHostImpl::IsPasteContentAllowedRequest request; int count = 0;
diff --git a/content/browser/renderer_host/navigation_controller_delegate.h b/content/browser/renderer_host/navigation_controller_delegate.h index 8fdeb7f..b36db342 100644 --- a/content/browser/renderer_host/navigation_controller_delegate.h +++ b/content/browser/renderer_host/navigation_controller_delegate.h
@@ -28,7 +28,8 @@ virtual bool IsBeingDestroyed() = 0; // Methods from WebContentsImpl that NavigationControllerImpl needs to - // call. + // call. NavigationControllerImpl cannot call them directly because + // renderer_host/ cannot depend on WebContents. virtual void NotifyBeforeFormRepostWarningShow() = 0; virtual void NotifyNavigationEntryCommitted( const LoadCommittedDetails& load_details) = 0; @@ -43,9 +44,9 @@ // preserved in the omnibox. Defaults to false. virtual bool ShouldPreserveAbortedURLs() = 0; - // This method is needed, since we are no longer guaranteed that the - // embedder for NavigationController will be a WebContents object. - virtual WebContents* GetWebContents() = 0; + // TODO(crbug.com/1225205): Remove this. It is a layering violation as + // renderer_host/ cannot depend on WebContents. + virtual WebContents* DeprecatedGetWebContents() = 0; virtual void UpdateOverridingUserAgent() = 0; };
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index c01c6ae..185b535 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -638,8 +638,8 @@ DiscardNonCommittedEntries(); } -WebContents* NavigationControllerImpl::GetWebContents() { - return delegate_->GetWebContents(); +WebContents* NavigationControllerImpl::DeprecatedGetWebContents() { + return delegate_->DeprecatedGetWebContents(); } BrowserContext* NavigationControllerImpl::GetBrowserContext() {
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h index 5ae6d97..31f1771 100644 --- a/content/browser/renderer_host/navigation_controller_impl.h +++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -86,7 +86,7 @@ ~NavigationControllerImpl() override; // NavigationController implementation: - WebContents* GetWebContents() override; + WebContents* DeprecatedGetWebContents() override; BrowserContext* GetBrowserContext() override; void Restore(int selected_navigation, RestoreType type,
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc index 85cb96f..8d6b4fb 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
@@ -2947,7 +2947,8 @@ controller.GetVisibleEntry()->SetTitle(title); NavigateAndCommit(url2); - std::unique_ptr<WebContents> clone(controller.GetWebContents()->Clone()); + std::unique_ptr<WebContents> clone( + RenderViewHostTestHarness::web_contents()->Clone()); ASSERT_EQ(2, clone->GetController().GetEntryCount()); EXPECT_TRUE(clone->GetController().NeedsReload()); @@ -2972,7 +2973,8 @@ controller.GetVisibleEntry()->SetTitle(title); NavigateAndCommit(url2); - std::unique_ptr<WebContents> clone(controller.GetWebContents()->Clone()); + std::unique_ptr<WebContents> clone( + RenderViewHostTestHarness::web_contents()->Clone()); clone->GetController().LoadIfNecessary(); ASSERT_EQ(2, clone->GetController().GetEntryCount()); @@ -3872,7 +3874,8 @@ // For cloned tabs, IsInitialNavigationShould be true but // IsInitialBlankNavigation should be false. - std::unique_ptr<WebContents> clone(controller.GetWebContents()->Clone()); + std::unique_ptr<WebContents> clone( + RenderViewHostTestHarness::web_contents()->Clone()); EXPECT_TRUE(clone->GetController().IsInitialNavigation()); EXPECT_FALSE(clone->GetController().IsInitialBlankNavigation()); } @@ -4396,14 +4399,14 @@ // Make sure that cloning a WebContentsImpl and clearing forward entries // before the first commit doesn't clear all entries. TEST_F(NavigationControllerTest, PruneForwardEntriesAfterClone) { - NavigationControllerImpl& controller = controller_impl(); const GURL url1("http://foo1"); const GURL url2("http://foo2"); NavigateAndCommit(url1); NavigateAndCommit(url2); - std::unique_ptr<WebContents> clone(controller.GetWebContents()->Clone()); + std::unique_ptr<WebContents> clone( + RenderViewHostTestHarness::web_contents()->Clone()); clone->GetController().LoadIfNecessary(); // Set a WebContentsDelegate to listen for state changes after the clone call
diff --git a/content/browser/renderer_host/raw_clipboard_host_impl.cc b/content/browser/renderer_host/raw_clipboard_host_impl.cc index e249dfb..4a01c577 100644 --- a/content/browser/renderer_host/raw_clipboard_host_impl.cc +++ b/content/browser/renderer_host/raw_clipboard_host_impl.cc
@@ -78,7 +78,6 @@ : render_frame_routing_id_( GlobalRenderFrameHostId(render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID())), - clipboard_(ui::Clipboard::GetForCurrentThread()), clipboard_writer_( new ui::ScopedClipboardWriter(ui::ClipboardBuffer::kCopyPaste, CreateDataEndpoint())) { @@ -90,8 +89,9 @@ if (!HasTransientUserActivation()) return; std::vector<std::u16string> raw_types = - clipboard_->ReadAvailablePlatformSpecificFormatNames( - ui::ClipboardBuffer::kCopyPaste, CreateDataEndpoint().get()); + ui::Clipboard::GetForCurrentThread() + ->ReadAvailablePlatformSpecificFormatNames( + ui::ClipboardBuffer::kCopyPaste, CreateDataEndpoint().get()); std::move(callback).Run(raw_types); } @@ -105,7 +105,7 @@ } std::string result; - clipboard_->ReadData( + ui::Clipboard::GetForCurrentThread()->ReadData( ui::ClipboardFormatType::GetType(base::UTF16ToUTF8(format)), CreateDataEndpoint().get(), &result); base::span<const uint8_t> span(
diff --git a/content/browser/renderer_host/raw_clipboard_host_impl.h b/content/browser/renderer_host/raw_clipboard_host_impl.h index 0acb2b3..c3723ce 100644 --- a/content/browser/renderer_host/raw_clipboard_host_impl.h +++ b/content/browser/renderer_host/raw_clipboard_host_impl.h
@@ -48,10 +48,9 @@ // The render frame is not owned. const GlobalRenderFrameHostId render_frame_routing_id_; - ui::Clipboard* const clipboard_; // Not owned. std::unique_ptr<ui::ScopedClipboardWriter> clipboard_writer_; }; } // namespace content -#endif // CONTENT_BROWSER_RENDERER_HOST_RAW_CLIPBOARD_HOST_IMPL_H_ \ No newline at end of file +#endif // CONTENT_BROWSER_RENDERER_HOST_RAW_CLIPBOARD_HOST_IMPL_H_
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index ec108a1..a121b26c 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -248,6 +248,7 @@ #include "third_party/blink/public/common/permissions_policy/document_policy.h" #include "third_party/blink/public/common/permissions_policy/document_policy_features.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy.h" +#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" #include "third_party/blink/public/common/storage_key/storage_key.h" #include "third_party/blink/public/mojom/appcache/appcache.mojom.h" #include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h" @@ -811,7 +812,7 @@ case LifecycleStateImpl::kRunningUnloadHandlers: return "RunningUnloadHandlers"; case LifecycleStateImpl::kReadyToBeDeleted: - return "ReadyToDeleted"; + return "ReadyToBeDeleted"; } } @@ -2865,7 +2866,13 @@ if (IsPendingDeletion()) { // If the process has died, we don't need to wait for the ACK. Complete the // deletion immediately. - SetLifecycleState(LifecycleStateImpl::kReadyToBeDeleted); + // Note that it is possible for a frame to already be in kReadyToBeDeleted. + // This happens when this RenderFrameHost is pending deletion and is + // waiting on one of its children to run its unload handler. While running + // it, it can request its parent to detach itself. + if (lifecycle_state() != LifecycleStateImpl::kReadyToBeDeleted) { + SetLifecycleState(LifecycleStateImpl::kReadyToBeDeleted); + } DCHECK(children_.empty()); PendingDeletionCheckCompleted(); // |this| is deleted. Don't add any more code at this point in the function. @@ -3902,15 +3909,16 @@ void RenderFrameHostImpl::DidChangeActiveSchedulerTrackedFeatures( uint64_t features_mask) { - renderer_reported_scheduler_tracked_features_ = features_mask; + renderer_reported_scheduler_tracked_features_ = + blink::scheduler::WebSchedulerTrackedFeatures::FromEnumBitmask( + features_mask); MaybeEvictFromBackForwardCache(); } void RenderFrameHostImpl::OnSchedulerTrackedFeatureUsed( blink::scheduler::WebSchedulerTrackedFeature feature) { - browser_reported_scheduler_tracked_features_ |= - 1ull << static_cast<uint64_t>(feature); + browser_reported_scheduler_tracked_features_.Put(feature); MaybeEvictFromBackForwardCache(); } @@ -5534,7 +5542,7 @@ // https://crrev.com/c/2563674. Lets keep this old code for now just in case // and replace with a CHECK once we are confident that is the case. SCOPED_CRASH_KEY_NUMBER("BFCache", "EvictAfterRestoreReasons", - can_store.not_stored_reasons().to_ullong()); + can_store.not_stored_reasons().ToEnumBitmask()); base::debug::DumpWithoutCrashing(); BackForwardCacheMetrics::RecordEvictedAfterDocumentRestored( BackForwardCacheMetrics::EvictedAfterDocumentRestoredReason:: @@ -10063,8 +10071,8 @@ DCHECK(params.embedding_token.has_value()); SetEmbeddingToken(params.embedding_token.value()); - renderer_reported_scheduler_tracked_features_ = 0; - browser_reported_scheduler_tracked_features_ = 0; + renderer_reported_scheduler_tracked_features_.Clear(); + browser_reported_scheduler_tracked_features_.Clear(); // TODO(https://crbug.com/888079): The origin computed from the browser must // match the one reported from the renderer process.
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index ea0a624..82bcb99 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -1524,9 +1524,10 @@ // Scheduler-relevant features this frame is using, for use in metrics. // See comments at |scheduler_tracked_features_|. - uint64_t scheduler_tracked_features() const { - return renderer_reported_scheduler_tracked_features_ | - browser_reported_scheduler_tracked_features_; + blink::scheduler::WebSchedulerTrackedFeatures scheduler_tracked_features() + const { + return Union(renderer_reported_scheduler_tracked_features_, + browser_reported_scheduler_tracked_features_); } // Returns a PrefetchedSignedExchangeCache which is attached to |this| iff @@ -2285,7 +2286,6 @@ // The SendCommit* functions below are wrappers for commit calls // made to mojom::NavigationClient. // These exist to be overridden in tests to retain mojo callbacks. - // Note: |navigation_id| is used in test overrides, but is unused otherwise. virtual void SendCommitNavigation( mojom::NavigationClient* navigation_client, NavigationRequest* navigation_request, @@ -3662,8 +3662,10 @@ // some in the browser process, depending on the design of each individual // feature. They are tracked separately, because when the renderer updates the // set of features, the browser ones should persist. - uint64_t renderer_reported_scheduler_tracked_features_ = 0; - uint64_t browser_reported_scheduler_tracked_features_ = 0; + blink::scheduler::WebSchedulerTrackedFeatures + renderer_reported_scheduler_tracked_features_; + blink::scheduler::WebSchedulerTrackedFeatures + browser_reported_scheduler_tracked_features_; // Holds prefetched signed exchanges for SignedExchangeSubresourcePrefetch. // They will be passed to the next navigation.
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index f4874e24..445f0e3 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -3064,16 +3064,16 @@ // Simulate getting 0b1 as a feature vector from the renderer. static_cast<blink::mojom::LocalFrameHost*>(main_frame) ->DidChangeActiveSchedulerTrackedFeatures(0b1u); - DCHECK_EQ(main_frame->scheduler_tracked_features(), 0b1u); + DCHECK_EQ(main_frame->scheduler_tracked_features().ToEnumBitmask(), 0b1u); // Simulate the browser side reporting a feature usage. main_frame->OnSchedulerTrackedFeatureUsed( static_cast<blink::scheduler::WebSchedulerTrackedFeature>(1)); - DCHECK_EQ(main_frame->scheduler_tracked_features(), 0b11u); + DCHECK_EQ(main_frame->scheduler_tracked_features().ToEnumBitmask(), 0b11u); // Simulate a feature vector being updated from the renderer with some // features being activated and some being deactivated. static_cast<blink::mojom::LocalFrameHost*>(main_frame) ->DidChangeActiveSchedulerTrackedFeatures(0b100u); - DCHECK_EQ(main_frame->scheduler_tracked_features(), 0b110u); + DCHECK_EQ(main_frame->scheduler_tracked_features().ToEnumBitmask(), 0b110u); // Navigate away and expect that no values persist the navigation. // Note that we are still simulating the renderer call, otherwise features
diff --git a/content/browser/renderer_host/render_frame_proxy_host.cc b/content/browser/renderer_host/render_frame_proxy_host.cc index 725b81f..e1b1ab0e 100644 --- a/content/browser/renderer_host/render_frame_proxy_host.cc +++ b/content/browser/renderer_host/render_frame_proxy_host.cc
@@ -683,8 +683,8 @@ // renderer side, e.g. status not available on remote frame, etc. blink::NavigationDownloadPolicy download_policy = params->download_policy; GetContentClient()->browser()->AugmentNavigationDownloadPolicy( - frame_tree_node_->navigator().controller().GetWebContents(), current_rfh, - params->user_gesture, &download_policy); + frame_tree_node_->navigator().controller().DeprecatedGetWebContents(), + current_rfh, params->user_gesture, &download_policy); if ((frame_tree_node_->pending_frame_policy().sandbox_flags & network::mojom::WebSandboxFlags::kDownloads) !=
diff --git a/content/browser/renderer_host/render_widget_host_view_event_handler.cc b/content/browser/renderer_host/render_widget_host_view_event_handler.cc index 7337fd8..9043a18 100644 --- a/content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ b/content/browser/renderer_host/render_widget_host_view_event_handler.cc
@@ -327,7 +327,7 @@ // breaks drop-down lists which means something is incorrectly setting // event->handled to true (http://crbug.com/577983). - if (mouse_locked_) { + if (mouse_locked_ && !window_->GetHost()->SupportsMouseLock()) { HandleMouseEventWhileLocked(event); return; } @@ -808,6 +808,8 @@ void RenderWidgetHostViewEventHandler::MoveCursorToCenter( ui::MouseEvent* event) { + DCHECK(!window_->GetHost()->SupportsMouseLock()); + gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); gfx::Point center_in_screen(window_->GetBoundsInScreen().CenterPoint()); window_->MoveCursorTo(center); @@ -877,6 +879,9 @@ return false; #endif + if (window_->GetHost()->SupportsMouseLock()) + return false; + gfx::Rect rect = window_->bounds(); rect = delegate_->ConvertRectToScreen(rect); float border_x = rect.width() * kMouseLockBorderPercentage / 100.0;
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc index 10521cf..82597983 100644 --- a/content/browser/service_worker/service_worker_register_job.cc +++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -16,6 +16,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "content/browser/devtools/devtools_instrumentation.h" +#include "content/browser/devtools/devtools_throttle_handle.h" #include "content/browser/devtools/service_worker_devtools_manager.h" #include "content/browser/service_worker/embedded_worker_instance.h" #include "content/browser/service_worker/embedded_worker_status.h" @@ -445,21 +446,30 @@ UpdateAndContinue(); } -void ServiceWorkerRegisterJob::StartScriptFetchForNewWorker( - scoped_refptr<ServiceWorkerVersion> version) { +void ServiceWorkerRegisterJob:: + MaybeThrottleForDevToolsBeforeStartingScriptFetch( + scoped_refptr<ServiceWorkerVersion> version) { DCHECK(base::FeatureList::IsEnabled(features::kPlzServiceWorker)); - DCHECK(!new_script_fetcher_); + + int64_t version_id = version->version_id(); + const GURL& script_url = version->script_url(); + const GURL& scope = version->scope(); + auto devtools_throttle_handle = base::MakeRefCounted<DevToolsThrottleHandle>( + base::BindOnce(&ServiceWorkerRegisterJob::StartScriptFetchForNewWorker, + weak_factory_.GetWeakPtr(), std::move(version))); // We are about to start fetching from the browser process and we want // devtools to be able to instrument the URLLoaderFactory. This call will // create a DevtoolsAgentHost. - // TODO(https://crbug.com/1211358): To give the opportunity to devtools target - // handlers to attach before starting the fetch, we should pass in a boolean - // pointer indicating if we should pause the fetch and act on it in the - // ServiceWorkerNewScriptFetcher. ServiceWorkerDevToolsManager::GetInstance()->WorkerMainScriptFetchingStarting( - context_->wrapper(), version->version_id(), version->script_url(), - version->scope()); + context_->wrapper(), version_id, script_url, scope, requesting_frame_id_, + std::move(devtools_throttle_handle)); +} + +void ServiceWorkerRegisterJob::StartScriptFetchForNewWorker( + scoped_refptr<ServiceWorkerVersion> version) { + DCHECK(base::FeatureList::IsEnabled(features::kPlzServiceWorker)); + DCHECK(!new_script_fetcher_); scoped_refptr<network::SharedURLLoaderFactory> loader_factory = context_->wrapper()->GetLoaderFactoryForMainScriptFetch( @@ -557,9 +567,10 @@ context_->registry()->NotifyInstallingRegistration(registration()); base::OnceCallback<void(scoped_refptr<ServiceWorkerVersion>)> next_task; if (base::FeatureList::IsEnabled(features::kPlzServiceWorker)) { - next_task = base::BindOnce( - &ServiceWorkerRegisterJob::StartScriptFetchForNewWorker, - weak_factory_.GetWeakPtr()); + next_task = + base::BindOnce(&ServiceWorkerRegisterJob:: + MaybeThrottleForDevToolsBeforeStartingScriptFetch, + weak_factory_.GetWeakPtr()); } else { next_task = base::BindOnce(&ServiceWorkerRegisterJob::StartWorkerForUpdate,
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h index d5b7a23..8ae4492 100644 --- a/content/browser/service_worker/service_worker_register_job.h +++ b/content/browser/service_worker/service_worker_register_job.h
@@ -139,10 +139,21 @@ blink::ServiceWorkerStatusCode status); void UpdateAndContinue(); - // PlzServiceWorker: - // Starts script loading before starting the worker. This is called only when - // the job type is REGISTRATION_JOB and the worker doesn't need an - // byte-for-byte check. + // With PlzServiceWorker, we start fetching the script before starting the + // worker. The 3 functions below represent the expected order of execution + // in this process: + // - Devtools might decide it wants to auto-attach to new targets and to start + // intercepting messages before the fetch starts. If so it needs to start + // some handlers asynchronously. We pass down to the handlers a "throttle" + // that can resume script fetching via a callback when ready. + // - We create a factory and a pass it to a ServiceWorkerNewScriptFetcher. + // Once the script fetch succeeded (or failed), it calls into the final + // step. + // - We inspect the response, determine if its a failure or not and update + // state. If successful we start the worker with load parameters returned by + // the ServiceWorkerNewScriptFetcher. + void MaybeThrottleForDevToolsBeforeStartingScriptFetch( + scoped_refptr<ServiceWorkerVersion> version); void StartScriptFetchForNewWorker( scoped_refptr<ServiceWorkerVersion> version); void OnScriptFetchCompleted(
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 442ed38c..2f8ef0bc 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc
@@ -335,7 +335,7 @@ // any previous decisions that have occurred. if (!ssl_host_state_delegate_ || !ssl_host_state_delegate_->HasAllowException( - url.host(), controller_->GetWebContents())) { + url.host(), controller_->DeprecatedGetWebContents())) { return; } @@ -432,7 +432,7 @@ void SSLManager::NotifyDidChangeVisibleSSLState() { WebContentsImpl* contents = - static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); + static_cast<WebContentsImpl*>(controller_->DeprecatedGetWebContents()); contents->DidChangeVisibleSecurityState(); }
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 8eb069f..728b41d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2899,7 +2899,7 @@ return tc; } -WebContents* WebContentsImpl::GetWebContents() { +WebContents* WebContentsImpl::DeprecatedGetWebContents() { return this; } @@ -4466,7 +4466,7 @@ // multiple frame trees (e.g. prerendering) so it's not enough to check // against this->frame_tree_. FrameTree* frame_tree = frame_tree_node->frame_tree(); - CHECK_EQ(frame_tree->controller().GetWebContents(), this); + CHECK_EQ(frame_tree->controller().DeprecatedGetWebContents(), this); if (blink::features::IsPrerender2Enabled()) { // Prerendering is generally hidden from embedders. If the navigation is
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 46f7b55..8ef07be 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -1019,7 +1019,7 @@ // NavigationControllerDelegate ---------------------------------------------- - WebContents* GetWebContents() override; + WebContents* DeprecatedGetWebContents() override; void NotifyNavigationEntryCommitted( const LoadCommittedDetails& load_details) override; void NotifyNavigationEntryChanged(
diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h index 654de6e6..469f93d 100644 --- a/content/public/browser/navigation_controller.h +++ b/content/public/browser/navigation_controller.h
@@ -298,7 +298,10 @@ // Returns the web contents associated with this controller. It can never be // nullptr. - virtual WebContents* GetWebContents() = 0; + // + // TODO(crbug.com/1225205): Remove this. It is a layering violation as it is + // implemented in renderer_host/ which cannot depend on WebContents. + virtual WebContents* DeprecatedGetWebContents() = 0; // Get the browser context for this controller. It can never be nullptr. virtual BrowserContext* GetBrowserContext() = 0;
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index d078124c..21b68894 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc
@@ -80,8 +80,8 @@ // (rather than WebContentsImpl directly). It is not trivial to make // that change, so for now we have this extra function for // non-TestWebContents. - auto navigation = - NavigationSimulator::CreateFromPending(controller->GetWebContents()); + auto navigation = NavigationSimulator::CreateFromPending( + controller->DeprecatedGetWebContents()); navigation->Commit(); }
diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc index 326ffab..467e79a2 100644 --- a/courgette/adjustment_method_2.cc +++ b/courgette/adjustment_method_2.cc
@@ -378,6 +378,12 @@ typedef std::set<Shingle, InterningLess> OwningSet; + // We can't disallow the copy constructor because we use std::set<Shingle> and + // VS2005's implementation of std::set<T>::set() requires T to have a copy + // constructor. + Shingle(const Shingle&) = default; + Shingle& operator=(const Shingle&) = delete; // Disallow assignment only. + static Shingle* Find(const Trace& trace, size_t position, OwningSet* owning_set) { std::pair<OwningSet::iterator, bool> pair = @@ -424,12 +430,6 @@ ShinglePattern* pattern_; // Pattern changes as LabelInfos are assigned. friend std::string ToString(const Shingle* instance); - - // We can't disallow the copy constructor because we use std::set<Shingle> and - // VS2005's implementation of std::set<T>::set() requires T to have a copy - // constructor. - // DISALLOW_COPY_AND_ASSIGN(Shingle); - void operator=(const Shingle&) = delete; // Disallow assignment only. }; std::string ToString(const Shingle* instance) {
diff --git a/docs/useful_urls.md b/docs/useful_urls.md index 56d2ae8d..f9b93a89 100644 --- a/docs/useful_urls.md +++ b/docs/useful_urls.md
@@ -15,11 +15,13 @@ ## Release Information +* https://chromiumdash.appspot.com/releases * https://omahaproxy.appspot.com/: Current release versions +* https://chromestatus.com/: Web Platform implementation status ## Source Information -* https://cs.chromium.org/: Code search +* https://source.chromium.org/chromium/chromium/src: Code search * https://chromium.googlesource.com/chromium/src/: Gitiles source code browser * https://chromium.googlesource.com/chromium/src/+log/b6cfa6a..9a2e0a8?pretty=fuller: Git changelog * https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html: Chrome #include Analysis @@ -28,3 +30,14 @@ * [Chromium Developers List chromium-dev@](https://groups.google.com/a/chromium.org/group/chromium-dev/topics) * [Chromium Users List chromium-discuss@](https://groups.google.com/a/chromium.org/group/chromium-discuss/topics) +* [Chromium Slack channel](https://chromium.slack.com) + +## Performance Information + +* https://chromeperf.appspot.com/ +* https://pinpoint-dot-chromeperf.appspot.com/ + +## Precompiled Binaries + +* http://commondatastorage.googleapis.com/chromium-browser-continuous/index.html +* http://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html \ No newline at end of file
diff --git a/google_apis/drive/base_requests.cc b/google_apis/drive/base_requests.cc index 4af6db26..2c85426dc 100644 --- a/google_apis/drive/base_requests.cc +++ b/google_apis/drive/base_requests.cc
@@ -143,24 +143,25 @@ value->GetAsDictionary(&dictionary) && dictionary->GetDictionaryWithoutPathExpansion(kErrorKey, &error)) { // Get error message. - std::string message; - error->GetStringWithoutPathExpansion(kErrorMessageKey, &message); - DLOG(ERROR) << "code: " << code << ", message: " << message; + const std::string* message = error->FindStringKey(kErrorMessageKey); + DLOG(ERROR) << "code: " << code + << ", message: " << (message ? *message : ""); // Override the error code based on the reason of the first error. const base::ListValue* errors = nullptr; const base::DictionaryValue* first_error = nullptr; if (error->GetListWithoutPathExpansion(kErrorErrorsKey, &errors) && errors->GetDictionary(0, &first_error)) { - std::string reason; - first_error->GetStringWithoutPathExpansion(kErrorReasonKey, &reason); - if (reason == kErrorReasonRateLimitExceeded || - reason == kErrorReasonUserRateLimitExceeded) { + const std::string* reason = first_error->FindStringKey(kErrorReasonKey); + if (!reason) + return code; + if (*reason == kErrorReasonRateLimitExceeded || + *reason == kErrorReasonUserRateLimitExceeded) { return google_apis::HTTP_SERVICE_UNAVAILABLE; } - if (reason == kErrorReasonQuotaExceeded) + if (*reason == kErrorReasonQuotaExceeded) return google_apis::DRIVE_NO_SPACE; - if (reason == kErrorReasonResponseTooLarge) + if (*reason == kErrorReasonResponseTooLarge) return google_apis::DRIVE_RESPONSE_TOO_LARGE; } }
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 391a66f..4f26d0e 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -58,25 +58,22 @@ base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value.get()); - std::string refresh_token; - std::string access_token; - std::string id_token; + std::string* refresh_token = dict->FindStringKey("refresh_token"); + std::string* access_token = dict->FindStringKey("access_token"); absl::optional<int> expires_in_secs = dict->FindIntKey("expires_in"); - if (!dict->GetStringWithoutPathExpansion("refresh_token", &refresh_token) || - !dict->GetStringWithoutPathExpansion("access_token", &access_token) || - !expires_in_secs.has_value()) { + if (!refresh_token || !access_token || !expires_in_secs.has_value()) return nullptr; - } // Extract ID token when obtaining refresh token. Do not fail if absent, // but log to keep track. - if (!dict->GetStringWithoutPathExpansion("id_token", &id_token)) { + std::string* id_token = dict->FindStringKey("id_token"); + if (!id_token) LOG(ERROR) << "Missing ID token on refresh token fetch response."; - } - gaia::TokenServiceFlags service_flags = gaia::ParseServiceFlags(id_token); + gaia::TokenServiceFlags service_flags = + gaia::ParseServiceFlags(id_token ? *id_token : std::string()); return std::make_unique<const GaiaAuthConsumer::ClientOAuthResult>( - refresh_token, access_token, expires_in_secs.value(), + *refresh_token, *access_token, expires_in_secs.value(), service_flags.is_child_account, service_flags.is_under_advanced_protection); } @@ -97,13 +94,13 @@ base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value.get()); - std::string error; - if (!dict->GetStringWithoutPathExpansion("error", &error)) + std::string* error = dict->FindStringKey("error"); + if (!error) return GaiaAuthConsumer::TokenRevocationStatus::kUnknownError; - if (error == "invalid_token") + if (*error == "invalid_token") return GaiaAuthConsumer::TokenRevocationStatus::kInvalidToken; - if (error == "invalid_request") + if (*error == "invalid_request") return GaiaAuthConsumer::TokenRevocationStatus::kInvalidRequest; return GaiaAuthConsumer::TokenRevocationStatus::kUnknownError;
diff --git a/gpu/command_buffer/common/sync_token.cc b/gpu/command_buffer/common/sync_token.cc index 0d6e9e6..69dfc8f 100644 --- a/gpu/command_buffer/common/sync_token.cc +++ b/gpu/command_buffer/common/sync_token.cc
@@ -22,6 +22,7 @@ release_count_(release_count) {} SyncToken::SyncToken(const SyncToken& other) = default; +SyncToken& SyncToken::operator=(const SyncToken& other) = default; std::string SyncToken::ToDebugString() const { // At the level of the generic command buffer code, the command buffer ID is
diff --git a/gpu/command_buffer/common/sync_token.h b/gpu/command_buffer/common/sync_token.h index 52d696ca..eae3faf2 100644 --- a/gpu/command_buffer/common/sync_token.h +++ b/gpu/command_buffer/common/sync_token.h
@@ -33,6 +33,7 @@ uint64_t release_count); SyncToken(const SyncToken& other); + SyncToken& operator=(const SyncToken& other); void Set(CommandBufferNamespace namespace_id, CommandBufferId command_buffer_id,
diff --git a/gpu/vulkan/PRESUBMIT.py b/gpu/vulkan/PRESUBMIT.py index 6deb715..a74b596 100644 --- a/gpu/vulkan/PRESUBMIT.py +++ b/gpu/vulkan/PRESUBMIT.py
@@ -11,6 +11,9 @@ import os.path +USE_PYTHON3 = True + + def CommonChecks(input_api, output_api): generating_files = input_api.AffectedFiles( file_filter=lambda x: os.path.basename(x.LocalPath()) in [ @@ -35,9 +38,6 @@ commands = [] if generating_files: python_executable = input_api.python_executable - # TODO(penghuang): Remove it when python3 is used by default. - if python_executable != 'vpython3': - python_executable = 'vpython3' commands.append(input_api.Command(name='generate_bindings', cmd=[python_executable, 'generate_bindings.py',
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index 054b6a46..42b97485 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -1013,12 +1013,9 @@ breadcrumbs::BreadcrumbPersistentStorageManager* persistentStorageManager = GetApplicationContext()->GetBreadcrumbPersistentStorageManager(); + DCHECK(persistentStorageManager); - // Application context can return a null persistent storage manager if - // breadcrumbs are not being persisted. - if (persistentStorageManager) { - breadcrumbService->StartPersisting(persistentStorageManager); - } + breadcrumbService->StartPersisting(persistentStorageManager); // Get stored persistent breadcrumbs from last run to set on crash reports. persistentStorageManager->GetStoredEvents(
diff --git a/ios/chrome/app/strings/resources/ios_chromium_strings_km.xtb b/ios/chrome/app/strings/resources/ios_chromium_strings_km.xtb index 07d16f2..4b78d62d 100644 --- a/ios/chrome/app/strings/resources/ios_chromium_strings_km.xtb +++ b/ios/chrome/app/strings/resources/ios_chromium_strings_km.xtb
@@ -6,6 +6,7 @@ <translation id="1257458525759135959">ដើម្បីរក្សាទុករូបភាព សូមចុចលើ "ការកំណត់" ដើម្បីអនុញ្ញាតឱ្យ Chromium បញ្ចូលទៅក្នុងរូបថតរបស់អ្នក</translation> <translation id="1289216811211435351">ប្ដូរទៅ Chromium</translation> <translation id="1361748954329991663">Chromium ហួសសម័យហើយ។ ប្រសិនបើមិនមានកំណែថ្មីនៅក្នុង <ph name="BEGIN_LINK" />App Store<ph name="END_LINK" /> ទេ ឧបករណ៍របស់អ្នកអាចនឹងមិនស្គាល់កំណែថ្មីៗរបស់ Chromium ទៀតទេ។</translation> +<translation id="1370204544543370355">ដើម្បីទទួលបានអត្ថប្រយោជន៍ច្រើនបំផុតពី Chromium សូមចូល Chromium ដោយប្រើគណនី Google របស់អ្នក</translation> <translation id="1431818719585918472">អនុញ្ញាតឱ្យ Chromium ចាក់សោផ្ទាំងឯកជនរបស់អ្នក។</translation> <translation id="1472013873724362412">គណនីរបស់អ្នកមិនដំណើរការនៅលើ Chromium ទេ។ សូមទាក់ទងអ្នកគ្រប់គ្រងដែនរបស់អ្នក ឫប្រើគណនី Google ធម្មតាដើម្បីចូល។</translation> <translation id="1507010443238049608">ជួយកែលម្អមុខងារ និងប្រតិបត្តិការរបស់ Chromium</translation>
diff --git a/ios/chrome/app/strings/resources/ios_chromium_strings_pa.xtb b/ios/chrome/app/strings/resources/ios_chromium_strings_pa.xtb index b9e71f0..4908ed3 100644 --- a/ios/chrome/app/strings/resources/ios_chromium_strings_pa.xtb +++ b/ios/chrome/app/strings/resources/ios_chromium_strings_pa.xtb
@@ -6,6 +6,7 @@ <translation id="1257458525759135959">ਚਿੱਤਰਾਂ ਨੂੰ ਰੱਖਿਅਤ ਕਰਨ ਲਈ, Chromium ਨੂੰ ਤੁਹਾਡੀਆਂ ਫ਼ੋਟੋਆਂ ਸ਼ਾਮਲ ਕਰਨ ਦੇਣ ਲਈ ਸੈਟਿੰਗਾਂ 'ਤੇ ਟੈਪ ਕਰੋ</translation> <translation id="1289216811211435351">Chromium 'ਤੇ ਜਾਓ</translation> <translation id="1361748954329991663">Chromium ਦਾ ਇਹ ਵਰਜਨ ਪੁਰਾਣਾ ਹੈ। ਜੇ <ph name="BEGIN_LINK" />ਐਪ ਸਟੋਰ<ph name="END_LINK" /> ਵਿੱਚ ਕੋਈ ਅੱਪਡੇਟ ਉਪਲਬਧ ਨਹੀਂ ਹੈ, ਤਾਂ ਇਹ ਸੰਭਵ ਹੈ ਕਿ ਤੁਹਾਡਾ ਡੀਵਾਈਸ ਹੁਣ Chromium ਦੇ ਨਵੇਂ ਵਰਜਨਾਂ ਦਾ ਸਮਰਥਨ ਨਹੀਂ ਕਰਦਾ ਹੈ।</translation> +<translation id="1370204544543370355">Chromium ਦਾ ਵੱਧ ਤੋਂ ਵੱਧ ਲਾਹਾ ਲੈਣ ਲਈ, ਆਪਣੇ Google ਖਾਤੇ ਨਾਲ Chromium ਵਿੱਚ ਸਾਈਨ-ਇਨ ਕਰੋ</translation> <translation id="1431818719585918472">Chromium ਨੂੰ ਤੁਹਾਡੀਆਂ ਇਨਕੋਗਨਿਟੋ ਟੈਬਾਂ ਲਾਕ ਕਰਨ ਦਿਓ।</translation> <translation id="1472013873724362412">ਤੁਹਾਡਾ ਖਾਤਾ Chromium 'ਤੇ ਕੰਮ ਨਹੀਂ ਕਰਦਾ। ਕਿਰਪਾ ਕਰਕੇ ਆਪਣੇ ਡੋਮੇਨ ਪ੍ਰਸ਼ਾਸਕ ਨੂੰ ਸੰਪਰਕ ਕਰੋ ਜਾਂ ਸਾਈਨ-ਇਨ ਲਈ ਇੱਕ ਨਿਯਮਿਤ Google ਖਾਤੇ ਦੀ ਵਰਤੋਂ ਕਰੋ।</translation> <translation id="1507010443238049608">Chromium ਦੀਆਂ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਅਤੇ ਕਾਰਗੁਜ਼ਾਰੀ ਨੂੰ ਬਿਹਤਰ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਕਰੋ</translation>
diff --git a/ios/chrome/app/strings/resources/ios_chromium_strings_sq.xtb b/ios/chrome/app/strings/resources/ios_chromium_strings_sq.xtb index 1921dcbe..19d164b 100644 --- a/ios/chrome/app/strings/resources/ios_chromium_strings_sq.xtb +++ b/ios/chrome/app/strings/resources/ios_chromium_strings_sq.xtb
@@ -6,6 +6,7 @@ <translation id="1257458525759135959">Për të ruajtur imazhet, trokit te "Cilësimet" për të lejuar që Chromium të shtojë te fotografitë e tua</translation> <translation id="1289216811211435351">Kalo te Chromium</translation> <translation id="1361748954329991663">Chromium është i papërditësuar. Nëse nuk ofrohet ndonjë përditësim në <ph name="BEGIN_LINK" />App Store<ph name="END_LINK" />, ka mundësi që pajisja jote nuk i mbështet më versionet e reja të Chromium.</translation> +<translation id="1370204544543370355">Për të marrë maksimumin nga Chromium, identifikohu në Chromium me "Llogarinë tënde të Google"</translation> <translation id="1431818719585918472">Lejo që Chromium t'i kyçë skedat "e fshehta".</translation> <translation id="1472013873724362412">Llogaria jote nuk punon në Chromium. Kontakto me administratorin e domenit ose përdor një llogari të rregullt të Google për t'u identifikuar.</translation> <translation id="1507010443238049608">Ndihmo në përmirësimin e veçorive dhe të cilësisë së funksionimit të Chrome</translation>
diff --git a/ios/chrome/app/strings/resources/ios_google_chrome_strings_km.xtb b/ios/chrome/app/strings/resources/ios_google_chrome_strings_km.xtb index 21d85ea6..2368a9a 100644 --- a/ios/chrome/app/strings/resources/ios_google_chrome_strings_km.xtb +++ b/ios/chrome/app/strings/resources/ios_google_chrome_strings_km.xtb
@@ -36,6 +36,7 @@ <translation id="3345341804167540816">ប្រើ Chrome គ្រប់ទីកន្លែង</translation> <translation id="3522659714780527202">ដើម្បីអាចមើលឃើញផ្ទាំងរបស់អ្នកពីឧបករណ៍ទាំងឡាយដែលអ្នកប្រើ Chrome សូមបើកសមកាលកម្ម</translation> <translation id="3533694711092285624">គ្មានពាក្យសម្ងាត់ដែលបានរក្សាទុកទេ។ Chrome អាចពិនិត្យពាក្យសម្ងាត់របស់អ្នក នៅពេលអ្នករក្សាទុកពាក្យសម្ងាត់ទាំងនោះ។</translation> +<translation id="3634910711516114487">ដើម្បីទទួលបានអត្ថប្រយោជន៍ច្រើនបំផុតពី Chrome សូមចូល Chrome ដោយប្រើគណនី Google របស់អ្នក</translation> <translation id="3706101708757577809">ឥឡូវនេះ អ្នកអាចប្រើ Chrome រាល់ពេលដែលអ្នកចុចលើតំណនៅក្នុងសារ ឯកសារ និងកម្មវិធីផ្សេងទៀត។</translation> <translation id="3720541637541300822">ចាក់សោផ្ទាំងឯកជន នៅពេលអ្នកបិទ Chrome</translation> <translation id="384394811301901750">Google Chrome មិនអាចប្រើកាមេរ៉ារបស់អ្នកបានទេឥឡូវនេះ</translation>
diff --git a/ios/chrome/app/strings/resources/ios_google_chrome_strings_pa.xtb b/ios/chrome/app/strings/resources/ios_google_chrome_strings_pa.xtb index 92c92bf..56110af 100644 --- a/ios/chrome/app/strings/resources/ios_google_chrome_strings_pa.xtb +++ b/ios/chrome/app/strings/resources/ios_google_chrome_strings_pa.xtb
@@ -36,6 +36,7 @@ <translation id="3345341804167540816">ਹਰ ਥਾਂ 'ਤੇ Chrome ਵਰਤੋ</translation> <translation id="3522659714780527202">ਜਿਸ ਡੀਵਾਈਸ 'ਤੇ ਵੀ ਤੁਸੀਂ Chrome ਵਰਤਦੇ ਹੋ, ਉੱਥੇ ਆਪਣੀਆਂ ਟੈਬਾਂ ਦੇਖਣ ਲਈ ਸਮਕਾਲੀਕਰਨ ਚਾਲੂ ਕਰੋ</translation> <translation id="3533694711092285624">ਕੋਈ ਰੱਖਿਅਤ ਕੀਤੇ ਪਾਸਵਰਡ ਨਹੀਂ। ਤੁਹਾਡੇ ਵੱਲੋਂ ਆਪਣੇ ਪਾਸਵਰਡ ਰੱਖਿਅਤ ਕਰਨ 'ਤੇ Chrome ਉਹਨਾਂ ਦੀ ਜਾਂਚ ਕਰ ਸਕਦਾ ਹੈ।</translation> +<translation id="3634910711516114487">Chrome ਦਾ ਵੱਧ ਤੋਂ ਵੱਧ ਲਾਹਾ ਲੈਣ ਲਈ, ਆਪਣੇ Google ਖਾਤੇ ਨਾਲ Chrome ਵਿੱਚ ਸਾਈਨ-ਇਨ ਕਰੋ</translation> <translation id="3706101708757577809">ਸੁਨੇਹੇ, ਦਸਤਾਵੇਜ਼ ਅਤੇ ਹੋਰ ਐਪਾਂ ਵਿੱਚ ਲਿੰਕ 'ਤੇ ਟੈਪ ਕਰਕੇ ਤੁਸੀਂ ਹੁਣ ਕਿਸੇ ਵੇਲੇ ਵੀ Chrome ਵਰਤ ਸਕਦੇ ਹੋ।</translation> <translation id="3720541637541300822">ਤੁਹਾਡੇ ਵੱਲੋਂ Chrome ਨੂੰ ਬੰਦ ਕੀਤੇ ਜਾਣ 'ਤੇ ਇਨਕੋਗਨਿਟੋ ਟੈਬਾਂ ਨੂੰ ਲਾਕ ਕਰੋ</translation> <translation id="384394811301901750">Google Chrome ਇਸ ਵੇਲੇ ਤੁਹਾਡੇ ਕੈਮਰੇ ਦੀ ਵਰਤੋਂ ਨਹੀਂ ਕਰ ਸਕਦਾ</translation>
diff --git a/ios/chrome/app/strings/resources/ios_google_chrome_strings_sq.xtb b/ios/chrome/app/strings/resources/ios_google_chrome_strings_sq.xtb index f234edd..b88acdf 100644 --- a/ios/chrome/app/strings/resources/ios_google_chrome_strings_sq.xtb +++ b/ios/chrome/app/strings/resources/ios_google_chrome_strings_sq.xtb
@@ -36,6 +36,7 @@ <translation id="3345341804167540816">Përdor Chrome kudo</translation> <translation id="3522659714780527202">Për të parë skedat e tua nga çdo vend ku përdor Chrome, aktivizo sinkronizimin</translation> <translation id="3533694711092285624">Nuk ka asnjë fjalëkalim të ruajtur. Chrome mund t'i kontrollojë fjalëkalimet e tua kur ti i ruan ato.</translation> +<translation id="3634910711516114487">Për të marrë maksimumin nga Chrome, identifikohu me në Chrome me "Llogarinë tënde të Google"</translation> <translation id="3706101708757577809">Tani mund të përdorësh Chrome sa herë që troket te lidhjet në mesazhe, dokumente dhe aplikacione të tjera.</translation> <translation id="3720541637541300822">Kyçi skedat "e fshehta" kur të mbyllësh Chrome</translation> <translation id="384394811301901750">Google Chrome nuk mund të përdorë kamerën tënde për momentin</translation>
diff --git a/ios/chrome/app/strings/resources/ios_strings_km.xtb b/ios/chrome/app/strings/resources/ios_strings_km.xtb index fcf977e..d37f4a1 100644 --- a/ios/chrome/app/strings/resources/ios_strings_km.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_km.xtb
@@ -802,6 +802,7 @@ <translation id="8917490105272468696">បាទ/ចាស ខ្ញុំយល់ព្រម។</translation> <translation id="895541991026785598">រាយការណ៍ពីបញ្ហា</translation> <translation id="8976382372951310360">ជំនួយ</translation> +<translation id="8976414606286374109">បណ្ណត្រូវបានរក្សាទុកក្នុងគណនី Google របស់អ្នក។</translation> <translation id="8981454092730389528">ការគ្រប់គ្រងសកម្មភាព Google</translation> <translation id="8985320356172329008">បានចូល Google ជា</translation> <translation id="9000089900434778519">ម៉ាស៊ីនស្វែងរករបស់អ្នកគឺ <ph name="DSE_NAME" />។ មើលការណែនាំរបស់ម៉ាស៊ីនស្វែងរក ដើម្បីដឹងអំពីរបៀបលុបប្រវត្តិស្វែងរករបស់អ្នក ប្រសិនបើអាច។</translation>
diff --git a/ios/chrome/app/strings/resources/ios_strings_pa.xtb b/ios/chrome/app/strings/resources/ios_strings_pa.xtb index 705727f..3afed3d 100644 --- a/ios/chrome/app/strings/resources/ios_strings_pa.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_pa.xtb
@@ -800,6 +800,7 @@ <translation id="8917490105272468696">ਹਾਂ, ਮੈਂ ਸਹਿਮਤ ਹਾਂ</translation> <translation id="895541991026785598">ਇੱਕ ਸਮੱਸਿਆ ਦੀ ਰਿਪੋਰਟ ਕਰੋ</translation> <translation id="8976382372951310360">ਮਦਦ</translation> +<translation id="8976414606286374109">ਕਾਰਡ ਤੁਹਾਡੇ Google ਖਾਤੇ 'ਤੇ ਰੱਖਿਅਤ ਕੀਤੇ ਜਾਂਦੇ ਹਨ।</translation> <translation id="8981454092730389528">Google ਸਰਗਰਮੀ ਕੰਟਰੋਲ</translation> <translation id="8985320356172329008">ਇਸ ਵਜੋਂ Google ਵਿੱਚ ਸਾਈਨ ਇਨ ਕੀਤਾ ਹੋਇਆ ਹੈ</translation> <translation id="9000089900434778519">ਤੁਹਾਡਾ ਖੋਜ ਇੰਜਣ <ph name="DSE_NAME" /> ਹੈ। ਲਾਗੂ ਹੋਣ 'ਤੇ, ਆਪਣਾ ਖੋਜ ਇਤਿਹਾਸ ਮਿਟਾਉਣ ਲਈ ਉਹਨਾਂ ਦੀਆਂ ਹਿਦਾਇਤਾਂ ਦੇਖੋ।</translation>
diff --git a/ios/chrome/app/strings/resources/ios_strings_sq.xtb b/ios/chrome/app/strings/resources/ios_strings_sq.xtb index ffd4ebbb..d6f13670 100644 --- a/ios/chrome/app/strings/resources/ios_strings_sq.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_sq.xtb
@@ -802,6 +802,7 @@ <translation id="8917490105272468696">Po, jam dakord</translation> <translation id="895541991026785598">Raporto një problem</translation> <translation id="8976382372951310360">Ndihma</translation> +<translation id="8976414606286374109">Kartat ruhen në "Llogarinë tënde të Google".</translation> <translation id="8981454092730389528">Kontrollet e aktivitetit të Google</translation> <translation id="8985320356172329008">Je identifikuar në Google si</translation> <translation id="9000089900434778519">Motori yt i kërkimit është <ph name="DSE_NAME" />. Shiko udhëzimet e motorit të kërkimit për fshirjen e historikut të kërkimit, nëse është e vlefshme.</translation>
diff --git a/ios/chrome/browser/credential_provider/BUILD.gn b/ios/chrome/browser/credential_provider/BUILD.gn index 68c97e9..13b20f0 100644 --- a/ios/chrome/browser/credential_provider/BUILD.gn +++ b/ios/chrome/browser/credential_provider/BUILD.gn
@@ -43,6 +43,7 @@ "//ios/chrome/browser/sync", "//ios/chrome/common/app_group", "//ios/chrome/common/credential_provider", + "//ios/chrome/common/credential_provider:ui", "//ios/public/provider/chrome/browser/signin", "//url", ]
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service.h b/ios/chrome/browser/credential_provider/credential_provider_service.h index f98c743d..ed8e499 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service.h +++ b/ios/chrome/browser/credential_provider/credential_provider_service.h
@@ -13,8 +13,7 @@ #include "components/sync/driver/sync_service_observer.h" #import "ios/chrome/browser/signin/authentication_service.h" -@class ArchivableCredential; -@class ArchivableCredentialStore; +@protocol CredentialStore; namespace syncer { class SyncService; @@ -33,7 +32,7 @@ CredentialProviderService( scoped_refptr<password_manager::PasswordStore> password_store, AuthenticationService* authentication_service, - ArchivableCredentialStore* credential_store, + id<CredentialStore> credential_store, signin::IdentityManager* identity_manager, syncer::SyncService* sync_service); ~CredentialProviderService() override; @@ -107,7 +106,7 @@ syncer::SyncService* sync_service_ = nullptr; // The interface for saving and updating credentials. - ArchivableCredentialStore* archivable_credential_store_ = nil; + id<CredentialStore> credential_store_ = nil; // The current validation ID or nil. NSString* account_validation_id_ = nil;
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service.mm b/ios/chrome/browser/credential_provider/credential_provider_service.mm index 33a110a..80de752 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service.mm
@@ -24,9 +24,9 @@ #import "ios/chrome/browser/credential_provider/credential_provider_util.h" #include "ios/chrome/common/app_group/app_group_constants.h" #import "ios/chrome/common/credential_provider/archivable_credential.h" -#import "ios/chrome/common/credential_provider/archivable_credential_store.h" #import "ios/chrome/common/credential_provider/as_password_credential_identity+credential.h" #import "ios/chrome/common/credential_provider/constants.h" +#import "ios/chrome/common/credential_provider/credential_store.h" #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -87,7 +87,7 @@ return !isIdentityStoreSynced && areCredentialsSynced; } -void SyncASIdentityStore(ArchivableCredentialStore* credential_store) { +void SyncASIdentityStore(id<CredentialStore> credential_store) { auto stateCompletion = ^(ASCredentialIdentityStoreState* state) { #if !defined(NDEBUG) dispatch_assert_queue_not(dispatch_get_main_queue()); @@ -132,14 +132,14 @@ CredentialProviderService::CredentialProviderService( scoped_refptr<PasswordStore> password_store, AuthenticationService* authentication_service, - ArchivableCredentialStore* credential_store, + id<CredentialStore> credential_store, signin::IdentityManager* identity_manager, syncer::SyncService* sync_service) : password_store_(password_store), authentication_service_(authentication_service), identity_manager_(identity_manager), sync_service_(sync_service), - archivable_credential_store_(credential_store) { + credential_store_(credential_store) { DCHECK(password_store_); password_store_->AddObserver(this); @@ -182,7 +182,7 @@ void CredentialProviderService::RequestSyncAllCredentialsIfNeeded() { if (ShouldSyncASIdentityStore()) { - SyncASIdentityStore(archivable_credential_store_); + SyncASIdentityStore(credential_store_); } if (ShouldSyncAllCredentials()) { RequestSyncAllCredentials(); @@ -191,15 +191,14 @@ void CredentialProviderService::SyncAllCredentials( std::vector<std::unique_ptr<PasswordForm>> forms) { - [archivable_credential_store_ removeAllCredentials]; + [credential_store_ removeAllCredentials]; AddCredentials(std::move(forms)); SyncStore(true); } void CredentialProviderService::SyncStore(bool set_first_time_sync_flag) { - __weak ArchivableCredentialStore* weak_archivable_credential_store = - archivable_credential_store_; - [archivable_credential_store_ saveDataWithCompletion:^(NSError* error) { + __weak id<CredentialStore> weak_credential_store = credential_store_; + [credential_store_ saveDataWithCompletion:^(NSError* error) { if (error) { return; } @@ -211,8 +210,8 @@ NSString* key = kUserDefaultsCredentialProviderFirstTimeSyncCompleted; [user_defaults setBool:YES forKey:key]; } - if (weak_archivable_credential_store) { - SyncASIdentityStore(weak_archivable_credential_store); + if (weak_credential_store) { + SyncASIdentityStore(weak_credential_store); } }]; } @@ -225,7 +224,7 @@ favicon:nil validationIdentifier:account_validation_id_]; DCHECK(credential); - [archivable_credential_store_ addCredential:credential]; + [credential_store_ addCredential:credential]; } } @@ -234,8 +233,7 @@ for (const auto& form : forms) { NSString* recordID = RecordIdentifierForPasswordForm(*form); DCHECK(recordID); - [archivable_credential_store_ - removeCredentialWithRecordIdentifier:recordID]; + [credential_store_ removeCredentialWithRecordIdentifier:recordID]; } }
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service_unittest.mm b/ios/chrome/browser/credential_provider/credential_provider_service_unittest.mm index 2e11baf..0879272 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service_unittest.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service_unittest.mm
@@ -14,9 +14,9 @@ #include "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/authentication_service_fake.h" #include "ios/chrome/common/app_group/app_group_constants.h" -#import "ios/chrome/common/credential_provider/archivable_credential_store.h" #import "ios/chrome/common/credential_provider/constants.h" #import "ios/chrome/common/credential_provider/credential.h" +#import "ios/chrome/common/credential_provider/memory_credential_store.h" #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" #include "ios/web/public/test/web_task_environment.h" @@ -50,7 +50,7 @@ EXPECT_FALSE([user_defaults boolForKey:kUserDefaultsCredentialProviderFirstTimeSyncCompleted]); - credential_store_ = [[ArchivableCredentialStore alloc] initWithFileURL:nil]; + credential_store_ = [[MemoryCredentialStore alloc] init]; TestChromeBrowserState::Builder builder; builder.AddTestingFactory( @@ -87,7 +87,7 @@ base::ScopedTempDir temp_dir_; web::WebTaskEnvironment task_environment_; scoped_refptr<PasswordStoreImpl> password_store_; - ArchivableCredentialStore* credential_store_; + id<CredentialStore> credential_store_; AuthenticationServiceFake* auth_service_; std::unique_ptr<CredentialProviderService> credential_provider_service_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
diff --git a/ios/chrome/browser/safe_browsing/unsafe_resource_util.mm b/ios/chrome/browser/safe_browsing/unsafe_resource_util.mm index 4530f23a..c92e5c1 100644 --- a/ios/chrome/browser/safe_browsing/unsafe_resource_util.mm +++ b/ios/chrome/browser/safe_browsing/unsafe_resource_util.mm
@@ -18,9 +18,9 @@ void RunUnsafeResourceCallback(const UnsafeResource& resource, bool proceed, bool showed_interstitial) { - DCHECK(resource.callback_thread); + DCHECK(resource.callback_sequence); DCHECK(!resource.callback.is_null()); - resource.callback_thread->PostTask( + resource.callback_sequence->PostTask( FROM_HERE, base::BindOnce(resource.callback, proceed, showed_interstitial)); }
diff --git a/ios/chrome/browser/safe_browsing/url_checker_delegate_impl_unittest.mm b/ios/chrome/browser/safe_browsing/url_checker_delegate_impl_unittest.mm index 45214b4..6e58b08f 100644 --- a/ios/chrome/browser/safe_browsing/url_checker_delegate_impl_unittest.mm +++ b/ios/chrome/browser/safe_browsing/url_checker_delegate_impl_unittest.mm
@@ -79,7 +79,7 @@ UnsafeResourceCallbackState* callback_state) { UnsafeResource resource; resource.url = GURL("http://www.chromium.test"); - resource.callback_thread = task_environment_.GetMainThreadTaskRunner(); + resource.callback_sequence = task_environment_.GetMainThreadTaskRunner(); resource.callback = base::BindRepeating(&PopulateCallbackState, callback_state); resource.web_state_getter = web_state_->CreateDefaultGetter();
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester_unittest.mm b/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester_unittest.mm index d375666d9..686947e 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester_unittest.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester_unittest.mm
@@ -100,6 +100,14 @@ } void TearDown() override { + // Remove the frame in order to destroy the AutofillDriver before the + // AutofillClient. + web::FakeWebFramesManager* frames_manager = + static_cast<web::FakeWebFramesManager*>( + web_state()->GetWebFramesManager()); + std::string frame_id = frames_manager->GetMainWebFrame()->GetFrameId(); + frames_manager->RemoveWebFrame(frame_id); + personal_data_manager_.SetPrefService(nullptr); PlatformTest::TearDown(); }
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h index f1d69a8..d26d8aa 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h
@@ -27,6 +27,9 @@ // The title text to display. @property(nonatomic, copy) NSString* text; +// The attributed text to display. +@property(nonatomic, copy) NSAttributedString* attributedText; + // The detail text to display. @property(nonatomic, copy) NSString* detailText;
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm index c6b06a8..810285af 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm
@@ -31,6 +31,10 @@ cell.detailTextLabel.text = self.detailText; cell.image = self.image; + if (self.attributedText) { + cell.textLabel.attributedText = self.attributedText; + } + if (self.detailTextColor) { cell.detailTextLabel.textColor = self.detailTextColor; } else {
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm index 96cdf6b..6f618f80 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm
@@ -46,6 +46,27 @@ EXPECT_NSEQ(image, imageDetailCell.image); } +// Tests that the attributed text is honoured after a call to +// |configureCell:|. +TEST_F(SettingsImageDetailTextItemTest, ConfigureAttributedText) { + SettingsImageDetailTextItem* item = + [[SettingsImageDetailTextItem alloc] initWithType:0]; + NSAttributedString* attributeString = + [[NSAttributedString alloc] initWithString:@"Test Attributed Text"]; + item.attributedText = attributeString; + + id cell = [[[item cellClass] alloc] init]; + ASSERT_TRUE([cell isMemberOfClass:[SettingsImageDetailTextCell class]]); + + SettingsImageDetailTextCell* imageDetailCell = + static_cast<SettingsImageDetailTextCell*>(cell); + + EXPECT_FALSE(imageDetailCell.textLabel.attributedText); + + [item configureCell:cell withStyler:[[ChromeTableViewStyler alloc] init]]; + EXPECT_NSEQ(attributeString, imageDetailCell.textLabel.attributedText); +} + // Tests that the detail text color is updated when detailTextColor is not // nil. TEST_F(SettingsImageDetailTextItemTest, setDetailTextColor) {
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h index b21a624..001394c7 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h
@@ -12,8 +12,8 @@ #import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h" // SettingsRootTableViewController is a base class for integrating UITableViews -// into the Settings UI. It handles the configuration and display of the MDC -// AppBar. +// into the Settings UI. This class is made to be subclassed and contains the +// logic to handle the most common user interactions (edit, delete...). @interface SettingsRootTableViewController : ChromeTableViewController <SettingsRootViewControlling, TableViewLinkHeaderFooterItemDelegate,
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_bottom_toolbar.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_bottom_toolbar.mm index f2b8aee..e978e8a3 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_bottom_toolbar.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_bottom_toolbar.mm
@@ -244,16 +244,17 @@ _addToButton = [[UIBarButtonItem alloc] init]; _addToButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); _addToButton.title = l10n_util::GetNSString(IDS_IOS_TAB_GRID_ADD_TO_BUTTON); - _addToButton.accessibilityIdentifier = kTabGridAddToButtonIdentifier; + _addToButton.accessibilityIdentifier = kTabGridEditAddToButtonIdentifier; _shareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil]; _shareButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); - _shareButton.accessibilityIdentifier = kTabGridShareButtonIdentifier; + _shareButton.accessibilityIdentifier = kTabGridEditShareButtonIdentifier; _closeTabsButton = [[UIBarButtonItem alloc] init]; _closeTabsButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); - _closeTabsButton.accessibilityIdentifier = kTabGridCloseButtonIdentifier; + _closeTabsButton.accessibilityIdentifier = + kTabGridEditCloseTabsButtonIdentifier; [self updateSelectionButtons]; }
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.h b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.h index ea7e4f85..4804ffa 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.h +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.h
@@ -15,15 +15,18 @@ extern NSString* const kTabGridDoneButtonIdentifier; extern NSString* const kTabGridCloseAllButtonIdentifier; extern NSString* const kTabGridUndoCloseAllButtonIdentifier; -extern NSString* const kTabGridCloseButtonIdentifier; -extern NSString* const kTabGridAddToButtonIdentifier; -extern NSString* const kTabGridShareButtonIdentifier; extern NSString* const kTabGridIncognitoTabsEmptyStateIdentifier; extern NSString* const kTabGridRegularTabsEmptyStateIdentifier; extern NSString* const kTabGridScrollViewIdentifier; extern NSString* const kRegularTabGridIdentifier; extern NSString* const kIncognitoTabGridIdentifier; +extern NSString* const kTabGridEditButtonIdentifier; +extern NSString* const kTabGridEditCloseTabsButtonIdentifier; +extern NSString* const kTabGridEditSelectAllButtonIdentifier; +extern NSString* const kTabGridEditAddToButtonIdentifier; +extern NSString* const kTabGridEditShareButtonIdentifier; + // All kxxxColor constants are RGB values stored in a Hex integer. These will be // converted into UIColors using the UIColorFromRGB() function, from // uikit_ui_util.h
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.mm index ff53983..370847a 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_constants.mm
@@ -20,10 +20,6 @@ @"TabGridCloseAllButtonIdentifier"; NSString* const kTabGridUndoCloseAllButtonIdentifier = @"TabGridUndoCloseAllButtonIdentifier"; -NSString* const kTabGridCloseButtonIdentifier = - @"TabGridUndoCloseButtonIdentifier"; -NSString* const kTabGridAddToButtonIdentifier = @"TabGridAddToButtonIdentifier"; -NSString* const kTabGridShareButtonIdentifier = @"TabGridShareButtonIdentifier"; NSString* const kTabGridIncognitoTabsEmptyStateIdentifier = @"TabGridIncognitoTabsEmptyStateIdentifier"; NSString* const kTabGridRegularTabsEmptyStateIdentifier = @@ -32,6 +28,16 @@ NSString* const kRegularTabGridIdentifier = @"kRegularTabGridIdentifier"; NSString* const kIncognitoTabGridIdentifier = @"kIncognitoTabGridIdentifier"; +NSString* const kTabGridEditButtonIdentifier = @"kTabGridEditButtonIdentifier"; +NSString* const kTabGridEditCloseTabsButtonIdentifier = + @"kTabGridEditCloseTabsButtonIdentifier"; +NSString* const kTabGridEditSelectAllButtonIdentifier = + @"kTabGridEditSelectAllButtonIdentifier"; +NSString* const kTabGridEditAddToButtonIdentifier = + @"kTabGridEditAddToButtonIdentifier"; +NSString* const kTabGridEditShareButtonIdentifier = + @"kTabGridEditShareButtonIdentifier"; + // The color of the text buttons in the toolbars. const int kTabGridToolbarTextButtonColor = 0xFFFFFF;
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm index af7ebaa..8df96fa 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_egtest.mm
@@ -99,6 +99,11 @@ config.features_enabled.push_back(kTabGridContextMenu); } + if ([self isRunningTest:@selector(testTabGridBulkActionCloseTabs)] || + [self isRunningTest:@selector(testTabGridBulkActionSelectAll)]) { + config.features_enabled.push_back(kTabsBulkActions); + } + config.features_disabled.push_back(kStartSurface); return config; @@ -910,6 +915,106 @@ performAction:grey_tap()]; } +#pragma mark - Bulk Actions + +// Tests closing a tab in the tab grid edit mode and that edit mode is exited +// after closing all tabs. +- (void)testTabGridBulkActionCloseTabs { + if (!base::ios::IsRunningOnIOS14OrLater()) { + EARL_GREY_TEST_SKIPPED( + @"Bulk actions are only supported on iOS 14 and later."); + } + + [ChromeEarlGrey loadURL:_URL1]; + [ChromeEarlGrey waitForWebStateContainingText:kResponse1]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()] + performAction:grey_tap()]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridEditButton()] + performAction:grey_tap()]; + + // Tap tab to select. + [[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridCellAtIndex(0)] + performAction:grey_tap()]; + + [[EarlGrey + selectElementWithMatcher:chrome_test_util::TabGridEditCloseTabsButton()] + performAction:grey_tap()]; + + NSString* closeTabsButtonText = + base::SysUTF16ToNSString(l10n_util::GetPluralStringFUTF16( + IDS_IOS_TAB_GRID_CLOSE_ALL_TABS_CONFIRMATION, + /*number=*/1)); + + [[EarlGrey + selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( + closeTabsButtonText)] + performAction:grey_tap()]; + + // Make sure that the tab is no longer present. + [[EarlGrey selectElementWithMatcher:TabWithTitle([NSString + stringWithUTF8String:kTitle1])] + assertWithMatcher:grey_nil()]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util:: + TabGridRegularTabsEmptyStateView()] + assertWithMatcher:grey_sufficientlyVisible()]; + + // Verify edit mode is exited. + [[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridEditButton()] + assertWithMatcher:grey_notNil()]; +} + +// Tests selecting all items in the tab grdi edit mode using the "Select all" +// button. +- (void)testTabGridBulkActionSelectAll { + if (!base::ios::IsRunningOnIOS14OrLater()) { + EARL_GREY_TEST_SKIPPED( + @"Bulk actions are only supported on iOS 14 and later."); + } + + [ChromeEarlGrey loadURL:_URL1]; + [ChromeEarlGrey waitForWebStateContainingText:kResponse1]; + + [ChromeEarlGrey openNewTab]; + [ChromeEarlGrey loadURL:_URL2]; + [ChromeEarlGrey waitForWebStateContainingText:kResponse2]; + + [ChromeEarlGrey openNewTab]; + [ChromeEarlGrey loadURL:_URL3]; + [ChromeEarlGrey waitForWebStateContainingText:kResponse3]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util::ShowTabsButton()] + performAction:grey_tap()]; + + [[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridEditButton()] + performAction:grey_tap()]; + + // Tap "Select all" and close selected tabs. + [[EarlGrey + selectElementWithMatcher:chrome_test_util::TabGridEditSelectAllButton()] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:chrome_test_util::TabGridEditCloseTabsButton()] + performAction:grey_tap()]; + NSString* closeTabsButtonText = + base::SysUTF16ToNSString(l10n_util::GetPluralStringFUTF16( + IDS_IOS_TAB_GRID_CLOSE_ALL_TABS_CONFIRMATION, + /*number=*/3)); + [[EarlGrey + selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( + closeTabsButtonText)] + performAction:grey_tap()]; + + // Make sure that the tab grid is empty. + [ChromeEarlGrey waitForMainTabCount:0 inWindowWithNumber:0]; + + // Verify edit mode is exited. + [[EarlGrey selectElementWithMatcher:chrome_test_util::TabGridEditButton()] + assertWithMatcher:grey_notNil()]; +} + #pragma mark - Helper Methods - (void)loadTestURLs {
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm index 42c816f..cd90b15 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_top_toolbar.mm
@@ -251,10 +251,13 @@ _selectAllButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); _selectAllButton.title = l10n_util::GetNSString(IDS_IOS_TAB_GRID_SELECT_ALL_BUTTON); + _selectAllButton.accessibilityIdentifier = + kTabGridEditSelectAllButtonIdentifier; _selectTabsButton = [[UIBarButtonItem alloc] init]; _selectTabsButton.image = [UIImage imageNamed:@"select_tabs_toolbar_button"]; _selectTabsButton.tintColor = UIColorFromRGB(kTabGridToolbarTextButtonColor); + _selectTabsButton.accessibilityIdentifier = kTabGridEditButtonIdentifier; // The segmented control has an intrinsic size. _pageControl = [[TabGridPageControl alloc] init];
diff --git a/ios/chrome/common/credential_provider/BUILD.gn b/ios/chrome/common/credential_provider/BUILD.gn index 819c842..f0ddf43 100644 --- a/ios/chrome/common/credential_provider/BUILD.gn +++ b/ios/chrome/common/credential_provider/BUILD.gn
@@ -16,6 +16,10 @@ "as_password_credential_identity+credential.mm", "constants.h", "constants.mm", + "memory_credential_store.h", + "memory_credential_store.mm", + "user_defaults_credential_store.h", + "user_defaults_credential_store.mm", ] deps = [ ":ui", @@ -45,6 +49,8 @@ "archivable_credential_store_unittest.mm", "archivable_credential_unittest.mm", "as_password_credential_identity+credential_unittests.mm", + "memory_credential_store_unittests.mm", + "user_defaults_credential_store_unittests.mm", ] deps = [ ":credential_provider",
diff --git a/ios/chrome/common/credential_provider/archivable_credential_store.h b/ios/chrome/common/credential_provider/archivable_credential_store.h index fbc992f5..961fce8 100644 --- a/ios/chrome/common/credential_provider/archivable_credential_store.h +++ b/ios/chrome/common/credential_provider/archivable_credential_store.h
@@ -7,24 +7,19 @@ #import <Foundation/Foundation.h> -#import "ios/chrome/common/credential_provider/credential_store.h" - -@class ArchivableCredential; +#import "ios/chrome/common/credential_provider/memory_credential_store.h" // Credential store built on top of keyed archiver and unarchiver to persist -// data. Can also be used as a memory only store. Use |saveDataWithCompletion:| -// to update the data on disk. All operations will be held in memory until saved -// to disk, making it possible to batch multiple operations. -// -// Only supports |Credentials| of class |ArchivableCredential|. -@interface ArchivableCredentialStore : NSObject <CredentialStore> +// data. Use |saveDataWithCompletion:| to update the data on disk. All +// operations will be held in memory until saved to disk, making it possible to +// batch multiple operations. +@interface ArchivableCredentialStore : MemoryCredentialStore // Initializes the store. |fileURL| is where the store should live in disk. If // the file doesn't exist, it will be created on first save. If the file was not // created by this class the store won't be able to load it and the behavior // will be unexpected. In general |fileURL| can be a temp file for testing, or a -// shared resource path in order to be used in an extension. Initialize the -// store with |fileURL| = nil to effectively create a memory only store. +// shared resource path in order to be used in an extension. - (instancetype)initWithFileURL:(NSURL*)fileURL NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE;
diff --git a/ios/chrome/common/credential_provider/archivable_credential_store.mm b/ios/chrome/common/credential_provider/archivable_credential_store.mm index 5d9a84d0..e5d84e8c 100644 --- a/ios/chrome/common/credential_provider/archivable_credential_store.mm +++ b/ios/chrome/common/credential_provider/archivable_credential_store.mm
@@ -5,7 +5,6 @@ #import "ios/chrome/common/credential_provider/archivable_credential_store.h" #include "base/check.h" -#include "base/mac/foundation_util.h" #include "base/notreached.h" #include "base/strings/sys_string_conversions.h" #import "ios/chrome/common/credential_provider/archivable_credential.h" @@ -16,16 +15,9 @@ @interface ArchivableCredentialStore () -// Working queue used to sync the mutable set operations. -@property(nonatomic) dispatch_queue_t workingQueue; - // The fileURL to the disk file, can be nil. @property(nonatomic, strong) NSURL* fileURL; -// The in-memory storage. -@property(nonatomic, strong) - NSMutableDictionary<NSString*, ArchivableCredential*>* memoryStorage; - @end @implementation ArchivableCredentialStore @@ -35,25 +27,14 @@ - (instancetype)initWithFileURL:(NSURL*)fileURL { self = [super init]; if (self) { - if (fileURL) { - DCHECK(fileURL.isFileURL) << "URL must be a file URL."; - } + DCHECK(fileURL.isFileURL) << "URL must be a file URL."; _fileURL = fileURL; - _workingQueue = dispatch_queue_create(nullptr, DISPATCH_QUEUE_CONCURRENT); } return self; } #pragma mark - CredentialStore -- (NSArray<id<Credential>>*)credentials { - __block NSArray<id<Credential>>* credentials; - dispatch_sync(self.workingQueue, ^{ - credentials = [self.memoryStorage allValues]; - }); - return credentials; -} - - (void)saveDataWithCompletion:(void (^)(NSError* error))completion { dispatch_barrier_async(self.workingQueue, ^{ auto executeCompletionIfPresent = ^(NSError* error) { @@ -64,12 +45,6 @@ } }; - if (!self.fileURL) { - // There is no fileURL, store is being used as memory only. - executeCompletionIfPresent(nil); - return; - } - NSError* error = nil; NSData* data = [NSKeyedArchiver archivedDataWithRootObject:self.memoryStorage @@ -98,59 +73,7 @@ }); } -- (void)removeAllCredentials { - dispatch_barrier_async(self.workingQueue, ^{ - [self.memoryStorage removeAllObjects]; - }); -} - -- (void)addCredential:(id<Credential>)credential { - DCHECK(credential.recordIdentifier) - << "credential must have a record identifier"; - dispatch_barrier_async(self.workingQueue, ^{ - DCHECK(!self.memoryStorage[credential.recordIdentifier]) - << "Credential already exists in the storage"; - self.memoryStorage[credential.recordIdentifier] = - base::mac::ObjCCastStrict<ArchivableCredential>(credential); - }); -} - -- (void)updateCredential:(id<Credential>)credential { - [self removeCredentialWithRecordIdentifier:credential.recordIdentifier]; - [self addCredential:credential]; -} - -- (void)removeCredentialWithRecordIdentifier:(NSString*)recordIdentifier { - DCHECK(recordIdentifier.length) << "Invalid |recordIdentifier| was passed."; - dispatch_barrier_async(self.workingQueue, ^{ - DCHECK(self.memoryStorage[recordIdentifier]) - << "Credential doesn't exist in the storage"; - self.memoryStorage[recordIdentifier] = nil; - }); -} - -- (id<Credential>)credentialWithRecordIdentifier:(NSString*)recordIdentifier { - DCHECK(recordIdentifier.length); - __block id<Credential> credential; - dispatch_sync(self.workingQueue, ^{ - credential = self.memoryStorage[recordIdentifier]; - }); - return credential; -} - -#pragma mark - Getters - -- (NSMutableDictionary<NSString*, ArchivableCredential*>*)memoryStorage { -#if !defined(NDEBUG) - dispatch_assert_queue(self.workingQueue); -#endif // !defined(NDEBUG) - if (!_memoryStorage) { - _memoryStorage = [self loadStorage]; - } - return _memoryStorage; -} - -#pragma mark - Private +#pragma mark - Subclassing // Loads the store from disk. - (NSMutableDictionary<NSString*, ArchivableCredential*>*)loadStorage {
diff --git a/ios/chrome/common/credential_provider/constants.mm b/ios/chrome/common/credential_provider/constants.mm index 0ff0f851..65d1d53 100644 --- a/ios/chrome/common/credential_provider/constants.mm +++ b/ios/chrome/common/credential_provider/constants.mm
@@ -45,6 +45,14 @@ NSURL* CredentialProviderSharedArchivableStoreURL() { NSURL* groupURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:ApplicationGroup()]; + + // As of 2021Q4, Earl Grey build don't support security groups in their + // entitlements. + if (!groupURL && + [[[NSBundle mainBundle] bundleIdentifier] containsString:@".gtest."]) { + groupURL = [NSURL fileURLWithPath:NSTemporaryDirectory()]; + } + NSURL* credentialProviderURL = [groupURL URLByAppendingPathComponent:kCredentialProviderContainer]; NSString* filename =
diff --git a/ios/chrome/common/credential_provider/memory_credential_store.h b/ios/chrome/common/credential_provider/memory_credential_store.h new file mode 100644 index 0000000..9b41c84 --- /dev/null +++ b/ios/chrome/common/credential_provider/memory_credential_store.h
@@ -0,0 +1,33 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_MEMORY_CREDENTIAL_STORE_H_ +#define IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_MEMORY_CREDENTIAL_STORE_H_ + +#import <Foundation/Foundation.h> + +#import "ios/chrome/common/credential_provider/credential_store.h" + +@class ArchivableCredential; + +// Base Credential store, memory only and meant to be subclassed. +// +// Only supports |Credentials| of class |ArchivableCredential|. +@interface MemoryCredentialStore : NSObject <CredentialStore> + +// The in-memory storage. +@property(nonatomic, readonly) + NSMutableDictionary<NSString*, ArchivableCredential*>* memoryStorage; + +// Working queue used to sync the mutable set operations. Meant for use when +// subclassing. +@property(nonatomic, readonly) dispatch_queue_t workingQueue; + +// The first time the storage is used, this method will be called to populate +// |memoryStorage|. Meant for subclassing. +- (NSMutableDictionary<NSString*, ArchivableCredential*>*)loadStorage; + +@end + +#endif // IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_MEMORY_CREDENTIAL_STORE_H_
diff --git a/ios/chrome/common/credential_provider/memory_credential_store.mm b/ios/chrome/common/credential_provider/memory_credential_store.mm new file mode 100644 index 0000000..8b625c4 --- /dev/null +++ b/ios/chrome/common/credential_provider/memory_credential_store.mm
@@ -0,0 +1,114 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/common/credential_provider/memory_credential_store.h" + +#include "base/check.h" +#include "base/mac/foundation_util.h" +#include "base/notreached.h" +#include "base/strings/sys_string_conversions.h" +#import "ios/chrome/common/credential_provider/archivable_credential.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface MemoryCredentialStore () + +// Working queue used to sync the mutable set operations. +@property(nonatomic) dispatch_queue_t workingQueue; + +// The in-memory storage. +@property(nonatomic, strong) + NSMutableDictionary<NSString*, ArchivableCredential*>* memoryStorage; + +@end + +@implementation MemoryCredentialStore + +#pragma mark - Public + +- (instancetype)init { + self = [super init]; + if (self) { + _workingQueue = dispatch_queue_create(nullptr, DISPATCH_QUEUE_CONCURRENT); + } + return self; +} + +#pragma mark - CredentialStore + +- (NSArray<id<Credential>>*)credentials { + __block NSArray<id<Credential>>* credentials; + dispatch_sync(self.workingQueue, ^{ + credentials = [self.memoryStorage allValues]; + }); + return credentials; +} + +- (void)saveDataWithCompletion:(void (^)(NSError* error))completion { + // No-op. + completion(nil); +} + +- (void)removeAllCredentials { + dispatch_barrier_async(self.workingQueue, ^{ + [self.memoryStorage removeAllObjects]; + }); +} + +- (void)addCredential:(id<Credential>)credential { + DCHECK(credential.recordIdentifier) + << "credential must have a record identifier"; + dispatch_barrier_async(self.workingQueue, ^{ + DCHECK(!self.memoryStorage[credential.recordIdentifier]) + << "Credential already exists in the storage"; + self.memoryStorage[credential.recordIdentifier] = + base::mac::ObjCCastStrict<ArchivableCredential>(credential); + }); +} + +- (void)updateCredential:(id<Credential>)credential { + [self removeCredentialWithRecordIdentifier:credential.recordIdentifier]; + [self addCredential:credential]; +} + +- (void)removeCredentialWithRecordIdentifier:(NSString*)recordIdentifier { + DCHECK(recordIdentifier.length) << "Invalid |recordIdentifier| was passed."; + dispatch_barrier_async(self.workingQueue, ^{ + DCHECK(self.memoryStorage[recordIdentifier]) + << "Credential doesn't exist in the storage"; + self.memoryStorage[recordIdentifier] = nil; + }); +} + +- (id<Credential>)credentialWithRecordIdentifier:(NSString*)recordIdentifier { + DCHECK(recordIdentifier.length); + __block id<Credential> credential; + dispatch_sync(self.workingQueue, ^{ + credential = self.memoryStorage[recordIdentifier]; + }); + return credential; +} + +#pragma mark - Getters + +- (NSMutableDictionary<NSString*, ArchivableCredential*>*)memoryStorage { +#if !defined(NDEBUG) + dispatch_assert_queue(self.workingQueue); +#endif // !defined(NDEBUG) + if (!_memoryStorage) { + _memoryStorage = [self loadStorage]; + } + return _memoryStorage; +} + +#pragma mark - Subclassing + +// Loads the store from disk. +- (NSMutableDictionary<NSString*, ArchivableCredential*>*)loadStorage { + return [[NSMutableDictionary alloc] init]; +} + +@end
diff --git a/ios/chrome/common/credential_provider/memory_credential_store_unittests.mm b/ios/chrome/common/credential_provider/memory_credential_store_unittests.mm new file mode 100644 index 0000000..ff35194 --- /dev/null +++ b/ios/chrome/common/credential_provider/memory_credential_store_unittests.mm
@@ -0,0 +1,82 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/common/credential_provider/memory_credential_store.h" + +#import "ios/chrome/common/credential_provider/archivable_credential.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +using MemoryCredentialStoreTest = PlatformTest; + +ArchivableCredential* TestCredential() { + return [[ArchivableCredential alloc] initWithFavicon:@"favicon" + keychainIdentifier:@"keychainIdentifier" + rank:5 + recordIdentifier:@"recordIdentifier" + serviceIdentifier:@"serviceIdentifier" + serviceName:@"serviceName" + user:@"user" + validationIdentifier:@"validationIdentifier"]; +} + +// Tests that an MemoryCredentialStore can be created. +TEST_F(MemoryCredentialStoreTest, create) { + MemoryCredentialStore* credentialStore = [[MemoryCredentialStore alloc] init]; + EXPECT_TRUE(credentialStore); + EXPECT_TRUE(credentialStore.credentials); +} + +// Tests that an MemoryCredentialStore can add a credential. +TEST_F(MemoryCredentialStoreTest, add) { + MemoryCredentialStore* credentialStore = [[MemoryCredentialStore alloc] init]; + EXPECT_TRUE(credentialStore); + [credentialStore addCredential:TestCredential()]; + EXPECT_EQ(1u, credentialStore.credentials.count); +} + +// Tests that an MemoryCredentialStore can update a credential. +TEST_F(MemoryCredentialStoreTest, update) { + MemoryCredentialStore* credentialStore = [[MemoryCredentialStore alloc] init]; + EXPECT_TRUE(credentialStore); + ArchivableCredential* credential = TestCredential(); + [credentialStore addCredential:credential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + + ArchivableCredential* updatedCredential = [[ArchivableCredential alloc] + initWithFavicon:@"other_favicon" + keychainIdentifier:@"other_keychainIdentifier" + rank:credential.rank + 10 + recordIdentifier:@"recordIdentifier" + serviceIdentifier:@"other_serviceIdentifier" + serviceName:@"other_serviceName" + user:@"other_user" + validationIdentifier:@"other_validationIdentifier"]; + + [credentialStore updateCredential:updatedCredential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + EXPECT_EQ(updatedCredential.rank, + credentialStore.credentials.firstObject.rank); +} + +// Tests that an MemoryCredentialStore can remove a credential. +TEST_F(MemoryCredentialStoreTest, remove) { + MemoryCredentialStore* credentialStore = [[MemoryCredentialStore alloc] init]; + EXPECT_TRUE(credentialStore); + ArchivableCredential* credential = TestCredential(); + [credentialStore addCredential:credential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + + [credentialStore + removeCredentialWithRecordIdentifier:credential.recordIdentifier]; + EXPECT_EQ(0u, credentialStore.credentials.count); +} + +}
diff --git a/ios/chrome/common/credential_provider/user_defaults_credential_store.h b/ios/chrome/common/credential_provider/user_defaults_credential_store.h new file mode 100644 index 0000000..029faf5a --- /dev/null +++ b/ios/chrome/common/credential_provider/user_defaults_credential_store.h
@@ -0,0 +1,25 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_USER_DEFAULTS_CREDENTIAL_STORE_H_ +#define IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_USER_DEFAULTS_CREDENTIAL_STORE_H_ + +#import "ios/chrome/common/credential_provider/memory_credential_store.h" + +// Credential store built on top of NSUserDefaults to persist data. Use +// |saveDataWithCompletion:| to update the data on disk. All operations will be +// held in memory until saved to disk, making it possible to batch multiple +// operations. +// +// Only supports |Credentials| of class |ArchivableCredential|. +@interface UserDefaultsCredentialStore : MemoryCredentialStore <CredentialStore> + +// Initializes the store. |userDefaults| is where the store will be persisted. +- (instancetype)initWithUserDefaults:(NSUserDefaults*)userDefaults + key:(NSString*)keyNS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + +@end + +#endif // IOS_CHROME_COMMON_CREDENTIAL_PROVIDER_USER_DEFAULTS_CREDENTIAL_STORE_H_
diff --git a/ios/chrome/common/credential_provider/user_defaults_credential_store.mm b/ios/chrome/common/credential_provider/user_defaults_credential_store.mm new file mode 100644 index 0000000..1eddca9 --- /dev/null +++ b/ios/chrome/common/credential_provider/user_defaults_credential_store.mm
@@ -0,0 +1,82 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/common/credential_provider/user_defaults_credential_store.h" + +#include "base/check.h" +#include "base/strings/sys_string_conversions.h" +#import "ios/chrome/common/credential_provider/archivable_credential.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface UserDefaultsCredentialStore () + +@property(nonatomic, strong) NSUserDefaults* userDefaults; +@property(nonatomic, copy) NSString* key; +@end + +@implementation UserDefaultsCredentialStore + +- (instancetype)initWithUserDefaults:(NSUserDefaults*)userDefaults + key:(NSString*)key { + self = [super init]; + if (self) { + _userDefaults = userDefaults; + _key = key; + } + return self; +} + +#pragma mark - CredentialStore + +- (void)saveDataWithCompletion:(void (^)(NSError* error))completion { + dispatch_barrier_async(self.workingQueue, ^{ + auto executeCompletionIfPresent = ^(NSError* error) { + if (completion) { + dispatch_async(dispatch_get_main_queue(), ^{ + completion(error); + }); + } + }; + + NSError* error = nil; + NSData* data = + [NSKeyedArchiver archivedDataWithRootObject:self.memoryStorage + requiringSecureCoding:YES + error:&error]; + DCHECK(!error) << base::SysNSStringToUTF8(error.description); + if (error) { + executeCompletionIfPresent(error); + return; + } + + [self.userDefaults setObject:data forKey:self.key]; + executeCompletionIfPresent(nil); + }); +} + +#pragma mark - Subclassing + +- (NSMutableDictionary<NSString*, ArchivableCredential*>*)loadStorage { +#if !defined(NDEBUG) + dispatch_assert_queue(self.workingQueue); +#endif // !defined(NDEBUG) + NSData* data = [self.userDefaults dataForKey:self.key]; + if (!data) { + return [[NSMutableDictionary alloc] init]; + } + NSError* error = nil; + NSSet* classes = [NSSet setWithObjects:[ArchivableCredential class], + [NSMutableDictionary class], nil]; + NSMutableDictionary<NSString*, ArchivableCredential*>* dictionary = + [NSKeyedUnarchiver unarchivedObjectOfClasses:classes + fromData:data + error:&error]; + DCHECK(!error) << base::SysNSStringToUTF8(error.description); + return dictionary; +} + +@end
diff --git a/ios/chrome/common/credential_provider/user_defaults_credential_store_unittests.mm b/ios/chrome/common/credential_provider/user_defaults_credential_store_unittests.mm new file mode 100644 index 0000000..d9cfb946 --- /dev/null +++ b/ios/chrome/common/credential_provider/user_defaults_credential_store_unittests.mm
@@ -0,0 +1,146 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/common/credential_provider/user_defaults_credential_store.h" + +#import "base/test/ios/wait_util.h" +#import "ios/chrome/common/credential_provider/archivable_credential.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +using base::test::ios::WaitUntilConditionOrTimeout; +using base::test::ios::kWaitForFileOperationTimeout; + +NSUserDefaults* TestUserDefaults() { + return [NSUserDefaults standardUserDefaults]; +} + +static NSString* kTestUserDefaultsKey = @"UserDefaultsCredentialStoreTestKey"; + +class UserDefaultsCredentialStoreTest : public PlatformTest { + protected: + void SetUp() override { + PlatformTest::SetUp(); + [TestUserDefaults() removeObjectForKey:kTestUserDefaultsKey]; + } + void TearDown() override { + PlatformTest::TearDown(); + [TestUserDefaults() removeObjectForKey:kTestUserDefaultsKey]; + } +}; + +ArchivableCredential* TestCredential() { + return [[ArchivableCredential alloc] initWithFavicon:@"favicon" + keychainIdentifier:@"keychainIdentifier" + rank:5 + recordIdentifier:@"recordIdentifier" + serviceIdentifier:@"serviceIdentifier" + serviceName:@"serviceName" + user:@"user" + validationIdentifier:@"validationIdentifier"]; +} + +// Tests that an UserDefaultsCredentialStore can be created. +TEST_F(UserDefaultsCredentialStoreTest, create) { + UserDefaultsCredentialStore* credentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(credentialStore); + EXPECT_TRUE(credentialStore.credentials); +} + +// Tests that an UserDefaultsCredentialStore can add a credential. +TEST_F(UserDefaultsCredentialStoreTest, add) { + UserDefaultsCredentialStore* credentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(credentialStore); + [credentialStore addCredential:TestCredential()]; + EXPECT_EQ(1u, credentialStore.credentials.count); +} + +// Tests that an UserDefaultsCredentialStore can update a credential. +TEST_F(UserDefaultsCredentialStoreTest, update) { + UserDefaultsCredentialStore* credentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(credentialStore); + ArchivableCredential* credential = TestCredential(); + [credentialStore addCredential:credential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + + ArchivableCredential* updatedCredential = [[ArchivableCredential alloc] + initWithFavicon:@"other_favicon" + keychainIdentifier:@"other_keychainIdentifier" + rank:credential.rank + 10 + recordIdentifier:@"recordIdentifier" + serviceIdentifier:@"other_serviceIdentifier" + serviceName:@"other_serviceName" + user:@"other_user" + validationIdentifier:@"other_validationIdentifier"]; + + [credentialStore updateCredential:updatedCredential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + EXPECT_EQ(updatedCredential.rank, + credentialStore.credentials.firstObject.rank); +} + +// Tests that an UserDefaultsCredentialStore can remove a credential. +TEST_F(UserDefaultsCredentialStoreTest, remove) { + UserDefaultsCredentialStore* credentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(credentialStore); + ArchivableCredential* credential = TestCredential(); + [credentialStore addCredential:credential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + + [credentialStore + removeCredentialWithRecordIdentifier:credential.recordIdentifier]; + EXPECT_EQ(0u, credentialStore.credentials.count); +} + +// Tests that UserDefaultsCredentialStore can save and retrieve data. +TEST_F(UserDefaultsCredentialStoreTest, persist) { + UserDefaultsCredentialStore* credentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(credentialStore); + + ArchivableCredential* credential = TestCredential(); + [credentialStore addCredential:credential]; + EXPECT_EQ(1u, credentialStore.credentials.count); + + __block BOOL blockWaitCompleted = false; + [credentialStore saveDataWithCompletion:^(NSError* error) { + EXPECT_FALSE(error); + blockWaitCompleted = true; + }]; + EXPECT_TRUE(WaitUntilConditionOrTimeout(kWaitForFileOperationTimeout, ^bool { + return blockWaitCompleted; + })); + + UserDefaultsCredentialStore* freshCredentialStore = + [[UserDefaultsCredentialStore alloc] + initWithUserDefaults:TestUserDefaults() + key:kTestUserDefaultsKey]; + EXPECT_TRUE(freshCredentialStore); + EXPECT_TRUE(freshCredentialStore.credentials); + EXPECT_EQ(1u, freshCredentialStore.credentials.count); + EXPECT_TRUE( + [credential isEqual:freshCredentialStore.credentials.firstObject]); +} + +}
diff --git a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_km.xtb b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_km.xtb index d9d1fa9..29548666 100644 --- a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_km.xtb +++ b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_km.xtb
@@ -15,6 +15,7 @@ <translation id="5366190986669335938">ចូលប្រើពាក្យសម្ងាត់ដែលអ្នករក្សាទុកនៅក្នុង Chrome ពីកម្មវិធីនានា។</translation> <translation id="579113627088729016">បើកការបំពេញស្វ័យប្រវត្តិ</translation> <translation id="5824290706342306555">ដើម្បីចាប់ផ្តើម សូមរក្សាទុកពាក្យសម្ងាត់មួយចំនួននៅក្នុង Chrome ឬចូលដោយប្រើគណនី Google របស់អ្នក។</translation> +<translation id="6734440856654324363">បញ្ចូលពាក្យសម្ងាត់ថ្មី</translation> <translation id="6965382102122355670">យល់ព្រម</translation> <translation id="6994951856208641136">ពាក្យសម្ងាត់ដែលបានណែនាំ</translation> <translation id="7013045517548357694">ចូលប្រើពាក្យសម្ងាត់...</translation>
diff --git a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_pa.xtb b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_pa.xtb index b94d16f..17adcb7 100644 --- a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_pa.xtb +++ b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_pa.xtb
@@ -15,6 +15,7 @@ <translation id="5366190986669335938">ਕਿਸੇ ਵੀ ਐਪ ਤੋਂ Chrome ਵਿੱਚ ਆਪਣੇ ਰੱਖਿਅਤ ਕੀਤੇ ਪਾਸਵਰਡਾਂ ਤੱਕ ਪਹੁੰਚ ਕਰੋ।</translation> <translation id="579113627088729016">ਆਟੋਫਿਲ ਨੂੰ ਚਾਲੂ ਕਰੋ</translation> <translation id="5824290706342306555">ਸ਼ੁਰੂਆਤ ਕਰਨ ਲਈ, ਕੁਝ ਪਾਸਵਰਡ Chrome ਵਿੱਚ ਰੱਖਿਅਤ ਕਰੋ ਜਾਂ ਆਪਣੇ Google ਖਾਤੇ ਨਾਲ ਸਾਈਨ-ਇਨ ਕਰੋ।</translation> +<translation id="6734440856654324363">ਨਵਾਂ ਪਾਸਵਰਡ ਸ਼ਾਮਲ ਕਰੋ</translation> <translation id="6965382102122355670">ਠੀਕ</translation> <translation id="6994951856208641136">ਸੁਝਾਇਆ ਗਿਆ ਪਾਸਵਰਡ</translation> <translation id="7013045517548357694">ਪਾਸਵਰਡਾਂ ਤੱਕ ਪਹੁੰਚ ਕਰੋ...</translation>
diff --git a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_sq.xtb b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_sq.xtb index 1270821..a83bebc 100644 --- a/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_sq.xtb +++ b/ios/chrome/credential_provider_extension/strings/resources/ios_credential_provider_extension_strings_sq.xtb
@@ -15,6 +15,7 @@ <translation id="5366190986669335938">Qasu në fjalëkalimet që ruan në Chrome nga çdo aplikacion.</translation> <translation id="579113627088729016">Aktivizo "Plotësimin automatik"</translation> <translation id="5824290706342306555">Për të filluar, ruaj disa fjalëkalime në Chrome ose identifikohu me "Llogarinë tënde të Google".</translation> +<translation id="6734440856654324363">Shto fjalëkalim të ri</translation> <translation id="6965382102122355670">Në rregull</translation> <translation id="6994951856208641136">Fjalëkalimi i sugjeruar</translation> <translation id="7013045517548357694">Qasu te fjalëkalimet...</translation>
diff --git a/ios/chrome/test/earl_grey/chrome_matchers.h b/ios/chrome/test/earl_grey/chrome_matchers.h index 380513e..4da1161f 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers.h +++ b/ios/chrome/test/earl_grey/chrome_matchers.h
@@ -593,6 +593,17 @@ // Returns a matcher for the button to accept the generated password. id<GREYMatcher> UseSuggestedPasswordMatcher(); +#pragma mark - Tab Grid Edit Mode + +// Returns a matcher for the button to enter the tab grid tab edit mode. +id<GREYMatcher> TabGridEditButton(); + +// Returns a matcher for the button to close the selected tabs. +id<GREYMatcher> TabGridEditCloseTabsButton(); + +// Returns a matcher for the button to select all tabs. +id<GREYMatcher> TabGridEditSelectAllButton(); + } // namespace chrome_test_util #endif // IOS_CHROME_TEST_EARL_GREY_CHROME_MATCHERS_H_
diff --git a/ios/chrome/test/earl_grey/chrome_matchers.mm b/ios/chrome/test/earl_grey/chrome_matchers.mm index 7e80c97..42cc08d 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers.mm +++ b/ios/chrome/test/earl_grey/chrome_matchers.mm
@@ -751,4 +751,18 @@ return [ChromeMatchersAppInterface useSuggestedPasswordMatcher]; } +#pragma mark - Tab Grid Edit Mode + +id<GREYMatcher> TabGridEditButton() { + return [ChromeMatchersAppInterface tabGridEditButton]; +} + +id<GREYMatcher> TabGridEditCloseTabsButton() { + return [ChromeMatchersAppInterface tabGridEditCloseTabsButton]; +} + +id<GREYMatcher> TabGridEditSelectAllButton() { + return [ChromeMatchersAppInterface tabGridEditSelectAllButton]; +} + } // namespace chrome_test_util
diff --git a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h index 1c6d0f5e..0a7563e3 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h +++ b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.h
@@ -585,6 +585,17 @@ // Returns a matcher for the button to accept the generated password. + (id<GREYMatcher>)useSuggestedPasswordMatcher; +#pragma mark - Tab Grid Edit Mode + +// Returns a matcher for the button to enter the tab grid tab edit mode. ++ (id<GREYMatcher>)tabGridEditButton; + +// Returns a matcher for the button to close the selected tabs. ++ (id<GREYMatcher>)tabGridEditCloseTabsButton; + +// Returns a matcher for the button to select all tabs. ++ (id<GREYMatcher>)tabGridEditSelectAllButton; + @end #endif // IOS_CHROME_TEST_EARL_GREY_CHROME_MATCHERS_APP_INTERFACE_H_
diff --git a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm index 634bf9c..4ca0f1d 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm +++ b/ios/chrome/test/earl_grey/chrome_matchers_app_interface.mm
@@ -1134,4 +1134,20 @@ grey_interactable(), nullptr); } +#pragma mark - Tab Grid Edit Mode ++ (id<GREYMatcher>)tabGridEditButton { + return grey_allOf(grey_accessibilityID(kTabGridEditButtonIdentifier), + grey_sufficientlyVisible(), nil); +} + ++ (id<GREYMatcher>)tabGridEditCloseTabsButton { + return grey_allOf(grey_accessibilityID(kTabGridEditCloseTabsButtonIdentifier), + grey_sufficientlyVisible(), nil); +} + ++ (id<GREYMatcher>)tabGridEditSelectAllButton { + return grey_allOf(grey_accessibilityID(kTabGridEditSelectAllButtonIdentifier), + grey_sufficientlyVisible(), nil); +} + @end
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 index 40a4b45..787e5af 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -1cae5a1f6d3a14c66d319ecbf11192c3194cc0d6 \ No newline at end of file +cc5afdfbc405b286f4667d9101be7053af5eda37 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 index a420a26..dbc77cd 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -6eaea5dd8332ea2d664da7b75bca897b9954777c \ No newline at end of file +111271ab6383f94b4391967a88f27ddd0c5b8a75 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 index 30ab9f4..c7931986 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -b3a03b4035fb1aab11f2d5c468e5f23b00ed9c5d \ No newline at end of file +5d13e5ecd5a6e12e0274c88ad0203e0e7164528f \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 index ade592ac..44492e7 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -e2fc3c90562f2508f38342b779b922f7cc783d17 \ No newline at end of file +6d90941e3d1710a129089d9d9d141da00bdf0866 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 index 2d8489d2..0bf020f8 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -b4a27b794cfac14df8cc054902123f6a3173e8ed \ No newline at end of file +f6590db1f0b744de62fcd37158cb327d9524409d \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 index 94768d8..3e66998 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -f102d51fbbca0654b326cdcf1ff9285be8428418 \ No newline at end of file +ab34484609b3e4be0fcb92ec20bf4548d9496161 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 index 12b161d..722fffc 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -a4b446c888af30f38d694b9ac7c0c9d5a9d6bab6 \ No newline at end of file +40d56131b31e82e3ad3e8976ac224794107017bd \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 index a355938..29672cf 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -fbcca2f0743cb5b2fa774ebe2d788b1e4efc870d \ No newline at end of file +aa439776cc4d22b6e7e94d6d43ca358a6509a820 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 index c8495fd5..b1cd0bf 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -02d1c168a485b9081db2466521b72f8d76028d3d \ No newline at end of file +487e4b038a5a644a1e50d3677a19fb5b6c783ead \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 index 9a320e4..624cb0e 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -a768138a900df031768e78cd25e6bd9cfc75297d \ No newline at end of file +e70d6e349b98c3c162a2e510d2d300f58d1a9943 \ No newline at end of file
diff --git a/ios/public/provider/chrome/browser/signin/BUILD.gn b/ios/public/provider/chrome/browser/signin/BUILD.gn index 6d26013..aa80521 100644 --- a/ios/public/provider/chrome/browser/signin/BUILD.gn +++ b/ios/public/provider/chrome/browser/signin/BUILD.gn
@@ -83,10 +83,15 @@ source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ "chrome_trusted_vault_service_unittest.mm" ] + sources = [ + "chrome_identity_service_unittest.mm", + "chrome_trusted_vault_service_unittest.mm", + ] deps = [ + ":fake_chrome_identity", ":signin", "//base", + "//base/test:test_support", "//testing/gmock", "//testing/gtest", ]
diff --git a/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm b/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm index 82d2782..e7b795f 100644 --- a/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm +++ b/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm
@@ -4,6 +4,7 @@ #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" +#include "base/metrics/histogram_functions.h" #include "base/strings/sys_string_conversions.h" #import "components/signin/internal/identity_manager/account_capabilities_constants.h" #include "google_apis/gaia/gaia_auth_util.h" @@ -212,9 +213,13 @@ CapabilitiesCallback completion) { NSString* canOfferExtendedChromeSyncPromos = [NSString stringWithUTF8String:kCanOfferExtendedChromeSyncPromosCapabilityName]; + base::TimeTicks fetch_start = base::TimeTicks::Now(); FetchCapabilities( @[ canOfferExtendedChromeSyncPromos ], identity, ^(NSDictionary<NSString*, NSNumber*>* capabilities, NSError* error) { + base::UmaHistogramTimes( + "Signin.AccountCapabilities.GetFromSystemLibraryDuration", + base::TimeTicks::Now() - fetch_start); if (!completion) { return; }
diff --git a/ios/public/provider/chrome/browser/signin/chrome_identity_service_unittest.mm b/ios/public/provider/chrome/browser/signin/chrome_identity_service_unittest.mm new file mode 100644 index 0000000..373d8a6 --- /dev/null +++ b/ios/public/provider/chrome/browser/signin/chrome_identity_service_unittest.mm
@@ -0,0 +1,129 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" + +#include "base/run_loop.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_mock_clock_override.h" +#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" +#import "testing/gmock/include/gmock/gmock.h" +#import "testing/gtest/include/gtest/gtest.h" +#include "testing/gtest_mac.h" +#import "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace ios { +namespace { + +class TestChromeIdentityService : public ChromeIdentityService { + public: + struct FetchCapabilitiesRequest { + NSArray* capabilities; + ChromeIdentity* identity; + ChromeIdentityCapabilitiesFetchCompletionBlock completion; + }; + + TestChromeIdentityService() = default; + ~TestChromeIdentityService() override = default; + + const FetchCapabilitiesRequest& fetch_capabilities_request() const { + return fetch_capabilities_request_.value(); + } + + void RunFinishCapabilitiesCompletion(NSDictionary* capabilities, + NSError* error) { + EXPECT_TRUE(fetch_capabilities_request_.has_value()); + EXPECT_TRUE(fetch_capabilities_request_.value().completion); + fetch_capabilities_request_.value().completion(capabilities, error); + fetch_capabilities_request_.reset(); + } + + protected: + void FetchCapabilities( + NSArray* capabilities, + ChromeIdentity* identity, + ChromeIdentityCapabilitiesFetchCompletionBlock completion) override { + EXPECT_FALSE(fetch_capabilities_request_.has_value()); + FetchCapabilitiesRequest request; + request.capabilities = capabilities; + request.identity = identity; + request.completion = completion; + fetch_capabilities_request_ = request; + } + + private: + absl::optional<FetchCapabilitiesRequest> fetch_capabilities_request_; +}; + +class ChromeIdentityServiceTest : public PlatformTest { + public: + ChromeIdentityServiceTest() = default; + ~ChromeIdentityServiceTest() override = default; + + protected: + ChromeIdentityCapabilityResult FetchCanOfferExtendedSyncPromos( + ChromeIdentity* identity, + int capability_value) { + __block ChromeIdentityCapabilityResult fetched_capability_result; + service_.CanOfferExtendedSyncPromos( + identity, ^(ChromeIdentityCapabilityResult result) { + fetched_capability_result = result; + }); + EXPECT_NSEQ(@[ @"accountcapabilities/gi2tklldmfya" ], + service_.fetch_capabilities_request().capabilities); + EXPECT_EQ(identity, service_.fetch_capabilities_request().identity); + + NSNumber* capability_val_number = [NSNumber numberWithInt:capability_value]; + service_.RunFinishCapabilitiesCompletion( + @{@"accountcapabilities/gi2tklldmfya" : capability_val_number}, + /*error=*/nil); + return fetched_capability_result; + } + + TestChromeIdentityService service_; +}; + +TEST_F(ChromeIdentityServiceTest, CanOfferExtendedSyncPromos) { + FakeChromeIdentity* identity = + [FakeChromeIdentity identityWithEmail:@"foo@bar.com" + gaiaID:@"foo_bar_id" + name:@"Foo"]; + + EXPECT_EQ(ChromeIdentityCapabilityResult::kFalse, + FetchCanOfferExtendedSyncPromos(identity, + /*capability_value=*/0)); + + EXPECT_EQ(ChromeIdentityCapabilityResult::kTrue, + FetchCanOfferExtendedSyncPromos(identity, + /*capability_value=*/1)); + + EXPECT_EQ(ChromeIdentityCapabilityResult::kUnknown, + FetchCanOfferExtendedSyncPromos(identity, + /*capability_value=*/2)); +} + +TEST_F(ChromeIdentityServiceTest, CanOfferExtendedSyncPromos_Histogram) { + FakeChromeIdentity* identity = + [FakeChromeIdentity identityWithEmail:@"foo@bar.com" + gaiaID:@"foo_bar_id" + name:@"Foo"]; + + base::HistogramTester histogramTester; + base::ScopedMockClockOverride clock; + service_.CanOfferExtendedSyncPromos(identity, /*callback=*/nil); + clock.Advance(base::TimeDelta::FromMinutes(1)); + service_.RunFinishCapabilitiesCompletion( + @{@"accountcapabilities/gi2tklldmfya" : @0}, /*error=*/nil); + histogramTester.ExpectUniqueTimeSample( + "Signin.AccountCapabilities.GetFromSystemLibraryDuration", + base::TimeDelta::FromMinutes(1), + /*expected_bucket_count=*/1); +} + +} // namespace +} // namespace ios
diff --git a/mojo/public/js/lib/codec.js b/mojo/public/js/lib/codec.js index 2925eb7..d83af26 100644 --- a/mojo/public/js/lib/codec.js +++ b/mojo/public/js/lib/codec.js
@@ -876,7 +876,7 @@ Enum.prototype.decode = function(decoder) { let value = decoder.readInt32(); - return cls.toKnownEnumValue(value); + return this.cls.toKnownEnumValue(value); }; Enum.prototype.encode = function(encoder, val) {
diff --git a/net/der/parser.h b/net/der/parser.h index 7c8e24b..fc372e6 100644 --- a/net/der/parser.h +++ b/net/der/parser.h
@@ -97,6 +97,9 @@ // the Parser object. explicit Parser(const Input& input); + Parser(const Parser&) = default; + Parser& operator=(const Parser&) = default; + // Returns whether there is any more data left in the input to parse. This // does not guarantee that the data is parseable. bool HasMore(); @@ -206,8 +209,6 @@ private: CBS cbs_; size_t advance_len_; - - DISALLOW_COPY(Parser); }; } // namespace der
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index 10d02bb..843df86 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc
@@ -134,6 +134,15 @@ return params; } +base::Value AuthHandleChallengeEndParams(const HttpAuthController& controller, + int net_error) { + base::Value params(base::Value::Type::DICTIONARY); + params.SetIntKey("net_error", net_error); + params.SetBoolKey("has_handler", controller.HaveAuthHandler()); + params.SetBoolKey("has_valid_identity", controller.HaveValidIdentity()); + return params; +} + } // namespace HttpAuthController::HttpAuthController( @@ -341,14 +350,18 @@ // We are establishing a tunnel, we can't show the error page because an // active network attacker could control its contents. Instead, we just // fail to establish the tunnel. - DCHECK(target_ == HttpAuth::AUTH_PROXY); - net_log_.EndEventWithNetErrorCode( - NetLogEventType::AUTH_HANDLE_CHALLENGE, ERR_PROXY_AUTH_UNSUPPORTED); + DCHECK_EQ(target_, HttpAuth::AUTH_PROXY); + net_log_.EndEvent(NetLogEventType::AUTH_HANDLE_CHALLENGE, [this] { + return AuthHandleChallengeEndParams(*this, + ERR_PROXY_AUTH_UNSUPPORTED); + }); return ERR_PROXY_AUTH_UNSUPPORTED; } // We found no supported challenge -- let the transaction continue so we // end up displaying the error page. - net_log_.EndEvent(NetLogEventType::AUTH_HANDLE_CHALLENGE); + net_log_.EndEvent(NetLogEventType::AUTH_HANDLE_CHALLENGE, [this] { + return AuthHandleChallengeEndParams(*this, OK); + }); return OK; } @@ -382,7 +395,8 @@ // TODO(asanka): Instead we should create a priority list of // <handler,identity> and iterate through that. } while(!handler_.get()); - net_log_.EndEvent(NetLogEventType::AUTH_HANDLE_CHALLENGE); + net_log_.EndEvent(NetLogEventType::AUTH_HANDLE_CHALLENGE, + [this] { return AuthHandleChallengeEndParams(*this, OK); }); return OK; } @@ -437,6 +451,10 @@ return handler_.get() && !identity_.invalid; } +bool HttpAuthController::HaveValidIdentity() const { + return !identity_.invalid; +} + bool HttpAuthController::NeedsHTTP11() const { return handler_ && handler_->is_connection_based(); }
diff --git a/net/http/http_auth_controller.h b/net/http/http_auth_controller.h index 1a3bac97..5f2f374 100644 --- a/net/http/http_auth_controller.h +++ b/net/http/http_auth_controller.h
@@ -118,6 +118,8 @@ bool HaveAuth() const; + bool HaveValidIdentity() const; + // Return whether the authentication scheme is incompatible with HTTP/2 // and thus the server would presumably reject a request on HTTP/2 anyway. bool NeedsHTTP11() const;
diff --git a/net/log/net_log_event_type_list.h b/net/log/net_log_event_type_list.h index 70dfb8b..3bb6386a 100644 --- a/net/log/net_log_event_type_list.h +++ b/net/log/net_log_event_type_list.h
@@ -2674,6 +2674,13 @@ // "different_realm" depending on the outcome of // the handling the challenge> // } +// +// The END phase has the following parameters: +// { +// "net_error": <The error code.> +// "has_handle": <Whether it has an auth handler.> +// "has_valid_identity": <Whether it has a valid identity.> +// } EVENT_TYPE(AUTH_HANDLE_CHALLENGE) // An attempt was made to load an authentication library.
diff --git a/net/test/gtest_util.h b/net/test/gtest_util.h index af85292..ea1ef86 100644 --- a/net/test/gtest_util.h +++ b/net/test/gtest_util.h
@@ -48,6 +48,9 @@ public: explicit StringPieceHasSubstrMatcher(const std::string& substring) : substring_(substring) {} + StringPieceHasSubstrMatcher(const StringPieceHasSubstrMatcher&) = default; + StringPieceHasSubstrMatcher& operator=(const StringPieceHasSubstrMatcher&) = + default; bool MatchAndExplain(base::StringPiece s, ::testing::MatchResultListener* listener) const { @@ -64,9 +67,7 @@ } private: - const std::string substring_; - - DISALLOW_ASSIGN(StringPieceHasSubstrMatcher); + std::string substring_; }; // Internal implementation for the EXPECT_DFATAL and ASSERT_DFATAL
diff --git a/remoting/test/BUILD.gn b/remoting/test/BUILD.gn index 52a0ee34..c7d04aab 100644 --- a/remoting/test/BUILD.gn +++ b/remoting/test/BUILD.gn
@@ -70,7 +70,6 @@ "//skia", "//testing/gmock", "//testing/gtest", - "//third_party/webrtc_overrides:webrtc_component", ] } @@ -101,6 +100,7 @@ ] deps = [ ":test_support", + "//extensions/browser/api/messaging:native_messaging", "//mojo/core/embedder", "//remoting/base", "//remoting/base:authorization",
diff --git a/sandbox/policy/features.cc b/sandbox/policy/features.cc index 5b91dda..8ba5f50 100644 --- a/sandbox/policy/features.cc +++ b/sandbox/policy/features.cc
@@ -24,10 +24,10 @@ const base::Feature kWinSboxDisableKtmComponent{ "WinSboxDisableKtmComponent", base::FEATURE_ENABLED_BY_DEFAULT}; -// Experiment for Windows sandbox security mitigation, +// Emergency "off switch" for new Windows sandbox security mitigation, // sandbox::MITIGATION_EXTENSION_POINT_DISABLE. const base::Feature kWinSboxDisableExtensionPoints{ - "WinSboxDisableExtensionPoint", base::FEATURE_DISABLED_BY_DEFAULT}; + "WinSboxDisableExtensionPoint", base::FEATURE_ENABLED_BY_DEFAULT}; // Enables GPU AppContainer sandbox on Windows. const base::Feature kGpuAppContainer{"GpuAppContainer",
diff --git a/services/preferences/public/cpp/dictionary_value_update.cc b/services/preferences/public/cpp/dictionary_value_update.cc index d6b3efd..978d09d4 100644 --- a/services/preferences/public/cpp/dictionary_value_update.cc +++ b/services/preferences/public/cpp/dictionary_value_update.cc
@@ -10,6 +10,7 @@ #include "base/strings/string_piece.h" #include "base/strings/string_split.h" +#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -222,13 +223,23 @@ bool DictionaryValueUpdate::GetStringWithoutPathExpansion( base::StringPiece key, std::string* out_value) const { - return value_->GetStringWithoutPathExpansion(key, out_value); + std::string* value = value_->FindStringKey(key); + if (!value) + return false; + + *out_value = *value; + return true; } bool DictionaryValueUpdate::GetStringWithoutPathExpansion( base::StringPiece key, std::u16string* out_value) const { - return value_->GetStringWithoutPathExpansion(key, out_value); + std::string* value = value_->FindStringKey(key); + if (!value) + return false; + + *out_value = base::UTF8ToUTF16(*value); + return true; } bool DictionaryValueUpdate::GetDictionaryWithoutPathExpansion(
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index afb13b8..572b8a1e 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -5125,7 +5125,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5211,7 +5211,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5383,7 +5383,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5469,7 +5469,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index fdbfeb7..d77650a 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -53730,7 +53730,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -53817,7 +53817,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -53991,7 +53991,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54078,7 +54078,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54324,7 +54324,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54410,7 +54410,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54582,7 +54582,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54668,7 +54668,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -54914,7 +54914,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -55000,7 +55000,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -55172,7 +55172,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M91", - "revision": "version:91.0.4472.154" + "revision": "version:91.0.4472.155" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -55258,7 +55258,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M92", - "revision": "version:92.0.4515.86" + "revision": "version:92.0.4515.87" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/filters/e2e.sync_integration_tests.filter b/testing/buildbot/filters/e2e.sync_integration_tests.filter index 1f95267..0a825777 100644 --- a/testing/buildbot/filters/e2e.sync_integration_tests.filter +++ b/testing/buildbot/filters/e2e.sync_integration_tests.filter
@@ -4,5 +4,4 @@ -TwoClientDictionarySyncTest.Sanity_E2ETest # TODO(crbug.com/1205316): Flaky. --All/TwoClientPasswordsSyncTest.SetPassphraseAndAddPassword_E2ETest/0 --All/TwoClientPasswordsSyncTest.SetPassphraseAndAddPassword_E2ETest/1 +-TwoClientPasswordsSyncTest.SetPassphraseAndAddPassword_E2ETest
diff --git a/testing/buildbot/filters/linux-lacros.browser_tests.filter b/testing/buildbot/filters/linux-lacros.browser_tests.filter index c3a7626..4b035bf 100644 --- a/testing/buildbot/filters/linux-lacros.browser_tests.filter +++ b/testing/buildbot/filters/linux-lacros.browser_tests.filter
@@ -119,8 +119,8 @@ -OutOfProcessPPAPITest.NetAddress -OutOfProcessPPAPITest.Printing -OutOfProcessPPAPITest.URLRequest_CreateAndIsURLRequestInfo --PageInfoBubbleViewBrowserTest.FocusDoesNotReturnToContentsOnReloadPrompt --PageInfoBubbleViewBrowserTest.FocusReturnsToContentOnClose +-All/PageInfoBubbleViewBrowserTest.FocusDoesNotReturnToContentsOnReloadPrompt/* +-All/PageInfoBubbleViewBrowserTest.FocusReturnsToContentOnClose/* -PageLoadMetricsBrowserTest.MainFrameIntersectionsMainFrame -PaymentRequestCompletionStatusMetricsTest.UserAborted_TabClosed -PaymentRequestCreditCardEditorTest.EditingExpiredCard
diff --git a/testing/buildbot/filters/ozone-linux.wayland_browser_tests.filter b/testing/buildbot/filters/ozone-linux.wayland_browser_tests.filter index f1d4897..9a73611 100644 --- a/testing/buildbot/filters/ozone-linux.wayland_browser_tests.filter +++ b/testing/buildbot/filters/ozone-linux.wayland_browser_tests.filter
@@ -33,8 +33,8 @@ -BrowserViewTest.GetAccessibleTabModalDialogTree -OmniboxPopupContentsViewTest.ClickOmnibox -OmniboxPopupContentsViewTest.PopupMatchesLocationBarBackground --PageInfoBubbleViewBrowserTest.FocusDoesNotReturnToContentsOnReloadPrompt --PageInfoBubbleViewBrowserTest.FocusReturnsToContentOnClose +-All/PageInfoBubbleViewBrowserTest.FocusDoesNotReturnToContentsOnReloadPrompt/* +-All/PageInfoBubbleViewBrowserTest.FocusReturnsToContentOnClose/* -PrintBrowserTest.PDFPluginNotKeyboardFocusable # These tests fail when run either with weston's test-plugin module or with
diff --git a/testing/buildbot/filters/pixel_browser_tests.filter b/testing/buildbot/filters/pixel_browser_tests.filter index dc37632b..14f59cb2 100644 --- a/testing/buildbot/filters/pixel_browser_tests.filter +++ b/testing/buildbot/filters/pixel_browser_tests.filter
@@ -18,7 +18,7 @@ ImportLockDialogViewBrowserTest.* OneTimePermissionPromptBubbleViewBrowserTest.* OutdatedUpgradeBubbleTest.* -PageInfoBubbleViewDialogBrowserTest.* +All/PageInfoBubbleViewDialogBrowserTest.* PasswordReuseModalWarningTest.* PermissionChipBrowserTest.* All/PermissionPromptBubbleViewBrowserTest.*
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index f3fd9f7..dcd5306 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -416,7 +416,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M92', - 'revision': 'version:92.0.4515.86', + 'revision': 'version:92.0.4515.87', } ], }, @@ -440,7 +440,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.154', + 'revision': 'version:91.0.4472.155', } ], }, @@ -488,7 +488,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M92', - 'revision': 'version:92.0.4515.86', + 'revision': 'version:92.0.4515.87', } ], }, @@ -512,7 +512,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.154', + 'revision': 'version:91.0.4472.155', } ], }, @@ -560,7 +560,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M92', - 'revision': 'version:92.0.4515.86', + 'revision': 'version:92.0.4515.87', } ], }, @@ -584,7 +584,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M91', - 'revision': 'version:91.0.4472.154', + 'revision': 'version:91.0.4472.155', } ], },
diff --git a/third_party/blink/common/permissions_policy/policy_value.cc b/third_party/blink/common/permissions_policy/policy_value.cc index 84e5b826..c2b1e1a 100644 --- a/third_party/blink/common/permissions_policy/policy_value.cc +++ b/third_party/blink/common/permissions_policy/policy_value.cc
@@ -10,6 +10,10 @@ PolicyValue::PolicyValue() : type_(mojom::PolicyValueType::kNull) {} +PolicyValue::PolicyValue(const PolicyValue&) = default; + +PolicyValue& PolicyValue::operator=(const PolicyValue&) = default; + // static PolicyValue PolicyValue::CreateBool(bool value) { return PolicyValue(value); @@ -82,16 +86,6 @@ int_value_ = int_value; } -PolicyValue& PolicyValue::operator=(const PolicyValue& rhs) { - if (this != &rhs) { - type_ = rhs.type_; - bool_value_ = rhs.bool_value_; - double_value_ = rhs.double_value_; - int_value_ = rhs.int_value_; - } - return *this; -} - bool operator==(const PolicyValue& lhs, const PolicyValue& rhs) { if (lhs.Type() != rhs.Type()) return false;
diff --git a/third_party/blink/common/scheduler/web_scheduler_tracked_feature.cc b/third_party/blink/common/scheduler/web_scheduler_tracked_feature.cc index ad692d4..475ce15 100644 --- a/third_party/blink/common/scheduler/web_scheduler_tracked_feature.cc +++ b/third_party/blink/common/scheduler/web_scheduler_tracked_feature.cc
@@ -167,47 +167,38 @@ } bool IsFeatureSticky(WebSchedulerTrackedFeature feature) { - return (FeatureToBit(feature) & StickyFeaturesBitmask()) > 0; + return StickyFeatures().Has(feature); } -uint64_t StickyFeaturesBitmask() { - return FeatureToBit( - WebSchedulerTrackedFeature::kMainResourceHasCacheControlNoStore) | - FeatureToBit( - WebSchedulerTrackedFeature::kMainResourceHasCacheControlNoCache) | - FeatureToBit( - WebSchedulerTrackedFeature::kSubresourceHasCacheControlNoStore) | - FeatureToBit( - WebSchedulerTrackedFeature::kSubresourceHasCacheControlNoCache) | - FeatureToBit(WebSchedulerTrackedFeature::kContainsPlugins) | - FeatureToBit(WebSchedulerTrackedFeature::kDocumentLoaded) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedGeolocationPermission) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedNotificationsPermission) | - FeatureToBit(WebSchedulerTrackedFeature::kRequestedMIDIPermission) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedAudioCapturePermission) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedVideoCapturePermission) | - FeatureToBit(WebSchedulerTrackedFeature:: - kRequestedBackForwardCacheBlockedSensors) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedBackgroundWorkPermission) | - FeatureToBit(WebSchedulerTrackedFeature::kWebLocks) | - FeatureToBit( - WebSchedulerTrackedFeature::kRequestedStorageAccessGrant) | - FeatureToBit(WebSchedulerTrackedFeature::kWebNfc) | - FeatureToBit(WebSchedulerTrackedFeature::kWebFileSystem) | - FeatureToBit(WebSchedulerTrackedFeature::kAppBanner) | - FeatureToBit(WebSchedulerTrackedFeature::kPrinting) | - FeatureToBit(WebSchedulerTrackedFeature::kPictureInPicture) | - FeatureToBit(WebSchedulerTrackedFeature::kIdleManager) | - FeatureToBit(WebSchedulerTrackedFeature::kPaymentManager) | - FeatureToBit(WebSchedulerTrackedFeature::kKeyboardLock) | - FeatureToBit(WebSchedulerTrackedFeature::kWebOTPService) | - FeatureToBit(WebSchedulerTrackedFeature::kIsolatedWorldScript) | - FeatureToBit(WebSchedulerTrackedFeature::kInjectedStyleSheet); +WebSchedulerTrackedFeatures StickyFeatures() { + constexpr WebSchedulerTrackedFeatures features = WebSchedulerTrackedFeatures( + WebSchedulerTrackedFeature::kMainResourceHasCacheControlNoStore, + WebSchedulerTrackedFeature::kMainResourceHasCacheControlNoCache, + WebSchedulerTrackedFeature::kSubresourceHasCacheControlNoStore, + WebSchedulerTrackedFeature::kSubresourceHasCacheControlNoCache, + WebSchedulerTrackedFeature::kContainsPlugins, + WebSchedulerTrackedFeature::kDocumentLoaded, + WebSchedulerTrackedFeature::kRequestedGeolocationPermission, + WebSchedulerTrackedFeature::kRequestedNotificationsPermission, + WebSchedulerTrackedFeature::kRequestedMIDIPermission, + WebSchedulerTrackedFeature::kRequestedAudioCapturePermission, + WebSchedulerTrackedFeature::kRequestedVideoCapturePermission, + WebSchedulerTrackedFeature::kRequestedBackForwardCacheBlockedSensors, + WebSchedulerTrackedFeature::kRequestedBackgroundWorkPermission, + WebSchedulerTrackedFeature::kWebLocks, + WebSchedulerTrackedFeature::kRequestedStorageAccessGrant, + WebSchedulerTrackedFeature::kWebNfc, + WebSchedulerTrackedFeature::kWebFileSystem, + WebSchedulerTrackedFeature::kAppBanner, + WebSchedulerTrackedFeature::kPrinting, + WebSchedulerTrackedFeature::kPictureInPicture, + WebSchedulerTrackedFeature::kIdleManager, + WebSchedulerTrackedFeature::kPaymentManager, + WebSchedulerTrackedFeature::kKeyboardLock, + WebSchedulerTrackedFeature::kWebOTPService, + WebSchedulerTrackedFeature::kIsolatedWorldScript, + WebSchedulerTrackedFeature::kInjectedStyleSheet); + return features; } } // namespace scheduler
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index 99702f7..c30c44d 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -223,6 +223,7 @@ ] public_deps = [ + "//base/util/enum_set", "//mojo/public/cpp/bindings", "//services/metrics/public/cpp:metrics_cpp", "//services/network/public/cpp:cpp",
diff --git a/third_party/blink/public/common/mobile_metrics/mobile_friendliness.h b/third_party/blink/public/common/mobile_metrics/mobile_friendliness.h index 9b83e20..cb62777 100644 --- a/third_party/blink/public/common/mobile_metrics/mobile_friendliness.h +++ b/third_party/blink/public/common/mobile_metrics/mobile_friendliness.h
@@ -15,6 +15,7 @@ struct BLINK_COMMON_EXPORT MobileFriendliness { MobileFriendliness() = default; MobileFriendliness(const MobileFriendliness&) = default; + MobileFriendliness& operator=(const MobileFriendliness&) = default; bool operator==(const MobileFriendliness& other) const; bool operator!=(const MobileFriendliness& other) const {
diff --git a/third_party/blink/public/common/permissions_policy/policy_value.h b/third_party/blink/public/common/permissions_policy/policy_value.h index 81e32d6..f6edcf5 100644 --- a/third_party/blink/public/common/permissions_policy/policy_value.h +++ b/third_party/blink/public/common/permissions_policy/policy_value.h
@@ -20,6 +20,8 @@ class BLINK_COMMON_EXPORT PolicyValue { public: PolicyValue(); + PolicyValue(const PolicyValue&); + PolicyValue& operator=(const PolicyValue&); static PolicyValue CreateBool(bool); static PolicyValue CreateDecDouble(double); @@ -45,9 +47,6 @@ void SetDoubleValue(double double_value); void SetIntValue(int32_t int_value); - // Operater overrides - PolicyValue& operator=(const PolicyValue& rhs); - void SetToMax(); void SetToMin();
diff --git a/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h b/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h index da0e3ca..29b24181 100644 --- a/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h +++ b/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h
@@ -7,6 +7,7 @@ #include <stdint.h> #include <string> +#include "base/util/enum_set/enum_set.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/common_export.h" @@ -20,6 +21,7 @@ // Please keep in sync with WebSchedulerTrackedFeature in // tools/metrics/histograms/enums.xml. These values should not be renumbered. enum class WebSchedulerTrackedFeature : uint32_t { + kMinValue = 0, kWebSocket = 0, kWebRTC = 1, @@ -109,6 +111,11 @@ kMaxValue = kMediaSessionImplOnServiceCreated, }; +using WebSchedulerTrackedFeatures = + base::util::EnumSet<WebSchedulerTrackedFeature, + WebSchedulerTrackedFeature::kMinValue, + WebSchedulerTrackedFeature::kMaxValue>; + static_assert(static_cast<uint32_t>(WebSchedulerTrackedFeature::kMaxValue) < 64, "This enum is used in a bitmask, so the values should fit into a" "64-bit integer"); @@ -129,8 +136,8 @@ // lifetime of the page. BLINK_COMMON_EXPORT bool IsFeatureSticky(WebSchedulerTrackedFeature feature); -// All the sticky features in bitmask form. -BLINK_COMMON_EXPORT uint64_t StickyFeaturesBitmask(); +// All the sticky features. +BLINK_COMMON_EXPORT WebSchedulerTrackedFeatures StickyFeatures(); } // namespace scheduler } // namespace blink
diff --git a/third_party/blink/public/mojom/use_counter/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/css_property_id.mojom index 9b113801..e265b63 100644 --- a/third_party/blink/public/mojom/use_counter/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/css_property_id.mojom
@@ -749,6 +749,7 @@ kSizeAdjust = 696, kContainerName = 697, kContainerType = 698, + kContainer = 699, // 1. Add new features above this line (don't change the assigned numbers of // the existing items). // 2. Run the src/tools/metrics/histograms/update_use_counter_css.py script
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index cd2ebc9..9d96af5 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -44,7 +44,6 @@ #include "media/base/audio_latency.h" #include "media/base/audio_renderer_sink.h" #include "media/base/media_log.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/security/protocol_handler_security_level.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" @@ -61,7 +60,6 @@ #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h" #include "third_party/blink/public/platform/web_string.h" -#include "third_party/blink/public/platform/web_url_loader_factory.h" #include "third_party/blink/public/platform/web_v8_value_converter.h" #include "third_party/blink/public/platform/websocket_handshake_throttle_provider.h" #include "third_party/webrtc/api/video/video_codec_type.h" @@ -102,8 +100,10 @@ namespace network { namespace mojom { +class URLLoaderFactory; class URLLoaderFactoryInterfaceBase; } +class PendingSharedURLLoaderFactory; class SharedURLLoaderFactory; } @@ -142,6 +142,7 @@ class WebSandboxSupport; class WebSecurityOrigin; class WebThemeEngine; +class WebURLLoaderFactory; class WebVideoCaptureImplManager; struct WebContentSecurityPolicyHeader; @@ -292,9 +293,7 @@ // network::mojom::URLLoaderFactory. virtual std::unique_ptr<WebURLLoaderFactory> WrapURLLoaderFactory( CrossVariantMojoRemote<network::mojom::URLLoaderFactoryInterfaceBase> - url_loader_factory) { - return nullptr; - } + url_loader_factory); // Returns a new WebURLLoaderFactory that wraps the given // network::SharedURLLoaderFactory. @@ -777,7 +776,7 @@ worker_timing_callback_task_runner, base::RepeatingCallback< void(int, mojo::PendingReceiver<blink::mojom::WorkerTimingContainer>)> - worker_timing_callback) {} + worker_timing_callback); // WebCrypto ----------------------------------------------------------
diff --git a/third_party/blink/renderer/bindings/core/v8/dictionary.h b/third_party/blink/renderer/bindings/core/v8/dictionary.h index 4444970..14d91535 100644 --- a/third_party/blink/renderer/bindings/core/v8/dictionary.h +++ b/third_party/blink/renderer/bindings/core/v8/dictionary.h
@@ -59,6 +59,7 @@ value_type_ = ValueType::kObject; } + Dictionary(const Dictionary&) = default; Dictionary& operator=(const Dictionary&) = default; bool IsObject() const { return !dictionary_object_.IsEmpty(); }
diff --git a/third_party/blink/renderer/core/animation/css/css_animation_update.cc b/third_party/blink/renderer/core/animation/css/css_animation_update.cc index 8fd81d08..fcbaa038 100644 --- a/third_party/blink/renderer/core/animation/css/css_animation_update.cc +++ b/third_party/blink/renderer/core/animation/css/css_animation_update.cc
@@ -17,14 +17,10 @@ new_animations_ = update.NewAnimations(); animations_with_updates_ = update.AnimationsWithUpdates(); new_transitions_ = update.NewTransitions(); - active_interpolations_for_custom_animations_ = - update.ActiveInterpolationsForCustomAnimations(); - active_interpolations_for_standard_animations_ = - update.ActiveInterpolationsForStandardAnimations(); - active_interpolations_for_custom_transitions_ = - update.ActiveInterpolationsForCustomTransitions(); - active_interpolations_for_standard_transitions_ = - update.ActiveInterpolationsForStandardTransitions(); + active_interpolations_for_animations_ = + update.ActiveInterpolationsForAnimations(); + active_interpolations_for_transitions_ = + update.ActiveInterpolationsForTransitions(); cancelled_animation_indices_ = update.CancelledAnimationIndices(); animation_indices_with_pause_toggled_ = update.AnimationIndicesWithPauseToggled(); @@ -37,10 +33,8 @@ new_animations_.clear(); animations_with_updates_.clear(); new_transitions_.clear(); - active_interpolations_for_custom_animations_.clear(); - active_interpolations_for_standard_animations_.clear(); - active_interpolations_for_custom_transitions_.clear(); - active_interpolations_for_standard_transitions_.clear(); + active_interpolations_for_animations_.clear(); + active_interpolations_for_transitions_.clear(); cancelled_animation_indices_.clear(); animation_indices_with_pause_toggled_.clear(); cancelled_transitions_.clear();
diff --git a/third_party/blink/renderer/core/animation/css/css_animation_update.h b/third_party/blink/renderer/core/animation/css/css_animation_update.h index 0cfaf314..4f8fdd6f 100644 --- a/third_party/blink/renderer/core/animation/css/css_animation_update.h +++ b/third_party/blink/renderer/core/animation/css/css_animation_update.h
@@ -211,43 +211,22 @@ return finished_transitions_; } - void AdoptActiveInterpolationsForCustomAnimations( + void AdoptActiveInterpolationsForAnimations( ActiveInterpolationsMap& new_map) { - new_map.swap(active_interpolations_for_custom_animations_); + new_map.swap(active_interpolations_for_animations_); } - void AdoptActiveInterpolationsForStandardAnimations( + void AdoptActiveInterpolationsForTransitions( ActiveInterpolationsMap& new_map) { - new_map.swap(active_interpolations_for_standard_animations_); + new_map.swap(active_interpolations_for_transitions_); } - void AdoptActiveInterpolationsForCustomTransitions( - ActiveInterpolationsMap& new_map) { - new_map.swap(active_interpolations_for_custom_transitions_); + const ActiveInterpolationsMap& ActiveInterpolationsForAnimations() const { + return active_interpolations_for_animations_; } - void AdoptActiveInterpolationsForStandardTransitions( - ActiveInterpolationsMap& new_map) { - new_map.swap(active_interpolations_for_standard_transitions_); + ActiveInterpolationsMap& ActiveInterpolationsForAnimations() { + return active_interpolations_for_animations_; } - const ActiveInterpolationsMap& ActiveInterpolationsForCustomAnimations() - const { - return active_interpolations_for_custom_animations_; - } - ActiveInterpolationsMap& ActiveInterpolationsForCustomAnimations() { - return active_interpolations_for_custom_animations_; - } - const ActiveInterpolationsMap& ActiveInterpolationsForStandardAnimations() - const { - return active_interpolations_for_standard_animations_; - } - ActiveInterpolationsMap& ActiveInterpolationsForStandardAnimations() { - return active_interpolations_for_standard_animations_; - } - const ActiveInterpolationsMap& ActiveInterpolationsForCustomTransitions() - const { - return active_interpolations_for_custom_transitions_; - } - const ActiveInterpolationsMap& ActiveInterpolationsForStandardTransitions() - const { - return active_interpolations_for_standard_transitions_; + const ActiveInterpolationsMap& ActiveInterpolationsForTransitions() const { + return active_interpolations_for_transitions_; } bool IsEmpty() const { @@ -258,10 +237,8 @@ animations_with_updates_.IsEmpty() && new_transitions_.IsEmpty() && cancelled_transitions_.IsEmpty() && finished_transitions_.IsEmpty() && - active_interpolations_for_custom_animations_.IsEmpty() && - active_interpolations_for_standard_animations_.IsEmpty() && - active_interpolations_for_custom_transitions_.IsEmpty() && - active_interpolations_for_standard_transitions_.IsEmpty() && + active_interpolations_for_animations_.IsEmpty() && + active_interpolations_for_transitions_.IsEmpty() && updated_compositor_keyframes_.IsEmpty(); } @@ -271,10 +248,8 @@ visitor->Trace(suppressed_animations_); visitor->Trace(animations_with_updates_); visitor->Trace(updated_compositor_keyframes_); - visitor->Trace(active_interpolations_for_custom_animations_); - visitor->Trace(active_interpolations_for_standard_animations_); - visitor->Trace(active_interpolations_for_custom_transitions_); - visitor->Trace(active_interpolations_for_standard_transitions_); + visitor->Trace(active_interpolations_for_animations_); + visitor->Trace(active_interpolations_for_transitions_); } private: @@ -293,10 +268,8 @@ HashSet<PropertyHandle> cancelled_transitions_; HashSet<PropertyHandle> finished_transitions_; - ActiveInterpolationsMap active_interpolations_for_custom_animations_; - ActiveInterpolationsMap active_interpolations_for_standard_animations_; - ActiveInterpolationsMap active_interpolations_for_custom_transitions_; - ActiveInterpolationsMap active_interpolations_for_standard_transitions_; + ActiveInterpolationsMap active_interpolations_for_animations_; + ActiveInterpolationsMap active_interpolations_for_transitions_; friend class PendingAnimationUpdate; };
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc index e4867dbd..b88b1dd 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -825,15 +825,12 @@ } void CSSAnimations::MaybeApplyPendingUpdate(Element* element) { - previous_active_interpolations_for_custom_animations_.clear(); - previous_active_interpolations_for_standard_animations_.clear(); + previous_active_interpolations_for_animations_.clear(); if (pending_update_.IsEmpty()) return; - previous_active_interpolations_for_custom_animations_.swap( - pending_update_.ActiveInterpolationsForCustomAnimations()); - previous_active_interpolations_for_standard_animations_.swap( - pending_update_.ActiveInterpolationsForStandardAnimations()); + previous_active_interpolations_for_animations_.swap( + pending_update_.ActiveInterpolationsForAnimations()); for (wtf_size_t paused_index : pending_update_.AnimationIndicesWithPauseToggled()) { @@ -988,7 +985,7 @@ ClearPendingUpdate(); } -void CSSAnimations::CalculateTransitionUpdateForProperty( +void CSSAnimations::CalculateTransitionUpdateForPropertyHandle( TransitionUpdateState& state, const PropertyHandle& property, size_t transition_index) { @@ -997,23 +994,12 @@ // FIXME: We should transition if an !important property changes even when an // animation is running, but this is a bit hard to do with the current // applyMatchedProperties system. - if (property.IsCSSCustomProperty()) { - if (state.update.ActiveInterpolationsForCustomAnimations().Contains( - property) || - (state.animating_element.GetElementAnimations() && - state.animating_element.GetElementAnimations() - ->CssAnimations() - .previous_active_interpolations_for_custom_animations_.Contains( - property))) { - return; - } - } else if (state.update.ActiveInterpolationsForStandardAnimations().Contains( - property) || - (state.animating_element.GetElementAnimations() && - state.animating_element.GetElementAnimations() - ->CssAnimations() - .previous_active_interpolations_for_standard_animations_ - .Contains(property))) { + if (state.update.ActiveInterpolationsForAnimations().Contains(property) || + (state.animating_element.GetElementAnimations() && + state.animating_element.GetElementAnimations() + ->CssAnimations() + .previous_active_interpolations_for_animations_.Contains( + property))) { return; } @@ -1199,19 +1185,37 @@ ->IsAnimationStyleChange()); } +void CSSAnimations::CalculateTransitionUpdateForProperty( + TransitionUpdateState& state, + const CSSTransitionData::TransitionProperty& transition_property, + size_t transition_index, + const ComputedStyle& style) { + switch (transition_property.property_type) { + case CSSTransitionData::kTransitionUnknownProperty: + CalculateTransitionUpdateForCustomProperty(state, transition_property, + transition_index); + break; + case CSSTransitionData::kTransitionKnownProperty: + CalculateTransitionUpdateForStandardProperty(state, transition_property, + transition_index, style); + break; + default: + break; + } +} + void CSSAnimations::CalculateTransitionUpdateForCustomProperty( TransitionUpdateState& state, const CSSTransitionData::TransitionProperty& transition_property, size_t transition_index) { - if (transition_property.property_type != - CSSTransitionData::kTransitionUnknownProperty) { - return; - } + DCHECK_EQ(transition_property.property_type, + CSSTransitionData::kTransitionUnknownProperty); + if (!CSSVariableParser::IsValidVariableName( transition_property.property_string)) { return; } - CalculateTransitionUpdateForProperty( + CalculateTransitionUpdateForPropertyHandle( state, PropertyHandle(transition_property.property_string), transition_index); } @@ -1221,10 +1225,8 @@ const CSSTransitionData::TransitionProperty& transition_property, size_t transition_index, const ComputedStyle& style) { - if (transition_property.property_type != - CSSTransitionData::kTransitionKnownProperty) { - return; - } + DCHECK_EQ(transition_property.property_type, + CSSTransitionData::kTransitionKnownProperty); CSSPropertyID resolved_id = ResolveCSSPropertyID(transition_property.unresolved_property); @@ -1249,13 +1251,12 @@ continue; } - CalculateTransitionUpdateForProperty(state, property_handle, - transition_index); + CalculateTransitionUpdateForPropertyHandle(state, property_handle, + transition_index); } } void CSSAnimations::CalculateTransitionUpdate(CSSAnimationUpdate& update, - PropertyPass property_pass, Element& animating_element, const ComputedStyle& style) { if (animating_element.GetDocument().FinishingOrIsPrinting()) @@ -1295,34 +1296,21 @@ if (transition_property.unresolved_property == CSSPropertyID::kAll) { any_transition_had_transition_all = true; } - if (property_pass == PropertyPass::kCustom) { - CalculateTransitionUpdateForCustomProperty(state, transition_property, - transition_index); - } else { - DCHECK_EQ(property_pass, PropertyPass::kStandard); - CalculateTransitionUpdateForStandardProperty( - state, transition_property, transition_index, style); - } + CalculateTransitionUpdateForProperty(state, transition_property, + transition_index, style); } } else if (active_transitions && active_transitions->size()) { // !transition_data implies transition: all 0s any_transition_had_transition_all = true; - if (property_pass == PropertyPass::kStandard) { CSSTransitionData::TransitionProperty default_property( CSSPropertyID::kAll); - CalculateTransitionUpdateForStandardProperty(state, default_property, 0, - style); - } + CalculateTransitionUpdateForProperty(state, default_property, 0, style); } } if (active_transitions) { for (const auto& entry : *active_transitions) { const PropertyHandle& property = entry.key; - if (property.IsCSSCustomProperty() != - (property_pass == PropertyPass::kCustom)) { - continue; - } if (!any_transition_had_transition_all && !animation_style_recalc && !listed_properties.Contains(property)) { update.CancelTransition(property); @@ -1332,8 +1320,7 @@ } } - CalculateTransitionActiveInterpolations(update, property_pass, - animating_element); + CalculateTransitionActiveInterpolations(update, animating_element); } scoped_refptr<const ComputedStyle> CSSAnimations::CalculateBeforeChangeStyle( @@ -1438,9 +1425,8 @@ // the case of effect collisions. // Example: Both 'color' and 'svg-color' set the color on ComputedStyle but are // considered distinct properties in the ActiveInterpolationsMap. -bool IsStandardPropertyHandle(const PropertyHandle& property) { - return (property.IsCSSProperty() && !property.IsCSSCustomProperty()) || - property.IsPresentationAttribute(); +bool IsCSSPropertyHandle(const PropertyHandle& property) { + return property.IsCSSProperty() || property.IsPresentationAttribute(); } void AdoptActiveAnimationInterpolations( @@ -1448,18 +1434,10 @@ CSSAnimationUpdate& update, const HeapVector<Member<const InertEffect>>* new_animations, const HeapHashSet<Member<const Animation>>* suppressed_animations) { - ActiveInterpolationsMap custom_interpolations( - EffectStack::ActiveInterpolations( - effect_stack, new_animations, suppressed_animations, - KeyframeEffect::kDefaultPriority, IsCustomPropertyHandle)); - update.AdoptActiveInterpolationsForCustomAnimations(custom_interpolations); - - ActiveInterpolationsMap standard_interpolations( - EffectStack::ActiveInterpolations( - effect_stack, new_animations, suppressed_animations, - KeyframeEffect::kDefaultPriority, IsStandardPropertyHandle)); - update.AdoptActiveInterpolationsForStandardAnimations( - standard_interpolations); + ActiveInterpolationsMap interpolations(EffectStack::ActiveInterpolations( + effect_stack, new_animations, suppressed_animations, + KeyframeEffect::kDefaultPriority, IsCSSPropertyHandle)); + update.AdoptActiveInterpolationsForAnimations(interpolations); } } // namespace @@ -1490,22 +1468,8 @@ &update.SuppressedAnimations()); } -namespace { - -EffectStack::PropertyHandleFilter PropertyFilter( - CSSAnimations::PropertyPass property_pass) { - if (property_pass == CSSAnimations::PropertyPass::kCustom) { - return IsCustomPropertyHandle; - } - DCHECK_EQ(property_pass, CSSAnimations::PropertyPass::kStandard); - return IsStandardPropertyHandle; -} - -} // namespace - void CSSAnimations::CalculateTransitionActiveInterpolations( CSSAnimationUpdate& update, - PropertyPass property_pass, const Element& animating_element) { ElementAnimations* element_animations = animating_element.GetElementAnimations(); @@ -1517,7 +1481,7 @@ update.CancelledTransitions().IsEmpty()) { active_interpolations_for_transitions = EffectStack::ActiveInterpolations( effect_stack, nullptr, nullptr, KeyframeEffect::kTransitionPriority, - PropertyFilter(property_pass)); + IsCSSPropertyHandle); } else { HeapVector<Member<const InertEffect>> new_transitions; for (const auto& entry : update.NewTransitions()) @@ -1537,13 +1501,11 @@ active_interpolations_for_transitions = EffectStack::ActiveInterpolations( effect_stack, &new_transitions, &cancelled_animations, - KeyframeEffect::kTransitionPriority, PropertyFilter(property_pass)); + KeyframeEffect::kTransitionPriority, IsCSSPropertyHandle); } const ActiveInterpolationsMap& animations = - property_pass == PropertyPass::kCustom - ? update.ActiveInterpolationsForCustomAnimations() - : update.ActiveInterpolationsForStandardAnimations(); + update.ActiveInterpolationsForAnimations(); // Properties being animated by animations don't get values from transitions // applied. if (!animations.IsEmpty() && @@ -1552,14 +1514,8 @@ active_interpolations_for_transitions.erase(entry.key); } - if (property_pass == PropertyPass::kCustom) { - update.AdoptActiveInterpolationsForCustomTransitions( - active_interpolations_for_transitions); - } else { - DCHECK_EQ(property_pass, PropertyPass::kStandard); - update.AdoptActiveInterpolationsForStandardTransitions( - active_interpolations_for_transitions); - } + update.AdoptActiveInterpolationsForTransitions( + active_interpolations_for_transitions); } EventTarget* CSSAnimations::AnimationEventDelegate::GetEventTarget() const { @@ -1865,8 +1821,7 @@ visitor->Trace(transitions_); visitor->Trace(pending_update_); visitor->Trace(running_animations_); - visitor->Trace(previous_active_interpolations_for_standard_animations_); - visitor->Trace(previous_active_interpolations_for_custom_animations_); + visitor->Trace(previous_active_interpolations_for_animations_); } } // namespace blink
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.h b/third_party/blink/renderer/core/animation/css/css_animations.h index 4b7469c1..51edea5d 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.h +++ b/third_party/blink/renderer/core/animation/css/css_animations.h
@@ -92,10 +92,7 @@ const AtomicString& animation_name, const AnimationEffect::EventDelegate* old_event_delegate); - // Specifies whether to process custom or standard CSS properties. - enum class PropertyPass { kCustom, kStandard }; static void CalculateTransitionUpdate(CSSAnimationUpdate&, - PropertyPass, Element& animating_element, const ComputedStyle&); @@ -174,9 +171,7 @@ CSSAnimationUpdate pending_update_; - ActiveInterpolationsMap previous_active_interpolations_for_custom_animations_; - ActiveInterpolationsMap - previous_active_interpolations_for_standard_animations_; + ActiveInterpolationsMap previous_active_interpolations_for_animations_; struct TransitionUpdateState { STACK_ALLOCATED(); @@ -193,6 +188,12 @@ const CSSTransitionData* transition_data; }; + static void CalculateTransitionUpdateForProperty( + TransitionUpdateState&, + const CSSTransitionData::TransitionProperty&, + size_t transition_index, + const ComputedStyle&); + static void CalculateTransitionUpdateForCustomProperty( TransitionUpdateState&, const CSSTransitionData::TransitionProperty&, @@ -204,16 +205,16 @@ size_t transition_index, const ComputedStyle&); - static void CalculateTransitionUpdateForProperty(TransitionUpdateState&, - const PropertyHandle&, - size_t transition_index); + static void CalculateTransitionUpdateForPropertyHandle( + TransitionUpdateState&, + const PropertyHandle&, + size_t transition_index); static void CalculateAnimationActiveInterpolations( CSSAnimationUpdate&, const Element& animating_element); static void CalculateTransitionActiveInterpolations( CSSAnimationUpdate&, - PropertyPass, const Element& animating_element); // The before-change style is defined as the computed values of all properties
diff --git a/third_party/blink/renderer/core/css/css_counter_value.h b/third_party/blink/renderer/core/css/css_counter_value.h index 36458e232..ffd2314 100644 --- a/third_party/blink/renderer/core/css/css_counter_value.h +++ b/third_party/blink/renderer/core/css/css_counter_value.h
@@ -41,9 +41,9 @@ list_style_(list_style), separator_(separator) {} - String Identifier() const { return identifier_->Value(); } - AtomicString ListStyle() const { return list_style_->Value(); } - String Separator() const { return separator_->Value(); } + const String& Identifier() const { return identifier_->Value(); } + const AtomicString& ListStyle() const { return list_style_->Value(); } + const String& Separator() const { return separator_->Value(); } bool Equals(const CSSCounterValue& other) const { return Identifier() == other.Identifier() &&
diff --git a/third_party/blink/renderer/core/css/css_custom_ident_value.h b/third_party/blink/renderer/core/css/css_custom_ident_value.h index 0179c94..51c0cebba 100644 --- a/third_party/blink/renderer/core/css/css_custom_ident_value.h +++ b/third_party/blink/renderer/core/css/css_custom_ident_value.h
@@ -17,7 +17,7 @@ explicit CSSCustomIdentValue(const AtomicString&); explicit CSSCustomIdentValue(CSSPropertyID); - AtomicString Value() const { + const AtomicString& Value() const { DCHECK(!IsKnownPropertyID()); return string_; }
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index aa67705a..b8854b44 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -5947,6 +5947,14 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, { + name: "container", + longhands: [ + "container-type", "container-name" + ], + property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], + runtime_flag: "CSSContainerQueries", + }, + { name: "flex", longhands: ["flex-grow", "flex-shrink", "flex-basis"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
diff --git a/third_party/blink/renderer/core/css/css_string_value.h b/third_party/blink/renderer/core/css/css_string_value.h index 7c9d034..bdf43558 100644 --- a/third_party/blink/renderer/core/css/css_string_value.h +++ b/third_party/blink/renderer/core/css/css_string_value.h
@@ -15,7 +15,7 @@ public: CSSStringValue(const String&); - String Value() const { return string_; } + const String& Value() const { return string_; } String CustomCSSText() const;
diff --git a/third_party/blink/renderer/core/css/css_value_list.cc b/third_party/blink/renderer/core/css/css_value_list.cc index 0dcdf6ef..a3d7853 100644 --- a/third_party/blink/renderer/core/css/css_value_list.cc +++ b/third_party/blink/renderer/core/css/css_value_list.cc
@@ -20,8 +20,6 @@ #include "third_party/blink/renderer/core/css/css_value_list.h" -#include "third_party/blink/renderer/core/css/css_primitive_value.h" -#include "third_party/blink/renderer/core/css/parser/css_parser.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -52,16 +50,13 @@ found = true; } } - return found; } bool CSSValueList::HasValue(const CSSValue& val) const { - for (wtf_size_t index = 0; index < values_.size(); index++) { - const Member<const CSSValue>& value = values_.at(index); - if (value && *value == val) { + for (const auto& value : values_) { + if (value && *value == val) return true; - } } return false; } @@ -86,8 +81,7 @@ } String CSSValueList::CustomCSSText() const { - StringBuilder result; - String separator; + StringView separator; switch (value_list_separator_) { case kSpaceSeparator: separator = " "; @@ -102,17 +96,16 @@ NOTREACHED(); } - unsigned size = values_.size(); - for (unsigned i = 0; i < size; i++) { + StringBuilder result; + for (const auto& value : values_) { if (!result.IsEmpty()) result.Append(separator); // TODO(crbug.com/1213338): value_[i] can be null by CSSMathExpressionNode // which is implemented by css-values-3. Until fully implement the // css-values-4 features, we should append empty string to remove // null-pointer exception. - result.Append(values_[i] ? values_[i]->CssText() : " "); + result.Append(value ? value->CssText() : " "); } - return result.ToString(); } @@ -122,8 +115,8 @@ } bool CSSValueList::HasFailedOrCanceledSubresources() const { - for (unsigned i = 0; i < values_.size(); ++i) { - if (values_[i]->HasFailedOrCanceledSubresources()) + for (const auto& value : values_) { + if (value->HasFailedOrCanceledSubresources()) return true; } return false;
diff --git a/third_party/blink/renderer/core/css/cssom/inline_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/inline_style_property_map_test.cc index dabf73f..9378619 100644 --- a/third_party/blink/renderer/core/css/cssom/inline_style_property_map_test.cc +++ b/third_party/blink/renderer/core/css/cssom/inline_style_property_map_test.cc
@@ -26,6 +26,8 @@ const CSSProperty& shorthand = CSSProperty::Get(property_id); if (!shorthand.IsShorthand()) continue; + if (shorthand.Exposure() == CSSExposure::kNone) + continue; div->SetInlineStyleProperty(property_id, "var(--dummy)"); const StylePropertyShorthand& longhands = shorthandForProperty(property_id); for (unsigned i = 0; i < longhands.length(); i++) {
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index 12628f7..1392d1b36 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -2683,6 +2683,38 @@ } } +CSSValueList* ComputedStyleUtils::ValuesForContainerShorthand( + const ComputedStyle& style, + const LayoutObject* layout_object, + bool allow_visited_style) { + CHECK_EQ(containerShorthand().length(), 2u); + CHECK_EQ(containerShorthand().properties()[0], + &GetCSSPropertyContainerType()); + CHECK_EQ(containerShorthand().properties()[1], + &GetCSSPropertyContainerName()); + + CSSValueList* list = CSSValueList::CreateSlashSeparated(); + + const CSSValue* type = + GetCSSPropertyContainerType().CSSValueFromComputedStyle( + style, layout_object, allow_visited_style); + const CSSValue* name = + GetCSSPropertyContainerName().CSSValueFromComputedStyle( + style, layout_object, allow_visited_style); + + DCHECK(type); + DCHECK(name); + + list->Append(*type); + + if (!(IsA<CSSIdentifierValue>(name) && + To<CSSIdentifierValue>(*name).GetValueID() == CSSValueID::kNone)) { + list->Append(*name); + } + + return list; +} + // Returns up to two values for 'scroll-customization' property. The values // correspond to the customization values for 'x' and 'y' axes. CSSValue* ComputedStyleUtils::ScrollCustomizationFlagsToCSSValue(
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/third_party/blink/renderer/core/css/properties/computed_style_utils.h index 627f3ff..ff391ca 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.h +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.h
@@ -244,6 +244,9 @@ static CSSValue* ValuesForFontVariantProperty(const ComputedStyle&, const LayoutObject*, bool allow_visited_style); + static CSSValueList* ValuesForContainerShorthand(const ComputedStyle&, + const LayoutObject*, + bool allow_visited_style); static CSSValue* ScrollCustomizationFlagsToCSSValue( scroll_customization::ScrollDirection); static CSSValue* ValueForGapLength(const absl::optional<Length>&,
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc index 75aaef70..1c69854 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
@@ -4897,7 +4897,7 @@ CSSIdentifierValue* inline_size = nullptr; CSSIdentifierValue* block_size = nullptr; - while (!range.AtEnd()) { + while (range.Peek().GetType() == kIdentToken) { CSSValueID id = range.Peek().Id(); if (id == CSSValueID::kInlineSize && !inline_size) { inline_size = ConsumeIdent(range);
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index 4eb31203..e5a8c84 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc
@@ -867,6 +867,46 @@ columnsShorthand(), style, layout_object, allow_visited_style); } +bool Container::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + const CSSValue* type = css_parsing_utils::ConsumeContainerType(range); + if (!type) + return false; + + const CSSValue* name = CSSIdentifierValue::Create(CSSValueID::kNone); + if (css_parsing_utils::ConsumeSlashIncludingWhitespace(range)) { + if (!(name = css_parsing_utils::ConsumeContainerName(range, context))) + return false; + } + + if (!range.AtEnd()) + return false; + + css_parsing_utils::AddProperty( + CSSPropertyID::kContainerType, CSSPropertyID::kContainer, *type, + important, css_parsing_utils::IsImplicitProperty::kNotImplicit, + properties); + + css_parsing_utils::AddProperty( + CSSPropertyID::kContainerName, CSSPropertyID::kContainer, *name, + important, css_parsing_utils::IsImplicitProperty::kNotImplicit, + properties); + + return true; +} + +const CSSValue* Container::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const LayoutObject* layout_object, + bool allow_visited_style) const { + return ComputedStyleUtils::ValuesForContainerShorthand(style, layout_object, + allow_visited_style); +} + bool Flex::ParseShorthand(bool important, CSSParserTokenRange& range, const CSSParserContext& context,
diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc b/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc index 6dca583..8c5bad2 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc
@@ -175,19 +175,10 @@ if (update.IsEmpty()) return; - cascade_.AddInterpolations( - &update.ActiveInterpolationsForCustomAnimations(), - CascadeOrigin::kAnimation); - cascade_.AddInterpolations( - &update.ActiveInterpolationsForStandardAnimations(), - CascadeOrigin::kAnimation); - - cascade_.AddInterpolations( - &update.ActiveInterpolationsForCustomTransitions(), - CascadeOrigin::kTransition); - cascade_.AddInterpolations( - &update.ActiveInterpolationsForStandardTransitions(), - CascadeOrigin::kTransition); + cascade_.AddInterpolations(&update.ActiveInterpolationsForAnimations(), + CascadeOrigin::kAnimation); + cascade_.AddInterpolations(&update.ActiveInterpolationsForTransitions(), + CascadeOrigin::kTransition); } void Reset() { @@ -254,11 +245,7 @@ void CalculateInterpolationUpdate() { CSSAnimations::CalculateTransitionUpdate( - state_.AnimationUpdate(), CSSAnimations::PropertyPass::kCustom, - state_.GetElement(), *state_.Style()); - CSSAnimations::CalculateTransitionUpdate( - state_.AnimationUpdate(), CSSAnimations::PropertyPass::kStandard, - state_.GetElement(), *state_.Style()); + state_.AnimationUpdate(), state_.GetElement(), *state_.Style()); CSSAnimations::CalculateAnimationUpdate( state_.AnimationUpdate(), state_.GetElement(), state_.GetElement(), *state_.Style(), state_.ParentStyle(),
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/third_party/blink/renderer/core/css/resolver/style_resolver.cc index 60fbe68..f87707f 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc
@@ -1255,11 +1255,7 @@ CSSAnimations::CalculateCompositorAnimationUpdate( state.AnimationUpdate(), *animating_element, element, *state.Style(), state.ParentStyle(), WasViewportResized()); - CSSAnimations::CalculateTransitionUpdate( - state.AnimationUpdate(), CSSAnimations::PropertyPass::kStandard, - *animating_element, *state.Style()); CSSAnimations::CalculateTransitionUpdate(state.AnimationUpdate(), - CSSAnimations::PropertyPass::kCustom, *animating_element, *state.Style()); CSSAnimations::SnapshotCompositorKeyframes( @@ -1271,19 +1267,13 @@ if (!has_update) return false; - const ActiveInterpolationsMap& standard_animations = - state.AnimationUpdate().ActiveInterpolationsForStandardAnimations(); - const ActiveInterpolationsMap& standard_transitions = - state.AnimationUpdate().ActiveInterpolationsForStandardTransitions(); - const ActiveInterpolationsMap& custom_animations = - state.AnimationUpdate().ActiveInterpolationsForCustomAnimations(); - const ActiveInterpolationsMap& custom_transitions = - state.AnimationUpdate().ActiveInterpolationsForCustomTransitions(); + const ActiveInterpolationsMap& animations = + state.AnimationUpdate().ActiveInterpolationsForAnimations(); + const ActiveInterpolationsMap& transitions = + state.AnimationUpdate().ActiveInterpolationsForTransitions(); - cascade.AddInterpolations(&standard_animations, CascadeOrigin::kAnimation); - cascade.AddInterpolations(&standard_transitions, CascadeOrigin::kTransition); - cascade.AddInterpolations(&custom_animations, CascadeOrigin::kAnimation); - cascade.AddInterpolations(&custom_transitions, CascadeOrigin::kTransition); + cascade.AddInterpolations(&animations, CascadeOrigin::kAnimation); + cascade.AddInterpolations(&transitions, CascadeOrigin::kTransition); CascadeFilter filter; if (state.Style()->StyleType() == kPseudoIdMarker)
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc index 5c194a76..fd36ed7 100644 --- a/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -3726,6 +3726,31 @@ } } +TEST_F(StyleEngineTest, ContainerPropertiesRuntimeFlag) { + Vector<String> declarations = {"container-type:inline-size", + "container-name:foo", "container:inline-size"}; + + { + ScopedCSSContainerQueriesForTest feature(false); + + for (const String& decl : declarations) { + const auto* set = css_test_helpers::ParseDeclarationBlock(decl); + ASSERT_TRUE(set); + EXPECT_EQ(0u, set->PropertyCount()); + } + } + + { + ScopedCSSContainerQueriesForTest feature(true); + + for (const String& decl : declarations) { + const auto* set = css_test_helpers::ParseDeclarationBlock(decl); + ASSERT_TRUE(set); + EXPECT_GT(set->PropertyCount(), 0u); + } + } +} + TEST_F(StyleEngineTest, VideoControlsReject) { GetDocument().body()->setInnerHTML(R"HTML( <video controls></video>
diff --git a/third_party/blink/renderer/core/css/style_property_serializer.cc b/third_party/blink/renderer/core/css/style_property_serializer.cc index 95b5859..8f23fee 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.cc +++ b/third_party/blink/renderer/core/css/style_property_serializer.cc
@@ -475,6 +475,8 @@ return GetShorthandValue(borderInlineStartShorthand()); case CSSPropertyID::kBorderInlineEnd: return GetShorthandValue(borderInlineEndShorthand()); + case CSSPropertyID::kContainer: + return ContainerValue(); case CSSPropertyID::kOutline: return GetShorthandValue(outlineShorthand()); case CSSPropertyID::kBorderColor: @@ -672,6 +674,33 @@ return true; } +String StylePropertySerializer::ContainerValue() const { + CHECK_EQ(containerShorthand().length(), 2u); + CHECK_EQ(containerShorthand().properties()[0], + &GetCSSPropertyContainerType()); + CHECK_EQ(containerShorthand().properties()[1], + &GetCSSPropertyContainerName()); + + CSSValueList* list = CSSValueList::CreateSlashSeparated(); + + const CSSValue* type = + property_set_.GetPropertyCSSValue(GetCSSPropertyContainerType()); + const CSSValue* name = + property_set_.GetPropertyCSSValue(GetCSSPropertyContainerName()); + + DCHECK(type); + DCHECK(name); + + list->Append(*type); + + if (!(IsA<CSSIdentifierValue>(name) && + To<CSSIdentifierValue>(*name).GetValueID() == CSSValueID::kNone)) { + list->Append(*name); + } + + return list->CssText(); +} + String StylePropertySerializer::FontValue() const { int font_size_property_index = property_set_.FindPropertyIndex(GetCSSPropertyFontSize());
diff --git a/third_party/blink/renderer/core/css/style_property_serializer.h b/third_party/blink/renderer/core/css/style_property_serializer.h index 00edf39e..897dd878 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.h +++ b/third_party/blink/renderer/core/css/style_property_serializer.h
@@ -55,6 +55,7 @@ String PageBreakPropertyValue(const StylePropertyShorthand&) const; String GetShorthandValue(const StylePropertyShorthand&, String separator = " ") const; + String ContainerValue() const; String FontValue() const; String FontVariantValue() const; bool AppendFontLonghandValueIfNotNormal(const CSSProperty&,
diff --git a/third_party/blink/renderer/core/css/style_recalc.h b/third_party/blink/renderer/core/css/style_recalc.h index 644fe31..9e080e2 100644 --- a/third_party/blink/renderer/core/css/style_recalc.h +++ b/third_party/blink/renderer/core/css/style_recalc.h
@@ -59,7 +59,8 @@ StyleRecalcChange() = default; StyleRecalcChange(const StyleRecalcChange&) = default; - StyleRecalcChange(Propagate propagate) : propagate_(propagate) {} + StyleRecalcChange& operator=(const StyleRecalcChange&) = default; + explicit StyleRecalcChange(Propagate propagate) : propagate_(propagate) {} StyleRecalcChange ForChildren(const Element& element) const { return {RecalcDescendants() ? kRecalcDescendants : kNo,
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 4c61ab7..5e886a8 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -2946,8 +2946,9 @@ // make sure we clear out-of-date ComputedStyles outside the flat tree // in Element::EnsureComputedStyle(). if (child_change.RecalcDescendants()) { - RecalcDescendantStyles(StyleRecalcChange::kClearEnsured, - child_recalc_context); + RecalcDescendantStyles( + StyleRecalcChange(StyleRecalcChange::kClearEnsured), + child_recalc_context); } } else if (auto* slot = ToHTMLSlotElementIfSupportsAssignmentOrNull(this)) { slot->RecalcStyleForSlotChildren(child_change, child_recalc_context);
diff --git a/third_party/blink/renderer/core/dom/events/registered_event_listener.cc b/third_party/blink/renderer/core/dom/events/registered_event_listener.cc index 9f5ab9b..baab2521 100644 --- a/third_party/blink/renderer/core/dom/events/registered_event_listener.cc +++ b/third_party/blink/renderer/core/dom/events/registered_event_listener.cc
@@ -50,6 +50,9 @@ options->PassiveForcedForDocumentTarget()), passive_specified_(options->PassiveSpecified()) {} +RegisteredEventListener::RegisteredEventListener( + const RegisteredEventListener& that) = default; + RegisteredEventListener& RegisteredEventListener::operator=( const RegisteredEventListener& that) = default;
diff --git a/third_party/blink/renderer/core/dom/events/registered_event_listener.h b/third_party/blink/renderer/core/dom/events/registered_event_listener.h index 2098939..9654dc59 100644 --- a/third_party/blink/renderer/core/dom/events/registered_event_listener.h +++ b/third_party/blink/renderer/core/dom/events/registered_event_listener.h
@@ -44,6 +44,7 @@ RegisteredEventListener(); RegisteredEventListener(EventListener* listener, const AddEventListenerOptionsResolved* options); + RegisteredEventListener(const RegisteredEventListener& that); RegisteredEventListener& operator=(const RegisteredEventListener& that); void Trace(Visitor* visitor) const;
diff --git a/third_party/blink/renderer/core/dom/range_boundary_point.h b/third_party/blink/renderer/core/dom/range_boundary_point.h index 5223f99..66fd775 100644 --- a/third_party/blink/renderer/core/dom/range_boundary_point.h +++ b/third_party/blink/renderer/core/dom/range_boundary_point.h
@@ -39,7 +39,8 @@ public: explicit RangeBoundaryPoint(Node& container); - explicit RangeBoundaryPoint(const RangeBoundaryPoint&); + RangeBoundaryPoint(const RangeBoundaryPoint&); + RangeBoundaryPoint& operator=(const RangeBoundaryPoint&); bool IsConnected() const; const Position ToPosition() const; @@ -83,11 +84,11 @@ dom_tree_version_(DomTreeVersion()), offset_in_container_(0) {} -inline RangeBoundaryPoint::RangeBoundaryPoint(const RangeBoundaryPoint& other) - : container_node_(other.Container()), - child_before_boundary_(other.ChildBefore()), - dom_tree_version_(other.dom_tree_version_), - offset_in_container_(other.Offset()) {} +inline RangeBoundaryPoint::RangeBoundaryPoint(const RangeBoundaryPoint&) = + default; + +inline RangeBoundaryPoint& RangeBoundaryPoint::operator=( + const RangeBoundaryPoint& other) = default; inline Node& RangeBoundaryPoint::Container() const { return *container_node_;
diff --git a/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.cc b/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.cc index 95e2fff7..ad2a58b 100644 --- a/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.cc +++ b/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.cc
@@ -6,9 +6,11 @@ namespace blink { +SuggestionMarkerProperties::SuggestionMarkerProperties() = default; SuggestionMarkerProperties::SuggestionMarkerProperties( const SuggestionMarkerProperties& other) = default; -SuggestionMarkerProperties::SuggestionMarkerProperties() = default; +SuggestionMarkerProperties& SuggestionMarkerProperties::operator=( + const SuggestionMarkerProperties& other) = default; SuggestionMarkerProperties::Builder::Builder() = default; SuggestionMarkerProperties::Builder::Builder(
diff --git a/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.h b/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.h index 85597cb..cf82e8f 100644 --- a/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.h +++ b/third_party/blink/renderer/core/editing/markers/suggestion_marker_properties.h
@@ -22,8 +22,9 @@ public: class CORE_EXPORT Builder; - SuggestionMarkerProperties(const SuggestionMarkerProperties&); SuggestionMarkerProperties(); + SuggestionMarkerProperties(const SuggestionMarkerProperties&); + SuggestionMarkerProperties& operator=(const SuggestionMarkerProperties&); SuggestionMarker::SuggestionType Type() const { return type_; } SuggestionMarker::RemoveOnFinishComposing RemoveOnFinishComposing() const {
diff --git a/third_party/blink/renderer/core/editing/position.cc b/third_party/blink/renderer/core/editing/position.cc index c5404220f6..71721aa2a 100644 --- a/third_party/blink/renderer/core/editing/position.cc +++ b/third_party/blink/renderer/core/editing/position.cc
@@ -148,10 +148,11 @@ : PositionTemplate(&anchor_node, offset) {} template <typename Strategy> -PositionTemplate<Strategy>::PositionTemplate(const PositionTemplate& other) - : anchor_node_(other.anchor_node_), - offset_(other.offset_), - anchor_type_(other.anchor_type_) {} +PositionTemplate<Strategy>::PositionTemplate(const PositionTemplate&) = default; + +template <typename Strategy> +PositionTemplate<Strategy>& PositionTemplate<Strategy>::operator=( + const PositionTemplate&) = default; // static template <typename Strategy>
diff --git a/third_party/blink/renderer/core/editing/position.h b/third_party/blink/renderer/core/editing/position.h index 334f13ce..37f10b0 100644 --- a/third_party/blink/renderer/core/editing/position.h +++ b/third_party/blink/renderer/core/editing/position.h
@@ -71,6 +71,7 @@ PositionTemplate(const Node* anchor_node, int offset); PositionTemplate(const PositionTemplate&); + PositionTemplate& operator=(const PositionTemplate&); // Returns a newly created |Position| with |kOffsetInAnchor|. |offset| can be // out of bound. Out of bound position is used for computing undo/redo
diff --git a/third_party/blink/renderer/core/editing/set_selection_options.cc b/third_party/blink/renderer/core/editing/set_selection_options.cc index fb28880..861dbbae7 100644 --- a/third_party/blink/renderer/core/editing/set_selection_options.cc +++ b/third_party/blink/renderer/core/editing/set_selection_options.cc
@@ -6,9 +6,11 @@ namespace blink { +SetSelectionOptions::SetSelectionOptions() = default; SetSelectionOptions::SetSelectionOptions(const SetSelectionOptions& other) = default; -SetSelectionOptions::SetSelectionOptions() = default; +SetSelectionOptions& SetSelectionOptions::operator=( + const SetSelectionOptions& other) = default; SetSelectionOptions::Builder::Builder() = default; SetSelectionOptions::Builder::Builder(const SetSelectionOptions& data) {
diff --git a/third_party/blink/renderer/core/editing/set_selection_options.h b/third_party/blink/renderer/core/editing/set_selection_options.h index 7b2d270..81f0cc0 100644 --- a/third_party/blink/renderer/core/editing/set_selection_options.h +++ b/third_party/blink/renderer/core/editing/set_selection_options.h
@@ -22,8 +22,9 @@ public: class CORE_EXPORT Builder; - SetSelectionOptions(const SetSelectionOptions&); SetSelectionOptions(); + SetSelectionOptions(const SetSelectionOptions&); + SetSelectionOptions& operator=(const SetSelectionOptions&); CursorAlignOnScroll GetCursorAlignOnScroll() const { return cursor_align_on_scroll_;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index 3338bdf..5d6da269 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -298,10 +298,18 @@ } #if defined(OS_ANDROID) - if (Platform::Current()->IsElasticOverscrollEnabled() && + // TODO(https://crbug.com/1226115): Remove this forced effect node creation + // once we have completed the experiment to measure additional memory usage. + bool force_overscroll_effect_node = base::GetFieldTrialParamValueByFeature( - ::features::kElasticOverscroll, ::features::kElasticOverscrollType) != - ::features::kElasticOverscrollTypeTransform) { + ::features::kElasticOverscroll, ::features::kElasticOverscrollType) == + ::features::kElasticOverscrollTypeFilter; + if (force_overscroll_effect_node || + (Platform::Current()->IsElasticOverscrollEnabled() && + base::GetFieldTrialParamValueByFeature( + ::features::kElasticOverscroll, + ::features::kElasticOverscrollType) != + ::features::kElasticOverscrollTypeTransform)) { bool needs_overscroll_effect_node = !MaximumScrollOffset().IsZero(); if (needs_overscroll_effect_node && !overscroll_elasticity_effect_node_) { EffectPaintPropertyNode::State state;
diff --git a/third_party/blink/renderer/core/layout/hit_testing_transform_state.h b/third_party/blink/renderer/core/layout/hit_testing_transform_state.h index a6f040e..10929a49 100644 --- a/third_party/blink/renderer/core/layout/hit_testing_transform_state.h +++ b/third_party/blink/renderer/core/layout/hit_testing_transform_state.h
@@ -53,12 +53,9 @@ last_planar_area_(area), accumulating_transform_(false) {} - HitTestingTransformState(const HitTestingTransformState& other) - : last_planar_point_(other.last_planar_point_), - last_planar_quad_(other.last_planar_quad_), - last_planar_area_(other.last_planar_area_), - accumulated_transform_(other.accumulated_transform_), - accumulating_transform_(other.accumulating_transform_) {} + HitTestingTransformState(const HitTestingTransformState&) = default; + HitTestingTransformState& operator=(const HitTestingTransformState&) = + default; enum TransformAccumulation { kFlattenTransform, kAccumulateTransform }; void Translate(int x, int y, TransformAccumulation);
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h index dbd793a..1108780 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h
@@ -240,6 +240,7 @@ const NGFragmentItems& items); explicit NGInlineCursor(const NGInlineBackwardCursor& backward_cursor); NGInlineCursor(const NGInlineCursor& other) = default; + NGInlineCursor& operator=(const NGInlineCursor& other) = default; // Creates an |NGInlineCursor| without the root. Even when callers don't know // the root of the inline formatting context, this cursor can |MoveTo()|
diff --git a/third_party/blink/renderer/core/loader/history_item.h b/third_party/blink/renderer/core/loader/history_item.h index 4cd3d899..25c2ef1 100644 --- a/third_party/blink/renderer/core/loader/history_item.h +++ b/third_party/blink/renderer/core/loader/history_item.h
@@ -68,6 +68,7 @@ public: ViewState() = default; ViewState(const ViewState&) = default; + ViewState& operator=(const ViewState&) = default; ScrollOffset visual_viewport_scroll_offset_; ScrollOffset scroll_offset_;
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc index e1dd53f..5d10d26 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc
@@ -7,11 +7,14 @@ #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/module_request.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h" #include "third_party/blink/renderer/core/loader/modulescript/module_script_fetch_request.h" #include "third_party/blink/renderer/core/loader/modulescript/module_tree_linker_registry.h" #include "third_party/blink/renderer/core/script/module_script.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" +#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loading_log.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" @@ -516,8 +519,14 @@ // <spec step="5.2">Perform record.Instantiate(). ...</spec> AdvanceState(State::kInstantiating); + + ScriptState* script_state = modulator_->GetScriptState(); + UseCounter::Count(ExecutionContext::From(script_state), + WebFeature::kInstantiateModuleScript); + + ScriptState::Scope scope(script_state); ScriptValue instantiation_error = - modulator_->InstantiateModule(record, result_->SourceURL()); + ModuleRecord::Instantiate(script_state, record, result_->SourceURL()); // <spec step="5.2">... If this throws an exception, set result's error to // rethrow to that exception.</spec>
diff --git a/third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h b/third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h index a9a04127..b384d1a 100644 --- a/third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h +++ b/third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h
@@ -80,6 +80,8 @@ is_anchored_bottom(false) {} StickyPositionScrollingConstraints( const StickyPositionScrollingConstraints& other) = default; + StickyPositionScrollingConstraints& operator=( + const StickyPositionScrollingConstraints& other) = default; // Computes the sticky offset for a given overflow clip rect. //
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc index fcaf129..05923aa 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc
@@ -454,13 +454,17 @@ } // The furthest node within same block without crossing block boundaries would - // be the suffix end. + // be the prefix start. Node* prefix_start = LastVisibleTextNodeWithinBlock(prefix_end); if (!prefix_start) return ""; auto range_start = Position(prefix_start, 0); auto range_end = Position(prefix_end, prefix_end_offset); + // TODO(gayane): Find test case when this happens, seems related to shadow + // root. See crbug.com/1220830 + if (range_start >= range_end) + return ""; return PlainText(EphemeralRange(range_start, range_end)).StripWhiteSpace(); } @@ -469,7 +473,6 @@ Node* suffix_start = suffix_start_position.ComputeContainerNode(); unsigned suffix_start_offset = suffix_start_position.ComputeOffsetInContainerNode(); - // If given position point to the last visible text in its containiner node, // use the following visible node for the suffix. if (IsLastVisiblePosition(suffix_start, suffix_start_offset)) { @@ -488,6 +491,11 @@ auto range_start = Position(suffix_start, suffix_start_offset); auto range_end = Position(suffix_end, suffix_end->textContent().length()); + + // TODO(gayane): Find test case when this happens, seems related to shadow + // root. See crbug.com/1220830 + if (range_start >= range_end) + return ""; return PlainText(EphemeralRange(range_start, range_end)).StripWhiteSpace(); }
diff --git a/third_party/blink/renderer/core/paint/box_painter_base.cc b/third_party/blink/renderer/core/paint/box_painter_base.cc index efc46dc6f..af40a19 100644 --- a/third_party/blink/renderer/core/paint/box_painter_base.cc +++ b/third_party/blink/renderer/core/paint/box_painter_base.cc
@@ -606,7 +606,7 @@ inline bool PaintFastBottomLayer(const Document* document, Node* node, - const PaintInfo& paint_info, + GraphicsContext& context, const BoxPainterBase::FillLayerInfo& info, const PhysicalRect& rect, const FloatRoundedRect& border_rect, @@ -626,7 +626,6 @@ // Compute the destination rect for painting the color here because we may // need it for computing the image painting rect for optimization. - GraphicsContext& context = paint_info.context; FloatRoundedRect color_border = info.is_rounded_fill ? border_rect : FloatRoundedRect(PixelSnappedIntRect(rect)); @@ -711,7 +710,7 @@ if (node && info.image && info.image->IsImageResource()) { PaintTimingDetector::NotifyBackgroundImagePaint( *node, *image, To<StyleFetchedImage>(*info.image), - paint_info.context.GetPaintController().CurrentPaintChunkProperties(), + context.GetPaintController().CurrentPaintChunkProperties(), RoundedIntRect(image_border.Rect())); LocalDOMWindow* window = node->GetDocument().domWindow(); @@ -896,7 +895,6 @@ BackgroundImageGeometry& geometry, bool object_has_multiple_boxes, const PhysicalSize& flow_box_size) { - GraphicsContext& context = paint_info.context; if (rect.IsEmpty()) return; @@ -907,6 +905,7 @@ if (!info.should_paint_image && !info.should_paint_color) return; + GraphicsContext& context = paint_info.context; GraphicsContextStateSaver clip_with_scrolling_state_saver( context, info.is_clipped_with_local_scrolling); auto scrolled_paint_rect = @@ -949,8 +948,8 @@ (bleed_avoidance == kBackgroundBleedShrinkBackground || did_adjust_paint_rect); if (!disable_fast_path && - PaintFastBottomLayer(document_, node_, paint_info, info, rect, - border_rect, geometry, image.get(), composite_op)) { + PaintFastBottomLayer(document_, node_, context, info, rect, border_rect, + geometry, image.get(), composite_op)) { return; }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index f4060c7..2f1d6ba 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -23,6 +23,7 @@ #include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h" #include "third_party/blink/renderer/core/layout/ng/ng_outline_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" +#include "third_party/blink/renderer/core/layout/pointer_events_hit_rules.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/background_image_geometry.h" #include "third_party/blink/renderer/core/paint/box_decoration_data.h" @@ -114,7 +115,21 @@ inline bool IsVisibleToHitTest(const NGFragmentItem& item, const HitTestRequest& request) { const ComputedStyle& style = item.Style(); - return IsVisibleToPaint(item, style) && IsVisibleToHitTest(style, request); + if (item.Type() != NGFragmentItem::kSvgText) + return IsVisibleToPaint(item, style) && IsVisibleToHitTest(style, request); + + if (item.IsHiddenForPaint()) + return false; + PointerEventsHitRules hit_rules(PointerEventsHitRules::SVG_TEXT_HITTESTING, + request, style.PointerEvents()); + if (hit_rules.require_visible && style.Visibility() != EVisibility::kVisible) + return false; + if (hit_rules.can_hit_bounding_box || + (hit_rules.can_hit_stroke && + (style.HasStroke() || !hit_rules.require_stroke)) || + (hit_rules.can_hit_fill && (style.HasFill() || !hit_rules.require_fill))) + return IsVisibleToHitTest(style, request); + return false; } inline bool IsVisibleToHitTest(const NGPhysicalFragment& fragment,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc index 356e9af..e5bf0c8 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc
@@ -53,6 +53,16 @@ InitCachedProps(); } + NGTableCollapsedEdge(const NGTableCollapsedEdge& edge) + : NGTableCollapsedEdge(edge, 0) {} + + NGTableCollapsedEdge& operator=(const NGTableCollapsedEdge& edge) { + edge_index_ = edge.edge_index_; + border_width_ = edge.border_width_; + border_style_ = edge.border_style_; + return *this; + } + bool Exists() const { return edge_index_ != UINT_MAX; } bool CanPaint() const { @@ -206,13 +216,6 @@ return !(*this == rhs); } - NGTableCollapsedEdge& operator=(const NGTableCollapsedEdge& edge) { - edge_index_ = edge.edge_index_; - border_width_ = edge.border_width_; - border_style_ = edge.border_style_; - return *this; - } - private: void InitCachedProps() { if (edge_index_ == UINT_MAX) {
diff --git a/third_party/blink/renderer/core/script/modulator.h b/third_party/blink/renderer/core/script/modulator.h index d3c4feef..5341736 100644 --- a/third_party/blink/renderer/core/script/modulator.h +++ b/third_party/blink/renderer/core/script/modulator.h
@@ -208,8 +208,6 @@ virtual bool HasValidContext() = 0; - virtual ScriptValue InstantiateModule(v8::Local<v8::Module>, const KURL&) = 0; - virtual ModuleType ModuleTypeFromRequest( const ModuleRequest& module_request) const = 0;
diff --git a/third_party/blink/renderer/core/script/modulator_impl_base.cc b/third_party/blink/renderer/core/script/modulator_impl_base.cc index f2ef18e..3438b2d 100644 --- a/third_party/blink/renderer/core/script/modulator_impl_base.cc +++ b/third_party/blink/renderer/core/script/modulator_impl_base.cc
@@ -253,16 +253,6 @@ return ModuleImportMeta(url_string); } -ScriptValue ModulatorImplBase::InstantiateModule( - v8::Local<v8::Module> module_record, - const KURL& source_url) { - UseCounter::Count(GetExecutionContext(), - WebFeature::kInstantiateModuleScript); - - ScriptState::Scope scope(script_state_); - return ModuleRecord::Instantiate(script_state_, module_record, source_url); -} - ModuleType ModulatorImplBase::ModuleTypeFromRequest( const ModuleRequest& module_request) const { String module_type_string = module_request.GetModuleTypeString();
diff --git a/third_party/blink/renderer/core/script/modulator_impl_base.h b/third_party/blink/renderer/core/script/modulator_impl_base.h index 4ef26e62..719166fe 100644 --- a/third_party/blink/renderer/core/script/modulator_impl_base.h +++ b/third_party/blink/renderer/core/script/modulator_impl_base.h
@@ -92,7 +92,6 @@ } ModuleImportMeta HostGetImportMetaProperties( v8::Local<v8::Module>) const override; - ScriptValue InstantiateModule(v8::Local<v8::Module>, const KURL&) override; ModuleType ModuleTypeFromRequest( const ModuleRequest& module_request) const override;
diff --git a/third_party/blink/renderer/core/scroll/scrollbar.cc b/third_party/blink/renderer/core/scroll/scrollbar.cc index 215dd8b..ef7d389 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar.cc
@@ -130,6 +130,7 @@ void Scrollbar::OffsetDidChange(mojom::blink::ScrollType scroll_type) { DCHECK(scrollable_area_); + pending_injected_delta_ = ScrollOffset(); float position = ScrollableAreaCurrentPos(); if (position == current_pos_) @@ -606,7 +607,8 @@ // Convert the target offset to the delta that will be injected as part of a // GestureScrollUpdate event. ScrollOffset current_offset = - scrollable_area_->GetScrollAnimator().CurrentOffset(); + scrollable_area_->GetScrollAnimator().CurrentOffset() + + pending_injected_delta_; float desired_x = orientation_ == kHorizontalScrollbar ? single_axis_target_offset : current_offset.Width(); @@ -657,6 +659,7 @@ granularity); } + pending_injected_delta_ += delta; scrollable_area_->InjectGestureScrollEvent(WebGestureDevice::kScrollbar, delta, granularity, gesture_type);
diff --git a/third_party/blink/renderer/core/scroll/scrollbar.h b/third_party/blink/renderer/core/scroll/scrollbar.h index a0eb0e9b..dfe6b50 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar.h +++ b/third_party/blink/renderer/core/scroll/scrollbar.h
@@ -263,6 +263,13 @@ IntRect frame_rect_; Member<Element> style_source_; + + // Tracks scroll delta that has been injected into the compositor thread as a + // GestureScrollUpdate but hasn't yet updated the scroll position on main. + // Scrollbar::MouseMoved needs this to calculate deltas during thumb drags. + // In particular we often process two mousemoves in the same frame thanks to + // MouseEventManager::RecomputeMouseHoverState sending fake ones. + ScrollOffset pending_injected_delta_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/style/basic_shapes.h b/third_party/blink/renderer/core/style/basic_shapes.h index 932a64a8..e423999 100644 --- a/third_party/blink/renderer/core/style/basic_shapes.h +++ b/third_party/blink/renderer/core/style/basic_shapes.h
@@ -89,10 +89,9 @@ ? length : length.SubtractFromOneHundredPercent()) {} - BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) - : direction_(other.GetDirection()), - length_(other.length()), - computed_length_(other.computed_length_) {} + BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate&) = default; + BasicShapeCenterCoordinate& operator=(const BasicShapeCenterCoordinate&) = + default; bool operator==(const BasicShapeCenterCoordinate& other) const { return direction_ == other.direction_ && length_ == other.length_ && @@ -117,8 +116,8 @@ BasicShapeRadius() : type_(kClosestSide) {} explicit BasicShapeRadius(const Length& v) : value_(v), type_(kValue) {} explicit BasicShapeRadius(RadiusType t) : type_(t) {} - BasicShapeRadius(const BasicShapeRadius& other) - : value_(other.Value()), type_(other.GetType()) {} + BasicShapeRadius(const BasicShapeRadius&) = default; + BasicShapeRadius& operator=(const BasicShapeRadius&) = default; bool operator==(const BasicShapeRadius& other) const { return type_ == other.type_ && value_ == other.value_; }
diff --git a/third_party/blink/renderer/core/style/style_variables.cc b/third_party/blink/renderer/core/style/style_variables.cc index 1492782..d817472 100644 --- a/third_party/blink/renderer/core/style/style_variables.cc +++ b/third_party/blink/renderer/core/style/style_variables.cc
@@ -37,6 +37,9 @@ : data_(other.data_), values_(MakeGarbageCollected<ValueMap>(*other.values_)) {} +StyleVariables& StyleVariables::operator=(const StyleVariables& other) = + default; + bool StyleVariables::operator==(const StyleVariables& other) const { if (data_.size() != other.data_.size()) return false;
diff --git a/third_party/blink/renderer/core/style/style_variables.h b/third_party/blink/renderer/core/style/style_variables.h index 9100c460..4640aa7f 100644 --- a/third_party/blink/renderer/core/style/style_variables.h +++ b/third_party/blink/renderer/core/style/style_variables.h
@@ -47,6 +47,7 @@ StyleVariables(); StyleVariables(const StyleVariables&); + StyleVariables& operator=(const StyleVariables&); bool operator==(const StyleVariables& other) const; bool operator!=(const StyleVariables& other) const {
diff --git a/third_party/blink/renderer/core/testing/dummy_modulator.cc b/third_party/blink/renderer/core/testing/dummy_modulator.cc index cc99f2b6..5e7988fc 100644 --- a/third_party/blink/renderer/core/testing/dummy_modulator.cc +++ b/third_party/blink/renderer/core/testing/dummy_modulator.cc
@@ -156,12 +156,6 @@ return ModuleImportMeta(String()); } -ScriptValue DummyModulator::InstantiateModule(v8::Local<v8::Module>, - const KURL&) { - NOTREACHED(); - return ScriptValue(); -} - ModuleType DummyModulator::ModuleTypeFromRequest( const ModuleRequest& module_request) const { String module_type_string = module_request.GetModuleTypeString();
diff --git a/third_party/blink/renderer/core/testing/dummy_modulator.h b/third_party/blink/renderer/core/testing/dummy_modulator.h index c15d8dc..c72a538 100644 --- a/third_party/blink/renderer/core/testing/dummy_modulator.h +++ b/third_party/blink/renderer/core/testing/dummy_modulator.h
@@ -72,7 +72,6 @@ ModuleImportMeta HostGetImportMetaProperties( v8::Local<v8::Module>) const override; const ImportMap* GetImportMapForTest() const override; - ScriptValue InstantiateModule(v8::Local<v8::Module>, const KURL&) override; ModuleType ModuleTypeFromRequest( const ModuleRequest& module_request) const override; ModuleScriptFetcher* CreateModuleScriptFetcher(
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index 20ed5715..dcd927fe 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -122,6 +122,7 @@ #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/loader/frame_loader.h" #include "third_party/blink/renderer/core/loader/history_item.h" +#include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/page.h" @@ -3463,6 +3464,18 @@ CanvasContextCreationAttributesCore attr; CanvasRenderingContext* context = canvas->GetCanvasRenderingContext(context_type, attr); + if (!context) + return; + context->LoseContext(CanvasRenderingContext::kSyntheticLostContext); +} + +void Internals::forceLoseCanvasContext(OffscreenCanvas* offscreencanvas, + const String& context_type) { + CanvasContextCreationAttributesCore attr; + CanvasRenderingContext* context = offscreencanvas->GetCanvasRenderingContext( + document_->GetExecutionContext(), context_type, attr); + if (!context) + return; context->LoseContext(CanvasRenderingContext::kSyntheticLostContext); }
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index c5e64fed..1bd387e 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -72,6 +72,7 @@ class Location; class Node; class OriginTrialsTest; +class OffscreenCanvas; class Page; class Range; class ReadableStream; @@ -506,6 +507,9 @@ void forceLoseCanvasContext(HTMLCanvasElement* canvas, const String& context_type); + void forceLoseCanvasContext(OffscreenCanvas* offscreencanvas, + const String& context_type); + void setScrollChain(ScrollState*, const HeapVector<Member<Element>>& elements, ExceptionState&);
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index 0c4611d6..0814cc67 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -320,6 +320,7 @@ boolean isInCanvasFontCache(Document document, DOMString fontString); unsigned long canvasFontCacheMaxFonts(); void forceLoseCanvasContext(HTMLCanvasElement canvas, DOMString contextType); + void forceLoseCanvasContext(OffscreenCanvas offscreencanvas, DOMString context_type); DictionaryTest dictionaryTest(); RecordTest recordTest();
diff --git a/third_party/blink/renderer/core/timing/performance.h b/third_party/blink/renderer/core/timing/performance.h index 06e82b2..32c9894 100644 --- a/third_party/blink/renderer/core/timing/performance.h +++ b/third_party/blink/renderer/core/timing/performance.h
@@ -142,9 +142,7 @@ DOMHighResTimeStamp timeOrigin() const; // Internal getter method for the time origin value. - double GetTimeOrigin() const { - return time_origin_.since_origin().InSecondsF(); - } + base::TimeTicks GetTimeOriginInternal() const { return time_origin_; } PerformanceEntryVector getEntries(); // Get BufferedEntriesByType will return all entries in the buffer regardless
diff --git a/third_party/blink/renderer/core/timing/performance_mark.cc b/third_party/blink/renderer/core/timing/performance_mark.cc index 487e2f9..30ec9b57 100644 --- a/third_party/blink/renderer/core/timing/performance_mark.cc +++ b/third_party/blink/renderer/core/timing/performance_mark.cc
@@ -58,8 +58,8 @@ // GetTimeOrigin() returns seconds from the monotonic clock's origin.. // Trace events timestamps accept seconds (as a double) based on // CurrentTime::monotonicallyIncreasingTime(). - unsafe_start_for_traces = trace_event::ToTraceTimestamp( - performance->GetTimeOrigin() + start / 1000.0); + unsafe_start_for_traces = performance->GetTimeOriginInternal() + + base::TimeDelta::FromMillisecondsD(start); } else { start = performance->now(); unsafe_start_for_traces = base::TimeTicks::Now();
diff --git a/third_party/blink/renderer/core/timing/performance_user_timing.cc b/third_party/blink/renderer/core/timing/performance_user_timing.cc index 2bf5070..a0ff985a 100644 --- a/third_party/blink/renderer/core/timing/performance_user_timing.cc +++ b/third_party/blink/renderer/core/timing/performance_user_timing.cc
@@ -176,15 +176,8 @@ return mark->UnsafeTimeForTraces(); } } - - // User timing events are stored as integer milliseconds from the start of - // navigation. - // GetTimeOrigin() returns seconds from the monotonic clock's origin.. - // Trace events timestamps accept seconds (as a double) based on - // CurrentTime::monotonicallyIncreasingTime(). - double start_time_in_seconds = start_time / 1000.0; - return trace_event::ToTraceTimestamp(performance_->GetTimeOrigin() + - start_time_in_seconds); + return performance_->GetTimeOriginInternal() + + base::TimeDelta::FromMillisecondsD(start_time); } PerformanceMeasure* UserTiming::Measure(ScriptState* script_state,
diff --git a/third_party/blink/renderer/core/timing/profiler.cc b/third_party/blink/renderer/core/timing/profiler.cc index 7d5b1aee..0bee7ae 100644 --- a/third_party/blink/renderer/core/timing/profiler.cc +++ b/third_party/blink/renderer/core/timing/profiler.cc
@@ -40,9 +40,7 @@ DCHECK(profiler_group); auto* profiler = profiler_group->CreateProfiler( - script_state, *options, - base::TimeTicks() + - base::TimeDelta::FromSecondsD(performance->GetTimeOrigin()), + script_state, *options, performance->GetTimeOriginInternal(), exception_state); if (exception_state.HadException()) return nullptr;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.cc b/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.cc index 7f382a0..c9d6b59 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.cc
@@ -39,6 +39,8 @@ ClipList::ClipOp::ClipOp() : anti_aliasing_mode_(kAntiAliased) {} -ClipList::ClipOp::ClipOp(const ClipOp& other) = default; +ClipList::ClipOp::ClipOp(const ClipOp&) = default; + +ClipList::ClipOp& ClipList::ClipOp::operator=(const ClipOp&) = default; } // namespace blink
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.h b/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.h index 630cf97..343157b 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.h +++ b/third_party/blink/renderer/modules/canvas/canvas2d/clip_list.h
@@ -36,6 +36,7 @@ ClipOp(); ClipOp(const ClipOp&); + ClipOp& operator=(const ClipOp&); }; // Number of clip ops that can be stored in a ClipList without resorting to
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc index 693e04c7..3f1506e 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc
@@ -28,7 +28,6 @@ #include "media/base/channel_layout.h" #include "media/base/limits.h" #include "media/webrtc/helpers.h" -#include "media/webrtc/webrtc_switches.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" @@ -38,9 +37,6 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" -#include "third_party/webrtc/api/audio/echo_canceller3_config.h" -#include "third_party/webrtc/api/audio/echo_canceller3_config_json.h" -#include "third_party/webrtc/api/audio/echo_canceller3_factory.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing_statistics.h" #include "third_party/webrtc_overrides/task_queue_factory.h" @@ -62,82 +58,6 @@ namespace { -using webrtc::AudioProcessing; - -bool Allow48kHzApmProcessing() { - return base::FeatureList::IsEnabled( - ::features::kWebRtcAllow48kHzProcessingOnArm); -} - -absl::optional<WebRtcHybridAgcParams> GetWebRtcHybridAgcParams() { - if (!base::FeatureList::IsEnabled(::features::kWebRtcHybridAgc)) { - return absl::nullopt; - } - return WebRtcHybridAgcParams{ - .dry_run = base::GetFieldTrialParamByFeatureAsBool( - ::features::kWebRtcHybridAgc, "dry_run", false), - .vad_reset_period_ms = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcHybridAgc, "vad_reset_period_ms", 1500), - .adjacent_speech_frames_threshold = - base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcHybridAgc, "adjacent_speech_frames_threshold", - 12), - .max_gain_change_db_per_second = - static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( - ::features::kWebRtcHybridAgc, "max_gain_change_db_per_second", - 3)), - .max_output_noise_level_dbfs = - static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( - ::features::kWebRtcHybridAgc, "max_output_noise_level_dbfs", - -50)), - .sse2_allowed = base::GetFieldTrialParamByFeatureAsBool( - ::features::kWebRtcHybridAgc, "sse2_allowed", true), - .avx2_allowed = base::GetFieldTrialParamByFeatureAsBool( - ::features::kWebRtcHybridAgc, "avx2_allowed", true), - .neon_allowed = base::GetFieldTrialParamByFeatureAsBool( - ::features::kWebRtcHybridAgc, "neon_allowed", true)}; -} - -absl::optional<WebRtcAnalogAgcClippingControlParams> -GetWebRtcAnalogAgcClippingControlParams() { - if (!base::FeatureList::IsEnabled( - ::features::kWebRtcAnalogAgcClippingControl)) { - return absl::nullopt; - } - return WebRtcAnalogAgcClippingControlParams{ - .mode = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, "mode", 0), - .window_length = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, "window_length", 5), - .reference_window_length = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, - "reference_window_length", 5), - .reference_window_delay = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, "reference_window_delay", - 5), - .clipping_threshold = - static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( - ::features::kWebRtcAnalogAgcClippingControl, "clipping_threshold", - -1.0)), - .crest_factor_margin = - static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( - ::features::kWebRtcAnalogAgcClippingControl, - "crest_factor_margin", 3.0)), - .clipped_level_step = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, "clipped_level_step", - 15), - .clipped_ratio_threshold = - static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( - ::features::kWebRtcAnalogAgcClippingControl, - "clipped_ratio_threshold", 0.1)), - .clipped_wait_frames = base::GetFieldTrialParamByFeatureAsInt( - ::features::kWebRtcAnalogAgcClippingControl, "clipped_wait_frames", - 300), - .use_predicted_step = base::GetFieldTrialParamByFeatureAsBool( - ::features::kWebRtcAnalogAgcClippingControl, "use_predicted_step", - true)}; -} - constexpr int kBuffersPerSecond = 100; // 10 ms per buffer. } // namespace @@ -600,89 +520,19 @@ // has determined webrtc::AudioProcessing will be used. DCHECK(WouldModifyAudio(properties)); - // Experimental options provided at creation. - webrtc::Config config; - config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs( - properties.goog_experimental_noise_suppression)); - - // TODO(bugs.webrtc.org/7494): Move logic below in ConfigAutomaticGainControl. - // Retrieve the Hybrid AGC experiment parameters. - // The hybrid AGC setup, that is AGC1 analog and AGC2 adaptive digital, - // requires `goog_auto_gain_control` and `goog_experimental_auto_gain_control` - // to be both active. - absl::optional<WebRtcHybridAgcParams> hybrid_agc_params; - absl::optional<WebRtcAnalogAgcClippingControlParams> clipping_control_params; - if (properties.goog_auto_gain_control && - properties.goog_experimental_auto_gain_control) { - hybrid_agc_params = GetWebRtcHybridAgcParams(); - clipping_control_params = GetWebRtcAnalogAgcClippingControlParams(); - } - // If the experimental AGC is enabled, check for overridden config params. - if (properties.goog_experimental_auto_gain_control) { - auto startup_min_volume = Platform::Current()->GetAgcStartupMinimumVolume(); - auto* experimental_agc = new webrtc::ExperimentalAgc( - /*enabled=*/true, startup_min_volume.value_or(0)); - // Disable the AGC1 adaptive digital controller if the hybrid AGC is enabled - // and it's not running in dry-run mode. - experimental_agc->digital_adaptive_disabled = - hybrid_agc_params.has_value() && !hybrid_agc_params->dry_run; - config.Set<webrtc::ExperimentalAgc>(experimental_agc); -#if BUILDFLAG(IS_CHROMECAST) - } else { - // Do not use the analog controller. - config.Set<webrtc::ExperimentalAgc>( - new webrtc::ExperimentalAgc(/*enabled=*/false)); -#endif // BUILDFLAG(IS_CHROMECAST) - } - - // Create and configure the webrtc::AudioProcessing. + absl::optional<int> agc_startup_min_volume = + Platform::Current()->GetAgcStartupMinimumVolume(); absl::optional<std::string> audio_processing_platform_config_json = Platform::Current()->GetWebRTCAudioProcessingConfiguration(); - webrtc::AudioProcessingBuilder ap_builder; - if (properties.EchoCancellationIsWebRtcProvided()) { - webrtc::EchoCanceller3Config aec3_config; - if (audio_processing_platform_config_json) { - aec3_config = webrtc::Aec3ConfigFromJsonString( - *audio_processing_platform_config_json); - bool config_parameters_already_valid = - webrtc::EchoCanceller3Config::Validate(&aec3_config); - RTC_DCHECK(config_parameters_already_valid); - } - ap_builder.SetEchoControlFactory( - std::unique_ptr<webrtc::EchoControlFactory>( - new webrtc::EchoCanceller3Factory(aec3_config))); - } - audio_processing_.reset(ap_builder.Create(config)); + audio_processing_ = CreateWebRtcAudioProcessingModule( + properties, use_capture_multi_channel_processing_, + audio_processing_platform_config_json, agc_startup_min_volume); - // Enable the audio processing components. + // Register as a listener for the echo cancellation playout reference signal. if (playout_data_source_) { playout_data_source_->AddPlayoutSink(this); } - - webrtc::AudioProcessing::Config apm_config = audio_processing_->GetConfig(); - apm_config.pipeline.multi_channel_render = true; - apm_config.pipeline.multi_channel_capture = - use_capture_multi_channel_processing_; - - absl::optional<double> gain_control_compression_gain_db; - PopulateApmConfig(&apm_config, properties, - audio_processing_platform_config_json, - &gain_control_compression_gain_db); - - // Set up gain control functionalities. - ConfigAutomaticGainControl(properties, hybrid_agc_params, - clipping_control_params, - gain_control_compression_gain_db, apm_config); - - // Ensure that 48 kHz APM processing is always active. This overrules the - // default setting in WebRTC of 32 kHz for ARM platforms. - if (Allow48kHzApmProcessing()) { - apm_config.pipeline.maximum_internal_processing_rate = 48000; - } - - apm_config.residual_echo_detector.enabled = false; - audio_processing_->ApplyConfig(apm_config); } void MediaStreamAudioProcessor::InitializeCaptureFifo(
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h index ea09417..19e4494 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h
@@ -12,6 +12,7 @@ #include "base/memory/scoped_refptr.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" +#include "media/base/audio_parameters.h" #include "media/webrtc/audio_delay_stats_reporter.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/modules/modules_export.h" @@ -25,13 +26,8 @@ namespace media { class AudioBus; -class AudioParameters; } // namespace media -namespace webrtc { -class TypingDetection; -} - namespace blink { class AecDumpAgentImpl;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc index 39fe24fa..bb569b6 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc
@@ -1500,7 +1500,10 @@ } AudioDeviceCaptureCapability::AudioDeviceCaptureCapability( - const AudioDeviceCaptureCapability& other) = default; + const AudioDeviceCaptureCapability&) = default; + +AudioDeviceCaptureCapability& AudioDeviceCaptureCapability::operator=( + const AudioDeviceCaptureCapability&) = default; String AudioDeviceCaptureCapability::DeviceID() const { return source_ ? String(source_->device().id.data()) : device_id_;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h index bc3a985..5cdb259 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h
@@ -52,7 +52,8 @@ // getUserMedia() with device capture for devices that are currently in use. explicit AudioDeviceCaptureCapability(blink::MediaStreamAudioSource* source); - AudioDeviceCaptureCapability(const AudioDeviceCaptureCapability& other); + AudioDeviceCaptureCapability(const AudioDeviceCaptureCapability&); + AudioDeviceCaptureCapability& operator=(const AudioDeviceCaptureCapability&); // If this capability represents a device currently in use, this method // returns a pointer to the MediaStreamAudioSource object associated with the
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc index 8beb892..83a53d5e 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include <limits> #include <memory> +#include <numeric> #include <utility> #include "base/callback_helpers.h"
diff --git a/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.cc b/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.cc index cb174e43..22a34bb3 100644 --- a/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.cc +++ b/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.cc
@@ -129,8 +129,6 @@ // Update the state to expect the start of an absolute URL. RewindAndSetState(StringParseState::kProtocol); - - break; } break; @@ -315,11 +313,9 @@ component_start_ = token_index_ + skip.value(); // Next, move the `token_index_` so that the top of the loop will begin - // parsing the new component. The index will be automatically incremented by - // the parse loop, so we move one less than the indicated `skip` amount. This - // means `kNone` and `kOne` are equivalent for setting `token_index_`. Note, - // however, these enums do have a different effect on setting - // `component_start_` above. + // parsing the new component. We adjust the `token_increment_` down to + // zero as the skip value already takes into account moving to the start + // of the next component. token_index_ += skip.value(); token_increment_ = 0; }
diff --git a/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.h b/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.h index ac6afae6..c339201 100644 --- a/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.h +++ b/third_party/blink/renderer/modules/url_pattern/url_pattern_parser.h
@@ -39,7 +39,7 @@ public: explicit Parser(const String& input); - // Attempt to parse the the input string used to construct the Parser object. + // Attempt to parse the input string used to construct the Parser object. // This method may only be called once. Any errors will be thrown on the // give `exception_state`. Retrieve the parse result by calling // `GetResult()`. A protocol component will also be eagerly compiled for
diff --git a/third_party/blink/renderer/modules/webmidi/midi_output.cc b/third_party/blink/renderer/modules/webmidi/midi_output.cc index e16c084..9a2e3922 100644 --- a/third_party/blink/renderer/modules/webmidi/midi_output.cc +++ b/third_party/blink/renderer/modules/webmidi/midi_output.cc
@@ -78,8 +78,7 @@ } DCHECK(performance); - return base::TimeTicks() + - base::TimeDelta::FromSecondsD(performance->GetTimeOrigin()); + return performance->GetTimeOriginInternal(); } class MessageValidator {
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.cc b/third_party/blink/renderer/modules/webtransport/web_transport.cc index e59e0a8..9b89c9a 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport.cc +++ b/third_party/blink/renderer/modules/webtransport/web_transport.cc
@@ -9,8 +9,11 @@ #include <utility> #include "base/numerics/safe_conversions.h" +#include "base/time/time.h" #include "mojo/public/cpp/bindings/remote.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" +#include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" #include "third_party/blink/public/mojom/webtransport/web_transport_connector.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" @@ -22,6 +25,7 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/web_feature.h" +#include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/streams/readable_stream.h" #include "third_party/blink/renderer/core/streams/readable_stream_default_controller_with_script_scope.h" @@ -40,6 +44,7 @@ #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/heap/visitor.h" #include "third_party/blink/renderer/platform/loader/fetch/unique_identifier.h" +#include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -49,6 +54,11 @@ namespace { +// The incoming max age to to be used when datagrams.incomingMaxAge is set to +// null. +constexpr base::TimeDelta kDefaultIncomingMaxAge = + base::TimeDelta::FromSeconds(60); + // Creates a mojo DataPipe with the options we use for our stream data pipes. On // success, returns true. On failure, throws an exception and returns false. bool CreateStreamDataPipe(mojo::ScopedDataPipeProducerHandle* producer, @@ -178,41 +188,264 @@ HeapDeque<Member<ScriptPromiseResolver>> pending_datagrams_; }; -// Captures a pointer to the ReadableStreamDefaultControllerWithScriptScope in -// the Start() method, and then does nothing else. Queuing of received datagrams -// is done inside the implementation of WebTransport. +// Passes incoming datagrams to the datagrams.readable stream. It maintains its +// own internal queue of datagrams so that stale datagrams won't remain in +// ReadableStream's queue. class WebTransport::DatagramUnderlyingSource final : public UnderlyingSourceBase { public: DatagramUnderlyingSource(ScriptState* script_state, - WebTransport* web_transport) - : UnderlyingSourceBase(script_state), web_transport_(web_transport) {} + DatagramDuplexStream* datagram_duplex_stream) + : UnderlyingSourceBase(script_state), + datagram_duplex_stream_(datagram_duplex_stream), + expiry_timer_(ExecutionContext::From(script_state) + ->GetTaskRunner(TaskType::kNetworking), + this, + &DatagramUnderlyingSource::ExpiryTimerFired) {} - ScriptPromise Start(ScriptState* script_state) override { - web_transport_->received_datagrams_controller_ = Controller(); - return ScriptPromise::CastUndefined(script_state); - } - + // Implementation of UnderlyingSourceBase. ScriptPromise pull(ScriptState* script_state) override { + DVLOG(1) << "DatagramUnderlyingSource::pull()"; + // If high water mark is reset to 0 and then read() is called, it should + // block waiting for a new datagram. So we may need to discard datagrams + // here. + DiscardExcessDatagrams(); + + MaybeExpireDatagrams(); + + if (queue_.empty()) { + if (close_when_queue_empty_) { + Controller()->Close(); + return ScriptPromise::CastUndefined(script_state); + } + + DCHECK(!waiting_for_datagrams_); + waiting_for_datagrams_ = true; + return ScriptPromise::CastUndefined(script_state); + } + + const QueueEntry* entry = queue_.front(); + queue_.pop_front(); + + if (queue_.empty()) { + expiry_timer_.Stop(); + } + + // This has to go after any mutations as it may run JavaScript, leading to + // re-entry. + Controller()->Enqueue(entry->datagram); + + // JavaScript could have called some other method at this point. + // However, this is safe, because |close_when_queue_empty_| only ever + // changes from false to true, and once it is true no more datagrams will + // be added to |queue_|. + if (close_when_queue_empty_ && queue_.empty()) { + Controller()->Close(); + } + return ScriptPromise::CastUndefined(script_state); } - ScriptPromise Cancel(ScriptState* script_state, ScriptValue reason) override { - // Stop Enqueue() from being called again. + ScriptPromise Cancel(ScriptState* script_state, ScriptValue) override { + DVLOG(1) << "DatagramUnderlyingSource::Cancel()"; + waiting_for_datagrams_ = false; + canceled_ = true; + DiscardQueue(); + Controller()->NoteHasBeenCanceled(); - web_transport_->received_datagrams_controller_->NoteHasBeenCanceled(); - web_transport_->received_datagrams_controller_ = nullptr; - web_transport_ = nullptr; return ScriptPromise::CastUndefined(script_state); } + // Interface for use by WebTransport. + void Close() { + DVLOG(1) << "DatagramUnderlyingSource::Close()"; + + if (queue_.empty()) { + Controller()->Close(); + } else { + close_when_queue_empty_ = true; + } + } + + void Error(v8::Local<v8::Value> error) { + DVLOG(1) << "DatagramUnderlyingSource::Error()"; + + waiting_for_datagrams_ = false; + DiscardQueue(); + Controller()->Error(error); + } + + void OnDatagramReceived(base::span<const uint8_t> data) { + DVLOG(1) << "DatagramUnderlyingSource::OnDatagramReceived() size=" + << data.size(); + + // We should not receive any datagrams after Close() was called. + DCHECK(!close_when_queue_empty_); + + if (canceled_) { + return; + } + + auto* datagram = DOMUint8Array::Create(data.data(), data.size()); + + // This fast path is expected to be hit frequently. Avoid the queue. + if (waiting_for_datagrams_) { + DCHECK(queue_.empty()); + waiting_for_datagrams_ = false; + // This may run JavaScript, so it has to be called immediately before + // returning to avoid confusion caused by re-entrant usage. + Controller()->Enqueue(datagram); + return; + } + + DiscardExcessDatagrams(); + + auto high_water_mark = HighWaterMark(); + + // A high water mark of 0 has the semantics that all datagrams are discarded + // unless there is read pending. This might be useful to someone, so support + // it. + if (high_water_mark == 0) { + DCHECK(queue_.empty()); + return; + } + + if (queue_.size() == high_water_mark) { + // Need to get rid of an entry for the new one to replace. + queue_.pop_front(); + } + + auto now = base::TimeTicks::Now(); + queue_.push_back(MakeGarbageCollected<QueueEntry>(datagram, now)); + MaybeExpireDatagrams(now); + } + void Trace(Visitor* visitor) const override { - visitor->Trace(web_transport_); + visitor->Trace(queue_); + visitor->Trace(datagram_duplex_stream_); + visitor->Trace(expiry_timer_); UnderlyingSourceBase::Trace(visitor); } private: - Member<WebTransport> web_transport_; + struct QueueEntry : GarbageCollected<QueueEntry> { + QueueEntry(DOMUint8Array* datagram, base::TimeTicks received_time) + : datagram(datagram), received_time(received_time) {} + + const Member<DOMUint8Array> datagram; + const base::TimeTicks received_time; + + void Trace(Visitor* visitor) const { visitor->Trace(datagram); } + }; + + void DiscardExcessDatagrams() { + DVLOG(1) + << "DatagramUnderlyingSource::DiscardExcessDatagrams() queue_.size=" + << queue_.size(); + + wtf_size_t high_water_mark = HighWaterMark(); + + // The high water mark may have been set to a lower value, so the size can + // be greater. + while (queue_.size() > high_water_mark) { + // TODO(ricea): Maybe free the memory associated with the array + // buffer? + queue_.pop_front(); + } + + if (queue_.empty()) { + DVLOG(1) << "DiscardExcessDatagrams: queue size now zero"; + expiry_timer_.Stop(); + } + } + + void DiscardQueue() { + queue_.clear(); + expiry_timer_.Stop(); + } + + void ExpiryTimerFired(TimerBase*) { + DVLOG(1) << "DatagramUnderlyingSource::ExpiryTimerFired()"; + + MaybeExpireDatagrams(); + } + + void MaybeExpireDatagrams() { MaybeExpireDatagrams(base::TimeTicks::Now()); } + + void MaybeExpireDatagrams(base::TimeTicks now) { + DVLOG(1) << "DatagramUnderlyingSource::MaybeExpireDatagrams() now=" << now + << " queue_.size=" << queue_.size(); + + absl::optional<double> optional_max_age = + datagram_duplex_stream_->incomingMaxAge(); + bool max_age_is_default = false; + base::TimeDelta max_age; + if (optional_max_age.has_value()) { + max_age = base::TimeDelta::FromMillisecondsD(optional_max_age.value()); + } else { + max_age_is_default = true; + max_age = kDefaultIncomingMaxAge; + } + + DCHECK_GT(now, base::TimeTicks()); + + // base::TimeTicks can take negative values, so this subtraction won't + // underflow even if MaxAge() is huge. + base::TimeTicks older_than = now - max_age; + + bool discarded = false; + while (!queue_.empty() && queue_.front()->received_time < older_than) { + discarded = true; + queue_.pop_front(); + } + + if (discarded && max_age_is_default) { + if (auto* execution_context = GetExecutionContext()) { + execution_context->AddConsoleMessage( + MakeGarbageCollected<ConsoleMessage>( + mojom::blink::ConsoleMessageSource::kNetwork, + mojom::blink::ConsoleMessageLevel::kWarning, + "Incoming datagram was discarded by WebTransport due to " + "reaching default incomingMaxAge"), + true); + } + } + + if (queue_.empty()) { + DVLOG(1) << "MaybeExpireDatagrams queue is now empty"; + expiry_timer_.Stop(); + return; + } + + base::TimeDelta age = now - queue_.front()->received_time; + DCHECK_GE(max_age, age); + base::TimeDelta time_until_next_expiry = max_age - age; + + // To reduce the number of wakeups, don't try to expire any more datagrams + // for at least a second. + if (time_until_next_expiry < base::TimeDelta::FromSeconds(1)) { + time_until_next_expiry = base::TimeDelta::FromSeconds(1); + } + + if (expiry_timer_.IsActive() && + expiry_timer_.NextFireInterval() <= time_until_next_expiry) { + return; + } + + expiry_timer_.StartOneShot(time_until_next_expiry, FROM_HERE); + } + + wtf_size_t HighWaterMark() const { + return base::checked_cast<wtf_size_t>( + datagram_duplex_stream_->incomingHighWaterMark()); + } + + HeapDeque<Member<const QueueEntry>> queue_; + const Member<DatagramDuplexStream> datagram_duplex_stream_; + HeapTaskRunnerTimer<DatagramUnderlyingSource> expiry_timer_; + bool waiting_for_datagrams_ = false; + bool canceled_ = false; + bool close_when_queue_empty_ = false; }; class WebTransport::StreamVendingUnderlyingSource final @@ -529,10 +762,7 @@ } cleanly_closed_ = true; - if (received_datagrams_controller_) { - received_datagrams_controller_->Close(); - received_datagrams_controller_ = nullptr; - } + datagram_underlying_source_->Close(); received_streams_underlying_source_->Close(); received_bidirectional_streams_underlying_source_->Close(); @@ -603,24 +833,7 @@ } void WebTransport::OnDatagramReceived(base::span<const uint8_t> data) { - ReadableStreamDefaultControllerWithScriptScope* controller = - received_datagrams_controller_; - - // Discard datagrams if the readable has been cancelled. - if (!controller) - return; - - // The spec says we should discard older datagrams first, but that's not what - // ReadableStream does, so instead we might need to maintain a separate queue - // with the desired semantics. But for now we'll just use a small queue in - // ReadableStream. - // TODO(ricea): Figure out how to get nice semantics here. - - if (controller->DesiredSize() > 0) { - auto* array = DOMUint8Array::Create( - data.data(), base::checked_cast<wtf_size_t>(data.size())); - controller->Enqueue(array); - } + datagram_underlying_source_->OnDatagramReceived(data); } void WebTransport::OnIncomingStreamClosed(uint32_t stream_id, @@ -666,7 +879,7 @@ void WebTransport::Trace(Visitor* visitor) const { visitor->Trace(datagrams_); visitor->Trace(received_datagrams_); - visitor->Trace(received_datagrams_controller_); + visitor->Trace(datagram_underlying_source_); visitor->Trace(outgoing_datagrams_); visitor->Trace(script_state_); visitor->Trace(create_stream_resolvers_); @@ -771,13 +984,10 @@ datagrams_ = MakeGarbageCollected<DatagramDuplexStream>( this, outgoing_datagrams_high_water_mark); - // The choice of 1 for the ReadableStream means that it will queue one - // datagram even when read() is not being called. Unfortunately, that datagram - // may become arbitrarily stale. - // TODO(ricea): Consider having a datagram queue inside this class instead. + datagram_underlying_source_ = + MakeGarbageCollected<DatagramUnderlyingSource>(script_state_, datagrams_); received_datagrams_ = ReadableStream::CreateWithCountQueueingStrategy( - script_state_, - MakeGarbageCollected<DatagramUnderlyingSource>(script_state_, this), 1); + script_state_, datagram_underlying_source_, 0); // We create a WritableStream with high water mark 1 and try to mimic the // given high water mark in the Sink, from two reasons: @@ -836,10 +1046,7 @@ if (!cleanly_closed_) { v8::Local<v8::Value> reason = V8ThrowException::CreateTypeError( script_state_->GetIsolate(), "Connection lost."); - if (received_datagrams_controller_) { - received_datagrams_controller_->Error(reason); - received_datagrams_controller_ = nullptr; - } + datagram_underlying_source_->Error(reason); received_streams_underlying_source_->Error(reason); received_bidirectional_streams_underlying_source_->Error(reason); WritableStreamDefaultController::ErrorIfNeeded(
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.h b/third_party/blink/renderer/modules/webtransport/web_transport.h index 50e6045..c3b9e81 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport.h +++ b/third_party/blink/renderer/modules/webtransport/web_transport.h
@@ -30,7 +30,6 @@ class DatagramDuplexStream; class ExceptionState; class ReadableStream; -class ReadableStreamDefaultControllerWithScriptScope; class ScriptPromise; class ScriptPromiseResolver; class ScriptState; @@ -135,8 +134,7 @@ Member<DatagramDuplexStream> datagrams_; Member<ReadableStream> received_datagrams_; - Member<ReadableStreamDefaultControllerWithScriptScope> - received_datagrams_controller_; + Member<DatagramUnderlyingSource> datagram_underlying_source_; // This corresponds to the [[SentDatagrams]] internal slot in the standard. Member<WritableStream> outgoing_datagrams_;
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport_test.cc b/third_party/blink/renderer/modules/webtransport/web_transport_test.cc index 3dc18cfe..351e53cd 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport_test.cc +++ b/third_party/blink/renderer/modules/webtransport/web_transport_test.cc
@@ -766,6 +766,19 @@ return result; } +bool IsDone(ScriptState* script_state, ScriptValue iterator_result) { + bool done = false; + v8::Local<v8::Value> value; + if (!V8UnpackIteratorResult(script_state, + iterator_result.V8Value().As<v8::Object>(), &done) + .ToLocal(&value)) { + ADD_FAILURE() << "unable to unpack iterator_result"; + return false; + } + + return done; +} + TEST_F(WebTransportTest, ReceiveDatagramBeforeRead) { V8TestingScope scope; auto* web_transport = @@ -808,18 +821,121 @@ EXPECT_THAT(GetValueAsVector(script_state, tester.Value()), ElementsAre('A')); } -// This test documents the current behaviour. If you improve the behaviour, -// change the test! +TEST_F(WebTransportTest, CancelDatagramReadableWorks) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + auto* readable = web_transport->datagrams()->readable(); + + // This datagram should be discarded. + const std::array<uint8_t, 1> chunk1 = {'A'}; + client_remote_->OnDatagramReceived(chunk1); + + test::RunPendingTasks(); + + readable->cancel(scope.GetScriptState(), ASSERT_NO_EXCEPTION); + + // This datagram should also be discarded. + const std::array<uint8_t, 1> chunk2 = {'B'}; + client_remote_->OnDatagramReceived(chunk2); + + test::RunPendingTasks(); +} + +TEST_F(WebTransportTest, DatagramsStillReadableAfterClose) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + const std::array<uint8_t, 1> chunk1 = {'A'}; + client_remote_->OnDatagramReceived(chunk1); + + test::RunPendingTasks(); + + web_transport->close(nullptr); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + ScriptPromise result1 = reader->read(script_state, ASSERT_NO_EXCEPTION); + ScriptPromiseTester tester1(script_state, result1); + tester1.WaitUntilSettled(); + EXPECT_TRUE(tester1.IsFulfilled()); + EXPECT_THAT(GetValueAsVector(script_state, tester1.Value()), + ElementsAre('A')); + + ScriptPromise result2 = reader->read(script_state, ASSERT_NO_EXCEPTION); + ScriptPromiseTester tester2(script_state, result2); + tester2.WaitUntilSettled(); + EXPECT_TRUE(tester2.IsFulfilled()); + EXPECT_TRUE(IsDone(script_state, tester2.Value())); +} + +TEST_F(WebTransportTest, ResettingIncomingHighWaterMarkWorksAfterClose) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + const std::array<uint8_t, 1> chunk1 = {'A'}; + client_remote_->OnDatagramReceived(chunk1); + + test::RunPendingTasks(); + + web_transport->close(nullptr); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + + web_transport->datagrams()->setIncomingHighWaterMark(0); + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + EXPECT_TRUE(tester.IsFulfilled()); + EXPECT_TRUE(IsDone(script_state, tester.Value())); +} + +TEST_F(WebTransportTest, TransportErrorErrorsReadableStream) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + // This datagram should be discarded. + const std::array<uint8_t, 1> chunk1 = {'A'}; + client_remote_->OnDatagramReceived(chunk1); + + test::RunPendingTasks(); + + // Cause a transport error. + client_remote_.reset(); + + test::RunPendingTasks(); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + EXPECT_TRUE(tester.IsRejected()); +} + TEST_F(WebTransportTest, DatagramsAreDropped) { V8TestingScope scope; auto* web_transport = CreateAndConnectSuccessfully(scope, "https://example.com"); - // Chunk 'A' gets placed in the readable queue. + // Chunk 'A' gets placed in the source queue. const std::array<uint8_t, 1> chunk1 = {'A'}; client_remote_->OnDatagramReceived(chunk1); - // Chunk 'B' gets dropped, because there is no space in the readable queue. + // Chunk 'B' replaces chunk 'A'. const std::array<uint8_t, 1> chunk2 = {'B'}; client_remote_->OnDatagramReceived(chunk2); @@ -840,7 +956,7 @@ EXPECT_FALSE(tester2.IsFulfilled()); EXPECT_THAT(GetValueAsVector(script_state, tester1.Value()), - ElementsAre('A')); + ElementsAre('B')); // Chunk 'C' fulfills the pending read. const std::array<uint8_t, 1> chunk3 = {'C'}; @@ -853,6 +969,136 @@ ElementsAre('C')); } +TEST_F(WebTransportTest, IncomingHighWaterMarkIsObeyed) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + constexpr int32_t kHighWaterMark = 5; + web_transport->datagrams()->setIncomingHighWaterMark(kHighWaterMark); + + for (int i = 0; i < kHighWaterMark + 1; ++i) { + const std::array<uint8_t, 1> chunk = {static_cast<uint8_t>('0' + i)}; + client_remote_->OnDatagramReceived(chunk); + } + + // Make sure that the calls have run. + test::RunPendingTasks(); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + + for (int i = 0; i < kHighWaterMark; ++i) { + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + EXPECT_TRUE(tester.IsFulfilled()); + EXPECT_THAT(GetValueAsVector(script_state, tester.Value()), + ElementsAre('0' + i + 1)); + } +} + +TEST_F(WebTransportTest, ResettingHighWaterMarkClearsQueue) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + constexpr int32_t kHighWaterMark = 5; + web_transport->datagrams()->setIncomingHighWaterMark(kHighWaterMark); + + for (int i = 0; i < kHighWaterMark; ++i) { + const std::array<uint8_t, 1> chunk = {'A'}; + client_remote_->OnDatagramReceived(chunk); + } + + // Make sure that the calls have run. + test::RunPendingTasks(); + + web_transport->datagrams()->setIncomingHighWaterMark(0); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + + // Give the promise an opportunity to settle. + test::RunPendingTasks(); + + // The queue should be empty, so read() should not have completed. + EXPECT_FALSE(tester.IsFulfilled()); + EXPECT_FALSE(tester.IsRejected()); +} + +TEST_F(WebTransportTest, ReadIncomingDatagramWorksWithHighWaterMarkZero) { + V8TestingScope scope; + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + web_transport->datagrams()->setIncomingHighWaterMark(0); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + const std::array<uint8_t, 1> chunk = {'A'}; + client_remote_->OnDatagramReceived(chunk); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + EXPECT_TRUE(tester.IsFulfilled()); + + EXPECT_THAT(GetValueAsVector(script_state, tester.Value()), ElementsAre('A')); +} + +// We only do an extremely basic test for incomingMaxAge as overriding +// base::TimeTicks::Now() doesn't work well in Blink and passing in a mock clock +// would add a lot of complexity for little benefit. +TEST_F(WebTransportTest, IncomingMaxAgeIsObeyed) { + V8TestingScope scope; + + auto* web_transport = + CreateAndConnectSuccessfully(scope, "https://example.com"); + + web_transport->datagrams()->setIncomingHighWaterMark(2); + + const std::array<uint8_t, 1> chunk1 = {'A'}; + client_remote_->OnDatagramReceived(chunk1); + + const std::array<uint8_t, 1> chunk2 = {'B'}; + client_remote_->OnDatagramReceived(chunk2); + + test::RunPendingTasks(); + + constexpr base::TimeDelta kMaxAge = base::TimeDelta::FromMicroseconds(1); + web_transport->datagrams()->setIncomingMaxAge(kMaxAge.InMillisecondsF()); + + test::RunDelayedTasks(kMaxAge); + + auto* readable = web_transport->datagrams()->readable(); + auto* script_state = scope.GetScriptState(); + auto* reader = + readable->GetDefaultReaderForTesting(script_state, ASSERT_NO_EXCEPTION); + + // The queue should be empty so the read should not complete. + ScriptPromise result = reader->read(script_state, ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + + test::RunPendingTasks(); + + EXPECT_FALSE(tester.IsFulfilled()); + EXPECT_FALSE(tester.IsRejected()); +} + bool ValidProducerHandle(const mojo::ScopedDataPipeProducerHandle& handle) { return handle.is_valid(); }
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 232376d..e824121 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1669,6 +1669,7 @@ deps = [ "//base:base_static", "//base/allocator:buildflags", + "//build:chromecast_buildflags", "//build:chromeos_buildflags", "//cc/ipc", "//cc/mojo_embedder", @@ -1686,6 +1687,7 @@ "//media", "//media/capture:capture_switches", "//media/capture/mojom:video_capture", + "//media/webrtc:webrtc", "//mojo/public/cpp/bindings:wtf_support", "//services/metrics/public/cpp:ukm_builders", "//services/network/public/mojom:mojom_shared",
diff --git a/third_party/blink/renderer/platform/exported/platform.cc b/third_party/blink/renderer/platform/exported/platform.cc index c7faf3c..0cd64e0 100644 --- a/third_party/blink/renderer/platform/exported/platform.cc +++ b/third_party/blink/renderer/platform/exported/platform.cc
@@ -44,6 +44,7 @@ #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" +#include "third_party/blink/public/platform/web_url_loader_factory.h" #include "third_party/blink/public/platform/websocket_handshake_throttle.h" #include "third_party/blink/renderer/platform/bindings/parkable_string_manager.h" #include "third_party/blink/renderer/platform/font_family_names.h" @@ -287,12 +288,29 @@ return g_platform; } +std::unique_ptr<WebURLLoaderFactory> Platform::WrapURLLoaderFactory( + CrossVariantMojoRemote<network::mojom::URLLoaderFactoryInterfaceBase>) { + return nullptr; +} + std::unique_ptr<blink::WebURLLoaderFactory> Platform::WrapSharedURLLoaderFactory( scoped_refptr<network::SharedURLLoaderFactory> factory) { return nullptr; } +void Platform::CreateServiceWorkerSubresourceLoaderFactory( + CrossVariantMojoRemote<mojom::ServiceWorkerContainerHostInterfaceBase> + service_worker_container_host, + const WebString& client_id, + std::unique_ptr<network::PendingSharedURLLoaderFactory> fallback_factory, + mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver, + scoped_refptr<base::SequencedTaskRunner> task_runner, + scoped_refptr<base::SequencedTaskRunner> worker_timing_callback_task_runner, + base::RepeatingCallback< + void(int, mojo::PendingReceiver<blink::mojom::WorkerTimingContainer>)> + worker_timing_callback) {} + ThreadSafeBrowserInterfaceBrokerProxy* Platform::GetBrowserInterfaceBroker() { DEFINE_STATIC_LOCAL(DefaultBrowserInterfaceBrokerProxy, proxy, ()); return &proxy;
diff --git a/third_party/blink/renderer/platform/fonts/font_cache_key.h b/third_party/blink/renderer/platform/fonts/font_cache_key.h index a860a0a..fcf08468 100644 --- a/third_party/blink/renderer/platform/fonts/font_cache_key.h +++ b/third_party/blink/renderer/platform/fonts/font_cache_key.h
@@ -33,6 +33,7 @@ #include <limits> +#include "build/build_config.h" #include "third_party/blink/renderer/platform/fonts/font_face_creation_params.h" #include "third_party/blink/renderer/platform/fonts/opentype/font_settings.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -51,12 +52,7 @@ DISALLOW_NEW(); public: - FontCacheKey() - : creation_params_(), - font_size_(0), - options_(0), - device_scale_factor_(0), - is_unique_match_(false) {} + FontCacheKey() = default; FontCacheKey(FontFaceCreationParams creation_params, float font_size, unsigned options, @@ -83,12 +79,16 @@ // Convert from float with 3 digit precision before hashing. unsigned device_scale_factor_hash = device_scale_factor_ * 1000; unsigned hash_codes[6] = { - creation_params_.GetHash(), - font_size_, - options_, - device_scale_factor_hash, - variation_settings_ ? variation_settings_->GetHash() : 0, - is_unique_match_}; + creation_params_.GetHash(), + font_size_, + options_, + device_scale_factor_hash, +#if defined(OS_ANDROID) + (locale_.IsEmpty() ? 0 : AtomicStringHash::GetHash(locale_)) ^ +#endif // defined(OS_ANDROID) + (variation_settings_ ? variation_settings_->GetHash() : 0), + is_unique_match_ + }; return StringHasher::HashMemory<sizeof(hash_codes)>(hash_codes); } @@ -100,6 +100,9 @@ return creation_params_ == other.creation_params_ && font_size_ == other.font_size_ && options_ == other.options_ && device_scale_factor_ == other.device_scale_factor_ && +#if defined(OS_ANDROID) + locale_ == other.locale_ && +#endif // defined(OS_ANDROID) variation_settings_equal && is_unique_match_ == other.is_unique_match_; } @@ -112,18 +115,26 @@ void ClearFontSize() { font_size_ = 0; } - private: +#if defined(OS_ANDROID) + // Set the locale if the font is locale-specific. This allows different + // |FontPlatformData| instances for each locale. + void SetLocale(const AtomicString& locale) { locale_ = locale.LowerASCII(); } +#endif // defined(OS_ANDROID) + private: FontFaceCreationParams creation_params_; - unsigned font_size_; - unsigned options_; + unsigned font_size_ = 0; + unsigned options_ = 0; // FontCacheKey is the key to retrieve FontPlatformData entries from the // FontCache. FontPlatformData queries the platform's font render style, which // is dependent on the device scale factor. That's why we need // device_scale_factor_ to be a part of computing the cache key. - float device_scale_factor_; + float device_scale_factor_ = 0; +#if defined(OS_ANDROID) + AtomicString locale_; +#endif // defined(OS_ANDROID) scoped_refptr<FontVariationSettings> variation_settings_; - bool is_unique_match_; + bool is_unique_match_ = false; }; struct FontCacheKeyHash {
diff --git a/third_party/blink/renderer/platform/fonts/font_cache_test.cc b/third_party/blink/renderer/platform/fonts/font_cache_test.cc index 6edad348..9832dc4c 100644 --- a/third_party/blink/renderer/platform/fonts/font_cache_test.cc +++ b/third_party/blink/renderer/platform/fonts/font_cache_test.cc
@@ -145,4 +145,20 @@ } #endif +#if defined(OS_ANDROID) +TEST(FontCache, Locale) { + FontCacheKey key1(FontFaceCreationParams(), /* font_size */ 16, + /* options */ 0, /* device_scale_factor */ 1.0f, + /* variation_settings */ nullptr, + /* is_unique_match */ false); + FontCacheKey key2 = key1; + EXPECT_EQ(key1.GetHash(), key2.GetHash()); + EXPECT_EQ(key1, key2); + + key2.SetLocale("ja"); + EXPECT_NE(key1.GetHash(), key2.GetHash()); + EXPECT_NE(key1, key2); +} +#endif // defined(OS_ANDROID) + } // namespace blink
diff --git a/third_party/blink/renderer/platform/geometry/float_box.h b/third_party/blink/renderer/platform/geometry/float_box.h index 7ed79b4..6560df0 100644 --- a/third_party/blink/renderer/platform/geometry/float_box.h +++ b/third_party/blink/renderer/platform/geometry/float_box.h
@@ -53,13 +53,8 @@ float depth) : x_(x), y_(y), z_(z), width_(width), height_(height), depth_(depth) {} - constexpr FloatBox(const FloatBox& box) - : x_(box.X()), - y_(box.Y()), - z_(box.Z()), - width_(box.Width()), - height_(box.Height()), - depth_(box.Depth()) {} + constexpr FloatBox(const FloatBox&) = default; + constexpr FloatBox& operator=(const FloatBox&) = default; void SetOrigin(const FloatPoint3D& origin) { x_ = origin.X();
diff --git a/third_party/blink/renderer/platform/geometry/float_point_3d.h b/third_party/blink/renderer/platform/geometry/float_point_3d.h index bbe09db..2302ef3a 100644 --- a/third_party/blink/renderer/platform/geometry/float_point_3d.h +++ b/third_party/blink/renderer/platform/geometry/float_point_3d.h
@@ -44,8 +44,9 @@ constexpr FloatPoint3D(const FloatPoint& p) : x_(p.X()), y_(p.Y()), z_(0) {} - constexpr FloatPoint3D(const FloatPoint3D& p) - : x_(p.X()), y_(p.Y()), z_(p.Z()) {} + constexpr FloatPoint3D(const FloatPoint3D&) = default; + + constexpr FloatPoint3D& operator=(const FloatPoint3D&) = default; FloatPoint3D(const gfx::Point3F&);
diff --git a/third_party/blink/renderer/platform/geometry/float_rounded_rect.h b/third_party/blink/renderer/platform/geometry/float_rounded_rect.h index b5f7e1b..ad7281c 100644 --- a/third_party/blink/renderer/platform/geometry/float_rounded_rect.h +++ b/third_party/blink/renderer/platform/geometry/float_rounded_rect.h
@@ -58,11 +58,8 @@ bottom_left_(bottom_left), bottom_right_(bottom_right) {} - constexpr Radii(const FloatRoundedRect::Radii& int_radii) - : top_left_(int_radii.TopLeft()), - top_right_(int_radii.TopRight()), - bottom_left_(int_radii.BottomLeft()), - bottom_right_(int_radii.BottomRight()) {} + constexpr Radii(const Radii&) = default; + constexpr Radii& operator=(const Radii&) = default; void SetTopLeft(const FloatSize& size) { top_left_ = size; } void SetTopRight(const FloatSize& size) { top_right_ = size; }
diff --git a/third_party/blink/renderer/platform/graphics/rw_buffer_test.cc b/third_party/blink/renderer/platform/graphics/rw_buffer_test.cc index 6143a01..f7b4ad1 100644 --- a/third_party/blink/renderer/platform/graphics/rw_buffer_test.cc +++ b/third_party/blink/renderer/platform/graphics/rw_buffer_test.cc
@@ -45,6 +45,7 @@ : reader_(reader), i_(i) {} ROBufferTestThread() = default; ROBufferTestThread(const ROBufferTestThread&) = default; + ROBufferTestThread& operator=(const ROBufferTestThread&) = default; void ThreadMain() override { EXPECT_EQ((i_ + 1) * 26U, reader_->size());
diff --git a/third_party/blink/renderer/platform/heap/impl/member.h b/third_party/blink/renderer/platform/heap/impl/member.h index 97073bff..d5d373f8 100644 --- a/third_party/blink/renderer/platform/heap/impl/member.h +++ b/third_party/blink/renderer/platform/heap/impl/member.h
@@ -425,6 +425,8 @@ UntracedMember(T* raw) : Parent(raw) {} + UntracedMember(const UntracedMember& other) : Parent(other) {} + template <typename U> UntracedMember(const Persistent<U>& other) : Parent(other) {}
diff --git a/third_party/blink/renderer/platform/mediastream/DEPS b/third_party/blink/renderer/platform/mediastream/DEPS index df126aa..fe894df 100644 --- a/third_party/blink/renderer/platform/mediastream/DEPS +++ b/third_party/blink/renderer/platform/mediastream/DEPS
@@ -9,6 +9,7 @@ "+base/atomicops.h", "+media/base", "+media/webrtc/audio_processor_controls.h", + "+media/webrtc/webrtc_switches.h", "+third_party/blink/renderer/platform/audio", "+third_party/blink/renderer/platform/heap", "+third_party/blink/renderer/platform/peerconnection/rtc_api_name.h",
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.cc b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.cc index eda8523..c97573b 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.cc +++ b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.cc
@@ -8,15 +8,17 @@ #include <utility> #include "base/feature_list.h" -#include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/logging.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/string_util.h" #include "base/values.h" #include "build/build_config.h" +#include "build/chromecast_buildflags.h" #include "media/base/audio_parameters.h" +#include "media/webrtc/webrtc_switches.h" +#include "third_party/webrtc/api/audio/echo_canceller3_config.h" +#include "third_party/webrtc/api/audio/echo_canceller3_config_json.h" +#include "third_party/webrtc/api/audio/echo_canceller3_factory.h" #include "third_party/webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" @@ -85,6 +87,80 @@ } } +bool Allow48kHzApmProcessing() { + return base::FeatureList::IsEnabled( + ::features::kWebRtcAllow48kHzProcessingOnArm); +} + +absl::optional<WebRtcHybridAgcParams> GetWebRtcHybridAgcParams() { + if (!base::FeatureList::IsEnabled(::features::kWebRtcHybridAgc)) { + return absl::nullopt; + } + return WebRtcHybridAgcParams{ + .dry_run = base::GetFieldTrialParamByFeatureAsBool( + ::features::kWebRtcHybridAgc, "dry_run", false), + .vad_reset_period_ms = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcHybridAgc, "vad_reset_period_ms", 1500), + .adjacent_speech_frames_threshold = + base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcHybridAgc, "adjacent_speech_frames_threshold", + 12), + .max_gain_change_db_per_second = + static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( + ::features::kWebRtcHybridAgc, "max_gain_change_db_per_second", + 3)), + .max_output_noise_level_dbfs = + static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( + ::features::kWebRtcHybridAgc, "max_output_noise_level_dbfs", + -50)), + .sse2_allowed = base::GetFieldTrialParamByFeatureAsBool( + ::features::kWebRtcHybridAgc, "sse2_allowed", true), + .avx2_allowed = base::GetFieldTrialParamByFeatureAsBool( + ::features::kWebRtcHybridAgc, "avx2_allowed", true), + .neon_allowed = base::GetFieldTrialParamByFeatureAsBool( + ::features::kWebRtcHybridAgc, "neon_allowed", true)}; +} + +absl::optional<WebRtcAnalogAgcClippingControlParams> +GetWebRtcAnalogAgcClippingControlParams() { + if (!base::FeatureList::IsEnabled( + ::features::kWebRtcAnalogAgcClippingControl)) { + return absl::nullopt; + } + return WebRtcAnalogAgcClippingControlParams{ + .mode = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, "mode", 0), + .window_length = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, "window_length", 5), + .reference_window_length = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, + "reference_window_length", 5), + .reference_window_delay = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, "reference_window_delay", + 5), + .clipping_threshold = + static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( + ::features::kWebRtcAnalogAgcClippingControl, "clipping_threshold", + -1.0)), + .crest_factor_margin = + static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( + ::features::kWebRtcAnalogAgcClippingControl, + "crest_factor_margin", 3.0)), + .clipped_level_step = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, "clipped_level_step", + 15), + .clipped_ratio_threshold = + static_cast<float>(base::GetFieldTrialParamByFeatureAsDouble( + ::features::kWebRtcAnalogAgcClippingControl, + "clipped_ratio_threshold", 0.1)), + .clipped_wait_frames = base::GetFieldTrialParamByFeatureAsInt( + ::features::kWebRtcAnalogAgcClippingControl, "clipped_wait_frames", + 300), + .use_predicted_step = base::GetFieldTrialParamByFeatureAsBool( + ::features::kWebRtcAnalogAgcClippingControl, "use_predicted_step", + true)}; +} + } // namespace void AudioProcessingProperties::DisableDefaultProperties() { @@ -345,4 +421,89 @@ } } +std::unique_ptr<webrtc::AudioProcessing> CreateWebRtcAudioProcessingModule( + const AudioProcessingProperties& properties, + bool use_capture_multi_channel_processing, + absl::optional<std::string> audio_processing_platform_config_json, + absl::optional<int> agc_startup_min_volume) { + // Experimental options provided at creation. + webrtc::Config config; + config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs( + properties.goog_experimental_noise_suppression)); + + // TODO(bugs.webrtc.org/7494): Move logic below in ConfigAutomaticGainControl. + // Retrieve the Hybrid AGC experiment parameters. + // The hybrid AGC setup, that is AGC1 analog and AGC2 adaptive digital, + // requires `goog_auto_gain_control` and `goog_experimental_auto_gain_control` + // to be both active. + absl::optional<WebRtcHybridAgcParams> hybrid_agc_params; + absl::optional<WebRtcAnalogAgcClippingControlParams> clipping_control_params; + if (properties.goog_auto_gain_control && + properties.goog_experimental_auto_gain_control) { + hybrid_agc_params = GetWebRtcHybridAgcParams(); + clipping_control_params = GetWebRtcAnalogAgcClippingControlParams(); + } + // If the experimental AGC is enabled, check for overridden config params. + if (properties.goog_experimental_auto_gain_control) { + auto* experimental_agc = new webrtc::ExperimentalAgc( + /*enabled=*/true, agc_startup_min_volume.value_or(0)); + // Disable the AGC1 adaptive digital controller if the hybrid AGC is enabled + // and it's not running in dry-run mode. + experimental_agc->digital_adaptive_disabled = + hybrid_agc_params.has_value() && !hybrid_agc_params->dry_run; + config.Set<webrtc::ExperimentalAgc>(experimental_agc); +#if BUILDFLAG(IS_CHROMECAST) + } else { + // Do not use the analog controller. + config.Set<webrtc::ExperimentalAgc>( + new webrtc::ExperimentalAgc(/*enabled=*/false)); +#endif // BUILDFLAG(IS_CHROMECAST) + } + + // Create and configure the webrtc::AudioProcessing. + webrtc::AudioProcessingBuilder ap_builder; + if (properties.EchoCancellationIsWebRtcProvided()) { + webrtc::EchoCanceller3Config aec3_config; + if (audio_processing_platform_config_json) { + aec3_config = webrtc::Aec3ConfigFromJsonString( + *audio_processing_platform_config_json); + bool config_parameters_already_valid = + webrtc::EchoCanceller3Config::Validate(&aec3_config); + RTC_DCHECK(config_parameters_already_valid); + } + + ap_builder.SetEchoControlFactory( + std::unique_ptr<webrtc::EchoControlFactory>( + new webrtc::EchoCanceller3Factory(aec3_config))); + } + std::unique_ptr<webrtc::AudioProcessing> audio_processing_module( + ap_builder.Create(config)); + + webrtc::AudioProcessing::Config apm_config = + audio_processing_module->GetConfig(); + apm_config.pipeline.multi_channel_render = true; + apm_config.pipeline.multi_channel_capture = + use_capture_multi_channel_processing; + + absl::optional<double> gain_control_compression_gain_db; + PopulateApmConfig(&apm_config, properties, + audio_processing_platform_config_json, + &gain_control_compression_gain_db); + + // Set up gain control functionalities. + ConfigAutomaticGainControl(properties, hybrid_agc_params, + clipping_control_params, + gain_control_compression_gain_db, apm_config); + + // Ensure that 48 kHz APM processing is always active. This overrules the + // default setting in WebRTC of 32 kHz for ARM platforms. + if (Allow48kHzApmProcessing()) { + apm_config.pipeline.maximum_internal_processing_rate = 48000; + } + + apm_config.residual_echo_detector.enabled = false; + audio_processing_module->ApplyConfig(apm_config); + return audio_processing_module; +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.h b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.h index e5e0b20..1ea1ee13 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.h +++ b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.h
@@ -8,25 +8,13 @@ #include <string> #include "base/files/file.h" -#include "base/threading/thread_checker.h" #include "build/build_config.h" -#include "media/base/audio_point.h" #include "media/base/audio_processing.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#include "third_party/blink/public/common/mediastream/media_stream_request.h" -#include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/webrtc/api/media_stream_interface.h" -#include "third_party/webrtc/media/base/media_channel.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" #include "third_party/webrtc/rtc_base/task_queue.h" -namespace webrtc { - -class TypingDetection; - -} - namespace blink { using webrtc::AudioProcessing; @@ -100,6 +88,18 @@ bool goog_experimental_auto_gain_control = true; }; +// Creates and configures a webrtc::AudioProcessing audio processing module +// (APM), based on the provided parameters. The optional parameters +// |audio_processing_platform_config_json| and |agc_startup_min_volume| contain +// specific parameter tunings provided by the platform. If possible, it is +// preferred to instead use field trials for testing new parameter sets. +PLATFORM_EXPORT std::unique_ptr<AudioProcessing> +CreateWebRtcAudioProcessingModule( + const AudioProcessingProperties& properties, + bool use_capture_multi_channel_processing, + absl::optional<std::string> audio_processing_platform_config_json, + absl::optional<int> agc_startup_min_volume); + // Starts the echo cancellation dump in // |audio_processing|. |worker_queue| must be kept alive until either // |audio_processing| is destroyed, or
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options_test.cc b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options_test.cc index f3b5673..b6b91b93 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options_test.cc +++ b/third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options_test.cc
@@ -292,4 +292,38 @@ EXPECT_FALSE(apm_config_with_system_ns.noise_suppression.enabled); } +// Verify that some basic settings have the expected default values. +TEST(CreateWebRtcAudioProcessingModuleTest, VerifyDefaultSettings) { + AudioProcessingProperties properties; + + std::unique_ptr<webrtc::AudioProcessing> apm = + CreateWebRtcAudioProcessingModule( + properties, /*use_capture_multi_channel_processing=*/true, + /*audio_processing_platform_config_json=*/absl::nullopt, + /*agc_startup_min_volume=*/absl::nullopt); + ASSERT_TRUE(!!apm); + + webrtc::AudioProcessing::Config config = apm->GetConfig(); + + EXPECT_TRUE(config.pipeline.multi_channel_render); + EXPECT_TRUE(config.pipeline.multi_channel_capture); + EXPECT_TRUE(config.high_pass_filter.enabled); + EXPECT_TRUE(config.echo_canceller.enabled); + EXPECT_TRUE(config.gain_controller1.enabled); + EXPECT_TRUE(config.gain_controller1.analog_gain_controller.enabled); + EXPECT_FALSE(config.gain_controller2.enabled); + EXPECT_TRUE(config.noise_suppression.enabled); + EXPECT_FALSE(config.voice_detection.enabled); + +#if defined(OS_ANDROID) + // Android uses echo cancellation optimized for mobiles, and does not support + // keytap suppression. + EXPECT_TRUE(config.echo_canceller.mobile_mode); + EXPECT_FALSE(config.transient_suppression.enabled); +#else + EXPECT_FALSE(config.echo_canceller.mobile_mode); + EXPECT_TRUE(config.transient_suppression.enabled); +#endif +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h index d36e96d..76b6985 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h
@@ -182,6 +182,7 @@ "Wrong Instanstiation for kPrioritisationTypeWidthBits"); QueueTraits(const QueueTraits&) = default; + QueueTraits& operator=(const QueueTraits&) = default; QueueTraits SetCanBeDeferred(bool value) { can_be_deferred = value;
diff --git a/third_party/blink/renderer/platform/text/text_run_iterator.h b/third_party/blink/renderer/platform/text/text_run_iterator.h index 4fe8374..c23a96af 100644 --- a/third_party/blink/renderer/platform/text/text_run_iterator.h +++ b/third_party/blink/renderer/platform/text/text_run_iterator.h
@@ -43,10 +43,9 @@ TextRunIterator(const TextRun* text_run, unsigned offset) : text_run_(text_run), offset_(offset), length_(text_run_->length()) {} - TextRunIterator(const TextRunIterator& other) - : text_run_(other.text_run_), - offset_(other.offset_), - length_(text_run_->length()) {} + TextRunIterator(const TextRunIterator&) = default; + + TextRunIterator& operator=(const TextRunIterator&) = default; unsigned Offset() const { return offset_; } void Increment() { offset_++; }
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index dcb607f..82eacb8 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4145,8 +4145,6 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/mouse-move-on-svg-container.xhtml [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/mouse-move-on-svg-container-standalone.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/path-textPath-simulation.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/pointer-events-text.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/pointer-events-text-css-transform.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/svg-root-with-opacity.html [ Failure Pass ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/text-match-highlight.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/custom/transformed-outlines.svg [ Failure ] @@ -4159,7 +4157,6 @@ crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/feDisplacementMap.svg [ Pass Timeout ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/filter-on-filter-for-text.svg [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/filters/filter-on-tspan.svg [ Failure ] -crbug.com/1179585 virtual/layout_ng_svg_text/svg/hittest/text-fill-none-with-nested-tspan.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/hittest/text-multiple-dx-values.svg [ Failure Pass ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/masking/mask-of-root.html [ Failure ] crbug.com/1179585 virtual/layout_ng_svg_text/svg/stroke/non-scaling-stroke-text-decoration.html [ Failure ] @@ -4744,9 +4741,6 @@ # Sheriff 2018-04-11 crbug.com/831796 fast/events/autoscroll-in-textfield.html [ Failure Pass ] -# DevTools underscore migration -crbug.com/1207342 http/tests/devtools/components/split-widget.js [ Failure Pass ] - # Sheriff 2018-04-13 crbug.com/833655 [ Linux ] media/controls/closed-captions-dynamic-update.html [ Skip ] crbug.com/833658 media/video-controls-focus-movement-on-hide.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html b/third_party/blink/web_tests/external/wpt/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html new file mode 100644 index 0000000..01ad92ea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.path.roundrect.radius.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.roundrect.radius.negative</h1> +<p class="desc">roundRect() with negative radius throws an exception</p> + + +<p class="output">Actual output:</p> +<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> + +<ul id="d"></ul> +<script> +var t = async_test("roundRect() with negative radius throws an exception"); +_addTest(function(canvas, ctx) { + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [-1]); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [1, -1]); }); +t.done(); + + +}); +</script> +
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html b/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html new file mode 100644 index 0000000..4c97373 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html
@@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.radius.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.negative</h1> +<p class="desc">roundRect() with negative radius throws an exception</p> + + +<script> +var t = async_test("roundRect() with negative radius throws an exception"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var offscreenCanvas = new OffscreenCanvas(100, 50); +var ctx = offscreenCanvas.getContext('2d'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [-1]); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [1, -1]); }); +t.done(); + +}); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js b/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js new file mode 100644 index 0000000..b941725 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js
@@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.radius.negative +// Description:roundRect() with negative radius throws an exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("roundRect() with negative radius throws an exception"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var offscreenCanvas = new OffscreenCanvas(100, 50); +var ctx = offscreenCanvas.getContext('2d'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [-1]); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.roundRect(0, 0, 0, 0, [1, -1]); }); +t.done(); + +}); +done();
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/path-objects.yaml b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/path-objects.yaml index 36194b1..0e40e8b 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/path-objects.yaml +++ b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/element/path-objects.yaml
@@ -2191,6 +2191,13 @@ code: | @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0]); +- name: 2d.path.roundrect.radius.negative + desc: roundRect() with negative radius throws an exception + code: | + @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 0, 0, [-1]); + @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 0, 0, [1, -1]); + t.done(); + - name: 2d.path.ellipse.basics desc: Verify canvas throws error when drawing ellipse with negative radii. testing:
diff --git a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/offscreen/path-objects.yaml b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/offscreen/path-objects.yaml index b8906eb6..c10b9d3 100644 --- a/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/offscreen/path-objects.yaml +++ b/third_party/blink/web_tests/external/wpt/html/canvas/tools/yaml/offscreen/path-objects.yaml
@@ -2192,6 +2192,13 @@ @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0]); t.done(); +- name: 2d.path.roundrect.radius.negative + desc: roundRect() with negative radius throws an exception + code: | + @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 0, 0, [-1]); + @assert throws INDEX_SIZE_ERR ctx.roundRect(0, 0, 0, 0, [1, -1]); + t.done(); + - name: 2d.path.fill.overlap testing: - 2d.path.fill.basic
diff --git a/third_party/blink/web_tests/external/wpt/urlpattern/resources/urlpatterntestdata.json b/third_party/blink/web_tests/external/wpt/urlpattern/resources/urlpatterntestdata.json index 019bf4f..8715b60b 100644 --- a/third_party/blink/web_tests/external/wpt/urlpattern/resources/urlpatterntestdata.json +++ b/third_party/blink/web_tests/external/wpt/urlpattern/resources/urlpatterntestdata.json
@@ -2058,18 +2058,6 @@ } }, { - "pattern": [ "https://foo{@}example.com" ], - "inputs": [ "https://foo@example.com" ], - "exactly_empty_components": [ "username", "password", "port", "search", - "hash" ], - "expected_obj": { - "protocol": "https", - "hostname": "foo%40example.com", - "pathname": "/" - }, - "expected_match": null - }, - { "pattern": [ "https://foo{\\:}bar@example.com" ], "inputs": [ "https://foo:bar@example.com" ], "exactly_empty_components": [ "password", "port", "search", "hash" ],
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/accent-color-contrast-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/accent-color-contrast-expected.png index 17e8a8066..59c25779 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/accent-color-contrast-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/accent-color-contrast-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png index 9e4c7e3..8cecc825 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/radio-accent-color-appearance-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/radio-accent-color-appearance-expected.png index 83a8768..52c6d67 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/radio-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/radio-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/range-accent-color-appearance-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/range-accent-color-appearance-expected.png index bd3fadf..c6f5282 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/range-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/accent-color/range-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/devtools/components/split-widget.js b/third_party/blink/web_tests/http/tests/devtools/components/split-widget.js index 6ffa49cd..f67d136 100644 --- a/third_party/blink/web_tests/http/tests/devtools/components/split-widget.js +++ b/third_party/blink/web_tests/http/tests/devtools/components/split-widget.js
@@ -32,7 +32,7 @@ TestRunner.addResult( ' Sidebar size = ' + sidebarSize + ', showMode = ' + splitWidget.showMode() + ', ' + orientation); TestRunner.addResult( - ' Setting value: ' + JSON.stringify(Common.settings.settingForTest(splitWidget._setting._name).get())); + ' Setting value: ' + JSON.stringify(Common.settings.settingForTest(splitWidget._setting.name).get())); } function testSplitWidgetSizes(useFraction, shouldSaveShowMode) {
diff --git a/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css-expected.txt b/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css-expected.txt deleted file mode 100644 index 1148021..0000000 --- a/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css-expected.txt +++ /dev/null
@@ -1,49 +0,0 @@ -Tests that (S)CSS syntax highlighter properly detects the tokens. - -a[href='/']: cm-css-tag, *, cm-css-tag, *, cm-css-string, * -#content > a:hover: cm-css-builtin, *, cm-css-tag, *, cm-css-variable-3 -@import url(style.css);: cm-css-def, *, cm-css-variable cm-css-callee, *, cm-css-string, * -@import url("style.css") projection, tv;: cm-css-def, *, cm-css-variable cm-css-callee, *, cm-css-string, *, cm-css-attribute, *, cm-css-attribute, * -@import "/css/fireball_unicode.css"; html {}: cm-css-def, *, cm-css-string, *, cm-css-tag, * -@media screen { body { color: red; } }: cm-css-def, *, cm-css-attribute, *, cm-css-tag, *, cm-css-property, *, cm-css-keyword, * -@font-face { font-family: "MyHelvetica"; }: cm-css-def, *, cm-css-property, *, cm-css-string, * -p { color: color; red: red; color: #000; color: #FFF; color: #123AbC; color: #faebfe; color:papayawhip; }: cm-css-tag, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-variable-3, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-keyword, * -p { margin: -10px !important; }: cm-css-tag, *, cm-css-property, *, cm-css-number, *, cm-css-keyword, * -$margin-left: $offsetBefore + 12px + $offsetAfter;: cm-css-variable-2, *, cm-css-variable-2, *, cm-css-number, *, cm-css-variable-2, * -$type: monster; -p { -@if $type == ocean { -color: blue; -} @else if $type == matador { -color: red; -} @else if $type == monster { -color: green; -} @else { -color: black; -} -}: cm-css-variable-2, *, cm-css-variable, *, *, cm-css-tag, *, *, cm-css-def, *, cm-css-variable-2, *, cm-css-tag, *, *, cm-css-property, *, cm-css-keyword, *, *, *, cm-css-def, *, cm-css-tag, *, cm-css-variable-2, *, cm-css-tag, *, *, cm-css-property, *, cm-css-keyword, *, *, *, cm-css-def, *, cm-css-tag, *, cm-css-variable-2, *, cm-css-tag, *, *, cm-css-property, *, cm-css-keyword, *, *, *, cm-css-def, *, *, cm-css-property, *, cm-css-keyword, *, *, *, *, * -@for $i from 1 through 3 { .item-#{$i} { width: 2em * $i; } }: cm-css-def, *, cm-css-variable-2, *, cm-css-tag, *, cm-css-number, *, cm-css-tag, *, cm-css-number, *, cm-css-qualifier, *, cm-css-variable-2, *, cm-css-property, *, cm-css-number, *, cm-css-variable-2, * -@mixin adjust-location($x, $y) { -@if unitless($x) { -@warn "Assuming #{$x} to be in pixels"; -$x: 1px * $x; -} -position: relative; left: $x; top: $y; -}: cm-css-def, *, cm-css-variable cm-css-callee, *, cm-css-variable-2, *, cm-css-variable-2, *, *, cm-css-def, *, cm-css-variable cm-css-callee, *, cm-css-variable-2, *, *, cm-css-def, *, cm-css-string, *, *, cm-css-variable-2, *, cm-css-number, *, cm-css-variable-2, *, *, *, *, cm-css-property, *, cm-css-atom, *, cm-css-property, *, cm-css-variable-2, *, cm-css-property, *, cm-css-variable-2, *, *, * -#navbar { -$navbar-width: 800px; -$items: 5; -$navbar-color: #ce4dd6; -width: $navbar-width; -border-bottom: 2px solid $navbar-color; -li { -@extend .notice !optional; -float: left; -width: $navbar-width/$items - 10px; -background-color: lighten($navbar-color, 20%); -&:hover { -background-color: lighten($navbar-color, 10%); -} -} -}: cm-css-builtin, *, *, cm-css-variable-2, *, cm-css-number, *, *, cm-css-variable-2, *, cm-css-number, *, *, cm-css-variable-2, *, cm-css-atom, *, *, cm-css-property, *, cm-css-variable-2, *, *, cm-css-property, *, cm-css-number, *, cm-css-atom, *, cm-css-variable-2, *, *, cm-css-tag, *, *, cm-css-def, *, cm-css-qualifier, *, cm-css-keyword, *, *, cm-css-property, *, cm-css-atom, *, *, cm-css-property, *, cm-css-variable-2, cm-css-operator, cm-css-variable-2, *, cm-css-number, *, *, cm-css-property, *, cm-css-variable cm-css-callee, *, cm-css-variable-2, *, cm-css-number, *, *, *, cm-css-variable-3, *, *, cm-css-property, *, cm-css-variable cm-css-callee, *, cm-css-variable-2, *, cm-css-number, *, *, *, *, *, *, * -
diff --git a/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css.js b/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css.js deleted file mode 100644 index 59256b3..0000000 --- a/third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css.js +++ /dev/null
@@ -1,67 +0,0 @@ -// 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. - -(async function() { - TestRunner.addResult(`Tests that (S)CSS syntax highlighter properly detects the tokens.\n`); - - function dumpSyntaxHighlightSCSS(str) { - return TestRunner.dumpSyntaxHighlight(str, 'text/x-scss'); - } - - dumpSyntaxHighlightSCSS('a[href=\'/\']'); - dumpSyntaxHighlightSCSS('#content > a:hover'); - dumpSyntaxHighlightSCSS('@import url(style.css);'); - dumpSyntaxHighlightSCSS('@import url("style.css") projection, tv;'); - dumpSyntaxHighlightSCSS('@import "/css/fireball_unicode.css"; html {}'); - dumpSyntaxHighlightSCSS('@media screen { body { color: red; } }'); - dumpSyntaxHighlightSCSS('@font-face { font-family: "MyHelvetica"; }'); - dumpSyntaxHighlightSCSS( - 'p { color: color; red: red; color: #000; color: #FFF; color: #123AbC; color: #faebfe; color:papayawhip; }'); - dumpSyntaxHighlightSCSS('p { margin: -10px !important; }'); - dumpSyntaxHighlightSCSS('$margin-left: $offsetBefore + 12px + $offsetAfter;'); - dumpSyntaxHighlightSCSS( - '$type: monster;\n' + - 'p {\n' + - '@if $type == ocean {\n' + - 'color: blue;\n' + - '} @else if $type == matador {\n' + - 'color: red;\n' + - '} @else if $type == monster {\n' + - 'color: green;\n' + - '} @else {\n' + - 'color: black;\n' + - '}\n' + - '}'); - dumpSyntaxHighlightSCSS('@for $i from 1 through 3 { .item-#{$i} { width: 2em * $i; } }'); - dumpSyntaxHighlightSCSS( - '@mixin adjust-location($x, $y) {\n' + - '@if unitless($x) {\n' + - '@warn "Assuming #{$x} to be in pixels";\n' + - '$x: 1px * $x;\n' + - '}\n' + - 'position: relative; left: $x; top: $y;\n' + - '}'); - - dumpSyntaxHighlightSCSS( - '#navbar {\n' + - '$navbar-width: 800px;\n' + - '$items: 5;\n' + - '$navbar-color: #ce4dd6;\n' + - - 'width: $navbar-width;\n' + - 'border-bottom: 2px solid $navbar-color;\n' + - - 'li {\n' + - '@extend .notice !optional;\n' + - 'float: left;\n' + - 'width: $navbar-width/$items - 10px;\n' + - 'background-color: lighten($navbar-color, 20%);\n' + - '&:hover {\n' + - 'background-color: lighten($navbar-color, 10%);\n' + - '}\n' + - '}\n' + - '}') - - .then(TestRunner.completeTest.bind(TestRunner)); -})();
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/accent-color-contrast-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/accent-color-contrast-expected.png index d855fec..a8dd282 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/accent-color-contrast-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/accent-color-contrast-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png index fdef383..300dfea 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/radio-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/radio-accent-color-appearance-expected.png index d29fe06..a1baac5 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/radio-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/radio-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/range-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/range-accent-color-appearance-expected.png index 661199f3..d6b3300 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/range-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/accent-color/range-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/accent-color-contrast-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/accent-color-contrast-expected.png index 9c2192a1..d376f3a 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/accent-color-contrast-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/accent-color-contrast-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png index a886ff4..472b416 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/radio-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/radio-accent-color-appearance-expected.png index 675763f..2b609c9 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/radio-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/radio-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/range-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/range-accent-color-appearance-expected.png index 92300321..f97457b 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/range-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/accent-color/range-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/accent-color-contrast-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/accent-color-contrast-expected.png index 1bad47c..e5f291e 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/accent-color-contrast-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/accent-color-contrast-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png index c45a14fd..a41a175 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/checkbox-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/radio-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/radio-accent-color-appearance-expected.png index f49f7e5..a8949259 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/radio-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/radio-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/range-accent-color-appearance-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/range-accent-color-appearance-expected.png index 1a4a188..cac34af 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/accent-color/range-accent-color-appearance-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/accent-color/range-accent-color-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/scrollbars/custom-scrollbar-drag.html b/third_party/blink/web_tests/scrollbars/custom-scrollbar-drag.html new file mode 100644 index 0000000..cf630d0 --- /dev/null +++ b/third_party/blink/web_tests/scrollbars/custom-scrollbar-drag.html
@@ -0,0 +1,90 @@ +<!DOCTYPE html> +<html> +<head> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="../resources/gesture-util.js"></script> +<style> + +#scroller { + position: absolute; + overflow: auto; + left: 20px; + top: 20px; + width: 600px; + height: 400px; +} +#scroller::-webkit-scrollbar { + width: 20px; + height: 20px; + background: #abc; +} +#scroller::-webkit-scrollbar-thumb { + background: black; + border-radius: 10px; +} +.space { + height: 2000px; + position: absolute; +} +#text { + font: 20px monospace; + padding: 20px; +} + +</style> +</head> +<body> +<div id=scroller> + <div class=space> + <div id=text> + x + </div> + </div> +</div> +<script> + +churnLayout = () => { + text.innerText += " x"; + requestAnimationFrame(churnLayout); +}; +churnLayout(); + +var STATES = [0, 1, 2, 3, 4, 3, 2, 1, 0, 3, 1, 2, 4, 0]; + +var thumb_x = 610; +var thumb_y = state => 30 + state * 80; +var expected_y = state => state * 400; + +var steps = new Promise((resolve, reject) => { + var cur = 0; + scroller.onscroll = () => { + var y = scroller.scrollTop; + text.style.marginTop = Math.min(1900, y) + "px"; + + ++cur; + var next = cur + 1; + + try { + assert_equals(y, expected_y(STATES[cur])); + } catch (e) { + reject(e); + } + + if (next == STATES.length) + resolve(); + else + mouseMoveTo(thumb_x, thumb_y(STATES[next])); + }; +}); + +promise_test(async (t) => { + await mouseMoveTo(thumb_x, thumb_y(STATES[0])); + await mouseDownAt(thumb_x, thumb_y(STATES[0])); + await mouseMoveTo(thumb_x, thumb_y(STATES[1])); + await steps; +}, "Scroll offset responds correctly to thumb drags."); + +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/virtual/container-queries/inspector-protocol/css/container-queries/css-container-queries-in-constructed-stylesheet-expected.txt b/third_party/blink/web_tests/virtual/container-queries/inspector-protocol/css/container-queries/css-container-queries-in-constructed-stylesheet-expected.txt index 2f3941a..49e1b951 100644 --- a/third_party/blink/web_tests/virtual/container-queries/inspector-protocol/css/container-queries/css-container-queries-in-constructed-stylesheet-expected.txt +++ b/third_party/blink/web_tests/virtual/container-queries/inspector-protocol/css/container-queries/css-container-queries-in-constructed-stylesheet-expected.txt
@@ -9,7 +9,7 @@ @container (max-width: 300px) { .item { font-size: 1px; } } -#named-container { width: 300px; container-name: container-1; container-type: inline-size; } +#named-container { width: 300px; container: inline-size / container-1; } @container container-1 (max-width: 300px) { .item { color: rgb(170, 187, 204); } } @@ -34,8 +34,7 @@ } *#named-container* { regular width: 300px; @[4:19-4:32] - container-name: container-1; @[4:33-4:61] - container-type: inline-size; @[4:62-4:90] + container: inline-size / container-1; @[4:33-4:70] width: 300px; @[undefined-undefined] container-name: container-1; @[undefined-undefined] container-type: inline-size; @[undefined-undefined]
diff --git a/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/devtools/console/console-uncaught-promise-expected.txt b/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/devtools/console/console-uncaught-promise-expected.txt new file mode 100644 index 0000000..9fd7892 --- /dev/null +++ b/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/devtools/console/console-uncaught-promise-expected.txt
@@ -0,0 +1,71 @@ +Tests that uncaught promise rejections are logged into console. + +error: Inspected target navigated or closed +console-uncaught-promise.js:26 Uncaught (in promise) Error: err1 +promiseTest1 @ console-uncaught-promise.js:26 +timeout @ console-uncaught-promise.js:19 +Promise.then (async) +promiseTest1 @ console-uncaught-promise.js:29 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:47 Uncaught (in promise) Error: err2 +promiseTest2 @ console-uncaught-promise.js:47 +timeout @ console-uncaught-promise.js:19 +Promise.then (async) +(anonymous) @ console-uncaught-promise.js:43 +Promise.catch (async) +(anonymous) @ console-uncaught-promise.js:42 +Promise.catch (async) +(anonymous) @ console-uncaught-promise.js:41 +Promise.catch (async) +promiseTest2 @ console-uncaught-promise.js:40 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:65 Uncaught (in promise) DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. +throwDOMException @ console-uncaught-promise.js:65 +catcher @ console-uncaught-promise.js:57 +Promise.catch (async) +promiseTest3 @ console-uncaught-promise.js:56 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:71 Uncaught (in promise) 42 +promiseTest4 @ console-uncaught-promise.js:71 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:76 Uncaught (in promise) 1e+100 +promiseTest5 @ console-uncaught-promise.js:76 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:81 Uncaught (in promise) foo +promiseTest6 @ console-uncaught-promise.js:81 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:86 Uncaught (in promise) {foo: 42} + foo: 42 + [[Prototype]]: Object +promiseTest7 @ console-uncaught-promise.js:86 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +console-uncaught-promise.js:91 Uncaught (in promise) undefined +promiseTest8 @ console-uncaught-promise.js:91 +timeout @ console-uncaught-promise.js:19 +setTimeout (async) +runNextPromiseTest @ console-uncaught-promise.js:18 +(anonymous) @ console-uncaught-promise.js:100 +A bad HTTP response code (404) was received when fetching the script. +inspected-page.html:1 Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://127.0.0.1:8000/devtools/console/') with script ('http://127.0.0.1:8000/devtools/console/404'): A bad HTTP response code (404) was received when fetching the script. +
diff --git a/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/fetch-cors-preflight-sw-expected.txt b/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/fetch-cors-preflight-sw-expected.txt deleted file mode 100644 index 098b265..0000000 --- a/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/fetch-cors-preflight-sw-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -Tests that Fetch intercepts CORS preflight requests from service workers correctly. -[sw] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/service-worker.html, type: XHR -[sw] Request to http://localhost:8000/inspector-protocol/network/resources/post-echo.pl, type: XHR -[sw] Request to http://localhost:8000/inspector-protocol/network/resources/post-echo.pl, type: XHR -fetch response: response body -
diff --git a/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/service-worker-interception-expected.txt b/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/service-worker-interception-expected.txt deleted file mode 100644 index 48fe476..0000000 --- a/third_party/blink/web_tests/virtual/plz-service-worker/http/tests/inspector-protocol/fetch/service-worker-interception-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -Tests that service worker requests are intercepted. -[browser] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/service-worker.html, type: Document -[browser] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/service-worker.js, type: Other -[renderer] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/service-worker.html, type: XHR -[browser] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/service-worker.html, type: XHR -Response fulfilled by service worker: response from service worker -[renderer] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/fetch-data.txt, type: XHR -[browser] Request to http://127.0.0.1:8000/inspector-protocol/fetch/resources/fetch-data.txt, type: XHR -Response after Fetch.fulfillRequest: overriden response body -
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-computed.html b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-computed.html new file mode 100644 index 0000000..6d156cf --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-computed.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>Computed values of container</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +<div id="target"></div> +<script> +test_computed_value('container', 'initial', 'none'); +test_computed_value('container', 'inherit', 'none'); +test_computed_value('container', 'unset', 'none'); +test_computed_value('container', 'inline-size'); +test_computed_value('container', 'block-size'); +test_computed_value('container', 'inline-size block-size'); +test_computed_value('container', 'block-size inline-size', 'inline-size block-size'); +test_computed_value('container', 'inline-size / inline-size'); +test_computed_value('container', 'block-size / block-size'); +test_computed_value('container', 'inline-size block-size / block-size'); +test_computed_value('container', 'block-size inline-size / block-size', 'inline-size block-size / block-size'); + +test_computed_value('container', 'inline-size / foo'); +test_computed_value('container', 'inline-size /foo', 'inline-size / foo'); +test_computed_value('container', 'inline-size/ foo', 'inline-size / foo'); +test_computed_value('container', 'inline-size/foo', 'inline-size / foo'); +test_computed_value('container', 'block-size inline-size / FoO', 'inline-size block-size / FoO'); +</script>
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-parsing.html b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-parsing.html new file mode 100644 index 0000000..dc68eb3 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/css/css-conditional/container-queries/container-parsing.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>Parsing of container</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +<div id="target"></div> +<script> +test_valid_value('container', 'initial'); +test_valid_value('container', 'inherit'); +test_valid_value('container', 'unset'); +test_valid_value('container', 'revert'); +test_valid_value('container', 'none'); +test_valid_value('container', 'none / none', 'none'); +test_valid_value('container', 'inline-size'); +test_valid_value('container', 'inline-size / none', 'inline-size'); +test_valid_value('container', 'block-size'); +test_valid_value('container', 'inline-size block-size'); +test_valid_value('container', 'block-size inline-size', 'inline-size block-size'); +test_valid_value('container', 'block-size / name'); +test_valid_value('container', 'block-size / NAME', 'block-size / NAME'); +test_valid_value('container', 'block-size/NAME','block-size / NAME'); +test_valid_value('container', 'inline-size / inline-size'); +test_valid_value('container', 'block-size / block-size'); +test_valid_value('container', 'inline-size block-size / block-size'); +test_valid_value('container', 'block-size inline-size / block-size', 'inline-size block-size / block-size'); + +test_invalid_value('container', 'none none'); +test_invalid_value('container', 'none inline-size'); +test_invalid_value('container', 'inline-size none'); +test_invalid_value('container', 'inline-size inline-size'); +test_invalid_value('container', 'inline-size block-size unknown'); +test_invalid_value('container', 'none, none'); +test_invalid_value('container', 'foo'); +test_invalid_value('container', '"foo"'); +test_invalid_value('container', 'foo, bar'); +test_invalid_value('container', '#fff'); +test_invalid_value('container', '1px'); +test_invalid_value('container', 'default'); +test_invalid_value('container', 'inline-size / 10px'); +test_invalid_value('container', 'inline-size / #fefefe'); +test_invalid_value('container', 'inline-size / calc(3px)'); +</script>
diff --git a/tools/binary_size/libsupersize/archive.py b/tools/binary_size/libsupersize/archive.py index b431626..94f00c64e 100644 --- a/tools/binary_size/libsupersize/archive.py +++ b/tools/binary_size/libsupersize/archive.py
@@ -145,7 +145,7 @@ self.analyze_native = not (sub_args.java_only or sub_args.no_native or top_args.java_only or top_args.no_native) - self.track_string_literals = True + self.track_string_literals = sub_args.track_string_literals def _OpenMaybeGzAsText(path):
diff --git a/tools/binary_size/libsupersize/demangle.py b/tools/binary_size/libsupersize/demangle.py index c4dbf1b..6247408 100644 --- a/tools/binary_size/libsupersize/demangle.py +++ b/tools/binary_size/libsupersize/demangle.py
@@ -101,8 +101,8 @@ to_process[i].full_name = name -def DemangleSetsInDicts(key_to_names, tool_prefix): - """Demangles values as sets, and returns the result. +def DemangleSetsInDictsInPlace(key_to_names, tool_prefix): + """Demangles values as sets. |key_to_names| is a dict from key to sets (or lists) of mangled names. """ @@ -114,11 +114,9 @@ logging.info('Demangling %d values', len(all_names)) it = iter(_DemangleNames(all_names, tool_prefix)) - ret = {} for key, names in key_to_names.items(): - ret[key] = set(next(it) if _CanDemangle(n) else n for n in names) + key_to_names[key] = set(next(it) if _CanDemangle(n) else n for n in names) assert(next(it, None) is None) - return ret def DemangleKeysAndMergeLists(name_to_list, tool_prefix):
diff --git a/tools/binary_size/libsupersize/nm.py b/tools/binary_size/libsupersize/nm.py index c8b16887..15ff93cd 100644 --- a/tools/binary_size/libsupersize/nm.py +++ b/tools/binary_size/libsupersize/nm.py
@@ -127,7 +127,7 @@ names_by_address[address].add(name) # Demangle all names. - names_by_address = demangle.DemangleSetsInDicts(names_by_address, tool_prefix) + demangle.DemangleSetsInDictsInPlace(names_by_address, tool_prefix) # Since this is run in a separate process, minimize data passing by returning # only aliased symbols.
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index c526db8..d05e02b 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -39,7 +39,7 @@ # https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. # This is the output of `git describe` and is usable as a commit-ish. -CLANG_REVISION = 'llvmorg-13-init-14086-ge1b8fde1' +CLANG_REVISION = 'llvmorg-13-init-14563-gbcaf57ca' CLANG_SUB_REVISION = 1 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 14523cc..6d05e9ed 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -1138,7 +1138,7 @@ <enum name="AccuracyTipStatus"> <int value="0" label="kNone"/> - <int value="1" label="kMisinformation"/> + <int value="1" label="kShowAccuracyTip"/> </enum> <enum name="ActionAfterDoubleTap"> @@ -3660,6 +3660,26 @@ <int value="48" label="tel:// Device selected"/> </enum> +<enum name="ArchivemountError"> + <int value="0" label="Success">EXIT_SUCCESS</int> + <int value="1" label="Failure">EXIT_FAILURE</int> + <int value="132" label="Terminated by SIGILL"> + MINIJAIL_ERR_SIG_BASE + SIGILL from libminijail + </int> + <int value="134" label="Terminated by SIGABRT"> + MINIJAIL_ERR_SIG_BASE + SIGABRT from libminijail + </int> + <int value="139" label="Terminated by SIGSEGV"> + MINIJAIL_ERR_SIG_BASE + SIGSEGV from libminijail + </int> + <int value="251" label="Cannot mount file in mount namespace"> + MINIJAIL_ERR_MOUNT from libminijail + </int> + <int value="253" label="Seccomp violation"> + MINIJAIL_ERR_JAIL from libminijail + </int> +</enum> + <enum name="ArcIntentHandlerAction"> <summary>Defines Arc intent handler actions</summary> <int value="0" label="Error after showing picker"/> @@ -9772,6 +9792,14 @@ <int value="1" label="Yes"/> </enum> +<enum name="BorealisGetDiskInfoResult"> + <int value="0" label="Success"/> + <int value="1" label="A GetDiskInfo request is already in progress"/> + <int value="2" label="Failed to get the expandable space of the disk"/> + <int value="3" label="Concierge failed"/> + <int value="4" label="Request was invalid"/> +</enum> + <enum name="BorealisInstallResult"> <int value="0" label="Success"/> <int value="1" label="User cancelled installation"/> @@ -9789,6 +9817,26 @@ <int value="11" label="DLC couldn't find an image at the correct version"/> </enum> +<enum name="BorealisResizeDiskResult"> + <int value="0" label="Success"/> + <int value="1" label="A resize request is already in progress"/> + <int value="2" label="Failed to get information about the disk"/> + <int value="3" label="Disk type is invalid and cannot be handled"/> + <int value="4" + label="There is not enough free space on the host to expand the disk"/> + <int value="5" + label="Shrinking the disk would not leave enough available space in the + VM"/> + <int value="6" + label="Shrinking the disk would make the disk size smaller than the + minimum"/> + <int value="7" label="Concierge failed to resize the disk"/> + <int value="8" label="Failed to get updated information about the disk"/> + <int value="9" label="Request was invalid"/> + <int value="10" label="The bytes specified are too large for an int64"/> + <int value="11" label="Failed to resize the disk by the amount specified"/> +</enum> + <enum name="BorealisStartupResult"> <int value="0" label="Success"/> <int value="1" label="Cancelled"/> @@ -16455,6 +16503,11 @@ <int value="3" label="Tar"/> <int value="4" label="Bzip2-compressed Tar"/> <int value="5" label="Gzip-compressed Tar"/> + <int value="6" label="Bzip2-compressed Other"/> + <int value="7" label="Gzip-compressed Other"/> + <int value="8" label="7z"/> + <int value="9" label="Crx"/> + <int value="10" label="Iso"/> </enum> <enum name="CrosDisksClientFormatError"> @@ -18845,6 +18898,7 @@ <int value="43" label="PrintManagementApp"/> <int value="45" label="ShimlessRMAApp"/> <int value="46" label="OSFeedbackApp"/> + <int value="47" label="A4"/> </enum> <enum name="DefaultBrowserAsyncAttemptResult"> @@ -52673,6 +52727,7 @@ <int value="696" label="size-adjust"/> <int value="697" label="container-name"/> <int value="698" label="container-type"/> + <int value="699" label="container"/> </enum> <enum name="MappedEditingCommands">
diff --git a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml index 07b27d0c..dd04866 100644 --- a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml
@@ -77,7 +77,7 @@ </histogram> <histogram name="Accessibility.Android.UserFontSizePref.Change" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>twellington@chromium.org</owner> <owner>skym@chromium.org</owner> <summary> @@ -88,7 +88,7 @@ </histogram> <histogram name="Accessibility.Android.UserFontSizePref.OnStartup" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>twellington@chromium.org</owner> <owner>skym@chromium.org</owner> <summary> @@ -565,7 +565,7 @@ </histogram> <histogram name="Accessibility.CrosVirtualKeyboard" enum="BooleanEnabled" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>dmazzoni@chromium.org</owner> <owner>kenjibaheux@google.com</owner> <owner>chrome-a11y-core@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/android/histograms.xml b/tools/metrics/histograms/histograms_xml/android/histograms.xml index 47306c8..0efb4da 100644 --- a/tools/metrics/histograms/histograms_xml/android/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/android/histograms.xml
@@ -381,7 +381,7 @@ </histogram> <histogram name="Android.ChildProcessLauncher.OnServiceConnectedTimedOutResult" - enum="OnServiceConnectedTimedOutResult" expires_after="2021-10-31"> + enum="OnServiceConnectedTimedOutResult" expires_after="2022-01-02"> <owner>boliu@chromium.org</owner> <owner>src/base/android/OWNERS</owner> <summary> @@ -935,7 +935,7 @@ </histogram> <histogram name="Android.DownloadManager.NotificationInteraction" - enum="DownloadNotificationInteractions" expires_after="2021-10-31"> + enum="DownloadNotificationInteractions" expires_after="2022-01-02"> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/apps/histograms.xml b/tools/metrics/histograms/histograms_xml/apps/histograms.xml index 4a431e5..ca8a5c78 100644 --- a/tools/metrics/histograms/histograms_xml/apps/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/apps/histograms.xml
@@ -1229,7 +1229,7 @@ </histogram> <histogram name="Apps.AppListPlayStoreQueryState" - enum="AppListPlayStoreQueryState" expires_after="2021-10-31"> + enum="AppListPlayStoreQueryState" expires_after="2022-01-02"> <owner>hejq@chromium.org</owner> <summary>The state of a Play Store app search request.</summary> </histogram> @@ -1256,7 +1256,7 @@ </histogram> <histogram name="Apps.AppListRecommendedResponse" - enum="ReinstallResponseParseResult" expires_after="2021-10-31"> + enum="ReinstallResponseParseResult" expires_after="2022-01-02"> <owner>napper@chromium.org</owner> <owner>robsc@chromium.org</owner> <owner>thanhdng@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/arc/histograms.xml b/tools/metrics/histograms/histograms_xml/arc/histograms.xml index 5b8dbdc..12d427f 100644 --- a/tools/metrics/histograms/histograms_xml/arc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/arc/histograms.xml
@@ -514,7 +514,7 @@ </histogram> <histogram name="Arc.EngagementTime.Foreground" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>maajid@google.com</owner> <owner>shaochuan@google.com</owner> <owner>shihuis@google.com</owner> @@ -540,7 +540,7 @@ </histogram> <histogram name="Arc.ExternalStorage.MountedMediaVisibility" - enum="BooleanEnabled" expires_after="2021-10-31"> + enum="BooleanEnabled" expires_after="2022-01-02"> <owner>fukino@chromium.org</owner> <owner>yusukes@chromium.org</owner> <summary> @@ -785,7 +785,7 @@ </histogram> <histogram name="Arc.OptInSilentAuthCode" enum="ArcOptInSilentAuthCode" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>elijahtaylor@google.com</owner> <summary> Arc Silent Auth Code status. This status is set during the ARC OptIn flow. @@ -853,7 +853,7 @@ </histogram> <histogram name="Arc.PlayStoreSearch.QueryTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>hejq@chromium.org</owner> <summary> Time between sending an Play Store app discovery request and the storing @@ -1318,7 +1318,7 @@ </histogram> <histogram name="Arc.UiAvailable.AlreadyProvisioned.TimeDelta" units="ms" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>khmel@google.com</owner> @@ -1342,7 +1342,7 @@ </histogram> <histogram name="Arc.UiAvailable.OobeProvisioning.TimeDelta" units="ms" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>khmel@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/ash/histograms.xml b/tools/metrics/histograms/histograms_xml/ash/histograms.xml index 3b0943b..a480e96 100644 --- a/tools/metrics/histograms/histograms_xml/ash/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ash/histograms.xml
@@ -400,7 +400,7 @@ </histogram> <histogram name="Ash.Clipboard.ConsecutivePastes" units="times" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>newcomer@chromium.org</owner> <owner>multipaste@google.com</owner> <summary> @@ -410,7 +410,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ConsecutivePastes" units="times" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>multipaste@google.com</owner> <summary> @@ -422,7 +422,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.DisplayFormatDeleted" - enum="ClipboardHistoryDisplayFormat" expires_after="2021-10-31"> + enum="ClipboardHistoryDisplayFormat" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -432,7 +432,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.DisplayFormatPasted" - enum="ClipboardHistoryDisplayFormat" expires_after="2021-10-31"> + enum="ClipboardHistoryDisplayFormat" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -442,7 +442,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.DisplayFormatShown" - enum="ClipboardHistoryDisplayFormat" expires_after="2021-10-31"> + enum="ClipboardHistoryDisplayFormat" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -452,7 +452,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.MenuOptionSelected" - units="index" expires_after="2021-10-31"> + units="index" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -462,7 +462,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.NumberOfItemsShown" - units="Items Shown" expires_after="2021-10-31"> + units="Items Shown" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -473,7 +473,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.ShowMenu" - enum="ClipboardHistoryTriggerType" expires_after="2021-10-31"> + enum="ClipboardHistoryTriggerType" expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>multipaste@google.com</owner> <summary> @@ -483,7 +483,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.ShowPlaceholderString" - enum="ClipboardHistoryPlaceholderStringType" expires_after="2021-10-31"> + enum="ClipboardHistoryPlaceholderStringType" expires_after="2022-01-02"> <owner>newcomer@chromium.org</owner> <owner>multipaste@google.com</owner> <summary> @@ -494,7 +494,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ContextMenu.UserJourneyTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>andrewxu@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -555,7 +555,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.ControlToVDelay" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>gzadina@google.com</owner> <owner>newcomer@chromium.org</owner> <summary> @@ -641,7 +641,7 @@ </histogram> <histogram name="Ash.ClipboardHistory.Operation" - enum="ClipboardHistoryOperation" expires_after="2021-10-31"> + enum="ClipboardHistoryOperation" expires_after="2022-01-02"> <owner>newcomer@chromium.org</owner> <owner>multipaste@google.com</owner> <summary> @@ -862,7 +862,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_1" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -872,7 +872,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_2" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -882,7 +882,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_3" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -892,7 +892,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_4" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -902,7 +902,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_5" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -912,7 +912,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_6" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -922,7 +922,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_7" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -932,7 +932,7 @@ </histogram> <histogram name="Ash.Desks.NumberOfWindowsOnDesk_8" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -2637,7 +2637,7 @@ </histogram> <histogram name="Ash.TabletMode.AnimationSmoothness.Enter" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>oshima@chromium.org</owner> <owner>sammiequon@chromium.org</owner> <summary> @@ -2910,7 +2910,7 @@ </histogram> <histogram name="Ash.WindowCycleController.DesksSwitchDistance" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>afakhry@chromium.org</owner> <owner>tclaiborne@chromium.org</owner> <summary> @@ -2980,7 +2980,7 @@ </histogram> <histogram name="Ash.WindowCycleView.AnimationSmoothness.Container" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>yjliu@chromium.org</owner> <owner>chromeos-wmp@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml index d05341b..ef7bb2e 100644 --- a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml
@@ -228,7 +228,7 @@ </histogram> <histogram name="Assistant.VoiceSearch.ConsentOutcome" - enum="AssistantConsentOutcome" expires_after="2021-10-31"> + enum="AssistantConsentOutcome" expires_after="2022-01-02"> <owner>wylieb@chromium.org</owner> <owner>fgorski@chromium.org</owner> <summary> @@ -273,7 +273,7 @@ </histogram> <histogram name="QuickAnswers.ActiveImpression" enum="QuickAnswersResultType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -312,7 +312,7 @@ </histogram> <histogram name="QuickAnswers.Consent" units="impressions" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -332,7 +332,7 @@ </histogram> <histogram base="true" name="QuickAnswers.Consent.Impression" - units="impressions" expires_after="2021-10-31"> + units="impressions" expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -370,7 +370,7 @@ </histogram> <histogram name="QuickAnswers.Intent" enum="QuickAnswersIntentType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -390,7 +390,7 @@ </histogram> <histogram name="QuickAnswers.Loading.Status" enum="QuickAnswersLoadStatus" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -399,7 +399,7 @@ </histogram> <histogram name="QuickAnswers.NetworkError.IntentType" - enum="QuickAnswersIntentType" expires_after="2021-10-31"> + enum="QuickAnswersIntentType" expires_after="2022-01-02"> <owner>updowndota@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -424,7 +424,7 @@ </histogram> <histogram name="QuickAnswers.Result" enum="QuickAnswersResultType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -434,7 +434,7 @@ </histogram> <histogram name="QuickAnswers.Result.Duration" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary> @@ -444,7 +444,7 @@ </histogram> <histogram name="QuickAnswers.SelectedContent.Length" units="characters" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/autofill/histograms.xml b/tools/metrics/histograms/histograms_xml/autofill/histograms.xml index 39c685f..bc7f8b126 100644 --- a/tools/metrics/histograms/histograms_xml/autofill/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/autofill/histograms.xml
@@ -938,7 +938,7 @@ </histogram> <histogram name="Autofill.FormFillSuccessIOS" - enum="BooleanAutofillFormFillSuccessIOS" expires_after="2021-10-30"> + enum="BooleanAutofillFormFillSuccessIOS" expires_after="2022-01-02"> <owner>kazinova@google.com</owner> <owner>chrome-autofill-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/background/histograms.xml b/tools/metrics/histograms/histograms_xml/background/histograms.xml index ea4a2989..7d82e66 100644 --- a/tools/metrics/histograms/histograms_xml/background/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/background/histograms.xml
@@ -242,7 +242,7 @@ </histogram> <histogram name="BackgroundSync.Event.OneShotResultPattern" - enum="BackgroundSyncResultPattern" expires_after="2021-10-31"> + enum="BackgroundSyncResultPattern" expires_after="2022-01-02"> <owner>nator@chromium.org</owner> <owner>rayankans@chromium.org</owner> <summary> @@ -256,7 +256,7 @@ </histogram> <histogram name="BackgroundSync.Event.OneShotStartedInForeground" - enum="BooleanInForeground" expires_after="2021-10-31"> + enum="BooleanInForeground" expires_after="2022-01-02"> <owner>nator@chromium.org</owner> <owner>rayankans@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/blink/histograms.xml b/tools/metrics/histograms/histograms_xml/blink/histograms.xml index 93570ee..4ff94abf 100644 --- a/tools/metrics/histograms/histograms_xml/blink/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/blink/histograms.xml
@@ -2264,7 +2264,7 @@ </histogram> <histogram base="true" name="Blink.PrePaint.UpdateTime" units="microseconds" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePreFCPSuffixes" --> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePostFCPSuffixes" --> @@ -3052,7 +3052,7 @@ </histogram> <histogram base="true" name="Blink.VisibleLoadTime.LazyLoadImages.AboveTheFold" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>rajendrant@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -3064,7 +3064,7 @@ </histogram> <histogram base="true" name="Blink.VisibleLoadTime.LazyLoadImages.BelowTheFold" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>rajendrant@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -3354,24 +3354,23 @@ <summary> Duration of overall garbage collection time when the garbage collector is invoked for finishing a garbage collection. This includes finishing up any - already running garbage collection operation. Recorded at the end of each - garbage collection. + already running garbage collection operation. Reported once per garbage + collection at the end. </summary> </histogram> <histogram name="BlinkGC.TimeForAtomicPhaseMarking" units="ms" - expires_after="2021-08-15"> + expires_after="M95"> <owner>mlippautz@chromium.org</owner> <owner>oilpan-reviews@chromium.org</owner> <summary> Duration of finishing marking the transitive closure of objects during the - final Blink garbage collection pause. Recorded at the end of each garbage - collection. + final Blink garbage collection pause. Reported once per garbage collection + at the end. </summary> </histogram> -<histogram name="BlinkGC.TimeForCompleteSweep" units="ms" - expires_after="2021-08-09"> +<histogram name="BlinkGC.TimeForCompleteSweep" units="ms" expires_after="M95"> <owner>bikineev@chromium.org</owner> <owner>oilpan-reviews@chromium.org</owner> <summary> @@ -3431,7 +3430,7 @@ </summary> </histogram> -<histogram name="BlinkGC.TimeForMarking" units="ms" expires_after="2021-10-10"> +<histogram name="BlinkGC.TimeForMarking" units="ms" expires_after="M95"> <owner>omerkatz@chromium.org</owner> <owner>oilpan-reviews@chromium.org</owner> <summary> @@ -3441,8 +3440,7 @@ </summary> </histogram> -<histogram name="BlinkGC.TimeForMarkingRoots" units="ms" - expires_after="2021-10-10"> +<histogram name="BlinkGC.TimeForMarkingRoots" units="ms" expires_after="M95"> <owner>omerkatz@chromium.org</owner> <owner>oilpan-reviews@chromium.org</owner> <summary> @@ -3472,7 +3470,7 @@ </histogram> <histogram name="BlinkGC.TimeForSweepingForeground" units="ms" - expires_after="2021-12-12"> + expires_after="M95"> <owner>bikineev@chromium.org</owner> <owner>oilpan-reviews@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/borealis/histograms.xml b/tools/metrics/histograms/histograms_xml/borealis/histograms.xml index eef1bf46..9459152 100644 --- a/tools/metrics/histograms/histograms_xml/borealis/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/borealis/histograms.xml
@@ -21,6 +21,85 @@ <histograms> +<histogram name="Borealis.Disk.Client.AvailableSpaceAtRequest" units="MB" + expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + Amount of space, in MB, that is available on the Borealis VM disk when a + client requests for more space. This is recorded each time a client makes a + valid RequestSpace request. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.GetDiskInfoResult" + enum="BorealisGetDiskInfoResult" expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + The results of a "GetDiskInfo" request from a client, which will + either be a success or an error. This is recorded each time a client makes a + GetDiskInfo request. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.NumRequestsPerSesssion" units="requests" + expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + The number of requests made by a client within a session of Borealis. This + counts each time a client makes a disk related request (GetDiskInfo, + RequestSpace and ReleaseSpace) and is emitted when Borealis is shutdown. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.ReleaseSpaceResult" + enum="BorealisResizeDiskResult" expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + The results of a "ReleaseSpace" request from a client, which will + either be a success or an error. This is recorded each time a client makes a + ReleaseSpace request. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.RequestSpaceResult" + enum="BorealisResizeDiskResult" expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + The results of a "RequestSpace" request from a client, which will + either be a success or an error. This is recorded each time a client makes a + RequestSpace request. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.SpaceReleased" units="MB" + expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + Amount of space, in MB, that is freed by the client (via a + "ReleaseSpace" request). This is recorded each time a client makes + a ReleaseSpace request. This is not necessarily the amount of space that the + host frees, it is just the amount that the client signals as free. + </summary> +</histogram> + +<histogram name="Borealis.Disk.Client.SpaceRequested" units="MB" + expires_after="2022-04-08"> + <owner>danielng@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary> + Amount of space, in MB, that is requested by the client (via a + "RequestSpace" request). This is recorded each time a client makes + a RequestSpace request. This is not necessarily the amount of space granted + by the client, it is just the amount that the client has requested. + </summary> +</histogram> + <histogram name="Borealis.EngagementTime.{Variant}" units="ms" expires_after="2022-04-08"> <owner>lqu@google.com</owner> @@ -104,14 +183,14 @@ </histogram> <histogram name="Borealis.Startup.NumAttempts" enum="BooleanAttempted" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>danielng@google.com</owner> <owner>src/chrome/browser/ash/borealis/OWNERS</owner> <summary>Recording every attempt to start Borealis (via the UI).</summary> </histogram> <histogram name="Borealis.Startup.OverallTime" units="ms" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>danielng@google.com</owner> <owner>src/chrome/browser/ash/borealis/OWNERS</owner> <summary> @@ -121,7 +200,7 @@ </histogram> <histogram name="Borealis.Startup.Result" enum="BorealisStartupResult" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>danielng@google.com</owner> <owner>src/chrome/browser/ash/borealis/OWNERS</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/browser/histograms.xml b/tools/metrics/histograms/histograms_xml/browser/histograms.xml index 71358405..29c036d 100644 --- a/tools/metrics/histograms/histograms_xml/browser/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/browser/histograms.xml
@@ -42,7 +42,7 @@ </histogram> <histogram name="Browser.BitmapFetcher.Decode" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>manukh@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -50,7 +50,7 @@ </histogram> <histogram name="Browser.BitmapFetcher.Fetch" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>manukh@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -157,7 +157,7 @@ </histogram> <histogram name="Browser.PaintPreview.Capture.CompressedOnDiskSize" units="KB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -168,7 +168,7 @@ </histogram> <histogram name="Browser.PaintPreview.Capture.NumberOfFramesCaptured" - units="units" expires_after="2021-10-31"> + units="units" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -178,7 +178,7 @@ </histogram> <histogram name="Browser.PaintPreview.Capture.Success" enum="BooleanSuccess" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -188,7 +188,7 @@ </histogram> <histogram name="Browser.PaintPreview.Capture.TotalCaptureDuration" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -240,7 +240,7 @@ </histogram> <histogram name="Browser.PaintPreview.Player.CompositorProcessStartedCorrectly" - units="BooleanSuccess" expires_after="2021-10-31"> + units="BooleanSuccess" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -250,7 +250,7 @@ </histogram> <histogram name="Browser.PaintPreview.Player.CompositorProcessStartupTime" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -260,7 +260,7 @@ </histogram> <histogram name="Browser.PaintPreview.Player.LinkClicked" - units="BooleanSuccess" expires_after="2021-10-31"> + units="BooleanSuccess" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -268,7 +268,7 @@ </histogram> <histogram name="Browser.PaintPreview.Player.TimeToFirstBitmap" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -279,7 +279,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabbedPlayer.CompositorFailureReason" - enum="TabbedPaintPreviewCompositorFailureReason" expires_after="2021-10-31"> + enum="TabbedPaintPreviewCompositorFailureReason" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -291,7 +291,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabbedPlayer.ExitCause" - enum="TabbedPaintPreviewExitCause" expires_after="2021-10-31"> + enum="TabbedPaintPreviewExitCause" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -313,7 +313,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabbedPlayer.HadCapture" units="Boolean" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -325,7 +325,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabbedPlayer.SnackbarCount" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -336,7 +336,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabbedPlayer.TimeToFirstBitmap" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -347,7 +347,7 @@ </histogram> <histogram base="true" name="Browser.PaintPreview.TabbedPlayer.UpTime" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -358,7 +358,7 @@ </histogram> <histogram name="Browser.PaintPreview.TabService.DiskUsageAtStartup" units="KB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -533,7 +533,7 @@ </histogram> <histogram base="true" name="Browser.Tabs.TotalSwitchDuration" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="TabSwitchingType" --> <owner>ejoe@google.com</owner> @@ -673,7 +673,7 @@ </histogram> <histogram name="BrowserRenderProcessHost.SpareProcessMaybeTakeAction" - enum="SpareProcessMaybeTakeAction" expires_after="2021-10-31"> + enum="SpareProcessMaybeTakeAction" expires_after="2022-01-02"> <owner>alexmos@chromium.org</owner> <owner>lukasza@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/compositing/histograms.xml b/tools/metrics/histograms/histograms_xml/compositing/histograms.xml index 4ba3ebd..fb9618ef3 100644 --- a/tools/metrics/histograms/histograms_xml/compositing/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/compositing/histograms.xml
@@ -41,7 +41,7 @@ </histogram> <histogram name="Compositing.Browser.LayersUpdateTime" units="microseconds" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>schenney@chromium.org</owner> <owner>animations-dev@chromium.org</owner> <summary> @@ -57,7 +57,7 @@ </histogram> <histogram name="Compositing.Browser.LayerTreeImpl.CalculateDrawPropertiesUs" - units="microseconds" expires_after="2021-10-31"> + units="microseconds" expires_after="2022-01-02"> <owner>schenney@chromium.org</owner> <owner>paint-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/content/histograms.xml b/tools/metrics/histograms/histograms_xml/content/histograms.xml index 24708be..d847665b 100644 --- a/tools/metrics/histograms/histograms_xml/content/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/content/histograms.xml
@@ -508,7 +508,7 @@ </histogram> <histogram name="ContentSettings.Popups" enum="ContentSettingPopupAction" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>charleszhao@chromium.org</owner> <owner>lazzzis@google.com</owner> <owner>src/components/blocked_content/OWNERS</owner>
diff --git a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml index 99c7378..5dfcf35 100644 --- a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml
@@ -253,7 +253,7 @@ </histogram> <histogram name="Cookie.IsSamePartyValid" enum="BooleanValid" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>chlily@chromium.org</owner> <owner>kaustubhag@chromium.org</owner> <summary> @@ -533,7 +533,7 @@ </histogram> <histogram name="Cookie.SamePartyCookieSameSiteAttributeValue" - enum="CookieSameSiteString" expires_after="2021-11-01"> + enum="CookieSameSiteString" expires_after="2022-01-02"> <owner>chlily@chromium.org</owner> <owner>kaustubhag@chromium.org</owner> <summary> @@ -610,7 +610,7 @@ </histogram> <histogram name="Cookie.SameSiteAttributeValue" enum="CookieSameSiteString" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>chlily@chromium.org</owner> <owner>bingler@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/cros/histograms.xml b/tools/metrics/histograms/histograms_xml/cros/histograms.xml index e8a966e..34f10b7 100644 --- a/tools/metrics/histograms/histograms_xml/cros/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cros/histograms.xml
@@ -63,6 +63,16 @@ </summary> </histogram> +<histogram name="CrosDisks.Fuse.Archivemount" enum="ArchivemountError" + expires_after="2021-12-05"> + <owner>fdegros@chromium.org</owner> + <owner>chromeos-files-app@google.com</owner> + <summary> + The error code returned by the archivemount program, which is called every + time a user opens various archive files in ChromeOS Files App. + </summary> +</histogram> + <histogram name="CrosDisks.Fuse.FuseZip" enum="FuseZipError" expires_after="2021-12-05"> <owner>fdegros@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/cross_device/histograms.xml b/tools/metrics/histograms/histograms_xml/cross_device/histograms.xml index 91fbf4d..edcdd2e6 100644 --- a/tools/metrics/histograms/histograms_xml/cross_device/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cross_device/histograms.xml
@@ -238,7 +238,7 @@ </histogram> <histogram name="CryptAuth.DeviceSyncSoftwareFeaturesResult" - enum="BooleanSuccess" expires_after="2021-10-06"> + enum="BooleanSuccess" expires_after="2022-01-02"> <owner>hansberry@chromium.org</owner> <owner>better-together-dev@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml index f9647b5..980919da 100644 --- a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="Cryptohome.AsyncDBusRequest" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>zuan@chromium.org</owner> <owner>cros-hwsec+uma@chromium.org</owner> <summary> @@ -535,7 +535,7 @@ </histogram> <histogram name="Cryptohome.TimeToPerformOOPMountCleanup" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jorgelo@chromium.org</owner> <owner>betuls@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml index 3871e4d..1fed99a 100644 --- a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml
@@ -426,7 +426,7 @@ </histogram> <histogram name="DataReductionProxy.UIAction" enum="DataReductionProxyUIAction" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>bengr@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/dev/histograms.xml b/tools/metrics/histograms/histograms_xml/dev/histograms.xml index 1f9a96c0..511eb19 100644 --- a/tools/metrics/histograms/histograms_xml/dev/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/dev/histograms.xml
@@ -259,7 +259,7 @@ </histogram> <histogram name="DevTools.IssueCreated" enum="DevToolsIssueCreated" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>yangguo@chromium.org</owner> <owner>bmeurer@chromium.org</owner> <summary> @@ -268,7 +268,7 @@ </histogram> <histogram name="DevTools.IssuesPanelIssueExpanded" - enum="DevToolsIssuesPanelIssueExpanded" expires_after="2021-10-31"> + enum="DevToolsIssuesPanelIssueExpanded" expires_after="2022-01-02"> <owner>yangguo@chromium.org</owner> <owner>jegarc@microsoft.com</owner> <summary> @@ -286,7 +286,7 @@ </histogram> <histogram name="DevTools.IssuesPanelResourceOpened" - enum="DevToolsIssuesPanelResourceOpened" expires_after="2021-10-31"> + enum="DevToolsIssuesPanelResourceOpened" expires_after="2022-01-02"> <owner>yangguo@chromium.org</owner> <owner>jegarc@microsoft.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/download/histograms.xml b/tools/metrics/histograms/histograms_xml/download/histograms.xml index c6c73d8..bf47291 100644 --- a/tools/metrics/histograms/histograms_xml/download/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/download/histograms.xml
@@ -1129,7 +1129,7 @@ </histogram> <histogram name="Download.Start.ContentType.NormalProfile" - enum="DownloadContentType" expires_after="2021-10-31"> + enum="DownloadContentType" expires_after="2022-01-02"> <owner>shaktisahu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/enterprise/histograms.xml b/tools/metrics/histograms/histograms_xml/enterprise/histograms.xml index 2580e39..cced75e 100644 --- a/tools/metrics/histograms/histograms_xml/enterprise/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/enterprise/histograms.xml
@@ -120,7 +120,7 @@ <histogram name="Enterprise.AutoEnrollmentPrivateSetMembershipHashDanceComparison" - enum="PrivateSetMembershipHashDanceComparison" expires_after="2021-10-31"> + enum="PrivateSetMembershipHashDanceComparison" expires_after="2022-01-02"> <owner>amraboelkher@google.com</owner> <owner>mpolzer@google.com</owner> <summary> @@ -144,7 +144,7 @@ </histogram> <histogram name="Enterprise.AutoEnrollmentPrivateSetMembershipSuccessTime" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>amraboelkher@google.com</owner> <owner>mpolzer@google.com</owner> <summary> @@ -2038,7 +2038,7 @@ </histogram> <histogram name="EnterpriseCheck.IsDomainJoined" enum="BooleanEnabled" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>pastarmovj@chromium.org</owner> <owner>rogerta@chromium.org</owner> <owner>zmin@chromium.org</owner> @@ -2049,7 +2049,7 @@ </histogram> <histogram name="EnterpriseCheck.IsEnterpriseUser" enum="BooleanEnabled" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>pastarmovj@chromium.org</owner> <owner>rogerta@chromium.org</owner> <owner>zmin@chromium.org</owner> @@ -2107,7 +2107,7 @@ </histogram> <histogram name="EnterpriseCheck.IsManaged2" enum="BooleanEnabled" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>rogerta@chromium.org</owner> <owner>pastarmovj@chromium.org</owner> <owner>zmin@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/event/histograms.xml b/tools/metrics/histograms/histograms_xml/event/histograms.xml index a941de2..7adad02 100644 --- a/tools/metrics/histograms/histograms_xml/event/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/event/histograms.xml
@@ -930,7 +930,7 @@ </histogram> <histogram name="Event.Latency.ScrollBegin.Wheel.TimeToScrollUpdateSwapBegin4" - units="microseconds" expires_after="2021-10-31"> + units="microseconds" expires_after="2022-01-02"> <owner>flackr@chromium.org</owner> <summary> Time between initial creation of a wheel event and the start of the frame @@ -1550,7 +1550,7 @@ </histogram> <histogram name="Event.Latency.ScrollUpdate.Wheel.TimeToScrollUpdateSwapBegin4" - units="microseconds" expires_after="2021-10-31"> + units="microseconds" expires_after="2022-01-02"> <owner>flackr@chromium.org</owner> <summary> Time between initial creation of a wheel event and start of the frame swap
diff --git a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml index 925da9c..c5c6b36 100644 --- a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml
@@ -701,7 +701,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.RequestHeaderAdded" - enum="WebRequest.RequestHeader" expires_after="2021-10-31"> + enum="WebRequest.RequestHeader" expires_after="2022-01-02"> <owner>karandeepb@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <owner>kelvinjiang@chromium.org</owner> @@ -1216,7 +1216,7 @@ </histogram> <histogram name="Extensions.ExtensionDisabledRemotely2" - enum="ExtensionUpdateCheckDataKey" expires_after="2021-10-10"> + enum="ExtensionUpdateCheckDataKey" expires_after="2022-01-02"> <owner>bdea@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -3460,7 +3460,7 @@ </histogram> <histogram name="Extensions.Toolbar.InvocationSource" - enum="ExtensionActionInvocationSource" expires_after="2021-10-31"> + enum="ExtensionActionInvocationSource" expires_after="2022-01-02"> <owner>rdevlin.cronin@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary> @@ -3631,7 +3631,7 @@ </histogram> <histogram name="Extensions.WebRequest.KeepaliveRequestState" - enum="ExtensionInProgressRequestState" expires_after="2021-10-31"> + enum="ExtensionInProgressRequestState" expires_after="2022-01-02"> <owner>yhirano@chromium.org</owner> <owner>kinuko@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/fingerprint/histograms.xml b/tools/metrics/histograms/histograms_xml/fingerprint/histograms.xml index 7ba7f319..365e0c5 100644 --- a/tools/metrics/histograms/histograms_xml/fingerprint/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/fingerprint/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="Fingerprint.Auth.ScanResult" enum="FingerprintScanResult" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rsorokin@chromium.org</owner> <owner>tomhughes@chromium.org</owner> <owner>cros-oac@google.com</owner> @@ -35,7 +35,7 @@ </histogram> <histogram name="Fingerprint.Enroll.ScanResult" enum="FingerprintScanResult" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rsorokin@chromium.org</owner> <owner>tomhughes@chromium.org</owner> <owner>cros-oac@google.com</owner> @@ -140,7 +140,7 @@ </histogram> <histogram name="Fingerprint.Unlock.MatchIgnoredDueToPowerButtonPress" - enum="BooleanIgnored" expires_after="2021-10-31"> + enum="BooleanIgnored" expires_after="2022-01-02"> <owner>ravisadineni@chromium.org</owner> <owner>chromeos-fingerprint@google.com</owner> <summary> @@ -182,7 +182,7 @@ </histogram> <histogram name="Fingerprint.Unlock.NoMatch.Duration.Overall" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rsorokin@chromium.org</owner> <owner>jessejames@chromium.org</owner> <owner>cros-oac@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml index f39323b..bd3f842 100644 --- a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="GCM.AccountMappingMessageReceived" enum="BooleanReceived" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>peter@chromium.org</owner> <owner>knollr@chromium.org</owner> <summary> @@ -456,7 +456,7 @@ </histogram> <histogram name="GCM.WebPushReceived.DeviceState" enum="WebPushDeviceState" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/geolocation/histograms.xml b/tools/metrics/histograms/histograms_xml/geolocation/histograms.xml index cc0c1c8..dcc2d5a2 100644 --- a/tools/metrics/histograms/histograms_xml/geolocation/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/geolocation/histograms.xml
@@ -218,7 +218,7 @@ </histogram> <histogram name="GeolocationDisclosure.DisclosureResult" - enum="GeolocationDisclosureResult" expires_after="2021-10-31"> + enum="GeolocationDisclosureResult" expires_after="2022-01-02"> <owner>benwells@chromium.org</owner> <summary> Records the action the user took after the geolocation disclosure has been
diff --git a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml index 80dc7a79..e905e7cb 100644 --- a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml
@@ -54,7 +54,7 @@ </histogram> <histogram name="GPU.ANGLE.D3D11FeatureLevel" enum="D3DFeatureLevel" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jonahr@google.com</owner> <owner>angle-team@google.com</owner> <summary> @@ -68,7 +68,7 @@ </histogram> <histogram name="GPU.ANGLE.D3D11InitializeResult" enum="D3D11InitializeResult" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jonahr@google.com</owner> <owner>angle-team@google.com</owner> <summary> @@ -646,7 +646,7 @@ </histogram> <histogram name="GPU.DirectComposition.VideoPresentationMode" - enum="DirectCompositionVideoPresentationMode" expires_after="2021-10-31"> + enum="DirectCompositionVideoPresentationMode" expires_after="2022-01-02"> <owner>sunnyps@chromium.org</owner> <owner>zmo@chromium.org</owner> <summary> @@ -898,7 +898,7 @@ </histogram> <histogram name="GPU.InitializeOneOffMediumTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jonahr@google.com</owner> <owner>angle-team@google.com</owner> <summary> @@ -1401,7 +1401,7 @@ </histogram> <histogram name="GPU.Vulkan.PipelineCache.LoadCacheHit" enum="BooleanCacheHit" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>backer@chromium.org</owner> <owner>penghuang@chromium.org</owner> <owner>vasilyt@chromium.org</owner> @@ -1424,7 +1424,7 @@ </histogram> <histogram name="GPU.Vulkan.PipelineCache.Size" units="KB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>backer@chromium.org</owner> <owner>penghuang@chromium.org</owner> <owner>vasilyt@chromium.org</owner> @@ -1436,7 +1436,7 @@ </histogram> <histogram name="GPU.Vulkan.PipelineCache.StoreDuration" units="microseconds" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>backer@chromium.org</owner> <owner>penghuang@chromium.org</owner> <owner>vasilyt@chromium.org</owner> @@ -1448,7 +1448,7 @@ </histogram> <histogram name="GPU.Vulkan.PipelineCache.vkCreateGraphicsPipelines" - units="microseconds" expires_after="2021-10-31"> + units="microseconds" expires_after="2022-01-02"> <owner>backer@chromium.org</owner> <owner>penghuang@chromium.org</owner> <owner>vasilyt@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/input/histograms.xml b/tools/metrics/histograms/histograms_xml/input/histograms.xml index 366be3d..03a2b597 100644 --- a/tools/metrics/histograms/histograms_xml/input/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/input/histograms.xml
@@ -177,7 +177,7 @@ </histogram> <histogram name="InputMethod.Assistive.InsufficientData" - enum="IMEAssistiveAction" expires_after="2021-10-31"> + enum="IMEAssistiveAction" expires_after="2022-01-02"> <owner>jiwan@google.com</owner> <owner>essential-inputs-team@google.com</owner> <summary> @@ -1036,7 +1036,7 @@ </histogram> <histogram name="InputMethod.VirtualKeyboard.SwitchMode" enum="IMEVKMode" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>shend@chromium.org</owner> <owner>essential-inputs-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/interstitial/histograms.xml b/tools/metrics/histograms/histograms_xml/interstitial/histograms.xml index 3208bba..494a961 100644 --- a/tools/metrics/histograms/histograms_xml/interstitial/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/interstitial/histograms.xml
@@ -150,7 +150,7 @@ </histogram> <histogram name="interstitial.ssl.did_user_revoke_decisions2" - enum="BooleanRevoked" expires_after="2021-10-31"> + enum="BooleanRevoked" expires_after="2022-01-02"> <owner>carlosil@chromium.org</owner> <owner>security-enamel@chromium.org</owner> <summary> @@ -193,7 +193,7 @@ </histogram> <histogram name="interstitial.ssl_error_type" enum="SSLErrorTypes" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>estark@chromium.org</owner> <owner>carlosil@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/media/histograms.xml b/tools/metrics/histograms/histograms_xml/media/histograms.xml index 5cc2609..e90a3b3 100644 --- a/tools/metrics/histograms/histograms_xml/media/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/media/histograms.xml
@@ -703,7 +703,7 @@ </histogram> <histogram name="Media.Audio.Render.FramesRequested" units="frames" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>guidou@chromium.org</owner> <owner>olka@chromium.org</owner> <summary> @@ -1532,7 +1532,7 @@ </histogram> <histogram name="Media.D3D11.VP9Status" enum="MediaStatusCode" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>liberato@chromium.org</owner> <owner>tmathmeyer@chromium.org</owner> <summary> @@ -2228,7 +2228,7 @@ </histogram> <histogram name="Media.GlobalMediaControls.InteractionDelayAfterPause" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>steimel@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/memory/histograms.xml b/tools/metrics/histograms/histograms_xml/memory/histograms.xml index 2fcfadb2..097f1c5c 100644 --- a/tools/metrics/histograms/histograms_xml/memory/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/memory/histograms.xml
@@ -367,7 +367,7 @@ </histogram> <histogram name="Memory.Browser.MemoryFootprint.OnBackground" units="MiB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>justincohen@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/navigation/histograms.xml b/tools/metrics/histograms/histograms_xml/navigation/histograms.xml index f8eaed4..789bb4d9 100644 --- a/tools/metrics/histograms/histograms_xml/navigation/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/navigation/histograms.xml
@@ -64,7 +64,7 @@ <histogram name="BackForwardCache.AllSites.HistoryNavigationOutcome.BlocklistedFeature" - enum="WebSchedulerTrackedFeature" expires_after="2021-10-31"> + enum="WebSchedulerTrackedFeature" expires_after="2022-01-02"> <owner>hajimehoshi@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner> <summary> @@ -759,7 +759,7 @@ </histogram> <histogram name="Navigation.EngagementTime.Ratio" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>estark@chromium.org</owner> <owner>security-enamel@chromium.org</owner> <summary> @@ -1044,7 +1044,7 @@ </histogram> <histogram name="Navigation.PolicyBlocklistNavigationThrottle.PolicyLoadDelay" - units="ms" expires_after="2021-11-01"> + units="ms" expires_after="2022-01-02"> <owner>ydago@chromium.org</owner> <owner>pastarmovj@chromium.org</owner> <summary> @@ -1055,7 +1055,7 @@ <histogram name="Navigation.PolicyBlocklistNavigationThrottle.PolicyLoadTimeout" - enum="Boolean" expires_after="2021-11-01"> + enum="Boolean" expires_after="2022-01-02"> <owner>ydago@chromium.org</owner> <owner>pastarmovj@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/notifications/histograms.xml b/tools/metrics/histograms/histograms_xml/notifications/histograms.xml index 55c62108..fd3092ed 100644 --- a/tools/metrics/histograms/histograms_xml/notifications/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/notifications/histograms.xml
@@ -238,7 +238,7 @@ </histogram> <histogram name="Notifications.Database.DeleteBeforeWriteResult" - enum="NotificationDatabaseStatus" expires_after="2021-10-31"> + enum="NotificationDatabaseStatus" expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -249,7 +249,7 @@ </histogram> <histogram name="Notifications.Database.DeleteResult" - enum="NotificationDatabaseStatus" expires_after="2021-10-31"> + enum="NotificationDatabaseStatus" expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -269,7 +269,7 @@ </histogram> <histogram name="Notifications.Database.DestroyResult" - enum="NotificationDatabaseStatus" expires_after="2021-10-31"> + enum="NotificationDatabaseStatus" expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -279,7 +279,7 @@ </histogram> <histogram name="Notifications.Database.ExpiredNotificationCount" - units="notifications" expires_after="2021-10-31"> + units="notifications" expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -302,7 +302,7 @@ </histogram> <histogram name="Notifications.Database.OpenAfterCorruptionResult" - enum="NotificationDatabaseStatus" expires_after="2021-10-31"> + enum="NotificationDatabaseStatus" expires_after="2022-01-02"> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -958,7 +958,7 @@ </histogram> <histogram name="Notifications.Windows.ActivationStatus" - enum="WindowsNotificationActivationStatus" expires_after="2021-10-31"> + enum="WindowsNotificationActivationStatus" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>peter@chromium.org</owner> <owner>chengx@chromium.org</owner> @@ -1001,7 +1001,7 @@ </histogram> <histogram name="Notifications.Windows.DisplayStatus" - enum="WindowsNotificationDisplayStatus" expires_after="2021-10-31"> + enum="WindowsNotificationDisplayStatus" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -1037,7 +1037,7 @@ <histogram name="Notifications.Windows.GetNotificationLaunchIdStatus" enum="WindowsNotificationGetNotificationLaunchIdStatus" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -1058,7 +1058,7 @@ </histogram> <histogram name="Notifications.Windows.GetSettingPolicyStartup" - enum="WindowsNotificationGetSettingPolicy" expires_after="2021-10-31"> + enum="WindowsNotificationGetSettingPolicy" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>knollr@chromium.org</owner> <owner>peter@chromium.org</owner> @@ -1069,7 +1069,7 @@ </histogram> <histogram name="Notifications.Windows.GetSettingStatus" - enum="WindowsNotificationGetSettingStatus" expires_after="2021-10-31"> + enum="WindowsNotificationGetSettingStatus" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>peter@chromium.org</owner> <summary> @@ -1090,7 +1090,7 @@ </histogram> <histogram name="Notifications.Windows.HandleEventStatus" - enum="WindowsNotificationHandleEventStatus" expires_after="2021-10-31"> + enum="WindowsNotificationHandleEventStatus" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>peter@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/offline/histograms.xml b/tools/metrics/histograms/histograms_xml/offline/histograms.xml index 13cc1e8..b4b672f 100644 --- a/tools/metrics/histograms/histograms_xml/offline/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/offline/histograms.xml
@@ -813,7 +813,7 @@ </histogram> <histogram name="OfflinePages.OfflineUsage" enum="OfflinePagesOfflineUsage" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>dimich@chromium.org</owner> <owner>offline-dev@chromium.org</owner> <summary> @@ -948,7 +948,7 @@ </histogram> <histogram name="OfflinePages.Prefetching.FinishedItemErrorCode" - enum="OfflinePrefetchItemErrorCode" expires_after="2021-10-31"> + enum="OfflinePrefetchItemErrorCode" expires_after="2022-01-02"> <owner>carlosk@chromium.org</owner> <owner>offline-dev@chromium.org</owner> <summary> @@ -1046,7 +1046,7 @@ </histogram> <histogram name="OfflinePages.PrefetchUsage" enum="OfflinePagesPrefetchUsage" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>dimich@chromium.org</owner> <owner>offline-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/omnibox/histograms.xml b/tools/metrics/histograms/histograms_xml/omnibox/histograms.xml index 3094951..f17623dd 100644 --- a/tools/metrics/histograms/histograms_xml/omnibox/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/omnibox/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="Omnibox.AnswerParseSuccess" enum="BooleanSuccess" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <summary> @@ -32,7 +32,7 @@ </histogram> <histogram name="Omnibox.AnswerParseType" enum="SuggestionAnswerType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <summary> @@ -47,7 +47,7 @@ </histogram> <histogram name="Omnibox.BitmapFetchLatency" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="Omnibox.BitmapFetchLatencyCacheSplit" --> <owner>manukh@chromium.org</owner> @@ -64,7 +64,7 @@ </histogram> <histogram name="Omnibox.CharTypedToRepaintLatency" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>asvitkine@chromium.org</owner> @@ -96,7 +96,7 @@ </histogram> <histogram name="Omnibox.CharTypedToRepaintLatency.InsertToPresent" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>asvitkine@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> @@ -124,7 +124,7 @@ </histogram> <histogram name="Omnibox.CharTypedToRepaintLatency.ToPaint" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>asvitkine@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> @@ -221,7 +221,7 @@ </histogram> <histogram name="Omnibox.CutOrCopyAllText" units="count" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -274,7 +274,7 @@ </histogram> <histogram name="Omnibox.EnteredKeywordMode2" enum="OmniboxEnteredKeywordMode2" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -288,7 +288,7 @@ </histogram> <histogram name="Omnibox.FocusResultedInNavigation" enum="BooleanNavigated" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ender@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> @@ -320,7 +320,7 @@ </histogram> <histogram name="Omnibox.FocusToOpenTimeAnyPopupState3" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -371,7 +371,7 @@ </histogram> <histogram name="Omnibox.InputType" enum="OmniboxInputType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -389,7 +389,7 @@ </histogram> <histogram name="Omnibox.IsPasteAndGo" enum="Boolean" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -407,7 +407,7 @@ </summary> </histogram> -<histogram name="Omnibox.IsPopupOpen" enum="Boolean" expires_after="2021-10-31"> +<histogram name="Omnibox.IsPopupOpen" enum="Boolean" expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -427,7 +427,7 @@ </histogram> <histogram name="Omnibox.JustDeletedText" enum="Boolean" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -567,7 +567,7 @@ </histogram> <histogram name="Omnibox.MatchStability.AsyncMatchChangedInAnyPosition" - enum="BooleanChanged" expires_after="2021-10-31"> + enum="BooleanChanged" expires_after="2022-01-02"> <owner>tommycli@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <summary> @@ -603,7 +603,7 @@ </histogram> <histogram name="Omnibox.NumTypedTerms" units="terms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -639,7 +639,7 @@ </summary> </histogram> -<histogram name="Omnibox.PaintTime" units="ms" expires_after="2021-10-31"> +<histogram name="Omnibox.PaintTime" units="ms" expires_after="2022-01-02"> <owner>asvitkine@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> @@ -649,7 +649,7 @@ </summary> </histogram> -<histogram name="Omnibox.Paste" units="count" expires_after="2021-10-31"> +<histogram name="Omnibox.Paste" units="count" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -672,7 +672,7 @@ </histogram> <histogram name="Omnibox.PedalShown" enum="SuggestionPedalType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>orinj@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -692,7 +692,7 @@ </summary> </histogram> -<histogram name="Omnibox.ProviderTime2" units="ms" expires_after="2021-10-31"> +<histogram name="Omnibox.ProviderTime2" units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -701,7 +701,7 @@ </summary> </histogram> -<histogram name="Omnibox.QueryTime2" units="ms" expires_after="2021-10-31"> +<histogram name="Omnibox.QueryTime2" units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -724,7 +724,7 @@ </histogram> <histogram name="Omnibox.SearchEngineType" enum="OmniboxSearchEngineType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -734,7 +734,7 @@ </histogram> <histogram name="Omnibox.SearchPrefetch.PrefetchEligibilityReason" - enum="SearchPrefetchEligibilityReason" expires_after="2021-10-31"> + enum="SearchPrefetchEligibilityReason" expires_after="2022-01-02"> <owner>ryansturm@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <summary> @@ -746,7 +746,7 @@ </histogram> <histogram name="Omnibox.SearchPrefetch.PrefetchFinalStatus" - enum="SearchPrefetchFinalStatus" expires_after="2021-10-31"> + enum="SearchPrefetchFinalStatus" expires_after="2022-01-02"> <owner>ryansturm@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <summary> @@ -756,7 +756,7 @@ </histogram> <histogram name="Omnibox.SearchPrefetch.PrefetchServingReason" - enum="SearchPrefetchServingReason" expires_after="2021-10-31"> + enum="SearchPrefetchServingReason" expires_after="2022-01-02"> <owner>ryansturm@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <summary> @@ -766,7 +766,7 @@ </histogram> <histogram name="Omnibox.SearchProviderMatches" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -778,7 +778,7 @@ </histogram> <histogram name="Omnibox.SelectedPosition" units="position" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -828,7 +828,7 @@ </histogram> <histogram name="Omnibox.SuggestionUsed.AnswerInSuggest" - enum="SuggestionAnswerOptionalType" expires_after="2021-10-31"> + enum="SuggestionAnswerOptionalType" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -864,7 +864,7 @@ </histogram> <histogram name="Omnibox.SuggestionUsed.Pedal" enum="SuggestionPedalType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>orinj@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -882,7 +882,7 @@ <histogram name="Omnibox.SuggestionUsed.Search.Experimental.NavigationToFirstMeaningfulPaint" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -894,7 +894,7 @@ <histogram name="Omnibox.SuggestionUsed.Search.NavigationToFirstContentfulPaint" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -935,7 +935,7 @@ <histogram name="Omnibox.SuggestionUsed.URL.Experimental.NavigationToFirstMeaningfulPaint" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -946,7 +946,7 @@ </histogram> <histogram name="Omnibox.SuggestionUsed.URL.NavigationToFirstContentfulPaint" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -957,7 +957,7 @@ </histogram> <histogram name="Omnibox.SuggestRequest.Failure.GoogleResponseTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>cch@chromium.org</owner> @@ -969,7 +969,7 @@ </histogram> <histogram name="Omnibox.SuggestRequest.Success.GoogleResponseTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>cch@chromium.org</owner> @@ -981,7 +981,7 @@ </histogram> <histogram name="Omnibox.SuggestRequest.Success.PrefetchImagesCount" - units="count" expires_after="2021-10-31"> + units="count" expires_after="2022-01-02"> <owner>manukh@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -992,7 +992,7 @@ </histogram> <histogram name="Omnibox.SuggestRequests" enum="OmniboxSuggestRequests" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>cch@chromium.org</owner> @@ -1003,7 +1003,7 @@ </histogram> <histogram name="Omnibox.TabMatchTime" units="microseconds" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>gangwu@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>mpearson@chromium.org</owner> @@ -1072,7 +1072,7 @@ </histogram> <histogram name="Omnibox.URLNavigationScheme" enum="NavigationScheme" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> @@ -1131,7 +1131,7 @@ </histogram> <histogram name="Omnibox.ZeroSuggest.Eligible.OnFocusV2" - enum="ZeroSuggestEligibleOnFocus" expires_after="2021-10-31"> + enum="ZeroSuggestEligibleOnFocus" expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <summary> @@ -1164,7 +1164,7 @@ </histogram> <histogram name="Omnibox.ZeroSuggest.Eligible.OnProfileOpen" - enum="BooleanSupported" expires_after="2021-10-31"> + enum="BooleanSupported" expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/optimization/histograms.xml b/tools/metrics/histograms/histograms_xml/optimization/histograms.xml index 2f51dd95..9bad8dff 100644 --- a/tools/metrics/histograms/histograms_xml/optimization/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/optimization/histograms.xml
@@ -43,7 +43,7 @@ </histogram> <histogram base="true" name="OptimizationGuide.ApplyDecisionAsync" - enum="OptimizationGuideOptimizationTypeDecision" expires_after="2021-10-31"> + enum="OptimizationGuideOptimizationTypeDecision" expires_after="2022-01-02"> <owner>sophiechang@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary> @@ -116,7 +116,7 @@ </histogram> <histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.FetchLatency" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>sophiechang@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary> @@ -147,7 +147,7 @@ </histogram> <histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.NetErrorCode" - enum="NetErrorCodes" expires_after="2021-10-31"> + enum="NetErrorCodes" expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> <summary> @@ -157,7 +157,7 @@ </histogram> <histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.Status" - enum="HttpResponseCode" expires_after="2021-10-31"> + enum="HttpResponseCode" expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> <summary> @@ -293,7 +293,7 @@ <histogram name="OptimizationGuide.HintsManager.RaceNavigationFetchAttemptStatus" enum="OptimizationGuideRaceNavigationFetchAttemptStatus" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> <summary> @@ -424,7 +424,7 @@ </histogram> <histogram base="true" name="OptimizationGuide.OptimizationFilterStatus" - enum="OptimizationGuideOptimizationFilterStatus" expires_after="2021-10-31"> + enum="OptimizationGuideOptimizationFilterStatus" expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> <summary> @@ -771,7 +771,7 @@ </histogram> <histogram name="OptimizationGuide.ProcessHintsResult" - enum="OptimizationGuideProcessHintsResult" expires_after="2021-10-31"> + enum="OptimizationGuideProcessHintsResult" expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> <summary> @@ -853,7 +853,7 @@ </histogram> <histogram name="OptimizationGuide.RemoteFetchingEnabled" - units="BooleanEnabled" expires_after="2021-10-31"> + units="BooleanEnabled" expires_after="2022-01-02"> <owner>sophiechang@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index 5d427a9..a07f2b4c 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -159,7 +159,7 @@ </histogram> <histogram name="AccountManager.EduCoexistenceV2.InSessionFlowResult" - enum="EduCoexistenceFlowV2Result" expires_after="2021-11-01"> + enum="EduCoexistenceFlowV2Result" expires_after="2022-01-02"> <owner>agawronska@chromium.org</owner> <owner>danan@chromium.org</owner> <owner>yilkal@chromium.org</owner> @@ -171,7 +171,7 @@ </histogram> <histogram name="AccountManager.EduCoexistenceV2.OnboardingFlowResult" - enum="EduCoexistenceFlowV2Result" expires_after="2021-11-01"> + enum="EduCoexistenceFlowV2Result" expires_after="2022-01-02"> <owner>agawronska@chromium.org</owner> <owner>danan@chromium.org</owner> <owner>yilkal@chromium.org</owner> @@ -1253,7 +1253,7 @@ </histogram> <histogram name="AutocompleteActionPredictor.DatabaseAction" - enum="AutocompleteActionPredictorDatabaseAction" expires_after="2021-10-31"> + enum="AutocompleteActionPredictorDatabaseAction" expires_after="2022-01-02"> <owner>tbansal@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <owner>jdonnelly@chromium.org</owner> @@ -1273,7 +1273,7 @@ </histogram> <histogram name="AutocompleteActionPredictor.MatchIsInDb" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>tbansal@chromium.org</owner> <owner>chrome-omnibox-team@google.com</owner> <owner>jdonnelly@chromium.org</owner> @@ -1927,7 +1927,7 @@ </histogram> <histogram name="Bookmarks.EntryPoint" enum="BookmarksEntryPoint" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ianwen@chromium.org</owner> <component>UI>Browser>Bookmarks</component> <summary>How users add a new bookmark.</summary> @@ -2071,7 +2071,7 @@ </summary> </histogram> -<histogram name="BootTime.Total2" units="ms" expires_after="2021-10-31"> +<histogram name="BootTime.Total2" units="ms" expires_after="2022-01-02"> <owner>bccheng@chromium.org</owner> <owner>semenzato@chromium.org</owner> <summary>Time from power on to login panel ready (Chrome OS).</summary> @@ -3352,7 +3352,7 @@ </histogram> <histogram name="ContextMenu.DelayedElementDetails" - enum="ContextMenuDelayedElementDetails" expires_after="2021-10-31"> + enum="ContextMenuDelayedElementDetails" expires_after="2022-01-02"> <owner>michaeldo@chromium.org</owner> <owner>src/ios/web/OWNERS</owner> <summary> @@ -3396,7 +3396,7 @@ </histogram> <histogram name="ContextMenu.LensChip.Event" enum="LensChipEvent" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>yusuyoutube@google.com</owner> <owner>benwgold@google.com</owner> <summary> @@ -6665,7 +6665,7 @@ </histogram> <histogram name="Graphics.PresentationTimestamp.InvalidBeforeSwap" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -6678,7 +6678,7 @@ </histogram> <histogram name="Graphics.PresentationTimestamp.InvalidFromFuture" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -6690,7 +6690,7 @@ </histogram> <histogram name="Graphics.PresentationTimestamp.LargePresentationDelta" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -6885,7 +6885,7 @@ </histogram> <histogram name="Graphics.Smoothness.MaxStale" units="ms" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>sadrul@chromium.org</owner> <owner>mjzhang@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> @@ -7115,7 +7115,7 @@ </histogram> <histogram name="Graphics.Smoothness.Stale" units="ms" - expires_after="2021-11-01"> + expires_after="2022-01-02"> <owner>sadrul@chromium.org</owner> <owner>mjzhang@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> @@ -7235,7 +7235,7 @@ </histogram> <histogram name="Hardware.Display.Count.OnChange" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>sashamcintosh@chromium.org</owner> <owner>chromeos-gfx@chromium.org</owner> <summary> @@ -7245,7 +7245,7 @@ </histogram> <histogram name="Hardware.Display.Count.OnStartup" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>sashamcintosh@chromium.org</owner> <owner>chromeos-gfx@chromium.org</owner> <summary> @@ -7719,7 +7719,7 @@ </histogram> <histogram name="ImportantFile.FileReplaceRetryCount" units="attempt count" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>brucedawson@chromium.org</owner> <owner>grt@chromium.org</owner> <summary> @@ -9316,7 +9316,7 @@ </histogram> <histogram name="LiteVideo.HintAgent.HasHint" units="boolean" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rajendrant@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary> @@ -9336,7 +9336,7 @@ </histogram> <histogram name="LiteVideo.NavigationMetrics.FrameRebufferMapSize" - units="count" expires_after="2021-10-31"> + units="count" expires_after="2022-01-02"> <owner>mcrouse@chromium.org</owner> <owner>rajendrant@chromium.org</owner> <summary> @@ -9604,7 +9604,7 @@ </histogram> <histogram name="MachineLearningService.NumWorkerProcess" units="count" - expires_after="2021-10-24"> + expires_after="2022-01-02"> <owner>alanlxl@chromium.org</owner> <owner>amoylan@chromium.org</owner> <owner>honglinyu@chromium.org</owner> @@ -10241,7 +10241,7 @@ </histogram> <histogram name="Mojo.Channel.Linux.SharedMemWriteBytes_Fail_NoSpace" - units="bytes" expires_after="2021-11-01"> + units="bytes" expires_after="2022-01-02"> <owner>bgeffon@chromium.org</owner> <owner>rockot@google.com</owner> <summary> @@ -10251,7 +10251,7 @@ </histogram> <histogram name="Mojo.Channel.Linux.SharedMemWriteBytes_Fail_TooLarge" - units="bytes" expires_after="2021-11-01"> + units="bytes" expires_after="2022-01-02"> <owner>bgeffon@chromium.org</owner> <owner>rockot@google.com</owner> <summary> @@ -10739,7 +10739,7 @@ </histogram> <histogram name="NQE.ConnectivityMonitor.TimeToSwitchNetworks" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rockot@google.com</owner> <owner>zhongyi@chromium.org</owner> <summary> @@ -12946,7 +12946,7 @@ </histogram> <histogram name="PushMessaging.GetRegistrationStatus" - enum="PushGetRegistrationStatus" expires_after="2021-10-31"> + enum="PushGetRegistrationStatus" expires_after="2022-01-02"> <owner>peter@chromium.org</owner> <owner>knollr@chromium.org</owner> <summary> @@ -12993,7 +12993,7 @@ </histogram> <histogram name="PushMessaging.RegistrationStatus" - enum="PushRegistrationStatus" expires_after="2021-10-31"> + enum="PushRegistrationStatus" expires_after="2022-01-02"> <owner>peter@chromium.org</owner> <owner>knollr@chromium.org</owner> <summary> @@ -13840,7 +13840,7 @@ </histogram> <histogram name="ResourceScheduler.RequestQueuingDuration" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>tbansal@chromium.org</owner> <summary> The amount of time the ResourceScheduler queued a request. Recorded in @@ -14926,7 +14926,7 @@ </histogram> <histogram name="SignedExchange.LoadResult2" enum="SignedExchangeLoadResult" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ksakamoto@chromium.org</owner> <owner>kinuko@chromium.org</owner> <owner>horo@chromium.org</owner> @@ -17808,7 +17808,7 @@ </histogram> <histogram name="UpgradeDetector.DaysBeforeUpgrade" units="days" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>emshack@chromium.org</owner> <owner>pbos@chromium.org</owner> <summary> @@ -18635,7 +18635,7 @@ </histogram> <histogram name="Webapp.AddToHomescreenMediator.AppTypeToMenuEntry" - enum="AppTypeToMenuEntry" expires_after="2021-10-31"> + enum="AppTypeToMenuEntry" expires_after="2022-01-02"> <owner>finnur@chromium.org</owner> <owner>beverloo@chromium.org</owner> <summary> @@ -18721,7 +18721,7 @@ </histogram> <histogram name="Webapp.Install.DisplayMode2" enum="WebAppDisplayMode" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>ericwilligers@chromium.org</owner> <owner>peter@chromium.org</owner> <owner>yfriedman@chromium.org</owner> @@ -19307,7 +19307,7 @@ </histogram> <histogram name="WebFont.LocalFontUsed" enum="BooleanUsage" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>hajimehoshi@chromium.org</owner> <owner>kenjibaheux@chromium.org</owner> <owner>kouhei@chromium.org</owner> @@ -19453,7 +19453,7 @@ </histogram> <histogram name="WebsiteSettings.Discoverability.TimeToOpen" units="ms" - expires_after="M94"> + expires_after="2022-01-02"> <owner>eokoyomon@chromium.org</owner> <owner>dullweber@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/page/histograms.xml b/tools/metrics/histograms/histograms_xml/page/histograms.xml index 46c4a57..0f39d60 100644 --- a/tools/metrics/histograms/histograms_xml/page/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/page/histograms.xml
@@ -298,7 +298,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.Memory.MainFrame.Max" units="KiB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>cammie@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> @@ -334,7 +334,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.Memory.UpdateCount" units="count" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>cammie@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> @@ -1175,7 +1175,7 @@ </histogram> <histogram name="PageLoad.Experimental.Memory.Core.MainFrame.Max" units="KiB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>cammie@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> @@ -1189,7 +1189,7 @@ </histogram> <histogram name="PageLoad.Experimental.Memory.Core.Subframe.Aggregate.Max" - units="KiB" expires_after="2021-10-31"> + units="KiB" expires_after="2022-01-02"> <owner>cammie@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> @@ -1204,7 +1204,7 @@ </histogram> <histogram name="PageLoad.Experimental.Memory.Core.Total.Max" units="KiB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>cammie@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> @@ -1716,7 +1716,7 @@ <histogram name="PageLoad.InteractiveTiming.FirstInputDelay.AfterBackForwardCacheRestore" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>altimin@chromium.org</owner> <owner>hajimehoshi@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner> @@ -1751,7 +1751,7 @@ </histogram> <histogram name="PageLoad.InteractiveTiming.FirstInputTimestamp4" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>sullivan@chromium.org</owner> <owner>speed-metrics-dev@chromium.org</owner> <summary> @@ -2099,7 +2099,7 @@ <histogram name="PageLoad.LayoutInstability.CumulativeShiftScore.AfterBackForwardCacheRestore" - units="scorex10" expires_after="2021-10-31"> + units="scorex10" expires_after="2022-01-02"> <owner>altimin@chromium.org</owner> <owner>hajimehoshi@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner> @@ -2124,7 +2124,7 @@ <histogram name="PageLoad.LayoutInstability.CumulativeShiftScore.MainFrame.AfterBackForwardCacheRestore" - units="scorex10" expires_after="2021-10-31"> + units="scorex10" expires_after="2022-01-02"> <owner>altimin@chromium.org</owner> <owner>hajimehoshi@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner> @@ -2362,7 +2362,7 @@ <histogram name="PageLoad.PaintTiming.NavigationToFirstPaint.AfterBackForwardCacheRestore" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>altimin@chromium.org</owner> <owner>hajimehoshi@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/password/histograms.xml b/tools/metrics/histograms/histograms_xml/password/histograms.xml index bd78d23d..ecd22317 100644 --- a/tools/metrics/histograms/histograms_xml/password/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/password/histograms.xml
@@ -184,7 +184,7 @@ </histogram> <histogram name="PasswordManager.AccountChooserDialogMultipleAccounts" - enum="AccountChooserDismissalReason" expires_after="2021-10-31"> + enum="AccountChooserDismissalReason" expires_after="2022-01-02"> <owner>vasilii@chromium.org</owner> <owner>kazinova@google.com</owner> <summary> @@ -194,7 +194,7 @@ </histogram> <histogram name="PasswordManager.AccountChooserDialogOneAccount" - enum="AccountChooserDismissalReason" expires_after="2021-10-31"> + enum="AccountChooserDismissalReason" expires_after="2022-01-02"> <owner>vasilii@chromium.org</owner> <owner>kazinova@google.com</owner> <summary> @@ -1121,7 +1121,7 @@ </histogram> <histogram name="PasswordManager.EditsInSaveBubble" - enum="PasswordManagerEditsInSaveBubbleEnum" expires_after="2021-10-31"> + enum="PasswordManagerEditsInSaveBubbleEnum" expires_after="2022-01-02"> <owner>vasilii@chromium.org</owner> <owner>kazinova@google.com</owner> <summary> @@ -1201,7 +1201,7 @@ </histogram> <histogram name="PasswordManager.FillingSource" - enum="PasswordManagerFillingSource" expires_after="2021-10-31"> + enum="PasswordManagerFillingSource" expires_after="2022-01-02"> <owner>mamir@chromium.org</owner> <owner>treib@chromium.org</owner> <summary> @@ -2308,7 +2308,7 @@ </histogram> <histogram base="true" name="PasswordManager.TotalAccountsHiRes.WithScheme" - units="accounts" expires_after="2021-10-31"> + units="accounts" expires_after="2022-01-02"> <owner>battre@chromium.org</owner> <owner>vasilii@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/permissions/histograms.xml b/tools/metrics/histograms/histograms_xml/permissions/histograms.xml index d9aef8e..c56695aa 100644 --- a/tools/metrics/histograms/histograms_xml/permissions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/permissions/histograms.xml
@@ -170,7 +170,7 @@ </histogram> <histogram name="Permissions.Chip.TimeToInteraction" units="ms" - expires_after="2021-10-25"> + expires_after="2022-01-02"> <owner>bsep@chromium.org</owner> <owner>engedy@chromium.org</owner> <owner>olesiamarukhno@google.com</owner> @@ -199,7 +199,7 @@ </histogram> <histogram name="Permissions.CrowdDeny.PreloadData.DelayedPushNotification" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>elklm@chromium.org</owner> <owner>src/components/permissions/PERMISSIONS_OWNERS</owner> <summary> @@ -294,7 +294,7 @@ </histogram> <histogram name="Permissions.Engagement.AcceptedOnce" units="%" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>engedy@chromium.org</owner> <owner>src/components/permissions/PERMISSIONS_OWNERS</owner> <summary> @@ -335,7 +335,7 @@ </histogram> <histogram name="Permissions.MissingOSLevelPermission.Action" - enum="PermissionAction" expires_after="2021-10-25"> + enum="PermissionAction" expires_after="2022-01-02"> <owner>andypaicu@chromium.org</owner> <owner>engedy@chromium.org</owner> <owner>hkamila@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/phonehub/histograms.xml b/tools/metrics/histograms/histograms_xml/phonehub/histograms.xml index 12bd87c..7a4597c 100644 --- a/tools/metrics/histograms/histograms_xml/phonehub/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/phonehub/histograms.xml
@@ -165,7 +165,7 @@ </histogram> <histogram name="PhoneHub.NotificationCount" units="notifications" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>tengs@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary> @@ -195,7 +195,7 @@ </histogram> <histogram name="PhoneHub.NotificationOptInEvents" - enum="PhoneHubInterstitialScreenEvent" expires_after="2021-10-31"> + enum="PhoneHubInterstitialScreenEvent" expires_after="2022-01-02"> <owner>tengs@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary>Events for the given notification opt-in prompt.</summary> @@ -209,7 +209,7 @@ </histogram> <histogram name="PhoneHub.QuickActionClicked" enum="PhoneHubQuickAction" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>tengs@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary>Event logged after the user clicks on a quick action.</summary> @@ -229,7 +229,7 @@ </histogram> <histogram name="PhoneHub.ScreenOnSettingsButtonClicked" enum="PhoneHubScreen" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>tengs@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/platform/histograms.xml b/tools/metrics/histograms/histograms_xml/platform/histograms.xml index 65949eda..9d383c7 100644 --- a/tools/metrics/histograms/histograms_xml/platform/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/platform/histograms.xml
@@ -1007,7 +1007,7 @@ </histogram> <histogram name="Platform.Temperature.Sensor00" units="Celsius" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>fletcherw@chromium.org</owner> <summary> Temperature reading from EC temperature sensor 0 (TSR0) taken every 30s. @@ -1049,7 +1049,7 @@ </histogram> <histogram name="Platform.Temperature.Sensor02" units="Celsius" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>fletcherw@chromium.org</owner> <summary> Temperature reading from EC temperature sensor 2 (TSR2) taken every 30s.
diff --git a/tools/metrics/histograms/histograms_xml/power/histograms.xml b/tools/metrics/histograms/histograms_xml/power/histograms.xml index e2af68e..e61afd2d 100644 --- a/tools/metrics/histograms/histograms_xml/power/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/power/histograms.xml
@@ -57,7 +57,7 @@ </summary> </histogram> -<histogram name="Power.BacklightLevelOnAC" units="%" expires_after="2021-10-31"> +<histogram name="Power.BacklightLevelOnAC" units="%" expires_after="2022-01-02"> <owner>puthik@chromium.org</owner> <owner>chromeos-platform-power@google.com</owner> <summary> @@ -282,7 +282,7 @@ </histogram> <histogram name="Power.CpuTimeSecondsPerCoreTypeAndFrequency" units="50 MHz" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>eseckler@chromium.org</owner> <owner>skyostil@chromium.org</owner> <summary> @@ -971,7 +971,7 @@ </histogram> <histogram name="Power.Mac.IsOnBattery2" enum="BooleanOnBattery" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>avi@chromium.org</owner> <owner>lgrey@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/prefetch/histograms.xml b/tools/metrics/histograms/histograms_xml/prefetch/histograms.xml index 8bbe2ea..5c36388 100644 --- a/tools/metrics/histograms/histograms_xml/prefetch/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/prefetch/histograms.xml
@@ -360,7 +360,7 @@ </histogram> <histogram name="PrefetchProxy.Prefetch.Mainframe.TotalTime" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>robertogden@chromium.org</owner> <owner>ryansturm@chromium.org</owner> <owner>tbansal@chromium.org</owner> @@ -429,7 +429,7 @@ </histogram> <histogram name="PrefetchProxy.SpareRenderer.CountStartedOnSRP" units="count" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>robertogden@chromium.org</owner> <owner>ryansturm@chromium.org</owner> <owner>tbansal@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/profile/histograms.xml b/tools/metrics/histograms/histograms_xml/profile/histograms.xml index 6174b4e..abc1febd 100644 --- a/tools/metrics/histograms/histograms_xml/profile/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/profile/histograms.xml
@@ -218,6 +218,9 @@ <histogram name="Profile.EphemeralGuest.Signin" enum="BooleanProfileSignedIn" expires_after="2022-02-02"> + <obsolete> + Removed on 2021-07. + </obsolete> <owner>rhalavati@chromium.org</owner> <owner>chrome-incognito@google.com</owner> <summary> @@ -335,7 +338,7 @@ </histogram> <histogram name="Profile.KeepAliveLeakAtShutdown" enum="ProfileKeepAliveOrigin" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>nicolaso@chromium.org</owner> <owner>cbe-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/quota/histograms.xml b/tools/metrics/histograms/histograms_xml/quota/histograms.xml index c26726d..e44c004 100644 --- a/tools/metrics/histograms/histograms_xml/quota/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/quota/histograms.xml
@@ -145,7 +145,7 @@ </histogram> <histogram name="Quota.GlobalUsageOfPersistentStorage" units="MB" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jarrydg@chromium.org</owner> <summary>Global usage of persistent storage.</summary> </histogram>
diff --git a/tools/metrics/histograms/histograms_xml/renderer/histograms.xml b/tools/metrics/histograms/histograms_xml/renderer/histograms.xml index 67cb573..871b5491 100644 --- a/tools/metrics/histograms/histograms_xml/renderer/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/renderer/histograms.xml
@@ -267,7 +267,7 @@ </histogram> <histogram name="Renderer.PaintPreview.Capture.MainFrameBlinkCaptureDuration" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner> @@ -288,7 +288,7 @@ </histogram> <histogram name="Renderer.PaintPreview.Capture.SubframeBlinkCaptureDuration" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml b/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml index 139de528..1c7ac5d 100644 --- a/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml
@@ -169,7 +169,7 @@ </histogram> <histogram name="SafeBrowsing.BrowserThrottle.TotalDelay" units="ms" - expires_after="2021-10-30"> + expires_after="2022-01-02"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1204,7 +1204,7 @@ </histogram> <histogram name="SafeBrowsing.RT.GetCache.Time" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1215,7 +1215,7 @@ </histogram> <histogram name="SafeBrowsing.RT.GetCacheResult" - enum="SafeBrowsingRTLookupResponseVerdictType" expires_after="2021-10-31"> + enum="SafeBrowsingRTLookupResponseVerdictType" expires_after="2022-01-02"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml index 4efe4dc..92e4026e 100644 --- a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml
@@ -88,7 +88,7 @@ </histogram> <histogram name="SBClientDownload.DownloadExtensions" - enum="SBClientDownloadExtensions" expires_after="2021-10-31"> + enum="SBClientDownloadExtensions" expires_after="2022-01-02"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <owner>mattm@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/search/histograms.xml b/tools/metrics/histograms/histograms_xml/search/histograms.xml index 4eca2bb..43c9e6ea 100644 --- a/tools/metrics/histograms/histograms_xml/search/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/search/histograms.xml
@@ -1163,7 +1163,7 @@ </histogram> <histogram name="Search.DefaultSearchProviderType" - enum="OmniboxSearchEngineType" expires_after="2021-10-31"> + enum="OmniboxSearchEngineType" expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>csharp@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/security/histograms.xml b/tools/metrics/histograms/histograms_xml/security/histograms.xml index a075823..10f7e36 100644 --- a/tools/metrics/histograms/histograms_xml/security/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/security/histograms.xml
@@ -275,7 +275,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.CloseTab" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/service/histograms.xml b/tools/metrics/histograms/histograms_xml/service/histograms.xml index 0dc8ffd..b7b7258 100644 --- a/tools/metrics/histograms/histograms_xml/service/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/service/histograms.xml
@@ -670,7 +670,7 @@ </histogram> <histogram name="ServiceWorker.OfflineCapable.Reason" - enum="OfflineCapableReason" expires_after="2021-10-31"> + enum="OfflineCapableReason" expires_after="2022-01-02"> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/settings/histograms.xml b/tools/metrics/histograms/histograms_xml/settings/histograms.xml index 54845ef..312c9b7f 100644 --- a/tools/metrics/histograms/histograms_xml/settings/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/settings/histograms.xml
@@ -71,7 +71,7 @@ </histogram> <histogram name="Settings.HomePageEngineType" enum="OmniboxSearchEngineType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>csharp@chromium.org</owner> <summary> @@ -137,7 +137,7 @@ </histogram> <histogram name="Settings.PinnedTabEngineTypes" enum="OmniboxSearchEngineType" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>csharp@chromium.org</owner> <summary> @@ -363,7 +363,7 @@ </histogram> <histogram name="Settings.StartupPageEngineTypes" - enum="OmniboxSearchEngineType" expires_after="2021-10-31"> + enum="OmniboxSearchEngineType" expires_after="2022-01-02"> <owner>mpearson@chromium.org</owner> <owner>csharp@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/signin/histograms.xml b/tools/metrics/histograms/histograms_xml/signin/histograms.xml index e44791c..27e6cf7 100644 --- a/tools/metrics/histograms/histograms_xml/signin/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/signin/histograms.xml
@@ -61,15 +61,17 @@ <histogram name="Signin.AccountCapabilities.GetFromSystemLibraryDuration" units="ms" expires_after="2021-11-01"> <owner>aliceywang@chromium.org</owner> + <owner>fernandex@chromium.org</owner> <owner>triploblastic@chromium.org</owner> + <owner>chrome-signin-team@google.com</owner> <summary> This histogram records the time it takes to fetch account capabilities from - the system library on Android on every call. + the system library on Android and iOS on every call. </summary> </histogram> <histogram name="Signin.AccountConsistencyPromoAction" - enum="AccountConsistencyPromoAction" expires_after="2021-10-31"> + enum="AccountConsistencyPromoAction" expires_after="2022-01-02"> <owner>bsazonov@chromium.org</owner> <owner>aliceywang@chromium.org</owner> <summary> @@ -79,7 +81,7 @@ </histogram> <histogram name="Signin.AccountConsistencyPromoAction.Shown.Count" - units="counts" expires_after="2021-10-31"> + units="counts" expires_after="2022-01-02"> <owner>aliceywang@chromium.org</owner> <owner>triploblastic@chromium.org</owner> <owner>chrome-signin-team@google.com</owner> @@ -91,7 +93,7 @@ </histogram> <histogram name="Signin.AccountConsistencyPromoAction.SignedIn.Count" - units="counts" expires_after="2021-10-31"> + units="counts" expires_after="2022-01-02"> <owner>aliceywang@chromium.org</owner> <owner>triploblastic@chromium.org</owner> <owner>chrome-signin-team@google.com</owner> @@ -103,7 +105,7 @@ </histogram> <histogram name="Signin.AccountConsistencyPromoAfterDismissal" - enum="AccountConsistencyPromoAfterDismissal" expires_after="2021-10-31"> + enum="AccountConsistencyPromoAfterDismissal" expires_after="2022-01-02"> <owner>triploblastic@chromium.org</owner> <owner>aliceywang@chromium.org</owner> <summary> @@ -277,7 +279,7 @@ </histogram> <histogram name="Signin.AndroidNumberOfDeviceAccounts" units="accounts" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>triploblastic@chromium.org</owner> <owner>aliceywang@chromium.org</owner> <summary> @@ -1423,7 +1425,7 @@ </histogram> <histogram name="Signin.TransactionalReauthResult" enum="SigninReauthResult" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="TransactionalReauthEntryPoint" --> @@ -1437,7 +1439,7 @@ </histogram> <histogram name="Signin.TransactionalReauthUserAction" - enum="SigninReauthUserAction" expires_after="2021-10-31"> + enum="SigninReauthUserAction" expires_after="2022-01-02"> <!-- Name completed by histogram_suffixes name="TransactionalReauthEntryPoint" --> @@ -1477,7 +1479,7 @@ </histogram> <histogram name="Signin.UserRequestedWipeDataOnSignout" enum="BooleanRequested" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>triploblastic@google.com</owner> <owner>bsazonov@chromium.org</owner> <summary>User requested to wipe local device data on signout.</summary>
diff --git a/tools/metrics/histograms/histograms_xml/startup/histograms.xml b/tools/metrics/histograms/histograms_xml/startup/histograms.xml index 0def5080a..f9788cba 100644 --- a/tools/metrics/histograms/histograms_xml/startup/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/startup/histograms.xml
@@ -106,7 +106,7 @@ </histogram> <histogram name="Startup.Android.Cold.TimeToVisibleContent" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>yashard@chromium.org</owner> <owner>ckitagawa@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/sync/histograms.xml b/tools/metrics/histograms/histograms_xml/sync/histograms.xml index a885c424..bcd3cd2 100644 --- a/tools/metrics/histograms/histograms_xml/sync/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sync/histograms.xml
@@ -679,7 +679,7 @@ </histogram> <histogram base="true" name="Sync.ModelTypeConfigurationTime.Ephemeral" - units="ms" expires_after="2021-10-31"> + units="ms" expires_after="2022-01-02"> <owner>jkrcal@chromium.org</owner> <owner>mastiz@chromium.org</owner> <component>Services>Sync</component>
diff --git a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml index 160f67c..7617223 100644 --- a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml
@@ -294,7 +294,7 @@ </histogram> <histogram name="UKM.UnsentLogs.DroppedSize" units="bytes" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rkaplow@chromium.org</owner> <owner>ukm-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/uma/histograms.xml b/tools/metrics/histograms/histograms_xml/uma/histograms.xml index 36c6900..d807633 100644 --- a/tools/metrics/histograms/histograms_xml/uma/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/uma/histograms.xml
@@ -383,7 +383,7 @@ </histogram> <histogram name="UMA.NegativeSamples.Histogram" enum="HistogramNameHash" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>asvitkine@chromium.org</owner> <owner>bcwhite@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -450,7 +450,7 @@ </histogram> <histogram name="UMA.PersistentHistograms.InitResult" - enum="PersistentHistogramsInitResult" expires_after="2021-10-31"> + enum="PersistentHistogramsInitResult" expires_after="2022-01-02"> <owner>bcwhite@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -496,7 +496,7 @@ </histogram> <histogram name="UMA.SamplingRatePerMille" units="samples per mille" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>jwd@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -604,7 +604,7 @@ </histogram> <histogram name="UMA.UnsentLogs.Dropped" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>holte@chromium.org</owner> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner>
diff --git a/tools/metrics/histograms/histograms_xml/v8/histograms.xml b/tools/metrics/histograms/histograms_xml/v8/histograms.xml index 0324fc8..fd4e932c 100644 --- a/tools/metrics/histograms/histograms_xml/v8/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/v8/histograms.xml
@@ -887,7 +887,7 @@ </summary> </histogram> -<histogram name="V8.GCMarkCompactor" units="ms" expires_after="2021-10-31"> +<histogram name="V8.GCMarkCompactor" units="ms" expires_after="2022-01-02"> <owner>mlippautz@chromium.org</owner> <owner>v8-memory-sheriffs@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml b/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml index 43d406f..ca13433 100644 --- a/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml
@@ -73,7 +73,7 @@ </histogram> <histogram name="WebAudio.AudioContext.latencyHintCategory" units="units" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rtoy@chromium.org</owner> <owner>hongchan@chromium.org</owner> <summary> @@ -86,7 +86,7 @@ </histogram> <histogram name="WebAudio.AudioContext.latencyHintMilliSeconds" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>rtoy@chromium.org</owner> <owner>hongchan@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml index 9b84420a..d06d8ac 100644 --- a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml
@@ -459,7 +459,7 @@ </histogram> <histogram name="WebRTC.Audio.DelayedPacketOutageEventsPerMinute" - units="events/minute" expires_after="2021-10-31"> + units="events/minute" expires_after="2022-01-02"> <owner>hlundin@chromium.org</owner> <summary> Counts the number of delayed packet outage events per minute. The range is @@ -794,7 +794,7 @@ </histogram> <histogram name="WebRTC.Audio.ReceiverDeviceDelayMs" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>hlundin@chromium.org</owner> <summary> The sound card's buffering delay for the receiving side. Sampled once every @@ -803,7 +803,7 @@ </histogram> <histogram name="WebRTC.Audio.ReceiverJitterBufferDelayMs" units="ms" - expires_after="2021-10-31"> + expires_after="2022-01-02"> <owner>hlundin@chromium.org</owner> <summary> The jitter buffer delay for the receiving side. Sampled once every 10 ms @@ -1553,7 +1553,7 @@ </histogram> <histogram name="WebRTC.PeerConnection.OfferExtmapAllowMixed" - enum="PeerConnectionOfferExtmapAllowMixed" expires_after="2021-10-31"> + enum="PeerConnectionOfferExtmapAllowMixed" expires_after="2022-01-02"> <owner>kron@chromium.org</owner> <summary> What setting for the SDP attribute extmap-allow-mixed has been asked for by
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 4da04da..b3ff0dd 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -1,16 +1,16 @@ { "trace_processor_shell": { "win": { - "hash": "12e3fd9531e12c10a46331957b5652f79756dec3", - "remote_path": "perfetto_binaries/trace_processor_shell/win/f4ffdc1c0d10c444b6ca626319d6cdb20f8edae4/trace_processor_shell.exe" + "hash": "bb7c89ce848f8487139902fda486c6f99dbcdefd", + "remote_path": "perfetto_binaries/trace_processor_shell/win/6d3242b7a7c9b99bf3a240177fd1d69d09e3c731/trace_processor_shell.exe" }, "mac": { - "hash": "973e90195adb0df69334e9dceae40f563505d34c", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/f4ffdc1c0d10c444b6ca626319d6cdb20f8edae4/trace_processor_shell" + "hash": "ada34a5a301074666453ddc87b5321f6255a31eb", + "remote_path": "perfetto_binaries/trace_processor_shell/mac/6d3242b7a7c9b99bf3a240177fd1d69d09e3c731/trace_processor_shell" }, "linux": { - "hash": "606767939ead967e52f9e3af8da3048e8139ea6d", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/f4ffdc1c0d10c444b6ca626319d6cdb20f8edae4/trace_processor_shell" + "hash": "9a607b8bd675d9f49ce73e25eea4f4ec8af56f7e", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/6d3242b7a7c9b99bf3a240177fd1d69d09e3c731/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index 3ccf7461..35e0e635 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc
@@ -81,7 +81,6 @@ WindowTreeHost::~WindowTreeHost() { if (display::Screen::GetScreen()) - display::Screen::GetScreen()->RemoveObserver(this); DCHECK(!compositor_) << "compositor must be destroyed before root window"; if (owned_input_method_) { delete input_method_; @@ -344,6 +343,10 @@ return nullptr; } +bool WindowTreeHost::SupportsMouseLock() { + return false; +} + void WindowTreeHost::LockMouse(Window* window) { Window* root_window = window->GetRootWindow(); DCHECK(root_window); @@ -380,7 +383,6 @@ owned_input_method_(false) { if (!window_) window_ = new Window(nullptr); - display::Screen::GetScreen()->AddObserver(this); auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(window_); device_scale_factor_ = display.device_scale_factor(); #if defined(OS_WIN)
diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index dbfdcb0..3492004 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h
@@ -253,6 +253,8 @@ virtual std::unique_ptr<ScopedEnableUnadjustedMouseEvents> RequestUnadjustedMovement(); + // Whether or not the underlying platform supports native pointer locking. + virtual bool SupportsMouseLock(); virtual void LockMouse(Window* window); virtual void UnlockMouse(Window* window); @@ -356,6 +358,8 @@ base::ObserverList<WindowTreeHostObserver>::Unchecked observers_; + display::ScopedDisplayObserver display_observer_{this}; + std::unique_ptr<WindowEventDispatcher> dispatcher_; std::unique_ptr<ui::Compositor> compositor_;
diff --git a/ui/base/clipboard/OWNERS b/ui/base/clipboard/OWNERS index 3520663..b9f041b 100644 --- a/ui/base/clipboard/OWNERS +++ b/ui/base/clipboard/OWNERS
@@ -1,6 +1,7 @@ dcheng@chromium.org huangdarwin@chromium.org +per-file clipboard_*android*=gangwu@chromium.org per-file clipboard_*ozone*=msisov@igalia.com per-file clipboard_*ozone*=adunaev@igalia.com per-file clipboard_*x11*=thomasanderson@chromium.org
diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index 1941b6c6..967546c 100644 --- a/ui/base/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h
@@ -90,6 +90,8 @@ // the main UI thread, but Windows has tricky semantics where there have to // be two clipboards: one that lives on the UI thread and one that lives on // the IO thread. + // + // The return value should not be cached. static Clipboard* GetForCurrentThread(); // Removes and transfers ownership of the current thread's clipboard to the @@ -117,6 +119,10 @@ // Returns a sequence number which uniquely identifies clipboard state. // This can be used to version the data on the clipboard and determine // whether it has changed. + // TODO(https://crbug.com/1226356): Note that the sequence number uniquely + // identifies the clipboard state within this particular ui::Clipboard + // instance. It is not guaranteed to be unique across multiple / subsequent + // ui::Clipborad instances. Consider changing that. virtual uint64_t GetSequenceNumber(ClipboardBuffer buffer) const = 0; // Tests whether the clipboard contains a certain format.
diff --git a/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.m.js b/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.m.js index 8a0e150..8ca9519 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.m.js +++ b/ui/file_manager/file_manager/background/js/file_operation_manager_unittest.m.js
@@ -997,11 +997,6 @@ assertFalse(events.some(event => { return event.type === 'delete'; })); - - assertTrue(events.some(event => { - return event.type === 'entries-changed' && - event.entries[0].fullPath === '/test.zip'; - })); }), callback);
diff --git a/ui/file_manager/file_manager/background/js/file_operation_util.js b/ui/file_manager/file_manager/background/js/file_operation_util.js index dbd7729..db25512 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_util.js +++ b/ui/file_manager/file_manager/background/js/file_operation_util.js
@@ -1179,64 +1179,58 @@ * @override */ run(entryChangedCallback, progressCallback, successCallback, errorCallback) { - // TODO(fdegros) Per-entry zip progress update with accurate byte count. - // For now just set processedBytes to 0 so that it is not full until - // the zip operation is done. - this.processedBytes = 0; - progressCallback(); + const f = async () => { + try { + // TODO(fdegros) Per-entry zip progress update with accurate byte count. + // For now just set processedBytes to 0 so that it is not full until + // the zip operation is done. + this.processedBytes = 0; + progressCallback(); - this.run_().then( - entry => { - this.processedBytes = this.totalBytes; - entryChangedCallback(util.EntryChangedKind.CREATED, entry); - successCallback(); - }, - error => errorCallback(new FileOperationError( - util.FileOperationErrorType.FILESYSTEM_ERROR, - /** @type DOMError */ (error)))); - } + // TODO(fdegros) Localize the name. + let destName = 'Archive'; - /** - * Runs a zip file creation task. - * - * @return {!Promise<FileEntry>} Promise fulfilled with the created archive - * entry, or rejected with a DOMError. - * @private - */ - async run_() { - // TODO(fdegros) Localize the name. - let destName = 'Archive'; + // If there is only one entry to zip, use this entry's name for the ZIP + // filename. + if (this.sourceEntries.length == 1) { + const entryName = this.sourceEntries[0].name; + const i = entryName.lastIndexOf('.'); + destName = ((i < 0) ? entryName : entryName.substr(0, i)); + } - // If there is only one entry to zip, use this entry's name for the ZIP - // filename. - if (this.sourceEntries.length == 1) { - const entryName = this.sourceEntries[0].name; - const i = entryName.lastIndexOf('.'); - destName = ((i < 0) ? entryName : entryName.substr(0, i)); - } + const destPath = await fileOperationUtil.deduplicatePath( + this.targetDirEntry, destName + '.zip'); - const destPath = await fileOperationUtil.deduplicatePath( - this.targetDirEntry, destName + '.zip'); + this.cancelCallback_ = () => { + console.log('Cancelling ZIP task...'); + chrome.fileManagerPrivate.cancelZip(this.zipBaseDirEntry, destPath); + }; - this.cancelCallback_ = () => { - console.log('Cancelling ZIP task...'); - chrome.fileManagerPrivate.cancelZip(this.zipBaseDirEntry, destPath); + const success = await new Promise( + resolve => chrome.fileManagerPrivate.zipSelection( + assert(this.sourceEntries), this.zipBaseDirEntry, destPath, + resolve)); + + if (!success) { + // Cannot create ZIP archive. + throw util.createDOMError(util.FileError.INVALID_MODIFICATION_ERR); + } + + this.processedBytes = this.totalBytes; + } catch (error) { + // Don't display any error message if the task was cancelled. + if (!this.cancelRequested_) { + errorCallback(new FileOperationError( + util.FileOperationErrorType.FILESYSTEM_ERROR, + /** @type DOMError */ (error))); + return; + } + } + + successCallback(); }; - const success = await new Promise( - resolve => chrome.fileManagerPrivate.zipSelection( - assert(this.sourceEntries), this.zipBaseDirEntry, destPath, - resolve)); - - if (!success) { - // Cannot create ZIP archive. - throw util.createDOMError(util.FileError.INVALID_MODIFICATION_ERR); - } - - // Get the created entry. - return new Promise( - (resolve, reject) => this.zipBaseDirEntry.getFile( - destPath, {create: false}, resolve, reject)); + f(); } };
diff --git a/ui/file_manager/file_manager/foreground/images/files/ui/drive_logo.svg b/ui/file_manager/file_manager/foreground/images/files/ui/drive_logo.svg index 2de6fb8..48011df8 100644 --- a/ui/file_manager/file_manager/foreground/images/files/ui/drive_logo.svg +++ b/ui/file_manager/file_manager/foreground/images/files/ui/drive_logo.svg
@@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><defs><path id="reuse-0" fill="#FFCD40" d="M12.71 0H6.456l6.52 11.25h6.191z"/><path id="a" d="M12.71 0H6.456L0 11.25l3.052 5.417h13.063l3.052-5.417L12.71 0zM6.19 11.25l3.393-5.854 3.393 5.854H6.191z"/></defs><defs><use href="#a"/><use id="d" href="#a"/><use id="f" href="#a"/><use id="h" href="#a"/><use id="l" href="#a"/><path id="j" d="M.031 5.417h13.063L16.146 0H3.17z"/><path id="n" d="M6.456 0L0 11.25l3.052 5.417L9.583 5.396z"/><radialGradient id="p" cx="33.896%" cy="1.011%" r="114.534%" fx="33.896%" fy="1.011%" gradientTransform="matrix(.86957 0 0 1 .044 0)"><stop offset="0%" stop-color="#FFF" stop-opacity=".1"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></radialGradient><linearGradient id="c" x1="25.311%" x2="100.67%" y1="50.149%" y2="85.425%"><stop offset="0%" stop-color="#1A237E" stop-opacity=".2"/><stop offset="100%" stop-color="#1A237E" stop-opacity=".02"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><g transform="translate(.417 1.667)"><mask id="b" fill="#fff"><use href="#a"/></mask><g fill-rule="nonzero" mask="url(#b)"><path fill="#4285F4" d="M3.051 11.25v5.417h13.063l3.052-5.417z"/><path fill="url(#c)" d="M3.17 0l3.139 5.417H.031z" transform="translate(3.02 11.25)"/><path fill="#FFF" fill-opacity=".2" d="M6.129 11.354h12.859l.178-.104H6.19z"/><path fill="#1A237E" fill-opacity=".2" d="M18.988 11.354l-2.935 5.209H3.112l-.061.104h13.063l3.052-5.417z"/><path fill="#1A237E" fill-opacity=".05" d="M6.25 11.354l-.06-.104-3.139 5.417h.12z"/></g></g><g transform="translate(.417 1.667)"><mask id="e" fill="#fff"><use href="#d"/></mask><g fill-rule="nonzero" mask="url(#e)"><path fill="#0F9D58" d="M6.456 0L0 11.25l3.052 5.417 7.364-12.708z"/><path fill="#263238" fill-opacity=".1" d="M6.456 0l.058.307 2.949 5.089-6.41 11.06L.12 11.25H0l3.052 5.417L9.583 5.396z"/><path fill="#FFF" fill-opacity=".2" d="M.12 11.25L6.517.104 6.456 0 0 11.25z"/></g></g><g transform="translate(.417 1.667)"><mask id="g" fill="#fff"><use href="#f"/></mask><g fill-rule="nonzero" mask="url(#g)"><use href="#reuse-0"/><path fill="#FFF" fill-opacity=".2" d="M12.71 0H6.456l.18.104h6.014l6.397 11.146h.12z"/><path fill="#BF360C" fill-opacity=".1" d="M13.035 11.146L6.636.104 6.456 0l6.52 11.25z"/></g></g><g transform="translate(.417 1.667)"><mask id="i" fill="#fff"><use href="#h"/></mask><g mask="url(#i)"><g transform="translate(3.02 11.25)"><mask id="k" fill="#fff"><use href="#j"/></mask><g mask="url(#k)"><path fill="#0F9D58" fill-rule="nonzero" d="M3.436-11.25L-3.021 0 .031 5.417 7.395-7.29z"/></g></g></g></g><g transform="translate(.417 1.667)"><mask id="m" fill="#fff"><use href="#l"/></mask><g mask="url(#m)"><mask id="o" fill="#fff"><use href="#n"/></mask><g mask="url(#o)"><use fill-rule="nonzero" href="#reuse-0"/></g></g></g><path fill="url(#p)" fill-rule="nonzero" d="M13.127 1.667H6.873L.417 12.917l3.052 5.416H16.53l3.052-5.416-6.456-11.25zm-6.52 11.25L10 7.063l3.393 5.854H6.607z"/><path d="M0 0h20v20H0z"/></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 192 192" width="24"><path fill="none" d="M0 0h192v192H0z"/><path d="M128.3 122l7.6 26.2 20 21.4a18 18 0 006.5-6.6l18.5-32a18 18 0 002.4-9l-28.4-5.5-26.6 5.5z" fill="#EA4335"/><path d="M123.5 18.4a18 18 0 00-9-2.4h-37c-3.2 0-6.3.9-9 2.4l8 26.8L95.9 66l.1.1 19.6-20.9 7.9-26.7z" fill="#188038"/><path d="M63.7 122l-28.4-6.5L8.7 122c0 3.1.8 6.2 2.4 9l18.5 32c1.6 2.8 3.9 5 6.6 6.6l19.6-20.2 7.9-27.4z" fill="#1967D2"/><path d="M155.5 69L130 25a18 18 0 00-6.6-6.6L96 66l32.3 56h55a18 18 0 00-2.4-9l-25.4-44z" fill="#FBBC04"/><path d="M128.3 122H63.7l-27.5 47.6a18 18 0 009 2.4h101.6a18 18 0 009-2.4L128.3 122z" fill="#4285F4"/><path d="M96 66L68.5 18.4A18 18 0 0062 25L11 113a18 18 0 00-2.4 9h55L96 66z" fill="#34A853"/></svg> \ No newline at end of file
diff --git a/ui/file_manager/file_manager/foreground/images/volumes/drive.svg b/ui/file_manager/file_manager/foreground/images/volumes/drive.svg index a92d0d8f..f8eae91 100644 --- a/ui/file_manager/file_manager/foreground/images/volumes/drive.svg +++ b/ui/file_manager/file_manager/foreground/images/volumes/drive.svg
@@ -1,3 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"> - <path d="M10 3l2 2h4c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2l.01-10c0-1.1.89-2 1.99-2h6zm6 4H4v8h12V7zm-1 5.1053L13.8935 14H9.6613l1.1064-1.8947H15zM10.1161 8.48s1.1065 1.8979 1.1065 1.8947l-2.1161 3.6221L8 12.1053zM12.6032 8l2.213 3.7895h-2.2097l-2.2097-3.7863V8h2.2064z"/> -</svg> +<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#455A64"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 6l-2-2H4a2 2 0 00-2 2v12c0 1.1.9 2 2 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8zm8 12H4V8h16v10zm-1.73-4.28l-1.96-3.38a.72.72 0 00-.61-.34h-1.4a.7.7 0 00-.61.35l-1.96 3.38a.68.68 0 000 .7l.7 1.22a.7.7 0 00.61.35h3.93a.7.7 0 00.61-.35l.7-1.22a.72.72 0 00-.01-.71zm-4.38.28L15 12l1.11 2h-2.22z"/></svg> \ No newline at end of file
diff --git a/ui/gfx/android/android_surface_control_compat.cc b/ui/gfx/android/android_surface_control_compat.cc index 95ec1237..994b8125 100644 --- a/ui/gfx/android/android_surface_control_compat.cc +++ b/ui/gfx/android/android_surface_control_compat.cc
@@ -72,6 +72,18 @@ const ARect& src, const ARect& dst, int32_t transform); +using pASurfaceTransaction_setPosition = + void (*)(ASurfaceTransaction* transaction, + ASurfaceControl* surface, + int32_t x, + int32_t y); +using pASurfaceTransaction_setScale = void (*)(ASurfaceTransaction* transaction, + ASurfaceControl* surface, + float x_scale, + float y_scale); +using pASurfaceTransaction_setCrop = void (*)(ASurfaceTransaction* transaction, + ASurfaceControl* surface, + const ARect& src); using pASurfaceTransaction_setBufferTransparency = void (*)(ASurfaceTransaction* transaction, ASurfaceControl* surface, @@ -158,6 +170,9 @@ LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setZOrder); LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setBuffer); LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setGeometry); + LOAD_FUNCTION_MAYBE(main_dl_handle, ASurfaceTransaction_setPosition); + LOAD_FUNCTION_MAYBE(main_dl_handle, ASurfaceTransaction_setScale); + LOAD_FUNCTION_MAYBE(main_dl_handle, ASurfaceTransaction_setCrop); LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setBufferTransparency); LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setDamageRegion); LOAD_FUNCTION(main_dl_handle, ASurfaceTransaction_setBufferDataSpace); @@ -191,6 +206,9 @@ pASurfaceTransaction_setZOrder ASurfaceTransaction_setZOrderFn; pASurfaceTransaction_setBuffer ASurfaceTransaction_setBufferFn; pASurfaceTransaction_setGeometry ASurfaceTransaction_setGeometryFn; + pASurfaceTransaction_setPosition ASurfaceTransaction_setPositionFn; + pASurfaceTransaction_setScale ASurfaceTransaction_setScaleFn; + pASurfaceTransaction_setCrop ASurfaceTransaction_setCropFn; pASurfaceTransaction_setBufferTransparency ASurfaceTransaction_setBufferTransparencyFn; pASurfaceTransaction_setDamageRegion ASurfaceTransaction_setDamageRegionFn; @@ -487,6 +505,28 @@ OverlayTransformToWindowTransform(transform)); } +void SurfaceControl::Transaction::SetPosition(const Surface& surface, + const gfx::Point& position) { + CHECK(SurfaceControlMethods::Get().ASurfaceTransaction_setPositionFn); + SurfaceControlMethods::Get().ASurfaceTransaction_setPositionFn( + transaction_, surface.surface(), position.x(), position.y()); +} + +void SurfaceControl::Transaction::SetScale(const Surface& surface, + const float sx, + float sy) { + CHECK(SurfaceControlMethods::Get().ASurfaceTransaction_setScaleFn); + SurfaceControlMethods::Get().ASurfaceTransaction_setScaleFn( + transaction_, surface.surface(), sx, sy); +} + +void SurfaceControl::Transaction::SetCrop(const Surface& surface, + const gfx::Rect& rect) { + CHECK(SurfaceControlMethods::Get().ASurfaceTransaction_setCropFn); + SurfaceControlMethods::Get().ASurfaceTransaction_setCropFn( + transaction_, surface.surface(), RectToARect(rect)); +} + void SurfaceControl::Transaction::SetOpaque(const Surface& surface, bool opaque) { int8_t transparency = opaque ? ASURFACE_TRANSACTION_TRANSPARENCY_OPAQUE
diff --git a/ui/gfx/android/android_surface_control_compat.h b/ui/gfx/android/android_surface_control_compat.h index 8545a9a..cd12d68 100644 --- a/ui/gfx/android/android_surface_control_compat.h +++ b/ui/gfx/android/android_surface_control_compat.h
@@ -133,6 +133,9 @@ const gfx::ColorSpace& color_space); void SetFrameRate(const Surface& surface, float frame_rate); void SetParent(const Surface& surface, Surface* new_parent); + void SetPosition(const Surface& surface, const gfx::Point& position); + void SetScale(const Surface& surface, float sx, float sy); + void SetCrop(const Surface& surface, const gfx::Rect& rect); // Sets the callback which will be dispatched when the transaction is acked // by the framework.
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index d64f4c1..879bd28 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -250,6 +250,15 @@ if (use_ozone) { deps += [ "//ui/ozone:buildflags" ] + if (use_egl && !is_fuchsia) { + data_deps += [ + "//third_party/angle:libEGL", + "//third_party/angle:libGLESv2", + ] + if (angle_shared_libvulkan && !is_chromeos) { + data_deps += [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ] + } + } } if (use_x11 || ozone_platform_x11) {
diff --git a/ui/gl/init/gl_factory.cc b/ui/gl/init/gl_factory.cc index 6a34741..879577f 100644 --- a/ui/gl/init/gl_factory.cc +++ b/ui/gl/init/gl_factory.cc
@@ -142,7 +142,7 @@ #if defined(OS_WIN) || defined(OS_LINUX) #if defined(USE_OZONE) if (!features::IsUsingOzonePlatform() || - ui::OzonePlatform::GetPlatformNameForTest() == "x11") + (ui::OzonePlatform::GetPlatformNameForTest() != "wayland")) #endif { return GetSoftwareGLImplementation();
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc index ecc64596..464b2d2 100644 --- a/ui/native_theme/native_theme_base.cc +++ b/ui/native_theme/native_theme_base.cc
@@ -578,10 +578,12 @@ // gets drawn adjacent to |accent_color|. In order to guarantee contrast // between |checkmark_color| and |accent_color|, we choose the |color_scheme| // here based on the two possible values for |checkmark_color|. - color_scheme = ColorSchemeForAccentColor( - accent_color, color_scheme, - ControlsBackgroundColorForState(state, ColorScheme::kLight), - ControlsBackgroundColorForState(state, ColorScheme::kDark)); + if (button.checked && state != kDisabled) { + color_scheme = ColorSchemeForAccentColor( + accent_color, color_scheme, + ControlsBackgroundColorForState(state, ColorScheme::kLight), + ControlsBackgroundColorForState(state, ColorScheme::kDark)); + } const float border_radius = GetBorderRadiusForPart(kCheckbox, rect.width(), rect.height()); @@ -719,10 +721,12 @@ // which gets draw adjacent to |accent_color|. In order to guarantee contrast // between the background and |accent_color|, we choose the |color_scheme| // here based on the two possible values for ControlsBackgroundColorForState. - color_scheme = ColorSchemeForAccentColor( - accent_color, color_scheme, - ControlsBackgroundColorForState(state, ColorScheme::kLight), - ControlsBackgroundColorForState(state, ColorScheme::kDark)); + if (button.checked && state != kDisabled) { + color_scheme = ColorSchemeForAccentColor( + accent_color, color_scheme, + ControlsBackgroundColorForState(state, ColorScheme::kLight), + ControlsBackgroundColorForState(state, ColorScheme::kDark)); + } // Most of a radio button is the same as a checkbox, except the the rounded // square is a circle (i.e. border radius >= 100%). @@ -919,10 +923,12 @@ // We use kNormal here because the user hovering or clicking on the slider // will change the state to something else, and we don't want the color-scheme // to flicker back and forth when the user interacts with it. - color_scheme = ColorSchemeForAccentColor( - accent_color, color_scheme, - ControlsFillColorForState(kNormal, ColorScheme::kLight), - ControlsFillColorForState(kNormal, ColorScheme::kDark)); + if (state != kDisabled) { + color_scheme = ColorSchemeForAccentColor( + accent_color, color_scheme, + ControlsFillColorForState(kNormal, ColorScheme::kLight), + ControlsFillColorForState(kNormal, ColorScheme::kDark)); + } // Paint the entire slider track. cc::PaintFlags flags; @@ -983,10 +989,12 @@ // We use kNormal here because the user hovering or clicking on the slider // will change the state to something else, and we don't want the color-scheme // to flicker back and forth when the user interacts with it. - color_scheme = ColorSchemeForAccentColor( - accent_color, color_scheme, - ControlsFillColorForState(kNormal, ColorScheme::kLight), - ControlsFillColorForState(kNormal, ColorScheme::kDark)); + if (state != kDisabled) { + color_scheme = ColorSchemeForAccentColor( + accent_color, color_scheme, + ControlsFillColorForState(kNormal, ColorScheme::kLight), + ControlsFillColorForState(kNormal, ColorScheme::kDark)); + } const float radius = GetBorderRadiusForPart(kSliderThumb, rect.width(), rect.height());
diff --git a/ui/ozone/platform/headless/headless_surface_factory.cc b/ui/ozone/platform/headless/headless_surface_factory.cc index 981e76a..d7d12f39 100644 --- a/ui/ozone/platform/headless/headless_surface_factory.cc +++ b/ui/ozone/platform/headless/headless_surface_factory.cc
@@ -226,7 +226,8 @@ std::vector<gl::GLImplementation> HeadlessSurfaceFactory::GetAllowedGLImplementations() { - return std::vector<gl::GLImplementation>{gl::kGLImplementationSwiftShaderGL}; + return std::vector<gl::GLImplementation>{gl::kGLImplementationSwiftShaderGL, + gl::kGLImplementationEGLANGLE}; } GLOzone* HeadlessSurfaceFactory::GetGLOzone( @@ -236,6 +237,11 @@ case gl::kGLImplementationSwiftShaderGL: return swiftshader_implementation_.get(); + case gl::kGLImplementationEGLANGLE: + return (implementation.angle == gl::ANGLEImplementation::kSwiftShader) + ? swiftshader_implementation_.get() + : nullptr; + default: return nullptr; }
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc index 2ba73b0..b146cec 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc
@@ -365,6 +365,20 @@ DispatchEvent(&event); } +void WaylandEventSource::SetRelativePointerMotionEnabled(bool enabled) { + if (enabled) + relative_pointer_location_ = pointer_location_; + else + relative_pointer_location_.reset(); +} + +void WaylandEventSource::OnRelativePointerMotion(const gfx::Vector2dF& delta) { + DCHECK(relative_pointer_location_.has_value()); + + relative_pointer_location_ = *relative_pointer_location_ + delta; + OnPointerMotionEvent(*relative_pointer_location_); +} + bool WaylandEventSource::IsPointerButtonPressed(EventFlags button) const { DCHECK(HasAnyPointerButtonFlag(button)); return pointer_flags_ & button;
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.h b/ui/ozone/platform/wayland/host/wayland_event_source.h index 2a44970..503904f8 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source.h +++ b/ui/ozone/platform/wayland/host/wayland_event_source.h
@@ -24,6 +24,7 @@ #include "ui/ozone/platform/wayland/host/wayland_touch.h" #include "ui/ozone/platform/wayland/host/wayland_window_observer.h" #include "ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.h" +#include "ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h" struct wl_display; @@ -48,7 +49,8 @@ public WaylandKeyboard::Delegate, public WaylandPointer::Delegate, public WaylandTouch::Delegate, - public WaylandZwpPointerGestures::Delegate { + public WaylandZwpPointerGestures::Delegate, + public WaylandZwpRelativePointerManager::Delegate { public: WaylandEventSource(wl_display* display, wl_event_queue* event_queue, @@ -128,6 +130,10 @@ int device_id, absl::optional<float> scale) override; + // WaylandZwpRelativePointerManager::Delegate: + void SetRelativePointerMotionEnabled(bool enabled) override; + void OnRelativePointerMotion(const gfx::Vector2dF& delta) override; + private: struct PointerFrame { PointerFrame(); @@ -178,6 +184,9 @@ // Last known pointer location. gfx::PointF pointer_location_; + // Last known relative pointer location (used for pointer lock). + absl::optional<gfx::PointF> relative_pointer_location_; + // Current frame PointerFrame current_pointer_frame_;
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index 9d0fe9a..a5bbe50 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -22,6 +22,7 @@ #include "ui/ozone/platform/wayland/host/wayland_window.h" #include "ui/ozone/platform/wayland/host/wayland_window_drag_controller.h" #include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h" +#include "ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.h" #include "ui/platform_window/extensions/wayland_extension.h" #if BUILDFLAG(IS_CHROMEOS_LACROS) @@ -554,6 +555,18 @@ } } +bool WaylandToplevelWindow::SupportsPointerLock() { + return !!connection()->wayland_zwp_pointer_constraints() && + !!connection()->wayland_zwp_relative_pointer_manager(); +} +void WaylandToplevelWindow::LockPointer(bool enabled) { + auto* pointer_constraints = connection()->wayland_zwp_pointer_constraints(); + if (enabled) + pointer_constraints->LockPointer(root_surface()); + else + pointer_constraints->UnlockPointer(); +} + void WaylandToplevelWindow::TriggerStateChanges() { if (!shell_toplevel_) return;
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h index 0e7e7e7..7d5c0f8 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
@@ -102,6 +102,8 @@ void CommitSnap(WaylandWindowSnapDirection snap) override; void SetCanGoBack(bool value) override; void SetPip() override; + bool SupportsPointerLock() override; + void LockPointer(bool enabled) override; void TriggerStateChanges(); void SetWindowState(PlatformWindowState state);
diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc index 2a9ac73..1f0a67a 100644 --- a/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc +++ b/ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.cc
@@ -9,6 +9,7 @@ #include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_pointer.h" #include "ui/ozone/platform/wayland/host/wayland_surface.h" +#include "ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h" namespace ui { @@ -36,22 +37,25 @@ } void WaylandZwpPointerConstraints::UnlockPointer() { - NOTIMPLEMENTED(); locked_pointer_.reset(); + connection_->wayland_zwp_relative_pointer_manager()->DisableRelativePointer(); } // static void WaylandZwpPointerConstraints::OnLock( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) { - NOTIMPLEMENTED(); + auto* pointer_constraints = static_cast<WaylandZwpPointerConstraints*>(data); + pointer_constraints->connection_->wayland_zwp_relative_pointer_manager() + ->EnableRelativePointer(); } // static void WaylandZwpPointerConstraints::OnUnlock( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) { - NOTIMPLEMENTED(); + auto* pointer_constraints = static_cast<WaylandZwpPointerConstraints*>(data); + pointer_constraints->UnlockPointer(); } } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc index ed6ca373..2a6c077 100644 --- a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc +++ b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.cc
@@ -7,6 +7,7 @@ #include <relative-pointer-unstable-v1-client-protocol.h> #include "ui/ozone/platform/wayland/host/wayland_connection.h" +#include "ui/ozone/platform/wayland/host/wayland_event_source.h" #include "ui/ozone/platform/wayland/host/wayland_pointer.h" namespace ui { @@ -14,9 +15,12 @@ WaylandZwpRelativePointerManager::WaylandZwpRelativePointerManager( zwp_relative_pointer_manager_v1* relative_pointer_manager, WaylandConnection* connection) - : obj_(relative_pointer_manager), connection_(connection) { + : obj_(relative_pointer_manager), + connection_(connection), + delegate_(connection_->event_source()) { DCHECK(obj_); DCHECK(connection_); + DCHECK(delegate_); } WaylandZwpRelativePointerManager::~WaylandZwpRelativePointerManager() = default; @@ -31,10 +35,12 @@ }; zwp_relative_pointer_v1_add_listener(relative_pointer_.get(), &relative_pointer_listener, this); + delegate_->SetRelativePointerMotionEnabled(true); } void WaylandZwpRelativePointerManager::DisableRelativePointer() { relative_pointer_.reset(); + delegate_->SetRelativePointerMotionEnabled(false); } // static @@ -47,7 +53,16 @@ wl_fixed_t dy, wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel) { - NOTIMPLEMENTED(); + auto* relative_pointer_manager = + static_cast<WaylandZwpRelativePointerManager*>(data); + + gfx::Vector2dF delta = {static_cast<float>(wl_fixed_to_double(dx)), + static_cast<float>(wl_fixed_to_double(dy))}; + gfx::Vector2dF delta_unaccel = { + static_cast<float>(wl_fixed_to_double(dx_unaccel)), + static_cast<float>(wl_fixed_to_double(dy_unaccel))}; + + relative_pointer_manager->delegate_->OnRelativePointerMotion(delta); } } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h index 878a350..473f1379 100644 --- a/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h +++ b/ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h
@@ -7,6 +7,10 @@ #include "ui/ozone/platform/wayland/common/wayland_object.h" +namespace gfx { +class Vector2dF; +} // namespace gfx + namespace ui { class WaylandConnection; @@ -14,6 +18,8 @@ // Wraps the zwp_relative_pointer_manager_v1 object. class WaylandZwpRelativePointerManager { public: + class Delegate; + WaylandZwpRelativePointerManager( zwp_relative_pointer_manager_v1* relative_pointer_manager, WaylandConnection* connection); @@ -41,6 +47,13 @@ wl::Object<zwp_relative_pointer_manager_v1> obj_; wl::Object<zwp_relative_pointer_v1> relative_pointer_; WaylandConnection* const connection_; + Delegate* const delegate_; +}; + +class WaylandZwpRelativePointerManager::Delegate { + public: + virtual void SetRelativePointerMotionEnabled(bool enabled) = 0; + virtual void OnRelativePointerMotion(const gfx::Vector2dF& delta) = 0; }; } // namespace ui
diff --git a/ui/ozone/platform/windows/windows_surface_factory.cc b/ui/ozone/platform/windows/windows_surface_factory.cc index 0f5ca60..84cc5da8 100644 --- a/ui/ozone/platform/windows/windows_surface_factory.cc +++ b/ui/ozone/platform/windows/windows_surface_factory.cc
@@ -69,7 +69,8 @@ std::vector<gl::GLImplementation> WindowsSurfaceFactory::GetAllowedGLImplementations() { return std::vector<gl::GLImplementation>{gl::kGLImplementationEGLGLES2, - gl::kGLImplementationSwiftShaderGL}; + gl::kGLImplementationSwiftShaderGL, + gl::kGLImplementationEGLANGLE}; } GLOzone* WindowsSurfaceFactory::GetGLOzone( @@ -77,6 +78,7 @@ switch (implementation.gl) { case gl::kGLImplementationSwiftShaderGL: case gl::kGLImplementationEGLGLES2: + case gl::kGLImplementationEGLANGLE: return egl_implementation_.get(); default: return nullptr;
diff --git a/ui/platform_window/extensions/wayland_extension.h b/ui/platform_window/extensions/wayland_extension.h index d095ece..d810ae31 100644 --- a/ui/platform_window/extensions/wayland_extension.h +++ b/ui/platform_window/extensions/wayland_extension.h
@@ -48,6 +48,10 @@ // (PIP). virtual void SetPip() = 0; + // Whether or not the underlying platform supports native pointer locking. + virtual bool SupportsPointerLock() = 0; + virtual void LockPointer(bool enabled) = 0; + protected: virtual ~WaylandExtension();
diff --git a/weblayer/browser/ads_page_load_metrics_observer_browsertest.cc b/weblayer/browser/ads_page_load_metrics_observer_browsertest.cc index 82215fec..18d7fb3 100644 --- a/weblayer/browser/ads_page_load_metrics_observer_browsertest.cc +++ b/weblayer/browser/ads_page_load_metrics_observer_browsertest.cc
@@ -89,8 +89,9 @@ } // Test that an empty embedded ad isn't reported at all. +// TODO(crbug.com/1226500): This test is flaky. IN_PROC_BROWSER_TEST_F(AdsPageLoadMetricsObserverBrowserTest, - OriginStatusMetricEmbeddedEmpty) { + DISABLED_OriginStatusMetricEmbeddedEmpty) { base::HistogramTester histogram_tester; NavigateAndWaitForCompletion( embedded_test_server()->GetURL(
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/PageInfoControllerDelegateImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/PageInfoControllerDelegateImpl.java index 5eb95aa..3eb342b 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/PageInfoControllerDelegateImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/PageInfoControllerDelegateImpl.java
@@ -104,7 +104,7 @@ @Override @Nullable public PageInfoSubpageController createHistoryController( - PageInfoMainController mainController, PageInfoRowView rowView, String url) { + PageInfoMainController mainController, PageInfoRowView rowView, String host) { return null; } @@ -158,4 +158,12 @@ public FragmentManager getFragmentManager() { return mBrowser.getFragmentManager(); } + + /** + * {@inheritDoc} + */ + @Override + public boolean isIncognito() { + return mProfile.isIncognito(); + } }
diff --git a/weblayer/browser/translate_client_impl.cc b/weblayer/browser/translate_client_impl.cc index 178e64a6..599753c6 100644 --- a/weblayer/browser/translate_client_impl.cc +++ b/weblayer/browser/translate_client_impl.cc
@@ -52,7 +52,8 @@ TranslateClientImpl::TranslateClientImpl(content::WebContents* web_contents) : content::WebContentsObserver(web_contents), - translate_driver_(&web_contents->GetController(), + translate_driver_(*web_contents, + &web_contents->GetController(), /*url_language_histogram=*/nullptr, /*translate_model_service=*/nullptr), translate_manager_(new translate::TranslateManager(