diff --git a/DEPS b/DEPS index ac340a7..1517e62 100644 --- a/DEPS +++ b/DEPS
@@ -105,11 +105,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': '5ea41fc89b264f2cab7058bf48429f87761f65e9', + 'skia_revision': '227d4e10276c0b9524dd985bf51a2708a930e050', # 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': 'd4c562dc691178f3bf0b278beff8696feadea48c', + 'v8_revision': '4034a5cfc80ef30c05c31ac733b880d9ec1241fa', # 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. @@ -117,7 +117,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '115e8a2625f5d81bb4e6fa4b687c0c5e5b56ca73', + 'angle_revision': '122919bddd98eef1d7bb522bda9429d6dcf1c99e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -165,7 +165,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '3cf15a9b47a0f81ff31921349a845275dc92f5b4', + 'catapult_revision': '4e651334d46bfffe71894f956ad284f479170940', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -313,7 +313,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + 'a9d14ef965d6e5e4852998b17a283e560990206e', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '50455404c6a72aa0540406325e787f0e2cf9b8d0', 'condition': 'checkout_ios', }, @@ -363,7 +363,7 @@ }, 'src/media/cdm/api': - Var('chromium_git') + '/chromium/cdm.git' + '@' + '1007f88b61d3dce70269923e30a536cc7c466a17', + Var('chromium_git') + '/chromium/cdm.git' + '@' + 'bf6d8e058121d690798366de678014e7d6f82b71', 'src/native_client': { 'url': Var('chromium_git') + '/native_client/src/native_client.git' + '@' + Var('nacl_revision'), @@ -620,7 +620,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'f221bac5302a86731c3a9b81a795587a7a429a48', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'd9fdc1f5b5ded0b2b8189a08b3f45dcdbc5951dd', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -954,7 +954,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '59d6ace5cb9969923533796844612d65b6db2cce', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '0d9930ffe55659b4d5b57c628446a466ed639d78', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', @@ -1106,7 +1106,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '6d2f3f4cb8bac1f7c4a945c73d07a33df74f22f9', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'd50fdd75341647b6d662a76a3af60e21ac742e03', + Var('webrtc_git') + '/src.git' + '@' + 'e9a7e90625fea3ad7d12d3a2aafb5b529db0940b', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1137,7 +1137,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3a31ac84a0bbd96d538d662219127741d4728053', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@5d8c6f4f9d8f09437987c5c277b6619028bc0e67', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index 30073bc6..cc9a1aee 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS
@@ -67,8 +67,6 @@ # QuotaStatusCode required by AwQuotaManagerBridge. "+third_party/blink/public/mojom/quota", - # POD structure required by the find-in-page IPC messages. - "+third_party/blink/public/web/web_find_options.h", # Interface required for in-process input event handling. "+third_party/blink/public/web/WebCompositorInputHandler.h", # For find-in-page
diff --git a/ash/pointer_watcher_adapter.cc b/ash/pointer_watcher_adapter.cc index 96bbea0..2cdedaef 100644 --- a/ash/pointer_watcher_adapter.cc +++ b/ash/pointer_watcher_adapter.cc
@@ -5,7 +5,6 @@ #include "ash/pointer_watcher_adapter.h" #include "ash/shell.h" -#include "ui/aura/client/screen_position_client.h" #include "ui/aura/window.h" #include "ui/display/screen.h" #include "ui/events/event.h" @@ -72,16 +71,9 @@ gfx::Point PointerWatcherAdapter::GetLocationInScreen( const ui::LocatedEvent& event) const { - gfx::Point location_in_screen; - if (event.type() == ui::ET_MOUSE_CAPTURE_CHANGED) { - location_in_screen = display::Screen::GetScreen()->GetCursorScreenPoint(); - } else { - aura::Window* target = static_cast<aura::Window*>(event.target()); - location_in_screen = event.location(); - aura::client::GetScreenPositionClient(target->GetRootWindow()) - ->ConvertPointToScreen(target, &location_in_screen); - } - return location_in_screen; + if (event.type() == ui::ET_MOUSE_CAPTURE_CHANGED) + return display::Screen::GetScreen()->GetCursorScreenPoint(); + return event.target()->GetScreenLocation(event); } void PointerWatcherAdapter::NotifyWatchers(
diff --git a/ash/public/cpp/immersive/immersive_fullscreen_controller.cc b/ash/public/cpp/immersive/immersive_fullscreen_controller.cc index 782cd11..e607840 100644 --- a/ash/public/cpp/immersive/immersive_fullscreen_controller.cc +++ b/ash/public/cpp/immersive/immersive_fullscreen_controller.cc
@@ -178,9 +178,7 @@ UpdateLocatedEventRevealedLock(&event, location_in_screen); } -void ImmersiveFullscreenController::OnGestureEvent( - ui::GestureEvent* event, - const gfx::Point& location_in_screen) { +void ImmersiveFullscreenController::OnGestureEvent(ui::GestureEvent* event) { if (!enabled_) return; @@ -191,7 +189,8 @@ switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: - if (ShouldHandleGestureEvent(location_in_screen)) { + if (ShouldHandleGestureEvent( + event->target()->GetScreenLocation(*event))) { gesture_begun_ = true; // Do not consume the event. Otherwise, we end up consuming all // ui::ET_GESTURE_SCROLL_BEGIN events in the top-of-window views
diff --git a/ash/public/cpp/immersive/immersive_fullscreen_controller.h b/ash/public/cpp/immersive/immersive_fullscreen_controller.h index f84fda05..f692fe3 100644 --- a/ash/public/cpp/immersive/immersive_fullscreen_controller.h +++ b/ash/public/cpp/immersive/immersive_fullscreen_controller.h
@@ -115,8 +115,7 @@ void OnTouchEvent(const ui::TouchEvent& event, const gfx::Point& location_in_screen); // Processes a GestureEvent. This may call SetHandled() on the supplied event. - void OnGestureEvent(ui::GestureEvent* event, - const gfx::Point& location_in_screen); + void OnGestureEvent(ui::GestureEvent* event); // views::PointerWatcher: void OnPointerEventObserved(const ui::PointerEvent& event,
diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc index 28add62..efd15286 100644 --- a/ash/shelf/overflow_bubble.cc +++ b/ash/shelf/overflow_bubble.cc
@@ -11,7 +11,6 @@ #include "ash/shelf/shelf_view.h" #include "ash/shell.h" #include "ash/system/tray/tray_background_view.h" -#include "ui/aura/client/screen_position_client.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/rect.h" #include "ui/views/widget/widget.h" @@ -61,14 +60,9 @@ if (!IsShowing() || bubble_->shelf_view()->IsShowingMenu()) return; - aura::Window* target = static_cast<aura::Window*>(event->target()); - gfx::Point event_location_in_screen = event->location(); - aura::client::GetScreenPositionClient(target->GetRootWindow()) - ->ConvertPointToScreen(target, &event_location_in_screen); - - if (bubble_->GetBoundsInScreen().Contains(event_location_in_screen) || - overflow_button_->GetBoundsInScreen().Contains( - event_location_in_screen)) { + const gfx::Point screen_location = event->target()->GetScreenLocation(*event); + if (bubble_->GetBoundsInScreen().Contains(screen_location) || + overflow_button_->GetBoundsInScreen().Contains(screen_location)) { return; } @@ -78,7 +72,7 @@ if (bubble_->shelf_view() ->main_shelf() ->GetVisibleItemsBoundsInScreen() - .Contains(event_location_in_screen)) { + .Contains(screen_location)) { return; }
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc index ab65fc36..19adaee 100644 --- a/ash/shelf/shelf.cc +++ b/ash/shelf/shelf.cc
@@ -209,7 +209,7 @@ : 0; } -gfx::Rect Shelf::GetIdealBounds() { +gfx::Rect Shelf::GetIdealBounds() const { return shelf_layout_manager_->GetIdealBounds(); } @@ -298,6 +298,21 @@ return GetStatusAreaWidget()->GetSystemTrayAnchor(); } +gfx::Rect Shelf::GetSystemTrayAnchorRect() const { + gfx::Rect shelf_bounds = GetIdealBounds(); + switch (alignment_) { + case SHELF_ALIGNMENT_BOTTOM: + case SHELF_ALIGNMENT_BOTTOM_LOCKED: + return gfx::Rect(shelf_bounds.right(), shelf_bounds.y(), 0, 0); + case SHELF_ALIGNMENT_LEFT: + return gfx::Rect(shelf_bounds.right(), shelf_bounds.bottom(), 0, 0); + case SHELF_ALIGNMENT_RIGHT: + return gfx::Rect(shelf_bounds.x(), shelf_bounds.bottom(), 0, 0); + } + NOTREACHED(); + return gfx::Rect(); +} + bool Shelf::ShouldHideOnSecondaryDisplay(session_manager::SessionState state) { if (Shell::GetPrimaryRootWindowController()->shelf() == this) return false;
diff --git a/ash/shelf/shelf.h b/ash/shelf/shelf.h index 9a6418d..1bd44f4 100644 --- a/ash/shelf/shelf.h +++ b/ash/shelf/shelf.h
@@ -102,7 +102,7 @@ int GetDockedMagnifierHeight() const; // Returns the ideal bounds of the shelf assuming it is visible. - gfx::Rect GetIdealBounds(); + gfx::Rect GetIdealBounds() const; gfx::Rect GetUserWorkAreaBounds() const; @@ -140,6 +140,12 @@ // bubble will be anchored. See also: StatusAreaWidget::GetSystemTrayAnchor() TrayBackgroundView* GetSystemTrayAnchor() const; + // Get the anchor rect that the system tray bubble and the notification center + // bubble will be anchored. + // x() and y() designates anchor point, but width() and height() are dummy. + // See also: BubbleDialogDelegateView::GetBubbleBounds() + gfx::Rect GetSystemTrayAnchorRect() const; + void set_is_tablet_mode_animation_running(bool value) { is_tablet_mode_animation_running_ = value; }
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index a79f4ef0..ed3a746 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc
@@ -210,7 +210,7 @@ state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)); } -gfx::Rect ShelfLayoutManager::GetIdealBounds() { +gfx::Rect ShelfLayoutManager::GetIdealBounds() const { const int shelf_size = ShelfConstants::shelf_size(); aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); gfx::Rect rect(screen_util::GetDisplayBoundsInParent(shelf_window));
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index 10b7de5..7bf88b9f 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h
@@ -80,7 +80,7 @@ bool IsVisible() const; // Returns the ideal bounds of the shelf assuming it is visible. - gfx::Rect GetIdealBounds(); + gfx::Rect GetIdealBounds() const; // Returns the preferred size of the shelf for the target visibility state. gfx::Size GetPreferredSize();
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc index 2f81846f..1c0500a7 100644 --- a/ash/system/date/date_view.cc +++ b/ash/system/date/date_view.cc
@@ -188,6 +188,7 @@ BaseDateTimeView::UpdateTextInternal(now); date_label_->SetText(l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now))); + date_label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); } void DateView::OnSystemClockCanSetTimeChanged(bool can_set_time) { @@ -237,6 +238,8 @@ now, model_->hour_clock_type(), base::kDropAmPm); horizontal_label_->SetText(current_time); horizontal_label_->SetTooltipText(base::TimeFormatFriendlyDate(now)); + horizontal_label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, + true); // Calculate vertical clock layout labels. size_t colon_pos = current_time.find(base::ASCIIToUTF16(":")); @@ -250,6 +253,10 @@ vertical_label_hours_->SetText(hour); vertical_label_minutes_->SetText(minute); + vertical_label_hours_->NotifyAccessibilityEvent( + ax::mojom::Event::kTextChanged, true); + vertical_label_minutes_->NotifyAccessibilityEvent( + ax::mojom::Event::kTextChanged, true); Layout(); }
diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 162dfc02d..275207ee 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc
@@ -231,6 +231,11 @@ auto layout = std::make_unique<BottomAlignedBoxLayout>(this); layout->SetDefaultFlex(1); layout_ = SetLayoutManager(std::move(layout)); + + if (init_params.anchor_mode == AnchorMode::kRect) { + SetAnchorView(nullptr); + SetAnchorRect(init_params.anchor_rect); + } } TrayBubbleView::~TrayBubbleView() { @@ -306,9 +311,20 @@ } void TrayBubbleView::ChangeAnchorView(views::View* anchor_view) { + DCHECK(params_.anchor_mode == AnchorMode::kView); BubbleDialogDelegateView::SetAnchorView(anchor_view); } +void TrayBubbleView::ChangeAnchorRect(const gfx::Rect& rect) { + DCHECK(params_.anchor_mode == AnchorMode::kRect); + BubbleDialogDelegateView::SetAnchorRect(rect); +} + +void TrayBubbleView::ChangeAnchorAlignment( + TrayBubbleView::AnchorAlignment alignment) { + SetArrow(GetArrowAlignment(alignment)); +} + int TrayBubbleView::GetDialogButtons() const { return ui::DIALOG_BUTTON_NONE; }
diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h index 22954c9..f3c78eabf 100644 --- a/ash/system/tray/tray_bubble_view.h +++ b/ash/system/tray/tray_bubble_view.h
@@ -12,6 +12,7 @@ #include "base/optional.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/events/event.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/mouse_watcher.h" @@ -85,12 +86,23 @@ DISALLOW_COPY_AND_ASSIGN(Delegate); }; + // Anchor mode being set at creation. + enum class AnchorMode { + // Anchor to |anchor_view|. This is the default. + kView, + // Anchor to |anchor_rect|. Used for anchoring to the shelf. + kRect + }; + struct ASH_EXPORT InitParams { InitParams(); InitParams(const InitParams& other); Delegate* delegate = nullptr; gfx::NativeWindow parent_window = nullptr; View* anchor_view = nullptr; + AnchorMode anchor_mode = AnchorMode::kView; + // Only used if anchor_mode == AnchorMode::kRect. + gfx::Rect anchor_rect; AnchorAlignment anchor_alignment = ANCHOR_ALIGNMENT_BOTTOM; int min_width = 0; int max_width = 0; @@ -135,8 +147,16 @@ void ResetDelegate(); // Anchors the bubble to |anchor_view|. + // Only eligible if anchor_mode == AnchorMode::kView. void ChangeAnchorView(views::View* anchor_view); + // Anchors the bubble to |anchor_rect|. Exclusive with ChangeAnchorView(). + // Only eligible if anchor_mode == AnchorMode::kRect. + void ChangeAnchorRect(const gfx::Rect& anchor_rect); + + // Change anchor alignment mode when anchoring either the rect or view. + void ChangeAnchorAlignment(AnchorAlignment alignment); + Delegate* delegate() { return delegate_; } void set_gesture_dragging(bool dragging) { is_gesture_dragging_ = dragging; }
diff --git a/ash/system/unified/unified_slider_bubble_controller.cc b/ash/system/unified/unified_slider_bubble_controller.cc index 725d944..a47be4e 100644 --- a/ash/system/unified/unified_slider_bubble_controller.cc +++ b/ash/system/unified/unified_slider_bubble_controller.cc
@@ -6,6 +6,7 @@ #include "ash/public/cpp/app_list/app_list_features.h" #include "ash/root_window_controller.h" +#include "ash/session/session_controller.h" #include "ash/shell.h" #include "ash/system/brightness/unified_brightness_slider_controller.h" #include "ash/system/keyboard_brightness/unified_keyboard_brightness_slider_controller.h" @@ -113,6 +114,10 @@ } void UnifiedSliderBubbleController::ShowBubble(SliderType slider_type) { + // Never show slider bubble in kiosk app mode. + if (Shell::Get()->session_controller()->IsRunningInAppMode()) + return; + if (IsAnyMainBubbleShown()) { tray_->EnsureBubbleExpanded(); return;
diff --git a/ash/system/unified/unified_system_info_view.cc b/ash/system/unified/unified_system_info_view.cc index d829767..bc993e3b 100644 --- a/ash/system/unified/unified_system_info_view.cc +++ b/ash/system/unified/unified_system_info_view.cc
@@ -112,6 +112,7 @@ label_->SetText(l10n_util::GetStringFUTF16( IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now))); SetAccessibleName(TimeFormatFriendlyDateAndTime(now)); + label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); } @@ -219,6 +220,9 @@ percentage_->SetVisible(!percentage_text.empty()); separator_->SetVisible(!percentage_text.empty() && !status_text.empty()); status_->SetVisible(!status_text.empty()); + + percentage_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); + status_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); } void BatteryView::ConfigureLabel(views::Label* label) {
diff --git a/ash/system/unified/unified_system_tray.cc b/ash/system/unified/unified_system_tray.cc index 29f44ba..a4e4d1d 100644 --- a/ash/system/unified/unified_system_tray.cc +++ b/ash/system/unified/unified_system_tray.cc
@@ -311,6 +311,10 @@ } void UnifiedSystemTray::ShowBubbleInternal(bool show_by_click) { + // Never show System Tray bubble in kiosk app mode. + if (Shell::Get()->session_controller()->IsRunningInAppMode()) + return; + // Hide volume/brightness slider popup. slider_bubble_controller_->CloseBubble();
diff --git a/ash/system/unified/unified_system_tray_bubble.cc b/ash/system/unified/unified_system_tray_bubble.cc index cec63ae..31554699 100644 --- a/ash/system/unified/unified_system_tray_bubble.cc +++ b/ash/system/unified/unified_system_tray_bubble.cc
@@ -76,6 +76,8 @@ init_params.parent_window = tray->GetBubbleWindowContainer(); init_params.anchor_view = tray->shelf()->GetSystemTrayAnchor()->GetBubbleAnchor(); + init_params.anchor_mode = TrayBubbleView::AnchorMode::kRect; + init_params.anchor_rect = tray->shelf()->GetSystemTrayAnchorRect(); init_params.corner_radius = kUnifiedTrayCornerRadius; init_params.has_shadow = false; init_params.show_by_click = show_by_click; @@ -294,22 +296,8 @@ int max_height = CalculateMaxHeight(); unified_view_->SetMaxHeight(max_height); bubble_view_->SetMaxHeight(max_height); - // If the bubble is open while switching to and from tablet mode, change the - // bubble anchor if needed. The new anchor view may also have a translation - // applied to it so shift the bubble bounds so that it appears in the correct - // location. - bubble_view_->ChangeAnchorView( - tray_->shelf()->GetSystemTrayAnchor()->GetBubbleAnchor()); - gfx::Rect bounds = - bubble_view_->GetWidget()->GetNativeWindow()->GetBoundsInScreen(); - const gfx::Vector2dF translation = tray_->shelf() - ->GetSystemTrayAnchor() - ->layer() - ->transform() - .To2dTranslation(); - bounds.set_x(bounds.x() - translation.x()); - bounds.set_y(bounds.y() - translation.y()); - bubble_view_->GetWidget()->GetNativeWindow()->SetBounds(bounds); + bubble_view_->ChangeAnchorAlignment(tray_->GetAnchorAlignment()); + bubble_view_->ChangeAnchorRect(tray_->shelf()->GetSystemTrayAnchorRect()); } void UnifiedSystemTrayBubble::CreateBlurLayerForAnimation() {
diff --git a/ash/utility/screenshot_controller.cc b/ash/utility/screenshot_controller.cc index b57dd109..1db0f4d 100644 --- a/ash/utility/screenshot_controller.cc +++ b/ash/utility/screenshot_controller.cc
@@ -39,20 +39,13 @@ // Returns the target for the specified event ignorning any capture windows. aura::Window* FindWindowForEvent(const ui::LocatedEvent& event) { - aura::Window* target = static_cast<aura::Window*>(event.target()); - aura::Window* target_root = target->GetRootWindow(); - - aura::client::ScreenPositionClient* position_client = - aura::client::GetScreenPositionClient(target_root); - gfx::Point location = event.location(); - position_client->ConvertPointToScreen(target, &location); - + gfx::Point location = event.target()->GetScreenLocation(event); display::Display display = display::Screen::GetScreen()->GetDisplayNearestPoint(location); - aura::Window* root_window = Shell::GetRootWindowForDisplayId(display.id()); - - position_client->ConvertPointFromScreen(root_window, &location); + aura::Window* root = Shell::GetRootWindowForDisplayId(display.id()); + auto* screen_position_client = aura::client::GetScreenPositionClient(root); + screen_position_client->ConvertPointFromScreen(root, &location); std::unique_ptr<ui::Event> cloned_event = ui::Event::Clone(event); ui::LocatedEvent* cloned_located_event = cloned_event->AsLocatedEvent(); @@ -60,15 +53,14 @@ // Ignore capture window when finding the target for located event. aura::client::CaptureClient* original_capture_client = - aura::client::GetCaptureClient(root_window); - aura::client::SetCaptureClient(root_window, nullptr); + aura::client::GetCaptureClient(root); + aura::client::SetCaptureClient(root, nullptr); - aura::Window* selected = - static_cast<aura::Window*>(aura::WindowTargeter().FindTargetForEvent( - root_window, cloned_located_event)); + aura::Window* selected = static_cast<aura::Window*>( + aura::WindowTargeter().FindTargetForEvent(root, cloned_located_event)); // Restore State. - aura::client::SetCaptureClient(root_window, original_capture_client); + aura::client::SetCaptureClient(root, original_capture_client); return selected; }
diff --git a/ash/wm/immersive_gesture_handler_classic.cc b/ash/wm/immersive_gesture_handler_classic.cc index e38c0ed..15242f07 100644 --- a/ash/wm/immersive_gesture_handler_classic.cc +++ b/ash/wm/immersive_gesture_handler_classic.cc
@@ -25,23 +25,14 @@ // window from the top of the screen in tablet mode. constexpr int kDragStartTopEdgeInset = 8; -// Returns the location of |event| in screen coordinates. -gfx::Point GetEventLocationInScreen(const ui::LocatedEvent& event) { - gfx::Point location_in_screen = event.location(); - aura::Window* target = static_cast<aura::Window*>(event.target()); - aura::client::ScreenPositionClient* screen_position_client = - aura::client::GetScreenPositionClient(target->GetRootWindow()); - screen_position_client->ConvertPointToScreen(target, &location_in_screen); - return location_in_screen; -} - // Check whether we should start gesture dragging app window according to the // given ET_GETURE_SCROLL_BEGIN type |event|. bool CanBeginGestureDrag(ui::GestureEvent* event) { if (event->details().scroll_y_hint() < 0) return false; - const gfx::Point location_in_screen(GetEventLocationInScreen(*event)); + const gfx::Point location_in_screen = + event->target()->GetScreenLocation(*event); const gfx::Rect display_bounds = display::Screen::GetScreen() ->GetDisplayNearestWindow(static_cast<aura::Window*>(event->target())) @@ -129,8 +120,7 @@ event->SetHandled(); return; } - immersive_fullscreen_controller_->OnGestureEvent( - event, GetEventLocationInScreen(*event)); + immersive_fullscreen_controller_->OnGestureEvent(event); } } // namespace ash
diff --git a/base/BUILD.gn b/base/BUILD.gn index 92fd2fa..1ed0b8a 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -2199,6 +2199,7 @@ if (is_fuchsia) { fidl_library("testfidl") { namespace = "base.fuchsia" + namespace_path = "base/fuchsia" sources = [ "fuchsia/test.fidl",
diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py index 5b6876e..78ade4b5 100755 --- a/build/android/gyp/dex.py +++ b/build/android/gyp/dex.py
@@ -8,8 +8,10 @@ import logging import optparse import os +import re import shutil import sys +import tempfile import zipfile from util import build_utils @@ -57,11 +59,28 @@ parser.add_option('--d8-jar-path', help='Path to D8 jar.') + parser.add_option('--dexlayout-profile', + help=('Text profile for dexlayout. If present, a dexlayout ' + 'pass will happen')) + parser.add_option('--profman-path', + help=('Path to ART profman binary. There should be a ' + 'lib/ directory at the same path containing shared ' + 'libraries (shared with dexlayout).')) + parser.add_option('--dexlayout-path', + help=('Path to ART dexlayout binary. There should be a ' + 'lib/ directory at the same path containing shared ' + 'libraries (shared with dexlayout).')) + + options, paths = parser.parse_args(args) required_options = ('d8_jar_path',) build_utils.CheckOptions(options, parser, required=required_options) + if options.dexlayout_profile: + build_utils.CheckOptions(options, parser, required=('profman_path', + 'dexlayout_path')) + if options.multidex_configuration_path: with open(options.multidex_configuration_path) as multidex_config_file: multidex_config = json.loads(multidex_config_file.read()) @@ -127,6 +146,153 @@ build_utils.CheckOutput(dex_cmd, print_stderr=False) +def _EnvWithArtLibPath(binary_path): + """Return an environment dictionary for ART host shared libraries. + + Args: + binary_path: the path to an ART host binary. + + Returns: + An environment dictionary where LD_LIBRARY_PATH has been augmented with the + shared library path for the binary. This assumes that there is a lib/ + directory in the same location as the binary. + """ + lib_path = os.path.join(os.path.dirname(binary_path), 'lib') + env = os.environ.copy() + libraries = [l for l in env.get('LD_LIBRARY_PATH', '').split(':') if l] + libraries.append(lib_path) + env['LD_LIBRARY_PATH'] = ':'.join(libraries) + return env + + +def _FilterOutput(output, filter_strings): + """Output filter from build_utils.CheckOutput. + + Args: + output: Executable output as from build_utils.CheckOutput. + filter_strings: List of RE strings that will filter (remove) matching + lines from |output|. + + Returns: + The filtered output, as a single string. + """ + filters = [re.compile(f) for f in filter_strings] + filtered_output = [] + for line in output.splitlines(): + if any(filter.search(line) for filter in filters): + continue + else: + filtered_output.append(line) + return '\n'.join(filtered_output) + + +def _FilterProfmanStderr(output): + return _FilterOutput(output, [ + r'Could not find (method_id|proto_id|name):', + r'Could not create type list', + ]) + + +def _FilterDexlayoutStderr(output): + return _FilterOutput(output, [ + r'Can.t mmap dex file.*please zipalign', + ]) + + +def _CreateBinaryProfile(text_profile, input_dex, profman_path, temp_dir): + """Create a binary profile for dexlayout. + + Args: + text_profile: The ART text profile that will be converted to a binary + profile. + input_dex: The input dex file to layout. + profman_path: Path to the profman binary. + temp_dir: Directory to work in. + + Returns: + The name of the binary profile, which will live in temp_dir. + """ + binary_profile = os.path.join( + temp_dir, 'binary_profile-for-' + os.path.basename(text_profile)) + open(binary_profile, 'w').close() # Touch binary_profile. + profman_cmd = [profman_path, + '--apk=' + input_dex, + '--dex-location=' + input_dex, + '--create-profile-from=' + text_profile, + '--reference-profile-file=' + binary_profile] + build_utils.CheckOutput(profman_cmd, env=_EnvWithArtLibPath(profman_path), + stderr_filter=_FilterProfmanStderr) + return binary_profile + + +def _LayoutDex(binary_profile, input_dex, dexlayout_path, temp_dir): + """Layout a dexfile using a profile. + + Args: + binary_profile: An ART binary profile, eg output from _CreateBinaryProfile. + input_dex: The dex file used to create the binary profile. + dexlayout_path: Path to the dexlayout binary. + temp_dir: Directory to work in. + + Returns: + List of output files produced by dexlayout. This will be one if the input + was a single dexfile, or multiple files if the input was a multidex + zip. These output files are located in temp_dir. + """ + dexlayout_output_dir = os.path.join(temp_dir, 'dexlayout_output') + os.mkdir(dexlayout_output_dir) + dexlayout_cmd = [ dexlayout_path, + '-u', # Update checksum + '-p', binary_profile, + '-w', dexlayout_output_dir, + input_dex ] + build_utils.CheckOutput(dexlayout_cmd, env=_EnvWithArtLibPath(dexlayout_path), + stderr_filter=_FilterDexlayoutStderr) + output_files = os.listdir(dexlayout_output_dir) + if not output_files: + raise Exception('dexlayout unexpectedly produced no output') + return [os.path.join(dexlayout_output_dir, f) for f in output_files] + + +def _ZipMultidex(file_dir, dex_files): + """Zip dex files into a multidex. + + Args: + file_dir: The directory into which to write the output. + dex_files: The dexfiles forming the multizip. Their names must end with + classes.dex, classes2.dex, ... + + Returns: + The name of the multidex file, which will live in file_dir. + """ + ordered_files = [] # List of (archive name, file name) + for f in dex_files: + if f.endswith('classes.dex.zip'): + ordered_files.append(('classes.dex', f)) + break + if not ordered_files: + raise Exception('Could not find classes.dex multidex file in %s', + dex_files) + for dex_idx in xrange(2, len(dex_files) + 1): + archive_name = 'classes%d.dex' % dex_idx + for f in dex_files: + if f.endswith(archive_name): + ordered_files.append((archive_name, f)) + break + else: + raise Exception('Could not find classes%d.dex multidex file in %s', + dex_files) + if len(set(f[1] for f in ordered_files)) != len(ordered_files): + raise Exception('Unexpected clashing filenames for multidex in %s', + dex_files) + + zip_name = os.path.join(file_dir, 'multidex_classes.zip') + build_utils.DoZip(((archive_name, os.path.join(file_dir, file_name)) + for archive_name, file_name in ordered_files), + zip_name) + return zip_name + + def main(args): options, paths = _ParseArgs(args) if ((options.proguard_enabled == 'true' @@ -170,6 +336,21 @@ else: _RunD8(dex_cmd, paths, options.dex_path) + if options.dexlayout_profile: + with build_utils.TempDir() as temp_dir: + binary_profile = _CreateBinaryProfile(options.dexlayout_profile, + options.dex_path, + options.profman_path, temp_dir) + output_files = _LayoutDex(binary_profile, options.dex_path, + options.dexlayout_path, temp_dir) + target = None + if len(output_files) > 1: + target = _ZipMultidex(temp_dir, output_files) + else: + target = output_files[0] + shutil.move(os.path.join(temp_dir, target), options.dex_path) + + build_utils.WriteDepfile( options.depfile, options.dex_path, input_paths, add_pydeps=False)
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index 0c3ce680..f7d99bd5 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -45,6 +45,64 @@ _default_proguard_jar_path = "//third_party/proguard/lib/proguard.jar" +_dexlayout_path = "//third_party/android_build_tools/art/dexlayout" +_profman_path = "//third_party/android_build_tools/art/profman" +_art_lib_file_names = [ + "libartbased.so", + "libartbase.so", + "libart-compiler.so", + "libartd-compiler.so", + "libartd-dexlayout.so", + "libartd-disassembler.so", + "libart-dexlayout.so", + "libart-disassembler.so", + "libartd-simulator-container.so", + "libartd-simulator.so", + "libartd.so", + "libart-gtest.so", + "libart.so", + "libbacktrace.so", + "libbase.so", + "libcrypto-host.so", + "libc++.so", + "libcutils.so", + "libdexfiled.so", + "libdexfile.so", + "libexpat-host.so", + "libicui18n-host.so", + "libicuuc-host.so", + "libjavacore.so", + "libjavacrypto.so", + "liblog.so", + "liblz4.so", + "liblzma.so", + "libnativebridge.so", + "libnativehelper.so", + "libnativeloader.so", + "libopenjdkd.so", + "libopenjdkjvmd.so", + "libopenjdkjvm.so", + "libopenjdkjvmtid.so", + "libopenjdkjvmti.so", + "libopenjdk.so", + "libprofiled.so", + "libprofile.so", + "libsigchain.so", + "libssl-host.so", + "libunwindstack.so", + "libvixl-arm64.so", + "libvixl-arm.so", + "libvixld-arm64.so", + "libvixld-arm.so", + "libz-host.so", + "libziparchive.so", + "slicer.so", +] +_default_art_libs = [] +foreach(lib, _art_lib_file_names) { + _default_art_libs += [ "//third_party/android_build_tools/art/lib/$lib" ] +} + # Write the target's .build_config file. This is a json file that contains a # dictionary of information about how to build this target (things that # require knowledge about this target's dependencies and cannot be calculated @@ -1119,6 +1177,23 @@ _rebased_output, ] + if (defined(invoker.dexlayout_profile)) { + args += [ + "--dexlayout_profile", + rebase_path(invoker.dexlayout_profile, root_build_dir), + "--dexlayout_path", + rebase_path(_dexlayout_path, root_build_dir), + "--profman_path", + rebase_path(_profman_path, root_build_dir), + ] + inputs += [ + _dexlayout_path, + _profman_path, + invoker.dexlayout_profile, + ] + inputs += _default_art_libs + } + if (_enable_multidex) { args += [ "--multi-dex",
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 7836755..29510a0 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -2511,6 +2511,8 @@ deps += [ ":$_compile_resources_target" ] } + forward_variables_from(invoker, [ "dexlayout_profile" ]) + # All deps are already included in _dex_sources when proguard is used. if (!_proguard_enabled) { if (_enable_multidex) { @@ -2871,6 +2873,7 @@ "data", "data_deps", "deps", + "dexlayout_profile", "dist_ijar_path", "dont_load_shared_libraries", "emma_never_instrument",
diff --git a/build/config/fuchsia/fidl_library.gni b/build/config/fuchsia/fidl_library.gni index 6fbb28b6..6259640 100644 --- a/build/config/fuchsia/fidl_library.gni +++ b/build/config/fuchsia/fidl_library.gni
@@ -12,6 +12,13 @@ # library_name - (optional) Name of the library. target_name is used if name # is not specified explicitly. # namespace - (optional) Namespace for the library. +# namespace_path - (optional) namespace with '.' are replaced with '/', e.g. +# if namespace is "fuchsia.foo", then namespace_path must be +# set to "fuchsia/foo". This parameter must be specified when +# namespace is specified. +# TODO(sergeyu): In theory namespace_path can be generated +# from name, but GN doesn't provide any tools to perform this +# conversion without invoking a python script. # deps - (optional) List of other fidl_library() targets that this # FIDL library depends on. # @@ -19,7 +26,11 @@ # files. template("fidl_library") { - forward_variables_from(invoker, [ "namespace" ]) + forward_variables_from(invoker, + [ + "namespace", + "namespace_path", + ]) _library_basename = target_name if (defined(invoker.library_name)) { @@ -27,9 +38,10 @@ } if (defined(namespace)) { + assert(defined(namespace_path), + "FIDL libraries with namespace must specify namespace_path") _library_name = "${namespace}.${_library_basename}" - _namespace_path = string_replace(namespace, ".", "/") - _library_path = "${_namespace_path}/${_library_basename}" + _library_path = "${namespace_path}/${_library_basename}" } else { _library_name = _library_basename _library_path = _library_basename
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index a10fcf1..a545949 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -b9dd8279f122d4d9718e66d5b9bd974b18924d57 \ No newline at end of file +98ba6c8440c2afb334433de9bb901a0f97efe1e1 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 2bf38f7e..da4623e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -ebbe4babd77b3b6a943ebc24daeeb48b1a2468d5 \ No newline at end of file +bd8834505d919018dd7ffdc5fa42eb04616ca9f5 \ No newline at end of file
diff --git a/build/fuchsia/update_sdk.py b/build/fuchsia/update_sdk.py index 4718aae..8305064 100755 --- a/build/fuchsia/update_sdk.py +++ b/build/fuchsia/update_sdk.py
@@ -75,8 +75,7 @@ # Previously SDK was unpacked in //third_party/fuchsia-sdk instead of # //third_party/fuchsia-sdk/sdk . Remove the old files if they are still # there. - sdk_root = os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk') - Cleanup(sdk_root) + Cleanup(os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk')) hash_file = GetSdkHashForPlatform() with open(hash_file, 'r') as f: @@ -86,15 +85,14 @@ print >>sys.stderr, 'No SHA1 found in %s' % hash_file return 1 - output_dir = os.path.join(sdk_root, 'sdk') + output_dir = os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk', + 'sdk') hash_filename = os.path.join(output_dir, '.hash') if os.path.exists(hash_filename): with open(hash_filename, 'r') as f: if f.read().strip() == sdk_hash: - # Nothing to do. Generate sdk/BUILD.gn anyways, in case the conversion - # script changed. - subprocess.check_call([os.path.join(sdk_root, 'gen_build_defs.py')]) + # Nothing to do. return 0 print 'Downloading SDK %s...' % sdk_hash @@ -115,9 +113,6 @@ finally: os.remove(tmp) - # Generate sdk/BUILD.gn. - subprocess.check_call([os.path.join(sdk_root, 'gen_build_defs.py')]) - with open(hash_filename, 'w') as f: f.write(sdk_hash)
diff --git a/chrome/VERSION b/chrome/VERSION index 5a62821..10c3fb7 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=71 MINOR=0 -BUILD=3563 +BUILD=3564 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridge.java index f7f06217..a643e34 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesBridge.java
@@ -38,9 +38,9 @@ /** * Causes a network request for updating the catalog. */ - public static void updateCatalogFromNetwork(Profile profile, Callback<Void> finishedCallback) { - // TODO(dewittj): Connect to the ExploreSitesService on the native side. - finishedCallback.onResult(null); + public static void updateCatalogFromNetwork( + Profile profile, Callback<Boolean> finishedCallback) { + nativeUpdateCatalogFromNetwork(profile, finishedCallback); } /** @@ -57,4 +57,7 @@ private static native void nativeGetIcon( Profile profile, int siteID, Callback<Bitmap> callback); + + private static native void nativeUpdateCatalogFromNetwork( + Profile profile, Callback<Boolean> callback); }
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 3fd20ff..62e562e0 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -24,6 +24,7 @@ import("//rlz/buildflags/buildflags.gni") import("//sandbox/features.gni") import("//third_party/protobuf/proto_library.gni") +import("//third_party/widevine/cdm/widevine.gni") import("//ui/base/ui_features.gni") # //build/config/android/rules.gni imports //tools/grit/grit_rule.gni, which @@ -1937,7 +1938,7 @@ "//third_party/smhasher:cityhash", "//third_party/webrtc_overrides", "//third_party/webrtc_overrides:init_webrtc", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", "//third_party/zlib", "//third_party/zlib:minizip", "//third_party/zlib/google:compression_utils", @@ -3965,20 +3966,25 @@ if (enable_library_cdms) { sources += [ - "component_updater/widevine_cdm_component_installer.cc", - "component_updater/widevine_cdm_component_installer.h", "media/output_protection_impl.cc", "media/output_protection_impl.h", ] deps += [ "//media/mojo/interfaces" ] - if (is_win) { + if (enable_widevine) { + # TODO(crbug.com/349182): Also check WIDEVINE_CDM_IS_COMPONENT. sources += [ - "media/widevine_hardware_caps_win.cc", - "media/widevine_hardware_caps_win.h", + "component_updater/widevine_cdm_component_installer.cc", + "component_updater/widevine_cdm_component_installer.h", ] deps += [ "//third_party/widevine/cdm:headers" ] - libs += [ "d3d11.lib" ] + if (is_win) { + sources += [ + "media/widevine_hardware_caps_win.cc", + "media/widevine_hardware_caps_win.h", + ] + libs += [ "d3d11.lib" ] + } } if (enable_cdm_storage_id) {
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index ad7bbdd..7793cb5d 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -87,6 +87,7 @@ "+third_party/cros_system_api", "+third_party/libaom/av1_buildflags.h", "+third_party/metrics_proto", + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", # Code under //ash runs out-of-process in mash so it must be accessed via mojo @@ -164,7 +165,6 @@ "+third_party/blink/public/platform/modules/screen_orientation/web_screen_orientation_lock_type.h", "+third_party/blink/public/public_buildflags.h", "+third_party/blink/public/web/web_context_menu_data.h", - "+third_party/blink/public/web/web_find_options.h", "+third_party/blink/public/web/web_fullscreen_options.h", "+third_party/blink/public/web/web_media_player_action.h", "+third_party/blink/public/web/web_plugin_action.h",
diff --git a/chrome/browser/android/explore_sites/explore_sites_bridge.cc b/chrome/browser/android/explore_sites/explore_sites_bridge.cc index 1861e62..0482af5 100644 --- a/chrome/browser/android/explore_sites/explore_sites_bridge.cc +++ b/chrome/browser/android/explore_sites/explore_sites_bridge.cc
@@ -65,6 +65,11 @@ base::android::RunObjectCallbackAndroid(j_callback_obj, j_bitmap); } +void UpdateCatalogDone(ScopedJavaGlobalRef<jobject>(j_callback_obj), + bool result) { + base::android::RunBooleanCallbackAndroid(j_callback_obj, result); +} + } // namespace // static @@ -111,6 +116,7 @@ ExploreSitesServiceFactory::GetForBrowserContext(profile); if (!service) { DLOG(ERROR) << "Unable to create the ExploreSitesService!"; + base::android::RunObjectCallbackAndroid(j_callback_obj, nullptr); return; } @@ -120,4 +126,25 @@ site_id, base::BindOnce(&ImageReady, ScopedJavaGlobalRef<jobject>(j_callback_obj))); } + +void JNI_ExploreSitesBridge_UpdateCatalogFromNetwork( + JNIEnv* env, + const JavaParamRef<jclass>& j_caller, + const JavaParamRef<jobject>& j_profile, + const JavaParamRef<jobject>& j_callback_obj) { + Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); + DCHECK(profile); + + ExploreSitesService* service = + ExploreSitesServiceFactory::GetForBrowserContext(profile); + if (!service) { + DLOG(ERROR) << "Unable to create the ExploreSitesService!"; + base::android::RunBooleanCallbackAndroid(j_callback_obj, false); + return; + } + + service->UpdateCatalogFromNetwork(base::BindOnce( + &UpdateCatalogDone, ScopedJavaGlobalRef<jobject>(j_callback_obj))); +} + } // namespace explore_sites
diff --git a/chrome/browser/android/explore_sites/explore_sites_service.h b/chrome/browser/android/explore_sites/explore_sites_service.h index aec6fff..37ce6a3 100644 --- a/chrome/browser/android/explore_sites/explore_sites_service.h +++ b/chrome/browser/android/explore_sites/explore_sites_service.h
@@ -28,6 +28,10 @@ // Returns via callback the image for a site. This is typically the site // favicon. Returns |nullptr| if there was an error or no match for |site_id|. virtual void GetSiteImage(int site_id, BitmapCallback callback) = 0; + + // Fetch the latest catalog from the network and stores it locally. Returns + // true in the callback for success. + virtual void UpdateCatalogFromNetwork(BooleanCallback callback) = 0; }; } // namespace explore_sites
diff --git a/chrome/browser/android/explore_sites/explore_sites_service_factory.cc b/chrome/browser/android/explore_sites/explore_sites_service_factory.cc index f36a73d..8dc7024 100644 --- a/chrome/browser/android/explore_sites/explore_sites_service_factory.cc +++ b/chrome/browser/android/explore_sites/explore_sites_service_factory.cc
@@ -19,6 +19,7 @@ #include "chrome/common/chrome_constants.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "content/public/browser/browser_context.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace explore_sites { const base::FilePath::CharType kExploreSitesStoreDirname[] = @@ -50,8 +51,11 @@ profile->GetPath().Append(kExploreSitesStoreDirname); auto explore_sites_store = std::make_unique<ExploreSitesStore>(background_task_runner, store_path); + scoped_refptr<network::SharedURLLoaderFactory> url_fetcher = + profile->GetURLLoaderFactory(); - return new ExploreSitesServiceImpl(std::move(explore_sites_store)); + return new ExploreSitesServiceImpl(std::move(explore_sites_store), + url_fetcher); } } // namespace explore_sites
diff --git a/chrome/browser/android/explore_sites/explore_sites_service_impl.cc b/chrome/browser/android/explore_sites/explore_sites_service_impl.cc index fc17f08..e90fb93 100644 --- a/chrome/browser/android/explore_sites/explore_sites_service_impl.cc +++ b/chrome/browser/android/explore_sites/explore_sites_service_impl.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/android/explore_sites/explore_sites_service_impl.h" +#include "base/logging.h" #include "base/task/post_task.h" #include "chrome/browser/android/explore_sites/catalog.pb.h" #include "chrome/browser/android/explore_sites/explore_sites_feature.h" @@ -15,6 +16,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/common/service_manager_connection.h" #include "services/data_decoder/public/cpp/decode_image.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/service_manager/public/cpp/connector.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/geometry/size.h" @@ -28,8 +30,12 @@ } ExploreSitesServiceImpl::ExploreSitesServiceImpl( - std::unique_ptr<ExploreSitesStore> store) - : task_queue_(this), explore_sites_store_(std::move(store)) {} + std::unique_ptr<ExploreSitesStore> store, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) + : task_queue_(this), + explore_sites_store_(std::move(store)), + url_loader_factory_(url_loader_factory), + weak_ptr_factory_(this) {} ExploreSitesServiceImpl::~ExploreSitesServiceImpl() {} @@ -64,18 +70,67 @@ std::move(callback)))); } +void ExploreSitesServiceImpl::UpdateCatalogFromNetwork( + BooleanCallback callback) { + if (!IsExploreSitesEnabled()) + return; + // If we are already fetching, don't interrupt a fetch in progress. + if (explore_sites_fetcher_ != nullptr) + return; + + // TODO(petewil): Eventually get the catalog version from DB. + std::string catalog_version = ""; + // TODO(petewil): Eventually get the country code from somewhere. + std::string country_code = "KE"; + + // Create a fetcher and start fetching the protobuf (async). + explore_sites_fetcher_ = ExploreSitesFetcher::CreateForGetCatalog( + base::BindOnce(&ExploreSitesServiceImpl::OnCatalogFetched, + weak_ptr_factory_.GetWeakPtr(), std::move(callback)), + catalog_version, country_code, url_loader_factory_); +} + +void ExploreSitesServiceImpl::OnCatalogFetched( + BooleanCallback callback, + ExploreSitesRequestStatus status, + std::unique_ptr<std::string> serialized_protobuf) { + explore_sites_fetcher_.reset(nullptr); + + if (serialized_protobuf == nullptr) { + DVLOG(1) << "Empty catalog response received from network."; + std::move(callback).Run(false); + return; + } + + // Convert the protobuf into a catalog object. + std::unique_ptr<explore_sites::GetCatalogResponse> catalog_response = + std::make_unique<explore_sites::GetCatalogResponse>(); + if (!catalog_response->ParseFromString(*serialized_protobuf.get())) { + DVLOG(1) << "Failed to parse catalog"; + std::move(callback).Run(false); + return; + } + std::string catalog_version = catalog_response->version_token(); + std::unique_ptr<Catalog> catalog(catalog_response->release_catalog()); + + // Add the catalog to our internal database using AddUpdatedCatalog + AddUpdatedCatalog(catalog_version, std::move(catalog), std::move(callback)); +} + void ExploreSitesServiceImpl::Shutdown() {} void ExploreSitesServiceImpl::OnTaskQueueIsIdle() {} void ExploreSitesServiceImpl::AddUpdatedCatalog( std::string version_token, - std::unique_ptr<Catalog> catalog_proto) { + std::unique_ptr<Catalog> catalog_proto, + BooleanCallback callback) { if (!IsExploreSitesEnabled()) return; task_queue_.AddTask(std::make_unique<ImportCatalogTask>( - explore_sites_store_.get(), version_token, std::move(catalog_proto))); + explore_sites_store_.get(), version_token, std::move(catalog_proto), + std::move(callback))); } // static
diff --git a/chrome/browser/android/explore_sites/explore_sites_service_impl.h b/chrome/browser/android/explore_sites/explore_sites_service_impl.h index 827de0c..b954754 100644 --- a/chrome/browser/android/explore_sites/explore_sites_service_impl.h +++ b/chrome/browser/android/explore_sites/explore_sites_service_impl.h
@@ -8,10 +8,12 @@ #include <memory> #include "base/macros.h" +#include "chrome/browser/android/explore_sites/explore_sites_fetcher.h" #include "chrome/browser/android/explore_sites/explore_sites_service.h" #include "chrome/browser/android/explore_sites/explore_sites_store.h" #include "chrome/browser/android/explore_sites/explore_sites_types.h" #include "components/offline_pages/task/task_queue.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" using offline_pages::TaskQueue; @@ -21,7 +23,9 @@ class ExploreSitesServiceImpl : public ExploreSitesService, public TaskQueue::Delegate { public: - explicit ExploreSitesServiceImpl(std::unique_ptr<ExploreSitesStore> store); + ExploreSitesServiceImpl( + std::unique_ptr<ExploreSitesStore> store, + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); ~ExploreSitesServiceImpl() override; bool IsExploreSitesEnabled(); @@ -30,6 +34,7 @@ void GetCatalog(CatalogCallback callback) override; void GetCategoryImage(int category_id, BitmapCallback callback) override; void GetSiteImage(int site_id, BitmapCallback callback) override; + void UpdateCatalogFromNetwork(BooleanCallback callback) override; private: // KeyedService implementation: @@ -39,13 +44,20 @@ void OnTaskQueueIsIdle() override; void AddUpdatedCatalog(std::string version_token, - std::unique_ptr<Catalog> catalog_proto); + std::unique_ptr<Catalog> catalog_proto, + BooleanCallback callback); static void OnDecodeDone(BitmapCallback callback, const SkBitmap& decoded_image); static void DecodeImageBytes(BitmapCallback callback, EncodedImageList images); + // Callback returning from the UpdateCatalogFromNetwork operation. It + // passes along the call back to the bridge and eventually back to Java land. + void OnCatalogFetched(BooleanCallback callback, + ExploreSitesRequestStatus status, + std::unique_ptr<std::string> serialized_protobuf); + // True when Chrome starts up, this is reset after the catalog is requested // the first time in Chrome. This prevents the ESP from changing out from // under a viewer. @@ -54,6 +66,9 @@ // Used to control access to the ExploreSitesStore. TaskQueue task_queue_; std::unique_ptr<ExploreSitesStore> explore_sites_store_; + scoped_refptr<network ::SharedURLLoaderFactory> url_loader_factory_; + std::unique_ptr<ExploreSitesFetcher> explore_sites_fetcher_; + base::WeakPtrFactory<ExploreSitesServiceImpl> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ExploreSitesServiceImpl); };
diff --git a/chrome/browser/android/explore_sites/explore_sites_service_impl_unittest.cc b/chrome/browser/android/explore_sites/explore_sites_service_impl_unittest.cc new file mode 100644 index 0000000..32d43db1 --- /dev/null +++ b/chrome/browser/android/explore_sites/explore_sites_service_impl_unittest.cc
@@ -0,0 +1,197 @@ +// Copyright 2018 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/android/explore_sites/explore_sites_service_impl.h" + +#include "base/feature_list.h" +#include "base/message_loop/message_loop.h" +#include "base/test/bind_test_util.h" +#include "base/test/scoped_feature_list.h" +#include "base/test/test_mock_time_task_runner.h" +#include "chrome/browser/android/chrome_feature_list.h" +#include "chrome/browser/android/explore_sites/catalog.pb.h" +#include "services/network/public/cpp/resource_request.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { +const char kCategoryName[] = "Technology"; +const char kSite1Url[] = "https://example.com/"; +const char kSite2Url[] = "https://sample.com/"; +const char kSite1Name[] = "example"; +const char kSite2Name[] = "sample"; +} // namespace + +namespace explore_sites { + +class ExploreSitesServiceImplTest : public testing::Test { + public: + ExploreSitesServiceImplTest(); + ~ExploreSitesServiceImplTest() override = default; + + void SetUp() override { + std::unique_ptr<ExploreSitesStore> store = + std::make_unique<ExploreSitesStore>(task_runner_); + service_ = std::make_unique<ExploreSitesServiceImpl>( + std::move(store), test_shared_url_loader_factory_); + success_ = false; + test_data_ = CreateTestDataProto(); + } + + void UpdateCatalogDoneCallback(bool success) { success_ = success; } + void CatalogCallback( + std::unique_ptr<std::vector<ExploreSitesCategory>> categories) { + if (categories != nullptr) { + database_categories_ = std::move(categories); + } + } + + bool success() { return success_; } + + std::vector<ExploreSitesCategory>* database_categories() { + return database_categories_.get(); + } + + ExploreSitesServiceImpl* service() { return service_.get(); } + + std::string test_data() { return test_data_; } + + void PumpLoop() { task_runner_->RunUntilIdle(); } + + std::string CreateTestDataProto(); + + ExploreSitesRequestStatus SimulateFetcherData( + const std::string& response_data); + + private: + network::TestURLLoaderFactory::PendingRequest* GetPendingRequest( + size_t index); + + std::unique_ptr<explore_sites::ExploreSitesServiceImpl> service_; + bool success_; + std::unique_ptr<std::vector<ExploreSitesCategory>> database_categories_; + std::string test_data_; + network::TestURLLoaderFactory test_url_loader_factory_; + scoped_refptr<network::SharedURLLoaderFactory> + test_shared_url_loader_factory_; + network::ResourceRequest last_resource_request_; + base::MessageLoopForIO message_loop_; + scoped_refptr<base::TestMockTimeTaskRunner> task_runner_; + + DISALLOW_COPY_AND_ASSIGN(ExploreSitesServiceImplTest); +}; + +ExploreSitesServiceImplTest::ExploreSitesServiceImplTest() + : success_(false), + test_shared_url_loader_factory_( + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &test_url_loader_factory_)), + task_runner_(new base::TestMockTimeTaskRunner) { + message_loop_.SetTaskRunner(task_runner_); +} + +// Called by tests - response_data is the data we want to go back as the +// response from the network. +ExploreSitesRequestStatus ExploreSitesServiceImplTest::SimulateFetcherData( + const std::string& response_data) { + DCHECK(test_url_loader_factory_.pending_requests()->size() > 0); + test_url_loader_factory_.SimulateResponseForPendingRequest( + GetPendingRequest(0)->request.url.spec(), response_data); + return ExploreSitesRequestStatus::kSuccess; +} + +// Helper to check the next request for the network. +network::TestURLLoaderFactory::PendingRequest* +ExploreSitesServiceImplTest::GetPendingRequest(size_t index) { + if (index >= test_url_loader_factory_.pending_requests()->size()) + return nullptr; + network::TestURLLoaderFactory::PendingRequest* request = + &(*test_url_loader_factory_.pending_requests())[index]; + DCHECK(request); + return request; +} + +// This is a helper to generate testing data to use in tests. +std::string ExploreSitesServiceImplTest::CreateTestDataProto() { + std::string serialized_protobuf; + explore_sites::GetCatalogResponse catalog_response; + explore_sites::Catalog* catalog = catalog_response.mutable_catalog(); + explore_sites::Category* category = catalog->add_categories(); + explore_sites::Site* site1 = category->add_sites(); + explore_sites::Site* site2 = category->add_sites(); + + // Fill in fields we need to add to the EoS database. + + // Create two sites. + site1->set_site_url(kSite1Url); + site1->set_title(kSite1Name); + site2->set_site_url(kSite2Url); + site2->set_title(kSite2Name); + + // Create one category, technology. + category->set_type(Category_CategoryType_TECHNOLOGY); + category->set_localized_title(kCategoryName); + + // Serialize it into a string. + catalog_response.SerializeToString(&serialized_protobuf); + + // Print out the string + DVLOG(1) << "test data proto '" << serialized_protobuf << "'"; + + return serialized_protobuf; +} + +TEST_F(ExploreSitesServiceImplTest, UpdateCatalogFromNetwork) { + std::string output_data; + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(chrome::android::kExploreSites); + + service()->UpdateCatalogFromNetwork( + base::BindOnce(&ExploreSitesServiceImplTest::UpdateCatalogDoneCallback, + base::Unretained(this))); + + // Simulate fetching using the test loader factory and test data. + SimulateFetcherData(test_data()); + + // Wait for callback to get called. + PumpLoop(); + + EXPECT_TRUE(success()); + + // Get the catalog and verify the contents. + + // First call is to get update_catalog out of the way. If GetCatalog has + // never been called before in this session, it won't return anything, it will + // just start the update process. For our test, we've already put data into + // the catalog, but GetCatalog doesn't know that. + // TODO(petewil): Fix get catalog so it always returns data if it has some. + service()->GetCatalog(base::BindOnce( + &ExploreSitesServiceImplTest::CatalogCallback, base::Unretained(this))); + // Second call is to get the actual catalog sata into the update callback. + service()->GetCatalog(base::BindOnce( + &ExploreSitesServiceImplTest::CatalogCallback, base::Unretained(this))); + PumpLoop(); + + EXPECT_NE(nullptr, database_categories()); + EXPECT_EQ(1U, database_categories()->size()); + + const ExploreSitesCategory& category = database_categories()->at(0); + EXPECT_EQ(Category_CategoryType_TECHNOLOGY, category.category_type); + EXPECT_EQ(std::string(kCategoryName), category.label); + EXPECT_EQ(2U, category.sites.size()); + + // Since the site name and url might come back in a different order than we + // started with, accept either order as long as one name and url match. + std::string site1Url = category.sites[0].url.spec(); + std::string site2Url = category.sites[1].url.spec(); + std::string site1Name = category.sites[0].title; + std::string site2Name = category.sites[1].title; + EXPECT_TRUE(site1Url == kSite1Url || site1Url == kSite2Url); + EXPECT_TRUE(site2Url == kSite1Url || site2Url == kSite2Url); + EXPECT_TRUE(site1Name == kSite1Name || site1Name == kSite2Name); + EXPECT_TRUE(site2Name == kSite1Name || site2Name == kSite2Name); +} + +} // namespace explore_sites
diff --git a/chrome/browser/android/explore_sites/explore_sites_types.h b/chrome/browser/android/explore_sites/explore_sites_types.h index e27916e7..cc81b29 100644 --- a/chrome/browser/android/explore_sites/explore_sites_types.h +++ b/chrome/browser/android/explore_sites/explore_sites_types.h
@@ -56,6 +56,7 @@ using CatalogCallback = base::OnceCallback<void( std::unique_ptr<std::vector<ExploreSitesCategory>>)>; +using BooleanCallback = base::OnceCallback<void(bool)>; using EncodedImageBytes = std::vector<uint8_t>; using EncodedImageList = std::vector<std::unique_ptr<EncodedImageBytes>>; using EncodedImageListCallback = base::OnceCallback<void(EncodedImageList)>;
diff --git a/chrome/browser/android/explore_sites/import_catalog_task.cc b/chrome/browser/android/explore_sites/import_catalog_task.cc index b30d3ca..8b52936 100644 --- a/chrome/browser/android/explore_sites/import_catalog_task.cc +++ b/chrome/browser/android/explore_sites/import_catalog_task.cc
@@ -107,10 +107,12 @@ ImportCatalogTask::ImportCatalogTask(ExploreSitesStore* store, std::string version_token, - std::unique_ptr<Catalog> catalog_proto) + std::unique_ptr<Catalog> catalog_proto, + BooleanCallback callback) : store_(store), version_token_(version_token), catalog_proto_(std::move(catalog_proto)), + callback_(std::move(callback)), weak_ptr_factory_(this) {} ImportCatalogTask::~ImportCatalogTask() = default; @@ -128,6 +130,7 @@ result_ = result; TaskComplete(); DVLOG(1) << "Finished importing the catalog, result: " << result; + std::move(callback_).Run(result); } } // namespace explore_sites
diff --git a/chrome/browser/android/explore_sites/import_catalog_task.h b/chrome/browser/android/explore_sites/import_catalog_task.h index a9841db..59f2425b 100644 --- a/chrome/browser/android/explore_sites/import_catalog_task.h +++ b/chrome/browser/android/explore_sites/import_catalog_task.h
@@ -7,6 +7,7 @@ #include "chrome/browser/android/explore_sites/catalog.pb.h" #include "chrome/browser/android/explore_sites/explore_sites_store.h" +#include "chrome/browser/android/explore_sites/explore_sites_types.h" #include "components/offline_pages/task/task.h" using offline_pages::Task; @@ -24,7 +25,8 @@ public: ImportCatalogTask(ExploreSitesStore* store, std::string version_token, - std::unique_ptr<Catalog> catalog_proto); + std::unique_ptr<Catalog> catalog_proto, + BooleanCallback callback); ~ImportCatalogTask() override; bool complete() const { return complete_; } @@ -42,6 +44,7 @@ bool complete_ = false; bool result_ = false; + BooleanCallback callback_; base::WeakPtrFactory<ImportCatalogTask> weak_ptr_factory_; };
diff --git a/chrome/browser/android/explore_sites/import_catalog_task_unittest.cc b/chrome/browser/android/explore_sites/import_catalog_task_unittest.cc index 5321f76..a8ae2ef 100644 --- a/chrome/browser/android/explore_sites/import_catalog_task_unittest.cc +++ b/chrome/browser/android/explore_sites/import_catalog_task_unittest.cc
@@ -40,6 +40,8 @@ void SetUp() override { store_ = std::make_unique<ExploreSitesStore>(task_runner()); + success_ = false; + callback_called_ = false; } ExploreSitesStore* store() { return store_.get(); } @@ -51,15 +53,29 @@ RunUntilIdle(); } + void OnImportTaskDone(bool success) { + success_ = success; + callback_called_ = true; + } + + bool success() { return success_; } + + bool callback_called() { return callback_called_; } + private: std::unique_ptr<ExploreSitesStore> store_; + bool success_; + bool callback_called_; DISALLOW_COPY_AND_ASSIGN(ExploreSitesImportCatalogTaskTest); }; TEST_F(ExploreSitesImportCatalogTaskTest, StoreFailure) { store()->SetInitializationStatusForTest(InitializationStatus::FAILURE); - ImportCatalogTask task(store(), kVersionToken, std::make_unique<Catalog>()); + ImportCatalogTask task( + store(), kVersionToken, std::make_unique<Catalog>(), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task); // A null catalog should be completed but return with an error. @@ -68,7 +84,10 @@ } TEST_F(ExploreSitesImportCatalogTaskTest, EmptyTask) { - ImportCatalogTask task(store(), kVersionToken, std::unique_ptr<Catalog>()); + ImportCatalogTask task( + store(), kVersionToken, std::unique_ptr<Catalog>(), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task); // A null catalog should be completed but return with an error. @@ -81,13 +100,19 @@ // where it is the "current" catalog, and where it is the "downloading" catalog. TEST_F(ExploreSitesImportCatalogTaskTest, CatalogAlreadyInUse) { // Successfully import a catalog with "version_token". - ImportCatalogTask task(store(), kVersionToken, std::make_unique<Catalog>()); + ImportCatalogTask task( + store(), kVersionToken, std::make_unique<Catalog>(), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task); ASSERT_TRUE(task.result()); // Importing the same catalog again should cause a successful import, // since the catalog was not "current". - ImportCatalogTask task2(store(), kVersionToken, std::make_unique<Catalog>()); + ImportCatalogTask task2( + store(), kVersionToken, std::make_unique<Catalog>(), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task2); EXPECT_TRUE(task2.result()); @@ -101,7 +126,10 @@ })); // Now it should fail to import another copy of the same catalog. - ImportCatalogTask task3(store(), kVersionToken, std::make_unique<Catalog>()); + ImportCatalogTask task3( + store(), kVersionToken, std::make_unique<Catalog>(), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task3); EXPECT_TRUE(task3.complete()); EXPECT_FALSE(task3.result()); @@ -125,11 +153,16 @@ gmail->set_site_url(kGmailUrl); gmail->set_icon(kIcon); - ImportCatalogTask task(store(), kVersionToken, std::move(catalog)); + ImportCatalogTask task( + store(), kVersionToken, std::move(catalog), + base::BindOnce(&ExploreSitesImportCatalogTaskTest::OnImportTaskDone, + base::Unretained(this))); RunTask(&task); EXPECT_TRUE(task.complete()); EXPECT_TRUE(task.result()); + EXPECT_TRUE(success()); + EXPECT_TRUE(callback_called()); ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { sql::Statement cat_count_s(
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 9e5b5c0..341a5366 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -192,6 +192,7 @@ #include "services/service_manager/embedder/main_delegate.h" #include "services/service_manager/public/cpp/connector.h" #include "third_party/blink/public/common/experiments/memory_ablation_experiment.h" +#include "third_party/widevine/cdm/buildflags.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" @@ -548,9 +549,9 @@ RegisterPepperFlashComponent(cus); #endif // !defined(OS_ANDROID) -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) +#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) RegisterWidevineCdmComponent(cus); -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) +#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_NACL) && !defined(OS_ANDROID) #if defined(OS_CHROMEOS)
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 123e53fa..0451655 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -289,6 +289,7 @@ #include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" #include "third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom.h" #include "third_party/blink/public/platform/modules/webshare/webshare.mojom.h" +#include "third_party/widevine/cdm/buildflags.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_features.h" @@ -297,8 +298,6 @@ #include "url/gurl.h" #include "url/origin.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - #if defined(OS_WIN) #include "base/strings/string_tokenizer.h" #include "chrome/browser/chrome_browser_main_win.h" @@ -498,7 +497,7 @@ #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "chrome/browser/media/output_protection_impl.h" #include "chrome/browser/media/platform_verification_impl.h" -#if defined(OS_WIN) && defined(WIDEVINE_CDM_AVAILABLE) +#if defined(OS_WIN) && BUILDFLAG(ENABLE_WIDEVINE) #include "chrome/browser/media/widevine_hardware_caps_win.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" #endif @@ -4147,7 +4146,7 @@ base::flat_set<media::VideoCodec>* video_codecs, base::flat_set<media::EncryptionMode>* encryption_schemes) { #if defined(OS_WIN) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && \ - defined(WIDEVINE_CDM_AVAILABLE) + BUILDFLAG(ENABLE_WIDEVINE) if (key_system == kWidevineKeySystem) { GetWidevineHardwareCaps(cdm_proxy_protocols, video_codecs, encryption_schemes);
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index e393da2..4618f1d 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -84,6 +84,7 @@ "//chromeos:cryptohome_signkey_proto", "//chromeos:login_manager_proto", "//chromeos:metrics_event_proto", + "//chromeos:oobe_config_proto", "//chromeos/assistant:buildflags", "//chromeos/components/drivefs", "//chromeos/components/drivefs/mojom",
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_delegate.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_delegate.cc index 8071c7af..f6c5a52c 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_delegate.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_delegate.cc
@@ -19,35 +19,12 @@ #include "extensions/browser/extension_host.h" #include "services/service_manager/public/cpp/connector.h" #include "third_party/blink/public/platform/web_mouse_event.h" -#include "ui/aura/client/screen_position_client.h" -#include "ui/aura/env.h" -#include "ui/aura/window.h" -#include "ui/aura/window_tree_host.h" #include "ui/content_accelerators/accelerator_util.h" -#include "ui/display/display.h" #include "ui/events/blink/web_input_event.h" #include "ui/events/event.h" -#include "ui/events/event_sink.h" namespace chromeos { -namespace { - -gfx::PointF GetScreenLocationFromEvent(const ui::LocatedEvent& event) { - aura::Window* root = - static_cast<aura::Window*>(event.target())->GetRootWindow(); - aura::client::ScreenPositionClient* spc = - aura::client::GetScreenPositionClient(root); - if (!spc) - return event.root_location_f(); - - gfx::PointF screen_location(event.root_location_f()); - spc->ConvertPointToScreen(root, &screen_location); - return screen_location; -} - -} // namespace - SelectToSpeakEventHandlerDelegate::SelectToSpeakEventHandlerDelegate() : binding_(this) { // Connect to ash's AccessibilityController interface. @@ -96,9 +73,7 @@ return; const ui::MouseEvent* mouse_event = event->AsMouseEvent(); - const blink::WebMouseEvent web_event = ui::MakeWebMouseEvent( - *mouse_event, base::BindRepeating(&GetScreenLocationFromEvent)); - rvh->GetWidget()->ForwardMouseEvent(web_event); + rvh->GetWidget()->ForwardMouseEvent(ui::MakeWebMouseEvent(*mouse_event)); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc index 88e2727..af53109 100644 --- a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "base/bind.h" #include "base/sha1.h" #include "chrome/browser/chromeos/arc/extensions/fake_arc_support.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" @@ -130,7 +131,8 @@ // BrowserWithTestWindowTest: TestingProfile::TestingFactories GetTestingFactories() override { - return {{ConsentAuditorFactory::GetInstance(), BuildFakeConsentAuditor}}; + return {{ConsentAuditorFactory::GetInstance(), + base::BindRepeating(&BuildFakeConsentAuditor)}}; } private:
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc index 81a503eb..4038361d 100644 --- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc +++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_default_negotiator_unittest.cc
@@ -97,7 +97,8 @@ // BrowserWithTestWindowTest: TestingProfile::TestingFactories GetTestingFactories() override { - return {{ConsentAuditorFactory::GetInstance(), BuildFakeConsentAuditor}}; + return {{ConsentAuditorFactory::GetInstance(), + base::BindRepeating(&BuildFakeConsentAuditor)}}; } private:
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc index 6aa6364..76cf915a 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -1199,20 +1199,24 @@ } vm_tools::concierge::StartVmResponse response = reply.value(); - if (!response.success()) { + if (response.status() == vm_tools::concierge::VM_STATUS_FAILURE || + response.status() == vm_tools::concierge::VM_STATUS_UNKNOWN) { LOG(ERROR) << "Failed to start VM: " << response.failure_reason(); std::move(callback).Run(ConciergeClientResult::VM_START_FAILED); return; } // If the vm is already marked "running" run the callback. - if (IsVmRunning(vm_name)) { + if (response.status() == vm_tools::concierge::VM_STATUS_RUNNING) { + running_vms_[vm_name] = + std::make_pair(VmState::STARTED, std::move(response.vm_info())); std::move(callback).Run(ConciergeClientResult::SUCCESS); return; } // Otherwise, record the container start and run the callback after the VM // starts. + DCHECK_EQ(response.status(), vm_tools::concierge::VM_STATUS_STARTING); VLOG(1) << "Awaiting TremplinStartedSignal for " << owner_id_ << ", " << vm_name; running_vms_[vm_name] =
diff --git a/chrome/browser/chromeos/crostini/crostini_share_path_unittest.cc b/chrome/browser/chromeos/crostini/crostini_share_path_unittest.cc index 95e42850..ab8cbcd0 100644 --- a/chrome/browser/chromeos/crostini/crostini_share_path_unittest.cc +++ b/chrome/browser/chromeos/crostini/crostini_share_path_unittest.cc
@@ -150,7 +150,7 @@ TEST_F(CrostiniSharePathTest, Success) { vm_tools::concierge::StartVmResponse start_vm_response; - start_vm_response.set_success(true); + start_vm_response.set_status(vm_tools::concierge::VM_STATUS_RUNNING); start_vm_response.mutable_vm_info()->set_seneschal_server_handle(123); fake_concierge_client_->set_start_vm_response(start_vm_response); @@ -164,7 +164,7 @@ TEST_F(CrostiniSharePathTest, SharePathErrorSeneschal) { vm_tools::concierge::StartVmResponse start_vm_response; - start_vm_response.set_success(true); + start_vm_response.set_status(vm_tools::concierge::VM_STATUS_RUNNING); start_vm_response.mutable_vm_info()->set_seneschal_server_handle(123); fake_concierge_client_->set_start_vm_response(start_vm_response);
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc index 39eaecb..d2900b9 100644 --- a/chrome/browser/chromeos/drive/drive_integration_service.cc +++ b/chrome/browser/chromeos/drive/drive_integration_service.cc
@@ -129,6 +129,22 @@ } } +base::FilePath FindUniquePath(const base::FilePath& base_name) { + auto target = base_name; + for (int uniquifier = 1; base::PathExists(target); ++uniquifier) { + target = base_name.InsertBeforeExtensionASCII( + base::StringPrintf(" (%d)", uniquifier)); + } + return target; +} + +base::FilePath GetRecoveredFilesPath( + const base::FilePath& downloads_directory) { + const std::string& dest_directory_name = l10n_util::GetStringUTF8( + IDS_FILE_BROWSER_RECOVERED_FILES_FROM_GOOGLE_DRIVE_DIRECTORY_NAME); + return FindUniquePath(downloads_directory.Append(dest_directory_name)); +} + // Initializes FileCache and ResourceMetadata. // Must be run on the same task runner used by |cache| and |resource_metadata|. FileError InitializeMetadata( @@ -170,6 +186,13 @@ base::FILE_PERMISSION_EXECUTE_BY_GROUP | base::FILE_PERMISSION_EXECUTE_BY_OTHERS); + // If attempting to migrate to DriveFS without previous Drive sync data + // present, skip the migration. + if (base::IsDirectoryEmpty(cache_root_directory.Append(kMetadataDirectory)) && + !cache) { + return FILE_ERROR_FAILED; + } + internal::ResourceMetadataStorage::UpgradeOldDB( metadata_storage->directory_path()); @@ -190,15 +213,7 @@ if (metadata_storage->cache_file_scan_is_needed()) { // Generate unique directory name. - const std::string& dest_directory_name = l10n_util::GetStringUTF8( - IDS_FILE_BROWSER_RECOVERED_FILES_FROM_GOOGLE_DRIVE_DIRECTORY_NAME); - base::FilePath dest_directory = downloads_directory.Append( - base::FilePath::FromUTF8Unsafe(dest_directory_name)); - for (int uniquifier = 1; base::PathExists(dest_directory); ++uniquifier) { - dest_directory = downloads_directory.Append( - base::FilePath::FromUTF8Unsafe(dest_directory_name)) - .InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", uniquifier)); - } + auto dest_directory = GetRecoveredFilesPath(downloads_directory); internal::ResourceMetadataStorage::RecoveredCacheInfoMap recovered_cache_info; @@ -257,21 +272,74 @@ return path; } +// Recover any dirty files in GCache/v1 to a recovered files directory in +// Downloads. This imitates the behavior of recovering cache files when database +// corruption occurs; however, in this case, we have an intact database so can +// use the exact file names, potentially with uniquifiers added since the +// directory structure is discarded. +void RecoverDirtyFiles( + const base::FilePath& cache_directory, + const base::FilePath& downloads_directory, + const std::vector<std::pair<base::FilePath, std::string>>& dirty_files) { + if (dirty_files.empty()) { + return; + } + auto recovery_directory = GetRecoveredFilesPath(downloads_directory); + if (!base::CreateDirectory(recovery_directory)) { + return; + } + for (auto& dirty_file : dirty_files) { + auto target_path = + FindUniquePath(recovery_directory.Append(dirty_file.first.BaseName())); + base::Move(cache_directory.Append(dirty_file.second), target_path); + } +} + +// Remove the data used by the old Drive client, first moving any dirty files +// into the user's Downloads. +void CleanupGCacheV1( + const base::FilePath& cache_directory, + const base::FilePath& downloads_directory, + std::vector<std::pair<base::FilePath, std::string>> dirty_files) { + RecoverDirtyFiles(cache_directory.Append(kCacheFileDirectory), + downloads_directory, dirty_files); + DeleteDirectoryContents(cache_directory); +} + std::vector<base::FilePath> GetPinnedFiles( - internal::ResourceMetadataStorage* metadata_storage) { + std::unique_ptr<internal::ResourceMetadataStorage, util::DestroyHelper> + metadata_storage, + base::FilePath cache_directory, + base::FilePath downloads_directory) { std::vector<base::FilePath> pinned_files; + std::vector<std::pair<base::FilePath, std::string>> dirty_files; for (auto it = metadata_storage->GetIterator(); !it->IsAtEnd(); it->Advance()) { const auto& value = it->GetValue(); - if (!value.has_file_specific_info() || - !value.file_specific_info().cache_state().is_pinned()) { + if (!value.has_file_specific_info()) { continue; } - auto path = GetFullPath(metadata_storage, value); - if (!path.empty()) { - pinned_files.push_back(std::move(path)); + const auto& info = value.file_specific_info(); + if (info.cache_state().is_pinned()) { + auto path = GetFullPath(metadata_storage.get(), value); + if (!path.empty()) { + pinned_files.push_back(std::move(path)); + } + } + if (info.cache_state().is_dirty()) { + dirty_files.push_back(std::make_pair( + GetFullPath(metadata_storage.get(), value), value.local_id())); } } + // Destructing |metadata_storage| requires a posted task to run, so defer + // deleting its data until after it's been destructed. This also returns the + // list of files to pin to the UI thread without waiting for the remaining + // data to be cleared. + metadata_storage.reset(); + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&CleanupGCacheV1, std::move(cache_directory), + std::move(downloads_directory), std::move(dirty_files))); return pinned_files; } @@ -908,6 +976,12 @@ if (error != FILE_ERROR_OK) { profile_->GetPrefs()->SetBoolean(prefs::kDriveFsPinnedMigrated, true); metadata_storage_.reset(); + blocking_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &CleanupGCacheV1, cache_root_directory_, base::FilePath(), + std::vector<std::pair<base::FilePath, std::string>>())); + metadata_storage_.reset(); } state_ = INITIALIZED; if (enabled_) @@ -931,6 +1005,11 @@ return; } + // Reset the pref so any migration to DriveFS is performed again the next time + // DriveFS is enabled. This is necessary to ensure any newly-pinned files are + // migrated and any dirty files are recovered whenever switching to DriveFS. + profile_->GetPrefs()->ClearPref(prefs::kDriveFsPinnedMigrated); + // Initialize Download Handler for hooking downloads to the Drive folder. content::DownloadManager* download_manager = g_browser_process->download_status_updater() @@ -1004,7 +1083,9 @@ base::PostTaskAndReplyWithResult( blocking_task_runner_.get(), FROM_HERE, - base::BindOnce(&GetPinnedFiles, metadata_storage_.get()), + base::BindOnce( + &GetPinnedFiles, std::move(metadata_storage_), cache_root_directory_, + file_manager::util::GetDownloadsFolderForProfile(profile_)), base::BindOnce(&DriveIntegrationService::PinFiles, weak_ptr_factory_.GetWeakPtr())); } @@ -1018,7 +1099,6 @@ GetDriveFsInterface()->SetPinned(path, true, base::DoNothing()); } profile_->GetPrefs()->SetBoolean(prefs::kDriveFsPinnedMigrated, true); - metadata_storage_.reset(); } //===================== DriveIntegrationServiceFactory =======================
diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc index 32a92c93..193fdff 100644 --- a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc +++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc
@@ -187,7 +187,7 @@ TestingProfile::TestingFactories GetTestingFactories() override { return {{EasyUnlockServiceFactory::GetInstance(), - &CreateEasyUnlockServiceForTest}}; + base::BindRepeating(&CreateEasyUnlockServiceForTest)}}; } // If a mode change event is raised, fail the test.
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 04a1c0d..c9473e2a 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -344,6 +344,7 @@ ::testing::Values(TestCase("openQuickView"), TestCase("openQuickView").InGuestMode(), TestCase("openQuickView").TabletMode(), + TestCase("openQuickViewScrollText"), TestCase("openQuickViewDrive"), TestCase("openQuickViewDrive").EnableDriveFs(), TestCase("openQuickViewUsb"), @@ -803,6 +804,10 @@ .starts_with("PRE"); } + base::FilePath GetDriveDataDirectory() { + return profile()->GetPath().Append("drive/v1"); + } + private: std::string test_case_name_; @@ -817,6 +822,28 @@ IN_PROC_BROWSER_TEST_F(DriveFsFilesAppBrowserTest, MigratePinnedFiles) { set_test_case_name("driveMigratePinnedFile"); StartTest(); + + EXPECT_TRUE(base::IsDirectoryEmpty(GetDriveDataDirectory())); +} + +IN_PROC_BROWSER_TEST_F(DriveFsFilesAppBrowserTest, PRE_RecoverDirtyFiles) { + set_test_case_name("PRE_driveRecoverDirtyFiles"); + StartTest(); + + // Create a non-dirty file in the cache. + base::WriteFile(GetDriveDataDirectory().Append("files/foo"), "data", 4); +} + +IN_PROC_BROWSER_TEST_F(DriveFsFilesAppBrowserTest, RecoverDirtyFiles) { + set_test_case_name("driveRecoverDirtyFiles"); + StartTest(); + + EXPECT_TRUE(base::IsDirectoryEmpty(GetDriveDataDirectory())); +} + +IN_PROC_BROWSER_TEST_F(DriveFsFilesAppBrowserTest, LaunchWithoutOldDriveData) { + // After starting up, GCache/v1 should still be empty. + EXPECT_TRUE(base::IsDirectoryEmpty(GetDriveDataDirectory())); } } // namespace file_manager
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 89f73a4..5578cae 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -804,8 +804,8 @@ EXPECT_FALSE(integration_service_); integration_service_ = new drive::DriveIntegrationService( - profile, nullptr, fake_drive_service_, std::string(), root_path(), - nullptr, CreateDriveFsConnectionDelegate()); + profile, nullptr, fake_drive_service_, std::string(), + root_path().Append("v1"), nullptr, CreateDriveFsConnectionDelegate()); return integration_service_; } @@ -881,7 +881,7 @@ } void InitializeFakeDriveFs() { - fake_drivefs_ = std::make_unique<drivefs::FakeDriveFs>(root_path()); + fake_drivefs_ = std::make_unique<drivefs::FakeDriveFs>(mount_path()); fake_drivefs_->RegisterMountingForAccountId(base::BindRepeating( [](Profile* profile) { auto* user = @@ -933,14 +933,16 @@ const AddEntriesMessage::TestEntryInfo& entry) { const base::FilePath target_path = GetTargetPathForTestEntry(entry); base::FilePath drive_path("/"); - CHECK(root_path().AppendRelativePath(target_path, &drive_path)); + CHECK(mount_path().AppendRelativePath(target_path, &drive_path)); return drive_path; } - base::FilePath GetMyDrivePath() { return root_path().Append("root"); } + base::FilePath mount_path() { return root_path().Append("v2"); } + + base::FilePath GetMyDrivePath() { return mount_path().Append("root"); } base::FilePath GetTeamDriveGrandRoot() { - return root_path().Append("team_drives"); + return mount_path().Append("team_drives"); } base::FilePath GetTeamDrivePath(const std::string& team_drive_name) { @@ -1372,6 +1374,12 @@ kPredefinedProfileSalt); drive_volumes_[profile->GetOriginalProfile()] = std::make_unique<DriveFsTestVolume>(profile->GetOriginalProfile()); + if (!IsIncognitoModeTest()) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(base::IgnoreResult(&LocalTestVolume::Mount), + base::Unretained(local_volume_.get()), profile)); + } } else { drive_volumes_[profile->GetOriginalProfile()] = std::make_unique<DriveTestVolume>();
diff --git a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc index 38962535..6a49572 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc
@@ -203,8 +203,14 @@ ScreenLocker::HandleShowLockScreenRequest(); } +// Flaky on Linux Chromium OS ASan LSan (https://crbug.com/889782) +#if defined(ADDRESS_SANITIZER) +#define MAYBE_TestFullscreenExit DISABLED_TestFullscreenExit +#else +#define MAYBE_TestFullscreenExit TestFullscreenExit +#endif // Test how locking the screen affects an active fullscreen window. -IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, TestFullscreenExit) { +IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, MAYBE_TestFullscreenExit) { // WebUiScreenLockerTest fails with Mash because of unexpected window // structure. Fortunately we will deprecate the WebUI-based screen locker // soon, so it is okay to skip it. See https://crbug.com/888779
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager.cc b/chrome/browser/chromeos/login/users/chrome_user_manager.cc index ad3ee13a..d404f21 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager.cc
@@ -5,11 +5,49 @@ #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" #include "base/command_line.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" +#include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" +#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chromeos/chromeos_switches.h" +#include "chromeos/login/login_state.h" +#include "chromeos/settings/cros_settings_names.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/policy_constants.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" +#include "components/user_manager/user_names.h" +#include "components/user_manager/user_type.h" namespace chromeos { +namespace { + +bool IsManagedSessionEnabled(const user_manager::User* active_user) { + // If the service doesn't exist or the policy is not set, enable managed + // session by default. + const bool managed_session_enabled_by_default = true; + + policy::DeviceLocalAccountPolicyService* service = + g_browser_process->platform_part() + ->browser_policy_connector_chromeos() + ->GetDeviceLocalAccountPolicyService(); + if (!service) + return managed_session_enabled_by_default; + + const policy::PolicyMap::Entry* entry = + service->GetBrokerForUser(active_user->GetAccountId().GetUserEmail()) + ->core() + ->store() + ->policy_map() + .Get(policy::key::kDeviceLocalAccountManagedSessionEnabled); + + if (!entry) + return managed_session_enabled_by_default; + + return entry && entry->value && entry->value->GetBool(); +} + +} // namespace ChromeUserManager::ChromeUserManager( scoped_refptr<base::TaskRunner> task_runner) @@ -25,6 +63,69 @@ return UserManagerBase::IsCurrentUserNew(); } +void ChromeUserManager::UpdateLoginState(const user_manager::User* active_user, + const user_manager::User* primary_user, + bool is_current_user_owner) const { + using chromeos::LoginState; + if (!LoginState::IsInitialized()) + return; // LoginState may be uninitialized in tests. + + chromeos::LoginState::LoggedInState logged_in_state; + logged_in_state = active_user ? chromeos::LoginState::LOGGED_IN_ACTIVE + : chromeos::LoginState::LOGGED_IN_NONE; + + chromeos::LoginState::LoggedInUserType login_user_type; + if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE; + } else if (is_current_user_owner) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER; + } else if (active_user->GetType() == user_manager::USER_TYPE_GUEST) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST; + } else if (active_user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { + login_user_type = + IsManagedSessionEnabled(active_user) + ? chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT_MANAGED + : chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; + } else if (active_user->GetType() == user_manager::USER_TYPE_SUPERVISED) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED; + } else if (active_user->GetType() == user_manager::USER_TYPE_KIOSK_APP) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP; + } else if (active_user->GetType() == user_manager::USER_TYPE_ARC_KIOSK_APP) { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_ARC_KIOSK_APP; + } else { + login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR; + } + + if (primary_user) { + LoginState::Get()->SetLoggedInStateAndPrimaryUser( + logged_in_state, login_user_type, primary_user->username_hash()); + } else { + LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); + } +} + +bool ChromeUserManager::GetPlatformKnownUserId( + const std::string& user_email, + const std::string& gaia_id, + AccountId* out_account_id) const { + if (user_email == user_manager::kStubUserEmail) { + *out_account_id = user_manager::StubAccountId(); + return true; + } + + if (user_email == user_manager::kStubAdUserEmail) { + *out_account_id = user_manager::StubAdAccountId(); + return true; + } + + if (user_email == user_manager::kGuestUserName) { + *out_account_id = user_manager::GuestAccountId(); + return true; + } + + return false; +} + // static ChromeUserManager* ChromeUserManager::Get() { user_manager::UserManager* user_manager = user_manager::UserManager::Get();
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager.h b/chrome/browser/chromeos/login/users/chrome_user_manager.h index 075ec7c..ac9ca35 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager.h +++ b/chrome/browser/chromeos/login/users/chrome_user_manager.h
@@ -25,6 +25,12 @@ // user_manager::UserManagerBase: bool IsCurrentUserNew() const override; + void UpdateLoginState(const user_manager::User* active_user, + const user_manager::User* primary_user, + bool is_current_user_owner) const override; + bool GetPlatformKnownUserId(const std::string& user_email, + const std::string& gaia_id, + AccountId* out_account_id) const override; // Returns current ChromeUserManager or NULL if instance hasn't been // yet initialized.
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc index 42e5e3c..be121b6 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -1263,16 +1263,38 @@ } bool ChromeUserManagerImpl::AreSupervisedUsersAllowed() const { - return chrome_user_manager_util::AreSupervisedUsersAllowed(cros_settings_); + bool supervised_users_allowed = false; + cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, + &supervised_users_allowed); + return supervised_users_allowed; } bool ChromeUserManagerImpl::IsGuestSessionAllowed() const { - return chrome_user_manager_util::IsGuestSessionAllowed(cros_settings_); + const AccountId& owner_account_id = GetOwnerAccountId(); + if (owner_account_id.is_valid()) { + // Some Autotest policy tests appear to wipe the user list in Local State + // but preserve a policy file referencing an owner: https://crbug.com/850139 + const user_manager::User* owner_user = FindUser(owner_account_id); + if (owner_user && + owner_user->GetType() == user_manager::UserType::USER_TYPE_CHILD) { + return false; + } + } + + // In tests CrosSettings might not be initialized. + if (!cros_settings_) + return false; + + bool is_guest_allowed = false; + cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &is_guest_allowed); + return is_guest_allowed; } bool ChromeUserManagerImpl::IsGaiaUserAllowed( const user_manager::User& user) const { - return chrome_user_manager_util::IsGaiaUserAllowed(user, cros_settings_); + DCHECK(user.HasGaiaAccount()); + return cros_settings_->IsUserWhitelisted(user.GetAccountId().GetUserEmail(), + nullptr); } void ChromeUserManagerImpl::OnMinimumVersionStateChanged() { @@ -1281,7 +1303,15 @@ bool ChromeUserManagerImpl::IsUserAllowed( const user_manager::User& user) const { - return chrome_user_manager_util::IsUserAllowed(user, cros_settings_); + DCHECK(user.GetType() == user_manager::USER_TYPE_REGULAR || + user.GetType() == user_manager::USER_TYPE_GUEST || + user.GetType() == user_manager::USER_TYPE_SUPERVISED || + user.GetType() == user_manager::USER_TYPE_CHILD); + + return chrome_user_manager_util::IsUserAllowed( + user, AreSupervisedUsersAllowed(), IsGuestSessionAllowed(), + user.HasGaiaAccount() && IsGaiaUserAllowed(user), + GetMinimumVersionPolicyHandler()->RequirementsAreSatisfied()); } UserFlow* ChromeUserManagerImpl::GetDefaultUserFlow() const { @@ -1407,22 +1437,6 @@ base::Value(FullyCanonicalize(account_id.GetUserEmail())), NULL); } -void ChromeUserManagerImpl::UpdateLoginState( - const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner) const { - chrome_user_manager_util::UpdateLoginState(active_user, primary_user, - is_current_user_owner); -} - -bool ChromeUserManagerImpl::GetPlatformKnownUserId( - const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id) const { - return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, - out_account_id); -} - const AccountId& ChromeUserManagerImpl::GetGuestAccountId() const { return user_manager::GuestAccountId(); }
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h index dbee25b..2f8c225 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.h
@@ -102,12 +102,6 @@ bool IsGuestSessionAllowed() const override; bool IsGaiaUserAllowed(const user_manager::User& user) const override; bool IsUserAllowed(const user_manager::User& user) const override; - void UpdateLoginState(const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner) const override; - bool GetPlatformKnownUserId(const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id) const override; const AccountId& GetGuestAccountId() const override; bool IsFirstExecAfterBoot() const override; void AsyncRemoveCryptohome(const AccountId& account_id) const override;
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_util.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_util.cc index 60060cae..b2550bd 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_util.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_util.cc
@@ -5,16 +5,10 @@ #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" #include "base/values.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/browser_process_platform_part_chromeos.h" -#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" -#include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" #include "chrome/browser/chromeos/policy/minimum_version_policy_handler.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/device_settings_provider.h" #include "chromeos/settings/cros_settings_names.h" -#include "components/policy/core/common/cloud/cloud_policy_core.h" -#include "components/policy/core/common/cloud/cloud_policy_store.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/policy_constants.h" #include "components/prefs/pref_value_map.h" @@ -24,206 +18,76 @@ namespace chromeos { namespace chrome_user_manager_util { -namespace { -// Checks if constraint defined by minimum version policy is satisfied. -bool MinVersionConstraintsSatisfied() { - return g_browser_process->platform_part() - ->browser_policy_connector_chromeos() - ->GetMinimumVersionPolicyHandler() - ->RequirementsAreSatisfied(); -} -bool IsUserAllowedInner(const user_manager::User& user, - bool supervised_users_allowed, - bool is_guest_allowed, - bool is_user_whitelisted) { - if (user.GetType() == user_manager::USER_TYPE_GUEST && !is_guest_allowed) - return false; - if (user.GetType() == user_manager::USER_TYPE_SUPERVISED && - !supervised_users_allowed) - return false; - if (user.HasGaiaAccount() && !is_user_whitelisted) - return false; - if (!MinVersionConstraintsSatisfied() && - user.GetType() != user_manager::USER_TYPE_GUEST) - return false; +bool AreAllUsersAllowed(const user_manager::UserList& users, + const enterprise_management::ChromeDeviceSettingsProto& + device_settings_proto) { + PrefValueMap decoded_policies; + DeviceSettingsProvider::DecodePolicies(device_settings_proto, + &decoded_policies); + + bool supervised_users_allowed = false; + decoded_policies.GetBoolean(kAccountsPrefSupervisedUsersEnabled, + &supervised_users_allowed); + + bool is_guest_allowed = false; + decoded_policies.GetBoolean(kAccountsPrefAllowGuest, &is_guest_allowed); + + const base::Value* value; + const base::ListValue* whitelist; + if (decoded_policies.GetValue(kAccountsPrefUsers, &value)) { + value->GetAsList(&whitelist); + } + + bool allow_new_user = false; + decoded_policies.GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); + + std::string min_chrome_version_string; + decoded_policies.GetString(kMinimumRequiredChromeVersion, + &min_chrome_version_string); + bool are_min_version_requirements_satisfied = + policy::MinimumVersionPolicyHandler::AreRequirementsSatisfied( + min_chrome_version_string); + + for (user_manager::User* user : users) { + bool is_user_whitelisted = + user->HasGaiaAccount() && + CrosSettings::FindEmailInList( + whitelist, user->GetAccountId().GetUserEmail(), nullptr); + if (!IsUserAllowed( + *user, supervised_users_allowed, is_guest_allowed, + user->HasGaiaAccount() && (allow_new_user || is_user_whitelisted), + are_min_version_requirements_satisfied)) + return false; + } return true; } -bool IsManagedSessionEnabled(const user_manager::User* active_user) { - // If the service doesn't exist or the policy is not set, enable managed - // session by default. - const bool managed_session_enabled_by_default = true; +bool IsUserAllowed(const user_manager::User& user, + bool supervised_users_allowed, + bool is_guest_allowed, + bool is_user_whitelisted, + bool are_min_version_constraints_satisfied) { + DCHECK(user.GetType() == user_manager::USER_TYPE_REGULAR || + user.GetType() == user_manager::USER_TYPE_GUEST || + user.GetType() == user_manager::USER_TYPE_SUPERVISED || + user.GetType() == user_manager::USER_TYPE_CHILD); - policy::DeviceLocalAccountPolicyService* service = - g_browser_process->platform_part() - ->browser_policy_connector_chromeos() - ->GetDeviceLocalAccountPolicyService(); - - if (!service) - return managed_session_enabled_by_default; - - const policy::PolicyMap::Entry* entry = - service->GetBrokerForUser(active_user->GetAccountId().GetUserEmail()) - ->core() - ->store() - ->policy_map() - .Get(policy::key::kDeviceLocalAccountManagedSessionEnabled); - - if (!entry) - return managed_session_enabled_by_default; - - return entry && entry->value && entry->value->GetBool(); -} - -} // namespace - -bool GetPlatformKnownUserId(const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id) { - if (user_email == user_manager::kStubUserEmail) { - *out_account_id = user_manager::StubAccountId(); - return true; - } - - if (user_email == user_manager::kStubAdUserEmail) { - *out_account_id = user_manager::StubAdAccountId(); - return true; - } - - if (user_email == user_manager::kGuestUserName) { - *out_account_id = user_manager::GuestAccountId(); - return true; - } - - return false; -} - -void UpdateLoginState(const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner) { - if (!chromeos::LoginState::IsInitialized()) - return; // LoginState may not be initialized in tests. - - chromeos::LoginState::LoggedInState logged_in_state; - logged_in_state = active_user ? chromeos::LoginState::LOGGED_IN_ACTIVE - : chromeos::LoginState::LOGGED_IN_NONE; - - chromeos::LoginState::LoggedInUserType login_user_type; - if (logged_in_state == chromeos::LoginState::LOGGED_IN_NONE) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_NONE; - } else if (is_current_user_owner) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_OWNER; - } else if (active_user->GetType() == user_manager::USER_TYPE_GUEST) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_GUEST; - } else if (active_user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { - login_user_type = - IsManagedSessionEnabled(active_user) - ? chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT_MANAGED - : chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT; - } else if (active_user->GetType() == user_manager::USER_TYPE_SUPERVISED) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_SUPERVISED; - } else if (active_user->GetType() == user_manager::USER_TYPE_KIOSK_APP) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_KIOSK_APP; - } else if (active_user->GetType() == user_manager::USER_TYPE_ARC_KIOSK_APP) { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_ARC_KIOSK_APP; - } else { - login_user_type = chromeos::LoginState::LOGGED_IN_USER_REGULAR; - } - - if (primary_user) { - chromeos::LoginState::Get()->SetLoggedInStateAndPrimaryUser( - logged_in_state, login_user_type, primary_user->username_hash()); - } else { - chromeos::LoginState::Get()->SetLoggedInState(logged_in_state, - login_user_type); - } -} - -bool AreSupervisedUsersAllowed(const CrosSettings* cros_settings) { - bool supervised_users_allowed = false; - cros_settings->GetBoolean(kAccountsPrefSupervisedUsersEnabled, - &supervised_users_allowed); - return supervised_users_allowed; -} - -bool IsGuestSessionAllowed(const CrosSettings* cros_settings) { - const AccountId& owner_account_id = - user_manager::UserManager::Get()->GetOwnerAccountId(); - if (owner_account_id.is_valid()) { - // Some Autotest policy tests appear to wipe the user list in Local State - // but preserve a policy file referencing an owner: https://crbug.com/850139 - const user_manager::User* owner_user = - user_manager::UserManager::Get()->FindUser(owner_account_id); - if (owner_user && - owner_user->GetType() == user_manager::UserType::USER_TYPE_CHILD) { - return false; - } - } - - // In tests CrosSettings might not be initialized. - if (!cros_settings) + if (user.GetType() == user_manager::USER_TYPE_GUEST && !is_guest_allowed) { return false; - - bool is_guest_allowed = false; - cros_settings->GetBoolean(kAccountsPrefAllowGuest, &is_guest_allowed); - return is_guest_allowed; -} - -bool IsGaiaUserAllowed(const user_manager::User& user, - const CrosSettings* cros_settings) { - DCHECK(user.HasGaiaAccount()); - return cros_settings->IsUserWhitelisted(user.GetAccountId().GetUserEmail(), - nullptr); -} - -bool IsUserAllowed(const user_manager::User& user, - const enterprise_management::ChromeDeviceSettingsProto& - device_settings_proto) { - DCHECK(user.GetType() == user_manager::USER_TYPE_REGULAR || - user.GetType() == user_manager::USER_TYPE_GUEST || - user.GetType() == user_manager::USER_TYPE_SUPERVISED || - user.GetType() == user_manager::USER_TYPE_CHILD); - - PrefValueMap prefs; - DeviceSettingsProvider::DecodePolicies(device_settings_proto, &prefs); - - bool supervised_users_allowed = false; - prefs.GetBoolean(kAccountsPrefSupervisedUsersEnabled, - &supervised_users_allowed); - - bool is_guest_allowed = false; - prefs.GetBoolean(kAccountsPrefAllowGuest, &is_guest_allowed); - - const base::Value* value; - const base::ListValue* list; - if (prefs.GetValue(kAccountsPrefUsers, &value)) { - value->GetAsList(&list); } - - bool is_user_whitelisted = - user.HasGaiaAccount() && - CrosSettings::FindEmailInList(list, user.GetAccountId().GetUserEmail(), - nullptr); - bool allow_new_user = false; - prefs.GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); - - return IsUserAllowedInner( - user, supervised_users_allowed, is_guest_allowed, - user.HasGaiaAccount() && (allow_new_user || is_user_whitelisted)); -} - -bool IsUserAllowed(const user_manager::User& user, - const CrosSettings* cros_settings) { - DCHECK(user.GetType() == user_manager::USER_TYPE_REGULAR || - user.GetType() == user_manager::USER_TYPE_GUEST || - user.GetType() == user_manager::USER_TYPE_SUPERVISED || - user.GetType() == user_manager::USER_TYPE_CHILD); - - return IsUserAllowedInner( - user, AreSupervisedUsersAllowed(cros_settings), - IsGuestSessionAllowed(cros_settings), - user.HasGaiaAccount() && IsGaiaUserAllowed(user, cros_settings)); + if (user.GetType() == user_manager::USER_TYPE_SUPERVISED && + !supervised_users_allowed) { + return false; + } + if (user.HasGaiaAccount() && !is_user_whitelisted) { + return false; + } + if (!are_min_version_constraints_satisfied && + user.GetType() != user_manager::USER_TYPE_GUEST) { + return false; + } + return true; } } // namespace chrome_user_manager_util
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_util.h b/chrome/browser/chromeos/login/users/chrome_user_manager_util.h index cfb3e09..e7c7359d 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_util.h +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_util.h
@@ -5,50 +5,29 @@ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_UTIL_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_UTIL_H_ -#include "chromeos/login/login_state.h" #include "components/policy/proto/chrome_device_policy.pb.h" #include "components/user_manager/user.h" -class AccountId; - namespace chromeos { - -class CrosSettings; - namespace chrome_user_manager_util { -// Implements user_manager::UserManager::GetPlatformKnownUserId for ChromeOS -bool GetPlatformKnownUserId(const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id); +// Returns true if all |users| are allowed depending on the provided device +// policies. Accepted user types: USER_TYPE_REGULAR, USER_TYPE_GUEST, +// USER_TYPE_SUPERVISED, USER_TYPE_CHILD. +// This function only checks against the device policies provided, so it does +// not depend on CrosSettings or any other policy store. +bool AreAllUsersAllowed(const user_manager::UserList& users, + const enterprise_management::ChromeDeviceSettingsProto& + device_settings_proto); -// Implements user_manager::UserManager::UpdateLoginState. -void UpdateLoginState(const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner); - -// Check if supervised users are allowed by provided cros settings. -bool AreSupervisedUsersAllowed(const CrosSettings* cros_settings); - -// Check if guest user is allowed by provided cros settings. -bool IsGuestSessionAllowed(const CrosSettings* cros_settings); - -// Check if the provided gaia user is allowed by provided cros settings. -bool IsGaiaUserAllowed(const user_manager::User& user, - const CrosSettings* cros_settings); - -// Returns true if |user| is allowed depending on provided device policies. +// Returns true if |user| is allowed, according to the given constraints. // Accepted user types: USER_TYPE_REGULAR, USER_TYPE_GUEST, // USER_TYPE_SUPERVISED, USER_TYPE_CHILD. bool IsUserAllowed(const user_manager::User& user, - const enterprise_management::ChromeDeviceSettingsProto& - device_settings_proto); - -// Returns true if |user| is allowed depending on provided cros settings. -// Accepted user types: USER_TYPE_REGULAR, USER_TYPE_GUEST, -// USER_TYPE_SUPERVISED, USER_TYPE_CHILD. -bool IsUserAllowed(const user_manager::User& user, - const CrosSettings* cros_settings); + bool supervised_users_allowed, + bool is_guest_allowed, + bool is_user_whitelisted, + bool are_min_version_constraints_satisfied); } // namespace chrome_user_manager_util } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc index 8ff86e6a..4110017 100644 --- a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc +++ b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc
@@ -315,26 +315,10 @@ return default_flow_.get(); } -void FakeChromeUserManager::UpdateLoginState( - const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner) const { - chrome_user_manager_util::UpdateLoginState(active_user, primary_user, - is_current_user_owner); -} - void FakeChromeUserManager::SetOwnerId(const AccountId& account_id) { UserManagerBase::SetOwnerId(account_id); } -bool FakeChromeUserManager::GetPlatformKnownUserId( - const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id) const { - return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, - out_account_id); -} - const AccountId& FakeChromeUserManager::GetGuestAccountId() const { return user_manager::GuestAccountId(); }
diff --git a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.h b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.h index 8539feb..84a0e293 100644 --- a/chrome/browser/chromeos/login/users/fake_chrome_user_manager.h +++ b/chrome/browser/chromeos/login/users/fake_chrome_user_manager.h
@@ -119,9 +119,6 @@ bool IsGaiaUserAllowed(const user_manager::User& user) const override; bool IsUserAllowed(const user_manager::User& user) const override; PrefService* GetLocalState() const override; - bool GetPlatformKnownUserId(const std::string& user_email, - const std::string& gaia_id, - AccountId* out_account_id) const override; const AccountId& GetGuestAccountId() const override; bool IsFirstExecAfterBoot() const override; void AsyncRemoveCryptohome(const AccountId& account_id) const override; @@ -158,9 +155,6 @@ void PublicAccountUserLoggedIn(user_manager::User* user) override; void SupervisedUserLoggedIn(const AccountId& account_id) override; void OnUserRemoved(const AccountId& account_id) override; - void UpdateLoginState(const user_manager::User* active_user, - const user_manager::User* primary_user, - bool is_current_user_owner) const override; void SetOwnerId(const AccountId& account_id) override; // UserManagerInterface override.
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc b/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc index ac22907..653b6ff 100644 --- a/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc +++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc
@@ -34,6 +34,22 @@ observers_.RemoveObserver(observer); } +// static +bool MinimumVersionPolicyHandler::AreRequirementsSatisfied( + const std::string& min_chrome_version_string) { + if (min_chrome_version_string.empty()) + return true; + + const base::Version required_version(min_chrome_version_string); + if (!required_version.IsValid()) { + LOG(ERROR) << "Version supplied by policy is not a valid version " + << required_version; + return true; + } + + return version_info::GetVersion().CompareTo(required_version) >= 0; +} + void MinimumVersionPolicyHandler::NotifyMinimumVersionStateChanged() { for (auto& observer : observers_) observer.OnMinimumVersionStateChanged(); @@ -47,22 +63,10 @@ if (status != chromeos::CrosSettingsProvider::TRUSTED) return; - requirements_met_ = true; std::string min_chrome_version_string; cros_settings_->GetString(chromeos::kMinimumRequiredChromeVersion, &min_chrome_version_string); - if (min_chrome_version_string.empty()) - return; - - const base::Version required_version(min_chrome_version_string); - if (!required_version.IsValid()) { - LOG(ERROR) << "Version supplied by policy is not a valid version " - << required_version; - return; - } - - requirements_met_ = - version_info::GetVersion().CompareTo(required_version) >= 0; + requirements_met_ = AreRequirementsSatisfied(min_chrome_version_string); NotifyMinimumVersionStateChanged(); }
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h index 53204553..62b2e40 100644 --- a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h +++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
@@ -31,6 +31,12 @@ void RemoveObserver(Observer* observer); bool RequirementsAreSatisfied() const { return requirements_met_; } + // Returns |true| if the requirements represented by the given + // |kMinimumRequiredChromeVersion| setting string are satisfied. + // Defaults to |true| if there are no requirements, or no valid requirements. + static bool AreRequirementsSatisfied( + const std::string& min_chrome_version_string); + private: void OnPolicyChanged();
diff --git a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc index 9057ed43..75f4cf8b 100644 --- a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc +++ b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "components/prefs/pref_value_map.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" @@ -79,21 +80,23 @@ user_manager::UserManager::Get(); const user_manager::UserList& logged_in_users = user_manager->GetLoggedInUsers(); - // If at least one logged in user won't be allowed after OffHours, - // the session will be terminated. + user_manager::UserList users_to_check; for (auto* user : logged_in_users) { - if (user->GetType() != user_manager::USER_TYPE_REGULAR && - user->GetType() != user_manager::USER_TYPE_GUEST && - user->GetType() != user_manager::USER_TYPE_SUPERVISED && - user->GetType() != user_manager::USER_TYPE_CHILD) { - continue; - } - if (!chromeos::chrome_user_manager_util::IsUserAllowed( - *user, device_settings_proto_)) { - return true; + if (user->GetType() == user_manager::USER_TYPE_REGULAR || + user->GetType() == user_manager::USER_TYPE_GUEST || + user->GetType() == user_manager::USER_TYPE_SUPERVISED || + user->GetType() == user_manager::USER_TYPE_CHILD) { + users_to_check.push_back(user); } } - return false; + + if (users_to_check.empty()) + return false; + + // If at least one logged in user won't be allowed after OffHours, + // the session will be terminated. + return !chromeos::chrome_user_manager_util::AreAllUsersAllowed( + users_to_check, device_settings_proto_); } void DeviceOffHoursController::UpdateOffHoursPolicy(
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc index a5f9f13..1b737b25 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc
@@ -151,13 +151,13 @@ new TestingProfileManager(TestingBrowserProcess::GetGlobal())); ASSERT_TRUE(profile_manager_->SetUp()); TestingProfile::TestingFactories factories; - factories.push_back( - std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), - BuildFakeProfileOAuth2TokenService)); + factories.emplace_back( + ProfileOAuth2TokenServiceFactory::GetInstance(), + base::BindRepeating(&BuildFakeProfileOAuth2TokenService)); profile_ = profile_manager_->CreateTestingProfile( chrome::kInitialProfile, std::unique_ptr<sync_preferences::PrefServiceSyncable>(), - base::UTF8ToUTF16(""), 0, std::string(), factories); + base::UTF8ToUTF16(""), 0, std::string(), std::move(factories)); // Usually the signin Profile and the main Profile are separate, but since // the signin Profile is an OTR Profile then for this test it suffices to // attach it to the main Profile.
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 60bb4e7..dca801b 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -43,16 +43,19 @@ #include "media/base/video_codecs.h" #include "media/cdm/cdm_proxy.h" #include "media/cdm/supported_cdm_versions.h" +#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT +#if !BUILDFLAG(ENABLE_WIDEVINE) +#error This file should only be compiled when Widevine is enabled +#endif using content::BrowserThread; using content::CdmRegistry; namespace component_updater { -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#if defined(WIDEVINE_CDM_IS_COMPONENT) namespace { @@ -241,6 +244,7 @@ // Temporary session is always supported. session_types->insert(media::CdmSessionType::kTemporary); + if (is_persistent_license_supported) session_types->insert(media::CdmSessionType::kPersistentLicense); @@ -511,14 +515,14 @@ absolute_cdm_install_dir, base::Passed(&manifest))); } -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#endif // defined(WIDEVINE_CDM_IS_COMPONENT) void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#if defined(WIDEVINE_CDM_IS_COMPONENT) auto installer = base::MakeRefCounted<ComponentInstaller>( std::make_unique<WidevineCdmComponentInstallerPolicy>()); installer->Register(cus, base::OnceClosure()); -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#endif // defined(WIDEVINE_CDM_IS_COMPONENT) } } // namespace component_updater
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index cca7d1a..8f5e772 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -54,6 +54,7 @@ #include "ppapi/buildflags/buildflags.h" #include "ppapi/shared_impl/ppapi_switches.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/widevine/cdm/buildflags.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" @@ -633,7 +634,7 @@ #endif } -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && BUILDFLAG(ENABLE_WIDEVINE) // Since the CDM is bundled and registered through the component updater, // we must re-enable the component updater. void SetUpDefaultCommandLine(base::CommandLine* command_line) override { @@ -642,7 +643,7 @@ test_launcher_utils::RemoveCommandLineSwitch( default_command_line, switches::kDisableComponentUpdate, command_line); } -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) && BUILDFLAG(ENABLE_WIDEVINE) void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded";
diff --git a/chrome/browser/download/download_core_service_impl.cc b/chrome/browser/download/download_core_service_impl.cc index 230d6b82..942024a 100644 --- a/chrome/browser/download/download_core_service_impl.cc +++ b/chrome/browser/download/download_core_service_impl.cc
@@ -68,10 +68,6 @@ download_provider_.reset(new DownloadOfflineContentProvider(manager)); -#if !defined(OS_ANDROID) - download_shelf_controller_.reset(new DownloadShelfController(profile_)); -#endif - // Include this download manager in the set monitored by the // global status updater. DCHECK(g_browser_process->download_status_updater());
diff --git a/chrome/browser/download/download_core_service_impl.h b/chrome/browser/download/download_core_service_impl.h index f153ca8..3b029b0 100644 --- a/chrome/browser/download/download_core_service_impl.h +++ b/chrome/browser/download/download_core_service_impl.h
@@ -13,10 +13,6 @@ #include "components/keyed_service/core/keyed_service.h" #include "extensions/buildflags/buildflags.h" -#if !defined(OS_ANDROID) -#include "chrome/browser/download/download_shelf_controller.h" -#endif - class ChromeDownloadManagerDelegate; class DownloadHistory; class DownloadOfflineContentProvider; @@ -72,10 +68,6 @@ // should be destroyed before the latter. std::unique_ptr<DownloadUIController> download_ui_; -#if !defined(OS_ANDROID) - std::unique_ptr<DownloadShelfController> download_shelf_controller_; -#endif - // The download provider is the responsible for supplying offline items to the // UI. std::unique_ptr<DownloadOfflineContentProvider> download_provider_;
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 9450df0..91a8eee1 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -114,15 +114,6 @@ // ----------------------------------------------------------------------------- // DownloadItemModel -// static -DownloadUIModel::DownloadUIModelPtr DownloadItemModel::Wrap( - download::DownloadItem* download) { - DownloadUIModel::DownloadUIModelPtr model( - new DownloadItemModel(download), - base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); - return model; -} - DownloadItemModel::DownloadItemModel(DownloadItem* download) : download_(download) { download_->AddObserver(this);
diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h index 624abd3b..9b8bcc1 100644 --- a/chrome/browser/download/download_item_model.h +++ b/chrome/browser/download/download_item_model.h
@@ -21,8 +21,6 @@ class DownloadItemModel : public DownloadUIModel, public download::DownloadItem::Observer { public: - static DownloadUIModelPtr Wrap(download::DownloadItem* download); - // Constructs a DownloadItemModel. The caller must ensure that |download| // outlives this object. explicit DownloadItemModel(download::DownloadItem* download);
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf.cc index 4503f1e1..4f15284 100644 --- a/chrome/browser/download/download_shelf.cc +++ b/chrome/browser/download/download_shelf.cc
@@ -17,19 +17,12 @@ #include "chrome/browser/download/download_core_service_factory.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_started_animation.h" -#include "chrome/browser/download/offline_item_model.h" -#include "chrome/browser/download/offline_item_model_manager.h" -#include "chrome/browser/download/offline_item_model_manager_factory.h" -#include "chrome/browser/download/offline_item_utils.h" -#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "components/download/public/common/download_item.h" -#include "components/offline_items_collection/core/offline_content_aggregator.h" -#include "components/offline_items_collection/core/offline_item.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/download_item_utils.h" #include "content/public/browser/download_manager.h" @@ -61,47 +54,6 @@ return static_cast<int>(255.0 * temp); } -void OnGetDownloadDoneForOfflineItem( - Profile* profile, - base::OnceCallback<void(DownloadUIModelPtr)> callback, - const base::Optional<OfflineItem>& offline_item) { - if (!offline_item.has_value()) - return; - - OfflineItemModelManager* manager = - OfflineItemModelManagerFactory::GetForBrowserContext(profile); - DownloadUIModelPtr model = - OfflineItemModel::Wrap(manager, offline_item.value()); - - std::move(callback).Run(std::move(model)); -} - -void GetDownload(Profile* profile, - ContentId id, - base::OnceCallback<void(DownloadUIModelPtr)> callback) { - if (!OfflineItemUtils::IsDownload(id)) { - content::DownloadManager* download_manager = - content::BrowserContext::GetDownloadManager(profile); - if (!download_manager) - return; - - DownloadItem* download = download_manager->GetDownloadByGuid(id.id); - if (!download) - return; - - DownloadUIModelPtr model = DownloadItemModel::Wrap(download); - std::move(callback).Run(std::move(model)); - } else { - offline_items_collection::OfflineContentAggregator* aggregator = - OfflineContentAggregatorFactory::GetForBrowserContext(profile); - if (!aggregator) - return; - - aggregator->GetItemById(id, base::BindOnce(&OnGetDownloadDoneForOfflineItem, - profile, std::move(callback))); - } -} - } // namespace DownloadShelf::DownloadShelf() @@ -180,19 +132,19 @@ PaintDownloadComplete(canvas, theme_provider, 1.0 - animation_progress); } -void DownloadShelf::AddDownload(DownloadUIModelPtr model) { - DCHECK(model); - if (model->ShouldRemoveFromShelfWhenComplete()) { +void DownloadShelf::AddDownload(DownloadItem* download) { + DCHECK(download); + if (DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) { // If we are going to remove the download from the shelf upon completion, // wait a few seconds to see if it completes quickly. If it's a small // download, then the user won't have time to interact with it. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&DownloadShelf::ShowDownloadById, - weak_ptr_factory_.GetWeakPtr(), model->GetContentId()), + weak_ptr_factory_.GetWeakPtr(), download->GetId()), GetTransientDownloadShowDelay()); } else { - ShowDownload(std::move(model)); + ShowDownload(download); } } @@ -236,26 +188,23 @@ return base::TimeDelta::FromSeconds(kDownloadShowDelayInSeconds); } -Profile* DownloadShelf::profile() const { - return browser() ? browser()->profile() : nullptr; +content::DownloadManager* DownloadShelf::GetDownloadManager() { + return content::BrowserContext::GetDownloadManager(browser()->profile()); } -void DownloadShelf::ShowDownload(DownloadUIModelPtr download) { +void DownloadShelf::ShowDownload(DownloadItem* download) { if (download->GetState() == DownloadItem::COMPLETE && - download->ShouldRemoveFromShelfWhenComplete()) + DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) return; - - if (!DownloadCoreServiceFactory::GetForBrowserContext(download->profile()) + if (!DownloadCoreServiceFactory::GetForBrowserContext( + content::DownloadItemUtils::GetBrowserContext(download)) ->IsShelfEnabled()) return; - bool should_show_download_started_animation = - download->ShouldShowDownloadStartedAnimation(); - if (is_hidden_) Unhide(); Open(); - DoAddDownload(std::move(download)); + DoAddDownload(download); // browser() can be NULL for tests. if (!browser()) @@ -269,15 +218,22 @@ // - Rich animations are enabled. content::WebContents* shelf_tab = browser()->tab_strip_model()->GetActiveWebContents(); - if (should_show_download_started_animation && shelf_tab && + if (DownloadItemModel(download).ShouldShowDownloadStartedAnimation() && + shelf_tab && platform_util::IsVisible(shelf_tab->GetNativeView()) && gfx::Animation::ShouldRenderRichAnimation()) { DownloadStartedAnimation::Show(shelf_tab); } } -void DownloadShelf::ShowDownloadById(ContentId id) { - GetDownload(profile(), id, - base::BindOnce(&DownloadShelf::ShowDownload, - weak_ptr_factory_.GetWeakPtr())); +void DownloadShelf::ShowDownloadById(int32_t download_id) { + content::DownloadManager* download_manager = GetDownloadManager(); + if (!download_manager) + return; + + DownloadItem* download = download_manager->GetDownload(download_id); + if (!download) + return; + + ShowDownload(download); }
diff --git a/chrome/browser/download/download_shelf.h b/chrome/browser/download/download_shelf.h index 33528535..4df9e43 100644 --- a/chrome/browser/download/download_shelf.h +++ b/chrome/browser/download/download_shelf.h
@@ -10,7 +10,6 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "build/build_config.h" -#include "chrome/browser/download/download_ui_model.h" class Browser; @@ -18,14 +17,18 @@ class Canvas; } +namespace content { +class DownloadManager; +} + +namespace download { +class DownloadItem; +} + namespace ui { class ThemeProvider; } -using offline_items_collection::ContentId; -using offline_items_collection::OfflineItem; -using DownloadUIModelPtr = DownloadUIModel::DownloadUIModelPtr; - // This is an abstract base class for platform specific download shelf // implementations. class DownloadShelf { @@ -83,7 +86,7 @@ // DownloadItemModel::ShouldRemoveFromShelfWhenComplete()). These transient // downloads are added to the shelf after a delay. If the download completes // before the delay duration, it will not be added to the shelf at all. - void AddDownload(DownloadUIModelPtr download); + void AddDownload(download::DownloadItem* download); // The browser view needs to know when we are going away to properly return // the resize corner size to WebKit so that we don't draw on top of it. @@ -113,7 +116,7 @@ bool is_hidden() { return is_hidden_; } protected: - virtual void DoAddDownload(DownloadUIModelPtr download) = 0; + virtual void DoAddDownload(download::DownloadItem* download) = 0; virtual void DoOpen() = 0; virtual void DoClose(CloseReason reason) = 0; virtual void DoHide() = 0; @@ -123,16 +126,20 @@ // Protected virtual for testing. virtual base::TimeDelta GetTransientDownloadShowDelay(); - // Virtual for testing. - virtual Profile* profile() const; + // Returns the DownloadManager associated with this DownloadShelf. All + // downloads that are shown on this shelf is expected to belong to this + // DownloadManager. Protected virtual for testing. + virtual content::DownloadManager* GetDownloadManager(); private: // Show the download on the shelf immediately. Also displayes the download // started animation if necessary. - void ShowDownload(DownloadUIModelPtr download); + void ShowDownload(download::DownloadItem* download); - // Similar to ShowDownload() but refers to the download using an ID. - void ShowDownloadById(ContentId id); + // Similar to ShowDownload() but refers to the download using an ID. This + // download should belong to the DownloadManager returned by + // GetDownloadManager(). + void ShowDownloadById(int32_t download_id); bool should_show_on_unhide_; bool is_hidden_;
diff --git a/chrome/browser/download/download_shelf_controller.cc b/chrome/browser/download/download_shelf_controller.cc index 1685aaa..38eea15 100644 --- a/chrome/browser/download/download_shelf_controller.cc +++ b/chrome/browser/download/download_shelf_controller.cc
@@ -4,28 +4,18 @@ #include "chrome/browser/download/download_shelf_controller.h" -#include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/offline_item_model_manager.h" #include "chrome/browser/download/offline_item_model_manager_factory.h" -#include "chrome/browser/download/offline_item_utils.h" -#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" -#include "components/offline_items_collection/core/offline_content_aggregator.h" #include "components/offline_items_collection/core/offline_item.h" using offline_items_collection::OfflineItemState; -using offline_items_collection::OfflineContentAggregator; DownloadShelfController::DownloadShelfController(Profile* profile) - : profile_(profile) { - aggregator_ = OfflineContentAggregatorFactory::GetForBrowserContext(profile_); - aggregator_->AddObserver(this); -} + : profile_(profile) {} -DownloadShelfController::~DownloadShelfController() { - aggregator_->RemoveObserver(this); -} +DownloadShelfController::~DownloadShelfController() = default; void DownloadShelfController::OnItemsAdded( const OfflineContentProvider::OfflineItemList& items) { @@ -34,38 +24,28 @@ } void DownloadShelfController::OnItemRemoved(const ContentId& id) { - if (OfflineItemUtils::IsDownload(id)) - return; - OfflineItemModelManagerFactory::GetForBrowserContext(profile_) ->RemoveOfflineItemModelData(id); } void DownloadShelfController::OnItemUpdated(const OfflineItem& item) { - if (OfflineItemUtils::IsDownload(item.id)) - return; - if (item.state == OfflineItemState::CANCELLED) return; OfflineItemModelManager* manager = OfflineItemModelManagerFactory::GetForBrowserContext(profile_); - - DownloadUIModel::DownloadUIModelPtr model = - OfflineItemModel::Wrap(manager, item); - - if (!model->WasUINotified()) { - model->SetWasUINotified(true); - OnNewOfflineItemReady(std::move(model)); + OfflineItemModel model(manager, item); + if (!model.WasUINotified()) { + model.SetWasUINotified(true); + OnNewOfflineItemReady(model); } } void DownloadShelfController::OnNewOfflineItemReady( - DownloadUIModel::DownloadUIModelPtr model) { + const OfflineItemModel& item) { Browser* browser = browser = chrome::FindLastActiveWithProfile(profile_); if (browser && browser->window()) { // Add the offline item to DownloadShelf in the browser window. - browser->window()->GetDownloadShelf()->AddDownload(std::move(model)); } }
diff --git a/chrome/browser/download/download_shelf_controller.h b/chrome/browser/download/download_shelf_controller.h index 502b987..6634e42087 100644 --- a/chrome/browser/download/download_shelf_controller.h +++ b/chrome/browser/download/download_shelf_controller.h
@@ -9,15 +9,12 @@ #include "base/macros.h" #include "chrome/browser/download/offline_item_model.h" -#include "components/offline_items_collection/core/offline_content_aggregator.h" #include "components/offline_items_collection/core/offline_content_provider.h" class Profile; using ContentId = offline_items_collection::ContentId; using OfflineContentProvider = offline_items_collection::OfflineContentProvider; -using OfflineContentAggregator = - offline_items_collection::OfflineContentAggregator; using OfflineItem = offline_items_collection::OfflineItem; // Class for notifying UI when an OfflineItem should be displayed. @@ -34,10 +31,9 @@ void OnItemUpdated(const OfflineItem& item) override; // Called when a new OfflineItem is to be displayed on UI. - void OnNewOfflineItemReady(DownloadUIModel::DownloadUIModelPtr model); + void OnNewOfflineItemReady(const OfflineItemModel& item); Profile* profile_; - OfflineContentAggregator* aggregator_; DISALLOW_COPY_AND_ASSIGN(DownloadShelfController); };
diff --git a/chrome/browser/download/download_shelf_unittest.cc b/chrome/browser/download/download_shelf_unittest.cc index 72c22f2..04b3500 100644 --- a/chrome/browser/download/download_shelf_unittest.cc +++ b/chrome/browser/download/download_shelf_unittest.cc
@@ -34,17 +34,13 @@ DownloadShelfTest(); protected: - DownloadUIModelPtr model() { - DownloadUIModelPtr model( - new DownloadItemModel(download_item_.get()), - base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); - return model; - } - + download::MockDownloadItem* download_item() { return download_item_.get(); } content::MockDownloadManager* download_manager() { return download_manager_.get(); } - TestDownloadShelf* shelf() { return &shelf_; } + TestDownloadShelf* shelf() { + return &shelf_; + } Profile* profile() { return profile_.get(); } void SetUp() override { @@ -53,7 +49,7 @@ void TearDown() override { } - protected: + private: std::unique_ptr<download::MockDownloadItem> GetInProgressMockDownload(); content::TestBrowserThreadBundle test_browser_thread_bundle_; @@ -65,8 +61,6 @@ DownloadShelfTest::DownloadShelfTest() : profile_(new TestingProfile()) { download_item_.reset(new ::testing::NiceMock<download::MockDownloadItem>()); - ON_CALL(*download_item_, GetGuid()) - .WillByDefault(ReturnRefOfCopy(std::string("TEST_GUID"))); ON_CALL(*download_item_, GetAutoOpened()).WillByDefault(Return(false)); ON_CALL(*download_item_, GetMimeType()).WillByDefault(Return("text/plain")); ON_CALL(*download_item_, GetOpenWhenComplete()).WillByDefault(Return(false)); @@ -84,14 +78,12 @@ download_manager_.reset( new ::testing::NiceMock<content::MockDownloadManager>()); - ON_CALL(*download_manager_, GetDownloadByGuid(_)) + ON_CALL(*download_manager_, GetDownload(_)) .WillByDefault(Return(download_item_.get())); ON_CALL(*download_manager_, GetBrowserContext()) .WillByDefault(Return(profile())); - content::BrowserContext::SetDownloadManagerForTesting( - profile_.get(), std::move(download_manager_)); - shelf_.set_profile(profile_.get()); + shelf_.set_download_manager(download_manager_.get()); } } // namespace @@ -122,20 +114,20 @@ TEST_F(DownloadShelfTest, AddDownloadWhileHiddenUnhides) { shelf()->Open(); shelf()->Hide(); - shelf()->AddDownload(model()); + shelf()->AddDownload(download_item()); EXPECT_TRUE(shelf()->IsShowing()); } TEST_F(DownloadShelfTest, AddDownloadWhileHiddenUnhidesAndShows) { shelf()->Hide(); - shelf()->AddDownload(model()); + shelf()->AddDownload(download_item()); EXPECT_TRUE(shelf()->IsShowing()); } // Normal downloads should be added synchronously and cause the shelf to show. TEST_F(DownloadShelfTest, AddNormalDownload) { EXPECT_FALSE(shelf()->IsShowing()); - shelf()->AddDownload(model()); + shelf()->AddDownload(download_item()); EXPECT_TRUE(shelf()->did_add_download()); EXPECT_TRUE(shelf()->IsShowing()); } @@ -144,35 +136,68 @@ // should be added after a delay. For testing, the delay is set to 0 seconds. So // the download should be added once the message loop is flushed. TEST_F(DownloadShelfTest, AddDelayedDownload) { - ON_CALL(*download_item_, ShouldOpenFileBasedOnExtension()) - .WillByDefault(Return(true)); - ASSERT_TRUE(model()->ShouldRemoveFromShelfWhenComplete()); - shelf()->AddDownload(model()); + EXPECT_CALL(*download_item(), ShouldOpenFileBasedOnExtension()) + .WillRepeatedly(Return(true)); + ASSERT_TRUE(DownloadItemModel(download_item()) + .ShouldRemoveFromShelfWhenComplete()); + shelf()->AddDownload(download_item()); EXPECT_FALSE(shelf()->did_add_download()); EXPECT_FALSE(shelf()->IsShowing()); - base::RunLoop().RunUntilIdle(); + base::RunLoop run_loop; + run_loop.RunUntilIdle(); + + EXPECT_TRUE(shelf()->did_add_download()); + EXPECT_TRUE(shelf()->IsShowing()); } // Add a transient download that completes before the delay. It should not be // displayed on the shelf. TEST_F(DownloadShelfTest, AddDelayedCompletedDownload) { - ON_CALL(*download_item_, ShouldOpenFileBasedOnExtension()) - .WillByDefault(Return(true)); - ASSERT_TRUE(model()->ShouldRemoveFromShelfWhenComplete()); - ON_CALL(*download_item_, IsTemporary()).WillByDefault(Return(true)); - shelf()->AddDownload(model()); + EXPECT_CALL(*download_item(), ShouldOpenFileBasedOnExtension()) + .WillRepeatedly(Return(true)); + ASSERT_TRUE(DownloadItemModel(download_item()) + .ShouldRemoveFromShelfWhenComplete()); + shelf()->AddDownload(download_item()); EXPECT_FALSE(shelf()->did_add_download()); EXPECT_FALSE(shelf()->IsShowing()); - ON_CALL(*download_item_, GetState()) - .WillByDefault(Return(DownloadItem::COMPLETE)); - ON_CALL(*download_item_, GetAutoOpened()).WillByDefault(Return(true)); + EXPECT_CALL(*download_item(), GetState()) + .WillRepeatedly(Return(DownloadItem::COMPLETE)); + EXPECT_CALL(*download_item(), GetAutoOpened()) + .WillRepeatedly(Return(true)); - base::RunLoop().RunUntilIdle(); + base::RunLoop run_loop; + run_loop.RunUntilIdle(); EXPECT_FALSE(shelf()->did_add_download()); EXPECT_FALSE(shelf()->IsShowing()); } + +// Add a transient download that completes and becomes non-transient before the +// delay. It should be displayed on the shelf even though it is complete. +TEST_F(DownloadShelfTest, AddDelayedCompleteNonTransientDownload) { + EXPECT_CALL(*download_item(), ShouldOpenFileBasedOnExtension()) + .WillRepeatedly(Return(true)); + ASSERT_TRUE(DownloadItemModel(download_item()) + .ShouldRemoveFromShelfWhenComplete()); + shelf()->AddDownload(download_item()); + + EXPECT_FALSE(shelf()->did_add_download()); + EXPECT_FALSE(shelf()->IsShowing()); + + EXPECT_CALL(*download_item(), GetState()) + .WillRepeatedly(Return(DownloadItem::COMPLETE)); + EXPECT_CALL(*download_item(), ShouldOpenFileBasedOnExtension()) + .WillRepeatedly(Return(false)); + ASSERT_FALSE(DownloadItemModel(download_item()) + .ShouldRemoveFromShelfWhenComplete()); + + base::RunLoop run_loop; + run_loop.RunUntilIdle(); + + EXPECT_TRUE(shelf()->did_add_download()); + EXPECT_TRUE(shelf()->IsShowing()); +}
diff --git a/chrome/browser/download/download_ui_controller.cc b/chrome/browser/download/download_ui_controller.cc index 8150809..15279d7 100644 --- a/chrome/browser/download/download_ui_controller.cc +++ b/chrome/browser/download/download_ui_controller.cc
@@ -98,10 +98,8 @@ if (browser && browser->window() && DownloadItemModel(item).ShouldShowInShelf()) { - DownloadUIModel::DownloadUIModelPtr model = DownloadItemModel::Wrap(item); - // GetDownloadShelf creates the download shelf if it was not yet created. - browser->window()->GetDownloadShelf()->AddDownload(std::move(model)); + browser->window()->GetDownloadShelf()->AddDownload(item); } }
diff --git a/chrome/browser/download/offline_item_model.cc b/chrome/browser/download/offline_item_model.cc index 25dee33..c08e04d 100644 --- a/chrome/browser/download/offline_item_model.cc +++ b/chrome/browser/download/offline_item_model.cc
@@ -15,16 +15,6 @@ using offline_items_collection::OfflineItem; using offline_items_collection::OfflineItemState; -// static -DownloadUIModel::DownloadUIModelPtr OfflineItemModel::Wrap( - OfflineItemModelManager* manager, - const OfflineItem& offline_item) { - DownloadUIModel::DownloadUIModelPtr model( - new OfflineItemModel(manager, offline_item), - base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); - return model; -} - OfflineItemModel::OfflineItemModel(OfflineItemModelManager* manager, const OfflineItem& offline_item) : manager_(manager), @@ -42,14 +32,6 @@ offline_item_observer_->RemoveObserver(offline_item_->id, this); } -Profile* OfflineItemModel::profile() const { - return Profile::FromBrowserContext(manager_->browser_context()); -} - -ContentId OfflineItemModel::GetContentId() const { - return offline_item_ ? offline_item_->id : ContentId(); -} - int64_t OfflineItemModel::GetCompletedBytes() const { return offline_item_ ? offline_item_->received_bytes : 0; } @@ -84,43 +66,6 @@ return offline_item_ ? offline_item_->file_path : base::FilePath(); } -void OfflineItemModel::OpenDownload() { - if (!offline_item_) - return; - - GetProvider()->OpenItem( - offline_items_collection::LaunchLocation::DOWNLOAD_SHELF, - offline_item_->id); -} - -void OfflineItemModel::Pause() { - if (!offline_item_) - return; - - GetProvider()->PauseDownload(offline_item_->id); -} - -void OfflineItemModel::Resume() { - if (!offline_item_) - return; - - GetProvider()->ResumeDownload(offline_item_->id, true /* has_user_gesture */); -} - -void OfflineItemModel::Cancel(bool user_cancel) { - if (!offline_item_) - return; - - GetProvider()->CancelDownload(offline_item_->id); -} - -void OfflineItemModel::Remove() { - if (!offline_item_) - return; - - GetProvider()->RemoveItem(offline_item_->id); -} - download::DownloadItem::DownloadState OfflineItemModel::GetState() const { if (!offline_item_) return download::DownloadItem::CANCELLED; @@ -146,8 +91,9 @@ } bool OfflineItemModel::IsPaused() const { - return offline_item_ ? offline_item_->state == OfflineItemState::PAUSED - : true; + return offline_item_ + ? offline_item_->state == offline_items_collection::PAUSED + : true; } bool OfflineItemModel::TimeRemaining(base::TimeDelta* remaining) const { @@ -216,18 +162,6 @@ return offline_item_ ? offline_item_->page_url : GURL(); } -bool OfflineItemModel::ShouldRemoveFromShelfWhenComplete() const { - // TODO(shaktisahu): Add more appropriate logic. - return false; -} - -OfflineContentProvider* OfflineItemModel::GetProvider() const { - offline_items_collection::OfflineContentAggregator* aggregator = - OfflineContentAggregatorFactory::GetForBrowserContext( - manager_->browser_context()); - return aggregator; -} - void OfflineItemModel::OnItemRemoved(const ContentId& id) { for (auto& obs : observers_) obs.OnDownloadDestroyed();
diff --git a/chrome/browser/download/offline_item_model.h b/chrome/browser/download/offline_item_model.h index 4a6c3c9..4aa64b9 100644 --- a/chrome/browser/download/offline_item_model.h +++ b/chrome/browser/download/offline_item_model.h
@@ -9,42 +9,28 @@ #include "chrome/browser/download/download_ui_model.h" #include "components/offline_items_collection/core/filtered_offline_item_observer.h" -#include "components/offline_items_collection/core/offline_content_provider.h" #include "components/offline_items_collection/core/offline_item.h" class OfflineItemModelManager; using offline_items_collection::FilteredOfflineItemObserver; -using offline_items_collection::OfflineContentProvider; -using offline_items_collection::OfflineItem; -using offline_items_collection::ContentId; // Implementation of DownloadUIModel that wrappers around a |OfflineItem|. class OfflineItemModel : public DownloadUIModel, public FilteredOfflineItemObserver::Observer { public: - static DownloadUIModelPtr Wrap(OfflineItemModelManager* manager, - const OfflineItem& offline_item); - // Constructs a OfflineItemModel. OfflineItemModel(OfflineItemModelManager* manager, - const OfflineItem& offline_item); + const offline_items_collection::OfflineItem& offline_item); ~OfflineItemModel() override; // DownloadUIModel implementation. - Profile* profile() const override; - ContentId GetContentId() const override; int64_t GetCompletedBytes() const override; int64_t GetTotalBytes() const override; int PercentComplete() const override; bool WasUINotified() const override; void SetWasUINotified(bool should_notify) override; base::FilePath GetTargetFilePath() const override; - void OpenDownload() override; - void Pause() override; - void Resume() override; - void Cancel(bool user_cancel) override; - void Remove() override; download::DownloadItem::DownloadState GetState() const override; bool IsPaused() const override; bool TimeRemaining(base::TimeDelta* remaining) const override; @@ -55,7 +41,6 @@ bool AllDataSaved() const override; bool GetFileExternallyRemoved() const override; GURL GetURL() const override; - bool ShouldRemoveFromShelfWhenComplete() const override; #if !defined(OS_ANDROID) bool IsCommandEnabled(const DownloadCommands* download_commands, @@ -67,11 +52,10 @@ #endif private: - OfflineContentProvider* GetProvider() const; - // FilteredOfflineItemObserver::Observer overrides. - void OnItemRemoved(const ContentId& id) override; - void OnItemUpdated(const OfflineItem& item) override; + void OnItemRemoved(const offline_items_collection::ContentId& id) override; + void OnItemUpdated( + const offline_items_collection::OfflineItem& item) override; // DownloadUIModel implementation. std::string GetMimeType() const override; @@ -79,7 +63,7 @@ OfflineItemModelManager* manager_; std::unique_ptr<FilteredOfflineItemObserver> offline_item_observer_; - std::unique_ptr<OfflineItem> offline_item_; + std::unique_ptr<offline_items_collection::OfflineItem> offline_item_; DISALLOW_COPY_AND_ASSIGN(OfflineItemModel); };
diff --git a/chrome/browser/download/offline_item_model_manager_factory.cc b/chrome/browser/download/offline_item_model_manager_factory.cc index b84e313..0c70fce 100644 --- a/chrome/browser/download/offline_item_model_manager_factory.cc +++ b/chrome/browser/download/offline_item_model_manager_factory.cc
@@ -6,7 +6,6 @@ #include "base/memory/singleton.h" #include "chrome/browser/download/offline_item_model_manager.h" -#include "chrome/browser/profiles/incognito_helpers.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "content/public/browser/browser_context.h" @@ -33,8 +32,3 @@ content::BrowserContext* context) const { return new OfflineItemModelManager(context); } - -content::BrowserContext* OfflineItemModelManagerFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - return chrome::GetBrowserContextOwnInstanceInIncognito(context); -}
diff --git a/chrome/browser/download/offline_item_model_manager_factory.h b/chrome/browser/download/offline_item_model_manager_factory.h index 9bddef1..a77b95c 100644 --- a/chrome/browser/download/offline_item_model_manager_factory.h +++ b/chrome/browser/download/offline_item_model_manager_factory.h
@@ -42,8 +42,6 @@ // BrowserContextKeyedServiceFactory implementation. KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; - content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(OfflineItemModelManagerFactory); };
diff --git a/chrome/browser/download/offline_item_utils.cc b/chrome/browser/download/offline_item_utils.cc index 5aadb2a..f9222148 100644 --- a/chrome/browser/download/offline_item_utils.cc +++ b/chrome/browser/download/offline_item_utils.cc
@@ -25,9 +25,6 @@ // The namespace for incognito downloads. const char kDownloadIncognitoNamespace[] = "LEGACY_DOWNLOAD_INCOGNITO"; -// Prefix that all download namespaces should start with. -const char kDownloadNamespacePrefix[] = "LEGACY_DOWNLOAD"; - // The remaining time for a download item if it cannot be calculated. constexpr int64_t kUnknownRemainingTime = -1; @@ -124,7 +121,3 @@ std::string OfflineItemUtils::GetDownloadNamespace(bool is_off_the_record) { return is_off_the_record ? kDownloadIncognitoNamespace : kDownloadNamespace; } - -bool OfflineItemUtils::IsDownload(const ContentId& id) { - return id.name_space.find(kDownloadNamespacePrefix) != std::string::npos; -}
diff --git a/chrome/browser/download/offline_item_utils.h b/chrome/browser/download/offline_item_utils.h index a72f857..58211923 100644 --- a/chrome/browser/download/offline_item_utils.h +++ b/chrome/browser/download/offline_item_utils.h
@@ -21,8 +21,6 @@ static std::string GetDownloadNamespace(bool is_off_the_record); - static bool IsDownload(const offline_items_collection::ContentId& id); - private: DISALLOW_COPY_AND_ASSIGN(OfflineItemUtils); };
diff --git a/chrome/browser/download/test_download_shelf.cc b/chrome/browser/download/test_download_shelf.cc index 48302c24..077acaf 100644 --- a/chrome/browser/download/test_download_shelf.cc +++ b/chrome/browser/download/test_download_shelf.cc
@@ -7,9 +7,14 @@ #include "content/public/browser/download_manager.h" TestDownloadShelf::TestDownloadShelf() - : is_showing_(false), did_add_download_(false), profile_(nullptr) {} + : is_showing_(false), + did_add_download_(false), + download_manager_(NULL) { +} TestDownloadShelf::~TestDownloadShelf() { + if (download_manager_) + download_manager_->RemoveObserver(this); } bool TestDownloadShelf::IsShowing() const { @@ -24,7 +29,21 @@ return NULL; } -void TestDownloadShelf::DoAddDownload(DownloadUIModelPtr download) { +void TestDownloadShelf::set_download_manager( + content::DownloadManager* download_manager) { + if (download_manager_) + download_manager_->RemoveObserver(this); + download_manager_ = download_manager; + if (download_manager_) + download_manager_->AddObserver(this); +} + +void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) { + DCHECK_EQ(manager, download_manager_); + download_manager_ = NULL; +} + +void TestDownloadShelf::DoAddDownload(download::DownloadItem* download) { did_add_download_ = true; } @@ -48,6 +67,6 @@ return base::TimeDelta(); } -Profile* TestDownloadShelf::profile() const { - return profile_; +content::DownloadManager* TestDownloadShelf::GetDownloadManager() { + return download_manager_; }
diff --git a/chrome/browser/download/test_download_shelf.h b/chrome/browser/download/test_download_shelf.h index 4c877eae..5f81c25 100644 --- a/chrome/browser/download/test_download_shelf.h +++ b/chrome/browser/download/test_download_shelf.h
@@ -12,7 +12,8 @@ #include "content/public/browser/download_manager.h" // An implementation of DownloadShelf for testing. -class TestDownloadShelf : public DownloadShelf { +class TestDownloadShelf : public DownloadShelf, + public content::DownloadManager::Observer { public: TestDownloadShelf(); ~TestDownloadShelf() override; @@ -25,22 +26,25 @@ // Return |true| if a download was added to this shelf. bool did_add_download() const { return did_add_download_; } - // Set a profile. - void set_profile(Profile* profile) { profile_ = profile; } + // Set download_manager_ (and the result of calling GetDownloadManager()) + void set_download_manager(content::DownloadManager* download_manager); + + // DownloadManager::Observer implementation. + void ManagerGoingDown(content::DownloadManager* manager) override; protected: - void DoAddDownload(DownloadUIModelPtr download) override; + void DoAddDownload(download::DownloadItem* download) override; void DoOpen() override; void DoClose(CloseReason reason) override; void DoHide() override; void DoUnhide() override; base::TimeDelta GetTransientDownloadShowDelay() override; - Profile* profile() const override; + content::DownloadManager* GetDownloadManager() override; private: bool is_showing_; bool did_add_download_; - Profile* profile_; + content::DownloadManager* download_manager_; DISALLOW_COPY_AND_ASSIGN(TestDownloadShelf); };
diff --git a/chrome/browser/extensions/api/history/history_apitest.cc b/chrome/browser/extensions/api/history/history_apitest.cc index d053946..27e12e5a 100644 --- a/chrome/browser/extensions/api/history/history_apitest.cc +++ b/chrome/browser/extensions/api/history/history_apitest.cc
@@ -8,9 +8,27 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_navigation_observer.h" +#include "extensions/browser/process_manager.h" +#include "extensions/test/extension_test_message_listener.h" #include "net/dns/mock_host_resolver.h" +namespace { + +std::string RunScriptAndReturnResult(const extensions::ExtensionHost* host, + const std::string& script) { + std::string result; + EXPECT_TRUE(content::ExecuteScriptAndExtractString(host->host_contents(), + script, &result)) + << script; + return result; +} + +} // namespace + namespace extensions { class HistoryApiTest : public ExtensionApiTest { @@ -26,37 +44,114 @@ // Full text search indexing sometimes exceeds a timeout. (http://crbug/119505) IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_MiscSearch) { ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "misc_search.html")) << message_; + ASSERT_TRUE(RunExtensionSubtest("history/regular", "misc_search.html")) + << message_; } // Same could happen here without the FTS (http://crbug/119505) IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_TimedSearch) { ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "timed_search.html")) << message_; + ASSERT_TRUE(RunExtensionSubtest("history/regular", "timed_search.html")) + << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, Delete) { ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "delete.html")) << message_; + ASSERT_TRUE(RunExtensionSubtest("history/regular", "delete.html")) + << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, DeleteProhibited) { browser()->profile()->GetPrefs()-> SetBoolean(prefs::kAllowDeletingBrowserHistory, false); ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "delete_prohibited.html")) << - message_; + ASSERT_TRUE(RunExtensionSubtest("history/regular", "delete_prohibited.html")) + << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, GetVisits) { ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "get_visits.html")) << message_; + ASSERT_TRUE(RunExtensionSubtest("history/regular", "get_visits.html")) + << message_; } IN_PROC_BROWSER_TEST_F(HistoryApiTest, SearchAfterAdd) { ASSERT_TRUE(StartEmbeddedTestServer()); - ASSERT_TRUE(RunExtensionSubtest("history", "search_after_add.html")) + ASSERT_TRUE(RunExtensionSubtest("history/regular", "search_after_add.html")) << message_; } +// Test when History API is used from incognito mode, it has access to the +// regular mode history and actual incognito navigation has no effect on it. +IN_PROC_BROWSER_TEST_F(HistoryApiTest, Incognito) { + ASSERT_TRUE(StartEmbeddedTestServer()); + // Setup. + Browser* incognito_browser = CreateIncognitoBrowser(browser()->profile()); + ExtensionTestMessageListener regular_listener("regular ready", false); + ExtensionTestMessageListener incognito_listener("incognito ready", false); + const Extension* extension = LoadExtensionWithFlags( + test_data_dir_.AppendASCII("history/incognito"), kFlagEnableIncognito); + ASSERT_TRUE(extension); + ASSERT_TRUE(regular_listener.WaitUntilSatisfied()); + ASSERT_TRUE(incognito_listener.WaitUntilSatisfied()); + + ExtensionHost* on_the_record_background_page = + ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension->id()); + ASSERT_TRUE(on_the_record_background_page); + + ExtensionHost* incognito_background_page = + ProcessManager::Get(incognito_browser->profile()) + ->GetBackgroundHostForExtension(extension->id()); + ASSERT_TRUE(incognito_background_page); + EXPECT_NE(incognito_background_page, on_the_record_background_page); + + // Check if history is empty in regular mode. + EXPECT_EQ("0", RunScriptAndReturnResult(on_the_record_background_page, + "countItemsInHistory()")); + + // Insert an item in incognito mode. + EXPECT_EQ(std::string("success"), + RunScriptAndReturnResult(incognito_background_page, "addItem()")); + + // Check history in incognito mode. + EXPECT_EQ("1", RunScriptAndReturnResult(on_the_record_background_page, + "countItemsInHistory()")); + + // Check history in regular mode. + EXPECT_EQ("1", RunScriptAndReturnResult(on_the_record_background_page, + "countItemsInHistory()")); + + // Perform navigation in incognito mode. + const GURL b_com = + embedded_test_server()->GetURL("www.b.com", "/simple.html"); + content::TestNavigationObserver incognito_observer( + incognito_browser->tab_strip_model()->GetActiveWebContents()); + ui_test_utils::NavigateToURL(incognito_browser, b_com); + EXPECT_TRUE(incognito_observer.last_navigation_succeeded()); + + // Check history in regular mode is not modified by incognito navigation. + EXPECT_EQ("1", RunScriptAndReturnResult(on_the_record_background_page, + "countItemsInHistory()")); + + // Check that history in incognito mode is not modified by navigation as + // incognito navigations are not recorded in history. + EXPECT_EQ("1", RunScriptAndReturnResult(incognito_background_page, + "countItemsInHistory()")); + + // Perform navigation in regular mode. + content::TestNavigationObserver regular_observer( + browser()->tab_strip_model()->GetActiveWebContents()); + ui_test_utils::NavigateToURL(browser(), b_com); + EXPECT_TRUE(regular_observer.last_navigation_succeeded()); + + // Check history in regular mode is modified by navigation. + EXPECT_EQ("2", RunScriptAndReturnResult(on_the_record_background_page, + "countItemsInHistory()")); + + // Check history in incognito mode is modified by navigation. + EXPECT_EQ("2", RunScriptAndReturnResult(incognito_background_page, + "countItemsInHistory()")); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc index aaff0a6..fcfaee0c 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/bind.h" #include "base/guid.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" @@ -157,7 +158,7 @@ private: TestingProfile::TestingFactories GetTestingFactories() override { return {{ProfileSyncServiceFactory::GetInstance(), - CreateProfileSyncServiceMock}}; + base::BindRepeating(&CreateProfileSyncServiceMock)}}; } };
diff --git a/chrome/browser/extensions/api/storage/sync_storage_backend.cc b/chrome/browser/extensions/api/storage/sync_storage_backend.cc index 7cb9a4b..ad8b2f5 100644 --- a/chrome/browser/extensions/api/storage/sync_storage_backend.cc +++ b/chrome/browser/extensions/api/storage/sync_storage_backend.cc
@@ -11,6 +11,7 @@ #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" #include "chrome/browser/extensions/api/storage/settings_sync_util.h" #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "extensions/browser/api/storage/backend_task_runner.h"
diff --git a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc index 7afd724c..e2a7da6c 100644 --- a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
@@ -10,6 +10,7 @@ #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "build/build_config.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/extensions/extension_install_prompt.h" #include "chrome/browser/extensions/extension_service.h" @@ -333,9 +334,15 @@ registry->GenerateInstalledExtensionsSet()->Contains(kTestExtensionId)); } +// Flaky on Linux ASan LSan (https://crbug.com/889804) +#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) +#define MAYBE_ReinstallDisabledExtension DISABLED_ReinstallDisabledExtension +#else +#define MAYBE_ReinstallDisabledExtension ReinstallDisabledExtension +#endif // Ensure that inline-installing a disabled extension simply re-enables it. IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, - ReinstallDisabledExtension) { + MAYBE_ReinstallDisabledExtension) { // Install an extension via inline install, and confirm it is successful. AutoAcceptInstall(); ui_test_utils::NavigateToURL( @@ -543,7 +550,14 @@ RunTest("download_progress_listener.html"); } -IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { +// Flaky on Linux ASan LSan (https://crbug.com/889804) +#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) +#define MAYBE_BothListenersTest DISABLED_BothListenersTest +#else +#define MAYBE_BothListenersTest BothListenersTest +#endif +IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, + MAYBE_BothListenersTest) { RunTest("both_listeners.html"); // The extension should be installed. ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
diff --git a/chrome/browser/load_library_perf_test.cc b/chrome/browser/load_library_perf_test.cc index 3443ae72..b843d43a 100644 --- a/chrome/browser/load_library_perf_test.cc +++ b/chrome/browser/load_library_perf_test.cc
@@ -16,10 +16,9 @@ #include "media/media_buildflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/perf/perf_test.h" +#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "media/cdm/cdm_paths.h" #endif @@ -76,13 +75,13 @@ #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) TEST(LoadCDMPerfTest, Widevine) { MeasureSizeAndTimeToLoadCdm( kWidevineCdmBaseDirectory, base::GetNativeLibraryName(kWidevineCdmLibraryName)); } -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) TEST(LoadCDMPerfTest, ExternalClearKey) { MeasureSizeAndTimeToLoadCdm(
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index b00a85a..3c3ce39 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -31,6 +31,7 @@ #include "media/cdm/supported_cdm_versions.h" #include "media/media_buildflags.h" #include "testing/gtest/include/gtest/gtest-spi.h" +#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" #if defined(OS_WIN) @@ -42,8 +43,6 @@ #include "media/cdm/cdm_paths.h" #endif -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - // Available key systems. const char kClearKeyKeySystem[] = "org.w3.clearkey"; const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; @@ -142,11 +141,11 @@ return key_system.substr(0, prefix.size()) == prefix; } -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) bool IsWidevine(const std::string& key_system) { return key_system == kWidevineKeySystem; } -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) void RunEncryptedMediaTestPage(const std::string& html_page, const std::string& key_system, @@ -259,23 +258,23 @@ } bool IsPlayBackPossible(const std::string& key_system) { -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) if (IsWidevine(key_system) && !GetServerConfig(key_system)) return false; -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) return true; } std::unique_ptr<TestLicenseServerConfig> GetServerConfig( const std::string& key_system) { -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) if (IsWidevine(key_system)) { std::unique_ptr<TestLicenseServerConfig> config( new WVTestLicenseServerConfig); if (config->IsPlatformSupported()) return config; } -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) return nullptr; } @@ -519,12 +518,12 @@ Values(SrcType::SRC))); #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(SHOULD_BUNDLE_WIDEVINE_CDM) INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest, Combine(Values(kWidevineKeySystem), Values(SrcType::MSE))); -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // #if BUILDFLAG(SHOULD_BUNDLE_WIDEVINE_CDM) IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMVorbisAudioVp8Video);
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc index c9cd17d..e6e2f9a 100644 --- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc +++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -28,6 +28,7 @@ #include "media/base/test_data_util.h" #include "media/media_buildflags.h" #include "net/test/embedded_test_server/embedded_test_server.h" +#include "third_party/widevine/cdm/buildflags.h" #include "url/gurl.h" #if BUILDFLAG(ENABLE_LIBRARY_CDMS) @@ -39,8 +40,6 @@ #error This file needs to be updated to run on Android. #endif -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - namespace { const char kClearKey[] = "org.w3.clearkey"; @@ -83,13 +82,13 @@ #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) // Expectations for Widevine. -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(SHOULD_BUNDLE_WIDEVINE_CDM) #define EXPECT_WV_SUCCESS EXPECT_SUCCESS #define EXPECT_WV_PROPRIETARY EXPECT_PROPRIETARY -#else // defined(WIDEVINE_CDM_AVAILABLE) +#else #define EXPECT_WV_SUCCESS EXPECT_UNSUPPORTED #define EXPECT_WV_PROPRIETARY EXPECT_UNSUPPORTED -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(SHOULD_BUNDLE_WIDEVINE_CDM) }; // namespace
diff --git a/chrome/browser/offline_pages/android/offline_page_bridge.cc b/chrome/browser/offline_pages/android/offline_page_bridge.cc index ce5b2d00..1ec5bd2 100644 --- a/chrome/browser/offline_pages/android/offline_page_bridge.cc +++ b/chrome/browser/offline_pages/android/offline_page_bridge.cc
@@ -221,9 +221,6 @@ offline_header.reason = offline_pages::OfflinePageHeader::Reason::NET_ERROR_SUGGESTION; break; - case offline_items_collection::LaunchLocation::DOWNLOAD_SHELF: - NOTREACHED(); - break; } offline_header.need_to_persist = true; offline_header.id = base::Int64ToString(offline_id);
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 0a0e3bba..e2c484d 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -266,7 +266,14 @@ prefs::kManagedDefaultGeolocationSetting, base::Value::Type::INTEGER }, { key::kSigninAllowed, +#if defined(OS_ANDROID) + // The new kSigninAllowedOnNextStartup pref is only used on Desktop. + // Keep the old kSigninAllowed pref for Android until the policy is + // fully depricated in M71 and can be removed. prefs::kSigninAllowed, +#else + prefs::kSigninAllowedOnNextStartup, +#endif base::Value::Type::BOOLEAN }, { key::kEnableOnlineRevocationChecks, prefs::kCertRevocationCheckingEnabled,
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 4e3be026..bfa92f3d 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -369,6 +369,8 @@ #if defined(OS_WIN) const char kLastWelcomedOSVersion[] = "browser.last_welcomed_os_version"; #endif +const char kSupervisedUserCreationAllowed[] = + "profile.managed_user_creation_allowed"; // Register prefs used only for migration (clearing or moving to a new key). void RegisterProfilePrefsForMigration( @@ -392,6 +394,7 @@ registry->RegisterIntegerPref(kModuleConflictBubbleShown, 0); registry->RegisterIntegerPref(kOptionsWindowLastTabIndex, 0); registry->RegisterStringPref(kTrustedDownloadSources, std::string()); + registry->RegisterBooleanPref(kSupervisedUserCreationAllowed, true); } } // namespace @@ -846,4 +849,5 @@ profile_prefs->ClearPref(kModuleConflictBubbleShown); profile_prefs->ClearPref(kOptionsWindowLastTabIndex); profile_prefs->ClearPref(kTrustedDownloadSources); + profile_prefs->ClearPref(kSupervisedUserCreationAllowed); }
diff --git a/chrome/browser/printing/cloud_print/gcd_api_flow_unittest.cc b/chrome/browser/printing/cloud_print/gcd_api_flow_unittest.cc index 84d5ddc..b1fd35c 100644 --- a/chrome/browser/printing/cloud_print/gcd_api_flow_unittest.cc +++ b/chrome/browser/printing/cloud_print/gcd_api_flow_unittest.cc
@@ -105,7 +105,8 @@ gcd_flow_->OnAccessTokenFetchComplete( GoogleServiceAuthError::AuthErrorNone(), identity::AccessTokenInfo( - "SomeToken", base::Time::Now() + base::TimeDelta::FromHours(1))); + "SomeToken", base::Time::Now() + base::TimeDelta::FromHours(1), + std::string() /* No extra information needed for this test */)); EXPECT_TRUE(base::ContainsKey(requested_urls, GURL(kConfirmRequest))); @@ -134,7 +135,8 @@ gcd_flow_->OnAccessTokenFetchComplete( GoogleServiceAuthError::AuthErrorNone(), identity::AccessTokenInfo( - "SomeToken", base::Time::Now() + base::TimeDelta::FromHours(1))); + "SomeToken", base::Time::Now() + base::TimeDelta::FromHours(1), + std::string() /* No extra information needed for this test */)); EXPECT_TRUE(base::ContainsKey(requested_urls, GURL(kConfirmRequest))); test_url_loader_factory_.AddResponse(kConfirmRequest,
diff --git a/chrome/browser/profiles/gaia_info_update_service_unittest.cc b/chrome/browser/profiles/gaia_info_update_service_unittest.cc index cb0b2ae..667a504 100644 --- a/chrome/browser/profiles/gaia_info_update_service_unittest.cc +++ b/chrome/browser/profiles/gaia_info_update_service_unittest.cc
@@ -8,6 +8,7 @@ #include <string> +#include "base/bind.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" @@ -89,12 +90,13 @@ Profile* CreateProfile(const std::string& name) { TestingProfile::TestingFactories testing_factories; - testing_factories.push_back( - std::make_pair(ChromeSigninClientFactory::GetInstance(), - signin::BuildTestSigninClient)); + testing_factories.emplace_back( + ChromeSigninClientFactory::GetInstance(), + base::BindRepeating(&signin::BuildTestSigninClient)); Profile* profile = testing_profile_manager_.CreateTestingProfile( name, std::unique_ptr<sync_preferences::PrefServiceSyncable>(), - base::UTF8ToUTF16(name), 0, std::string(), testing_factories); + base::UTF8ToUTF16(name), 0, std::string(), + std::move(testing_factories)); // The testing manager sets the profile name manually, which counts as // a user-customized profile name. Reset this to match the default name // we are actually using.
diff --git a/chrome/browser/resources/chromeos/zip_archiver/OWNERS b/chrome/browser/resources/chromeos/zip_archiver/OWNERS index 48676b5..73220a8 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/OWNERS +++ b/chrome/browser/resources/chromeos/zip_archiver/OWNERS
@@ -1,2 +1 @@ -yamaguchi@chromium.org -yawano@chromium.org +file://ui/file_manager/OWNERS
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.cc index 622868e..15b64406 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.cc +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include <cerrno> #include <cstring> +#include <utility> #include "base/time/time.h" #include "chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h" @@ -15,6 +16,13 @@ namespace { +const char kCreateArchiveError[] = "Failed to create archive."; +const char kAddToArchiveError[] = "Failed to add entry to archive."; +const char kCloseArchiveError[] = "Failed to close archive."; + +// We need at least 256KB for MiniZip. +const int64_t kMaximumDataChunkSize = 512 * 1024; + uint32_t UnixToDosdate(const int64_t datetime) { tm tm_datetime; localtime_r(&datetime, &tm_datetime); @@ -122,15 +130,11 @@ : CompressorArchive(compressor_stream), compressor_stream_(compressor_stream), zip_file_(nullptr), + destination_buffer_(std::make_unique<char[]>(kMaximumDataChunkSize)), offset_(0), - length_(0) { - destination_buffer_ = - new char[compressor_stream_constants::kMaximumDataChunkSize]; -} + length_(0) {} -CompressorArchiveMinizip::~CompressorArchiveMinizip() { - delete destination_buffer_; -} +CompressorArchiveMinizip::~CompressorArchiveMinizip() = default; bool CompressorArchiveMinizip::CreateArchive() { // Set up archive object. @@ -147,7 +151,7 @@ zip_file_ = zipOpen2(nullptr /* pathname */, APPEND_STATUS_CREATE, nullptr /* globalcomment */, &zip_funcs); if (!zip_file_) { - set_error_message(compressor_archive_constants::kCreateArchiveError); + set_error_message(kCreateArchiveError); return false /* Error */; } return true /* Success */; @@ -204,7 +208,7 @@ LANGUAGE_ENCODING_FLAG); // flagBase if (open_result != ZIP_OK) { CloseArchive(true /* has_error */); - set_error_message(compressor_archive_constants::kAddToArchiveError); + set_error_message(kAddToArchiveError); return false /* Error */; } @@ -212,12 +216,11 @@ if (!is_directory) { int64_t remaining_size = file_size; while (remaining_size > 0) { - int64_t chunk_size = std::min( - remaining_size, compressor_stream_constants::kMaximumDataChunkSize); + int64_t chunk_size = std::min(remaining_size, kMaximumDataChunkSize); PP_DCHECK(chunk_size > 0); int64_t read_bytes = - compressor_stream_->Read(chunk_size, destination_buffer_); + compressor_stream_->Read(chunk_size, destination_buffer_.get()); // Negative read_bytes indicates an error occurred when reading chunks. // 0 just means there is no more data available, but here we need positive // length of bytes, so this is also an error here. @@ -230,8 +233,8 @@ break; } - if (zipWriteInFileInZip(zip_file_, destination_buffer_, read_bytes) != - ZIP_OK) { + if (zipWriteInFileInZip(zip_file_, destination_buffer_.get(), + read_bytes) != ZIP_OK) { has_error = true; break; } @@ -244,7 +247,7 @@ if (has_error) { CloseArchive(true /* has_error */); - set_error_message(compressor_archive_constants::kAddToArchiveError); + set_error_message(kAddToArchiveError); return false /* Error */; } @@ -258,12 +261,12 @@ bool CompressorArchiveMinizip::CloseArchive(bool has_error) { if (zipClose(zip_file_, nullptr /* global_comment */) != ZIP_OK) { - set_error_message(compressor_archive_constants::kCloseArchiveError); + set_error_message(kCloseArchiveError); return false /* Error */; } if (!has_error) { if (compressor_stream()->Flush() < 0) { - set_error_message(compressor_archive_constants::kCloseArchiveError); + set_error_message(kCloseArchiveError); return false /* Error */; } }
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.h index 166643d..b2d739a 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_RESOURCES_CHROMEOS_ZIP_ARCHIVER_CPP_COMPRESSOR_ARCHIVE_MINIZIP_H_ #define CHROME_BROWSER_RESOURCES_CHROMEOS_ZIP_ARCHIVER_CPP_COMPRESSOR_ARCHIVE_MINIZIP_H_ +#include <memory> #include <string> #include "chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive.h" @@ -13,15 +14,6 @@ class CompressorStream; -// A namespace with constants used by CompressorArchiveMinizip. -namespace compressor_archive_constants { - -const char kCreateArchiveError[] = "Failed to create archive."; -const char kAddToArchiveError[] = "Failed to add entry to archive."; -const char kCloseArchiveError[] = "Failed to close archive."; - -} // namespace compressor_archive_constants - // A name space with custom functions passed to minizip. namespace compressor_archive_functions { @@ -98,7 +90,7 @@ zipFile zip_file_; // The buffer used to store the data read from JavaScript. - char* destination_buffer_; + std::unique_ptr<char[]> destination_buffer_; // The current offset of the zip archive file. int64_t offset_;
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.cc index 556c127..879671e9 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.cc +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.cc
@@ -11,6 +11,13 @@ #include "chrome/browser/resources/chromeos/zip_archiver/cpp/javascript_compressor_requestor_interface.h" #include "ppapi/cpp/logging.h" +namespace { + +// We need at least 256KB for MiniZip. +const int64_t kMaximumDataChunkSize = 512 * 1024; + +} // namespace + CompressorIOJavaScriptStream::CompressorIOJavaScriptStream( JavaScriptCompressorRequestorInterface* requestor) : requestor_(requestor), buffer_offset_(-1), buffer_data_length_(0) { @@ -20,7 +27,7 @@ pthread_mutex_lock(&shared_state_lock_); available_data_ = false; - buffer_ = new char[compressor_stream_constants::kMaximumDataChunkSize]; + buffer_ = new char[kMaximumDataChunkSize]; pthread_mutex_unlock(&shared_state_lock_); } @@ -89,10 +96,9 @@ // 4: The index to write is outside the buffer. // If we want to write data outside the range, we first need to flush // the buffer, and then cache the data in the buffer. - if (buffer_offset_ >= 0 && /* 1 */ - (current_offset != buffer_offset_ + buffer_data_length_ || /* 2 */ - buffer_data_length_ + left_length > - compressor_stream_constants::kMaximumDataChunkSize) && /* 3 */ + if (buffer_offset_ >= 0 && /* 1 */ + (current_offset != buffer_offset_ + buffer_data_length_ || /* 2 */ + buffer_data_length_ + left_length > kMaximumDataChunkSize) && /* 3 */ (current_offset < buffer_offset_ || buffer_offset_ + buffer_data_length_ < current_offset + left_length) /* 4 */) { @@ -104,8 +110,7 @@ } // How many bytes we should copy to buffer_ in this iteration. - int64_t copy_length = std::min( - left_length, compressor_stream_constants::kMaximumDataChunkSize); + int64_t copy_length = std::min(left_length, kMaximumDataChunkSize); // Set up the buffer_offset_ if the buffer_ has no data. if (buffer_offset_ == -1 /* initial state */) buffer_offset_ = current_offset;
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h index 281a7be..1605cc9 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h
@@ -18,12 +18,6 @@ class JavaScriptCompressorRequestorInterface; -// A namespace with constants used by CompressorArchiveMinizip. -namespace compressor_stream_constants { -// We need at least 256KB for MiniZip. -const int64_t kMaximumDataChunkSize = 512 * 1024; -} // namespace compressor_stream_constants - class CompressorIOJavaScriptStream : public CompressorStream { public: CompressorIOJavaScriptStream(
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.cc index 8ca3d7df..b41cfeeb 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.cc +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.cc
@@ -16,6 +16,38 @@ namespace { +const char kArchiveOpenError[] = "Failed to open archive."; +const char kArchiveNextHeaderError[] = + "Failed to open current file in archive."; +const char kArchiveReadDataError[] = "Failed to read archive data."; +const char kArchiveReadFreeError[] = "Failed to close archive."; + +// The size of the buffer used to skip unnecessary data. Should be positive and +// UINT16_MAX or less. unzReadCurrentFile in third_party/minizip/src/unzip.c +// supports to read a data up to UINT16_MAX at a time. +const int64_t kDummyBufferSize = UINT16_MAX; // ~64 KB + +// The size of the buffer used by ReadInProgress to decompress data. Should be +// positive and UINT16_MAX or less. unzReadCurrentFile in +// third_party/minizip/src/unzip.c supports to read a data up to UINT16_MAX at a +// time. +const int64_t kDecompressBufferSize = UINT16_MAX; // ~64 KB. + +// The maximum data chunk size for VolumeReader::Read requests. +// Should be positive. +const int64_t kMaximumDataChunkSize = 512 * 1024; // 512 KB. + +// The minimum data chunk size for VolumeReader::Read requests. +// Should be positive. +const int64_t kMinimumDataChunkSize = 32 * 1024; // 16 KB. + +// Maximum length of filename in zip archive. +const int kZipMaxPath = 256; + +// The size of the static cache. We need at least 64KB to cache whole +// 'end of central directory' data. +const int64_t kStaticCacheSize = 128 * 1024; + base::Time::Exploded ExplodeDosdate(uint32_t dos_timedate) { base::Time::Exploded exploded_time = {}; exploded_time.year = 1980 + ((dos_timedate >> 25) & 0x7f); @@ -45,12 +77,11 @@ return -1 /* Error */; } - int64_t bytes_to_read = - std::min(volume_archive_constants::kMaximumDataChunkSize, - archive->reader()->archive_size() - offset); + int64_t bytes_to_read = std::min(kMaximumDataChunkSize, + archive->reader()->archive_size() - offset); PP_DCHECK(bytes_to_read > 0); int64_t left_length = bytes_to_read; - char* buffer_pointer = archive->dynamic_cache_; + char* buffer_pointer = archive->dynamic_cache_.get(); const void* destination_buffer; do { @@ -88,7 +119,8 @@ if (offset >= archive_minizip->static_cache_offset_) { // Relative offset in the central directory. int64_t offset_in_cache = offset - archive_minizip->static_cache_offset_; - memcpy(buffer, archive_minizip->static_cache_ + offset_in_cache, size); + memcpy(buffer, archive_minizip->static_cache_.get() + offset_in_cache, + size); if (archive_minizip->reader()->Seek(static_cast<int64_t>(size), ZLIB_FILEFUNC_SEEK_CUR) < 0) { return -1 /* Error */; @@ -117,7 +149,8 @@ int64_t copy_length = std::min( left_length, archive_minizip->dynamic_cache_size_ - offset_in_cache); memcpy(unzip_buffer_pointer, - archive_minizip->dynamic_cache_ + offset_in_cache, copy_length); + archive_minizip->dynamic_cache_.get() + offset_in_cache, + copy_length); unzip_buffer_pointer += copy_length; left_length -= copy_length; if (archive_minizip->reader()->Seek(static_cast<int64_t>(copy_length), @@ -173,15 +206,20 @@ VolumeArchiveMinizip::VolumeArchiveMinizip(VolumeReader* reader) : VolumeArchive(reader), - reader_data_size_(volume_archive_constants::kMinimumDataChunkSize), + reader_data_size_(kMinimumDataChunkSize), zip_file_(nullptr), + dynamic_cache_(std::make_unique<char[]>(kMaximumDataChunkSize)), dynamic_cache_offset_(0), dynamic_cache_size_(0), + static_cache_(std::make_unique<char[]>(kStaticCacheSize)), static_cache_offset_(0), static_cache_size_(0), last_read_data_offset_(0), last_read_data_length_(0), + dummy_buffer_(std::make_unique<char[]>(kDummyBufferSize)), decompressed_data_(nullptr), + decompressed_data_buffer_( + std::make_unique<char[]>(kDecompressBufferSize)), decompressed_data_size_(0), decompressed_error_(false) {} @@ -203,15 +241,14 @@ // Load maximum static_cache_size_ bytes from the end of the archive to // static_cache_. - static_cache_size_ = std::min(volume_archive_constants::kStaticCacheSize, - reader()->archive_size()); + static_cache_size_ = std::min(kStaticCacheSize, reader()->archive_size()); int64_t previous_offset = reader()->offset(); - char* buffer_pointer = static_cache_; + char* buffer_pointer = static_cache_.get(); int64_t left_length = static_cache_size_; static_cache_offset_ = std::max(reader()->archive_size() - static_cache_size_, 0LL); if (reader()->Seek(static_cache_offset_, ZLIB_FILEFUNC_SEEK_SET) < 0) { - set_error_message(volume_archive_constants::kArchiveOpenError); + set_error_message(kArchiveOpenError); return false /* Error */; } do { @@ -224,13 +261,13 @@ // Set the offset to the original position. if (reader()->Seek(previous_offset, ZLIB_FILEFUNC_SEEK_SET) < 0) { - set_error_message(volume_archive_constants::kArchiveOpenError); + set_error_message(kArchiveOpenError); return false /* Error */; } zip_file_ = unzOpen2(nullptr /* filename */, &zip_funcs); if (!zip_file_) { - set_error_message(volume_archive_constants::kArchiveOpenError); + set_error_message(kArchiveOpenError); return false; } @@ -246,7 +283,7 @@ // Headers are being read from the central directory (in the ZIP format), so // use a large block size to save on IPC calls. The headers in EOCD are // grouped one by one. - reader_data_size_ = volume_archive_constants::kMaximumDataChunkSize; + reader_data_size_ = kMaximumDataChunkSize; // Reset to 0 for new VolumeArchive::ReadData operation. last_read_data_offset_ = 0; @@ -254,13 +291,13 @@ unz_file_pos position = {}; if (unzGetFilePos(zip_file_, &position) != UNZ_OK) { - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return VolumeArchive::RESULT_FAIL; } // Get the information of the opened file. unz_file_info raw_file_info = {}; - char raw_file_name_in_zip[volume_archive_constants::kZipMaxPath] = {}; + char raw_file_name_in_zip[kZipMaxPath] = {}; const int result = unzGetCurrentFileInfo(zip_file_, &raw_file_info, raw_file_name_in_zip, sizeof(raw_file_name_in_zip) - 1, @@ -270,7 +307,7 @@ 0); // commentBufferSize. if (result != UNZ_OK || raw_file_name_in_zip[0] == '\0') { - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return VolumeArchive::RESULT_FAIL; } *pathname = std::string(raw_file_name_in_zip); @@ -302,7 +339,7 @@ if (return_value == UNZ_OK) return VolumeArchive::RESULT_SUCCESS; - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return VolumeArchive::RESULT_FAIL; } @@ -315,19 +352,19 @@ // sensitive. if (unzLocateFile(zip_file_, path_name.c_str(), nullptr /* filename_compare_func */) != UNZ_OK) { - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return false; } unz_file_info raw_file_info = {}; - char raw_file_name_in_zip[volume_archive_constants::kZipMaxPath] = {}; + char raw_file_name_in_zip[kZipMaxPath] = {}; if (unzGetCurrentFileInfo(zip_file_, &raw_file_info, raw_file_name_in_zip, sizeof(raw_file_name_in_zip) - 1, nullptr, // extraField. 0, // extraFieldBufferSize. nullptr, // szComment. 0) != UNZ_OK) { - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return false; } @@ -362,7 +399,7 @@ } if (open_result != UNZ_OK) { - set_error_message(volume_archive_constants::kArchiveNextHeaderError); + set_error_message(kArchiveNextHeaderError); return false; } @@ -377,8 +414,7 @@ // Requests with offset smaller than last read offset are not supported. if (offset < last_read_data_offset_) { - set_error_message( - std::string(volume_archive_constants::kArchiveReadDataError)); + set_error_message(std::string(kArchiveReadDataError)); decompressed_error_ = true; return; } @@ -393,23 +429,21 @@ // offset - last_read_data_offset_, kMaximumDataChunkSize in case the former // is too big or kMinimumDataChunkSize in case its too small and we might // end up with too many IPCs. - reader_data_size_ = - std::max(std::min(offset - last_read_data_offset_, - volume_archive_constants::kMaximumDataChunkSize), - volume_archive_constants::kMinimumDataChunkSize); + reader_data_size_ = std::max( + std::min(offset - last_read_data_offset_, kMaximumDataChunkSize), + kMinimumDataChunkSize); // No need for an offset in dummy_buffer as it will be ignored anyway. // archive_read_data receives size_t as length parameter, but we limit it to - // volume_archive_constants::kDummyBufferSize which is positive and less + // kDummyBufferSize which is positive and less // than size_t maximum. So conversion from int64_t to size_t is safe here. size = unzReadCurrentFile( - zip_file_, dummy_buffer_, - std::min(offset - last_read_data_offset_, - volume_archive_constants::kDummyBufferSize)); + zip_file_, dummy_buffer_.get(), + std::min(offset - last_read_data_offset_, kDummyBufferSize)); PP_DCHECK(size != 0); // The actual read is done below. We shouldn't get to // end of file here. if (size < 0) { // Error. - set_error_message(volume_archive_constants::kArchiveReadDataError); + set_error_message(kArchiveReadDataError); decompressed_error_ = true; return; } @@ -418,29 +452,27 @@ // Do not decompress more bytes than we can store internally. The // kDecompressBufferSize limit is used to avoid huge memory usage. - int64_t left_length = - std::min(length, volume_archive_constants::kDecompressBufferSize); + int64_t left_length = std::min(length, kDecompressBufferSize); // ReadData will call CustomArchiveRead when calling archive_read_data. The // read should be done with a value similar to length, which is the requested // number of bytes, or kMaximumDataChunkSize / kMinimumDataChunkSize // in case length is too big or too small. - reader_data_size_ = - std::max(std::min(static_cast<int64_t>(left_length), - volume_archive_constants::kMaximumDataChunkSize), - volume_archive_constants::kMinimumDataChunkSize); + reader_data_size_ = std::max( + std::min(static_cast<int64_t>(left_length), kMaximumDataChunkSize), + kMinimumDataChunkSize); // Perform the actual copy. int64_t bytes_read = 0; do { // archive_read_data receives size_t as length parameter, but we limit it to - // volume_archive_constants::kMinimumDataChunkSize (see left_length + // kMinimumDataChunkSize (see left_length // initialization), which is positive and less than size_t maximum. // So conversion from int64_t to size_t is safe here. - size = unzReadCurrentFile(zip_file_, decompressed_data_buffer_ + bytes_read, - left_length); + size = unzReadCurrentFile( + zip_file_, decompressed_data_buffer_.get() + bytes_read, left_length); if (size < 0) { // Error. - set_error_message(volume_archive_constants::kArchiveReadDataError); + set_error_message(kArchiveReadDataError); decompressed_error_ = true; return; } @@ -452,7 +484,7 @@ // beginning of the buffer. VolumeArchiveMinizip::ConsumeData is used // to preserve the bytes that are decompressed but not required by // VolumeArchiveMinizip::ReadData. - decompressed_data_ = decompressed_data_buffer_; + decompressed_data_ = decompressed_data_buffer_.get(); decompressed_data_size_ = bytes_read; } @@ -460,7 +492,7 @@ bool returnValue = true; if (zip_file_) { if (unzClose(zip_file_) != UNZ_OK) { - set_error_message(volume_archive_constants::kArchiveReadFreeError); + set_error_message(kArchiveReadFreeError); returnValue = false; } } @@ -486,7 +518,7 @@ // Decompressed failed. if (decompressed_error_) { - set_error_message(volume_archive_constants::kArchiveReadDataError); + set_error_message(kArchiveReadDataError); return -1 /* Error */; } @@ -502,8 +534,7 @@ last_read_data_offset_ += read_bytes; PP_DCHECK(decompressed_data_ + decompressed_data_size_ <= - decompressed_data_buffer_ + - volume_archive_constants::kDecompressBufferSize); + decompressed_data_buffer_.get() + kDecompressBufferSize); return read_bytes; }
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h index 425e4a0..784d4e7 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h
@@ -14,46 +14,6 @@ #include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive.h" -// A namespace with constants used by VolumeArchiveMinizip. -namespace volume_archive_constants { - -const char kArchiveReadNewError[] = "Could not allocate archive."; -const char kFileNotFound[] = "File not found for read data request."; -const char kVolumeReaderError[] = "VolumeReader failed to retrieve data."; -const char kArchiveOpenError[] = "Failed to open archive."; -const char kArchiveNextHeaderError[] = - "Failed to open current file in archive."; -const char kArchiveReadDataError[] = "Failed to read archive data."; -const char kArchiveReadFreeError[] = "Failed to close archive."; - -// The size of the buffer used to skip unnecessary data. Should be positive and -// UINT16_MAX or less. unzReadCurrentFile in third_party/minizip/src/unzip.c -// supports to read a data up to UINT16_MAX at a time. -const int64_t kDummyBufferSize = UINT16_MAX; // ~64 KB - -// The size of the buffer used by ReadInProgress to decompress data. Should be -// positive and UINT16_MAX or less. unzReadCurrentFile in -// third_party/minizip/src/unzip.c supports to read a data up to UINT16_MAX at a -// time. -const int64_t kDecompressBufferSize = UINT16_MAX; // ~64 KB. - -// The maximum data chunk size for VolumeReader::Read requests. -// Should be positive. -const int64_t kMaximumDataChunkSize = 512 * 1024; // 512 KB. - -// The minimum data chunk size for VolumeReader::Read requests. -// Should be positive. -const int64_t kMinimumDataChunkSize = 32 * 1024; // 16 KB. - -// Maximum length of filename in zip archive. -const int kZipMaxPath = 256; - -// The size of the static cache. We need at least 64KB to cache whole -// 'end of central directory' data. -const int64_t kStaticCacheSize = 128 * 1024; - -} // namespace volume_archive_constants - class VolumeArchiveMinizip; // A namespace with custom functions passed to minizip. @@ -148,7 +108,7 @@ // chunk is small, we load larger size of bytes from the archive and cache // them in dynamic_cache_. If the range of the next requested chunk is within // the cache, we don't read the archive and just return the data in the cache. - char dynamic_cache_[volume_archive_constants::kMaximumDataChunkSize]; + std::unique_ptr<char[]> dynamic_cache_; // The offset from which dynamic_cache_ has the data of the archive. int64_t dynamic_cache_offset_; @@ -163,7 +123,7 @@ // cache a certain length of data from the end into static_cache_. The data // in this buffer is also used when the data in the central directory is // requested by MiniZip later. - char static_cache_[volume_archive_constants::kStaticCacheSize]; + std::unique_ptr<char[]> static_cache_; // The offset from which static_cache_ has the data of the archive. int64_t static_cache_offset_; @@ -197,7 +157,7 @@ // offsets different from last_read_data_offset_. In this case some bytes // must be skipped. Because seeking is not possible inside compressed files, // the bytes will be discarded using this buffer. - char dummy_buffer_[volume_archive_constants::kDummyBufferSize]; + std::unique_ptr<char[]> dummy_buffer_; // The address where the decompressed data starting from // decompressed_offset_ is stored. It should point to a valid location @@ -207,8 +167,7 @@ char* decompressed_data_; // The actual buffer that contains the decompressed data. - char decompressed_data_buffer_ - [volume_archive_constants::kDecompressBufferSize]; + std::unique_ptr<char[]> decompressed_data_buffer_; // The size of valid data starting from decompressed_data_ that is stored // inside decompressed_data_buffer_.
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html index d120aec94..ea21039 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -88,10 +88,6 @@ $i18nRaw{improveBrowsingExperience} </p> </div> - <settings-personalization-options prefs="{{prefs}}" - page-visibility="[[pageVisibility]]" - unified-consent-enabled="[[unifiedConsentEnabled_]]"> - </settings-personalization-options> </template> <if expr="not chromeos"> <settings-toggle-button id="signinAllowedToggle" @@ -101,6 +97,12 @@ on-settings-boolean-control-change="onSigninAllowedChange_"> </settings-toggle-button> </if><!-- not chromeos --> + <template is="dom-if" if="[[!unifiedConsentEnabled_]]"> + <settings-personalization-options prefs="{{prefs}}" + page-visibility="[[pageVisibility]]" + unified-consent-enabled="[[unifiedConsentEnabled_]]"> + </settings-personalization-options> + </template> <settings-toggle-button id="doNotTrack" pref="{{prefs.enable_do_not_track}}" label="$i18n{doNotTrack}" on-settings-boolean-control-change="onDoNotTrackChange_"
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn index b06bed7..dbdb32b0 100644 --- a/chrome/browser/safe_browsing/BUILD.gn +++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -7,31 +7,6 @@ static_library("safe_browsing") { sources = [ - "chrome_cleaner/chrome_cleaner_controller_impl_win.cc", - "chrome_cleaner/chrome_cleaner_controller_impl_win.h", - "chrome_cleaner/chrome_cleaner_controller_win.h", - "chrome_cleaner/chrome_cleaner_extensions_util_win.h", - "chrome_cleaner/chrome_cleaner_fetcher_win.cc", - "chrome_cleaner/chrome_cleaner_fetcher_win.h", - "chrome_cleaner/chrome_cleaner_navigation_util_win.cc", - "chrome_cleaner/chrome_cleaner_navigation_util_win.h", - "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_impl_win.cc", - "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_impl_win.h", - "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_win.h", - "chrome_cleaner/chrome_cleaner_runner_win.cc", - "chrome_cleaner/chrome_cleaner_runner_win.h", - "chrome_cleaner/chrome_cleaner_scanner_results.cc", - "chrome_cleaner/chrome_cleaner_scanner_results.h", - "chrome_cleaner/reporter_runner_win.cc", - "chrome_cleaner/reporter_runner_win.h", - "chrome_cleaner/settings_resetter_win.cc", - "chrome_cleaner/settings_resetter_win.h", - "chrome_cleaner/srt_chrome_prompt_impl.cc", - "chrome_cleaner/srt_chrome_prompt_impl.h", - "chrome_cleaner/srt_client_info_win.cc", - "chrome_cleaner/srt_client_info_win.h", - "chrome_cleaner/srt_field_trial_win.cc", - "chrome_cleaner/srt_field_trial_win.h", "safe_browsing_controller_client.cc", "safe_browsing_controller_client.h", "safe_browsing_tab_observer.cc", @@ -50,9 +25,34 @@ if (enable_extensions) { sources += [ + "chrome_cleaner/chrome_cleaner_controller_impl_win.cc", + "chrome_cleaner/chrome_cleaner_controller_impl_win.h", + "chrome_cleaner/chrome_cleaner_controller_win.h", "chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc", "chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.h", "chrome_cleaner/chrome_cleaner_dialog_controller_win.h", + "chrome_cleaner/chrome_cleaner_extensions_util_win.h", + "chrome_cleaner/chrome_cleaner_fetcher_win.cc", + "chrome_cleaner/chrome_cleaner_fetcher_win.h", + "chrome_cleaner/chrome_cleaner_navigation_util_win.cc", + "chrome_cleaner/chrome_cleaner_navigation_util_win.h", + "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_impl_win.cc", + "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_impl_win.h", + "chrome_cleaner/chrome_cleaner_reboot_dialog_controller_win.h", + "chrome_cleaner/chrome_cleaner_runner_win.cc", + "chrome_cleaner/chrome_cleaner_runner_win.h", + "chrome_cleaner/chrome_cleaner_scanner_results.cc", + "chrome_cleaner/chrome_cleaner_scanner_results.h", + "chrome_cleaner/reporter_runner_win.cc", + "chrome_cleaner/reporter_runner_win.h", + "chrome_cleaner/settings_resetter_win.cc", + "chrome_cleaner/settings_resetter_win.h", + "chrome_cleaner/srt_chrome_prompt_impl.cc", + "chrome_cleaner/srt_chrome_prompt_impl.h", + "chrome_cleaner/srt_client_info_win.cc", + "chrome_cleaner/srt_client_info_win.h", + "chrome_cleaner/srt_field_trial_win.cc", + "chrome_cleaner/srt_field_trial_win.h", "settings_reset_prompt/default_settings_fetcher.cc", "settings_reset_prompt/default_settings_fetcher.h", "settings_reset_prompt/settings_reset_prompt_config.cc",
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc index 715704f2..1e76621 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
@@ -472,6 +472,7 @@ void ChromeCleanerControllerImpl::ReplyWithUserResponse( Profile* profile, + extensions::ExtensionService* extension_service, UserResponse user_response) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); @@ -489,6 +490,7 @@ RecordCleanerLogsAcceptanceHistogram(true); new_state = State::kCleaning; delegate_->TagForResetting(profile); + extension_service_ = extension_service; break; case UserResponse::kAcceptedWithoutLogs: acceptance = PromptAcceptance::ACCEPTED_WITHOUT_LOGS; @@ -496,6 +498,7 @@ RecordCleanerLogsAcceptanceHistogram(false); new_state = State::kCleaning; delegate_->TagForResetting(profile); + extension_service_ = extension_service; break; case UserResponse::kDenied: // Fallthrough case UserResponse::kDismissed: @@ -626,7 +629,8 @@ : ChromeCleanerRunner::ChromeMetricsStatus::kDisabled; ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( - executable_path, *reporter_invocation_, metrics_status, + extension_service_, executable_path, *reporter_invocation_, + metrics_status, base::Bind(&ChromeCleanerControllerImpl::WeakOnPromptUser, weak_factory_.GetWeakPtr()), base::Bind(&ChromeCleanerControllerImpl::OnConnectionClosed,
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h index 78f7dc11..645ec18 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h
@@ -65,6 +65,7 @@ void OnSwReporterReady(SwReporterInvocationSequence&& invocations) override; void Scan(const SwReporterInvocation& reporter_invocation) override; void ReplyWithUserResponse(Profile* profile, + extensions::ExtensionService* extension_service, UserResponse user_response) override; void Reboot() override; bool IsAllowedByPolicy() override; @@ -122,6 +123,8 @@ // Pointer to either real_delegate_ or one set by tests. ChromeCleanerControllerDelegate* delegate_; + extensions::ExtensionService* extension_service_; + State state_ = State::kIdle; // The logs permission checkboxes in the Chrome Cleaner dialog and webui page // are opt out.
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win_unittest.cc index a667129..e217adf 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win_unittest.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win_unittest.cc
@@ -16,6 +16,7 @@ #include "base/test/multiprocess_test.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" +#include "chrome/browser/extensions/extension_service_test_base.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -235,14 +236,16 @@ // Test fixture that runs a mock Chrome Cleaner process in various // configurations and mocks the user's response. class ChromeCleanerControllerTest - : public testing::TestWithParam<ChromeCleanerControllerTestParams>, + : public testing::WithParamInterface<ChromeCleanerControllerTestParams>, public ChromeCleanerRunnerTestDelegate, - public ChromeCleanerControllerDelegate { + public ChromeCleanerControllerDelegate, + public extensions::ExtensionServiceTestBase { public: ChromeCleanerControllerTest() = default; ~ChromeCleanerControllerTest() override {} void SetUp() override { + InitializeEmptyExtensionService(); std::tie(process_status_, crash_point_, uws_found_status_, registry_keys_reporting_, extensions_reporting_, user_response_) = GetParam(); @@ -436,11 +439,6 @@ } protected: - // We need this because we need UI and IO threads during tests. The thread - // bundle should be the first member of the class so that it will be destroyed - // last. - content::TestBrowserThreadBundle thread_bundle_; - CleanerProcessStatus process_status_; MockChromeCleanerProcess::CrashPoint crash_point_; UwsFoundStatus uws_found_status_; @@ -482,7 +480,8 @@ } TEST_P(ChromeCleanerControllerTest, WithMockCleanerProcess) { - TestingProfileManager profile_manager(TestingBrowserProcess::GetGlobal()); + TestingProfileManager profile_manager(TestingBrowserProcess::GetGlobal(), + &testing_local_state_); ASSERT_TRUE(profile_manager.SetUp()); constexpr char kTestProfileName1[] = "Test 1"; @@ -524,8 +523,8 @@ EXPECT_CALL(mock_observer_, OnInfected(_, _)) .WillOnce(DoAll(SaveArg<1>(&scanner_results_on_infected), InvokeWithoutArgs([this, profile1]() { - controller_->ReplyWithUserResponse(profile1, - user_response_); + controller_->ReplyWithUserResponse( + profile1, service(), user_response_); }))); // Since logs upload is enabled by default, OnLogsEnabledChanged() will be // called only if the user response is kAcceptedWithoutLogs.
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h index 10a110a..048c5cb 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h
@@ -11,6 +11,7 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_scanner_results.h" #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h" #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" @@ -190,8 +191,10 @@ // in the kInfected state. This gracefully handles cases where multiple user // responses are received, for example if a user manages to click on a // "Cleanup" button multiple times. - virtual void ReplyWithUserResponse(Profile* profile, - UserResponse user_response) = 0; + virtual void ReplyWithUserResponse( + Profile* profile, + extensions::ExtensionService* extension_service, + UserResponse user_response) = 0; // If the controller is in the kRebootRequired state, initiates a reboot of // the computer. Call this after obtaining permission from the user to
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc index e99ac1a..4bd8fc4 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_win.cc
@@ -7,6 +7,7 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_navigation_util_win.h" #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" @@ -15,6 +16,7 @@ #include "chrome/browser/ui/browser_list.h" #include "components/component_updater/pref_names.h" #include "components/prefs/pref_service.h" +#include "extensions/browser/extension_system.h" #include "ui/base/window_open_disposition.h" namespace safe_browsing { @@ -87,8 +89,13 @@ base::RecordAction( base::UserMetricsAction("SoftwareReporter.PromptDialog_Accepted")); + Profile* profile = browser_->profile(); + + extensions::ExtensionService* extension_service = + extensions::ExtensionSystem::Get(profile)->extension_service(); + cleaner_controller_->ReplyWithUserResponse( - browser_->profile(), + profile, extension_service, logs_enabled ? ChromeCleanerController::UserResponse::kAcceptedWithLogs : ChromeCleanerController::UserResponse::kAcceptedWithoutLogs); @@ -108,8 +115,14 @@ base::RecordAction( base::UserMetricsAction("SoftwareReporter.PromptDialog_Canceled")); + Profile* profile = browser_->profile(); + + extensions::ExtensionService* extension_service = + extensions::ExtensionSystem::Get(profile)->extension_service(); + cleaner_controller_->ReplyWithUserResponse( - browser_->profile(), ChromeCleanerController::UserResponse::kDenied); + profile, extension_service, + ChromeCleanerController::UserResponse::kDenied); OnInteractionDone(); } @@ -124,8 +137,14 @@ base::RecordAction( base::UserMetricsAction("SoftwareReporter.PromptDialog_Dismissed")); + Profile* profile = browser_->profile(); + + extensions::ExtensionService* extension_service = + extensions::ExtensionSystem::Get(profile)->extension_service(); + cleaner_controller_->ReplyWithUserResponse( - browser_->profile(), ChromeCleanerController::UserResponse::kDismissed); + profile, extension_service, + ChromeCleanerController::UserResponse::kDismissed); OnInteractionDone(); }
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc index 487ed4b..e690eac 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc
@@ -23,10 +23,12 @@ #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_task_traits.h" +#include "extensions/browser/extension_system.h" #include "mojo/public/cpp/platform/platform_channel.h" #include "mojo/public/cpp/system/invitation.h" #include "mojo/public/cpp/system/message_pipe.h" +using extensions::ExtensionService; using chrome_cleaner::mojom::ChromePrompt; using chrome_cleaner::mojom::ChromePromptRequest; using content::BrowserThread; @@ -47,6 +49,7 @@ // static void ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( + ExtensionService* extension_service, const base::FilePath& cleaner_executable_path, const SwReporterInvocation& reporter_invocation, ChromeMetricsStatus metrics_status, @@ -55,9 +58,10 @@ ChromeCleanerRunner::ProcessDoneCallback on_process_done, scoped_refptr<base::SequencedTaskRunner> task_runner) { auto cleaner_runner = base::WrapRefCounted(new ChromeCleanerRunner( - cleaner_executable_path, reporter_invocation, metrics_status, - std::move(on_prompt_user), std::move(on_connection_closed), - std::move(on_process_done), std::move(task_runner))); + extension_service, cleaner_executable_path, reporter_invocation, + metrics_status, std::move(on_prompt_user), + std::move(on_connection_closed), std::move(on_process_done), + std::move(task_runner))); auto launch_and_wait = base::BindOnce( &ChromeCleanerRunner::LaunchAndWaitForExitOnBackgroundThread, cleaner_runner); @@ -74,6 +78,7 @@ } ChromeCleanerRunner::ChromeCleanerRunner( + ExtensionService* extension_service, const base::FilePath& cleaner_executable_path, const SwReporterInvocation& reporter_invocation, ChromeMetricsStatus metrics_status, @@ -85,7 +90,8 @@ cleaner_command_line_(cleaner_executable_path), on_prompt_user_(std::move(on_prompt_user)), on_connection_closed_(std::move(on_connection_closed)), - on_process_done_(std::move(on_process_done)) { + on_process_done_(std::move(on_process_done)), + extension_service_(extension_service) { DCHECK(on_prompt_user_); DCHECK(on_connection_closed_); DCHECK(on_process_done_); @@ -213,7 +219,7 @@ // Cannot use std::make_unique() since it does not support creating // std::unique_ptrs with custom deleters. chrome_prompt_impl_.reset(new ChromePromptImpl( - std::move(chrome_prompt_request), + extension_service_, std::move(chrome_prompt_request), base::Bind(&ChromeCleanerRunner::OnConnectionClosed, base::RetainedRef(this)), base::Bind(&ChromeCleanerRunner::OnPromptUser, base::RetainedRef(this))));
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h index 5945e5c4..41b96a6a 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h
@@ -21,6 +21,7 @@ #include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" #include "content/public/browser/browser_thread.h" +#include "extensions/browser/extension_system.h" namespace safe_browsing { @@ -88,15 +89,19 @@ // // This function will pass command line flags to the Chrome Cleaner executable // as appropriate based on the flags in |reporter_invocation| and the - // |metrics_status| parameters The Cleaner process will communicate with + // |metrics_status| parameters. The Cleaner process will communicate with // Chrome via a Mojo IPC interface and any IPC requests or notifications are // passed to the caller via the |on_prompt_user| and |on_connection_closed| // callbacks. Finally, when the Chrome Cleaner process terminates, a // ProcessStatus is passed along to |on_process_done|. // + // This IPC interface needs the |extension_service| in order to + // disable extensions that the Cleaner process wants to disable. + // // The details of the mojo interface are documented in // "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h". static void RunChromeCleanerAndReplyWithExitCode( + extensions::ExtensionService* extension_service, const base::FilePath& cleaner_executable_path, const SwReporterInvocation& reporter_invocation, ChromeMetricsStatus metrics_status, @@ -110,7 +115,8 @@ ~ChromeCleanerRunner(); - ChromeCleanerRunner(const base::FilePath& cleaner_executable_path, + ChromeCleanerRunner(extensions::ExtensionService* extension_service, + const base::FilePath& cleaner_executable_path, const SwReporterInvocation& reporter_invocation, ChromeMetricsStatus metrics_status, ChromePromptImpl::OnPromptUser on_prompt_user, @@ -139,6 +145,7 @@ std::unique_ptr<ChromePromptImpl, content::BrowserThread::DeleteOnIOThread> chrome_prompt_impl_; + extensions::ExtensionService* extension_service_; }; // A delegate class used to override launching of the Cleaner proccess for
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win_unittest.cc index cd7ecddd0..f0b99ce 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win_unittest.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win_unittest.cc
@@ -115,6 +115,7 @@ reporter_invocation.set_chrome_prompt(chrome_prompt_); ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( + /*extension_service=*/nullptr, base::FilePath(FILE_PATH_LITERAL("cleaner.exe")), reporter_invocation, metrics_status_, base::BindOnce(&ChromeCleanerRunnerSimpleTest::OnPromptUser, @@ -300,6 +301,7 @@ void CallRunChromeCleaner() { base::CommandLine command_line(base::CommandLine::NO_PROGRAM); ChromeCleanerRunner::RunChromeCleanerAndReplyWithExitCode( + /*extension_service=*/nullptr, base::FilePath(FILE_PATH_LITERAL("cleaner.exe")), SwReporterInvocation(command_line), ChromeMetricsStatus::kDisabled, base::BindOnce(&ChromeCleanerRunnerTest::OnPromptUser,
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_controller_win.h b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_controller_win.h index f1e8d41..03736cd4 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_controller_win.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_controller_win.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_MOCK_CHROME_CLEANER_CONTROLLER_WIN_H_ #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_MOCK_CHROME_CLEANER_CONTROLLER_WIN_H_ +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h" #include "testing/gmock/include/gmock/gmock.h" @@ -32,7 +33,8 @@ MOCK_METHOD0(RequestUserInitiatedScan, void()); MOCK_METHOD1(MockedOnSwReporterReady, void(SwReporterInvocationSequence&)); MOCK_METHOD1(Scan, void(const safe_browsing::SwReporterInvocation&)); - MOCK_METHOD2(ReplyWithUserResponse, void(Profile*, UserResponse)); + MOCK_METHOD3(ReplyWithUserResponse, + void(Profile*, extensions::ExtensionService*, UserResponse)); MOCK_METHOD0(Reboot, void()); MOCK_METHOD0(IsAllowedByPolicy, bool()); MOCK_METHOD0(IsReportingAllowedByPolicy, bool());
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc index 2490b12..d43cce3 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc
@@ -4,12 +4,17 @@ #include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" +#include <algorithm> #include <utility> #include "base/files/file_path.h" #include "base/location.h" #include "base/logging.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/extensions/extension_service.h" +#include "components/crx_file/id_util.h" #include "content/public/browser/browser_thread.h" +#include "extensions/browser/disable_reason.h" namespace safe_browsing { @@ -18,10 +23,13 @@ using chrome_cleaner::mojom::PromptAcceptance; using content::BrowserThread; -ChromePromptImpl::ChromePromptImpl(ChromePromptRequest request, - base::Closure on_connection_closed, - OnPromptUser on_prompt_user) +ChromePromptImpl::ChromePromptImpl( + extensions::ExtensionService* extension_service, + ChromePromptRequest request, + base::RepeatingClosure on_connection_closed, + OnPromptUser on_prompt_user) : binding_(this, std::move(request)), + extension_service_(extension_service), on_prompt_user_(std::move(on_prompt_user)) { DCHECK(on_prompt_user_); DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -56,4 +64,28 @@ } } +void ChromePromptImpl::DisableExtensions( + const std::vector<base::string16>& extension_ids, + ChromePrompt::DisableExtensionsCallback callback) { + if (extension_service_ == nullptr) { + std::move(callback).Run(false); + return; + } + bool ids_are_valid = std::all_of( + extension_ids.begin(), extension_ids.end(), [](const base::string16& id) { + return crx_file::id_util::IdIsValid(base::UTF16ToUTF8(id)); + }); + if (!ids_are_valid) { + std::move(callback).Run(false); + return; + } + + int reason = extensions::disable_reason::DISABLE_EXTERNAL_EXTENSION; + for (const base::string16& extension_id : extension_ids) { + extension_service_->DisableExtension(base::UTF16ToUTF8(extension_id), + reason); + } + std::move(callback).Run(true); +} + } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h index 520287c..9c71ce4 100644 --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h
@@ -12,6 +12,7 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_scanner_results.h" #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" #include "mojo/public/cpp/bindings/binding.h" @@ -26,7 +27,8 @@ ChromeCleanerScannerResults&&, chrome_cleaner::mojom::ChromePrompt::PromptUserCallback)>; - ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request, + ChromePromptImpl(extensions::ExtensionService* extension_service, + chrome_cleaner::mojom::ChromePromptRequest request, base::Closure on_connection_closed, OnPromptUser on_prompt_user); ~ChromePromptImpl() override; @@ -38,8 +40,14 @@ chrome_cleaner::mojom::ChromePrompt::PromptUserCallback callback) override; + void DisableExtensions( + const std::vector<base::string16>& extension_ids, + chrome_cleaner::mojom::ChromePrompt::DisableExtensionsCallback callback) + override; + private: mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_; + extensions::ExtensionService* extension_service_; OnPromptUser on_prompt_user_; DISALLOW_COPY_AND_ASSIGN(ChromePromptImpl);
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_delete_extension_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_delete_extension_win_unittest.cc new file mode 100644 index 0000000..30e4920 --- /dev/null +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_delete_extension_win_unittest.cc
@@ -0,0 +1,155 @@ +// Copyright 2018 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/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" + +#include "base/location.h" +#include "base/sequenced_task_runner.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/extension_service_test_base.h" +#include "chrome/browser/extensions/test_extension_service.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "extensions/browser/mock_extension_system.h" +#include "extensions/common/extension.h" +#include "extensions/common/extension_builder.h" +#include "extensions/common/extension_set.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace safe_browsing { + +class ExtensionDeletionTest : public extensions::ExtensionServiceTestBase { + public: + ExtensionDeletionTest() { InitializeEmptyExtensionService(); } + ~ExtensionDeletionTest() override = default; + + void SetUp() override {} + + private: + DISALLOW_COPY_AND_ASSIGN(ExtensionDeletionTest); +}; + +TEST_F(ExtensionDeletionTest, DisableExtensionTest) { + std::vector<base::string16> extension_ids{}; + extensions::ExtensionService* extension_service = this->service(); + for (int i = 40; i < 43; i++) { + scoped_refptr<extensions::Extension> extension = + extensions::ExtensionBuilder(base::NumberToString(i)) + .SetManifestKey("version", "1") + .Build(); + auto id = extension->id(); + extension_ids.push_back(base::UTF8ToUTF16(id)); + extension_service->AddExtension(extension.get()); + extension_service->EnableExtension(id); + } + std::unique_ptr<ChromePromptImpl> chrome_prompt = + std::make_unique<ChromePromptImpl>(extension_service, nullptr, + base::DoNothing(), base::DoNothing()); + std::vector<base::string16> extensions_to_disable{extension_ids[0]}; + chrome_prompt->DisableExtensions( + extensions_to_disable, + base::BindOnce([](bool result) { EXPECT_TRUE(result); })); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[0]))); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[1]))); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[2]))); + + extensions_to_disable.push_back(extension_ids[2]); + chrome_prompt->DisableExtensions( + extensions_to_disable, + base::BindOnce([](bool result) { EXPECT_TRUE(result); })); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[0]))); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[1]))); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[2]))); + + extensions_to_disable.push_back(extension_ids[1]); + chrome_prompt->DisableExtensions( + extensions_to_disable, + base::BindOnce([](bool result) { EXPECT_TRUE(result); })); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[0]))); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[1]))); + EXPECT_FALSE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[2]))); +} + +TEST_F(ExtensionDeletionTest, EmptyDeletionTest) { + std::vector<base::string16> extension_ids{}; + extensions::ExtensionService* extension_service = this->service(); + std::unique_ptr<ChromePromptImpl> chrome_prompt = + std::make_unique<ChromePromptImpl>(extension_service, nullptr, + base::DoNothing(), base::DoNothing()); + for (int i = 40; i < 43; i++) { + scoped_refptr<extensions::Extension> extension = + extensions::ExtensionBuilder(base::NumberToString(i)) + .SetManifestKey("version", "1") + .Build(); + auto id = extension->id(); + extension_ids.push_back(base::UTF8ToUTF16(id)); + extension_service->AddExtension(extension.get()); + extension_service->EnableExtension(id); + } + chrome_prompt->DisableExtensions( + {}, base::BindOnce([](bool result) { EXPECT_TRUE(result); })); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[0]))); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[1]))); + EXPECT_TRUE(extension_service->IsExtensionEnabled( + base::UTF16ToUTF8(extension_ids[2]))); +} + +TEST_F(ExtensionDeletionTest, BadlyFormattedDeletionTest) { + std::vector<base::string16> extension_ids{}; + extensions::ExtensionService* extension_service = this->service(); + std::unique_ptr<ChromePromptImpl> chrome_prompt = + std::make_unique<ChromePromptImpl>(extension_service, nullptr, + base::DoNothing(), base::DoNothing()); + for (int i = 40; i < 43; i++) { + scoped_refptr<extensions::Extension> extension = + extensions::ExtensionBuilder(base::NumberToString(i)) + .SetManifestKey("version", "1") + .Build(); + auto id = extension->id(); + extension_ids.push_back(base::UTF8ToUTF16(id)); + extension_service->AddExtension(extension.get()); + extension_service->EnableExtension(id); + } + chrome_prompt->DisableExtensions( + {L"bad-extension-id"}, + base::BindOnce([](bool result) { EXPECT_FALSE(result); })); + chrome_prompt->DisableExtensions( + {L""}, base::BindOnce([](bool result) { EXPECT_FALSE(result); })); + chrome_prompt->DisableExtensions( + {L"🤷☝¯\\_(ツ)_/¯✌🤷"}, + base::BindOnce([](bool result) { EXPECT_FALSE(result); })); +} + +TEST_F(ExtensionDeletionTest, NotInstalledExtensionTest) { + std::vector<base::string16> extension_ids{}; + extensions::ExtensionService* extension_service = this->service(); + std::unique_ptr<ChromePromptImpl> chrome_prompt = + std::make_unique<ChromePromptImpl>(extension_service, nullptr, + base::DoNothing(), base::DoNothing()); + for (int i = 40; i < 43; i++) { + // Don't actually install the extension + scoped_refptr<extensions::Extension> extension = + extensions::ExtensionBuilder(base::NumberToString(i)) + .SetManifestKey("version", "1") + .Build(); + auto id = extension->id(); + extension_ids.push_back(base::UTF8ToUTF16(id)); + } + chrome_prompt->DisableExtensions( + extension_ids, base::BindOnce([](bool result) { EXPECT_TRUE(result); })); +} + +} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc index f2faa9d..2ac593f 100644 --- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
@@ -172,13 +172,11 @@ // Set up keyed service factories. TestingProfile::TestingFactories factories; // Build up a custom history service. - factories.push_back(std::make_pair(HistoryServiceFactory::GetInstance(), - &BuildHistoryService)); + factories.emplace_back(HistoryServiceFactory::GetInstance(), + base::BindRepeating(&BuildHistoryService)); // Suppress WebHistoryService since it makes network requests. - factories.push_back(std::make_pair( - WebHistoryServiceFactory::GetInstance(), - static_cast<BrowserContextKeyedServiceFactory::TestingFactoryFunction>( - NULL))); + factories.emplace_back(WebHistoryServiceFactory::GetInstance(), + BrowserContextKeyedServiceFactory::TestingFactory()); // Create prefs for the profile with safe browsing enabled or not. std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> prefs( @@ -198,7 +196,7 @@ base::UTF8ToUTF16(profile_name), // user_name 0, // avatar_id std::string(), // supervised_user_id - factories); + std::move(factories)); return profile; }
diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc index 91d136f..b713e95 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.cc +++ b/chrome/browser/signin/account_consistency_mode_manager.cc
@@ -123,19 +123,15 @@ DCHECK(profile_); DCHECK(!profile_->IsOffTheRecord()); +#if BUILDFLAG(ENABLE_DICE_SUPPORT) PrefService* prefs = profile->GetPrefs(); - bool signin_allowed = prefs->GetBoolean(prefs::kSigninAllowed); - if (prefs->IsUserModifiablePreference(prefs::kSigninAllowed)) { - // Propagate settings changes from the previous launch to the signin-allowed - // pref. - signin_allowed = prefs->GetBoolean(prefs::kSigninAllowedOnNextStartup); - prefs->SetBoolean(prefs::kSigninAllowed, signin_allowed); - } else { - // When the signin-allowed pref is not user-modifiable(e.g. managed), reset - // signin-allowed-on-next-startup. - prefs->SetBoolean(prefs::kSigninAllowedOnNextStartup, signin_allowed); - } + // Propagate settings changes from the previous launch to the signin-allowed + // pref. + bool signin_allowed = prefs->GetBoolean(prefs::kSigninAllowedOnNextStartup); + prefs->SetBoolean(prefs::kSigninAllowed, signin_allowed); + UMA_HISTOGRAM_BOOLEAN("Signin.SigninAllowed", signin_allowed); +#endif account_consistency_ = ComputeAccountConsistencyMethod(profile_);
diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc index 1a3a295..be1f98a1 100644 --- a/chrome/browser/signin/signin_global_error_unittest.cc +++ b/chrome/browser/signin/signin_global_error_unittest.cc
@@ -9,6 +9,7 @@ #include <memory> #include <string> +#include "base/bind.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" @@ -50,11 +51,13 @@ // Create a signed-in profile. TestingProfile::TestingFactories testing_factories; - testing_factories.push_back(std::make_pair( - SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase)); + testing_factories.emplace_back( + SigninManagerFactory::GetInstance(), + base::BindRepeating(&BuildFakeSigninManagerBase)); profile_ = profile_manager_.CreateTestingProfile( "Person 1", std::unique_ptr<sync_preferences::PrefServiceSyncable>(), - base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories); + base::UTF8ToUTF16("Person 1"), 0, std::string(), + std::move(testing_factories)); SigninManagerFactory::GetForProfile(profile()) ->SetAuthenticatedAccountInfo(kTestAccountId, kTestUsername);
diff --git a/chrome/browser/signin/signin_ui_util_unittest.cc b/chrome/browser/signin/signin_ui_util_unittest.cc index 8f37c2c..3e115d27b 100644 --- a/chrome/browser/signin/signin_ui_util_unittest.cc +++ b/chrome/browser/signin/signin_ui_util_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/signin/signin_ui_util.h" +#include "base/bind.h" #include "base/macros.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/user_action_tester.h" @@ -131,11 +132,13 @@ // BrowserWithTestWindowTest: TestingProfile::TestingFactories GetTestingFactories() override { - return {{SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase}, + return {{SigninManagerFactory::GetInstance(), + base::BindRepeating(&BuildFakeSigninManagerBase)}, {ProfileOAuth2TokenServiceFactory::GetInstance(), - BuildFakeProfileOAuth2TokenService}, + base::BindRepeating(&BuildFakeProfileOAuth2TokenService)}, {GaiaCookieManagerServiceFactory::GetInstance(), - BuildFakeGaiaCookieManagerServiceNoFakeUrlFetcher}}; + base::BindRepeating( + &BuildFakeGaiaCookieManagerServiceNoFakeUrlFetcher)}}; } // BrowserWithTestWindowTest:
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index a12b0b2..8c0de54 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <algorithm> #include <functional> #include <utility> #include <vector> @@ -23,6 +24,7 @@ #include "components/spellcheck/browser/spellcheck_host_metrics.h" #include "components/spellcheck/common/spellcheck_common.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc index 343f965..4c374a5 100644 --- a/chrome/browser/supervised_user/supervised_user_service.cc +++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -151,7 +151,6 @@ registry->RegisterDictionaryPref(prefs::kSupervisedUserManualURLs); registry->RegisterIntegerPref(prefs::kDefaultSupervisedUserFilteringBehavior, SupervisedUserURLFilter::ALLOW); - registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true); registry->RegisterBooleanPref(prefs::kSupervisedUserSafeSites, true); for (const char* pref : kCustodianInfoPrefs) { registry->RegisterStringPref(pref, std::string());
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc index 502bfe4..5216c52 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service.cc +++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <set> #include <utility> #include "base/callback.h" @@ -20,6 +21,7 @@ #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_filter.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc index 60251376..ae48e7af 100644 --- a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc
@@ -24,6 +24,7 @@ #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_data.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_error_factory.h"
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service.h b/chrome/browser/supervised_user/supervised_user_whitelist_service.h index daee28d..f0de032 100644 --- a/chrome/browser/supervised_user/supervised_user_whitelist_service.h +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service.h
@@ -9,6 +9,7 @@ #include <memory> #include <set> #include <string> +#include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc index 21e606f..a1490b6 100644 --- a/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service_unittest.cc
@@ -24,6 +24,7 @@ #include "chrome/test/base/testing_profile.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h" #include "content/public/test/test_browser_thread_bundle.h"
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index a82dab9..4390b9b 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <string> #include <utility> #include "base/strings/stringprintf.h" @@ -14,6 +15,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/common/extensions/sync_helper.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/protocol/sync.pb.h" #include "components/sync/protocol/theme_specifics.pb.h" #include "extensions/browser/disable_reason.h"
diff --git a/chrome/browser/ui/cocoa/test/cocoa_profile_test.h b/chrome/browser/ui/cocoa/test/cocoa_profile_test.h index c36602e..bed50361 100644 --- a/chrome/browser/ui/cocoa/test/cocoa_profile_test.h +++ b/chrome/browser/ui/cocoa/test/cocoa_profile_test.h
@@ -57,15 +57,6 @@ // test window. virtual Browser* CreateBrowser(); - // Define the TestingFactories to be used when SetUp() builds a Profile. To be - // called in the subclass' constructor. - void AddTestingFactories( - const TestingProfile::TestingFactories& testing_factories); - - const TestingProfile::TestingFactories& testing_factories() { - return testing_factories_; - } - private: std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; @@ -73,7 +64,6 @@ TestingProfileManager profile_manager_; TestingProfile* profile_; // Weak; owned by profile_manager_. - TestingProfile::TestingFactories testing_factories_; std::unique_ptr<Browser> browser_; };
diff --git a/chrome/browser/ui/cocoa/test/cocoa_profile_test.mm b/chrome/browser/ui/cocoa/test/cocoa_profile_test.mm index 5deaed2..fd5aabe 100644 --- a/chrome/browser/ui/cocoa/test/cocoa_profile_test.mm +++ b/chrome/browser/ui/cocoa/test/cocoa_profile_test.mm
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/cocoa/test/cocoa_profile_test.h" +#include "base/bind.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" @@ -49,25 +50,20 @@ base::RunLoop().RunUntilIdle(); } -void CocoaProfileTest::AddTestingFactories( - const TestingProfile::TestingFactories& testing_factories) { - for (auto testing_factory : testing_factories) { - testing_factories_.push_back(testing_factory); - } -} - void CocoaProfileTest::SetUp() { CocoaTest::SetUp(); ASSERT_TRUE(profile_manager_.SetUp()); // Always fake out the Gaia service to avoid issuing network requests. - testing_factories_.push_back({GaiaCookieManagerServiceFactory::GetInstance(), - &BuildFakeGaiaCookieManagerService}); + TestingProfile::TestingFactories testing_factories = { + {GaiaCookieManagerServiceFactory::GetInstance(), + base::BindRepeating(&BuildFakeGaiaCookieManagerService)}}; profile_ = profile_manager_.CreateTestingProfile( "Person 1", std::unique_ptr<sync_preferences::PrefServiceSyncable>(), - base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories_); + base::UTF8ToUTF16("Person 1"), 0, std::string(), + std::move(testing_factories)); ASSERT_TRUE(profile_); // TODO(shess): These are needed in case someone creates a browser
diff --git a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc index 77c7327..895eac3 100644 --- a/chrome/browser/ui/extensions/icon_with_badge_image_source.cc +++ b/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
@@ -40,12 +40,6 @@ } float GetBlockedActionBadgeRadius() { -#if defined(OS_MACOSX) - // Cocoa. Note: this doesn't look great on Cocoa. But runtime host - // permissions are expected to be launched after MacViews for top-chrome. - if (!base::FeatureList::IsEnabled(features::kViewsBrowserWindows)) - return 11.4f; -#endif return 12.0f; }
diff --git a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc index 9988d39..a2c1a97 100644 --- a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc +++ b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
@@ -4,6 +4,7 @@ #include <memory> +#include "base/bind.h" #include "base/macros.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/extensions/extension_action_test_util.h" @@ -96,10 +97,11 @@ TestingProfile::TestingFactories GetTestingFactories() override { return {{media_router::MediaRouterFactory::GetInstance(), - &media_router::MockMediaRouter::Create}, + base::BindRepeating(&media_router::MockMediaRouter::Create)}, {media_router::MediaRouterUIServiceFactory::GetInstance(), - &BuildUIService}, - {SigninManagerFactory::GetInstance(), &BuildFakeSigninManagerBase}}; + base::BindRepeating(&BuildUIService)}, + {SigninManagerFactory::GetInstance(), + base::BindRepeating(&BuildFakeSigninManagerBase)}}; } protected:
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc index 8cea239..d65c2ba 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc
@@ -136,11 +136,6 @@ // static gfx::Size ToolbarActionsBar::GetIconAreaSize() { -#if defined(OS_MACOSX) - // On Cocoa, the spec is a 24x24 button in a 28x28 space. - if (!base::FeatureList::IsEnabled(features::kViewsBrowserWindows)) - return gfx::Size(24, 24); -#endif return gfx::Size(28, 28); }
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc index 5020e8ba..f96f036f 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "base/bind.h" #include "base/macros.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" @@ -51,7 +52,8 @@ // BrowserWithTestWindowTest: TestingProfile::TestingFactories GetTestingFactories() override { - return {{SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase}}; + return {{SigninManagerFactory::GetInstance(), + base::BindRepeating(&BuildFakeSigninManagerBase)}}; } protected:
diff --git a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc index 32751683..433398ec3 100644 --- a/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc +++ b/chrome/browser/ui/views/crostini/crostini_installer_view_browsertest.cc
@@ -220,7 +220,7 @@ ShowUi("default"); EXPECT_NE(nullptr, ActiveView()); vm_tools::concierge::StartVmResponse response; - response.set_success(false); + response.set_status(vm_tools::concierge::VM_STATUS_FAILURE); waiting_fake_concierge_client_->set_start_vm_response(std::move(response)); ActiveView()->GetDialogClientView()->AcceptWindow();
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index 5aa4ba7..4fbb794 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -119,10 +119,12 @@ new_item_animation_.Show(); } -void DownloadShelfView::DoAddDownload( - DownloadUIModel::DownloadUIModelPtr download) { +void DownloadShelfView::DoAddDownload(DownloadItem* download) { + DownloadUIModel::DownloadUIModelPtr model( + new DownloadItemModel(download), + base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); AddDownloadView( - new DownloadItemView(std::move(download), this, accessible_alert_)); + new DownloadItemView(std::move(model), this, accessible_alert_)); } void DownloadShelfView::MouseMovedOutOfHost() {
diff --git a/chrome/browser/ui/views/download/download_shelf_view.h b/chrome/browser/ui/views/download/download_shelf_view.h index 412e3ab..0a84c66 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.h +++ b/chrome/browser/ui/views/download/download_shelf_view.h
@@ -27,6 +27,10 @@ class PageNavigator; } +namespace download { +class DownloadItem; +} + namespace views { class ImageButton; class MdTextButton; @@ -92,7 +96,7 @@ protected: // DownloadShelf: - void DoAddDownload(DownloadUIModel::DownloadUIModelPtr download) override; + void DoAddDownload(download::DownloadItem* download) override; void DoOpen() override; void DoClose(CloseReason reason) override; void DoHide() override;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc index f7af287..887df215 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" +#include "base/bind.h" #include "base/command_line.h" #include "build/build_config.h" #include "chrome/browser/themes/theme_properties.h" @@ -103,8 +104,8 @@ TestingProfile::TestingFactories GetTestingFactories() override { auto testing_factories = BrowserNonClientFrameViewTest::GetTestingFactories(); - testing_factories.push_back( - {ThemeServiceFactory::GetInstance(), &BuildStubThemeService}); + testing_factories.emplace_back(ThemeServiceFactory::GetInstance(), + base::BindRepeating(&BuildStubThemeService)); return testing_factories; }
diff --git a/chrome/browser/ui/views/frame/hosted_app_button_container.cc b/chrome/browser/ui/views/frame/hosted_app_button_container.cc index 321c04d1..e8851ad 100644 --- a/chrome/browser/ui/views/frame/hosted_app_button_container.cc +++ b/chrome/browser/ui/views/frame/hosted_app_button_container.cc
@@ -322,6 +322,16 @@ app_menu_button_->SetIconColor(color); } +gfx::Size HostedAppButtonContainer::CalculatePreferredSize() const { + // Prefer height consistency over accommodating edge case icons that may bump + // up the container height (e.g. extension action icons with badges). + // TODO(https://crbug.com/889745): Fix the inconsistent icon sizes found in + // this container and turn this into a DCHECK that the conatiner height is the + // same as the app menu button height. + return gfx::Size(views::View::CalculatePreferredSize().width(), + app_menu_button_->GetPreferredSize().height()); +} + void HostedAppButtonContainer::ChildPreferredSizeChanged(views::View* child) { PreferredSizeChanged(); }
diff --git a/chrome/browser/ui/views/frame/hosted_app_button_container.h b/chrome/browser/ui/views/frame/hosted_app_button_container.h index f843ac45..d68f595b 100644 --- a/chrome/browser/ui/views/frame/hosted_app_button_container.h +++ b/chrome/browser/ui/views/frame/hosted_app_button_container.h
@@ -106,6 +106,7 @@ void UpdateChildrenColor(); // views::View: + gfx::Size CalculatePreferredSize() const override; void ChildPreferredSizeChanged(views::View* child) override; void ChildVisibilityChanged(views::View* child) override; const char* GetClassName() const override;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index 015f65dc..5176ba3d 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
@@ -136,6 +136,8 @@ virtual void MaybeRedrawFrameButtons(); private: + friend class HostedAppOpaqueBrowserFrameViewTest; + // Creates, adds and returns a new image button with |this| as its listener. // Memory is owned by the caller. views::ImageButton* InitWindowCaptionButton(int normal_image_id,
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc index ddab231..3e866a4d 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
@@ -10,9 +10,11 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/hosted_app_button_container.h" +#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" #include "chrome/common/chrome_features.h" #include "chrome/common/web_application_info.h" #include "chrome/test/base/in_process_browser_test.h" +#include "ui/views/test/test_views.h" // Tests hosted app windows that use the OpaqueBrowserFrameView implementation // for their non client frames. @@ -53,14 +55,21 @@ return false; #endif + opaque_browser_frame_view_ = + static_cast<OpaqueBrowserFrameView*>(frame_view); hosted_app_button_container_ = - static_cast<OpaqueBrowserFrameView*>(frame_view) - ->hosted_app_button_container_for_testing(); + opaque_browser_frame_view_->hosted_app_button_container_for_testing(); DCHECK(hosted_app_button_container_); DCHECK(hosted_app_button_container_->visible()); + return true; } + int GetRestoredTitleBarHeight() { + return opaque_browser_frame_view_->layout()->NonClientTopHeight(true); + } + + OpaqueBrowserFrameView* opaque_browser_frame_view_ = nullptr; HostedAppButtonContainer* hosted_app_button_container_ = nullptr; private: @@ -96,3 +105,23 @@ EXPECT_EQ(hosted_app_button_container_->active_color_for_testing(), SK_ColorWHITE); } + +IN_PROC_BROWSER_TEST_F(HostedAppOpaqueBrowserFrameViewTest, + StaticTitleBarHeight) { + if (!InstallAndLaunchHostedApp()) + return; + + const int title_bar_height = GetRestoredTitleBarHeight(); + EXPECT_GT(title_bar_height, 0); + + // Add taller children to the hosted app button container. + const int container_height = hosted_app_button_container_->height(); + hosted_app_button_container_->AddChildView( + new views::StaticSizedView(gfx::Size(1, title_bar_height * 2))); + opaque_browser_frame_view_->Layout(); + + // The height of the hosted app button container and title bar should not be + // affected. + EXPECT_EQ(container_height, hosted_app_button_container_->height()); + EXPECT_EQ(title_bar_height, GetRestoredTitleBarHeight()); +}
diff --git a/chrome/browser/ui/views/frame/test_with_browser_view.cc b/chrome/browser/ui/views/frame/test_with_browser_view.cc index 71e2d0d..b930cbb1 100644 --- a/chrome/browser/ui/views/frame/test_with_browser_view.cc +++ b/chrome/browser/ui/views/frame/test_with_browser_view.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/bind.h" #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" @@ -124,5 +125,5 @@ TestingProfile::TestingFactories TestWithBrowserView::GetTestingFactories() { return {{GaiaCookieManagerServiceFactory::GetInstance(), - &BuildFakeGaiaCookieManagerService}}; + base::BindRepeating(&BuildFakeGaiaCookieManagerService)}}; }
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc index 62b89c2..896f0fb 100644 --- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
@@ -423,6 +423,11 @@ // separate resize area. // TODO(pbos): Remove this workaround when the files merge. bounds.set_x(bounds.x() + GetResizeAreaWidth()); + // Vertically center the icons if the available height is not enough. + // TODO(https://889745): Remove the possibility of there not being enough + // available height. + if (bounds.height() > height()) + bounds.set_y((height() - bounds.height()) / 2); view->SetBoundsRect(bounds); view->SetVisible(true); // TODO(corising): Move setting background to
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index e3c2649..951eb55 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -177,9 +177,8 @@ CrosSettings* cros_settings = CrosSettings::Get(); bool allow_new_user = true; cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); - params->SetBoolean( - "guestSignin", - chrome_user_manager_util::IsGuestSessionAllowed(cros_settings)); + params->SetBoolean("guestSignin", + user_manager::UserManager::Get()->IsGuestSessionAllowed()); // nosignup flow if new users are not allowed. if (!allow_new_user || is_restrictive_proxy)
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 963c6b0..48ff131e 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -850,15 +850,15 @@ std::string()); } - const bool guest_signin_allowed = - chrome_user_manager_util::IsGuestSessionAllowed(CrosSettings::Get()) && - IsSigninScreenError(error_screen_->GetErrorState()); + bool guest_signin_allowed = false; + bool offline_login_allowed = false; + if (IsSigninScreenError(error_screen_->GetErrorState())) { + guest_signin_allowed = + user_manager::UserManager::Get()->IsGuestSessionAllowed(); + offline_login_allowed = error_screen_->GetErrorState() != + NetworkError::ERROR_STATE_AUTH_EXT_TIMEOUT; + } error_screen_->AllowGuestSignin(guest_signin_allowed); - - const bool offline_login_allowed = - IsSigninScreenError(error_screen_->GetErrorState()) && - error_screen_->GetErrorState() != - NetworkError::ERROR_STATE_AUTH_EXT_TIMEOUT; error_screen_->AllowOfflineLogin(offline_login_allowed); if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) {
diff --git a/chrome/browser/ui/webui/management_ui_handler.cc b/chrome/browser/ui/webui/management_ui_handler.cc index 801c066c..58071f7 100644 --- a/chrome/browser/ui/webui/management_ui_handler.cc +++ b/chrome/browser/ui/webui/management_ui_handler.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" +#include "base/metrics/user_metrics.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" @@ -113,6 +114,7 @@ void ManagementUIHandler::HandleGetDeviceManagementStatus( const base::ListValue* args) { AllowJavascript(); + base::RecordAction(base::UserMetricsAction("ManagementPageViewed")); #if defined(OS_CHROMEOS) policy::BrowserPolicyConnectorChromeOS* connector =
diff --git a/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc b/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc index b15b9927e..a9af36a 100644 --- a/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc +++ b/chrome/browser/ui/webui/media_router/media_router_web_ui_test.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/webui/media_router/media_router_web_ui_test.h" +#include "base/bind.h" #include "chrome/browser/media/router/media_router_factory.h" #include "chrome/browser/media/router/test/mock_media_router.h" #include "chrome/browser/ui/media_router/media_router_ui_service.h" @@ -49,13 +50,13 @@ TestingProfile::TestingFactories MediaRouterWebUITest::GetTestingFactories() { TestingProfile::TestingFactories factories = { {media_router::MediaRouterFactory::GetInstance(), - &media_router::MockMediaRouter::Create}}; + base::BindRepeating(&media_router::MockMediaRouter::Create)}}; if (require_mock_ui_service_) { factories.emplace_back( media_router::MediaRouterUIServiceFactory::GetInstance(), - BuildMockMediaRouterUIService); + base::BindRepeating(&BuildMockMediaRouterUIService)); factories.emplace_back(ToolbarActionsModelFactory::GetInstance(), - BuildToolbarActionsModel); + base::BindRepeating(&BuildToolbarActionsModel)); } return factories;
diff --git a/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc b/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc index 0b3616a..95f0eff6 100644 --- a/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc +++ b/chrome/browser/ui/webui/settings/chrome_cleanup_handler.cc
@@ -18,6 +18,7 @@ #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h" #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" @@ -27,6 +28,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_message_handler.h" +#include "extensions/browser/extension_system.h" #include "ui/base/l10n/l10n_util.h" using safe_browsing::ChromeCleanerController; @@ -284,8 +286,11 @@ base::RecordAction( base::UserMetricsAction("SoftwareReporter.CleanupWebui_StartCleanup")); + extensions::ExtensionService* extension_service = + extensions::ExtensionSystem::Get(profile_)->extension_service(); + controller_->ReplyWithUserResponse( - profile_, + profile_, extension_service, allow_logs_upload ? ChromeCleanerController::UserResponse::kAcceptedWithLogs : ChromeCleanerController::UserResponse::kAcceptedWithoutLogs);
diff --git a/chrome/browser/ui/webui/signin/signin_create_profile_handler_unittest.cc b/chrome/browser/ui/webui/signin/signin_create_profile_handler_unittest.cc index 12410e5..44a3468e 100644 --- a/chrome/browser/ui/webui/signin/signin_create_profile_handler_unittest.cc +++ b/chrome/browser/ui/webui/signin/signin_create_profile_handler_unittest.cc
@@ -105,10 +105,6 @@ handler_.reset(new TestSigninCreateProfileHandler(web_ui(), profile_manager())); - - TestingProfile::TestingFactories factories; - factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), - BuildFakeSigninManagerBase)); } void TearDown() override {
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc index f9d193e5a..5a808d1 100644 --- a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc +++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
@@ -8,6 +8,7 @@ #include <unordered_map> #include <vector> +#include "base/bind.h" #include "base/bind_helpers.h" #include "base/scoped_observer.h" #include "base/test/metrics/histogram_tester.h" @@ -167,10 +168,13 @@ } TestingProfile::TestingFactories GetTestingFactories() override { - return {{AccountFetcherServiceFactory::GetInstance(), - FakeAccountFetcherServiceBuilder::BuildForTests}, - {SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase}, - {ConsentAuditorFactory::GetInstance(), BuildFakeConsentAuditor}}; + return { + {AccountFetcherServiceFactory::GetInstance(), + base::BindRepeating(&FakeAccountFetcherServiceBuilder::BuildForTests)}, + {SigninManagerFactory::GetInstance(), + base::BindRepeating(&BuildFakeSigninManagerBase)}, + {ConsentAuditorFactory::GetInstance(), + base::BindRepeating(&BuildFakeConsentAuditor)}}; } const std::unordered_map<std::string, int>& GetStringToGrdIdMap() {
diff --git a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc index a5387c2..756d755 100644 --- a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc +++ b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc
@@ -110,6 +110,10 @@ CloseConnectionIf(ParentDisconnected::kOnDone); } + void DisableExtensions( + const std::vector<base::string16>& extension_ids, + ChromePrompt::DisableExtensionsCallback callback) override {} + // Close the IPC connection on the parent process depending on the value of // |parent_disconnected|. void CloseConnectionIf(ParentDisconnected parent_disconnected) {
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index bc780064..ab7c907 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -15,6 +15,7 @@ import("//mojo/public/tools/bindings/mojom.gni") import("//pdf/features.gni") import("//ppapi/buildflags/buildflags.gni") +import("//third_party/widevine/cdm/widevine.gni") import("//tools/grit/grit_rule.gni") if (enable_pdf) { @@ -279,7 +280,7 @@ "//skia", "//third_party/icu", "//third_party/re2", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", "//ui/accessibility", "//ui/base", "//ui/gfx/ipc", @@ -489,6 +490,10 @@ ] } + if (enable_widevine && enable_library_cdms) { + deps += [ "//third_party/widevine/cdm:headers" ] + } + if (safe_browsing_mode != 0) { public_deps += [ "//chrome/common/safe_browsing" ] } @@ -607,10 +612,10 @@ "//components/nacl/common:switches", "//components/offline_pages/buildflags", "//extensions/buildflags", - "//media/cdm:cdm_paths", # Needed by chrome_paths.cc. + "//media:media_buildflags", "//ppapi/buildflags", "//printing/buildflags", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", ] if (is_android) { @@ -630,6 +635,13 @@ if (is_win) { deps += [ "//chrome/install_static:install_static_util" ] } + + if (enable_widevine && enable_library_cdms) { + deps += [ + "//media/cdm:cdm_paths", # Needed by chrome_paths.cc. + "//third_party/widevine/cdm:headers", + ] + } } if (is_win) {
diff --git a/chrome/common/DEPS b/chrome/common/DEPS index 6c567654..2c6e1bfa 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS
@@ -57,6 +57,7 @@ "+third_party/blink/public/platform/web_client_hints_types.mojom.h", "+third_party/blink/public/platform/web_feature.mojom.h", "+third_party/metrics_proto", # For heap profiler test. + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", # FIXME - refactor code and remove these dependencies
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 970334ba..d06d0cf 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -59,12 +59,11 @@ #include "net/http/http_util.h" #include "pdf/buildflags.h" #include "ppapi/buildflags/buildflags.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "third_party/widevine/cdm/buildflags.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "url/url_constants.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #if defined(OS_LINUX) #include <fcntl.h> @@ -97,8 +96,20 @@ #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "media/cdm/cdm_paths.h" // nogncheck -#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT) -#define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT +// The order is sensitive here as WIDEVINE_CDM_IS_COMPONENT is defined in +// widevine_cdm_common.h. +// TODO(xhwang): Also make WIDEVINE_CDM_IS_COMPONENT a buildflag to avoid this. +#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck +// Registers Widevine CDM if Widevine is enabled, the Widevine CDM is +// bundled and not a component. When the Widevine CDM is a component, it is +// registered in widevine_cdm_component_installer.cc. +#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(SHOULD_BUNDLE_WIDEVINE_CDM) && \ + !defined(WIDEVINE_CDM_IS_COMPONENT) +#define REGISTER_BUNDLED_WIDEVINE_CDM +// TODO(crbug.com/663554): Needed for WIDEVINE_CDM_VERSION_STRING. Support +// component updated CDM on all desktop platforms and remove this. +// This file is In SHARED_INTERMEDIATE_DIR. +#include "widevine_cdm_version.h" // nogncheck #endif #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) @@ -132,51 +143,6 @@ content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; #endif -#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) -bool IsWidevineAvailable(base::FilePath* cdm_path, - content::CdmCapability* capability) { - static enum { - NOT_CHECKED, - FOUND, - NOT_FOUND, - } widevine_cdm_file_check = NOT_CHECKED; - - if (base::PathService::Get(chrome::FILE_WIDEVINE_CDM, cdm_path)) { - if (widevine_cdm_file_check == NOT_CHECKED) - widevine_cdm_file_check = base::PathExists(*cdm_path) ? FOUND : NOT_FOUND; - - if (widevine_cdm_file_check == FOUND) { - // Add the supported codecs as if they came from the component manifest. - // This list must match the CDM that is being bundled with Chrome. - capability->video_codecs.push_back(media::VideoCodec::kCodecVP8); - capability->video_codecs.push_back(media::VideoCodec::kCodecVP9); -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - capability->video_codecs.push_back(media::VideoCodec::kCodecH264); -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) - - // Add the supported encryption schemes as if they came from the - // component manifest. This list must match the CDM that is being - // bundled with Chrome. - capability->encryption_schemes.insert(media::EncryptionMode::kCenc); - capability->encryption_schemes.insert(media::EncryptionMode::kCbcs); - - // Temporary session is always supported. - capability->session_types.insert(media::CdmSessionType::kTemporary); -#if defined(OS_CHROMEOS) - // TODO(crbug.com/767941): Push persistent-license support info here once - // we check in a new CDM that supports it on Linux. - capability->session_types.insert( - media::CdmSessionType::kPersistentLicense); -#endif // defined(OS_CHROMEOS) - - return true; - } - } - - return false; -} -#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) - // Appends the known built-in plugins to the given vector. Some built-in // plugins are "internal" which means they are compiled into the Chrome binary, // and some are extra shared libraries distributed with the browser (these are @@ -384,6 +350,51 @@ } #endif // BUILDFLAG(ENABLE_PLUGINS) +#if defined(REGISTER_BUNDLED_WIDEVINE_CDM) +bool IsWidevineAvailable(base::FilePath* cdm_path, + content::CdmCapability* capability) { + static enum { + NOT_CHECKED, + FOUND, + NOT_FOUND, + } widevine_cdm_file_check = NOT_CHECKED; + + if (base::PathService::Get(chrome::FILE_WIDEVINE_CDM, cdm_path)) { + if (widevine_cdm_file_check == NOT_CHECKED) + widevine_cdm_file_check = base::PathExists(*cdm_path) ? FOUND : NOT_FOUND; + + if (widevine_cdm_file_check == FOUND) { + // Add the supported codecs as if they came from the component manifest. + // This list must match the CDM that is being bundled with Chrome. + capability->video_codecs.push_back(media::VideoCodec::kCodecVP8); + capability->video_codecs.push_back(media::VideoCodec::kCodecVP9); +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + capability->video_codecs.push_back(media::VideoCodec::kCodecH264); +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + + // Add the supported encryption schemes as if they came from the + // component manifest. This list must match the CDM that is being + // bundled with Chrome. + capability->encryption_schemes.insert(media::EncryptionMode::kCenc); + capability->encryption_schemes.insert(media::EncryptionMode::kCbcs); + + // Temporary session is always supported. + capability->session_types.insert(media::CdmSessionType::kTemporary); +#if defined(OS_CHROMEOS) + // TODO(crbug.com/767941): Push persistent-license support info here once + // we check in a new CDM that supports it on Linux. + capability->session_types.insert( + media::CdmSessionType::kPersistentLicense); +#endif // defined(OS_CHROMEOS) + + return true; + } + } + + return false; +} +#endif // defined(REGISTER_BUNDLED_WIDEVINE_CDM) + std::string GetProduct() { return version_info::GetProductNameAndVersionForUserAgent(); } @@ -527,7 +538,7 @@ std::vector<content::CdmInfo>* cdms, std::vector<media::CdmHostFilePath>* cdm_host_file_paths) { if (cdms) { -#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) +#if defined(REGISTER_BUNDLED_WIDEVINE_CDM) base::FilePath cdm_path; content::CdmCapability capability; if (IsWidevineAvailable(&cdm_path, &capability)) { @@ -539,7 +550,7 @@ cdm_path, kWidevineCdmFileSystemId, std::move(capability), kWidevineKeySystem, false)); } -#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) +#endif // defined(REGISTER_BUNDLED_WIDEVINE_CDM) #if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Register Clear Key CDM if specified in command line.
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index bc7415d..96f9962 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc
@@ -17,9 +17,8 @@ #include "chrome/common/buildflags.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths_internal.h" -#include "media/cdm/cdm_paths.h" #include "media/media_buildflags.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "third_party/widevine/cdm/buildflags.h" #if defined(OS_ANDROID) #include "base/android/path_utils.h" @@ -37,7 +36,10 @@ #include "base/win/registry.h" #endif -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) +#include "media/cdm/cdm_paths.h" // nogncheck +#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck +#endif namespace { @@ -367,7 +369,7 @@ #endif cur = cur.Append(FILE_PATH_LITERAL("pnacl")); break; -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) +#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) // TODO(crbug.com/663554): Remove this after component updated CDM is // supported on Linux and ChromeOS. case chrome::FILE_WIDEVINE_CDM: @@ -378,7 +380,7 @@ media::GetPlatformSpecificDirectory(kWidevineCdmBaseDirectory)) .AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName)); break; -#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) +#endif // BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) case chrome::FILE_RESOURCES_PACK: #if defined(OS_MACOSX) cur = base::mac::FrameworkBundlePath();
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index d203e86..aba2ebe 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -1185,10 +1185,6 @@ const char kDefaultSupervisedUserFilteringBehavior[] = "profile.managed.default_filtering_behavior"; -// Whether this user is permitted to create supervised users. -const char kSupervisedUserCreationAllowed[] = - "profile.managed_user_creation_allowed"; - // List pref containing the users supervised by this user. const char kSupervisedUsers[] = "profile.managed_users";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index c5346b3..6ba77e8 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -399,7 +399,6 @@ extern const char kDefaultSupervisedUserFilteringBehavior[]; -extern const char kSupervisedUserCreationAllowed[]; extern const char kSupervisedUsers[]; extern const char kMessageCenterDisabledExtensionIds[];
diff --git a/chrome/gpu/BUILD.gn b/chrome/gpu/BUILD.gn index ec2a3cef..614027c 100644 --- a/chrome/gpu/BUILD.gn +++ b/chrome/gpu/BUILD.gn
@@ -3,12 +3,14 @@ # found in the LICENSE file. import("//media/media_options.gni") +import("//third_party/widevine/cdm/widevine.gni") static_library("gpu") { deps = [ "//components/metrics:child_call_stack_profile_builder", "//content/public/common", "//content/public/gpu", + "//third_party/widevine/cdm:buildflags", ] sources = [ @@ -22,7 +24,7 @@ "//media/cdm/library_cdm/clear_key_cdm:clear_key_cdm_proxy", ] - if (is_win) { + if (enable_widevine && is_win) { sources += [ "widevine_cdm_proxy_factory.cc", "widevine_cdm_proxy_factory.h",
diff --git a/chrome/gpu/DEPS b/chrome/gpu/DEPS index 92fb433..c7efd56 100644 --- a/chrome/gpu/DEPS +++ b/chrome/gpu/DEPS
@@ -6,5 +6,6 @@ "+content/public/gpu", "+media/cdm", "+media/gpu", + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", ]
diff --git a/chrome/gpu/chrome_content_gpu_client.cc b/chrome/gpu/chrome_content_gpu_client.cc index 8b71cb5..aa9671f 100644 --- a/chrome/gpu/chrome_content_gpu_client.cc +++ b/chrome/gpu/chrome_content_gpu_client.cc
@@ -16,11 +16,11 @@ #if BUILDFLAG(ENABLE_LIBRARY_CDMS) #include "media/cdm/cdm_paths.h" #include "media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_WIN) +#include "third_party/widevine/cdm/buildflags.h" +#if BUILDFLAG(ENABLE_WIDEVINE) && defined(OS_WIN) #include "chrome/gpu/widevine_cdm_proxy_factory.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_WIN) +#endif // BUILDFLAG(ENABLE_WIDEVINE) && defined(OS_WIN) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) #if defined(OS_CHROMEOS) @@ -105,10 +105,10 @@ if (cdm_guid == media::kClearKeyCdmGuid) return std::make_unique<media::ClearKeyCdmProxy>(); -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_WIN) +#if BUILDFLAG(ENABLE_WIDEVINE) && defined(OS_WIN) if (cdm_guid == kWidevineCdmGuid) return CreateWidevineCdmProxy(); -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_WIN) +#endif // BUILDFLAG(ENABLE_WIDEVINE) && defined(OS_WIN) return nullptr; }
diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn index bf218a3f..b051404 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn
@@ -9,7 +9,9 @@ import("//components/offline_pages/buildflags/features.gni") import("//components/spellcheck/spellcheck_build_features.gni") import("//extensions/buildflags/buildflags.gni") +import("//media/media_options.gni") import("//ppapi/buildflags/buildflags.gni") +import("//third_party/widevine/cdm/widevine.gni") import("//tools/grit/grit_rule.gni") grit("resources") { @@ -171,7 +173,7 @@ "//third_party/blink/public:scaled_resources", "//third_party/icu", "//third_party/re2", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", "//ui/surface", "//v8:v8", ] @@ -231,6 +233,10 @@ } } + if (enable_library_cdms && enable_widevine) { + deps += [ "//third_party/widevine/cdm:headers" ] + } + if (safe_browsing_mode != 0) { deps += [ "//components/safe_browsing/common:common",
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index fb277fd..55ca2694 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS
@@ -60,6 +60,7 @@ "+storage/common", "+third_party/blink/public/mojom", "+third_party/metrics_proto", + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", ]
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc index 27c8c9357..bcf7d3a8 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -23,7 +23,7 @@ #include "media/base/eme_constants.h" #include "media/base/key_system_properties.h" #include "media/media_buildflags.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "third_party/widevine/cdm/buildflags.h" #if defined(OS_ANDROID) #include "components/cdm/renderer/android_key_systems.h" @@ -34,16 +34,18 @@ #include "content/public/renderer/key_system_support.h" #include "media/base/media_switches.h" #include "media/base/video_codecs.h" -#endif - +#if BUILDFLAG(ENABLE_WIDEVINE) +#include "third_party/widevine/cdm/widevine_cdm_common.h" +// TODO(crbug.com/663554): Needed for WIDEVINE_CDM_MIN_GLIBC_VERSION. +// component updated CDM on all desktop platforms and remove this. #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - // The following must be after widevine_cdm_version.h. - -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) +#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) #include <gnu/libc-version.h> #include "base/version.h" -#endif +#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) +#endif // BUILDFLAG(ENABLE_WIDEVINE) +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) using media::EmeFeatureSupport; using media::EmeSessionTypeSupport; @@ -139,7 +141,7 @@ new cdm::ExternalClearKeyProperties(kExternalClearKeyCdmProxyKeySystem)); } -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) static SupportedCodecs GetSupportedCodecs( const std::vector<media::VideoCodec>& supported_video_codecs, bool is_secure) { @@ -304,7 +306,7 @@ persistent_license_support, persistent_usage_record_support, persistent_state_support, distinctive_identifier_support)); } -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) void AddChromeKeySystems( @@ -313,9 +315,9 @@ if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) AddExternalClearKey(key_systems_properties); -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) AddWidevine(key_systems_properties); -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
diff --git a/chrome/renderer/media/chrome_key_systems_provider.cc b/chrome/renderer/media/chrome_key_systems_provider.cc index db85cf2..48d53984 100644 --- a/chrome/renderer/media/chrome_key_systems_provider.cc +++ b/chrome/renderer/media/chrome_key_systems_provider.cc
@@ -6,9 +6,12 @@ #include "base/time/default_tick_clock.h" #include "chrome/renderer/media/chrome_key_systems.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "media/media_buildflags.h" +#include "third_party/widevine/cdm/buildflags.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && BUILDFLAG(ENABLE_WIDEVINE) +#include "third_party/widevine/cdm/widevine_cdm_common.h" +#endif ChromeKeySystemsProvider::ChromeKeySystemsProvider() : has_updated_(false), @@ -33,7 +36,8 @@ // Check whether all potentially supported key systems are supported. If so, // no need to update again. -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && BUILDFLAG(ENABLE_WIDEVINE) && \ + defined(WIDEVINE_CDM_IS_COMPONENT) for (const auto& properties : *key_systems) { if (properties->GetKeySystemName() == kWidevineKeySystem) { is_update_needed_ = false;
diff --git a/chrome/renderer/media/chrome_key_systems_provider_unittest.cc b/chrome/renderer/media/chrome_key_systems_provider_unittest.cc index 4d94b671..be8fa26 100644 --- a/chrome/renderer/media/chrome_key_systems_provider_unittest.cc +++ b/chrome/renderer/media/chrome_key_systems_provider_unittest.cc
@@ -12,10 +12,9 @@ #include "base/bind_helpers.h" #include "base/test/simple_test_tick_clock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - namespace { class TestKeySystemProperties : public media::KeySystemProperties { @@ -77,7 +76,7 @@ new TestKeySystemProperties("com.example.foobar")); if (include_widevine_) { -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) key_systems->emplace_back( new TestKeySystemProperties(kWidevineKeySystem)); #else @@ -128,7 +127,7 @@ EXPECT_FALSE(key_systems_provider.IsKeySystemsUpdateNeeded()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(10)); -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#if BUILDFLAG(ENABLE_WIDEVINE) && defined(WIDEVINE_CDM_IS_COMPONENT) // Require update once enough time has passed for builds that install Widevine // as a component. EXPECT_TRUE(key_systems_provider.IsKeySystemsUpdateNeeded()); @@ -158,5 +157,5 @@ // No update needed for builds that either don't offer Widevine or do so // as part of Chrome rather than component installer. EXPECT_FALSE(key_systems_provider.IsKeySystemsUpdateNeeded()); -#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) +#endif // BUILDFLAG(ENABLE_WIDEVINE) && defined(WIDEVINE_CDM_IS_COMPONENT) }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 186a805..650b3a3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -24,6 +24,7 @@ import("//services/service_manager/public/service_manifest.gni") import("//services/catalog/public/tools/catalog.gni") import("//testing/test.gni") +import("//third_party/widevine/cdm/widevine.gni") import("//ui/base/ui_features.gni") import("//ui/views/features.gni") import("//v8/gni/v8.gni") @@ -1045,6 +1046,7 @@ "//third_party/icu", "//third_party/leveldatabase", "//third_party/webrtc_overrides", + "//third_party/widevine/cdm:buildflags", "//third_party/widevine/cdm:headers", "//ui/accessibility:test_support", "//ui/base:test_support", @@ -2320,6 +2322,7 @@ "../browser/android/explore_sites/explore_sites_feature_unittest.cc", "../browser/android/explore_sites/explore_sites_fetcher_unittest.cc", "../browser/android/explore_sites/explore_sites_schema_unittest.cc", + "../browser/android/explore_sites/explore_sites_service_impl_unittest.cc", "../browser/android/explore_sites/explore_sites_store_unittest.cc", "../browser/android/explore_sites/get_catalog_task_unittest.cc", "../browser/android/explore_sites/get_images_task_unittest.cc", @@ -2789,11 +2792,13 @@ if (is_win) { assert(toolkit_views) sources += [ - "../browser/media/widevine_hardware_caps_win_unittest.cc", "../browser/notifications/win/mock_notification_image_retainer.cc", "../browser/notifications/win/mock_notification_image_retainer.h", "../browser/ui/views/try_chrome_dialog_win/button_layout_unittest.cc", ] + if (enable_widevine) { + sources += [ "../browser/media/widevine_hardware_caps_win_unittest.cc" ] + } } if (!is_android && !is_ios) { @@ -3095,6 +3100,7 @@ "../browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win_unittest.cc", "../browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc", "../browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h", + "../browser/safe_browsing/chrome_cleaner/srt_delete_extension_win_unittest.cc", "../browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc", "../browser/search/background/ntp_background_service_unittest.cc", "../browser/search/iframe_source_unittest.cc", @@ -4446,8 +4452,7 @@ sources += [ "../browser/password_manager/password_store_signin_notifier_impl_unittest.cc" ] } - # TODO(crbug.com/349182): Replace "is_chrome_branded" with "enable_widevine". - if (is_chrome_branded && is_win) { + if (enable_widevine && is_win) { sources += [ "../gpu/widevine_cdm_proxy_factory_unittest.cc" ] } } @@ -5560,7 +5565,7 @@ "//media:media_buildflags", "//testing/gtest", "//testing/perf", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", ] data_deps = [
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index f8874cd..639b140 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/base_paths.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/feature_list.h" #include "base/files/file_util.h" @@ -329,7 +330,7 @@ base::Optional<bool> is_new_profile, const std::string& supervised_user_id, std::unique_ptr<policy::PolicyService> policy_service, - const TestingFactories& factories, + TestingFactories testing_factories, const std::string& profile_name) : start_time_(Time::Now()), prefs_(std::move(prefs)), @@ -360,10 +361,9 @@ } // Set any testing factories prior to initializing the services. - for (TestingFactories::const_iterator it = factories.begin(); - it != factories.end(); ++it) { - it->first->SetTestingFactory(this, it->second); - } + for (TestingFactories::value_type& pair : testing_factories) + pair.first->SetTestingFactory(this, std::move(pair.second)); + testing_factories.clear(); Init(); // If caller supplied a delegate, delay the FinishInit invocation until other @@ -1073,22 +1073,32 @@ void TestingProfile::Builder::AddTestingFactory( BrowserContextKeyedServiceFactory* service_factory, - BrowserContextKeyedServiceFactory::TestingFactoryFunction callback) { - testing_factories_.push_back(std::make_pair(service_factory, callback)); + BrowserContextKeyedServiceFactory::TestingFactoryFunction function) { + BrowserContextKeyedServiceFactory::TestingFactory testing_factory; + if (function) + testing_factory = base::BindRepeating(function); + AddTestingFactory(service_factory, std::move(testing_factory)); +} + +void TestingProfile::Builder::AddTestingFactory( + BrowserContextKeyedServiceFactory* service_factory, + BrowserContextKeyedServiceFactory::TestingFactory testing_factory) { + testing_factories_.emplace_back(service_factory, std::move(testing_factory)); } std::unique_ptr<TestingProfile> TestingProfile::Builder::Build() { DCHECK(!build_called_); build_called_ = true; - return std::unique_ptr<TestingProfile>(new TestingProfile( - path_, delegate_, + return std::unique_ptr<TestingProfile>( + new TestingProfile(path_, delegate_, #if BUILDFLAG(ENABLE_EXTENSIONS) - extension_policy_, + extension_policy_, #endif - std::move(pref_service_), NULL, guest_session_, - std::move(is_new_profile_), supervised_user_id_, - std::move(policy_service_), testing_factories_, profile_name_)); + std::move(pref_service_), NULL, guest_session_, + std::move(is_new_profile_), supervised_user_id_, + std::move(policy_service_), + std::move(testing_factories_), profile_name_)); } TestingProfile* TestingProfile::Builder::BuildIncognito( @@ -1105,5 +1115,5 @@ std::move(pref_service_), original_profile, guest_session_, std::move(is_new_profile_), supervised_user_id_, std::move(policy_service_), - testing_factories_, profile_name_); + std::move(testing_factories_), profile_name_); }
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index 6fa9903..b784b5e2 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h
@@ -69,10 +69,9 @@ // Default constructor that cannot be used with multi-profiles. TestingProfile(); - typedef std::vector<std::pair< - BrowserContextKeyedServiceFactory*, - BrowserContextKeyedServiceFactory::TestingFactoryFunction> > - TestingFactories; + using TestingFactories = + std::vector<std::pair<BrowserContextKeyedServiceFactory*, + BrowserContextKeyedServiceFactory::TestingFactory>>; // Helper class for building an instance of TestingProfile (allows injecting // mocks for various services prior to profile initialization). @@ -92,9 +91,17 @@ // Adds a testing factory to the TestingProfile. These testing factories // are applied before the ProfileKeyedServices are created. + // DEPRECATED: use TestingFactory version instead, see + // http://crbug.com/809610 void AddTestingFactory( BrowserContextKeyedServiceFactory* service_factory, - BrowserContextKeyedServiceFactory::TestingFactoryFunction callback); + BrowserContextKeyedServiceFactory::TestingFactoryFunction function); + + // Adds a testing factory to the TestingProfile. These testing factories + // are applied before the ProfileKeyedServices are created. + void AddTestingFactory( + BrowserContextKeyedServiceFactory* service_factory, + BrowserContextKeyedServiceFactory::TestingFactory testing_factory); #if BUILDFLAG(ENABLE_EXTENSIONS) // Sets the ExtensionSpecialStoragePolicy to be returned by @@ -183,7 +190,7 @@ base::Optional<bool> is_new_profile, const std::string& supervised_user_id, std::unique_ptr<policy::PolicyService> policy_service, - const TestingFactories& factories, + TestingFactories testing_factories, const std::string& profile_name); ~TestingProfile() override;
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc index c555d6f0c..c122355 100644 --- a/chrome/test/base/testing_profile_manager.cc +++ b/chrome/test/base/testing_profile_manager.cc
@@ -45,7 +45,17 @@ TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) : called_set_up_(false), browser_process_(process), - local_state_(process), + owned_local_state_(std::make_unique<ScopedTestingLocalState>(process)), + profile_manager_(nullptr) { + local_state_ = owned_local_state_.get(); +} + +TestingProfileManager::TestingProfileManager( + TestingBrowserProcess* process, + ScopedTestingLocalState* local_state) + : called_set_up_(false), + browser_process_(process), + local_state_(local_state), profile_manager_(nullptr) {} TestingProfileManager::~TestingProfileManager() { @@ -65,7 +75,7 @@ const base::string16& user_name, int avatar_id, const std::string& supervised_user_id, - const TestingProfile::TestingFactories& factories) { + TestingProfile::TestingFactories testing_factories) { DCHECK(called_set_up_); // Create a path for the profile based on the name. @@ -91,10 +101,9 @@ builder.SetSupervisedUserId(supervised_user_id); builder.SetProfileName(profile_name); - for (TestingProfile::TestingFactories::const_iterator it = factories.begin(); - it != factories.end(); ++it) { - builder.AddTestingFactory(it->first, it->second); - } + for (TestingProfile::TestingFactories::value_type& pair : testing_factories) + builder.AddTestingFactory(pair.first, std::move(pair.second)); + testing_factories.clear(); TestingProfile* profile = builder.Build().release(); profile_manager_->AddProfile(profile); // Takes ownership.
diff --git a/chrome/test/base/testing_profile_manager.h b/chrome/test/base/testing_profile_manager.h index 32058ee..b4510b60 100644 --- a/chrome/test/base/testing_profile_manager.h +++ b/chrome/test/base/testing_profile_manager.h
@@ -37,6 +37,8 @@ class TestingProfileManager { public: explicit TestingProfileManager(TestingBrowserProcess* browser_process); + TestingProfileManager(TestingBrowserProcess* browser_process, + ScopedTestingLocalState* local_state); ~TestingProfileManager(); // This needs to be called in testing::Test::SetUp() to put the object in a @@ -64,7 +66,7 @@ const base::string16& user_name, int avatar_id, const std::string& supervised_user_id, - const TestingProfile::TestingFactories& factories); + TestingProfile::TestingFactories testing_factories); // Small helper for creating testing profiles. Just forwards to above. TestingProfile* CreateTestingProfile(const std::string& name); @@ -110,7 +112,7 @@ const base::FilePath& profiles_dir(); ProfileManager* profile_manager(); ProfileAttributesStorage* profile_attributes_storage(); - ScopedTestingLocalState* local_state() { return &local_state_; } + ScopedTestingLocalState* local_state() { return local_state_; } private: friend class ProfileAttributesStorageTest; @@ -149,7 +151,10 @@ TestingBrowserProcess* browser_process_; // Local state in which all the profiles are registered. - ScopedTestingLocalState local_state_; + ScopedTestingLocalState* local_state_; + + // Owned local state for when it's not provided in the constructor. + std::unique_ptr<ScopedTestingLocalState> owned_local_state_; // Weak reference to the profile manager. ProfileManager* profile_manager_;
diff --git a/chrome/test/data/chromeos/file_manager/tall.txt b/chrome/test/data/chromeos/file_manager/tall.txt new file mode 100644 index 0000000..f9377eee --- /dev/null +++ b/chrome/test/data/chromeos/file_manager/tall.txt
@@ -0,0 +1,42 @@ + 1 tall text + 2 tall text + 3 tall text + 4 tall text + 5 tall text + 6 tall text + 7 tall text + 8 tall text + 9 tall text +10 tall text +11 tall text +12 tall text +13 tall text +14 tall text +15 tall text +16 tall text +17 tall text +18 tall text +19 tall text +20 tall text +21 tall text +22 tall text +23 tall text +24 tall text +25 tall text +26 tall text +27 tall text +28 tall text +29 tall text +30 tall text +31 tall text +32 tall text +33 tall text +34 tall text +35 tall text +36 tall text +37 tall text +38 tall text +39 tall text +40 tall text +41 tall text +42 tall text
diff --git a/chrome/test/data/extensions/api_test/history/incognito/incognito.js b/chrome/test/data/extensions/api_test/history/incognito/incognito.js new file mode 100644 index 0000000..8082166 --- /dev/null +++ b/chrome/test/data/extensions/api_test/history/incognito/incognito.js
@@ -0,0 +1,24 @@ +// Copyright 2018 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. + +// History api test for Chrome. +// browser_tests.exe --gtest_filter=HistoryApiTest.Incognito + +function addItem() { + chrome.history.addUrl({url: 'http://www.a.com/'}, function() { + window.domAutomationController.send('success'); + }); +} + +function countItemsInHistory() { + var query = {'text': ''}; + chrome.history.search(query, function(results) { + window.domAutomationController.send(results.length.toString()); + }); +} + +// Return a message to sync test with page load. +let message = chrome.extension.inIncognitoContext ? + 'incognito ready' : 'regular ready'; +chrome.test.sendMessage(message);
diff --git a/chrome/test/data/extensions/api_test/history/incognito/manifest.json b/chrome/test/data/extensions/api_test/history/incognito/manifest.json new file mode 100644 index 0000000..44b23b7 --- /dev/null +++ b/chrome/test/data/extensions/api_test/history/incognito/manifest.json
@@ -0,0 +1,11 @@ +{ + "name": "chrome.history", + "version": "0.1", + "manifest_version": 2, + "description": "end-to-end browser test for chrome.history API", + "permissions": ["history"], + "incognito": "split", + "background": { + "scripts": ["incognito.js"] + } +}
diff --git a/chrome/test/data/extensions/api_test/history/a.html b/chrome/test/data/extensions/api_test/history/regular/a.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/a.html rename to chrome/test/data/extensions/api_test/history/regular/a.html
diff --git a/chrome/test/data/extensions/api_test/history/b.html b/chrome/test/data/extensions/api_test/history/regular/b.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/b.html rename to chrome/test/data/extensions/api_test/history/regular/b.html
diff --git a/chrome/test/data/extensions/api_test/history/common.js b/chrome/test/data/extensions/api_test/history/regular/common.js similarity index 97% rename from chrome/test/data/extensions/api_test/history/common.js rename to chrome/test/data/extensions/api_test/history/regular/common.js index fbbf077..2024abd 100644 --- a/chrome/test/data/extensions/api_test/history/common.js +++ b/chrome/test/data/extensions/api_test/history/regular/common.js
@@ -105,7 +105,7 @@ /** * Tests call this function to invoke specific tests. - * @param {Array<funcion>} testFns The tests to run. + * @param {Array<function>} testFns The tests to run. */ function runHistoryTestFns(testFns) { chrome.test.getConfig(function(config) { @@ -122,7 +122,7 @@ /** * Add two URLs to the history. Compute three times, in ms since the epoch: * 'before': A time before both URLs were added. - * 'between': A time between the times teh URLs were added. + * 'between': A time between the times the URLs were added. * 'after': A time after both were added. * All times are passed to |callback| as properties of its object parameter. * @param {Array<string>} urls An array of two URLs to add to the history.
diff --git a/chrome/test/data/extensions/api_test/history/delete.html b/chrome/test/data/extensions/api_test/history/regular/delete.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/delete.html rename to chrome/test/data/extensions/api_test/history/regular/delete.html
diff --git a/chrome/test/data/extensions/api_test/history/delete.js b/chrome/test/data/extensions/api_test/history/regular/delete.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/delete.js rename to chrome/test/data/extensions/api_test/history/regular/delete.js
diff --git a/chrome/test/data/extensions/api_test/history/delete_prohibited.html b/chrome/test/data/extensions/api_test/history/regular/delete_prohibited.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/delete_prohibited.html rename to chrome/test/data/extensions/api_test/history/regular/delete_prohibited.html
diff --git a/chrome/test/data/extensions/api_test/history/delete_prohibited.js b/chrome/test/data/extensions/api_test/history/regular/delete_prohibited.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/delete_prohibited.js rename to chrome/test/data/extensions/api_test/history/regular/delete_prohibited.js
diff --git a/chrome/test/data/extensions/api_test/history/get_visits.html b/chrome/test/data/extensions/api_test/history/regular/get_visits.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/get_visits.html rename to chrome/test/data/extensions/api_test/history/regular/get_visits.html
diff --git a/chrome/test/data/extensions/api_test/history/get_visits.js b/chrome/test/data/extensions/api_test/history/regular/get_visits.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/get_visits.js rename to chrome/test/data/extensions/api_test/history/regular/get_visits.js
diff --git a/chrome/test/data/extensions/api_test/history/manifest.json b/chrome/test/data/extensions/api_test/history/regular/manifest.json similarity index 100% rename from chrome/test/data/extensions/api_test/history/manifest.json rename to chrome/test/data/extensions/api_test/history/regular/manifest.json
diff --git a/chrome/test/data/extensions/api_test/history/misc_search.html b/chrome/test/data/extensions/api_test/history/regular/misc_search.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/misc_search.html rename to chrome/test/data/extensions/api_test/history/regular/misc_search.html
diff --git a/chrome/test/data/extensions/api_test/history/misc_search.js b/chrome/test/data/extensions/api_test/history/regular/misc_search.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/misc_search.js rename to chrome/test/data/extensions/api_test/history/regular/misc_search.js
diff --git a/chrome/test/data/extensions/api_test/history/search_after_add.html b/chrome/test/data/extensions/api_test/history/regular/search_after_add.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/search_after_add.html rename to chrome/test/data/extensions/api_test/history/regular/search_after_add.html
diff --git a/chrome/test/data/extensions/api_test/history/search_after_add.js b/chrome/test/data/extensions/api_test/history/regular/search_after_add.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/search_after_add.js rename to chrome/test/data/extensions/api_test/history/regular/search_after_add.js
diff --git a/chrome/test/data/extensions/api_test/history/timed_search.html b/chrome/test/data/extensions/api_test/history/regular/timed_search.html similarity index 100% rename from chrome/test/data/extensions/api_test/history/timed_search.html rename to chrome/test/data/extensions/api_test/history/regular/timed_search.html
diff --git a/chrome/test/data/extensions/api_test/history/timed_search.js b/chrome/test/data/extensions/api_test/history/regular/timed_search.js similarity index 100% rename from chrome/test/data/extensions/api_test/history/timed_search.js rename to chrome/test/data/extensions/api_test/history/regular/timed_search.js
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index d08eed9..5fe83e0 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -640,7 +640,7 @@ "os": ["win", "linux", "mac"], "test_policy": { "SigninAllowed": true }, "pref_mappings": [ - { "pref": "signin.allowed" } + { "pref": "signin.allowed_on_next_startup" } ] },
diff --git a/chromecast/media/DEPS b/chromecast/media/DEPS index 811bdcfe..20744a9 100644 --- a/chromecast/media/DEPS +++ b/chromecast/media/DEPS
@@ -14,5 +14,6 @@ "+ui/gfx/geometry", "+ui/gfx/overlay_transform.h", "+services/service_manager/public", + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", ]
diff --git a/chromecast/media/base/BUILD.gn b/chromecast/media/base/BUILD.gn index bc5fe5b..450a06d2 100644 --- a/chromecast/media/base/BUILD.gn +++ b/chromecast/media/base/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//chromecast/chromecast.gni") +import("//third_party/widevine/cdm/widevine.gni") cast_source_set("key_systems") { sources = [ @@ -18,8 +19,12 @@ "//base", "//chromecast/public/media", "//media", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", ] + + if (enable_widevine) { + deps += [ "//third_party/widevine/cdm:headers" ] + } } cast_source_set("base") {
diff --git a/chromecast/media/base/key_systems_common.cc b/chromecast/media/base/key_systems_common.cc index 11986635..26e3414 100644 --- a/chromecast/media/base/key_systems_common.cc +++ b/chromecast/media/base/key_systems_common.cc
@@ -7,9 +7,11 @@ #include <cstddef> #include "media/base/key_system_names.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "third_party/widevine/cdm/buildflags.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#if BUILDFLAG(ENABLE_WIDEVINE) +#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck +#endif namespace chromecast { namespace media { @@ -19,11 +21,11 @@ #endif // defined(PLAYREADY_CDM_AVAILABLE) CastKeySystem GetKeySystemByName(const std::string& key_system_name) { -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) if (key_system_name.compare(kWidevineKeySystem) == 0) { return KEY_SYSTEM_WIDEVINE; } -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) #if defined(PLAYREADY_CDM_AVAILABLE) if (key_system_name.compare(kChromecastPlayreadyKeySystem) == 0) {
diff --git a/chromecast/media/cma/backend/fuchsia/BUILD.gn b/chromecast/media/cma/backend/fuchsia/BUILD.gn index 1e4d0646..5d2af30b 100644 --- a/chromecast/media/cma/backend/fuchsia/BUILD.gn +++ b/chromecast/media/cma/backend/fuchsia/BUILD.gn
@@ -40,7 +40,7 @@ "//chromecast/public", "//chromecast/public/media", "//media", - "//third_party/fuchsia-sdk/sdk:media", + "//third_party/fuchsia-sdk:media", ] } @@ -56,6 +56,6 @@ ":cma_backend_support", "//base", "//testing/gtest", - "//third_party/fuchsia-sdk/sdk:media", + "//third_party/fuchsia-sdk:media", ] }
diff --git a/chromecast/renderer/media/BUILD.gn b/chromecast/renderer/media/BUILD.gn index 799c41c..59f6477 100644 --- a/chromecast/renderer/media/BUILD.gn +++ b/chromecast/renderer/media/BUILD.gn
@@ -22,7 +22,7 @@ "//components/cdm/renderer", "//content/public/renderer", "//media", - "//third_party/widevine/cdm:headers", + "//third_party/widevine/cdm:buildflags", "//ui/gfx/geometry", ] }
diff --git a/chromecast/renderer/media/DEPS b/chromecast/renderer/media/DEPS index 3ad6543..7f0b425 100644 --- a/chromecast/renderer/media/DEPS +++ b/chromecast/renderer/media/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+mojo/public", + "+third_party/widevine/cdm/buildflags.h", "+ui/gfx/geometry", ]
diff --git a/chromecast/renderer/media/key_systems_cast.cc b/chromecast/renderer/media/key_systems_cast.cc index da2796b..bb5ecaa 100644 --- a/chromecast/renderer/media/key_systems_cast.cc +++ b/chromecast/renderer/media/key_systems_cast.cc
@@ -12,12 +12,14 @@ #include "chromecast/chromecast_buildflags.h" #include "chromecast/media/base/key_systems_common.h" #include "components/cdm/renderer/android_key_systems.h" -#include "components/cdm/renderer/widevine_key_system_properties.h" #include "media/base/eme_constants.h" #include "media/base/key_system_properties.h" #include "media/media_buildflags.h" +#include "third_party/widevine/cdm/buildflags.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#if BUILDFLAG(ENABLE_WIDEVINE) +#include "components/cdm/renderer/widevine_key_system_properties.h" +#endif using ::media::EmeConfigRule; using ::media::EmeFeatureSupport; @@ -154,7 +156,7 @@ codecs, codecs, enable_persistent_license_support)); #endif // defined(PLAYREADY_CDM_AVAILABLE) -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) using Robustness = cdm::WidevineKeySystemProperties::Robustness; base::flat_set<::media::EncryptionMode> encryption_schemes = { @@ -172,7 +174,7 @@ // Note: On Chromecast, all CDMs may have persistent state. EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. EmeFeatureSupport::ALWAYS_ENABLED)); // Distinctive identifier. -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) } #elif defined(OS_ANDROID) #if defined(PLAYREADY_CDM_AVAILABLE) @@ -199,9 +201,9 @@ AddCastPlayreadyKeySystemAndroid(key_systems_properties); #endif // defined(PLAYREADY_CDM_AVAILABLE) -#if defined(WIDEVINE_CDM_AVAILABLE) +#if BUILDFLAG(ENABLE_WIDEVINE) cdm::AddAndroidWidevine(key_systems_properties); -#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_WIDEVINE) } #endif // defined(OS_ANDROID)
diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index f90144d..a5144da 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn
@@ -26,6 +26,7 @@ ":login_manager_proto", ":media_perception_proto", ":metrics_event_proto", + ":oobe_config_proto", ":power_manager_proto", ":seneschal_proto", ":smbprovider_proto", @@ -633,6 +634,7 @@ ":authpolicy_proto", ":biod_proto", ":cryptohome_proto", + ":oobe_config_proto", ":power_manager_proto", ":test_support", ":test_support_without_gmock", @@ -679,6 +681,7 @@ "dbus/fake_power_manager_client_unittest.cc", "dbus/gsm_sms_client_unittest.cc", "dbus/modem_messaging_client_unittest.cc", + "dbus/oobe_configuration_client_unittest.cc", "dbus/pipe_reader_unittest.cc", "dbus/power_manager_client_unittest.cc", "dbus/power_policy_controller_unittest.cc", @@ -910,6 +913,14 @@ proto_out_dir = "chromeos/dbus/media_perception" } +proto_library("oobe_config_proto") { + sources = [ + "//third_party/cros_system_api/dbus/oobe_config/oobe_config.proto", + ] + + proto_out_dir = "chromeos/dbus/oobe_config" +} + proto_library("seneschal_proto") { sources = [ "//third_party/cros_system_api/dbus/seneschal/seneschal_service.proto",
diff --git a/chromeos/components/drivefs/fake_drivefs.cc b/chromeos/components/drivefs/fake_drivefs.cc index 1e504a3..1939d1f9 100644 --- a/chromeos/components/drivefs/fake_drivefs.cc +++ b/chromeos/components/drivefs/fake_drivefs.cc
@@ -125,13 +125,6 @@ auto item = drivefs::mojom::QueryItem::New(); item->path = base::FilePath("/"); CHECK(mount_path.AppendRelativePath(file, &item->path)); - std::vector<std::string> components; - item->path.GetComponents(&components); - // During tests, metadata for the other drive sync implementation can - // end up in |mount_path| so filter it out. - if (components.size() < 2u || components[1] == "meta") { - continue; - } results.push_back(std::move(item)); } return results;
diff --git a/chromeos/dbus/fake_concierge_client.cc b/chromeos/dbus/fake_concierge_client.cc index 9ccc99a..46fb0d1 100644 --- a/chromeos/dbus/fake_concierge_client.cc +++ b/chromeos/dbus/fake_concierge_client.cc
@@ -67,6 +67,11 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), start_vm_response_)); + if (start_vm_response_.status() != vm_tools::concierge::VM_STATUS_STARTING) { + // Don't send the tremplin signal unless the VM was STARTING. + return; + } + // Trigger CiceroneClient::Observer::NotifyTremplinStartedSignal. vm_tools::cicerone::TremplinStartedSignal tremplin_started_signal; tremplin_started_signal.set_vm_name(request.name()); @@ -123,7 +128,7 @@ list_vm_disks_response_.set_success(true); start_vm_response_.Clear(); - start_vm_response_.set_success(true); + start_vm_response_.set_status(vm_tools::concierge::VM_STATUS_STARTING); stop_vm_response_.Clear(); stop_vm_response_.set_success(true);
diff --git a/chromeos/dbus/oobe_configuration_client.cc b/chromeos/dbus/oobe_configuration_client.cc index 3590c2b..1e19e36 100644 --- a/chromeos/dbus/oobe_configuration_client.cc +++ b/chromeos/dbus/oobe_configuration_client.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/macros.h" +#include "chromeos/dbus/oobe_config/oobe_config.pb.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -27,13 +28,20 @@ // OobeConfigurationClient override: void CheckForOobeConfiguration(ConfigurationCallback callback) override { - // TODO (antrim): do a method call once https://crbug.com/869209 is fixed. - OnData(std::move(callback), nullptr); + dbus::MethodCall method_call( + oobe_config::kOobeConfigRestoreInterface, + oobe_config::kProcessAndGetOobeAutoConfigMethod); + proxy_->CallMethod( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::BindOnce(&OobeConfigurationClientImpl::OnData, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } protected: void Init(dbus::Bus* bus) override { - // TODO (antrim): get proxy object once https://crbug.com/869209 is fixed. + proxy_ = bus->GetObjectProxy( + oobe_config::kOobeConfigRestoreServiceName, + dbus::ObjectPath(oobe_config::kOobeConfigRestoreServicePath)); } private: @@ -42,11 +50,35 @@ std::move(callback).Run(false, std::string()); return; } - - // TODO (antrim): read response once https://crbug.com/869209 is fixed. - NOTREACHED(); + oobe_config::OobeRestoreData response_proto; + dbus::MessageReader reader(response); + int error_code; + if (!reader.PopInt32(&error_code)) { + LOG(ERROR) << "Failed to parse error code from DBus Response."; + std::move(callback).Run(false, std::string()); + return; + } + if (error_code) { + LOG(ERROR) << "Error during DBus call " << error_code; + std::move(callback).Run(false, std::string()); + return; + } + if (!reader.PopArrayOfBytesAsProto(&response_proto)) { + LOG(ERROR) << "Failed to parse proto from DBus Response."; + std::move(callback).Run(false, std::string()); + return; + } + VLOG(0) << "Got oobe config, size = " + << response_proto.chrome_config_json().size(); + if (response_proto.chrome_config_json().empty()) { + std::move(callback).Run(false, std::string()); + return; + } + std::move(callback).Run(true, response_proto.chrome_config_json()); } + dbus::ObjectProxy* proxy_ = nullptr; + // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<OobeConfigurationClientImpl> weak_ptr_factory_;
diff --git a/chromeos/dbus/oobe_configuration_client.h b/chromeos/dbus/oobe_configuration_client.h index fa027a0..590189d16 100644 --- a/chromeos/dbus/oobe_configuration_client.h +++ b/chromeos/dbus/oobe_configuration_client.h
@@ -34,6 +34,8 @@ virtual void CheckForOobeConfiguration(ConfigurationCallback callback) = 0; protected: + friend class OobeConfigurationClientTest; + // Create() should be used instead. OobeConfigurationClient() = default;
diff --git a/chromeos/dbus/oobe_configuration_client_unittest.cc b/chromeos/dbus/oobe_configuration_client_unittest.cc new file mode 100644 index 0000000..56e8aa7b --- /dev/null +++ b/chromeos/dbus/oobe_configuration_client_unittest.cc
@@ -0,0 +1,202 @@ +// 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. + +#include "chromeos/dbus/oobe_configuration_client.h" + +#include <memory> +#include <string> + +#include "base/bind.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "chromeos/dbus/oobe_config/oobe_config.pb.h" +#include "dbus/message.h" +#include "dbus/mock_bus.h" +#include "dbus/mock_object_proxy.h" +#include "dbus/object_path.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/service_constants.h" + +using ::testing::_; +using ::testing::Invoke; +using ::testing::Return; + +namespace chromeos { + +namespace { + +// A mock ConfigurationCallback +class MockConfigurationCallback { + public: + MOCK_METHOD2(Run, void(bool, const std::string&)); +}; + +// Expect the reader to be empty. +void ExpectNoArgument(dbus::MessageReader* reader) { + EXPECT_FALSE(reader->HasMoreData()); +} + +} // namespace + +class OobeConfigurationClientTest : public testing::Test { + public: + OobeConfigurationClientTest() + : interface_name_(oobe_config::kOobeConfigRestoreInterface), + response_(nullptr) {} + + void SetUp() override { + // Create a mock bus. + dbus::Bus::Options options; + options.bus_type = dbus::Bus::SYSTEM; + mock_bus_ = new dbus::MockBus(options); + + // Create a mock oobe config proxy. + mock_proxy_ = new dbus::MockObjectProxy( + mock_bus_.get(), oobe_config::kOobeConfigRestoreServiceName, + dbus::ObjectPath(oobe_config::kOobeConfigRestoreServicePath)); + + // Set an expectation so mock_proxy's CallMethod() will use + // OnCallMethod() to return responses. + EXPECT_CALL(*mock_proxy_.get(), DoCallMethod(_, _, _)) + .WillRepeatedly( + Invoke(this, &OobeConfigurationClientTest::OnCallMethod)); + + // Set an expectation so mock_bus's GetObjectProxy() for the given + // service name and the object path will return mock_proxy_. + EXPECT_CALL(*mock_bus_.get(), + GetObjectProxy(oobe_config::kOobeConfigRestoreServiceName, + dbus::ObjectPath( + oobe_config::kOobeConfigRestoreServicePath))) + .WillOnce(Return(mock_proxy_.get())); + + // ShutdownAndBlock() will be called in TearDown(). + EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); + + // Create a client with the mock bus. + client_ = OobeConfigurationClient::Create(); + client_->Init(mock_bus_.get()); + // Run the message loop to run the signal connection result callback. + base::RunLoop().RunUntilIdle(); + } + + void TearDown() override { mock_bus_->ShutdownAndBlock(); } + + protected: + // A callback to intercept and check the method call arguments. + typedef base::RepeatingCallback<void(dbus::MessageReader* reader)> + ArgumentCheckCallback; + + // Sets expectations for called method name and arguments, and sets response. + void PrepareForMethodCall(const std::string& method_name, + const ArgumentCheckCallback& argument_checker, + dbus::Response* response) { + expected_method_name_ = method_name; + argument_checker_ = argument_checker; + response_ = response; + } + + // The interface name. + const std::string interface_name_; + // The client to be tested. + std::unique_ptr<OobeConfigurationClient> client_; + // A message loop to emulate asynchronous behavior. + base::MessageLoop message_loop_; + // The mock bus. + scoped_refptr<dbus::MockBus> mock_bus_; + // The mock object proxy. + scoped_refptr<dbus::MockObjectProxy> mock_proxy_; + + // The name of the method which is expected to be called. + std::string expected_method_name_; + // The response which the mock proxy returns. + dbus::Response* response_; + // A callback to intercept and check the method call arguments. + ArgumentCheckCallback argument_checker_; + + private: + // Checks the content of the method call and returns the response. + // Used to implement the mock oobe config proxy. + void OnCallMethod(dbus::MethodCall* method_call, + int timeout_ms, + dbus::ObjectProxy::ResponseCallback* response) { + EXPECT_EQ(interface_name_, method_call->GetInterface()); + EXPECT_EQ(expected_method_name_, method_call->GetMember()); + dbus::MessageReader reader(method_call); + argument_checker_.Run(&reader); + message_loop_.task_runner()->PostTask( + FROM_HERE, base::BindOnce(std::move(*response), response_)); + } +}; + +TEST_F(OobeConfigurationClientTest, CheckEmptyConfiguration) { + // Create response. + std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); + + oobe_config::OobeRestoreData proto; + proto.set_chrome_config_json(std::string()); + dbus::MessageWriter writer(response.get()); + writer.AppendInt32(0); + writer.AppendProtoAsArrayOfBytes(proto); + + // Set expectations. + PrepareForMethodCall(oobe_config::kProcessAndGetOobeAutoConfigMethod, + base::BindRepeating(&ExpectNoArgument), response.get()); + + MockConfigurationCallback callback; + EXPECT_CALL(callback, Run(false, _)).Times(1); + + client_->CheckForOobeConfiguration(base::BindOnce( + &MockConfigurationCallback::Run, base::Unretained(&callback))); + + base::RunLoop().RunUntilIdle(); +} + +TEST_F(OobeConfigurationClientTest, CheckServiceError) { + // Create response. + std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); + + oobe_config::OobeRestoreData proto; + proto.set_chrome_config_json("{key:true}"); + dbus::MessageWriter writer(response.get()); + writer.AppendInt32(1); + writer.AppendProtoAsArrayOfBytes(proto); + + // Set expectations. + PrepareForMethodCall(oobe_config::kProcessAndGetOobeAutoConfigMethod, + base::BindRepeating(&ExpectNoArgument), response.get()); + + MockConfigurationCallback callback; + EXPECT_CALL(callback, Run(false, _)).Times(1); + + client_->CheckForOobeConfiguration(base::BindOnce( + &MockConfigurationCallback::Run, base::Unretained(&callback))); + + base::RunLoop().RunUntilIdle(); +} + +TEST_F(OobeConfigurationClientTest, CheckConfigurationExists) { + // Create response. + std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); + + oobe_config::OobeRestoreData proto; + proto.set_chrome_config_json("{key:true}"); + dbus::MessageWriter writer(response.get()); + writer.AppendInt32(0); + writer.AppendProtoAsArrayOfBytes(proto); + + // Set expectations. + PrepareForMethodCall(oobe_config::kProcessAndGetOobeAutoConfigMethod, + base::BindRepeating(&ExpectNoArgument), response.get()); + + MockConfigurationCallback callback; + EXPECT_CALL(callback, Run(true, "{key:true}")).Times(1); + + client_->CheckForOobeConfiguration(base::BindOnce( + &MockConfigurationCallback::Run, base::Unretained(&callback))); + + base::RunLoop().RunUntilIdle(); +} + +} // namespace chromeos
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 561ffe7..9c2db9a 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -1080,8 +1080,6 @@ ServerFieldTypeSet non_empty_types; personal_data_->GetNonEmptyTypes(&non_empty_types); - if (submitted_form.is_signin_upload()) - non_empty_types.insert(PASSWORD); download_manager_->StartUploadRequest( submitted_form, was_autofilled, non_empty_types,
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index 445c56dc..1325168 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -6168,54 +6168,6 @@ } } -// Test that a sign-in form submission sends an upload with types matching the -// fields. -// TODO(https://crbug.com/889472): Remove this test together with sending -// sign-in vote. -TEST_F(AutofillManagerTest, SignInFormSubmission_Upload) { - // Set up our form data (it's already filled out with user data). - FormData form; - form.origin = GURL("http://myform.com/form.html"); - form.action = GURL("http://myform.com/submit.html"); - - std::vector<ServerFieldTypeSet> expected_types; - ServerFieldTypeSet types; - - FormFieldData field; - test::CreateTestFormField("Email", "email", "theking@gmail.com", "text", - &field); - form.fields.push_back(field); - types.insert(EMAIL_ADDRESS); - expected_types.push_back(types); - - test::CreateTestFormField("Password", "pw", "", "password", &field); - form.fields.push_back(field); - FormsSeen(std::vector<FormData>(1, form)); - types.clear(); - types.insert(PASSWORD); - expected_types.push_back(types); - - FormsSeen({form}); - - // We will expect these types in the upload and no observed submission. (the - // callback initiated by WaitForAsyncUploadProcess checks these expectations.) - autofill_manager_->SetExpectedSubmittedFieldTypes(expected_types); - autofill_manager_->SetExpectedObservedSubmission(true); - autofill_manager_->SetCallParentUploadFormData(true); - - std::unique_ptr<FormStructure> form_structure(new FormStructure(form)); - form_structure->set_is_signin_upload(true); - form_structure->field(1)->set_possible_types({autofill::PASSWORD}); - - std::string signature = form_structure->FormSignatureAsStr(); - - EXPECT_CALL(*download_manager_, - StartUploadRequest(_, false, _, std::string(), true)) - .Times(0); - autofill_manager_->MaybeStartVoteUploadProcess(std::move(form_structure), - base::TimeTicks::Now(), true); -} - // Test that with small form upload enabled but heuristics and query disabled // we get uploads but not quality metrics. TEST_F(AutofillManagerTest, SmallForm_Upload_NoHeuristicsOrQuery) {
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index d313284..6547e88 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc
@@ -344,7 +344,6 @@ is_form_tag_(form.is_form_tag), is_formless_checkout_(form.is_formless_checkout), all_fields_are_passwords_(!form.fields.empty()), - is_signin_upload_(false), form_parsed_timestamp_(base::TimeTicks::Now()), passwords_were_revealed_(false), developer_engagement_metrics_(0) { @@ -691,7 +690,7 @@ if (active_field_count() < min_required_fields && (!all_fields_are_passwords() || active_field_count() < kRequiredFieldsForFormsWithOnlyPasswordFields) && - !is_signin_upload_ && !has_author_specified_types_) { + !has_author_specified_types_) { return false; }
diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h index 2cf3f6e..098db543 100644 --- a/components/autofill/core/browser/form_structure.h +++ b/components/autofill/core/browser/form_structure.h
@@ -248,11 +248,6 @@ bool all_fields_are_passwords() const { return all_fields_are_passwords_; } - bool is_signin_upload() const { return is_signin_upload_; } - void set_is_signin_upload(bool is_signin_upload) { - is_signin_upload_ = is_signin_upload; - } - FormSignature form_signature() const { return form_signature_; } // Returns a FormData containing the data this form structure knows about. @@ -514,10 +509,6 @@ // True if all form fields are password fields. bool all_fields_are_passwords_; - // True if the form is submitted and has 2 fields: one text and one password - // field. - bool is_signin_upload_; - // The unique signature for this form, composed of the target url domain, // the form name, and the form field names in a 64-bit hash. FormSignature form_signature_;
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc index 99e4b69..f895284 100644 --- a/components/autofill/core/browser/form_structure_unittest.cc +++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -394,28 +394,6 @@ field.form_control_type = "password"; form.fields.push_back(field); CheckFormShouldBeParsed("new password", form, true, true); - - // There are 2 fields, one of which is password, and this is an upload of - // a sign-in form submission, should be parsed. even if all minimums are - // enforced. - form.fields.clear(); - field.name = ASCIIToUTF16("username"); - field.form_control_type = "text"; - form.fields.push_back(field); - field.name = ASCIIToUTF16("pw"); - field.form_control_type = "password"; - form.fields.push_back(field); - base::test::ScopedFeatureList feature_list; - feature_list.InitWithFeatures( - // Enabled. - {kAutofillEnforceMinRequiredFieldsForHeuristics, - kAutofillEnforceMinRequiredFieldsForQuery, - kAutofillEnforceMinRequiredFieldsForUpload}, - // Disabled. - {}); - FormStructure form_structure(form); - form_structure.set_is_signin_upload(true); - EXPECT_TRUE(form_structure.ShouldBeParsed()); } // Tests that ShouldBeParsed returns true for a form containing less than three
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc index 9da1c4c2..8ad100d 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
@@ -22,6 +22,7 @@ #include "components/autofill/core/browser/webdata/autofill_table.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_constants.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h" @@ -644,6 +645,11 @@ } } +void AutofillProfileSyncableService::set_sync_processor( + syncer::SyncChangeProcessor* sync_processor) { + sync_processor_.reset(sync_processor); +} + syncer::SyncData AutofillProfileSyncableService::CreateData( const AutofillProfile& profile) { sync_pb::EntitySpecifics specifics;
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.h b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.h index 028b92f3..ce6efa43 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.h +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.h
@@ -108,9 +108,7 @@ // For unit tests. AutofillProfileSyncableService(); - void set_sync_processor(syncer::SyncChangeProcessor* sync_processor) { - sync_processor_.reset(sync_processor); - } + void set_sync_processor(syncer::SyncChangeProcessor* sync_processor); // Creates syncer::SyncData based on supplied |profile|. // Exposed for unit tests.
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc index c3c165f..0678d733 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc
@@ -17,6 +17,7 @@ #include "components/autofill/core/browser/country_names.h" #include "components/autofill/core/browser/webdata/autofill_change.h" #include "components/autofill/core/common/autofill_constants.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/model/sync_error_factory_mock.h" #include "components/sync/protocol/sync.pb.h"
diff --git a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc index 0bea08e..dfbede0 100644 --- a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc +++ b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc
@@ -122,9 +122,17 @@ } std::string GetSpecificsIdForEntryServerId(const std::string& server_id) { + // TODO(jkrcal): This specifics id for wallet_data probably should not be + // base64 encoded - this function is only used in printing debug data; should + // the storage key for wallet_data below be encoded? (probably yes, as this is + // already launched). return GetBase64EncodedServerId(server_id); } +std::string GetSpecificsIdForMetadataId(const std::string& metadata_id) { + return GetBase64EncodedServerId(metadata_id); +} + std::string GetStorageKeyForSpecificsId(const std::string& specifics_id) { // We use the base64 encoded |specifics_id| directly as the storage key, this // function only hides this definition from all its call sites. @@ -132,9 +140,15 @@ } std::string GetStorageKeyForEntryServerId(const std::string& server_id) { + // TODO(jkrcal): This probably needs to stay base64 encoded while specifics id + // should not. Fix. return GetStorageKeyForSpecificsId(GetSpecificsIdForEntryServerId(server_id)); } +std::string GetStorageKeyForMetadataId(const std::string& metadata_id) { + return GetStorageKeyForSpecificsId(GetSpecificsIdForMetadataId(metadata_id)); +} + std::string GetClientTagForSpecificsId( AutofillWalletSpecifics::WalletInfoType type, const std::string& wallet_data_specifics_id) {
diff --git a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.h b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.h index c4893d7f..07861d4 100644 --- a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.h +++ b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.h
@@ -21,15 +21,23 @@ // Returns the specified |server_id| encoded in base 64. std::string GetBase64EncodedServerId(const std::string& server_id); -// Returns the wallet specifics id for the specified |server_id|. +// Returns the wallet data specifics id for the specified |server_id|. std::string GetSpecificsIdForEntryServerId(const std::string& server_id); -// Returns the storage key for the specified |server_id|. +// Returns the wallet metadata specifics id for the specified |metadata_id|. +std::string GetSpecificsIdForMetadataId(const std::string& metadata_id); + +// Returns the storage key for the specified |specifics_id|. std::string GetStorageKeyForSpecificsId(const std::string& specifics_id); -// Returns the wallet specifics storage key for the specified |server_id|. +// Returns the wallet data specifics storage key for the specified +// |server_id|. std::string GetStorageKeyForEntryServerId(const std::string& server_id); +// Returns the wallet metadata specifics storage key for the specified +// |metadata_id|. +std::string GetStorageKeyForMetadataId(const std::string& metadata_id); + // Returns the client tag for the specified wallet |type| and // |wallet_data_specifics_id|. std::string GetClientTagForSpecificsId(
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge.cc index 7f2c2761..ab7b29f 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge.cc
@@ -10,6 +10,7 @@ #include "base/base64.h" #include "base/logging.h" #include "base/optional.h" +#include "components/autofill/core/browser/autofill_metadata.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/webdata/autofill_sync_bridge_util.h" @@ -45,53 +46,56 @@ } } -// Returns EntityData with common fields set based on |local_data_model|. -std::unique_ptr<EntityData> CreateEntityDataFromAutofillDataModel( - const AutofillDataModel& local_data_model, - WalletMetadataSpecifics::Type type, - const std::string& specifics_id) { +// Returns EntityData for wallet_metadata for |local_metadata| and |type|. +std::unique_ptr<EntityData> CreateEntityDataFromAutofillMetadata( + const AutofillMetadata& local_metadata, + WalletMetadataSpecifics::Type type) { auto entity_data = std::make_unique<EntityData>(); + std::string specifics_id = GetSpecificsIdForMetadataId(local_metadata.id); entity_data->non_unique_name = GetClientTagForSpecificsId(type, specifics_id); - WalletMetadataSpecifics* metadata = + WalletMetadataSpecifics* remote_metadata = entity_data->specifics.mutable_wallet_metadata(); - metadata->set_type(type); - metadata->set_id(specifics_id); - metadata->set_use_count(local_data_model.use_count()); - metadata->set_use_date( - local_data_model.use_date().ToDeltaSinceWindowsEpoch().InMicroseconds()); + remote_metadata->set_type(type); + remote_metadata->set_id(specifics_id); + remote_metadata->set_use_count(local_metadata.use_count); + remote_metadata->set_use_date( + local_metadata.use_date.ToDeltaSinceWindowsEpoch().InMicroseconds()); + + switch (type) { + case WalletMetadataSpecifics::ADDRESS: { + remote_metadata->set_address_has_converted(local_metadata.has_converted); + break; + } + case WalletMetadataSpecifics::CARD: { + // The strings must be in valid UTF-8 to sync. + std::string billing_address_id; + base::Base64Encode(local_metadata.billing_address_id, + &billing_address_id); + remote_metadata->set_card_billing_address_id(billing_address_id); + break; + } + case WalletMetadataSpecifics::UNKNOWN: { + NOTREACHED(); + break; + } + } + return entity_data; } // Returns EntityData for wallet_metadata for |local_profile|. std::unique_ptr<EntityData> CreateMetadataEntityDataFromAutofillServerProfile( const AutofillProfile& local_profile) { - std::unique_ptr<EntityData> entity_data = - CreateEntityDataFromAutofillDataModel( - local_profile, WalletMetadataSpecifics::ADDRESS, - GetSpecificsIdForEntryServerId(local_profile.server_id())); - - WalletMetadataSpecifics* metadata = - entity_data->specifics.mutable_wallet_metadata(); - metadata->set_address_has_converted(local_profile.has_converted()); - return entity_data; + return CreateEntityDataFromAutofillMetadata(local_profile.GetMetadata(), + WalletMetadataSpecifics::ADDRESS); } // Returns EntityData for wallet_metadata for |local_card|. std::unique_ptr<EntityData> CreateMetadataEntityDataFromCard( const CreditCard& local_card) { - std::unique_ptr<EntityData> entity_data = - CreateEntityDataFromAutofillDataModel( - local_card, WalletMetadataSpecifics::CARD, - GetSpecificsIdForEntryServerId(local_card.server_id())); - - WalletMetadataSpecifics* metadata = - entity_data->specifics.mutable_wallet_metadata(); - // The strings must be in valid UTF-8 to sync. - std::string billing_address_id; - base::Base64Encode(local_card.billing_address_id(), &billing_address_id); - metadata->set_card_billing_address_id(billing_address_id); - return entity_data; + return CreateEntityDataFromAutofillMetadata(local_card.GetMetadata(), + WalletMetadataSpecifics::CARD); } } // namespace @@ -269,12 +273,12 @@ return; } for (const std::unique_ptr<AutofillProfile>& entry : profiles) { - cache_[GetStorageKeyForEntryServerId(entry->server_id())] = + cache_[GetStorageKeyForMetadataId(entry->GetMetadata().id)] = CreateMetadataEntityDataFromAutofillServerProfile(*entry) ->specifics.wallet_metadata(); } for (const std::unique_ptr<CreditCard>& entry : cards) { - cache_[GetStorageKeyForEntryServerId(entry->server_id())] = + cache_[GetStorageKeyForMetadataId(entry->GetMetadata().id)] = CreateMetadataEntityDataFromCard(*entry)->specifics.wallet_metadata(); } @@ -307,17 +311,16 @@ auto batch = std::make_unique<syncer::MutableDataBatch>(); for (const std::unique_ptr<AutofillProfile>& entry : profiles) { - std::string key = GetStorageKeyForEntryServerId(entry->server_id()); + std::string key = GetStorageKeyForMetadataId(entry->GetMetadata().id); if (!storage_keys_set || base::ContainsKey(*storage_keys_set, key)) { batch->Put(key, CreateMetadataEntityDataFromAutofillServerProfile(*entry)); } } for (const std::unique_ptr<CreditCard>& entry : cards) { - std::string key = GetStorageKeyForEntryServerId(entry->server_id()); + std::string key = GetStorageKeyForMetadataId(entry->GetMetadata().id); if (!storage_keys_set || base::ContainsKey(*storage_keys_set, key)) { - batch->Put(GetStorageKeyForEntryServerId(entry->server_id()), - CreateMetadataEntityDataFromCard(*entry)); + batch->Put(key, CreateMetadataEntityDataFromCard(*entry)); } }
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc index f13179a..6d86082 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <algorithm> #include <map> #include <utility> @@ -19,6 +20,7 @@ #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_util.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h"
diff --git a/components/autofill_assistant/browser/actions/action.cc b/components/autofill_assistant/browser/actions/action.cc index ea4cf260..7617be4 100644 --- a/components/autofill_assistant/browser/actions/action.cc +++ b/components/autofill_assistant/browser/actions/action.cc
@@ -18,4 +18,4 @@ : ProcessedActionStatus::OTHER_ACTION_STATUS); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/action.h b/components/autofill_assistant/browser/actions/action.h index 3fb6c7d..e0060b3 100644 --- a/components/autofill_assistant/browser/actions/action.h +++ b/components/autofill_assistant/browser/actions/action.h
@@ -40,5 +40,5 @@ std::unique_ptr<ProcessedActionProto> processed_action_proto_; }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/action_delegate.h b/components/autofill_assistant/browser/actions/action_delegate.h index c44d118..846bf00 100644 --- a/components/autofill_assistant/browser/actions/action_delegate.h +++ b/components/autofill_assistant/browser/actions/action_delegate.h
@@ -95,5 +95,5 @@ protected: ActionDelegate() = default; }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_ACTION_DELEGATE_H_
diff --git a/components/autofill_assistant/browser/actions/autofill_action.cc b/components/autofill_assistant/browser/actions/autofill_action.cc index d0f7c3b..aea5228 100644 --- a/components/autofill_assistant/browser/actions/autofill_action.cc +++ b/components/autofill_assistant/browser/actions/autofill_action.cc
@@ -334,4 +334,4 @@ } } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/autofill_action.h b/components/autofill_assistant/browser/actions/autofill_action.h index 1365f695..8fd8658 100644 --- a/components/autofill_assistant/browser/actions/autofill_action.h +++ b/components/autofill_assistant/browser/actions/autofill_action.h
@@ -87,5 +87,5 @@ DISALLOW_COPY_AND_ASSIGN(AutofillAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_AUTOFILL_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/click_action.cc b/components/autofill_assistant/browser/actions/click_action.cc index 7f64df4..109f0d461 100644 --- a/components/autofill_assistant/browser/actions/click_action.cc +++ b/components/autofill_assistant/browser/actions/click_action.cc
@@ -38,4 +38,4 @@ std::move(callback).Run(std::move(processed_action_proto_)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/click_action.h b/components/autofill_assistant/browser/actions/click_action.h index 07f8fdf..7df47ef2 100644 --- a/components/autofill_assistant/browser/actions/click_action.h +++ b/components/autofill_assistant/browser/actions/click_action.h
@@ -33,5 +33,5 @@ DISALLOW_COPY_AND_ASSIGN(ClickAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_CLICK_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/focus_element_action.cc b/components/autofill_assistant/browser/actions/focus_element_action.cc index 7680a7d17..1a3f0bd 100644 --- a/components/autofill_assistant/browser/actions/focus_element_action.cc +++ b/components/autofill_assistant/browser/actions/focus_element_action.cc
@@ -43,4 +43,4 @@ std::move(callback).Run(std::move(processed_action_proto_)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/focus_element_action.h b/components/autofill_assistant/browser/actions/focus_element_action.h index e8a4318c..ef289faf 100644 --- a/components/autofill_assistant/browser/actions/focus_element_action.h +++ b/components/autofill_assistant/browser/actions/focus_element_action.h
@@ -29,5 +29,5 @@ DISALLOW_COPY_AND_ASSIGN(FocusElementAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_FOCUS_ELEMENT_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/select_option_action.cc b/components/autofill_assistant/browser/actions/select_option_action.cc index fd7a239..c95d5a1 100644 --- a/components/autofill_assistant/browser/actions/select_option_action.cc +++ b/components/autofill_assistant/browser/actions/select_option_action.cc
@@ -44,4 +44,4 @@ std::move(callback).Run(std::move(processed_action_proto_)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/select_option_action.h b/components/autofill_assistant/browser/actions/select_option_action.h index a47658f..61ae34255 100644 --- a/components/autofill_assistant/browser/actions/select_option_action.h +++ b/components/autofill_assistant/browser/actions/select_option_action.h
@@ -32,5 +32,5 @@ DISALLOW_COPY_AND_ASSIGN(SelectOptionAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_SELECT_OPTION_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/tell_action.cc b/components/autofill_assistant/browser/actions/tell_action.cc index 65ecbad..ecd2127 100644 --- a/components/autofill_assistant/browser/actions/tell_action.cc +++ b/components/autofill_assistant/browser/actions/tell_action.cc
@@ -26,4 +26,4 @@ std::move(callback).Run(std::move(processed_action_proto_)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/tell_action.h b/components/autofill_assistant/browser/actions/tell_action.h index 8ac84a9..a1eab82 100644 --- a/components/autofill_assistant/browser/actions/tell_action.h +++ b/components/autofill_assistant/browser/actions/tell_action.h
@@ -25,5 +25,5 @@ DISALLOW_COPY_AND_ASSIGN(TellAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_TELL_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/upload_dom_action.cc b/components/autofill_assistant/browser/actions/upload_dom_action.cc index f291fb0..682eac8 100644 --- a/components/autofill_assistant/browser/actions/upload_dom_action.cc +++ b/components/autofill_assistant/browser/actions/upload_dom_action.cc
@@ -42,4 +42,4 @@ std::move(callback).Run(std::move(processed_action_proto_)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/upload_dom_action.h b/components/autofill_assistant/browser/actions/upload_dom_action.h index f062c53..5857f1b 100644 --- a/components/autofill_assistant/browser/actions/upload_dom_action.h +++ b/components/autofill_assistant/browser/actions/upload_dom_action.h
@@ -30,5 +30,5 @@ DISALLOW_COPY_AND_ASSIGN(UploadDomAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_UPLOAD_DOM_ACTION_H_
diff --git a/components/autofill_assistant/browser/actions/wait_for_dom_action.cc b/components/autofill_assistant/browser/actions/wait_for_dom_action.cc index 5aae1bd..335a7562 100644 --- a/components/autofill_assistant/browser/actions/wait_for_dom_action.cc +++ b/components/autofill_assistant/browser/actions/wait_for_dom_action.cc
@@ -79,4 +79,4 @@ base::TimeDelta::FromMilliseconds(kCheckPeriodInMilliseconds)); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/actions/wait_for_dom_action.h b/components/autofill_assistant/browser/actions/wait_for_dom_action.h index 798d9ef..6187efb 100644 --- a/components/autofill_assistant/browser/actions/wait_for_dom_action.h +++ b/components/autofill_assistant/browser/actions/wait_for_dom_action.h
@@ -37,5 +37,5 @@ DISALLOW_COPY_AND_ASSIGN(WaitForDomAction); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_ACTIONS_WAIT_FOR_DOM_ACTION_H_
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index ba53a395f..1a788dc 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -157,13 +157,7 @@ EXPECT_CALL(*mock_service_, OnGetActions(StrEq("script1"), _, _)) .WillOnce(RunOnceCallback<2>(true, "")); - // 6. offering the choice: script2 - EXPECT_CALL(*mock_ui_controller_, UpdateScripts(SizeIs(1))) - .WillOnce([](const std::vector<ScriptHandle>& scripts) { - EXPECT_EQ("script2", scripts[0].path); - }); - // 7. As nothing is selected from the 2nd UpdateScripts call, the flow - // terminates. + // 6. As nothing is selected the flow terminates. // Start the flow. SimulateNavigateToUrl(GURL("http://a.example.com/path")); @@ -201,7 +195,6 @@ EXPECT_CALL(*mock_service_, OnGetActions(StrEq("runnable"), _, _)) .WillOnce(RunOnceCallback<2>(true, "")); - EXPECT_CALL(*mock_ui_controller_, UpdateScripts(SizeIs(0))); SimulateNavigateToUrl(GURL("http://a.example.com/path")); }
diff --git a/components/autofill_assistant/browser/script.cc b/components/autofill_assistant/browser/script.cc index 8f35cbb2..62ec03f 100644 --- a/components/autofill_assistant/browser/script.cc +++ b/components/autofill_assistant/browser/script.cc
@@ -14,4 +14,4 @@ Script::~Script() = default; -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/script_precondition.cc b/components/autofill_assistant/browser/script_precondition.cc index e324747..b843b15e 100644 --- a/components/autofill_assistant/browser/script_precondition.cc +++ b/components/autofill_assistant/browser/script_precondition.cc
@@ -13,12 +13,11 @@ #include "url/gurl.h" namespace autofill_assistant { - // Static std::unique_ptr<ScriptPrecondition> ScriptPrecondition::FromProto( - const ScriptPreconditionProto& proto) { + const ScriptPreconditionProto& script_precondition_proto) { std::vector<std::vector<std::string>> elements_exist; - for (const auto& element : proto.elements_exist()) { + for (const auto& element : script_precondition_proto.elements_exist()) { std::vector<std::string> selectors; for (const auto& selector : element.selectors()) { selectors.emplace_back(selector); @@ -27,12 +26,12 @@ } std::set<std::string> domain_match; - for (const auto& domain : proto.domain()) { + for (const auto& domain : script_precondition_proto.domain()) { domain_match.emplace(domain); } std::vector<std::unique_ptr<re2::RE2>> path_pattern; - for (const auto& pattern : proto.path_pattern()) { + for (const auto& pattern : script_precondition_proto.path_pattern()) { auto re = std::make_unique<re2::RE2>(pattern); if (re->error_code() != re2::RE2::NoError) { LOG(ERROR) << "Invalid regexp in script precondition '" << pattern; @@ -42,20 +41,26 @@ } std::vector<ScriptParameterMatchProto> parameter_match; - for (const auto& match : proto.script_parameter_match()) { + for (const auto& match : script_precondition_proto.script_parameter_match()) { parameter_match.emplace_back(match); } std::vector<FormValueMatchProto> form_value_match; - for (const auto& match : proto.form_value_match()) { + for (const auto& match : script_precondition_proto.form_value_match()) { form_value_match.emplace_back(match); } - // TODO(crbug.com/806868): Detect unknown or unsupported conditions and reject - // them. + std::vector<ScriptStatusMatchProto> status_matches; + for (const auto& status_match : + script_precondition_proto.script_status_match()) { + status_matches.push_back(status_match); + } + + // TODO(crbug.com/806868): Detect unknown or unsupported conditions and + // reject them. return std::make_unique<ScriptPrecondition>( elements_exist, domain_match, std::move(path_pattern), parameter_match, - form_value_match); + form_value_match, status_matches); } ScriptPrecondition::~ScriptPrecondition() {} @@ -63,9 +68,12 @@ void ScriptPrecondition::Check( WebController* web_controller, const std::map<std::string, std::string>& parameters, + const std::map<std::string, ScriptStatusProto>& executed_scripts, base::OnceCallback<void(bool)> callback) { const GURL& url = web_controller->GetUrl(); - if (!MatchDomain(url) || !MatchPath(url) || !MatchParameters(parameters)) { + + if (!MatchDomain(url) || !MatchPath(url) || !MatchParameters(parameters) || + !MatchScriptStatus(executed_scripts)) { std::move(callback).Run(false); return; } @@ -106,7 +114,8 @@ const std::set<std::string>& domain_match, std::vector<std::unique_ptr<re2::RE2>> path_pattern, const std::vector<ScriptParameterMatchProto>& parameter_match, - const std::vector<FormValueMatchProto>& form_value_match) + const std::vector<FormValueMatchProto>& form_value_match, + const std::vector<ScriptStatusMatchProto>& status_match) : elements_exist_(elements_exist), pending_preconditions_check_count_(0), all_preconditions_check_satisfied_(false), @@ -114,6 +123,7 @@ path_pattern_(std::move(path_pattern)), parameter_match_(parameter_match), form_value_match_(form_value_match), + status_match_(status_match), weak_ptr_factory_(this) {} void ScriptPrecondition::OnCheckElementExists(bool result) { @@ -168,6 +178,26 @@ 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: + return !has_same_status; + case ScriptStatusMatchProto::EQUAL: + default: + return has_same_status; + } + } + return true; +} + void ScriptPrecondition::OnGetFieldValue(const std::string& value) { DCHECK_LT(0u, pending_preconditions_check_count_); pending_preconditions_check_count_--; @@ -185,4 +215,4 @@ } } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/script_precondition.h b/components/autofill_assistant/browser/script_precondition.h index 210775f..5455c49 100644 --- a/components/autofill_assistant/browser/script_precondition.h +++ b/components/autofill_assistant/browser/script_precondition.h
@@ -29,20 +29,22 @@ // Builds a precondition from its proto representation. Returns nullptr if the // preconditions are invalid. static std::unique_ptr<ScriptPrecondition> FromProto( - const ScriptPreconditionProto& proto); + const ScriptPreconditionProto& script_precondition_proto); ScriptPrecondition( const std::vector<std::vector<std::string>>& elements_exist, const std::set<std::string>& domain_match, std::vector<std::unique_ptr<re2::RE2>> path_pattern, const std::vector<ScriptParameterMatchProto>& parameter_match, - const std::vector<FormValueMatchProto>& form_value_match); + const std::vector<FormValueMatchProto>& form_value_match, + const std::vector<ScriptStatusMatchProto>& status_match); ~ScriptPrecondition(); // Check whether the conditions satisfied and return the result through // |callback|. void Check(WebController* web_controller, const std::map<std::string, std::string>& parameters, + const std::map<std::string, ScriptStatusProto>& executed_scripts, base::OnceCallback<void(bool)> callback); private: @@ -51,6 +53,9 @@ bool MatchPath(const GURL& url) const; bool MatchParameters( const std::map<std::string, std::string>& parameters) const; + bool MatchScriptStatus( + const std::map<std::string, ScriptStatusProto>& executed_scripts) const; + void OnGetFieldValue(const std::string& value); // Return if all checks have been completed and we have not returned anything @@ -74,11 +79,14 @@ // Conditions on form fields value. std::vector<FormValueMatchProto> form_value_match_; + // Conditions regarding the execution status of passed scripts. + std::vector<ScriptStatusMatchProto> status_match_; + base::WeakPtrFactory<ScriptPrecondition> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ScriptPrecondition); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SCRIPT_PRECONDITION_H_
diff --git a/components/autofill_assistant/browser/script_precondition_unittest.cc b/components/autofill_assistant/browser/script_precondition_unittest.cc index dfff053..0d498dd5 100644 --- a/components/autofill_assistant/browser/script_precondition_unittest.cc +++ b/components/autofill_assistant/browser/script_precondition_unittest.cc
@@ -82,13 +82,15 @@ return false; DirectCallback callback; - precondition->Check(&mock_web_controller_, parameters_, callback.Get()); + precondition->Check(&mock_web_controller_, parameters_, executed_scripts_, + callback.Get()); return callback.GetResultOrDie(); } GURL url_; MockWebController mock_web_controller_; std::map<std::string, std::string> parameters_; + std::map<std::string, ScriptStatusProto> executed_scripts_; }; TEST_F(ScriptPreconditionTest, NoConditions) { @@ -143,6 +145,54 @@ EXPECT_EQ(nullptr, ScriptPrecondition::FromProto(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, 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 62bae9c..001cc84 100644 --- a/components/autofill_assistant/browser/script_tracker.cc +++ b/components/autofill_assistant/browser/script_tracker.cc
@@ -40,26 +40,18 @@ DCHECK_EQ(pending_precondition_check_count_, 0); DCHECK(pending_runnable_scripts_.empty()); - std::vector<Script*> scripts_to_check; - for (const auto& entry : available_scripts_) { - Script* script = entry.first; - if (executed_scripts_.find(script->handle.path) == - executed_scripts_.end() && - script->precondition) { - scripts_to_check.emplace_back(script); - } - } - // pending_precondition_check_count_ lets OnPreconditionCheck know when to // stop. It must be set before the callback can possibly be run. - pending_precondition_check_count_ = scripts_to_check.size(); + pending_precondition_check_count_ = available_scripts_.size(); if (pending_precondition_check_count_ == 0) { // Possibly report an empty set of runnable scripts. UpdateRunnableScriptsIfNecessary(); } else { - for (Script* script : scripts_to_check) { + for (const auto& entry : available_scripts_) { + Script* script = entry.first; script->precondition->Check( delegate_->GetWebController(), delegate_->GetParameters(), + executed_scripts_, base::BindOnce(&ScriptTracker::OnPreconditionCheck, weak_ptr_factory_.GetWeakPtr(), script)); } @@ -73,17 +65,19 @@ return; } - DCHECK(executed_scripts_.find(script_path) == executed_scripts_.end()); - executed_scripts_.insert(script_path); + executed_scripts_[script_path] = SCRIPT_STATUS_RUNNING; executor_ = std::make_unique<ScriptExecutor>(script_path, delegate_); executor_->Run(base::BindOnce(&ScriptTracker::OnScriptRun, - weak_ptr_factory_.GetWeakPtr(), + weak_ptr_factory_.GetWeakPtr(), script_path, std::move(callback))); } void ScriptTracker::OnScriptRun( + const std::string& script_path, base::OnceCallback<void(bool)> original_callback, bool success) { + executed_scripts_[script_path] = + success ? SCRIPT_STATUS_SUCCESS : SCRIPT_STATUS_FAILURE; executor_.reset(); std::move(original_callback).Run(success); }
diff --git a/components/autofill_assistant/browser/script_tracker.h b/components/autofill_assistant/browser/script_tracker.h index b8b707e..bd48e92 100644 --- a/components/autofill_assistant/browser/script_tracker.h +++ b/components/autofill_assistant/browser/script_tracker.h
@@ -15,6 +15,7 @@ #include "base/memory/weak_ptr.h" #include "components/autofill_assistant/browser/script.h" #include "components/autofill_assistant/browser/script_executor.h" +#include "components/autofill_assistant/browser/service.pb.h" namespace autofill_assistant { class ScriptExecutorDelegate; @@ -65,7 +66,8 @@ bool running() const { return executor_ != nullptr; } private: - void OnScriptRun(base::OnceCallback<void(bool)> original_callback, + void OnScriptRun(const std::string& script_path, + base::OnceCallback<void(bool)> original_callback, bool success); void UpdateRunnableScriptsIfNecessary(); @@ -89,10 +91,8 @@ // any pending check. std::map<Script*, std::unique_ptr<Script>> available_scripts_; - // Set of scripts that have been executed. They'll be excluded from runnable. - // TODO(crbug.com/806868): Track script execution status and forward - // that information to the script precondition. - std::set<std::string> executed_scripts_; + // List of scripts that have been executed and their corresponding statuses. + std::map<std::string, ScriptStatusProto> executed_scripts_; // Number of precondition checks run for CheckScripts that are still // pending.
diff --git a/components/autofill_assistant/browser/script_tracker_unittest.cc b/components/autofill_assistant/browser/script_tracker_unittest.cc index 4a85d101..d64d90cd 100644 --- a/components/autofill_assistant/browser/script_tracker_unittest.cc +++ b/components/autofill_assistant/browser/script_tracker_unittest.cc
@@ -86,6 +86,13 @@ ->mutable_precondition() ->add_elements_exist() ->add_selectors(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; return script; }
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 671a3bb7..ea1675f7 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -60,6 +60,41 @@ optional PresentationProto presentation = 2; } +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 { // Combined with AND: the elements referenced here must be present. repeated ElementReferenceProto elements_exist = 3; @@ -69,7 +104,7 @@ repeated string domain = 6; // Combined with AND: all matches must be true for precondition to hold. repeated ScriptParameterMatchProto script_parameter_match = 7; - // Combined with AND: all matches must be true for precondition to hold. + repeated ScriptStatusMatchProto script_status_match = 8; repeated FormValueMatchProto form_value_match = 9; } @@ -226,7 +261,7 @@ // Contain all arguments to perform a click. message ClickProto { - required ElementReferenceProto element_to_click = 1; + optional ElementReferenceProto element_to_click = 1; } // Contain all arguments to perform a select option action. @@ -286,7 +321,7 @@ optional string prompt = 2; // Reference to an element in the form that should be filled. - required ElementReferenceProto form_field_element = 4; + optional ElementReferenceProto form_field_element = 4; // An optional list of fields that should be filled by this action. repeated RequiredField required_fields = 6; @@ -299,14 +334,14 @@ optional string prompt = 1; // A reference to the card number field in the form that should be filled. - required ElementReferenceProto form_field_element = 3; + optional ElementReferenceProto form_field_element = 3; } // Ask Chrome to wait for an element in the DOM. This can be used to only // proceed to the next action once the page is ready. message WaitForDomProto { // The element to wait. - required ElementReferenceProto element = 1; + optional ElementReferenceProto element = 1; // Fail after waiting this amount of time. optional int32 timeout_ms = 2;
diff --git a/components/autofill_assistant/browser/ui_controller.h b/components/autofill_assistant/browser/ui_controller.h index 340c7fe..58063f4 100644 --- a/components/autofill_assistant/browser/ui_controller.h +++ b/components/autofill_assistant/browser/ui_controller.h
@@ -51,5 +51,5 @@ protected: UiController() = default; }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_UI_CONTROLLER_H_
diff --git a/components/autofill_assistant/browser/ui_delegate.h b/components/autofill_assistant/browser/ui_delegate.h index c8889a9..d90f7a9 100644 --- a/components/autofill_assistant/browser/ui_delegate.h +++ b/components/autofill_assistant/browser/ui_delegate.h
@@ -26,5 +26,5 @@ protected: UiDelegate() = default; }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_UI_DELEGATE_H_
diff --git a/components/autofill_assistant/browser/web_controller.cc b/components/autofill_assistant/browser/web_controller.cc index 21c1cfa..d38b4185 100644 --- a/components/autofill_assistant/browser/web_controller.cc +++ b/components/autofill_assistant/browser/web_controller.cc
@@ -6,7 +6,6 @@ #include "base/callback.h" #include "base/logging.h" -#include "base/strings/string_util.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/common/form_data.h" @@ -30,16 +29,15 @@ node.scrollIntoViewIfNeeded();\ }"; -// Javascript where $1 will be replaced with the option value. Also fires a -// "change" event to trigger any listeners. Changing the index directly does not -// trigger this. +// Javascript to select a value from a select box. Also fires a "change" event +// to trigger any listeners. Changing the index directly does not trigger this. const char* const kSelectOptionScript = - R"(function() { - const value = '$1'.toUpperCase(); + R"(function(value) { + const uppercaseValue = value.toUpperCase(); var found = false; for (var i = 0; i < this.options.length; ++i) { const label = this.options[i].label.toUpperCase(); - if (label.length > 0 && label.startsWith(value)) { + if (label.length > 0 && label.startsWith(uppercaseValue)) { this.options.selectedIndex = i; found = true; break; @@ -58,8 +56,7 @@ const char* const kGetValueAttributeScript = "function () { return this.value; }"; -// Javascript code to set the 'value' attribute of a node, where $1 will be -// replaced with the value. +// Javascript code to set the 'value' attribute of a node. const char* const kSetValueAttributeScript = "function (value) { this.value = value; }"; @@ -548,18 +545,17 @@ return; } - std::string select_option_script = base::ReplaceStringPlaceholders( - kSelectOptionScript, {selected_option}, nullptr); - std::vector<std::unique_ptr<runtime::CallArgument>> argument; argument.emplace_back( - runtime::CallArgument::Builder().SetObjectId(object_id).Build()); + runtime::CallArgument::Builder() + .SetValue(base::Value::ToUniquePtrValue(base::Value(selected_option))) + .Build()); devtools_client_->GetRuntime()->Enable(); devtools_client_->GetRuntime()->CallFunctionOn( runtime::CallFunctionOnParams::Builder() .SetObjectId(object_id) .SetArguments(std::move(argument)) - .SetFunctionDeclaration(std::string(select_option_script)) + .SetFunctionDeclaration(std::string(kSelectOptionScript)) .SetReturnByValue(true) .Build(), base::BindOnce(&WebController::OnSelectOption, @@ -684,4 +680,4 @@ std::move(callback).Run(true); } -} // namespace autofill_assistant. +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/web_controller.h b/components/autofill_assistant/browser/web_controller.h index 8277558..9c3e155 100644 --- a/components/autofill_assistant/browser/web_controller.h +++ b/components/autofill_assistant/browser/web_controller.h
@@ -224,5 +224,5 @@ DISALLOW_COPY_AND_ASSIGN(WebController); }; -} // namespace autofill_assistant. +} // namespace autofill_assistant #endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_WEB_CONTROLLER_H_
diff --git a/components/browser_sync/sync_auth_manager.cc b/components/browser_sync/sync_auth_manager.cc index 5ff9038..1f98567 100644 --- a/components/browser_sync/sync_auth_manager.cc +++ b/components/browser_sync/sync_auth_manager.cc
@@ -160,11 +160,14 @@ // this point. DCHECK(access_token_.empty()); DCHECK(!request_access_token_retry_timer_.IsRunning()); + DCHECK(token_status_.next_token_request_time.is_null()); } else if (request_access_token_retry_timer_.IsRunning()) { // The timer to perform a request later is already running; nothing // further needs to be done at this point. DCHECK(access_token_.empty()); + DCHECK(!token_status_.next_token_request_time.is_null()); } else if (request_access_token_backoff_.failure_count() == 0) { + DCHECK(token_status_.next_token_request_time.is_null()); // First time request without delay. Currently invalid token is used // to initialize sync engine and we'll always end up here. We don't // want to delay initialization. @@ -179,13 +182,7 @@ credentials_changed_callback_.Run(); } request_access_token_backoff_.InformOfRequest(false); - base::TimeDelta delay = - request_access_token_backoff_.GetTimeUntilRelease(); - token_status_.next_token_request_time = base::Time::Now() + delay; - request_access_token_retry_timer_.Start( - FROM_HERE, delay, - base::BindRepeating(&SyncAuthManager::RequestAccessToken, - weak_ptr_factory_.GetWeakPtr())); + ScheduleAccessTokenRequest(); } break; case syncer::CONNECTION_OK: @@ -195,6 +192,7 @@ // thus hammers token server. To be safe, only reset backoff delay when // no scheduled request. if (!request_access_token_retry_timer_.IsRunning()) { + DCHECK(token_status_.next_token_request_time.is_null()); request_access_token_backoff_.Reset(); } last_auth_error_ = GoogleServiceAuthError::AuthErrorNone(); @@ -220,6 +218,20 @@ weak_ptr_factory_.InvalidateWeakPtrs(); } +void SyncAuthManager::ScheduleAccessTokenRequest() { + DCHECK(access_token_.empty()); + DCHECK(!ongoing_access_token_fetch_); + DCHECK(!request_access_token_retry_timer_.IsRunning()); + DCHECK(token_status_.next_token_request_time.is_null()); + + base::TimeDelta delay = request_access_token_backoff_.GetTimeUntilRelease(); + token_status_.next_token_request_time = base::Time::Now() + delay; + request_access_token_retry_timer_.Start( + FROM_HERE, delay, + base::BindRepeating(&SyncAuthManager::RequestAccessToken, + weak_ptr_factory_.GetWeakPtr())); +} + void SyncAuthManager::Clear() { // TODO(crbug.com/839834): Clearing the auth error here isn't quite right. // It makes sense to clear any auth error we got from the Sync server, but we @@ -389,6 +401,12 @@ } void SyncAuthManager::RequestAccessToken() { + // First reset the next request time: Either we were called back by the retry + // timer, in which case this is now obsolete, or we'll cancel the timer below. + // Note that if we were called back by the retry timer, then it's already + // considered not running, so we reset this time unconditionally. + token_status_.next_token_request_time = base::Time(); + // Only one active request at a time. if (ongoing_access_token_fetch_) { DCHECK(access_token_.empty()); @@ -401,10 +419,6 @@ if (request_access_token_retry_timer_.IsRunning()) { request_access_token_retry_timer_.Stop(); } - // Also reset the next request time. Note that if we were called back by the - // timer, then it's already considered not running, so we reset this time - // unconditionally. - token_status_.next_token_request_time = base::Time(); const OAuth2TokenService::ScopeSet kOAuth2ScopeSet{ GaiaConstants::kChromeSyncOAuth2Scope}; @@ -436,6 +450,7 @@ identity::AccessTokenInfo access_token_info) { DCHECK(ongoing_access_token_fetch_); ongoing_access_token_fetch_.reset(); + DCHECK(!request_access_token_retry_timer_.IsRunning()); access_token_ = access_token_info.token; token_status_.last_get_token_error = error; @@ -458,13 +473,7 @@ // persistent error. Should we use .IsTransientError() instead of manually // listing cases here? request_access_token_backoff_.InformOfRequest(false); - token_status_.next_token_request_time = - base::Time::Now() + - request_access_token_backoff_.GetTimeUntilRelease(); - request_access_token_retry_timer_.Start( - FROM_HERE, request_access_token_backoff_.GetTimeUntilRelease(), - base::BindRepeating(&SyncAuthManager::RequestAccessToken, - weak_ptr_factory_.GetWeakPtr())); + ScheduleAccessTokenRequest(); break; case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: sync_prefs_->SetSyncAuthError(true);
diff --git a/components/browser_sync/sync_auth_manager.h b/components/browser_sync/sync_auth_manager.h index f706a38..44f0578c 100644 --- a/components/browser_sync/sync_auth_manager.h +++ b/components/browser_sync/sync_auth_manager.h
@@ -120,8 +120,17 @@ // account to another is exposed to observers as a sign-out + sign-in. bool UpdateSyncAccountIfNecessary(); + // Clears any access token we have, and cancels any pending or scheduled + // request for one. void ClearAccessTokenAndRequest(); + // Schedules a request for an access token according to the current + // |request_access_token_backoff_|. Usually called after some transient error. + void ScheduleAccessTokenRequest(); + + // Immediately starts an access token request, unless one is already ongoing. + // If another request is scheduled for later, it is canceled. Any access token + // we currently have is dropped and removed from IdentityManager's cache. void RequestAccessToken(); void AccessTokenFetched(GoogleServiceAuthError error,
diff --git a/components/cdm/renderer/BUILD.gn b/components/cdm/renderer/BUILD.gn index cbf8471..c8e6160f 100644 --- a/components/cdm/renderer/BUILD.gn +++ b/components/cdm/renderer/BUILD.gn
@@ -3,13 +3,20 @@ # found in the LICENSE file. import("//build/config/jumbo.gni") +import("//third_party/widevine/cdm/widevine.gni") jumbo_static_library("renderer") { sources = [ "external_clear_key_key_system_properties.cc", "external_clear_key_key_system_properties.h", - "widevine_key_system_properties.cc", - "widevine_key_system_properties.h", + ] + deps = [ + "//base", + "//components/cdm/common", + "//content/public/renderer", + "//media", + "//media:media_buildflags", + "//third_party/widevine/cdm:buildflags", ] if (is_android) { @@ -19,12 +26,11 @@ ] } - deps = [ - "//base", - "//components/cdm/common", - "//content/public/renderer", - "//media", - "//media:media_buildflags", - "//third_party/widevine/cdm:headers", - ] + if (enable_widevine) { + sources += [ + "widevine_key_system_properties.cc", + "widevine_key_system_properties.h", + ] + deps += [ "//third_party/widevine/cdm:headers" ] + } }
diff --git a/components/cdm/renderer/DEPS b/components/cdm/renderer/DEPS index ac8ac8d9..65b9b373 100644 --- a/components/cdm/renderer/DEPS +++ b/components/cdm/renderer/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+content/public/renderer", + "+third_party/widevine/cdm/buildflags.h", "+third_party/widevine/cdm/widevine_cdm_common.h", ]
diff --git a/components/cdm/renderer/widevine_key_system_properties.cc b/components/cdm/renderer/widevine_key_system_properties.cc index 0f58b1f..89ea042 100644 --- a/components/cdm/renderer/widevine_key_system_properties.cc +++ b/components/cdm/renderer/widevine_key_system_properties.cc
@@ -4,11 +4,12 @@ #include "components/cdm/renderer/widevine_key_system_properties.h" +#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/widevine_cdm_common.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - -#if defined(WIDEVINE_CDM_AVAILABLE) +#if !BUILDFLAG(ENABLE_WIDEVINE) +#error This file should only be built when Widevine is enabled. +#endif using media::EmeConfigRule; using media::EmeFeatureSupport; @@ -185,5 +186,3 @@ } } // namespace cdm - -#endif // WIDEVINE_CDM_AVAILABLE
diff --git a/components/chrome_cleaner/public/interfaces/chrome_prompt.mojom b/components/chrome_cleaner/public/interfaces/chrome_prompt.mojom index 5677ea2..d0647e730 100644 --- a/components/chrome_cleaner/public/interfaces/chrome_prompt.mojom +++ b/components/chrome_cleaner/public/interfaces/chrome_prompt.mojom
@@ -58,4 +58,12 @@ [MinVersion=1] array<RegistryKey>? registry_keys, [MinVersion=2] array<ExtensionId>? extension_ids) => (PromptAcceptance prompt_acceptance); + + // Params: + // - extension_ids: list of IDs of extensions that will be removed from + // Chrome. If there are any invalid IDs, none are removed and false is + // returned. + // Returns: + // - success: indicates if the extension removal was successful. + DisableExtensions(array<ExtensionId> extension_ids) => (bool success); };
diff --git a/components/drive/service/fake_drive_service.cc b/components/drive/service/fake_drive_service.cc index 79f8719..378a5074 100644 --- a/components/drive/service/fake_drive_service.cc +++ b/components/drive/service/fake_drive_service.cc
@@ -1099,6 +1099,10 @@ "", // etag title); + if (title == "never-sync.txt") { + return CancelCallback(); + } + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(callback, HTTP_SUCCESS, session_url)); return CancelCallback();
diff --git a/components/offline_items_collection/core/launch_location.h b/components/offline_items_collection/core/launch_location.h index ec9d6b0..dcfca7f9 100644 --- a/components/offline_items_collection/core/launch_location.h +++ b/components/offline_items_collection/core/launch_location.h
@@ -23,8 +23,6 @@ SUGGESTION, // Due to clicking a suggestion on the net error page. NET_ERROR_SUGGESTION, - // From Download shelf. - DOWNLOAD_SHELF, }; } // namespace offline_items_collection
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index e2d3371..71101d0 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -223,6 +223,8 @@ sources += [ "hsts_query.cc", "hsts_query.h", + "http_credentials_cleaner.cc", + "http_credentials_cleaner.h", ] deps += [ "//components/safe_browsing/common:safe_browsing_prefs" ] } @@ -420,7 +422,10 @@ if (is_ios) { sources += [ "login_database_ios_unittest.cc" ] } else { - sources += [ "hsts_query_unittest.cc" ] + sources += [ + "hsts_query_unittest.cc", + "http_credentials_cleaner_unittest.cc", + ] } if (password_reuse_detection_support) { sources += [
diff --git a/components/password_manager/core/browser/DEPS b/components/password_manager/core/browser/DEPS index 9b3e0fd..11e54a3 100644 --- a/components/password_manager/core/browser/DEPS +++ b/components/password_manager/core/browser/DEPS
@@ -41,7 +41,7 @@ "password_manager_unittest\.cc": [ "+components/ukm", ], - "password_manager_util_unittest\.cc": [ + "http_credentials_cleaner_unittest\.cc": [ "+services/network", ], }
diff --git a/components/password_manager/core/browser/form_parsing/form_parser.cc b/components/password_manager/core/browser/form_parsing/form_parser.cc index 6533836e..9c7f868 100644 --- a/components/password_manager/core/browser/form_parsing/form_parser.cc +++ b/components/password_manager/core/browser/form_parsing/form_parser.cc
@@ -665,7 +665,7 @@ // Create the PasswordForm and set data not related to specific fields. auto result = std::make_unique<PasswordForm>(); result->origin = form_data.origin; - result->signon_realm = form_data.origin.GetOrigin().spec(); + result->signon_realm = GetSignonRealm(form_data.origin); result->action = form_data.action; result->form_data = form_data; result->all_possible_passwords = std::move(all_possible_passwords); @@ -769,4 +769,14 @@ std::move(all_possible_usernames), form_predictions); } +std::string GetSignonRealm(const GURL& url) { + GURL::Replacements rep; + rep.ClearUsername(); + rep.ClearPassword(); + rep.ClearQuery(); + rep.ClearRef(); + rep.SetPathStr(std::string()); + return url.ReplaceComponents(rep).spec(); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/form_parsing/form_parser.h b/components/password_manager/core/browser/form_parsing/form_parser.h index 7216f1b..39699b2d 100644 --- a/components/password_manager/core/browser/form_parsing/form_parser.h +++ b/components/password_manager/core/browser/form_parsing/form_parser.h
@@ -9,6 +9,7 @@ #include <vector> #include "components/password_manager/core/browser/form_parsing/password_field_prediction.h" +#include "url/gurl.h" namespace autofill { struct FormData; @@ -40,6 +41,10 @@ const FormPredictions* form_predictions, FormParsingMode mode); +// Returns the value of PasswordForm::signon_realm for an HTML form with the +// origin |url|. +std::string GetSignonRealm(const GURL& url); + } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FORM_PARSING_IOS_FORM_PARSER_H_
diff --git a/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc b/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc index 925f6d6..a1d251c 100644 --- a/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc +++ b/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc
@@ -1439,6 +1439,25 @@ } } +TEST(FormParserTest, GetSignonRealm) { + struct TestCase { + const char* input; + const char* expected_output; + } test_cases[]{ + {"http://example.com/", "http://example.com/"}, + {"http://example.com/signup", "http://example.com/"}, + {"https://google.com/auth?a=1#b", "https://google.com/"}, + }; + + for (const TestCase& test_case : test_cases) { + SCOPED_TRACE(testing::Message("Input: ") + << test_case.input << " " + << "Expected output: " << test_case.expected_output); + GURL input(test_case.input); + EXPECT_EQ(test_case.expected_output, GetSignonRealm(input)); + } +} + } // namespace } // namespace password_manager
diff --git a/components/password_manager/core/browser/http_credentials_cleaner.cc b/components/password_manager/core/browser/http_credentials_cleaner.cc new file mode 100644 index 0000000..c35e7ae --- /dev/null +++ b/components/password_manager/core/browser/http_credentials_cleaner.cc
@@ -0,0 +1,111 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/password_manager/core/browser/http_credentials_cleaner.h" + +#include "base/metrics/histogram_functions.h" +#include "base/strings/string_piece.h" +#include "components/password_manager/core/browser/password_manager_util.h" +#include "url/gurl.h" + +namespace password_manager { + +HttpCredentialCleaner::HttpCredentialCleaner( + scoped_refptr<PasswordStore> store, + base::RepeatingCallback<network::mojom::NetworkContext*()> + network_context_getter) + : store_(std::move(store)), + network_context_getter_(network_context_getter) { + store_->GetAutofillableLogins(this); +} + +HttpCredentialCleaner::~HttpCredentialCleaner() = default; + +void HttpCredentialCleaner::OnGetPasswordStoreResults( + std::vector<std::unique_ptr<autofill::PasswordForm>> results) { + // Non HTTP or HTTPS credentials are ignored. + base::EraseIf(results, [](const auto& form) { + return !form->origin.SchemeIsHTTPOrHTTPS(); + }); + + for (auto& form : results) { + // The next signon-realm has the protocol excluded. For example if original + // signon_realm is "https://google.com/". After excluding protocol it + // becomes "google.com/". + FormKey form_key({GURL(form->signon_realm).GetContent(), form->scheme, + form->username_value}); + if (form->origin.SchemeIs(url::kHttpScheme)) { + PostHSTSQueryForHostAndNetworkContext( + form->origin, network_context_getter_.Run(), + base::Bind(&HttpCredentialCleaner::OnHSTSQueryResult, + base::Unretained(this), form_key, form->password_value)); + ++total_http_credentials_; + } else { // HTTPS + https_credentials_map_[form_key].insert(form->password_value); + } + } + + // This is needed in case of empty |results|. + ReportMetrics(); +} + +// |key| and |password_value| was created from the same form. +void HttpCredentialCleaner::OnHSTSQueryResult( + FormKey key, + base::string16 password_value, + password_manager::HSTSResult hsts_result) { + ++processed_results_; + base::ScopedClosureRunner report(base::BindOnce( + &HttpCredentialCleaner::ReportMetrics, base::Unretained(this))); + + if (hsts_result == HSTSResult::kError) + return; + + bool is_hsts = (hsts_result == HSTSResult::kYes); + + auto user_it = https_credentials_map_.find(key); + if (user_it == https_credentials_map_.end()) { + // Credentials are not migrated yet. + ++https_credential_not_found_[is_hsts]; + return; + } + + if (base::ContainsKey(user_it->second, password_value)) { + // The password store contains the same credentials (signon_realm, scheme, + // username and password) on HTTP version of the form. + ++same_password_[is_hsts]; + } else { + ++different_password_[is_hsts]; + } +} + +void HttpCredentialCleaner::ReportMetrics() { + // The metrics have to be recorded after all requests are done. + if (processed_results_ != total_http_credentials_) + return; + + for (bool is_hsts_enabled : {false, true}) { + std::string suffix = (is_hsts_enabled ? std::string("WithHSTSEnabled") + : std::string("HSTSNotEnabled")); + + base::UmaHistogramCounts1000( + "PasswordManager.HttpCredentialsWithEquivalentHttpsCredential." + + suffix, + same_password_[is_hsts_enabled]); + + base::UmaHistogramCounts1000( + "PasswordManager.HttpCredentialsWithConflictingHttpsCredential." + + suffix, + different_password_[is_hsts_enabled]); + + base::UmaHistogramCounts1000( + "PasswordManager.HttpCredentialsWithoutMatchingHttpsCredential." + + suffix, + https_credential_not_found_[is_hsts_enabled]); + } + + delete this; +} + +} // namespace password_manager \ No newline at end of file
diff --git a/components/password_manager/core/browser/http_credentials_cleaner.h b/components/password_manager/core/browser/http_credentials_cleaner.h new file mode 100644 index 0000000..42a0767 --- /dev/null +++ b/components/password_manager/core/browser/http_credentials_cleaner.h
@@ -0,0 +1,102 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_HTTP_CREDENTIALS_CLEANER_H_ +#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_HTTP_CREDENTIALS_CLEANER_H_ + +#include <map> +#include <memory> +#include <string> +#include <tuple> +#include <utility> +#include <vector> + +#include "base/containers/flat_set.h" +#include "base/memory/ref_counted.h" +#include "components/autofill/core/common/password_form.h" +#include "components/password_manager/core/browser/hsts_query.h" +#include "components/password_manager/core/browser/password_store_consumer.h" + +namespace network { +namespace mojom { +class NetworkContext; +} // namespace mojom +} // namespace network + +namespace password_manager { + +class PasswordStore; + +// This class is responsible for reporting metrics about HTTP to HTTPS +// migration. Important note: The object will delete itself once metrics are +// reported. Having a private destructor enforces this. +class HttpCredentialCleaner : public PasswordStoreConsumer { + public: + HttpCredentialCleaner( + scoped_refptr<PasswordStore> store, + base::RepeatingCallback<network::mojom::NetworkContext*()> + network_context_getter); + + private: + // This type define a subset of PasswordForm where first argument is the + // signon-realm excluding the protocol, the second argument is + // the PasswordForm::scheme (i.e. HTML, BASIC, etc.) and the third argument is + // the username of the form. + using FormKey = + std::tuple<std::string, autofill::PasswordForm::Scheme, base::string16>; + + ~HttpCredentialCleaner() override; + + // PasswordStoreConsumer: + void OnGetPasswordStoreResults( + std::vector<std::unique_ptr<autofill::PasswordForm>> results) override; + + void OnHSTSQueryResult(FormKey key, + base::string16 password_value, + HSTSResult hsts_result); + + void ReportMetrics(); + + scoped_refptr<PasswordStore> store_; + + // Needed to create HSTS request. + base::RepeatingCallback<network::mojom::NetworkContext*()> + network_context_getter_; + + // Map from (signon-realm excluding the protocol, Password::Scheme, username) + // tuples of HTTPS forms to a list of passwords for that pair. + std::map<FormKey, base::flat_set<base::string16>> https_credentials_map_; + + // The number of HTTP credentials processed after HSTS query results are + // received. + size_t processed_results_ = 0; + + // The next three counters are in pairs where [0] component means that HSTS is + // not enabled and [1] component means that HSTS is enabled for that HTTP type + // of credentials. + + // Number of HTTP credentials for which no HTTPS credential for the same + // signon_realm excluding protocol, PasswordForm::scheme and username exists. + size_t https_credential_not_found_[2] = {0, 0}; + + // Number of HTTP credentials for which an equivalent (i.e. same signon_realm + // excluding protocol, PasswordForm::scheme (i.e. HTML, BASIC, etc.), username + // and password) HTTPS credential exists. + size_t same_password_[2] = {0, 0}; + + // Number of HTTP credentials for which a conflicting (i.e. same signon-realm + // excluding the protocol, PasswordForm::Scheme and username but different + // password) HTTPS credential exists. + size_t different_password_[2] = {0, 0}; + + // Number of HTTP credentials from the password store. Used to know when all + // credentials were processed. + size_t total_http_credentials_ = 0; + + DISALLOW_COPY_AND_ASSIGN(HttpCredentialCleaner); +}; + +} // namespace password_manager + +#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_HTTP_CREDENTIALS_CLEANER_H_ \ No newline at end of file
diff --git a/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc new file mode 100644 index 0000000..f4b678df --- /dev/null +++ b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc
@@ -0,0 +1,192 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/macros.h" +#include "base/stl_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/bind_test_util.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_task_environment.h" +#include "components/password_manager/core/browser/password_manager_util.h" +#include "components/password_manager/core/browser/test_password_store.h" +#include "net/url_request/url_request_test_util.h" +#include "services/network/network_context.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace password_manager { + +TEST(HttpCredentialCleaner, ReportHttpMigrationMetrics) { + enum class HttpCredentialType { kNoMatching, kEquivalent, kConflicting }; + + struct TestCase { + bool is_hsts_enabled; + autofill::PasswordForm::Scheme http_form_scheme; + bool same_signon_realm; + bool same_scheme; + bool same_username; + bool same_password; + HttpCredentialType expected; + }; + + struct Histogram { + bool test_hsts_enabled; + HttpCredentialType test_type; + std::string histogram_name; + }; + + constexpr static TestCase cases[] = { + + {true, autofill::PasswordForm::Scheme::SCHEME_HTML, false, true, true, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, false, true, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, false, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, + false, HttpCredentialType::kConflicting}, + {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, + true, HttpCredentialType::kEquivalent}, + + {false, autofill::PasswordForm::Scheme::SCHEME_HTML, false, true, true, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, false, true, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, false, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, + false, HttpCredentialType::kConflicting}, + {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, + true, HttpCredentialType::kEquivalent}, + + {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, false, true, true, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, false, true, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, false, + true, HttpCredentialType::kNoMatching}, + {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, + false, HttpCredentialType::kConflicting}, + {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, + true, HttpCredentialType::kEquivalent}, + + {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, false, true, true, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, false, true, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, false, + true, HttpCredentialType::kNoMatching}, + {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, + false, HttpCredentialType::kConflicting}, + {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, + true, HttpCredentialType::kEquivalent} + + }; + + const base::string16 username[2] = {base::ASCIIToUTF16("user0"), + base::ASCIIToUTF16("user1")}; + const base::string16 password[2] = {base::ASCIIToUTF16("pass0"), + base::ASCIIToUTF16("pass1")}; + + std::vector<Histogram> histograms_to_test; + for (bool test_hsts_enabled : {true, false}) { + std::string suffix = + (test_hsts_enabled ? "WithHSTSEnabled" : "HSTSNotEnabled"); + histograms_to_test.push_back( + {test_hsts_enabled, HttpCredentialType::kNoMatching, + "PasswordManager.HttpCredentialsWithoutMatchingHttpsCredential." + + suffix}); + histograms_to_test.push_back( + {test_hsts_enabled, HttpCredentialType::kEquivalent, + "PasswordManager.HttpCredentialsWithEquivalentHttpsCredential." + + suffix}); + histograms_to_test.push_back( + {test_hsts_enabled, HttpCredentialType::kConflicting, + "PasswordManager.HttpCredentialsWithConflictingHttpsCredential." + + suffix}); + } + for (const auto& test : cases) { + SCOPED_TRACE(testing::Message() + << "is_hsts_enabled=" << test.is_hsts_enabled + << ", http_form_scheme=" + << static_cast<int>(test.http_form_scheme) + << ", same_signon_realm=" << test.same_signon_realm + << ", same_scheme=" << test.same_scheme + << ", same_username=" << test.same_username + << ", same_password=" << test.same_password); + + base::test::ScopedTaskEnvironment scoped_task_environment; + auto request_context = + base::MakeRefCounted<net::TestURLRequestContextGetter>( + base::ThreadTaskRunnerHandle::Get()); + network::mojom::NetworkContextPtr network_context_pipe; + auto network_context = std::make_unique<network::NetworkContext>( + nullptr, mojo::MakeRequest(&network_context_pipe), + request_context->GetURLRequestContext()); + + auto password_store = + base::MakeRefCounted<password_manager::TestPasswordStore>(); + ASSERT_TRUE(password_store->Init(syncer::SyncableService::StartSyncFlare(), + nullptr)); + + autofill::PasswordForm http_form; + http_form.origin = GURL("http://example.org/"); + http_form.signon_realm = http_form.origin.GetOrigin().spec(); + http_form.scheme = test.http_form_scheme; + http_form.username_value = username[1]; + http_form.password_value = password[1]; + password_store->AddLogin(http_form); + + autofill::PasswordForm https_form; + https_form.origin = GURL("https://example.org/"); + https_form.scheme = test.http_form_scheme; + if (!test.same_scheme) { + if (https_form.scheme == autofill::PasswordForm::Scheme::SCHEME_BASIC) + https_form.scheme = autofill::PasswordForm::Scheme::SCHEME_HTML; + else + https_form.scheme = autofill::PasswordForm::Scheme::SCHEME_BASIC; + } + + https_form.signon_realm = https_form.origin.GetOrigin().spec(); + if (!test.same_signon_realm) + https_form.signon_realm += "different/"; + + https_form.username_value = username[test.same_username]; + https_form.password_value = password[test.same_password]; + password_store->AddLogin(https_form); + + if (test.is_hsts_enabled) { + network_context->AddHSTSForTesting( + http_form.origin.host(), base::Time::Max(), + false /*include_subdomains*/, base::DoNothing()); + } + scoped_task_environment.RunUntilIdle(); + + base::HistogramTester histogram_tester; + password_manager_util::ReportHttpMigrationMetrics( + password_store, + base::BindLambdaForTesting([&]() -> network::mojom::NetworkContext* { + // This needs to be network_context_pipe.get() and + // not network_context.get() to make HSTS queries asynchronous, which + // is what the progress tracking logic in HttpMetricsMigrationReporter + // assumes. This also matches reality, since + // StoragePartition::GetNetworkContext will return a mojo pipe + // even in the in-process case. + return network_context_pipe.get(); + })); + scoped_task_environment.RunUntilIdle(); + + for (const auto& histogram : histograms_to_test) { + int sample = + static_cast<int>(histogram.test_type == test.expected && + histogram.test_hsts_enabled == test.is_hsts_enabled); + histogram_tester.ExpectUniqueSample(histogram.histogram_name, sample, 1); + } + + password_store->ShutdownOnUIThread(); + scoped_task_environment.RunUntilIdle(); + } +} + +} // namespace password_manager \ No newline at end of file
diff --git a/components/password_manager/core/browser/new_password_form_manager.cc b/components/password_manager/core/browser/new_password_form_manager.cc index f65294a..a1db4f6 100644 --- a/components/password_manager/core/browser/new_password_form_manager.cc +++ b/components/password_manager/core/browser/new_password_form_manager.cc
@@ -160,6 +160,7 @@ const PasswordManagerDriver* driver) const { if (driver != driver_.get()) return false; + if (observed_form_.is_form_tag != form.is_form_tag) return false; // All unowned input elements are considered as one synthetic form. @@ -305,8 +306,7 @@ if (!new_blacklisted_) { new_blacklisted_ = std::make_unique<PasswordForm>(); new_blacklisted_->origin = observed_form_.origin; - // The following method of finding |signon_realm| is correct for HTML forms. - new_blacklisted_->signon_realm = observed_form_.origin.GetOrigin().spec(); + new_blacklisted_->signon_realm = GetSignonRealm(observed_form_.origin); blacklisted_matches_.push_back(new_blacklisted_.get()); } form_saver_->PermanentlyBlacklist(new_blacklisted_.get()); @@ -342,6 +342,40 @@ return {driver_}; } +std::unique_ptr<NewPasswordFormManager> NewPasswordFormManager::Clone() { + // Fetcher is cloned to avoid re-fetching data from PasswordStore. + std::unique_ptr<FormFetcher> fetcher = form_fetcher_->Clone(); + + // Some data is filled through the constructor. No PasswordManagerDriver is + // needed, because the UI does not need any functionality related to the + // renderer process, to which the driver serves as an interface. The full + // |observed_form_| needs to be copied, because it is used to create the + // blacklisting entry if needed. + auto result = std::make_unique<NewPasswordFormManager>( + client_, base::WeakPtr<PasswordManagerDriver>(), observed_form_, + fetcher.get(), form_saver_->Clone()); + + result->metrics_recorder_ = metrics_recorder_; + + // The constructor only can take a weak pointer to the fetcher, so moving the + // owning one needs to happen explicitly. + result->owned_form_fetcher_ = std::move(fetcher); + + // These data members all satisfy: + // (1) They could have been changed by |*this| between its construction and + // calling Clone(). + // (2) They are potentially used in the clone as the clone is used in the UI + // code. + // (3) They are not changed during ProcessMatches, triggered at some point + // by the cloned FormFetcher. + result->has_generated_password_ = has_generated_password_; + result->user_action_ = user_action_; + result->votes_uploader_ = votes_uploader_; + result->predictions_ = predictions_; + + return result; +} + void NewPasswordFormManager::ProcessMatches( const std::vector<const PasswordForm*>& non_federated, size_t filtered_count) {
diff --git a/components/password_manager/core/browser/new_password_form_manager.h b/components/password_manager/core/browser/new_password_form_manager.h index 436bbb6..8165f140 100644 --- a/components/password_manager/core/browser/new_password_form_manager.h +++ b/components/password_manager/core/browser/new_password_form_manager.h
@@ -122,13 +122,19 @@ bool RetryPasswordFormPasswordUpdate() const override; std::vector<base::WeakPtr<PasswordManagerDriver>> GetDrivers() const override; + // Create a copy of |*this| which can be passed to the code handling + // save-password related UI. This omits some parts of the internal data, so + // the result is not identical to the original. + // TODO(crbug.com/739366): Replace with translating one appropriate class into + // another one. + std::unique_ptr<NewPasswordFormManager> Clone(); + #if defined(UNIT_TEST) static void set_wait_for_server_predictions_for_filling(bool value) { wait_for_server_predictions_for_filling_ = value; } FormSaver* form_saver() { return form_saver_.get(); } - #endif // TODO(https://crbug.com/831123): Remove it when the old form parsing is
diff --git a/components/password_manager/core/browser/new_password_form_manager_unittest.cc b/components/password_manager/core/browser/new_password_form_manager_unittest.cc index ba36475..27669e1 100644 --- a/components/password_manager/core/browser/new_password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/new_password_form_manager_unittest.cc
@@ -828,4 +828,20 @@ new_blacklisted_form->signon_realm); } +TEST_F(NewPasswordFormManagerTest, Clone) { + TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner_.get()); + fetcher_->SetNonFederated({}, 0u); + + std::unique_ptr<NewPasswordFormManager> cloned_manager = + form_manager_->Clone(); + + EXPECT_TRUE(cloned_manager->DoesManage(observed_form_, nullptr)); + EXPECT_TRUE(cloned_manager->GetFormFetcher()); + // Check that |form_fetcher| was cloned. + EXPECT_NE(form_manager_->GetFormFetcher(), cloned_manager->GetFormFetcher()); + + EXPECT_EQ(form_manager_->metrics_recorder(), + cloned_manager->metrics_recorder()); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 6bf7ba45..9e9534ae 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -3465,31 +3465,21 @@ } TEST_F(PasswordFormManagerTest, UploadUsernameCorrectionVote) { - // TODO(rogerm,kolos): Fix this test so that it works correctly when the - // enforcement of the minimum number of required for fields is upload is - // relaxed. base::test::ScopedFeatureList features; features.InitAndEnableFeature(kAutofillEnforceMinRequiredFieldsForUpload); for (bool is_pending_credential_psl_match : {false, true}) { - for (bool is_form_with_2_fields : {false, true}) { - SCOPED_TRACE(testing::Message() - << "is_form_with_2_fields=" << is_form_with_2_fields); // Observed and saved forms have the same password, but different // usernames. PasswordForm new_login(*observed_form()); autofill::FormFieldData field; - if (!is_form_with_2_fields) { - field.label = ASCIIToUTF16("Full name"); - field.name = ASCIIToUTF16("full_name"); - field.form_control_type = "text"; - new_login.form_data.fields.push_back(field); - } - field.label = ASCIIToUTF16("Email"); + field.name = ASCIIToUTF16("full_name"); + field.form_control_type = "text"; + new_login.form_data.fields.push_back(field); + field.name = ASCIIToUTF16("observed-username-field"); field.form_control_type = "text"; new_login.form_data.fields.push_back(field); - field.label = ASCIIToUTF16("Password"); field.name = ASCIIToUTF16("Passwd"); field.form_control_type = "password"; new_login.form_data.fields.push_back(field); @@ -3542,17 +3532,6 @@ autofill::AutofillUploadContents::Field::USERNAME_OVERWRITTEN}}; InSequence s; - std::unique_ptr<FormStructure> signin_vote_form_structure; - if (is_form_with_2_fields) { - // Make signin vote upload synchronous and free |FormStructure| passed - // for upload. - auto* mock_autofill_manager = - client()->mock_driver()->mock_autofill_manager(); - EXPECT_CALL(*mock_autofill_manager, - MaybeStartVoteUploadProcessPtr(_, _, true)) - .WillOnce(WithArg<0>(SaveToUniquePtr(&signin_vote_form_structure))); - } - autofill::ServerFieldTypeSet field_types; field_types.insert(autofill::PASSWORD); EXPECT_CALL( @@ -3568,7 +3547,6 @@ false, expected_available_field_types, expected_login_signature, true)); form_manager.Save(); - } } } @@ -3776,76 +3754,6 @@ form_manager.GrabFetcher(std::move(new_fetcher)); } -TEST_F(PasswordFormManagerTest, UploadSignInForm_WithAutofillTypes) { - // For newly saved passwords on a sign-in form, upload an autofill vote for a - // username field and a autofill::PASSWORD vote for a password field. - autofill::FormFieldData field; - field.name = ASCIIToUTF16("Email"); - field.form_control_type = "text"; - observed_form()->form_data.fields.push_back(field); - - field.name = ASCIIToUTF16("Passwd"); - field.form_control_type = "password"; - observed_form()->form_data.fields.push_back(field); - - FakeFormFetcher fetcher; - fetcher.Fetch(); - PasswordFormManager form_manager( - password_manager(), client(), client()->driver(), *observed_form(), - std::make_unique<NiceMock<MockFormSaver>>(), &fetcher); - form_manager.Init(nullptr); - fetcher.SetNonFederated(std::vector<const PasswordForm*>(), 0u); - - PasswordForm form_to_save(*observed_form()); - form_to_save.preferred = true; - form_to_save.username_value = ASCIIToUTF16("test@gmail.com"); - form_to_save.password_value = ASCIIToUTF16("password"); - - std::unique_ptr<FormStructure> uploaded_form_structure; - auto* mock_autofill_manager = - client()->mock_driver()->mock_autofill_manager(); - EXPECT_CALL(*mock_autofill_manager, - MaybeStartVoteUploadProcessPtr(_, _, true)) - .WillOnce(WithArg<0>(SaveToUniquePtr(&uploaded_form_structure))); - form_manager.ProvisionallySave(form_to_save); - form_manager.Save(); - - ASSERT_EQ(2u, uploaded_form_structure->field_count()); - autofill::ServerFieldTypeSet expected_types = {autofill::PASSWORD}; - EXPECT_EQ(form_to_save.username_value, - uploaded_form_structure->field(0)->value); - EXPECT_EQ(expected_types, - uploaded_form_structure->field(1)->possible_types()); -} - -// Checks that there is no upload on saving a password on a password form only -// with 1 field. -TEST_F(PasswordFormManagerTest, NoUploadsForSubmittedFormWithOnlyOneField) { - autofill::FormFieldData field; - field.name = ASCIIToUTF16("Passwd"); - field.form_control_type = "password"; - observed_form()->form_data.fields.push_back(field); - - FakeFormFetcher fetcher; - fetcher.Fetch(); - PasswordFormManager form_manager( - password_manager(), client(), client()->driver(), *observed_form(), - std::make_unique<NiceMock<MockFormSaver>>(), &fetcher); - form_manager.Init(nullptr); - fetcher.SetNonFederated(std::vector<const PasswordForm*>(), 0u); - - PasswordForm form_to_save(*observed_form()); - form_to_save.preferred = true; - form_to_save.password_value = ASCIIToUTF16("password"); - - auto* mock_autofill_manager = - client()->mock_driver()->mock_autofill_manager(); - EXPECT_CALL(*mock_autofill_manager, MaybeStartVoteUploadProcessPtr(_, _, _)) - .Times(0); - form_manager.ProvisionallySave(form_to_save); - form_manager.Save(); -} - TEST_F(PasswordFormManagerTest, SuppressedHTTPSFormsHistogram_NotRecordedIfStoreWasTooSlow) { base::HistogramTester histogram_tester;
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index 89575227..5f9cdd29 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc
@@ -228,6 +228,29 @@ : matched_manager_it->get(); } +std::unique_ptr<PasswordFormManager> FindAndCloneMatchedPasswordFormManager( + const PasswordForm& password_form, + const std::vector<std::unique_ptr<PasswordFormManager>>& + pending_login_managers, + const password_manager::PasswordManagerDriver* driver) { + PasswordFormManager* matched_manager = FindMatchedManager( + password_form, pending_login_managers, driver, nullptr); + if (!matched_manager) + return nullptr; + // TODO(crbug.com/741537): Process manual saving request even if there is + // still no response from the store. + if (matched_manager->GetFormFetcher()->GetState() == + FormFetcher::State::WAITING) { + return nullptr; + } + + std::unique_ptr<PasswordFormManager> manager = matched_manager->Clone(); + PasswordForm form(password_form); + form.preferred = true; + manager->ProvisionallySave(form); + return manager; +} + // Returns true if the user needs to be prompted before a password can be // saved (instead of automatically saving the password), based on inspecting // the state of |manager|. @@ -260,6 +283,47 @@ return false; } +// Finds the matched form manager for |form| in |form_managers|. +NewPasswordFormManager* FindMatchedManager( + const FormData& form, + const std::vector<std::unique_ptr<NewPasswordFormManager>>& form_managers, + const PasswordManagerDriver* driver) { + for (const auto& form_manager : form_managers) { + if (form_manager->DoesManage(form, driver)) + return form_manager.get(); + } + return nullptr; +} + +// Returns a form manager that is ready to save/update credentials, provided +// that |form| is submitted form. Namely 1. Finds form manager from +// |form_managers| that manages |form| 2. Clones it. 3. Passes |form| as +// submitted form to the cloned form manager. +std::unique_ptr<NewPasswordFormManager> +FindAndCloneMatchedNewPasswordFormManager( + const FormData& form, + const std::vector<std::unique_ptr<NewPasswordFormManager>>& form_managers, + const PasswordManagerDriver* driver) { + NewPasswordFormManager* matched_manager = + FindMatchedManager(form, form_managers, driver); + if (!matched_manager) + return nullptr; + // TODO(crbug.com/741537): Process manual saving request even if there is + // still no response from the store. + if (matched_manager->GetFormFetcher()->GetState() == + FormFetcher::State::WAITING) { + return nullptr; + } + + std::unique_ptr<NewPasswordFormManager> manager = matched_manager->Clone(); + // Cloned NewPasswordFormManager doesn't have |driver|, so nullptr must be + // passed to ensure that the |form| is managed. + if (manager->SetSubmittedFormIfIsManaged(form, nullptr)) + return manager; + + return nullptr; +} + } // namespace // static @@ -308,7 +372,7 @@ PasswordManager::PasswordManager(PasswordManagerClient* client) : client_(client), is_new_form_parsing_for_saving_enabled_(base::FeatureList::IsEnabled( - password_manager::features::kNewPasswordFormParsingForSaving)) { + features::kNewPasswordFormParsingForSaving)) { DCHECK(client_); } @@ -462,8 +526,7 @@ void PasswordManager::UpdateFormManagers() { std::vector<PasswordFormManagerInterface*> form_managers; - if (base::FeatureList::IsEnabled( - password_manager::features::kNewPasswordFormParsing)) { + if (base::FeatureList::IsEnabled(features::kNewPasswordFormParsing)) { for (const auto& form_manager : form_managers_) form_managers.push_back(form_manager.get()); } else { @@ -586,30 +649,25 @@ !client_->GetStoreResultFilter()->ShouldSave(password_form)) return; - PasswordFormManager* matched_manager = FindMatchedManager( - password_form, pending_login_managers_, driver, nullptr); - if (!matched_manager) - return; - // TODO(crbug.com/741537): Process manual saving request even if there is - // still no response from the store. - if (matched_manager->GetFormFetcher()->GetState() == - FormFetcher::State::WAITING) { - return; + std::unique_ptr<PasswordFormManagerInterface> manager = nullptr; + if (is_new_form_parsing_for_saving_enabled_) { + manager = FindAndCloneMatchedNewPasswordFormManager(password_form.form_data, + form_managers_, driver); + } else { + manager = FindAndCloneMatchedPasswordFormManager( + password_form, pending_login_managers_, driver); } - - std::unique_ptr<PasswordFormManager> manager = matched_manager->Clone(); - PasswordForm form(password_form); - form.preferred = true; - manager->ProvisionallySave(form); + if (!manager) + return; // Show the fallback if a prompt or a confirmation bubble should be available. bool has_generated_password = manager->HasGeneratedPassword(); if (ShouldPromptUserToSavePassword(*manager) || has_generated_password) { bool is_update = IsPasswordUpdate(*manager); + manager->GetMetricsRecorder()->RecordShowManualFallbackForSaving( + has_generated_password, is_update); client_->ShowManualFallbackForSaving(std::move(manager), has_generated_password, is_update); - matched_manager->GetMetricsRecorder()->RecordShowManualFallbackForSaving( - has_generated_password, is_update); } else { HideManualFallbackForSaving(); } @@ -642,8 +700,7 @@ logger->LogMessage(Logger::STRING_CREATE_LOGIN_MANAGERS_METHOD); } - if (base::FeatureList::IsEnabled( - password_manager::features::kNewPasswordFormParsing)) { + if (base::FeatureList::IsEnabled(features::kNewPasswordFormParsing)) { CreateFormManagers(driver, forms); } @@ -758,20 +815,18 @@ // NewPasswordFormManger instance. if (form.is_gaia_with_skip_save_password_form) continue; - auto form_it = - std::find_if(form_managers_.begin(), form_managers_.end(), - [&form, driver](const auto& form_manager) { - return form_manager->DoesManage(form.form_data, driver); - }); - if (form_it == form_managers_.end()) { - new_forms.push_back(&form); - } else { + NewPasswordFormManager* manager = + FindMatchedManager(form.form_data, form_managers_, driver); + + if (manager) { // This extra filling is just duplicating redundancy that was in // PasswordFormManager, that helps to fix cases when the site overrides // filled values. // TODO(https://crbug.com/831123): Implement more robust filling and // remove the next line. - (*form_it)->Fill(); + manager->Fill(); + } else { + new_forms.push_back(&form); } }
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index d4902b2..698592a 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -198,7 +198,7 @@ form.username_value = ASCIIToUTF16("googleuser"); form.password_value = ASCIIToUTF16("p4ssword"); form.submit_element = ASCIIToUTF16("signIn"); - form.signon_realm = "http://www.google.com"; + form.signon_realm = "http://www.google.com/"; // Fill |form.form_data|. form.form_data.origin = form.origin; @@ -209,12 +209,14 @@ autofill::FormFieldData field; field.name = ASCIIToUTF16("Email"); field.id = field.name; + field.value = ASCIIToUTF16("googleuser"); field.form_control_type = "text"; field.unique_renderer_id = 2; form.form_data.fields.push_back(field); field.name = ASCIIToUTF16("Passwd"); field.id = field.name; + field.value = ASCIIToUTF16("p4ssword"); field.form_control_type = "password"; field.unique_renderer_id = 3; form.form_data.fields.push_back(field); @@ -271,7 +273,7 @@ form.username_value = ASCIIToUTF16("twitter"); form.password_value = ASCIIToUTF16("password"); form.submit_element = ASCIIToUTF16("signIn"); - form.signon_realm = "https://twitter.com"; + form.signon_realm = "https://twitter.com/"; return form; } @@ -285,7 +287,7 @@ form.username_value = ASCIIToUTF16("twitter"); form.password_value = ASCIIToUTF16("password"); form.submit_element = ASCIIToUTF16("signIn"); - form.signon_realm = "https://twitter.com"; + form.signon_realm = "https://twitter.com/"; return form; } @@ -328,8 +330,7 @@ form.username_value == arg.username_value && form.password_element == arg.password_element && form.password_value == arg.password_value && - form.new_password_element == arg.new_password_element && - form.submit_element == arg.submit_element; + form.new_password_element == arg.new_password_element; } TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { @@ -2713,4 +2714,47 @@ } } +TEST_F(PasswordManagerTest, ManualFallbackForSavingNewParser) { + base::test::ScopedFeatureList scoped_feature_list; + TurnOnNewParsingForSaving(&scoped_feature_list); + NewPasswordFormManager::set_wait_for_server_predictions_for_filling(false); + + EXPECT_CALL(client_, IsSavingAndFillingEnabledForCurrentPage()) + .WillRepeatedly(Return(true)); + + std::vector<PasswordForm> observed; + PasswordForm form(MakeSimpleForm()); + observed.push_back(form); + PasswordForm stored_form = form; + stored_form.password_value = ASCIIToUTF16("old_password"); + EXPECT_CALL(*store_, GetLogins(_, _)) + .WillRepeatedly(WithArg<1>(InvokeConsumer(stored_form))); + EXPECT_CALL(driver_, FillPasswordForm(_)).Times(2); + manager()->OnPasswordFormsParsed(&driver_, observed); + manager()->OnPasswordFormsRendered(&driver_, observed, true); + + // The username of the stored form is the same, there should be update bubble. + std::unique_ptr<PasswordFormManagerForUI> form_manager_to_save; + EXPECT_CALL(client_, ShowManualFallbackForSavingPtr(_, false, true)) + .WillOnce(WithArg<0>(SaveToScopedPtr(&form_manager_to_save))); + manager()->ShowManualFallbackForSaving(&driver_, form); + ASSERT_TRUE(form_manager_to_save); + EXPECT_THAT(form_manager_to_save->GetPendingCredentials(), FormMatches(form)); + + // The username of the stored form is different, there should be save bubble. + PasswordForm new_form = form; + new_form.username_value = ASCIIToUTF16("another_username"); + new_form.form_data.fields[0].value = new_form.username_value; + EXPECT_CALL(client_, ShowManualFallbackForSavingPtr(_, false, false)) + .WillOnce(WithArg<0>(SaveToScopedPtr(&form_manager_to_save))); + manager()->ShowManualFallbackForSaving(&driver_, new_form); + ASSERT_TRUE(form_manager_to_save); + EXPECT_THAT(form_manager_to_save->GetPendingCredentials(), + FormMatches(new_form)); + + // Hide the manual fallback. + EXPECT_CALL(client_, HideManualFallbackForSaving()); + manager()->HideManualFallbackForSaving(); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_manager_util.cc b/components/password_manager/core/browser/password_manager_util.cc index 639fc0f..f8b6087 100644 --- a/components/password_manager/core/browser/password_manager_util.cc +++ b/components/password_manager/core/browser/password_manager_util.cc
@@ -8,7 +8,6 @@ #include <string> #include <utility> -#include "base/containers/flat_set.h" #include "base/metrics/histogram_functions.h" #include "base/stl_util.h" #include "build/build_config.h" @@ -19,7 +18,7 @@ #include "components/password_manager/core/browser/blacklisted_duplicates_cleaner.h" #include "components/password_manager/core/browser/credentials_cleaner.h" #include "components/password_manager/core/browser/credentials_cleaner_runner.h" -#include "components/password_manager/core/browser/hsts_query.h" +#include "components/password_manager/core/browser/http_credentials_cleaner.h" #include "components/password_manager/core/browser/invalid_realm_credential_cleaner.h" #include "components/password_manager/core/browser/log_manager.h" #include "components/password_manager/core/browser/password_generation_manager.h" @@ -32,7 +31,6 @@ #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_service.h" #include "components/sync/driver/sync_service.h" -#include "url/gurl.h" using autofill::PasswordForm; @@ -48,146 +46,6 @@ std::make_pair(!rhs->is_public_suffix_match, rhs->preferred); } -// This class is responsible for reporting metrics about HTTP to HTTPS -// migration. -class HttpMetricsMigrationReporter - : public password_manager::PasswordStoreConsumer { - public: - HttpMetricsMigrationReporter( - password_manager::PasswordStore* store, - base::RepeatingCallback<network::mojom::NetworkContext*()> - network_context_getter) - : network_context_getter_(network_context_getter) { - store->GetAutofillableLogins(this); - } - - private: - // This type define a subset of PasswordForm where first argument is the - // signon-realm excluding the protocol, the second argument is - // PasswordForm::scheme (i.e. HTML, BASIC, etc.) and the third argument is the - // username of the form. - using FormKey = std::tuple<std::string, PasswordForm::Scheme, base::string16>; - - // This overrides the PasswordStoreConsumer method. - void OnGetPasswordStoreResults( - std::vector<std::unique_ptr<autofill::PasswordForm>> results) override; - - void OnHSTSQueryResult(FormKey key, - base::string16 password_value, - password_manager::HSTSResult is_hsts); - - void ReportMetrics(); - - base::RepeatingCallback<network::mojom::NetworkContext*()> - network_context_getter_; - - std::map<FormKey, base::flat_set<base::string16>> https_credentials_map_; - size_t processed_results_ = 0; - - // The next three counters are in pairs where [0] component means that HSTS is - // not enabled and [1] component means that HSTS is enabled for that HTTP type - // of credentials. - - // Number of HTTP credentials for which no HTTPS credential for the same - // username exists. - size_t https_credential_not_found_[2] = {0, 0}; - - // Number of HTTP credentials for which an equivalent (i.e. same host, - // username and password) HTTPS credential exists. - size_t same_password_[2] = {0, 0}; - - // Number of HTTP credentials for which a conflicting (i.e. same host and - // username, but different password) HTTPS credential exists. - size_t different_password_[2] = {0, 0}; - - // Number of HTTP credentials from the Password Store. - size_t total_http_credentials_ = 0; - - DISALLOW_COPY_AND_ASSIGN(HttpMetricsMigrationReporter); -}; - -void HttpMetricsMigrationReporter::OnGetPasswordStoreResults( - std::vector<std::unique_ptr<autofill::PasswordForm>> results) { - // Non HTTP or HTTPS credentials are ignored. - base::EraseIf(results, [](const std::unique_ptr<PasswordForm>& form) { - return !form->origin.SchemeIsHTTPOrHTTPS(); - }); - - for (auto& form : results) { - // The next signon-realm has the protocol excluded. For example if original - // signon_realm is "https://google.com/". After excluding protocol it - // becomes "google.com/". - FormKey form_key({GURL(form->signon_realm).GetContent(), form->scheme, - form->username_value}); - if (form->origin.SchemeIs(url::kHttpScheme)) { - password_manager::PostHSTSQueryForHostAndNetworkContext( - form->origin, network_context_getter_.Run(), - base::Bind(&HttpMetricsMigrationReporter::OnHSTSQueryResult, - base::Unretained(this), form_key, form->password_value)); - ++total_http_credentials_; - } else { // Https - https_credentials_map_[form_key].insert(form->password_value); - } - } - ReportMetrics(); -} - -// |key| and |password_value| was created from the same form. -void HttpMetricsMigrationReporter::OnHSTSQueryResult( - FormKey key, - base::string16 password_value, - password_manager::HSTSResult hsts_result) { - ++processed_results_; - base::ScopedClosureRunner report(base::BindOnce( - &HttpMetricsMigrationReporter::ReportMetrics, base::Unretained(this))); - - if (hsts_result == password_manager::HSTSResult::kError) - return; - - bool is_hsts = (hsts_result == password_manager::HSTSResult::kYes); - - auto user_it = https_credentials_map_.find(key); - if (user_it == https_credentials_map_.end()) { - // Credentials are not migrated yet. - ++https_credential_not_found_[is_hsts]; - return; - } - if (base::ContainsKey(user_it->second, password_value)) { - // The password store contains the same credentials (username and - // password) on HTTP version of the form. - ++same_password_[is_hsts]; - } else { - ++different_password_[is_hsts]; - } -} - -void HttpMetricsMigrationReporter::ReportMetrics() { - // The metrics have to be recorded after all requests are done. - if (processed_results_ != total_http_credentials_) - return; - - for (bool is_hsts_enabled : {false, true}) { - std::string suffix = (is_hsts_enabled ? std::string("WithHSTSEnabled") - : std::string("HSTSNotEnabled")); - - base::UmaHistogramCounts1000( - "PasswordManager.HttpCredentialsWithEquivalentHttpsCredential." + - suffix, - same_password_[is_hsts_enabled]); - - base::UmaHistogramCounts1000( - "PasswordManager.HttpCredentialsWithConflictingHttpsCredential." + - suffix, - different_password_[is_hsts_enabled]); - - base::UmaHistogramCounts1000( - "PasswordManager.HttpCredentialsWithoutMatchingHttpsCredential." + - suffix, - https_credential_not_found_[is_hsts_enabled]); - } - delete this; -} - } // namespace #if !defined(OS_IOS) @@ -196,7 +54,8 @@ base::RepeatingCallback<network::mojom::NetworkContext*()> network_context_getter) { // The object will delete itself once the metrics are recorded. - new HttpMetricsMigrationReporter(store.get(), network_context_getter); + new password_manager::HttpCredentialCleaner(std::move(store), + network_context_getter); } #endif // !defined(OS_IOS)
diff --git a/components/password_manager/core/browser/password_manager_util_unittest.cc b/components/password_manager/core/browser/password_manager_util_unittest.cc index b49c280..c24abe8 100644 --- a/components/password_manager/core/browser/password_manager_util_unittest.cc +++ b/components/password_manager/core/browser/password_manager_util_unittest.cc
@@ -12,19 +12,13 @@ #include "base/macros.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/bind_test_util.h" -#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_task_environment.h" -#include "build/build_config.h" #include "components/autofill/core/common/password_form.h" -#include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" #include "components/password_manager/core/browser/test_password_store.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" -#include "net/url_request/url_request_test_util.h" -#include "services/network/network_context.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -95,180 +89,6 @@ EXPECT_THAT(forms, UnorderedPasswordFormElementsAre(&expected_forms)); } -#if !defined(OS_IOS) -TEST(PasswordManagerUtil, ReportHttpMigrationMetrics) { - enum class HttpCredentialType { kNoMatching, kEquivalent, kConflicting }; - - struct TestCase { - bool is_hsts_enabled; - autofill::PasswordForm::Scheme http_form_scheme; - bool same_signon_realm; - bool same_scheme; - bool same_username; - bool same_password; - HttpCredentialType expected; - }; - - struct Histogram { - bool test_hsts_enabled; - HttpCredentialType test_type; - std::string histogram_name; - }; - - constexpr static TestCase cases[] = { - - {true, autofill::PasswordForm::Scheme::SCHEME_HTML, false, true, true, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, false, true, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, false, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, - false, HttpCredentialType::kConflicting}, - {true, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, - true, HttpCredentialType::kEquivalent}, - - {false, autofill::PasswordForm::Scheme::SCHEME_HTML, false, true, true, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, false, true, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, false, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, - false, HttpCredentialType::kConflicting}, - {false, autofill::PasswordForm::Scheme::SCHEME_HTML, true, true, true, - true, HttpCredentialType::kEquivalent}, - - {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, false, true, true, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, false, true, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, false, - true, HttpCredentialType::kNoMatching}, - {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, - false, HttpCredentialType::kConflicting}, - {true, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, - true, HttpCredentialType::kEquivalent}, - - {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, false, true, true, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, false, true, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, false, - true, HttpCredentialType::kNoMatching}, - {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, - false, HttpCredentialType::kConflicting}, - {false, autofill::PasswordForm::Scheme::SCHEME_BASIC, true, true, true, - true, HttpCredentialType::kEquivalent} - - }; - - const base::string16 username[2] = {base::ASCIIToUTF16("user0"), - base::ASCIIToUTF16("user1")}; - const base::string16 password[2] = {base::ASCIIToUTF16("pass0"), - base::ASCIIToUTF16("pass1")}; - - std::vector<Histogram> histograms_to_test; - for (bool test_hsts_enabled : {true, false}) { - std::string suffix = - (test_hsts_enabled ? "WithHSTSEnabled" : "HSTSNotEnabled"); - histograms_to_test.push_back( - {test_hsts_enabled, HttpCredentialType::kNoMatching, - "PasswordManager.HttpCredentialsWithoutMatchingHttpsCredential." + - suffix}); - histograms_to_test.push_back( - {test_hsts_enabled, HttpCredentialType::kEquivalent, - "PasswordManager.HttpCredentialsWithEquivalentHttpsCredential." + - suffix}); - histograms_to_test.push_back( - {test_hsts_enabled, HttpCredentialType::kConflicting, - "PasswordManager.HttpCredentialsWithConflictingHttpsCredential." + - suffix}); - } - for (const auto& test : cases) { - SCOPED_TRACE(testing::Message() - << "is_hsts_enabled=" << test.is_hsts_enabled - << ", http_form_scheme=" - << static_cast<int>(test.http_form_scheme) - << ", same_signon_realm=" << test.same_signon_realm - << ", same_scheme=" << test.same_scheme - << ", same_username=" << test.same_username - << ", same_password=" << test.same_password); - - base::test::ScopedTaskEnvironment scoped_task_environment; - auto request_context = - base::MakeRefCounted<net::TestURLRequestContextGetter>( - base::ThreadTaskRunnerHandle::Get()); - network::mojom::NetworkContextPtr network_context_pipe; - auto network_context = std::make_unique<network::NetworkContext>( - nullptr, mojo::MakeRequest(&network_context_pipe), - request_context->GetURLRequestContext()); - - auto password_store = - base::MakeRefCounted<password_manager::TestPasswordStore>(); - ASSERT_TRUE(password_store->Init(syncer::SyncableService::StartSyncFlare(), - nullptr)); - - autofill::PasswordForm http_form; - http_form.origin = GURL("http://example.org/"); - http_form.signon_realm = http_form.origin.GetOrigin().spec(); - http_form.scheme = test.http_form_scheme; - http_form.username_value = username[1]; - http_form.password_value = password[1]; - password_store->AddLogin(http_form); - - autofill::PasswordForm https_form; - https_form.origin = GURL("https://example.org/"); - https_form.scheme = test.http_form_scheme; - if (!test.same_scheme) { - if (https_form.scheme == autofill::PasswordForm::Scheme::SCHEME_BASIC) - https_form.scheme = autofill::PasswordForm::Scheme::SCHEME_HTML; - else - https_form.scheme = autofill::PasswordForm::Scheme::SCHEME_BASIC; - } - - https_form.signon_realm = https_form.origin.GetOrigin().spec(); - if (!test.same_signon_realm) - https_form.signon_realm += "different/"; - - https_form.username_value = username[test.same_username]; - https_form.password_value = password[test.same_password]; - password_store->AddLogin(https_form); - - if (test.is_hsts_enabled) { - network_context->AddHSTSForTesting( - http_form.origin.host(), base::Time::Max(), - false /*include_subdomains*/, base::DoNothing()); - } - scoped_task_environment.RunUntilIdle(); - - base::HistogramTester histogram_tester; - ReportHttpMigrationMetrics( - password_store, - base::BindLambdaForTesting([&]() -> network::mojom::NetworkContext* { - // This needs to be network_context_pipe.get() and - // not network_context.get() to make HSTS queries asynchronous, which - // is what the progress tracking logic in HttpMetricsMigrationReporter - // assumes. This also matches reality, since - // StoragePartition::GetNetworkContext will return a mojo pipe - // even in the in-process case. - return network_context_pipe.get(); - })); - scoped_task_environment.RunUntilIdle(); - - for (const auto& histogram : histograms_to_test) { - int sample = - static_cast<int>(histogram.test_type == test.expected && - histogram.test_hsts_enabled == test.is_hsts_enabled); - histogram_tester.ExpectUniqueSample(histogram.histogram_name, sample, 1); - } - - password_store->ShutdownOnUIThread(); - scoped_task_environment.RunUntilIdle(); - } -} -#endif // !defined(OS_IOS) - // This test is supposed to check the behavior when: // 1. User blacklisted on http site two forms (they being considered // duplicated because they have the same signon_realm).
diff --git a/components/password_manager/core/browser/password_syncable_service.cc b/components/password_manager/core/browser/password_syncable_service.cc index dbc7115f..11d37104 100644 --- a/components/password_manager/core/browser/password_syncable_service.cc +++ b/components/password_manager/core/browser/password_syncable_service.cc
@@ -17,6 +17,7 @@ #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_store_sync.h" #include "components/password_manager/core/common/password_manager_features.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "net/base/escape.h"
diff --git a/components/password_manager/core/browser/password_syncable_service_unittest.cc b/components/password_manager/core/browser/password_syncable_service_unittest.cc index 2022942..61467bf8 100644 --- a/components/password_manager/core/browser/password_syncable_service_unittest.cc +++ b/components/password_manager/core/browser/password_syncable_service_unittest.cc
@@ -19,6 +19,7 @@ #include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/sync/model/sync_change_processor.h" +#include "components/sync/model/sync_change_processor_wrapper_for_test.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_error_factory_mock.h" #include "testing/gmock/include/gmock/gmock.h" @@ -191,11 +192,6 @@ PasswordSyncableService* service() { return service_.get(); } - // Returnes the scoped_ptr to |service_| thus NULLing out it. - std::unique_ptr<syncer::SyncChangeProcessor> ReleaseSyncableService() { - return std::move(service_); - } - private: scoped_refptr<MockPasswordStore> password_store_; std::unique_ptr<PasswordSyncableService> service_; @@ -466,7 +462,8 @@ other_service_wrapper.service()->GetAllSyncData(syncer::PASSWORDS); service()->MergeDataAndStartSyncing( syncer::PASSWORDS, other_service_data, - other_service_wrapper.ReleaseSyncableService(), + std::make_unique<syncer::SyncChangeProcessorWrapperForTest>( + other_service_wrapper.service()), std::unique_ptr<syncer::SyncErrorFactory>()); }
diff --git a/components/password_manager/core/browser/votes_uploader.cc b/components/password_manager/core/browser/votes_uploader.cc index 111bb4e4..a06414a 100644 --- a/components/password_manager/core/browser/votes_uploader.cc +++ b/components/password_manager/core/browser/votes_uploader.cc
@@ -142,21 +142,6 @@ const PasswordForm& submitted_form, const std::map<base::string16, const PasswordForm*>& best_matches, PasswordForm* pending_credentials) { - // if (observed_form_.IsPossibleChangePasswordFormWithoutUsername()) - // return; // todo: is it needed - - // Send votes for sign-in form. - FormData& form_data = pending_credentials->form_data; - if (form_data.fields.size() == 2 && - form_data.fields[0].form_control_type == "text" && - form_data.fields[1].form_control_type == "password") { - // |form_data| is received from the renderer and does not contain field - // values. Fill username field value with username to allow AutofillManager - // to detect username autofill type. - form_data.fields[0].value = pending_credentials->username_value; - SendSignInVote(form_data, submitted_form.submission_event); - } - if (pending_credentials->times_used == 1 || IsAddingUsernameToExistingMatch(*pending_credentials, best_matches)) UploadFirstLoginVotes(best_matches, *pending_credentials, submitted_form); @@ -372,22 +357,6 @@ std::string(), true /* observed_submission */); } -void VotesUploader::SendSignInVote( - const FormData& form_data, - const PasswordForm::SubmissionIndicatorEvent& submission_event) { - AutofillManager* autofill_manager = client_->GetAutofillManagerForMainFrame(); - if (!autofill_manager) - return; - std::unique_ptr<FormStructure> form_structure(new FormStructure(form_data)); - form_structure->set_submission_event(submission_event); - form_structure->set_is_signin_upload(true); - DCHECK_EQ(2u, form_structure->field_count()); - form_structure->field(1)->set_possible_types({autofill::PASSWORD}); - autofill_manager->MaybeStartVoteUploadProcess(std::move(form_structure), - base::TimeTicks::Now(), - /*observed_submission=*/true); -} - void VotesUploader::AddGeneratedVote(FormStructure* form_structure) { DCHECK(form_structure); DCHECK(generation_popup_was_shown_);
diff --git a/components/password_manager/core/browser/votes_uploader.h b/components/password_manager/core/browser/votes_uploader.h index 286d68e..a8318d1 100644 --- a/components/password_manager/core/browser/votes_uploader.h +++ b/components/password_manager/core/browser/votes_uploader.h
@@ -135,12 +135,6 @@ kFoundGenerationElement }; - // Send a vote for sign-in forms with autofill types for a username field. - // TODO(https://crbug.com/889472): Remove this method. - void SendSignInVote( - const autofill::FormData& form_data, - const autofill::PasswordForm::SubmissionIndicatorEvent& submission_event); - // Adds a vote on password generation usage to |form_structure|. void AddGeneratedVote(autofill::FormStructure* form_structure);
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index 646d44a..064b6ad 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -4,6 +4,8 @@ #include "components/search_engines/template_url_service.h" +#include <algorithm> + #include "base/auto_reset.h" #include "base/callback.h" #include "base/debug/crash_logging.h" @@ -22,6 +24,7 @@ #include "components/search_engines/template_url_service_client.h" #include "components/search_engines/template_url_service_observer.h" #include "components/search_engines/util.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/search_engine_specifics.pb.h" #include "components/sync/protocol/sync.pb.h" @@ -2146,7 +2149,6 @@ change_list->push_back(syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, sync_data)); - } void TemplateURLService::MergeInSyncTemplateURL(
diff --git a/components/search_engines/template_url_service.h b/components/search_engines/template_url_service.h index 769cd76f..3400b47 100644 --- a/components/search_engines/template_url_service.h +++ b/components/search_engines/template_url_service.h
@@ -7,6 +7,13 @@ #include <stddef.h> +#include <map> +#include <memory> +#include <set> +#include <string> +#include <utility> +#include <vector> + #include "base/callback_list.h" #include "base/gtest_prod_util.h" #include "base/macros.h"
diff --git a/components/sync/base/data_type_histogram.h b/components/sync/base/data_type_histogram.h index bd17cfb..be57d0f 100644 --- a/components/sync/base/data_type_histogram.h +++ b/components/sync/base/data_type_histogram.h
@@ -39,6 +39,8 @@ // in macros, pass in the histogram method directly as a parameter. // See http://connect.microsoft.com/VisualStudio/feedback/details/380090/ // variadic-macro-replacement#details +// When adding a new datatype in the switch below, also update the SyncModelType +// and SyncModelTypeByMacro histogram suffixes in histograms.xml. #define SYNC_DATA_TYPE_HISTOGRAM(datatype) \ do { \ switch (datatype) { \
diff --git a/components/sync/base/model_type.h b/components/sync/base/model_type.h index ea9a153..7573c64d 100644 --- a/components/sync/base/model_type.h +++ b/components/sync/base/model_type.h
@@ -35,8 +35,9 @@ // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.sync // // |kModelTypeInfoMap| struct entries are in the same order as their definition -// in ModelType enum. Don't forget to update the |kModelTypeInfoMap| struct in -// model_type.cc when you make changes in ModelType enum. +// in ModelType enum. When you make changes in ModelType enum, don't forget to +// update the |kModelTypeInfoMap| struct in model_type.cc and also the +// SyncModelType and SyncModelTypeByMacro histogram suffixes in histograms.xml enum ModelType { // Object type unknown. Objects may transition through // the unknown state during their initial creation, before
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc index 5709cc4..80100852 100644 --- a/components/sync/driver/model_type_controller.cc +++ b/components/sync/driver/model_type_controller.cc
@@ -291,6 +291,17 @@ void ModelTypeController::ReportModelError(SyncError::ErrorType error_type, const ModelError& error) { DCHECK(CalledOnValidThread()); + + // Error could arrive too late, e.g. after the datatype has been stopped. + // This is allowed for the delegate's convenience, so there's no constraints + // around when exactly DataTypeActivationRequest::error_handler is supposed to + // be used (it can be used at any time). This also simplifies the + // implementation of task-posting delegates. + if (state_ == NOT_RUNNING) { + state_ = FAILED; + return; + } + LoadModelsDone(UNRECOVERABLE_ERROR, SyncError(error.location(), error_type, error.message(), type())); }
diff --git a/components/sync/driver/model_type_controller_unittest.cc b/components/sync/driver/model_type_controller_unittest.cc index 7bb0a81..d86895d9 100644 --- a/components/sync/driver/model_type_controller_unittest.cc +++ b/components/sync/driver/model_type_controller_unittest.cc
@@ -37,6 +37,10 @@ const char kCacheGuid[] = "SomeCacheGuid"; const char kAccountId[] = "SomeAccountId"; +MATCHER(ErrorIsSet, "") { + return arg.IsSet(); +} + class MockDelegate : public ModelTypeControllerDelegate { public: MOCK_METHOD2(OnSyncStarting, @@ -248,6 +252,29 @@ EXPECT_TRUE(processor()->is_connected()); } +TEST_F(ModelTypeControllerTest, ActivateWithError) { + ModelErrorHandler error_handler; + EXPECT_CALL(*delegate(), OnSyncStarting(_, _)) + .WillOnce([&](const DataTypeActivationRequest& request, + ModelTypeControllerDelegate::StartCallback callback) { + error_handler = request.error_handler; + }); + + base::MockCallback<DataTypeController::ModelLoadCallback> load_models_done; + controller()->LoadModels(MakeConfigureContext(), load_models_done.Get()); + ASSERT_EQ(DataTypeController::MODEL_STARTING, controller()->state()); + ASSERT_TRUE(error_handler); + + // Mimic completion for OnSyncStarting(), with an error. + EXPECT_CALL(*delegate(), OnSyncStopping(_)).Times(0); + EXPECT_CALL(load_models_done, Run(_, ErrorIsSet())); + error_handler.Run(ModelError(FROM_HERE, "Test error")); + // TODO(mastiz): We shouldn't need RunUntilIdle() here, but + // ModelTypeController currently uses task-posting for errors. + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(DataTypeController::FAILED, controller()->state()); +} + TEST_F(ModelTypeControllerTest, Stop) { ASSERT_TRUE(LoadModels()); RegisterWithBackend(/*expect_downloaded=*/false); @@ -295,6 +322,103 @@ EXPECT_EQ(DataTypeController::NOT_RUNNING, controller()->state()); } +// Test emulates disabling sync when datatype is loading. The controller should +// wait for completion of the delegate, before stopping it. +TEST_F(ModelTypeControllerTest, StopWhileStarting) { + ModelTypeControllerDelegate::StartCallback start_callback; + EXPECT_CALL(*delegate(), OnSyncStarting(_, _)) + .WillOnce([&](const DataTypeActivationRequest& request, + ModelTypeControllerDelegate::StartCallback callback) { + start_callback = std::move(callback); + }); + + controller()->LoadModels(MakeConfigureContext(), base::DoNothing()); + ASSERT_EQ(DataTypeController::MODEL_STARTING, controller()->state()); + ASSERT_TRUE(start_callback); + + // Stop() should be deferred until OnSyncStarting() finishes. + base::MockCallback<base::OnceClosure> stop_completion; + EXPECT_CALL(stop_completion, Run()).Times(0); + EXPECT_CALL(*delegate(), OnSyncStopping(_)).Times(0); + controller()->Stop(CLEAR_METADATA, stop_completion.Get()); + EXPECT_EQ(DataTypeController::STOPPING, controller()->state()); + + // Mimic completion for OnSyncStarting(). + EXPECT_CALL(*delegate(), OnSyncStopping(_)); + EXPECT_CALL(stop_completion, Run()); + std::move(start_callback).Run(std::make_unique<DataTypeActivationResponse>()); + EXPECT_EQ(DataTypeController::NOT_RUNNING, controller()->state()); +} + +// Test emulates disabling sync when datatype is loading. The controller should +// wait for completion of the delegate, before stopping it. In this test, +// loading produces an error, so the resulting state should be FAILED. +TEST_F(ModelTypeControllerTest, StopWhileStartingWithError) { + ModelErrorHandler error_handler; + EXPECT_CALL(*delegate(), OnSyncStarting(_, _)) + .WillOnce([&](const DataTypeActivationRequest& request, + ModelTypeControllerDelegate::StartCallback callback) { + error_handler = request.error_handler; + }); + + controller()->LoadModels(MakeConfigureContext(), base::DoNothing()); + ASSERT_EQ(DataTypeController::MODEL_STARTING, controller()->state()); + ASSERT_TRUE(error_handler); + + // Stop() should be deferred until OnSyncStarting() finishes. + base::MockCallback<base::OnceClosure> stop_completion; + EXPECT_CALL(stop_completion, Run()).Times(0); + EXPECT_CALL(*delegate(), OnSyncStopping(_)).Times(0); + controller()->Stop(CLEAR_METADATA, stop_completion.Get()); + EXPECT_EQ(DataTypeController::STOPPING, controller()->state()); + + // Mimic completion for OnSyncStarting(), with an error. + EXPECT_CALL(*delegate(), OnSyncStopping(_)).Times(0); + EXPECT_CALL(stop_completion, Run()); + error_handler.Run(ModelError(FROM_HERE, "Test error")); + // TODO(mastiz): We shouldn't need RunUntilIdle() here, but + // ModelTypeController currently uses task-posting for errors. + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(DataTypeController::FAILED, controller()->state()); +} + +// Test emulates a controller talking to a delegate (processor) in a backend +// thread, which necessarily involves task posting (usually via +// ProxyModelTypeControllerDelegate), where the backend posts an error +// simultaneously to the UI stopping the datatype. +TEST_F(ModelTypeControllerTest, StopWhileErrorInFlight) { + ModelTypeControllerDelegate::StartCallback start_callback; + ModelErrorHandler error_handler; + EXPECT_CALL(*delegate(), OnSyncStarting(_, _)) + .WillOnce([&](const DataTypeActivationRequest& request, + ModelTypeControllerDelegate::StartCallback callback) { + start_callback = std::move(callback); + error_handler = request.error_handler; + }); + + controller()->LoadModels(MakeConfigureContext(), base::DoNothing()); + ASSERT_EQ(DataTypeController::MODEL_STARTING, controller()->state()); + ASSERT_TRUE(start_callback); + ASSERT_TRUE(error_handler); + + // Mimic completion for OnSyncStarting(). + std::move(start_callback).Run(std::make_unique<DataTypeActivationResponse>()); + ASSERT_EQ(DataTypeController::MODEL_LOADED, controller()->state()); + + // At this point, the UI stops the datatype, but it's possible that the + // backend has already posted a task to the UI thread, which we'll process + // later below. + controller()->Stop(CLEAR_METADATA, base::DoNothing()); + ASSERT_EQ(DataTypeController::NOT_RUNNING, controller()->state()); + + // In the next loop iteration, the UI thread receives the error. + error_handler.Run(ModelError(FROM_HERE, "Test error")); + // TODO(mastiz): We shouldn't need RunUntilIdle() here, but + // ModelTypeController currently uses task-posting for errors. + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(DataTypeController::FAILED, controller()->state()); +} + // Tests that StorageOption is honored when the controller has been constructed // with two delegates. TEST(ModelTypeControllerWithMultiDelegateTest, ToggleStorageOption) {
diff --git a/components/sync/driver/shared_change_processor.cc b/components/sync/driver/shared_change_processor.cc index bc59e8f9..d73de92 100644 --- a/components/sync/driver/shared_change_processor.cc +++ b/components/sync/driver/shared_change_processor.cc
@@ -107,12 +107,6 @@ return; } - std::string datatype_context; - if (GetDataTypeContext(&datatype_context)) { - local_service_->UpdateDataTypeContext( - type_, SyncChangeProcessor::NO_REFRESH, datatype_context); - } - syncer_merge_result.set_num_items_before_association( initial_sync_data.size()); // Passes a reference to |shared_change_processor|.
diff --git a/components/sync/model/fake_syncable_service.cc b/components/sync/model/fake_syncable_service.cc index 8792bdd..fcdf12476 100644 --- a/components/sync/model/fake_syncable_service.cc +++ b/components/sync/model/fake_syncable_service.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/location.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" namespace syncer {
diff --git a/components/sync/model/sync_change.h b/components/sync/model/sync_change.h index 747dd7f..93a4798 100644 --- a/components/sync/model/sync_change.h +++ b/components/sync/model/sync_change.h
@@ -71,6 +71,8 @@ // gmock printer helper. void PrintTo(const SyncChange& sync_change, std::ostream* os); +using SyncChangeList = std::vector<SyncChange>; + } // namespace syncer #endif // COMPONENTS_SYNC_MODEL_SYNC_CHANGE_H_
diff --git a/components/sync/model/sync_change_processor.h b/components/sync/model/sync_change_processor.h index f2cf206b..9d9c1e7 100644 --- a/components/sync/model/sync_change_processor.h +++ b/components/sync/model/sync_change_processor.h
@@ -9,6 +9,7 @@ #include <vector> #include "components/sync/base/model_type.h" +#include "components/sync/model/sync_change.h" #include "components/sync/model/sync_data.h" #include "components/sync/model/sync_error.h" @@ -18,12 +19,8 @@ namespace syncer { -class SyncChange; - class LocalChangeObserver; -using SyncChangeList = std::vector<SyncChange>; - // An interface for services that handle receiving SyncChanges. class SyncChangeProcessor { public:
diff --git a/components/sync/model/sync_change_processor_wrapper_for_test.cc b/components/sync/model/sync_change_processor_wrapper_for_test.cc index b559af32..94562cb 100644 --- a/components/sync/model/sync_change_processor_wrapper_for_test.cc +++ b/components/sync/model/sync_change_processor_wrapper_for_test.cc
@@ -4,12 +4,25 @@ #include "components/sync/model/sync_change_processor_wrapper_for_test.h" +#include "base/bind.h" +#include "components/sync/model/syncable_service.h" + namespace syncer { SyncChangeProcessorWrapperForTest::SyncChangeProcessorWrapperForTest( SyncChangeProcessor* wrapped) - : wrapped_(wrapped) { - DCHECK(wrapped_); + : process_sync_changes_( + base::BindRepeating(&SyncChangeProcessor::ProcessSyncChanges, + base::Unretained(wrapped))) { + DCHECK(wrapped); +} + +SyncChangeProcessorWrapperForTest::SyncChangeProcessorWrapperForTest( + SyncableService* wrapped) + : process_sync_changes_( + base::BindRepeating(&SyncableService::ProcessSyncChanges, + base::Unretained(wrapped))) { + DCHECK(wrapped); } SyncChangeProcessorWrapperForTest::~SyncChangeProcessorWrapperForTest() {} @@ -17,12 +30,13 @@ SyncError SyncChangeProcessorWrapperForTest::ProcessSyncChanges( const base::Location& from_here, const SyncChangeList& change_list) { - return wrapped_->ProcessSyncChanges(from_here, change_list); + return process_sync_changes_.Run(from_here, change_list); } SyncDataList SyncChangeProcessorWrapperForTest::GetAllSyncData( ModelType type) const { - return wrapped_->GetAllSyncData(type); + NOTREACHED(); + return SyncDataList(); } } // namespace syncer
diff --git a/components/sync/model/sync_change_processor_wrapper_for_test.h b/components/sync/model/sync_change_processor_wrapper_for_test.h index 616fceff3..c4546fd 100644 --- a/components/sync/model/sync_change_processor_wrapper_for_test.h +++ b/components/sync/model/sync_change_processor_wrapper_for_test.h
@@ -5,12 +5,16 @@ #ifndef COMPONENTS_SYNC_MODEL_SYNC_CHANGE_PROCESSOR_WRAPPER_FOR_TEST_H_ #define COMPONENTS_SYNC_MODEL_SYNC_CHANGE_PROCESSOR_WRAPPER_FOR_TEST_H_ +#include "base/callback.h" #include "base/macros.h" #include "components/sync/model/sync_change_processor.h" namespace syncer { -// A wrapper class for use in tests. +class SyncableService; + +// A wrapper class for use in tests that forwards changes to a SyncableService +// or a SyncChangeProcessor; class SyncChangeProcessorWrapperForTest : public SyncChangeProcessor { public: // Create a SyncChangeProcessorWrapperForTest. @@ -18,6 +22,8 @@ // All method calls are forwarded to |wrapped|. Caller maintains ownership // of |wrapped| and is responsible for ensuring it outlives this object. explicit SyncChangeProcessorWrapperForTest(SyncChangeProcessor* wrapped); + // Overload for SyncableService. + explicit SyncChangeProcessorWrapperForTest(SyncableService* wrapped); ~SyncChangeProcessorWrapperForTest() override; // SyncChangeProcessor implementation. @@ -26,7 +32,9 @@ SyncDataList GetAllSyncData(ModelType type) const override; private: - SyncChangeProcessor* const wrapped_; + const base::RepeatingCallback<SyncError(const base::Location& from_here, + const SyncChangeList& change_list)> + process_sync_changes_; DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorWrapperForTest); };
diff --git a/components/sync/model/sync_data.cc b/components/sync/model/sync_data.cc index 16186b1..eb57484 100644 --- a/components/sync/model/sync_data.cc +++ b/components/sync/model/sync_data.cc
@@ -39,14 +39,16 @@ t1->Swap(t2); } -SyncData::SyncData() : id_(kInvalidId), is_valid_(false) {} +SyncData::SyncData() : id_(kInvalidId), is_local_(false), is_valid_(false) {} -SyncData::SyncData(int64_t id, +SyncData::SyncData(bool is_local, + int64_t id, sync_pb::SyncEntity* entity, const base::Time& remote_modification_time) : id_(id), remote_modification_time_(remote_modification_time), immutable_entity_(entity), + is_local_(is_local), is_valid_(true) {} SyncData::SyncData(const SyncData& other) = default; @@ -69,7 +71,7 @@ entity.set_client_defined_unique_tag(sync_tag); entity.set_non_unique_name(non_unique_title); entity.mutable_specifics()->CopyFrom(specifics); - return SyncData(kInvalidId, &entity, base::Time()); + return SyncData(/*is_local=*/true, kInvalidId, &entity, base::Time()); } // Static. @@ -78,11 +80,10 @@ const sync_pb::EntitySpecifics& specifics, const base::Time& modification_time, const std::string& client_tag_hash) { - DCHECK_NE(id, kInvalidId); sync_pb::SyncEntity entity; entity.mutable_specifics()->CopyFrom(specifics); entity.set_client_defined_unique_tag(client_tag_hash); - return SyncData(id, &entity, modification_time); + return SyncData(/*is_local=*/false, id, &entity, modification_time); } bool SyncData::IsValid() const { @@ -104,7 +105,7 @@ } bool SyncData::IsLocal() const { - return id_ == kInvalidId; + return is_local_; } std::string SyncData::ToString() const { @@ -125,7 +126,7 @@ } SyncDataRemote sync_data_remote(*this); - std::string id = base::Int64ToString(sync_data_remote.GetId()); + std::string id = base::Int64ToString(sync_data_remote.id_); return "{ isLocal: false, type: " + type + ", specifics: " + specifics + ", id: " + id + "}"; } @@ -156,6 +157,8 @@ } int64_t SyncDataRemote::GetId() const { + DCHECK(!IsLocal()); + DCHECK_NE(id_, kInvalidId); return id_; }
diff --git a/components/sync/model/sync_data.h b/components/sync/model/sync_data.h index 1628c2e..941a2f8 100644 --- a/components/sync/model/sync_data.h +++ b/components/sync/model/sync_data.h
@@ -109,21 +109,26 @@ using ImmutableSyncEntity = Immutable<sync_pb::SyncEntity, ImmutableSyncEntityTraits>; - // Equal to kInvalidId iff this is local. int64_t id_; // This may be null if the SyncData represents a deleted item. + // TODO(crbug.com/681921): Remove when directory-based sessions sync is + // removed, the only remaining reader. base::Time remote_modification_time_; // The actual shared sync entity being held. ImmutableSyncEntity immutable_entity_; private: + // Whether this SyncData represents a local change. + bool is_local_; + // Whether this SyncData holds valid data. bool is_valid_; // Clears |entity|. - SyncData(int64_t id, + SyncData(bool is_local_, + int64_t id, sync_pb::SyncEntity* entity, const base::Time& remote_modification_time); }; @@ -153,13 +158,17 @@ // Return the last motification time according to the server. This may be null // if the SyncData represents a deleted item. + // TODO(crbug.com/681921): Remove when directory-based sessions sync is + // removed, the only remaining reader. const base::Time& GetModifiedTime() const; - int64_t GetId() const; - // Returns the tag hash value. May not always be present, in which case an // empty string will be returned. const std::string& GetClientTagHash() const; + + // Deprecated: might not be populated in SyncableService API. + // TODO(crbug.com/870624): Remove when directory is removed. + int64_t GetId() const; }; // gmock printer helper.
diff --git a/components/sync/model/sync_data_unittest.cc b/components/sync/model/sync_data_unittest.cc index e793bf34..6dc5d8d7 100644 --- a/components/sync/model/sync_data_unittest.cc +++ b/components/sync/model/sync_data_unittest.cc
@@ -10,6 +10,7 @@ #include "base/message_loop/message_loop.h" #include "base/threading/thread_task_runner_handle.h" #include "components/sync/protocol/sync.pb.h" +#include "components/sync/syncable/base_node.h" #include "testing/gtest/include/gtest/gtest.h" using std::string; @@ -66,6 +67,16 @@ EXPECT_TRUE(data.GetSpecifics().has_preference()); } +TEST_F(SyncDataTest, CreateRemoteDataWithInvalidId) { + specifics.mutable_preference(); + SyncData data = + SyncData::CreateRemoteData(kInvalidId, specifics, kLastModifiedTime); + EXPECT_TRUE(data.IsValid()); + EXPECT_FALSE(data.IsLocal()); + EXPECT_EQ(kLastModifiedTime, SyncDataRemote(data).GetModifiedTime()); + EXPECT_TRUE(data.GetSpecifics().has_preference()); +} + } // namespace } // namespace syncer
diff --git a/components/sync/model/syncable_service.cc b/components/sync/model/syncable_service.cc index 4fbbc10..d4b33c2d 100644 --- a/components/sync/model/syncable_service.cc +++ b/components/sync/model/syncable_service.cc
@@ -6,6 +6,8 @@ namespace syncer { +SyncableService::SyncableService() {} + SyncableService::~SyncableService() {} } // namespace syncer
diff --git a/components/sync/model/syncable_service.h b/components/sync/model/syncable_service.h index 0f8ef9b4..8baaef1 100644 --- a/components/sync/model/syncable_service.h +++ b/components/sync/model/syncable_service.h
@@ -9,24 +9,26 @@ #include <vector> #include "base/callback.h" -#include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "components/sync/base/model_type.h" -#include "components/sync/model/sync_change_processor.h" +#include "components/sync/model/sync_change.h" #include "components/sync/model/sync_data.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_merge_result.h" namespace syncer { +class SyncChangeProcessor; class SyncErrorFactory; // TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService // implementers provide a way of getting a weak pointer to themselves. // See crbug.com/100114. -class SyncableService : public SyncChangeProcessor, - public base::SupportsWeakPtr<SyncableService> { +class SyncableService : public base::SupportsWeakPtr<SyncableService> { public: + SyncableService(); + virtual ~SyncableService(); + // A StartSyncFlare is useful when your SyncableService has a need for sync // to start ASAP. This is typically for one of three reasons: // 1) Because a local change event has occurred but MergeDataAndStartSyncing @@ -64,11 +66,15 @@ // Returns: A default SyncError (IsSet() == false) if no errors were // encountered, and a filled SyncError (IsSet() == true) // otherwise. - SyncError ProcessSyncChanges(const base::Location& from_here, - const SyncChangeList& change_list) override = 0; + virtual SyncError ProcessSyncChanges(const base::Location& from_here, + const SyncChangeList& change_list) = 0; - protected: - ~SyncableService() override; + // TODO(crbug.com/870624): We don't seem to use this function anywhere, so + // we should simply remove it and simplify all implementations. + virtual SyncDataList GetAllSyncData(ModelType type) const = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(SyncableService); }; } // namespace syncer
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.cc b/components/sync_bookmarks/bookmark_model_type_processor.cc index ee29ffc..6ec071d 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor.cc
@@ -340,11 +340,10 @@ void BookmarkModelTypeProcessor::OnSyncStopping( syncer::SyncStopMetadataFate metadata_fate) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Disabling sync for a type shouldn't happen before the model is ready to - // sync and metadata are tracked. - DCHECK(bookmark_tracker_); + // Disabling sync for a type shouldn't happen before the model is loaded + // because OnSyncStopping() is not allowed to be called before + // OnSyncStarting() has completed.. DCHECK(bookmark_model_); - DCHECK(bookmark_model_observer_); DCHECK(!start_callback_); cache_guid_.clear(); @@ -358,9 +357,12 @@ case syncer::CLEAR_METADATA: { // Stop observing local changes. We'll start observing local changes again // when Sync is (re)started in StartTrackingMetadata(). - bookmark_model_->RemoveObserver(bookmark_model_observer_.get()); - bookmark_model_observer_.reset(); - bookmark_tracker_.reset(); + if (bookmark_tracker_) { + DCHECK(bookmark_model_observer_); + bookmark_model_->RemoveObserver(bookmark_model_observer_.get()); + bookmark_model_observer_.reset(); + bookmark_tracker_.reset(); + } schedule_save_closure_.Run(); break; }
diff --git a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc index 2f72302..6edcaef 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc
@@ -21,6 +21,7 @@ using base::ASCIIToUTF16; using testing::Eq; +using testing::IsNull; using testing::NiceMock; using testing::NotNull; @@ -358,6 +359,22 @@ Eq(kEncryptionKeyName)); } +// Verifies that the processor doesn't crash if sync is stopped before receiving +// remote updates or tracking metadata. +TEST_F(BookmarkModelTypeProcessorTest, ShouldStopBeforeReceivingRemoteUpdates) { + ASSERT_THAT(processor()->GetTrackerForTest(), IsNull()); + processor()->OnSyncStopping(syncer::CLEAR_METADATA); + EXPECT_THAT(processor()->GetTrackerForTest(), IsNull()); +} + +TEST_F(BookmarkModelTypeProcessorTest, ShouldStopAfterReceivingRemoteUpdates) { + // Initialize the process to make sure the tracker has been created. + InitWithSyncedBookmarks({}, processor()); + ASSERT_THAT(processor()->GetTrackerForTest(), NotNull()); + processor()->OnSyncStopping(syncer::CLEAR_METADATA); + EXPECT_THAT(processor()->GetTrackerForTest(), IsNull()); +} + } // namespace } // namespace sync_bookmarks
diff --git a/components/sync_preferences/pref_model_associator.cc b/components/sync_preferences/pref_model_associator.cc index 11eface..d7b18ba9 100644 --- a/components/sync_preferences/pref_model_associator.cc +++ b/components/sync_preferences/pref_model_associator.cc
@@ -22,6 +22,7 @@ #include "components/prefs/persistent_pref_store.h" #include "components/prefs/pref_service.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/preference_specifics.pb.h" #include "components/sync/protocol/sync.pb.h"
diff --git a/components/sync_preferences/pref_service_syncable_unittest.cc b/components/sync_preferences/pref_service_syncable_unittest.cc index a1fa85d5..b9de7bc 100644 --- a/components/sync_preferences/pref_service_syncable_unittest.cc +++ b/components/sync_preferences/pref_service_syncable_unittest.cc
@@ -20,6 +20,7 @@ #include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/testing_pref_store.h" #include "components/sync/model/sync_change.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_data.h" #include "components/sync/model/sync_error_factory_mock.h" #include "components/sync/model/syncable_service.h"
diff --git a/components/sync_sessions/sessions_sync_manager.cc b/components/sync_sessions/sessions_sync_manager.cc index 503f362..19e726d 100644 --- a/components/sync_sessions/sessions_sync_manager.cc +++ b/components/sync_sessions/sessions_sync_manager.cc
@@ -17,6 +17,7 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" #include "components/sync/base/hash_util.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/model/sync_merge_result.h"
diff --git a/components/sync_sessions/sessions_sync_manager_unittest.cc b/components/sync_sessions/sessions_sync_manager_unittest.cc index 9f2dc2ba..2b473e5 100644 --- a/components/sync_sessions/sessions_sync_manager_unittest.cc +++ b/components/sync_sessions/sessions_sync_manager_unittest.cc
@@ -10,6 +10,7 @@ #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "components/prefs/testing_pref_service.h" +#include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory_mock.h" #include "components/sync_sessions/mock_sync_sessions_client.h" #include "components/sync_sessions/session_sync_prefs.h"
diff --git a/components/sync_sessions/synced_session_tracker_unittest.cc b/components/sync_sessions/synced_session_tracker_unittest.cc index e6a7aeb..40e2fdf5 100644 --- a/components/sync_sessions/synced_session_tracker_unittest.cc +++ b/components/sync_sessions/synced_session_tracker_unittest.cc
@@ -37,11 +37,11 @@ const char kTag2[] = "tag2"; const char kTag3[] = "tag3"; const char kTitle[] = "title"; -const int kTabNode1 = 1; -const int kTabNode2 = 2; -const int kTabNode3 = 3; -const int kTabNode4 = 4; -const int kTabNode5 = 5; +const int kTabNode1 = 0; +const int kTabNode2 = 1; +const int kTabNode3 = 2; +const int kTabNode4 = 3; +const int kTabNode5 = 4; const SessionID kWindow1 = SessionID::FromSerializedValue(1); const SessionID kWindow2 = SessionID::FromSerializedValue(2); const SessionID kWindow3 = SessionID::FromSerializedValue(3); @@ -504,15 +504,13 @@ // Start with two restored tab nodes. GetTracker()->ReassociateLocalTab(kTabNode1, kTab1); GetTracker()->ReassociateLocalTab(kTabNode2, kTab2); - EXPECT_TRUE(GetLocalTabNodePool()->Empty()); - EXPECT_FALSE(GetLocalTabNodePool()->Full()); - EXPECT_EQ(2U, GetLocalTabNodePool()->Capacity()); + GetTracker()->CleanupLocalTabs(&free_node_ids); + EXPECT_TRUE(free_node_ids.empty()); // Associate with no tabs. The tab pool should now be full. GetTracker()->ResetSessionTracking(kTag); GetTracker()->CleanupLocalTabs(&free_node_ids); EXPECT_TRUE(free_node_ids.empty()); - EXPECT_TRUE(GetLocalTabNodePool()->Full()); // Associate with only 1 tab open. A tab node should be reused. GetTracker()->ResetSessionTracking(kTag); @@ -522,22 +520,14 @@ GetTracker()->CleanupLocalTabs(&free_node_ids); EXPECT_TRUE(free_node_ids.empty()); - // TabNodePool should have one free tab node and one used. - EXPECT_EQ(2U, GetLocalTabNodePool()->Capacity()); - EXPECT_FALSE(GetLocalTabNodePool()->Empty()); - EXPECT_FALSE(GetLocalTabNodePool()->Full()); - // Simulate a tab opening, which should use the last free tab node. EXPECT_EQ(kTabNode2, GetTracker()->AssociateLocalTabWithFreeTabNode(kTab2)); EXPECT_EQ(kTabNode2, GetTracker()->LookupTabNodeFromTabId(kTag, kTab2)); - EXPECT_TRUE(GetLocalTabNodePool()->Empty()); // Simulate another tab opening, which should create a new associated tab // node. EXPECT_EQ(kTabNode3, GetTracker()->AssociateLocalTabWithFreeTabNode(kTab3)); EXPECT_EQ(kTabNode3, GetTracker()->LookupTabNodeFromTabId(kTag, kTab3)); - EXPECT_EQ(3U, GetLocalTabNodePool()->Capacity()); - EXPECT_TRUE(GetLocalTabNodePool()->Empty()); // Previous tabs should still be associated. EXPECT_EQ(kTabNode1, GetTracker()->LookupTabNodeFromTabId(kTag, kTab1)); @@ -548,8 +538,6 @@ GetTracker()->ResetSessionTracking(kTag); GetTracker()->CleanupLocalTabs(&free_node_ids); EXPECT_TRUE(free_node_ids.empty()); - EXPECT_TRUE(GetLocalTabNodePool()->Full()); - EXPECT_FALSE(GetLocalTabNodePool()->Empty()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); } @@ -600,7 +588,6 @@ session->windows.at(kWindow1)->wrapped_window.tabs[0].get()); ASSERT_EQ(GetTracker()->LookupTabNodeIds(kTag).size(), GetTracker()->LookupTabNodeIds(kTag).count(kTabNode1)); - ASSERT_EQ(1U, GetLocalTabNodePool()->Capacity()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); } @@ -658,7 +645,6 @@ session->windows.at(kWindow1)->wrapped_window.tabs[1].get()); EXPECT_EQ(GetTracker()->LookupTabNodeIds(kTag).size(), GetTracker()->LookupTabNodeIds(kTag).count(kTabNode1)); - EXPECT_EQ(1U, GetLocalTabNodePool()->Capacity()); // Attempting to access the original tab will create a new SessionTab object. EXPECT_NE(GetTracker()->GetTab(kTag, kTab1), @@ -700,7 +686,6 @@ session->windows.at(kWindow1)->wrapped_window.tabs[0].get()); ASSERT_EQ(GetTracker()->LookupTabNodeIds(kTag).size(), GetTracker()->LookupTabNodeIds(kTag).count(kTabNode1)); - ASSERT_EQ(1U, GetLocalTabNodePool()->Capacity()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); } @@ -738,7 +723,6 @@ session->windows.at(kWindow1)->wrapped_window.tabs[0].get()); ASSERT_EQ(GetTracker()->LookupTabNodeIds(kTag).size(), GetTracker()->LookupTabNodeIds(kTag).count(kTabNode1)); - ASSERT_EQ(1U, GetLocalTabNodePool()->Capacity()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); } @@ -788,7 +772,6 @@ session->windows.at(kWindow1)->wrapped_window.tabs[0].get()); ASSERT_EQ(GetTracker()->LookupTabNodeIds(kTag).size(), GetTracker()->LookupTabNodeIds(kTag).count(kTabNode1)); - ASSERT_EQ(1U, GetLocalTabNodePool()->Capacity()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); } @@ -843,7 +826,6 @@ // GetSession as well as the GetTab. ASSERT_EQ(GetTracker()->GetTab(kTag, kTab2), session->windows.at(kWindow1)->wrapped_window.tabs[0].get()); - ASSERT_EQ(2U, GetLocalTabNodePool()->Capacity()); ASSERT_TRUE(VerifyTabIntegrity(kTag)); }
diff --git a/components/sync_sessions/tab_node_pool.cc b/components/sync_sessions/tab_node_pool.cc index c638fc6..a11146c0 100644 --- a/components/sync_sessions/tab_node_pool.cc +++ b/components/sync_sessions/tab_node_pool.cc
@@ -5,6 +5,7 @@ #include "components/sync_sessions/tab_node_pool.h" #include <algorithm> +#include <limits> #include "base/logging.h" #include "components/sync/base/model_type.h" @@ -27,10 +28,11 @@ void TabNodePool::AddTabNode(int tab_node_id) { DCHECK_GT(tab_node_id, kInvalidTabNodeID); + DCHECK_LE(tab_node_id, max_used_tab_node_id_); DCHECK(nodeid_tabid_map_.find(tab_node_id) == nodeid_tabid_map_.end()); DVLOG(1) << "Adding tab node " << tab_node_id << " to pool."; - max_used_tab_node_id_ = std::max(max_used_tab_node_id_, tab_node_id); free_nodes_pool_.insert(tab_node_id); + missing_nodes_pool_.erase(tab_node_id); } void TabNodePool::AssociateTabNode(int tab_node_id, SessionID tab_id) { @@ -76,13 +78,23 @@ DCHECK_EQ(0U, tabid_nodeid_map_.count(tab_id)); int tab_node_id; - if (free_nodes_pool_.empty()) { - // Tab pool has no free nodes, allocate new one. + if (free_nodes_pool_.empty() && missing_nodes_pool_.empty()) { + // Tab pool has neither free nodes nor "holes" within the ID range, so + // allocate a new one by extending the range. tab_node_id = ++max_used_tab_node_id_; AddTabNode(tab_node_id); } else { - // Return the next free node. - tab_node_id = *free_nodes_pool_.begin(); + tab_node_id = std::numeric_limits<int>::max(); + // Take the smallest available, either from the freed pool or from IDs that + // were never associated before (but are within 0..max_used_tab_node_id_). + if (!free_nodes_pool_.empty()) { + tab_node_id = *free_nodes_pool_.begin(); + } + if (!missing_nodes_pool_.empty() && + *missing_nodes_pool_.begin() < tab_node_id) { + tab_node_id = *missing_nodes_pool_.begin(); + AddTabNode(tab_node_id); + } } AssociateTabNode(tab_node_id, tab_id); @@ -108,7 +120,13 @@ // This node was already associated with another tab. Free it. FreeTab(nodeid_it->second); } else { - // This is a new tab node. Add it before association. + // This is a new tab node. Add it before association. We also need to + // remember the "holes". + for (int missing_tab_node_id = max_used_tab_node_id_ + 1; + missing_tab_node_id < tab_node_id; ++missing_tab_node_id) { + missing_nodes_pool_.insert(missing_tab_node_id); + } + max_used_tab_node_id_ = std::max(max_used_tab_node_id_, tab_node_id); AddTabNode(tab_node_id); } @@ -128,15 +146,16 @@ // delete sync nodes till number reaches kFreeNodesLowWatermark. // Note: This logic is to mitigate temporary disassociation issues with old // clients: https://crbug.com/259918. Newer versions do not need this. - if (free_nodes_pool_.size() > kFreeNodesHighWatermark) { - for (std::set<int>::iterator free_it = free_nodes_pool_.begin(); - free_it != free_nodes_pool_.end();) { - deleted_node_ids->insert(*free_it); - free_nodes_pool_.erase(free_it++); - if (free_nodes_pool_.size() <= kFreeNodesLowWatermark) { - return; - } - } + if (free_nodes_pool_.size() <= kFreeNodesHighWatermark) { + return; + } + + while (free_nodes_pool_.size() > kFreeNodesLowWatermark) { + // We delete the largest IDs first, to achieve more compaction. + const int tab_node_id = *free_nodes_pool_.rbegin(); + deleted_node_ids->insert(tab_node_id); + missing_nodes_pool_.insert(tab_node_id); + free_nodes_pool_.erase(tab_node_id); } } @@ -155,26 +174,6 @@ nodeid_tabid_map_.erase(it); } -// Clear tab pool. -void TabNodePool::Clear() { - free_nodes_pool_.clear(); - nodeid_tabid_map_.clear(); - tabid_nodeid_map_.clear(); - max_used_tab_node_id_ = kInvalidTabNodeID; -} - -size_t TabNodePool::Capacity() const { - return nodeid_tabid_map_.size() + free_nodes_pool_.size(); -} - -bool TabNodePool::Empty() const { - return free_nodes_pool_.empty(); -} - -bool TabNodePool::Full() { - return nodeid_tabid_map_.empty(); -} - std::set<int> TabNodePool::GetAllTabNodeIds() const { std::set<int> tab_node_ids = free_nodes_pool_; for (const auto& entry : nodeid_tabid_map_) {
diff --git a/components/sync_sessions/tab_node_pool.h b/components/sync_sessions/tab_node_pool.h index e36c84e8..ce79b63 100644 --- a/components/sync_sessions/tab_node_pool.h +++ b/components/sync_sessions/tab_node_pool.h
@@ -73,19 +73,6 @@ // when remote deletions are received. void DeleteTabNode(int tab_node_id); - // Clear tab pool. - void Clear(); - - // Return the number of tab nodes this client currently has allocated - // (including both free and associated nodes). - size_t Capacity() const; - - // Return empty status (all tab nodes are in use). - bool Empty() const; - - // Return full status (no tab nodes are in use). - bool Full(); - // Returns tab node IDs for all known (used or free) tab nodes. std::set<int> GetAllTabNodeIds() const; @@ -115,10 +102,14 @@ // The node ids for the set of free sync nodes. std::set<int> free_nodes_pool_; - // The maximum used tab_node id for a sync node. A new sync node will always - // be created with max_used_tab_node_id_ + 1. + // The maximum used tab_node id for a sync node. int max_used_tab_node_id_; + // Not actual tab nodes, but instead represent "holes", i.e. tab node IDs + // that are not used within the range [0..max_used_tab_node_id_). This + // allows AssociateWithFreeTabNode() to return a compact distribution of IDs. + std::set<int> missing_nodes_pool_; + DISALLOW_COPY_AND_ASSIGN(TabNodePool); };
diff --git a/components/sync_sessions/tab_node_pool_unittest.cc b/components/sync_sessions/tab_node_pool_unittest.cc index 4874331..dba46c3 100644 --- a/components/sync_sessions/tab_node_pool_unittest.cc +++ b/components/sync_sessions/tab_node_pool_unittest.cc
@@ -32,10 +32,12 @@ const int kTabNodeId1 = 10; const int kTabNodeId2 = 5; -const int kTabNodeId3 = 1000; -const SessionID kTabId1 = SessionID::FromSerializedValue(1); -const SessionID kTabId2 = SessionID::FromSerializedValue(2); -const SessionID kTabId3 = SessionID::FromSerializedValue(3); +const int kTabNodeId3 = 30; +const SessionID kTabId1 = SessionID::FromSerializedValue(1010); +const SessionID kTabId2 = SessionID::FromSerializedValue(1020); +const SessionID kTabId3 = SessionID::FromSerializedValue(1030); +const SessionID kTabId4 = SessionID::FromSerializedValue(1040); +const SessionID kTabId5 = SessionID::FromSerializedValue(1050); TEST_F(SyncTabNodePoolTest, TabNodeIdIncreases) { std::set<int> deleted_node_ids; @@ -50,7 +52,6 @@ // Freeing a tab node does not change max_used_tab_node_id_. pool_.FreeTab(kTabId3); pool_.CleanupTabNodes(&deleted_node_ids); - EXPECT_TRUE(deleted_node_ids.empty()); pool_.FreeTab(kTabId2); pool_.CleanupTabNodes(&deleted_node_ids); EXPECT_TRUE(deleted_node_ids.empty()); @@ -68,49 +69,33 @@ pool_.CleanupTabNodes(&deleted_node_ids); EXPECT_TRUE(deleted_node_ids.empty()); EXPECT_EQ(kTabNodeId3, GetMaxUsedTabNodeId()); - EXPECT_TRUE(pool_.Empty()); } TEST_F(SyncTabNodePoolTest, Reassociation) { // Reassociate tab node 1 with tab id 1. pool_.ReassociateTabNode(kTabNodeId1, kTabId1); - EXPECT_EQ(1U, pool_.Capacity()); - EXPECT_TRUE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); EXPECT_EQ(kTabId1, pool_.GetTabIdFromTabNodeId(kTabNodeId1)); EXPECT_FALSE(pool_.GetTabIdFromTabNodeId(kTabNodeId2).is_valid()); // Introduce a new tab node associated with the same tab. The old tab node // should get added to the free pool pool_.ReassociateTabNode(kTabNodeId2, kTabId1); - EXPECT_EQ(2U, pool_.Capacity()); - EXPECT_FALSE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); EXPECT_FALSE(pool_.GetTabIdFromTabNodeId(kTabNodeId1).is_valid()); EXPECT_EQ(kTabId1, pool_.GetTabIdFromTabNodeId(kTabNodeId2)); // Reassociating the same tab node/tab should have no effect. pool_.ReassociateTabNode(kTabNodeId2, kTabId1); - EXPECT_EQ(2U, pool_.Capacity()); - EXPECT_FALSE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); EXPECT_FALSE(pool_.GetTabIdFromTabNodeId(kTabNodeId1).is_valid()); EXPECT_EQ(kTabId1, pool_.GetTabIdFromTabNodeId(kTabNodeId2)); // Reassociating the new tab node with a new tab should just update the // association tables. pool_.ReassociateTabNode(kTabNodeId2, kTabId2); - EXPECT_EQ(2U, pool_.Capacity()); - EXPECT_FALSE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); EXPECT_FALSE(pool_.GetTabIdFromTabNodeId(kTabNodeId1).is_valid()); EXPECT_EQ(kTabId2, pool_.GetTabIdFromTabNodeId(kTabNodeId2)); // Reassociating the first tab node should make the pool empty. pool_.ReassociateTabNode(kTabNodeId1, kTabId1); - EXPECT_EQ(2U, pool_.Capacity()); - EXPECT_TRUE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); EXPECT_EQ(kTabId1, pool_.GetTabIdFromTabNodeId(kTabNodeId1)); EXPECT_EQ(kTabId2, pool_.GetTabIdFromTabNodeId(kTabNodeId2)); } @@ -119,55 +104,31 @@ std::set<int> deleted_node_ids; // Verify old tab nodes are reassociated correctly. - pool_.ReassociateTabNode(kTabNodeId1, kTabId1); - pool_.ReassociateTabNode(kTabNodeId2, kTabId2); - pool_.ReassociateTabNode(kTabNodeId3, kTabId3); - EXPECT_EQ(3u, pool_.Capacity()); - EXPECT_TRUE(pool_.Empty()); + pool_.ReassociateTabNode(/*tab_node_id=*/0, kTabId1); + pool_.ReassociateTabNode(/*tab_node_id=*/1, kTabId2); + pool_.ReassociateTabNode(/*tab_node_id=*/2, kTabId3); // Free tabs 2 and 3. pool_.FreeTab(kTabId2); pool_.FreeTab(kTabId3); - pool_.CleanupTabNodes(&deleted_node_ids); - EXPECT_TRUE(deleted_node_ids.empty()); - // Free node pool should have 2 and 3. - EXPECT_FALSE(pool_.Empty()); - EXPECT_EQ(3u, pool_.Capacity()); - // Free all nodes - pool_.FreeTab(kTabId1); - pool_.CleanupTabNodes(&deleted_node_ids); - EXPECT_TRUE(deleted_node_ids.empty()); - EXPECT_TRUE(pool_.Full()); + EXPECT_EQ(TabNodePool::kInvalidTabNodeID, + pool_.GetTabNodeIdFromTabId(kTabId2)); + EXPECT_EQ(TabNodePool::kInvalidTabNodeID, + pool_.GetTabNodeIdFromTabId(kTabId3)); + EXPECT_NE(TabNodePool::kInvalidTabNodeID, + pool_.GetTabNodeIdFromTabId(kTabId1)); - // Reassociate tab nodes. - std::vector<int> sync_ids; - for (int i = 1; i <= 3; ++i) { - const SessionID tab_id = SessionID::FromSerializedValue(i); - EXPECT_EQ(TabNodePool::kInvalidTabNodeID, - pool_.GetTabNodeIdFromTabId(tab_id)); - sync_ids.push_back(pool_.AssociateWithFreeTabNode(tab_id)); - } - - EXPECT_TRUE(pool_.Empty()); - EXPECT_THAT(sync_ids, - UnorderedElementsAre(kTabNodeId1, kTabNodeId2, kTabNodeId3)); -} - -TEST_F(SyncTabNodePoolTest, Init) { - EXPECT_TRUE(pool_.Empty()); - EXPECT_TRUE(pool_.Full()); + // Free node pool should have 1 (for kTabId2) and 2 (for kTabId3). + EXPECT_EQ(1, pool_.AssociateWithFreeTabNode(kTabId4)); + EXPECT_EQ(2, pool_.AssociateWithFreeTabNode(kTabId5)); } TEST_F(SyncTabNodePoolTest, AddGet) { AddFreeTabNodes({5, 10}); - EXPECT_EQ(2U, pool_.Capacity()); ASSERT_EQ(TabNodePool::kInvalidTabNodeID, pool_.GetTabNodeIdFromTabId(kTabId1)); EXPECT_EQ(5, pool_.AssociateWithFreeTabNode(kTabId1)); - EXPECT_FALSE(pool_.Empty()); - EXPECT_FALSE(pool_.Full()); - EXPECT_EQ(2U, pool_.Capacity()); ASSERT_EQ(TabNodePool::kInvalidTabNodeID, pool_.GetTabNodeIdFromTabId(kTabId2)); // 5 is now used, should return 10. @@ -210,12 +171,6 @@ EXPECT_TRUE(deleted_node_ids.empty()); } - // Except one node all nodes should be in FreeNode pool. - EXPECT_FALSE(pool_.Full()); - EXPECT_FALSE(pool_.Empty()); - // Total capacity = 1 Associated Node + kFreeNodesHighWatermark free node. - EXPECT_EQ(TabNodePool::kFreeNodesHighWatermark + 1, pool_.Capacity()); - // Freeing the last sync node should drop the free nodes to // kFreeNodesLowWatermark. pool_.FreeTab( @@ -224,9 +179,33 @@ EXPECT_EQ(TabNodePool::kFreeNodesHighWatermark + 1 - TabNodePool::kFreeNodesLowWatermark, deleted_node_ids.size()); - EXPECT_FALSE(pool_.Empty()); - EXPECT_TRUE(pool_.Full()); - EXPECT_EQ(TabNodePool::kFreeNodesLowWatermark, pool_.Capacity()); + // Make sure the highest ones are deleted. + EXPECT_EQ(0U, + deleted_node_ids.count(TabNodePool::kFreeNodesLowWatermark - 1)); + EXPECT_NE(0U, deleted_node_ids.count(TabNodePool::kFreeNodesLowWatermark)); + EXPECT_NE(0U, deleted_node_ids.count(TabNodePool::kFreeNodesHighWatermark)); +} + +TEST_F(SyncTabNodePoolTest, AssociateWithFreeTabNodesContiguous) { + pool_.ReassociateTabNode(/*tab_node_id=*/2, kTabId1); + EXPECT_EQ(0, pool_.AssociateWithFreeTabNode(kTabId2)); + EXPECT_EQ(1, pool_.AssociateWithFreeTabNode(kTabId3)); + // Tab node 2 is already used, so it should be skipped. + EXPECT_EQ(3, pool_.AssociateWithFreeTabNode(kTabId4)); +} + +// Tests that, when *both* a free tab node and a "hole" exists, +// AssociateWithFreeTabNode() returns the smallest of them. +TEST_F(SyncTabNodePoolTest, AssociateWithFreeTabNodeReturnsMinimum) { + // Set up the pool such that tab node 1 is freed, and nodes 0 and 2 are holes + // (missing). + pool_.ReassociateTabNode(/*tab_node_id=*/1, kTabId1); + pool_.ReassociateTabNode(/*tab_node_id=*/3, kTabId2); + pool_.FreeTab(kTabId1); + + EXPECT_EQ(0, pool_.AssociateWithFreeTabNode(kTabId3)); + EXPECT_EQ(1, pool_.AssociateWithFreeTabNode(kTabId4)); + EXPECT_EQ(2, pool_.AssociateWithFreeTabNode(kTabId5)); } } // namespace
diff --git a/components/viz/client/frame_eviction_manager.cc b/components/viz/client/frame_eviction_manager.cc index 6a9412e..1531d8c 100644 --- a/components/viz/client/frame_eviction_manager.cc +++ b/components/viz/client/frame_eviction_manager.cc
@@ -8,8 +8,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "base/memory/memory_coordinator_client_registry.h" -#include "base/memory/memory_coordinator_proxy.h" #include "base/memory/memory_pressure_listener.h" #include "base/memory/memory_pressure_monitor.h" #include "base/memory/shared_memory.h" @@ -28,6 +26,8 @@ return base::Singleton<FrameEvictionManager>::get(); } +FrameEvictionManager::~FrameEvictionManager() {} + void FrameEvictionManager::AddFrame(FrameEvictionManagerClient* frame, bool locked) { RemoveFrame(frame); @@ -74,39 +74,23 @@ size_t FrameEvictionManager::GetMaxNumberOfSavedFrames() const { int percentage = 100; - auto* memory_coordinator_proxy = base::MemoryCoordinatorProxy::GetInstance(); - if (memory_coordinator_proxy) { - switch (memory_coordinator_proxy->GetCurrentMemoryState()) { - case base::MemoryState::NORMAL: - percentage = 100; - break; - case base::MemoryState::THROTTLED: - percentage = kCriticalPressurePercentage; - break; - case base::MemoryState::SUSPENDED: - case base::MemoryState::UNKNOWN: - NOTREACHED(); - break; - } - } else { - base::MemoryPressureMonitor* monitor = base::MemoryPressureMonitor::Get(); + base::MemoryPressureMonitor* monitor = base::MemoryPressureMonitor::Get(); - if (!monitor) - return max_number_of_saved_frames_; + if (!monitor) + return max_number_of_saved_frames_; - // Until we have a global OnMemoryPressureChanged event we need to query the - // value from our specific pressure monitor. - switch (monitor->GetCurrentPressureLevel()) { - case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: - percentage = 100; - break; - case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: - percentage = kModeratePressurePercentage; - break; - case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: - percentage = kCriticalPressurePercentage; - break; - } + // Until we have a global OnMemoryPressureChanged event we need to query the + // value from our specific pressure monitor. + switch (monitor->GetCurrentPressureLevel()) { + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: + percentage = 100; + break; + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: + percentage = kModeratePressurePercentage; + break; + case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: + percentage = kCriticalPressurePercentage; + break; } size_t frames = (max_number_of_saved_frames_ * percentage) / 100; return std::max(static_cast<size_t>(1), frames); @@ -116,7 +100,6 @@ : memory_pressure_listener_(new base::MemoryPressureListener( base::Bind(&FrameEvictionManager::OnMemoryPressure, base::Unretained(this)))) { - base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); max_number_of_saved_frames_ = #if defined(OS_ANDROID) // If the amount of memory on the device is >= 3.5 GB, save up to 5 @@ -127,8 +110,6 @@ #endif } -FrameEvictionManager::~FrameEvictionManager() {} - void FrameEvictionManager::CullUnlockedFrames(size_t saved_frame_limit) { while (!unlocked_frames_.empty() && unlocked_frames_.size() + locked_frames_.size() > saved_frame_limit) { @@ -154,10 +135,6 @@ } } -void FrameEvictionManager::OnPurgeMemory() { - PurgeMemory(kCriticalPressurePercentage); -} - void FrameEvictionManager::PurgeMemory(int percentage) { int saved_frame_limit = max_number_of_saved_frames_; if (saved_frame_limit <= 1)
diff --git a/components/viz/client/frame_eviction_manager.h b/components/viz/client/frame_eviction_manager.h index 86486913..3307db3 100644 --- a/components/viz/client/frame_eviction_manager.h +++ b/components/viz/client/frame_eviction_manager.h
@@ -11,7 +11,6 @@ #include <map> #include "base/macros.h" -#include "base/memory/memory_coordinator_client.h" #include "base/memory/memory_pressure_listener.h" #include "base/memory/singleton.h" #include "components/viz/client/viz_client_export.h" @@ -30,8 +29,7 @@ // between a small set of tabs faster. The limit is a soft limit, because // clients can lock their frame to prevent it from being discarded, e.g. if the // tab is visible, or while capturing a screenshot. -class VIZ_CLIENT_EXPORT FrameEvictionManager - : public base::MemoryCoordinatorClient { +class VIZ_CLIENT_EXPORT FrameEvictionManager { public: static FrameEvictionManager* GetInstance(); @@ -57,10 +55,7 @@ private: FrameEvictionManager(); - ~FrameEvictionManager() override; - - // base::MemoryCoordinatorClient implementation: - void OnPurgeMemory() override; + ~FrameEvictionManager(); void CullUnlockedFrames(size_t saved_frame_limit);
diff --git a/content/app/strings/content_strings.grd b/content/app/strings/content_strings.grd index 79f5ebe..eacdf8f 100644 --- a/content/app/strings/content_strings.grd +++ b/content/app/strings/content_strings.grd
@@ -728,6 +728,10 @@ movie time scrubber </message> + <message name="IDS_AX_MEDIA_VOLUME_SLIDER_HELP" desc="Accessibility help description for volume slider"> + volume slider + </message> + <message name="IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP" desc="Accessibility help description for elapsed time display"> current time in seconds </message>
diff --git a/content/browser/DEPS b/content/browser/DEPS index 98aedad..0e28e43 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -114,7 +114,6 @@ "+third_party/blink/public/web/web_context_menu_data.h", "+third_party/blink/public/web/web_device_emulation_params.h", "+third_party/blink/public/web/web_drag_status.h", - "+third_party/blink/public/web/web_find_options.h", "+third_party/blink/public/web/web_fullscreen_options.h", "+third_party/blink/public/web/web_frame_serializer_cache_control_policy.h", "+third_party/blink/public/web/web_ime_text_span.h",
diff --git a/content/browser/background_fetch/background_fetch_data_manager_unittest.cc b/content/browser/background_fetch/background_fetch_data_manager_unittest.cc index 60f8021d..b84fd49 100644 --- a/content/browser/background_fetch/background_fetch_data_manager_unittest.cc +++ b/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
@@ -778,6 +778,71 @@ ASSERT_EQ(error, blink::mojom::BackgroundFetchError::QUOTA_EXCEEDED); } +TEST_F(BackgroundFetchDataManagerTest, RegistrationLimitIsEnforced) { + // Tests that the BackgroundFetchDataManager correctly rejects creating a + // registration when an origin exceeds the allowed number of registrations. + int64_t swid1 = RegisterServiceWorker(); + ASSERT_NE(blink::mojom::kInvalidServiceWorkerRegistrationId, swid1); + int64_t swid2 = RegisterServiceWorker(); + ASSERT_NE(blink::mojom::kInvalidServiceWorkerRegistrationId, swid2); + + ASSERT_NE(swid1, swid2); + + blink::mojom::BackgroundFetchError error; + + // Create two registrations for every Service Worker. + for (int i = 0; i < 2; i++) { + // First Service Worker. + BackgroundFetchRegistrationId registration_id1( + swid1, origin(), kExampleDeveloperId + base::IntToString(i), + base::GenerateGUID()); + CreateRegistration(registration_id1, + std::vector<ServiceWorkerFetchRequest>(), + BackgroundFetchOptions(), SkBitmap(), &error); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); + + // Second service Worker. + BackgroundFetchRegistrationId registration_id2( + swid2, origin(), kExampleDeveloperId + base::IntToString(i), + base::GenerateGUID()); + CreateRegistration(registration_id2, + std::vector<ServiceWorkerFetchRequest>(), + BackgroundFetchOptions(), SkBitmap(), &error); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); + } + + // Create another registration in the first Service Worker, + // bringing us to the limit. + { + BackgroundFetchRegistrationId registration_id( + swid1, origin(), "developer_id1", base::GenerateGUID()); + CreateRegistration(registration_id, + std::vector<ServiceWorkerFetchRequest>(), + BackgroundFetchOptions(), SkBitmap(), &error); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); + } + + // A registration this time should fail. + { + BackgroundFetchRegistrationId registration_id( + swid1, origin(), "developer_id2", base::GenerateGUID()); + CreateRegistration(registration_id, + std::vector<ServiceWorkerFetchRequest>(), + BackgroundFetchOptions(), SkBitmap(), &error); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::QUOTA_EXCEEDED); + } + + // The registration should also fail for the other Service Worker. + { + BackgroundFetchRegistrationId registration_id( + swid2, origin(), "developer_id3", base::GenerateGUID()); + CreateRegistration(registration_id, + std::vector<ServiceWorkerFetchRequest>(), + BackgroundFetchOptions(), SkBitmap(), &error); + ASSERT_EQ(error, blink::mojom::BackgroundFetchError::QUOTA_EXCEEDED); + } +} + TEST_F(BackgroundFetchDataManagerTest, GetDeveloperIds) { int64_t sw_id = RegisterServiceWorker(); ASSERT_NE(blink::mojom::kInvalidServiceWorkerRegistrationId, sw_id);
diff --git a/content/browser/background_fetch/background_fetch_service_unittest.cc b/content/browser/background_fetch/background_fetch_service_unittest.cc index 412d0b2..cd512d70 100644 --- a/content/browser/background_fetch/background_fetch_service_unittest.cc +++ b/content/browser/background_fetch/background_fetch_service_unittest.cc
@@ -184,7 +184,7 @@ base::BindOnce(&BackgroundFetchServiceTest::DidGetRegistration, base::Unretained(this), run_loop.QuitClosure(), out_error, out_registration)); - UnregisterServiceWorker(); + UnregisterServiceWorker(service_worker_registration_id); run_loop.Run(); }
diff --git a/content/browser/background_fetch/background_fetch_test_base.cc b/content/browser/background_fetch/background_fetch_test_base.cc index 136811637c..f09f7a3 100644 --- a/content/browser/background_fetch/background_fetch_test_base.cc +++ b/content/browser/background_fetch/background_fetch_test_base.cc
@@ -67,6 +67,10 @@ std::move(quit_closure).Run(); } +GURL GetPatternForId(int64_t id) { + return GURL(kTestOrigin + base::IntToString(id)); +} + } // namespace BackgroundFetchTestBase::BackgroundFetchTestBase() @@ -99,7 +103,7 @@ { blink::mojom::ServiceWorkerRegistrationOptions options; - options.scope = origin_.GetURL(); + options.scope = GetPatternForId(next_pattern_id_++); base::RunLoop run_loop; embedded_worker_test_helper_.context()->RegisterServiceWorker( script_url, options, @@ -142,10 +146,11 @@ return service_worker_registration_id; } -void BackgroundFetchTestBase::UnregisterServiceWorker() { +void BackgroundFetchTestBase::UnregisterServiceWorker( + int64_t service_worker_registration_id) { base::RunLoop run_loop; embedded_worker_test_helper_.context()->UnregisterServiceWorker( - origin_.GetURL(), + GetPatternForId(service_worker_registration_id), base::BindOnce(&DidUnregisterServiceWorker, run_loop.QuitClosure())); run_loop.Run(); }
diff --git a/content/browser/background_fetch/background_fetch_test_base.h b/content/browser/background_fetch/background_fetch_test_base.h index 7dc8ca23..4244b01 100644 --- a/content/browser/background_fetch/background_fetch_test_base.h +++ b/content/browser/background_fetch/background_fetch_test_base.h
@@ -47,7 +47,7 @@ // Unregisters the test Service Worker and verifies that the unregistration // succeeded. - void UnregisterServiceWorker(); + void UnregisterServiceWorker(int64_t service_worker_registration_id); // Creates a ServiceWorkerFetchRequest instance for the given details and // provides a faked |response|. @@ -93,6 +93,8 @@ StoragePartition* storage_partition_; + int next_pattern_id_ = 0; + // Vector of ServiceWorkerRegistration instances that have to be kept alive // for the lifetime of this test. std::vector<scoped_refptr<ServiceWorkerRegistration>>
diff --git a/content/browser/background_fetch/storage/create_metadata_task.cc b/content/browser/background_fetch/storage/create_metadata_task.cc index e569a8a..8695617 100644 --- a/content/browser/background_fetch/storage/create_metadata_task.cc +++ b/content/browser/background_fetch/storage/create_metadata_task.cc
@@ -4,8 +4,10 @@ #include "content/browser/background_fetch/storage/create_metadata_task.h" +#include <set> #include <utility> +#include "base/barrier_closure.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" @@ -19,6 +21,105 @@ namespace background_fetch { +namespace { + +// TODO(crbug.com/889401): Consider making this configurable by finch. +constexpr size_t kRegistrationLimitPerOrigin = 5u; + +// Finds the number of active registrations associated with the provided origin, +// and compares it with the limit to determine whether this registration can go +// through. +class CanCreateRegistrationTask : public DatabaseTask { + public: + using CanCreateRegistrationCallback = + base::OnceCallback<void(blink::mojom::BackgroundFetchError, bool)>; + + CanCreateRegistrationTask(DatabaseTaskHost* host, + const url::Origin& origin, + CanCreateRegistrationCallback callback) + : DatabaseTask(host), + origin_(origin), + callback_(std::move(callback)), + weak_factory_(this) {} + + ~CanCreateRegistrationTask() override = default; + + void Start() override { + service_worker_context()->GetRegistrationsForOrigin( + origin_, + base::BindOnce(&CanCreateRegistrationTask::DidGetRegistrationsForOrigin, + weak_factory_.GetWeakPtr())); + } + + private: + void DidGetRegistrationsForOrigin( + blink::ServiceWorkerStatusCode status, + const std::vector<scoped_refptr<ServiceWorkerRegistration>>& + registrations) { + switch (ToDatabaseStatus(status)) { + case DatabaseStatus::kOk: + break; + case DatabaseStatus::kNotFound: + FinishWithError(blink::mojom::BackgroundFetchError::NONE); + return; + case DatabaseStatus::kFailed: + FinishWithError(blink::mojom::BackgroundFetchError::STORAGE_ERROR); + return; + } + + std::set<int64_t> registration_ids; + for (const auto& registration : registrations) + registration_ids.insert(registration->id()); + + base::RepeatingClosure barrier_closure = base::BarrierClosure( + registration_ids.size(), + base::BindOnce(&CanCreateRegistrationTask::FinishWithError, + weak_factory_.GetWeakPtr(), + blink::mojom::BackgroundFetchError::NONE)); + + for (int64_t registration_id : registration_ids) { + service_worker_context()->GetRegistrationUserDataByKeyPrefix( + registration_id, kActiveRegistrationUniqueIdKeyPrefix, + base::BindOnce(&CanCreateRegistrationTask::DidGetActiveRegistrations, + weak_factory_.GetWeakPtr(), barrier_closure)); + } + } + + void DidGetActiveRegistrations(base::OnceClosure done_closure, + const std::vector<std::string>& data, + blink::ServiceWorkerStatusCode status) { + switch (ToDatabaseStatus(status)) { + case DatabaseStatus::kNotFound: + std::move(done_closure).Run(); + return; + case DatabaseStatus::kOk: + num_active_registrations_ += data.size(); + std::move(done_closure).Run(); + return; + case DatabaseStatus::kFailed: + FinishWithError(blink::mojom::BackgroundFetchError::STORAGE_ERROR); + return; + } + } + + void FinishWithError(blink::mojom::BackgroundFetchError error) override { + std::move(callback_).Run( + error, num_active_registrations_ < kRegistrationLimitPerOrigin); + Finished(); // Destroys |this|. + } + + url::Origin origin_; + CanCreateRegistrationCallback callback_; + + // The number of existing registrations found for |origin_|. + size_t num_active_registrations_ = 0u; + + base::WeakPtrFactory<CanCreateRegistrationTask> + weak_factory_; // Keep as last. +}; + +} // namespace + CreateMetadataTask::CreateMetadataTask( DatabaseTaskHost* host, const BackgroundFetchRegistrationId& registration_id, @@ -37,6 +138,29 @@ CreateMetadataTask::~CreateMetadataTask() = default; void CreateMetadataTask::Start() { + // Check if the registration can be created. + AddSubTask(std::make_unique<CanCreateRegistrationTask>( + this, registration_id_.origin(), + base::BindOnce(&CreateMetadataTask::DidGetCanCreateRegistration, + weak_factory_.GetWeakPtr()))); +} + +void CreateMetadataTask::DidGetCanCreateRegistration( + blink::mojom::BackgroundFetchError error, + bool can_create) { + if (error == blink::mojom::BackgroundFetchError::STORAGE_ERROR) { + SetStorageErrorAndFinish( + BackgroundFetchStorageError::kServiceWorkerStorageError); + return; + } + + DCHECK_EQ(error, blink::mojom::BackgroundFetchError::NONE); + if (!can_create) { + // TODO(crbug.com/889401): Report a more descriptive storage error. + FinishWithError(blink::mojom::BackgroundFetchError::QUOTA_EXCEEDED); + return; + } + // Check if there is enough quota to download the data first. if (options_.download_total > 0) { IsQuotaAvailable(registration_id_.origin(), options_.download_total,
diff --git a/content/browser/background_fetch/storage/create_metadata_task.h b/content/browser/background_fetch/storage/create_metadata_task.h index 3330762..af92aea 100644 --- a/content/browser/background_fetch/storage/create_metadata_task.h +++ b/content/browser/background_fetch/storage/create_metadata_task.h
@@ -40,6 +40,8 @@ void Start() override; private: + void DidGetCanCreateRegistration(blink::mojom::BackgroundFetchError error, + bool can_create); void DidGetIsQuotaAvailable(bool is_available); void GetRegistrationUniqueId();
diff --git a/content/browser/loader/cors_file_origin_browsertest.cc b/content/browser/loader/cors_file_origin_browsertest.cc index 2b0e7a60..5bcb94a 100644 --- a/content/browser/loader/cors_file_origin_browsertest.cc +++ b/content/browser/loader/cors_file_origin_browsertest.cc
@@ -263,17 +263,15 @@ EXPECT_FALSE(is_preflight_requested()); } -// --allow-file-access-from-files is currently not supported by OOR-CORS. -// We may remove the feature. INSTANTIATE_TEST_CASE_P( /* No test prefix */, CORSFileOriginBrowserTest, - ::testing::Values(false)); + ::testing::Values(false, true)); INSTANTIATE_TEST_CASE_P( /* No test prefix */, CORSFileOriginBrowserTestWithAllowFileAccessFromFiles, - ::testing::Values(false)); + ::testing::Values(false, true)); INSTANTIATE_TEST_CASE_P( /* No test prefix */,
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 65322cae..7318323b 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
@@ -20,7 +20,6 @@ #include "content/public/common/content_features.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/client/focus_client.h" -#include "ui/aura/client/screen_position_client.h" #include "ui/aura/scoped_keyboard_hook.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -65,19 +64,6 @@ } #endif // defined(OS_WIN) -gfx::PointF GetScreenLocationFromEvent(const ui::LocatedEvent& event) { - aura::Window* root = - static_cast<aura::Window*>(event.target())->GetRootWindow(); - aura::client::ScreenPositionClient* spc = - aura::client::GetScreenPositionClient(root); - if (!spc) - return event.root_location_f(); - - gfx::PointF screen_location(event.root_location_f()); - spc->ConvertPointToScreen(root, &screen_location); - return screen_location; -} - bool IsFractionalScaleFactor(float scale_factor) { return (scale_factor - static_cast<int>(scale_factor)) > 0; } @@ -363,8 +349,7 @@ } #endif blink::WebMouseWheelEvent mouse_wheel_event = - ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event), - base::Bind(&GetScreenLocationFromEvent)); + ui::MakeWebMouseWheelEvent(*event->AsMouseWheelEvent()); if (mouse_wheel_event.delta_x != 0 || mouse_wheel_event.delta_y != 0) { bool should_route_event = ShouldRouteEvent(event); @@ -390,8 +375,7 @@ if (event->type() == ui::ET_MOUSE_PRESSED) FinishImeCompositionSession(); - blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent( - *event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent(*event); ModifyEventMovementAndCoords(*event, &mouse_event); if (ShouldRouteEvent(event)) { host_->delegate()->GetInputEventRouter()->RouteMouseEvent( @@ -433,8 +417,8 @@ if (event->finger_count() != 2) return; #endif - blink::WebMouseWheelEvent mouse_wheel_event = ui::MakeWebMouseWheelEvent( - *event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseWheelEvent mouse_wheel_event = + ui::MakeWebMouseWheelEvent(*event); mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent( mouse_wheel_event, should_route_event); @@ -461,8 +445,7 @@ } } else if (event->type() == ui::ET_SCROLL_FLING_START || event->type() == ui::ET_SCROLL_FLING_CANCEL) { - blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent( - *event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent(*event); if (should_route_event) { host_->delegate()->GetInputEventRouter()->RouteGestureEvent( host_view_, &gesture_event, @@ -552,8 +535,7 @@ if (event->type() == ui::ET_GESTURE_TAP) FinishImeCompositionSession(); - blink::WebGestureEvent gesture = - ui::MakeWebGestureEvent(*event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebGestureEvent gesture = ui::MakeWebGestureEvent(*event); if (event->type() == ui::ET_GESTURE_TAP_DOWN) { // Webkit does not stop a fling-scroll on tap-down. So explicitly send an // event to stop any in-progress flings. @@ -741,8 +723,7 @@ if (event->type() == ui::ET_MOUSEWHEEL) { blink::WebMouseWheelEvent mouse_wheel_event = - ui::MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent&>(*event), - base::Bind(&GetScreenLocationFromEvent)); + ui::MakeWebMouseWheelEvent(*event->AsMouseWheelEvent()); if (mouse_wheel_event.delta_x != 0 || mouse_wheel_event.delta_y != 0) { if (ShouldRouteEvent(event)) { host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( @@ -764,8 +745,7 @@ return; } - blink::WebMouseEvent mouse_event = - ui::MakeWebMouseEvent(*event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent mouse_event = ui::MakeWebMouseEvent(*event); bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED ||
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index 09fa454..7809aa3d 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -745,6 +745,22 @@ context_core_->storage()->GetAllRegistrationsInfos(std::move(callback)); } +void ServiceWorkerContextWrapper::GetRegistrationsForOrigin( + const url::Origin& origin, + GetRegistrationsCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (!context_core_) { + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce( + std::move(callback), blink::ServiceWorkerStatusCode::kErrorAbort, + std::vector<scoped_refptr<ServiceWorkerRegistration>>())); + return; + } + context_core_->storage()->GetRegistrationsForOrigin(origin.GetURL(), + std::move(callback)); +} + void ServiceWorkerContextWrapper::GetRegistrationUserData( int64_t registration_id, const std::vector<std::string>& keys,
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h index 7766bd23..a137985 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.h +++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -31,6 +31,10 @@ class SpecialStoragePolicy; } +namespace url { +class Origin; +} // namespace url + namespace content { class BrowserContext; @@ -54,6 +58,8 @@ using BoolCallback = base::OnceCallback<void(bool)>; using FindRegistrationCallback = ServiceWorkerStorage::FindRegistrationCallback; + using GetRegistrationsCallback = + ServiceWorkerStorage::GetRegistrationsCallback; using GetRegistrationsInfosCallback = ServiceWorkerStorage::GetRegistrationsInfosCallback; using GetUserDataCallback = ServiceWorkerStorage::GetUserDataCallback; @@ -225,6 +231,8 @@ // All these methods must be called from the IO thread. void GetAllRegistrations(GetRegistrationsInfosCallback callback); + void GetRegistrationsForOrigin(const url::Origin& origin, + GetRegistrationsCallback callback); void GetRegistrationUserData(int64_t registration_id, const std::vector<std::string>& keys, GetUserDataCallback callback);
diff --git a/content/browser/tracing/background_tracing_manager_browsertest.cc b/content/browser/tracing/background_tracing_manager_browsertest.cc index 038ad8e5..9dd2cb9 100644 --- a/content/browser/tracing/background_tracing_manager_browsertest.cc +++ b/content/browser/tracing/background_tracing_manager_browsertest.cc
@@ -586,6 +586,18 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, MAYBE_ToggleBlinkScenarios) { { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + ASSERT_TRUE(command_line); + + // Early bailout in the case command line arguments have been explicitly set + // for the runner. + if (!command_line->GetSwitchValueASCII(switches::kEnableBlinkFeatures) + .empty() || + !command_line->GetSwitchValueASCII(switches::kDisableBlinkFeatures) + .empty()) { + return; + } + SetupBackgroundTracingManager(); base::RunLoop run_loop; @@ -619,10 +631,6 @@ BackgroundTracingManager::NO_DATA_FILTERING); EXPECT_TRUE(scenario_activated); - - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - EXPECT_TRUE(command_line); - EXPECT_EQ(command_line->GetSwitchValueASCII(switches::kEnableBlinkFeatures), "FasterWeb1,FasterWeb2"); EXPECT_EQ(
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 554cbc0f..1e794d78 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc
@@ -138,6 +138,8 @@ return IDS_AX_MEDIA_AUDIO_SLIDER_HELP; case WebLocalizedString::kAXMediaVideoSliderHelp: return IDS_AX_MEDIA_VIDEO_SLIDER_HELP; + case WebLocalizedString::kAXMediaVolumeSliderHelp: + return IDS_AX_MEDIA_VOLUME_SLIDER_HELP; case WebLocalizedString::kAXMediaCurrentTimeDisplayHelp: return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP; case WebLocalizedString::kAXMediaTimeRemainingDisplayHelp:
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index efe1fa0..21a52ff 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -468,8 +468,8 @@ deps += [ "//third_party/fuchsia-sdk:fdio", - "//third_party/fuchsia-sdk/sdk:fonts", - "//third_party/fuchsia-sdk/sdk:scenic", + "//third_party/fuchsia-sdk:fonts", + "//third_party/fuchsia-sdk:scenic", ] } }
diff --git a/content/common/DEPS b/content/common/DEPS index 0ba0e1f3..ba5997de 100644 --- a/content/common/DEPS +++ b/content/common/DEPS
@@ -67,7 +67,6 @@ "+third_party/blink/public/web/web_ax_enums.h", "+third_party/blink/public/web/web_device_emulation_params.h", "+third_party/blink/public/web/web_drag_status.h", - "+third_party/blink/public/web/web_find_options.h", "+third_party/blink/public/web/web_frame_owner_properties.h", "+third_party/blink/public/web/web_frame_serializer_cache_control_policy.h", "+third_party/blink/public/web/web_fullscreen_options.h",
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 5b4f16c..229d3192 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -68,7 +68,6 @@ #include "third_party/blink/public/platform/web_scroll_into_view_params.h" #include "third_party/blink/public/platform/web_scroll_types.h" #include "third_party/blink/public/platform/web_sudden_termination_disabler_type.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_frame_owner_properties.h" #include "third_party/blink/public/web/web_frame_serializer_cache_control_policy.h" #include "third_party/blink/public/web/web_fullscreen_options.h"
diff --git a/content/renderer/loader/web_url_loader_impl.cc b/content/renderer/loader/web_url_loader_impl.cc index c313497..576cfdf4 100644 --- a/content/renderer/loader/web_url_loader_impl.cc +++ b/content/renderer/loader/web_url_loader_impl.cc
@@ -644,10 +644,17 @@ resource_request->url = url_; resource_request->site_for_cookies = request.SiteForCookies(); resource_request->upgrade_if_insecure = request.UpgradeIfInsecure(); - resource_request->request_initiator = - request.RequestorOrigin().IsNull() - ? base::Optional<url::Origin>() - : base::Optional<url::Origin>(request.RequestorOrigin()); + if (!request.RequestorOrigin().IsNull()) { + if (request.RequestorOrigin().ToString() == "null") { + // "file:" origin is treated like an opaque unique origin when + // allow-file-access-from-files is not specified. Such origin is not + // opaque (i.e., IsOpaque() returns false) but still serializes to + // "null". + resource_request->request_initiator = url::Origin(); + } else { + resource_request->request_initiator = request.RequestorOrigin(); + } + } resource_request->referrer = referrer_url; resource_request->referrer_policy =
diff --git a/content/renderer/render_frame_impl_browsertest.cc b/content/renderer/render_frame_impl_browsertest.cc index fa714bd..00afebe 100644 --- a/content/renderer/render_frame_impl_browsertest.cc +++ b/content/renderer/render_frame_impl_browsertest.cc
@@ -476,9 +476,9 @@ // text finding, and then delete the frame immediately before the text finding // returns any text match. TEST_F(RenderFrameImplTest, NoCrashWhenDeletingFrameDuringFind) { - blink::WebFindOptions options; - options.force = true; - frame()->GetWebFrame()->Find(1, "foo", options, false); + frame()->GetWebFrame()->FindForTesting( + 1, "foo", true /* match_case */, true /* forward */, + false /* find_next */, true /* force */, false /* wrap_within_frame */); FrameMsg_Delete delete_message(0); frame()->OnMessageReceived(delete_message);
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index db1cf76..5723681 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -149,7 +149,6 @@ #include "services/ws/public/cpp/gpu/gpu.h" #include "services/ws/public/mojom/constants.mojom.h" #include "skia/ext/skia_memory_dump_provider.h" -#include "third_party/blink/public/platform/scheduler/child/webthread_base.h" #include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h" #include "third_party/blink/public/platform/web_cache.h" #include "third_party/blink/public/platform/web_image_generator.h" @@ -1172,10 +1171,10 @@ #if defined(OS_ANDROID) params.thread_options.priority = base::ThreadPriority::DISPLAY; #endif - compositor_thread_ = - blink::scheduler::WebThreadBase::CreateCompositorThread(params); - blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); - compositor_task_runner_ = compositor_thread_->GetTaskRunner(); + blink_platform_impl_->InitializeCompositorThread(params); + blink::WebThread* compositor_thread = + blink_platform_impl_->CompositorThread(); + compositor_task_runner_ = compositor_thread->GetTaskRunner(); compositor_task_runner_->PostTask( FROM_HERE, base::BindOnce(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), @@ -1183,7 +1182,7 @@ GetContentClient()->renderer()->PostCompositorThreadCreated( compositor_task_runner_.get()); #if defined(OS_LINUX) - render_message_filter()->SetThreadPriority(compositor_thread_->ThreadId(), + render_message_filter()->SetThreadPriority(compositor_thread->ThreadId(), base::ThreadPriority::DISPLAY); #endif }
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 42e4856dc3..62909b9 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -71,9 +71,6 @@ class SkBitmap; namespace blink { -namespace scheduler { -class WebThreadBase; -} class WebMediaStreamCenter; } @@ -316,6 +313,8 @@ return blink_platform_impl_.get(); } + // Returns the task runner on the compositor thread. + // // Will be null if threaded compositing has not been enabled. scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner() const { return compositor_task_runner_; @@ -651,9 +650,6 @@ // software-based. bool is_gpu_compositing_disabled_ = false; - // May be null if overridden by ContentRendererClient. - std::unique_ptr<blink::scheduler::WebThreadBase> compositor_thread_; - // Utility class to provide GPU functionalities to media. // TODO(dcastagna): This should be just one scoped_ptr once // http://crbug.com/580386 is fixed.
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 4c03b63..1e87b767 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -248,8 +248,6 @@ RenderThreadImpl::current() ? RenderThreadImpl::current()->GetIOTaskRunner() : nullptr), - compositor_thread_(nullptr), - main_thread_(main_thread_scheduler->CreateMainThread()), sudden_termination_disables_(0), is_locked_to_site_(false), default_task_runner_(main_thread_scheduler->DefaultTaskRunner()), @@ -382,16 +380,6 @@ return url_loader_factory; } -void RendererBlinkPlatformImpl::SetCompositorThread( - blink::scheduler::WebThreadBase* compositor_thread) { - // TODO(yutak): Compositor thread is currently owned by RenderThreadImpl, - // but should probably be owned by Platform so this wouldn't depend on - // WebThread. - compositor_thread_ = compositor_thread; - if (compositor_thread_) - RegisterExtraThreadToTLS(compositor_thread_); -} - blink::BlameContext* RendererBlinkPlatformImpl::GetTopLevelBlameContext() { return &top_level_blame_context_; } @@ -515,10 +503,6 @@ thread->GetRendererHost()->SuddenTerminationChanged(enabled); } -blink::WebThread* RendererBlinkPlatformImpl::CompositorThread() const { - return compositor_thread_; -} - std::unique_ptr<WebStorageNamespace> RendererBlinkPlatformImpl::CreateLocalStorageNamespace() { if (!local_storage_cached_areas_) {
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h index 5b62c65..960ed3a 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h
@@ -38,7 +38,6 @@ namespace blink { namespace scheduler { class WebThreadScheduler; -class WebThreadBase; } class WebCanvasCaptureHandler; class WebGraphicsContext3DProvider; @@ -102,7 +101,6 @@ const blink::WebString& cacheStorageCacheName) override; blink::WebString DefaultLocale() override; void SuddenTerminationChanged(bool enabled) override; - blink::WebThread* CompositorThread() const override; std::unique_ptr<blink::WebStorageNamespace> CreateLocalStorageNamespace() override; std::unique_ptr<blink::WebStorageNamespace> CreateSessionStorageNamespace( @@ -239,11 +237,6 @@ scoped_refptr<ChildURLLoaderFactoryBundle> CreateDefaultURLLoaderFactoryBundle(); - // This class does *not* own the compositor thread. It is the responsibility - // of the caller to ensure that the compositor thread is cleared before it is - // destructed. - void SetCompositorThread(blink::scheduler::WebThreadBase* compositor_thread); - PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory> CreateNetworkURLLoaderFactory(); @@ -267,9 +260,6 @@ // Return the mojo interface for making CodeCache calls. blink::mojom::CodeCacheHost& GetCodeCacheHost(); - blink::scheduler::WebThreadBase* compositor_thread_; - - std::unique_ptr<blink::WebThread> main_thread_; std::unique_ptr<service_manager::Connector> connector_; scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 361c05c..87fc4b1 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -343,7 +343,7 @@ "//components/crash/content/app:test_support", "//components/crash/content/browser", ] - deps += [ "//third_party/fuchsia-sdk/sdk:policy" ] + deps += [ "//third_party/fuchsia-sdk:policy" ] } # Annoyingly, this target and layouttest_support have circular includes.
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc index f05d6a79..8d3df86 100644 --- a/content/shell/test_runner/test_runner.cc +++ b/content/shell/test_runner/test_runner.cc
@@ -47,7 +47,6 @@ #include "third_party/blink/public/web/web_array_buffer_converter.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document_loader.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_local_frame.h"
diff --git a/content/shell/test_runner/test_runner_for_specific_view.cc b/content/shell/test_runner/test_runner_for_specific_view.cc index 8558f78..db2f338 100644 --- a/content/shell/test_runner/test_runner_for_specific_view.cc +++ b/content/shell/test_runner/test_runner_for_specific_view.cc
@@ -42,7 +42,6 @@ #include "third_party/blink/public/web/web_array_buffer.h" #include "third_party/blink/public/web/web_array_buffer_converter.h" #include "third_party/blink/public/web/web_document.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_input_element.h" @@ -613,28 +612,25 @@ bool TestRunnerForSpecificView::FindString( const std::string& search_text, const std::vector<std::string>& options_array) { - blink::WebFindOptions find_options; + bool match_case = true; + bool forward = true; + bool find_next = true; bool wrap_around = false; - find_options.match_case = true; - find_options.find_next = true; - for (const std::string& option : options_array) { if (option == "CaseInsensitive") - find_options.match_case = false; + match_case = false; else if (option == "Backwards") - find_options.forward = false; + forward = false; else if (option == "StartInSelection") - find_options.find_next = false; + find_next = false; else if (option == "WrapAround") wrap_around = true; } blink::WebLocalFrame* frame = GetLocalMainFrame(); - const bool find_result = - frame->Find(0, blink::WebString::FromUTF8(search_text), find_options, - wrap_around, nullptr); - frame->StopFindingForTesting( - blink::mojom::StopFindAction::kStopFindActionKeepSelection); + const bool find_result = frame->FindForTesting( + 0, blink::WebString::FromUTF8(search_text), match_case, forward, + find_next, false /* force */, wrap_around); return find_result; }
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc index e614e96..47d4309 100644 --- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc +++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -27,7 +27,6 @@ #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/permissions_data.h" #include "extensions/common/user_script.h" -#include "third_party/blink/public/web/web_find_options.h" using content::WebContents; using extensions::ExtensionResource;
diff --git a/extensions/browser/api/webcam_private/v4l2_webcam.cc b/extensions/browser/api/webcam_private/v4l2_webcam.cc index 532d85c..c7c7963 100644 --- a/extensions/browser/api/webcam_private/v4l2_webcam.cc +++ b/extensions/browser/api/webcam_private/v4l2_webcam.cc
@@ -163,6 +163,15 @@ callback.Run(success, value, min_value, max_value); } +void V4L2Webcam::GetFocus(const GetPTZCompleteCallback& callback) { + int value = 0; + int min_value = 0; + int max_value = 0; + bool success = GetWebcamParameter(fd_.get(), V4L2_CID_FOCUS_ABSOLUTE, &value, + &min_value, &max_value); + callback.Run(success, value, min_value, max_value); +} + void V4L2Webcam::SetPan(int value, int pan_speed, const SetPTZCompleteCallback& callback) { @@ -179,6 +188,16 @@ callback.Run(SetWebcamParameter(fd_.get(), V4L2_CID_ZOOM_ABSOLUTE, value)); } +void V4L2Webcam::SetFocus(int value, const SetPTZCompleteCallback& callback) { + callback.Run(SetWebcamParameter(fd_.get(), V4L2_CID_FOCUS_ABSOLUTE, value)); +} + +void V4L2Webcam::SetAutofocusState(AutofocusState state, + const SetPTZCompleteCallback& callback) { + const int value = (state == AUTOFOCUS_ON) ? 1 : 0; + callback.Run(SetWebcamParameter(fd_.get(), V4L2_CID_FOCUS_AUTO, value)); +} + void V4L2Webcam::SetPanDirection(PanDirection direction, int pan_speed, const SetPTZCompleteCallback& callback) {
diff --git a/extensions/browser/api/webcam_private/v4l2_webcam.h b/extensions/browser/api/webcam_private/v4l2_webcam.h index a09af69..78cc35e 100644 --- a/extensions/browser/api/webcam_private/v4l2_webcam.h +++ b/extensions/browser/api/webcam_private/v4l2_webcam.h
@@ -33,6 +33,7 @@ void GetPan(const GetPTZCompleteCallback& callback) override; void GetTilt(const GetPTZCompleteCallback& callback) override; void GetZoom(const GetPTZCompleteCallback& callback) override; + void GetFocus(const GetPTZCompleteCallback& callback) override; void SetPan(int value, int pan_speed, const SetPTZCompleteCallback& callback) override; @@ -50,6 +51,9 @@ bool tilt, bool zoom, const SetPTZCompleteCallback& callback) override; + void SetFocus(int value, const SetPTZCompleteCallback& callback) override; + void SetAutofocusState(AutofocusState state, + const SetPTZCompleteCallback& callback) override; const std::string device_id_; base::ScopedFD fd_;
diff --git a/extensions/browser/api/webcam_private/visca_webcam.cc b/extensions/browser/api/webcam_private/visca_webcam.cc index 96e5532..e4174e0d 100644 --- a/extensions/browser/api/webcam_private/visca_webcam.cc +++ b/extensions/browser/api/webcam_private/visca_webcam.cc
@@ -76,6 +76,24 @@ const char kSetZoomCommand[] = {0x81, 0x01, 0x04, 0x47, 0x00, 0x00, 0x00, 0x00, 0xFF}; +// Command: {0x8X, 0x01, 0x04, 0x38, 0x02, 0xFF}, X = 1 to 7: target device +// address. +const char kSetAutoFocusCommand[] = {0x81, 0x01, 0x04, 0x38, 0x02, 0xFF}; + +// Command: {0x8X, 0x01, 0x04, 0x38, 0x03, 0xFF}, X = 1 to 7: target device +// address. +const char kSetManualFocusCommand[] = {0x81, 0x01, 0x04, 0x38, 0x03, 0xFF}; + +// Command: {0x8X, 0x09, 0x04, 0x48, 0xFF}, X = 1 to 7: target device address. +// Response: {0xY0, 0x50, 0x0p, 0x0q, 0x0r, 0x0s, 0xFF}, Y = socket number; +// pqrs: focus position. +const char kGetFocusCommand[] = {0x81, 0x09, 0x04, 0x48, 0xFF}; + +// Command: {0x8X, 0x01, 0x04, 0x48, 0x0p, 0x0q, 0x0r, 0x0s, 0xFF}, X = 1 to 7: +// target device address; pqrs: focus position; +const char kSetFocusCommand[] = {0x81, 0x01, 0x04, 0x48, 0x00, + 0x00, 0x00, 0x00, 0xFF}; + // Command: {0x8X, 0x01, 0x06, 0x01, 0x0p, 0x0t, 0x03, 0x01, 0xFF}, X = 1 to 7: // target device address; p: pan speed; t: tilt speed. const char kPTUpCommand[] = {0x81, 0x01, 0x06, 0x01, 0x00, @@ -350,6 +368,9 @@ case INQUIRY_ZOOM: is_valid_response = CanBuildResponseInt(response, 2); break; + case INQUIRY_FOCUS: + is_valid_response = CanBuildResponseInt(response, 2); + break; } if (!is_valid_response) { callback.Run(false, 0 /* value */, 0 /* min_value */, 0 /* max_value */); @@ -373,6 +394,10 @@ // See kGetZoomCommand for the format of response. value = BuildResponseInt(response, 2); break; + case INQUIRY_FOCUS: + // See kGetFocusCommand for the format of response. + value = BuildResponseInt(response, 2); + break; } // TODO(pbos): Add support for valid ranges. callback.Run(true, value, 0, 0); @@ -418,6 +443,12 @@ weak_ptr_factory_.GetWeakPtr(), INQUIRY_ZOOM, callback)); } +void ViscaWebcam::GetFocus(const GetPTZCompleteCallback& callback) { + Send(CHAR_VECTOR_FROM_ARRAY(kGetFocusCommand), + base::Bind(&ViscaWebcam::OnInquiryCompleted, + weak_ptr_factory_.GetWeakPtr(), INQUIRY_FOCUS, callback)); +} + void ViscaWebcam::SetPan(int value, int pan_speed, const SetPTZCompleteCallback& callback) { @@ -458,6 +489,26 @@ weak_ptr_factory_.GetWeakPtr(), callback)); } +void ViscaWebcam::SetFocus(int value, const SetPTZCompleteCallback& callback) { + int actual_value = std::max(value, 0); + std::vector<char> command = CHAR_VECTOR_FROM_ARRAY(kSetFocusCommand); + ResponseToCommand(&command, 4, actual_value); + Send(command, base::Bind(&ViscaWebcam::OnCommandCompleted, + weak_ptr_factory_.GetWeakPtr(), callback)); +} + +void ViscaWebcam::SetAutofocusState(AutofocusState state, + const SetPTZCompleteCallback& callback) { + std::vector<char> command; + if (state == AUTOFOCUS_ON) { + command = CHAR_VECTOR_FROM_ARRAY(kSetAutoFocusCommand); + } else { + command = CHAR_VECTOR_FROM_ARRAY(kSetManualFocusCommand); + } + Send(command, base::Bind(&ViscaWebcam::OnCommandCompleted, + weak_ptr_factory_.GetWeakPtr(), callback)); +} + void ViscaWebcam::SetPanDirection(PanDirection direction, int pan_speed, const SetPTZCompleteCallback& callback) {
diff --git a/extensions/browser/api/webcam_private/visca_webcam.h b/extensions/browser/api/webcam_private/visca_webcam.h index d36e909..2c4b287 100644 --- a/extensions/browser/api/webcam_private/visca_webcam.h +++ b/extensions/browser/api/webcam_private/visca_webcam.h
@@ -37,6 +37,7 @@ INQUIRY_PAN, INQUIRY_TILT, INQUIRY_ZOOM, + INQUIRY_FOCUS, }; using CommandCompleteCallback = @@ -98,6 +99,7 @@ void GetPan(const GetPTZCompleteCallback& callback) override; void GetTilt(const GetPTZCompleteCallback& callback) override; void GetZoom(const GetPTZCompleteCallback& callback) override; + void GetFocus(const GetPTZCompleteCallback& callback) override; void SetPan(int value, int pan_speed, const SetPTZCompleteCallback& callback) override; @@ -115,6 +117,9 @@ bool tilt, bool zoom, const SetPTZCompleteCallback& callback) override; + void SetFocus(int value, const SetPTZCompleteCallback& callback) override; + void SetAutofocusState(AutofocusState state, + const SetPTZCompleteCallback& callback) override; // Used only in unit tests in place of Open(). void OpenForTesting(std::unique_ptr<SerialConnection> serial_connection);
diff --git a/extensions/browser/api/webcam_private/webcam.h b/extensions/browser/api/webcam_private/webcam.h index d008a93..87e0bec 100644 --- a/extensions/browser/api/webcam_private/webcam.h +++ b/extensions/browser/api/webcam_private/webcam.h
@@ -29,6 +29,11 @@ TILT_STOP, }; + enum AutofocusState { + AUTOFOCUS_ON, + AUTOFOCUS_OFF, + }; + Webcam(); using GetPTZCompleteCallback = base::Callback< @@ -38,6 +43,7 @@ virtual void GetPan(const GetPTZCompleteCallback& callback) = 0; virtual void GetTilt(const GetPTZCompleteCallback& callback) = 0; virtual void GetZoom(const GetPTZCompleteCallback& callback) = 0; + virtual void GetFocus(const GetPTZCompleteCallback& callback) = 0; virtual void SetPan(int value, int pan_speed, const SetPTZCompleteCallback& callback) = 0; @@ -51,6 +57,9 @@ virtual void SetTiltDirection(TiltDirection direction, int tilt_speed, const SetPTZCompleteCallback& callback) = 0; + virtual void SetFocus(int value, const SetPTZCompleteCallback& callback) = 0; + virtual void SetAutofocusState(AutofocusState state, + const SetPTZCompleteCallback& callback) = 0; virtual void Reset(bool pan, bool tilt, bool zoom,
diff --git a/extensions/browser/api/webcam_private/webcam_private_api.h b/extensions/browser/api/webcam_private/webcam_private_api.h index 4d5b95f..019a905 100644 --- a/extensions/browser/api/webcam_private/webcam_private_api.h +++ b/extensions/browser/api/webcam_private/webcam_private_api.h
@@ -150,6 +150,12 @@ INQUIRY_PAN, INQUIRY_TILT, INQUIRY_ZOOM, + INQUIRY_FOCUS, + }; + + enum AutofocusState { + AUTOFOCUSSTATE_ON, + AUTOFOCUSSTATE_OFF, }; void OnGetWebcamParameters(InquiryType type, @@ -167,9 +173,13 @@ int min_zoom_; int max_zoom_; int zoom_; + int min_focus_; + int max_focus_; + int focus_; bool get_pan_; bool get_tilt_; bool get_zoom_; + bool get_focus_; bool success_; DISALLOW_COPY_AND_ASSIGN(WebcamPrivateGetFunction);
diff --git a/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc b/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc index de2ee8b..ee5aab8 100644 --- a/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc +++ b/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc
@@ -313,6 +313,31 @@ base::Bind(&WebcamPrivateSetFunction::OnSetWebcamParameters, this)); } + if (params->config.autofocus_state) { + Webcam::AutofocusState state = Webcam::AUTOFOCUS_ON; + switch (params->config.autofocus_state) { + case webcam_private::AUTOFOCUS_STATE_NONE: + case webcam_private::AUTOFOCUS_STATE_OFF: + state = Webcam::AUTOFOCUS_OFF; + break; + + case webcam_private::AUTOFOCUS_STATE_ON: + state = Webcam::AUTOFOCUS_ON; + break; + } + ++pending_num_set_webcam_param_requests_; + webcam->SetAutofocusState( + state, + base::Bind(&WebcamPrivateSetFunction::OnSetWebcamParameters, this)); + } + + if (params->config.focus) { + ++pending_num_set_webcam_param_requests_; + webcam->SetFocus( + *(params->config.focus), + base::Bind(&WebcamPrivateSetFunction::OnSetWebcamParameters, this)); + } + if (pending_num_set_webcam_param_requests_ == 0) return AlreadyResponded(); @@ -338,9 +363,13 @@ min_zoom_(0), max_zoom_(0), zoom_(0), + min_focus_(0), + max_focus_(0), + focus_(0), get_pan_(false), get_tilt_(false), get_zoom_(false), + get_focus_(false), success_(true) {} WebcamPrivateGetFunction::~WebcamPrivateGetFunction() { @@ -362,6 +391,8 @@ this, INQUIRY_TILT)); webcam->GetZoom(base::Bind(&WebcamPrivateGetFunction::OnGetWebcamParameters, this, INQUIRY_ZOOM)); + webcam->GetFocus(base::Bind(&WebcamPrivateGetFunction::OnGetWebcamParameters, + this, INQUIRY_FOCUS)); // We might have already responded through OnGetWebcamParameters(). return did_respond() ? AlreadyResponded() : RespondLater(); @@ -398,8 +429,14 @@ zoom_ = value; get_zoom_ = true; break; + case INQUIRY_FOCUS: + min_focus_ = min_value; + max_focus_ = max_value; + focus_ = value; + get_focus_ = true; + break; } - if (get_pan_ && get_tilt_ && get_zoom_) { + if (get_pan_ && get_tilt_ && get_zoom_ && get_focus_) { webcam_private::WebcamCurrentConfiguration result; if (min_pan_ != max_pan_) { result.pan_range = std::make_unique<webcam_private::Range>(); @@ -416,10 +453,16 @@ result.zoom_range->min = min_zoom_; result.zoom_range->max = max_zoom_; } + if (min_focus_ != max_focus_) { + result.focus_range = std::make_unique<webcam_private::Range>(); + result.focus_range->min = min_focus_; + result.focus_range->max = max_focus_; + } result.pan = pan_; result.tilt = tilt_; result.zoom = zoom_; + result.focus = focus_; Respond(OneArgument(result.ToValue())); } }
diff --git a/extensions/common/api/webcam_private.idl b/extensions/common/api/webcam_private.idl index 3f5e11c..a1839ce 100644 --- a/extensions/common/api/webcam_private.idl +++ b/extensions/common/api/webcam_private.idl
@@ -7,6 +7,7 @@ enum PanDirection { stop, right, left }; enum TiltDirection { stop, up, down }; enum Protocol { visca }; + enum AutofocusState { on, off }; dictionary ProtocolConfiguration { Protocol? protocol; @@ -20,6 +21,8 @@ double? tiltSpeed; TiltDirection? tiltDirection; double? zoom; + AutofocusState? autofocusState; + double? focus; }; dictionary Range { double min; double max; }; @@ -28,11 +31,13 @@ double pan; double tilt; double zoom; + double focus; // Supported range of pan, tilt and zoom values. Range? panRange; Range? tiltRange; Range? zoomRange; + Range? focusRange; }; callback WebcamIdCallback = void(DOMString webcamId);
diff --git a/extensions/renderer/object_backed_native_handler.cc b/extensions/renderer/object_backed_native_handler.cc index 9242b20..8784a77 100644 --- a/extensions/renderer/object_backed_native_handler.cc +++ b/extensions/renderer/object_backed_native_handler.cc
@@ -51,7 +51,8 @@ DCHECK_EQ(kInitialized, init_state_) << "Initialize() must be called before a new instance is created!"; return v8::Local<v8::ObjectTemplate>::New(GetIsolate(), object_template_) - ->NewInstance(); + ->NewInstance(GetIsolate()->GetCurrentContext()) + .ToLocalChecked(); } // static
diff --git a/infra/config/global/luci-milo.cfg b/infra/config/global/luci-milo.cfg index 878d0e3..21f40ed 100644 --- a/infra/config/global/luci-milo.cfg +++ b/infra/config/global/luci-milo.cfg
@@ -3869,209 +3869,108 @@ manifest_name: "REVISION" builders { name: "buildbot/chromium.webrtc.fyi/Android Builder (dbg)" - name: "buildbucket/luci.webrtc.ci/Android Builder (dbg)" - category: "android|debug|builder" - short_name: "32" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Android Builder ARM64 (dbg)" - name: "buildbucket/luci.webrtc.ci/Android Builder ARM64 (dbg)" - category: "android|debug|builder" - short_name: "64" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Android Tests (dbg) (K Nexus5)" - name: "buildbucket/luci.webrtc.ci/Android Tests (dbg) (K Nexus5)" - category: "android|debug|tester" - short_name: "K" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Android Tests (dbg) (M Nexus5X)" - name: "buildbucket/luci.webrtc.ci/Android Tests (dbg) (M Nexus5X)" - category: "android|debug|tester" - short_name: "M" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Android Builder" - name: "buildbucket/luci.webrtc.ci/Android Builder" - category: "android|release" - short_name: "32" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Linux Builder (dbg)" - name: "buildbucket/luci.webrtc.ci/Linux Builder (dbg)" - category: "linux|debug" - short_name: "bld" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Linux Builder" - name: "buildbucket/luci.webrtc.ci/Linux Builder" - category: "linux|release" - short_name: "bld" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Linux Tester" - name: "buildbucket/luci.webrtc.ci/Linux Tester" - category: "linux|release" - short_name: "tst" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" - name: "buildbucket/luci.webrtc.ci/Mac Builder (dbg)" - category: "mac|debug" - short_name: "bld" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Mac Builder" - name: "buildbucket/luci.webrtc.ci/Mac Builder" - category: "mac|release" - short_name: "bld" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Mac Tester" - name: "buildbucket/luci.webrtc.ci/Mac Tester" - category: "mac|release" - short_name: "tst" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Win Builder (dbg)" - name: "buildbucket/luci.webrtc.ci/Win Builder (dbg)" - category: "win|debug" - short_name: "bld" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Win Builder" - name: "buildbucket/luci.webrtc.ci/Win Builder" - category: "win|release|builder" - short_name: "32" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Win10 Tester" - name: "buildbucket/luci.webrtc.ci/Win10 Tester" - category: "win|release|tester" - short_name: "10" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Win7 Tester" - name: "buildbucket/luci.webrtc.ci/Win7 Tester" - category: "win|release|tester" - short_name: "7" - } - builders { - name: "buildbot/chromium.webrtc.fyi/Win8 Tester" - name: "buildbucket/luci.webrtc.ci/Win8 Tester" - category: "win|release|tester" - short_name: "8" - } - builders { - name: "buildbot/chromium.webrtc.fyi/ios-device" - name: "buildbucket/luci.webrtc.ci/ios-device" - category: "ios" - short_name: "dev" - } - builders { - name: "buildbot/chromium.webrtc.fyi/ios-simulator" - name: "buildbucket/luci.webrtc.ci/ios-simulator" - category: "ios" - short_name: "sim" - } -} - -# TODO(crbug.com/877018): Graduate to chromium.webrtc.fyi once ready. -consoles { - header_id: "chromium" - id: "chromium.webrtc.fyi.experimental" - name: "WebRTC Chromium FYI" - repo_url: "https://webrtc.googlesource.com/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - - builders { name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder (dbg)" category: "android|debug|builder" short_name: "32" } builders { + name: "buildbot/chromium.webrtc.fyi/Android Builder ARM64 (dbg)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder ARM64 (dbg)" category: "android|debug|builder" short_name: "64" } builders { + name: "buildbot/chromium.webrtc.fyi/Android Tests (dbg) (K Nexus5)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Tests (dbg) (K Nexus5)" category: "android|debug|tester" short_name: "K" } builders { + name: "buildbot/chromium.webrtc.fyi/Android Tests (dbg) (M Nexus5X)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Tests (dbg) (M Nexus5X)" category: "android|debug|tester" short_name: "M" } builders { + name: "buildbot/chromium.webrtc.fyi/Android Builder" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Android Builder" category: "android|release" short_name: "32" } builders { + name: "buildbot/chromium.webrtc.fyi/Linux Builder (dbg)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder (dbg)" category: "linux|debug" short_name: "bld" } builders { + name: "buildbot/chromium.webrtc.fyi/Linux Builder" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Builder" category: "linux|release" short_name: "bld" } builders { + name: "buildbot/chromium.webrtc.fyi/Linux Tester" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Linux Tester" category: "linux|release" short_name: "tst" } builders { + name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Builder (dbg)" category: "mac|debug" short_name: "bld" } builders { + name: "buildbot/chromium.webrtc.fyi/Mac Builder" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Builder" category: "mac|release" short_name: "bld" } builders { + name: "buildbot/chromium.webrtc.fyi/Mac Tester" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Mac Tester" category: "mac|release" short_name: "tst" } builders { + name: "buildbot/chromium.webrtc.fyi/Win Builder (dbg)" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win Builder (dbg)" category: "win|debug" short_name: "bld" } builders { + name: "buildbot/chromium.webrtc.fyi/Win Builder" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win Builder" category: "win|release|builder" short_name: "32" } builders { + name: "buildbot/chromium.webrtc.fyi/Win10 Tester" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win10 Tester" category: "win|release|tester" short_name: "10" } builders { + name: "buildbot/chromium.webrtc.fyi/Win7 Tester" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win7 Tester" category: "win|release|tester" short_name: "7" } builders { + name: "buildbot/chromium.webrtc.fyi/Win8 Tester" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI Win8 Tester" category: "win|release|tester" short_name: "8" } builders { + name: "buildbot/chromium.webrtc.fyi/ios-device" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI ios-device" category: "ios" short_name: "dev" } builders { + name: "buildbot/chromium.webrtc.fyi/ios-simulator" name: "buildbucket/luci.chromium.webrtc.fyi/WebRTC Chromium FYI ios-simulator" category: "ios" short_name: "sim"
diff --git a/infra/config/global/luci-scheduler.cfg b/infra/config/global/luci-scheduler.cfg index edf463a..de6d2e6 100644 --- a/infra/config/global/luci-scheduler.cfg +++ b/infra/config/global/luci-scheduler.cfg
@@ -4660,7 +4660,7 @@ buildbucket: { server: "cr-buildbucket.appspot.com" bucket: "luci.chromium.webrtc.fyi" - builder: "WebRTC Chromium FYI Win8 Tester" + builder: "WebRTC Chromium FYI Win7 Tester" } }
diff --git a/ios/build/tools/convert_gn_xcodeproj.py b/ios/build/tools/convert_gn_xcodeproj.py index d4bb9e45..d40f4a3 100755 --- a/ios/build/tools/convert_gn_xcodeproj.py +++ b/ios/build/tools/convert_gn_xcodeproj.py
@@ -71,7 +71,7 @@ CopyFileIfChanged(temp_file.name, output_path) -def UpdateProductsProject(file_input, file_output, configurations): +def UpdateProductsProject(file_input, file_output, configurations, root_dir): """Update Xcode project to support multiple configurations. Args: @@ -113,9 +113,63 @@ for object_id in objects_to_remove: del project.objects[object_id] + AddMarkdownToProject(project, root_dir, json_data['rootObject']) + objects = collections.OrderedDict(sorted(project.objects.iteritems())) WriteXcodeProject(file_output, json.dumps(json_data)) +def AddMarkdownToProject(project, root_dir, root_object): + list_files_cmd = ['git', '-C', root_dir, 'ls-files', '*.md'] + paths = subprocess.check_output(list_files_cmd).splitlines() + ios_internal_dir = os.path.join(root_dir, 'ios_internal') + if os.path.exists(ios_internal_dir): + list_files_cmd = ['git', '-C', ios_internal_dir, 'ls-files', '*.md'] + ios_paths = subprocess.check_output(list_files_cmd).splitlines() + paths.extend(["ios_internal/" + path for path in ios_paths]) + for path in paths: + new_markdown_entry = { + "fileEncoding": "4", + "isa": "PBXFileReference", + "lastKnownFileType": "net.daringfireball.markdown", + "name": os.path.basename(path), + "path": path, + "sourceTree": "<group>" + } + new_markdown_entry_id = project.AddObject('sources', new_markdown_entry) + folder = GetFolderForPath(project, root_object, os.path.dirname(path)) + folder['children'].append(new_markdown_entry_id) + + +def GetFolderForPath(project, rootObject, path): + objects = project.objects + # 'Sources' is always the first child of + # project->rootObject->mainGroup->children. + root = objects[objects[objects[rootObject]['mainGroup']]['children'][0]] + if not path: + return root + for folder in path.split('/'): + children = root['children'] + new_root = None + for child in children: + if objects[child]['isa'] == 'PBXGroup' and \ + objects[child]['name'] == folder: + new_root = objects[child] + break + if not new_root: + # If the folder isn't found we could just cram it into the leaf existing + # folder, but that leads to folders with tons of README.md inside. + new_group = { + "children": [ + ], + "isa": "PBXGroup", + "name": folder, + "sourceTree": "<group>" + } + new_group_id = project.AddObject('sources', new_group) + children.append(new_group_id) + new_root = objects[new_group_id] + root = new_root + return root def DisableNewBuildSystem(output_dir): """Disables the new build system due to crbug.com/852522 """ @@ -129,7 +183,7 @@ WriteXcodeProject(xcwspacesharedsettings, json.dumps(json_data)) -def ConvertGnXcodeProject(input_dir, output_dir, configurations): +def ConvertGnXcodeProject(root_dir,input_dir, output_dir, configurations): '''Tweak the Xcode project generated by gn to support multiple configurations. The Xcode projects generated by "gn gen --ide" only supports a single @@ -149,7 +203,7 @@ products = os.path.join('products.xcodeproj', 'project.pbxproj') product_input = os.path.join(input_dir, products) product_output = os.path.join(output_dir, products) - UpdateProductsProject(product_input, product_output, configurations) + UpdateProductsProject(product_input, product_output, configurations, root_dir) # Copy all workspace. xcwspace = os.path.join('all.xcworkspace', 'contents.xcworkspacedata') @@ -181,6 +235,9 @@ parser.add_argument( '--add-config', dest='configurations', default=[], action='append', help='configuration to add to the Xcode project') + parser.add_argument( + '--root', type=os.path.abspath, + help='root directory of the project') args = parser.parse_args(args) if not os.path.isdir(args.input): @@ -197,7 +254,8 @@ sys.stderr.write('At least one configuration required, see --add-config.\n') return 1 - ConvertGnXcodeProject(args.input, args.output, args.configurations) + ConvertGnXcodeProject(args.root_dir, args.input, args.output, + args.configurations) if __name__ == '__main__': sys.exit(Main(sys.argv[1:]))
diff --git a/ios/build/tools/setup-gn.py b/ios/build/tools/setup-gn.py index c4a3ea4..a0d13c8e 100755 --- a/ios/build/tools/setup-gn.py +++ b/ios/build/tools/setup-gn.py
@@ -268,6 +268,7 @@ generator = GnGenerator(settings, 'Debug', 'iphonesimulator') generator.Generate(gn_path, root_dir, temp_path) convert_gn_xcodeproj.ConvertGnXcodeProject( + root_dir, os.path.join(temp_path), os.path.join(out_dir, 'build'), SUPPORTED_CONFIGS)
diff --git a/ios/chrome/browser/ui/autofill/BUILD.gn b/ios/chrome/browser/ui/autofill/BUILD.gn index 5b7b1f1..47e85cd 100644 --- a/ios/chrome/browser/ui/autofill/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/BUILD.gn
@@ -84,8 +84,6 @@ "//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/image_util", "//ios/chrome/browser/ui/infobars", - "//ios/chrome/browser/ui/infobars/resources:infobar_close", - "//ios/chrome/browser/ui/infobars/resources:infobar_shadow", "//ios/chrome/browser/ui/util", "//ios/chrome/common", "//ios/third_party/material_components_ios",
diff --git a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm index f5c519e..721b322 100644 --- a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm +++ b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm
@@ -32,14 +32,8 @@ namespace { -// Returns whether the UI Refresh Infobar will be used. -using ::IsRefreshInfobarEnabled; - // Returns the image for the infobar close button. UIImage* InfoBarCloseImage() { - if (!IsRefreshInfobarEnabled()) { - return [UIImage imageNamed:@"infobar_close"]; - } ui::ResourceBundle& resourceBundle = ui::ResourceBundle::GetSharedInstance(); return resourceBundle.GetNativeImageNamed(IDR_IOS_INFOBAR_CLOSE).ToUIImage(); }
diff --git a/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm b/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm index 424f7b4..02cced2d 100644 --- a/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm +++ b/ios/chrome/browser/ui/autofill/save_card_infobar_view.mm
@@ -63,9 +63,7 @@ // Returns the font for the infobar message. UIFont* InfoBarMessageFont() { - return IsRefreshInfobarEnabled() - ? [UIFont preferredFontForTextStyle:UIFontTextStyleBody] - : [MDCTypography subheadFont]; + return [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; } } // namespace @@ -200,20 +198,6 @@ id<LayoutGuideProvider> safeAreaLayoutGuide = SafeAreaLayoutGuideForView(self); - // The drop shadow is at the top of the view, placed outside of its bounds. - if (!IsRefreshInfobarEnabled()) { - UIImage* shadowImage = [UIImage imageNamed:@"infobar_shadow"]; - UIImageView* shadowView = [[UIImageView alloc] initWithImage:shadowImage]; - shadowView.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:shadowView]; - [NSLayoutConstraint activateConstraints:@[ - [self.leadingAnchor constraintEqualToAnchor:shadowView.leadingAnchor], - [self.trailingAnchor constraintEqualToAnchor:shadowView.trailingAnchor], - [self.topAnchor constraintEqualToAnchor:shadowView.topAnchor - constant:shadowView.image.size.height], - ]]; - } - // Add the icon. The icon is fixed to the top leading corner of the infobar. // |iconContainerView| is used here because the AutoLayout constraints for // UIImageView would get ignored otherwise. @@ -224,9 +208,7 @@ iconContainerView.translatesAutoresizingMaskIntoConstraints = NO; iconContainerView.clipsToBounds = YES; UIImageView* iconImageView = [[UIImageView alloc] initWithImage:self.icon]; - if (IsRefreshInfobarEnabled()) { - iconImageView.tintColor = UIColorFromRGB(kIconTintColor); - } + iconImageView.tintColor = UIColorFromRGB(kIconTintColor); [iconContainerView addSubview:iconImageView]; AddSameConstraints(iconContainerView, iconImageView); [self addSubview:iconContainerView]; @@ -284,9 +266,7 @@ // Add the close button. The close button is fixed to the trailing edge of the // infobar since it cannot expand. DCHECK(self.closeButtonImage); - UIButton* closeButton = - [UIButton buttonWithType:IsRefreshInfobarEnabled() ? UIButtonTypeSystem - : UIButtonTypeCustom]; + UIButton* closeButton = [UIButton buttonWithType:UIButtonTypeSystem]; closeButton.translatesAutoresizingMaskIntoConstraints = NO; [closeButton setImage:self.closeButtonImage forState:UIControlStateNormal]; closeButton.contentEdgeInsets = @@ -296,10 +276,8 @@ action:@selector(didTapClose) forControlEvents:UIControlEventTouchUpInside]; [closeButton setAccessibilityLabel:l10n_util::GetNSString(IDS_CLOSE)]; - if (IsRefreshInfobarEnabled()) { - closeButton.tintColor = [UIColor blackColor]; - closeButton.alpha = 0.20; - } + closeButton.tintColor = [UIColor blackColor]; + closeButton.alpha = 0.20; // Prevent the button from shrinking or expanding horizontally. [closeButton setContentCompressionResistancePriority:UILayoutPriorityRequired @@ -628,14 +606,11 @@ action:action forControlEvents:UIControlEventTouchUpInside]; [button setUnderlyingColorHint:[UIColor blackColor]]; - - if (IsRefreshInfobarEnabled()) { - button.uppercaseTitle = NO; - button.layer.cornerRadius = kButtonCornerRadius; - [button - setTitleFont:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] - forState:UIControlStateNormal]; - } + button.uppercaseTitle = NO; + button.layer.cornerRadius = kButtonCornerRadius; + [button + setTitleFont:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] + forState:UIControlStateNormal]; if (palette) { button.hasOpaqueBackground = YES;
diff --git a/ios/chrome/browser/ui/download/BUILD.gn b/ios/chrome/browser/ui/download/BUILD.gn index 62507e26..5c310dc 100644 --- a/ios/chrome/browser/ui/download/BUILD.gn +++ b/ios/chrome/browser/ui/download/BUILD.gn
@@ -26,6 +26,7 @@ "resources:background_compact", "resources:background_regular", "resources:done_badge", + "resources:download_close", "resources:error_badge", "//base", "//components/infobars/core",
diff --git a/ios/chrome/browser/ui/download/download_manager_view_controller.mm b/ios/chrome/browser/ui/download/download_manager_view_controller.mm index e166ffa..e99824c 100644 --- a/ios/chrome/browser/ui/download/download_manager_view_controller.mm +++ b/ios/chrome/browser/ui/download/download_manager_view_controller.mm
@@ -419,8 +419,7 @@ _closeButton.exclusiveTouch = YES; _closeButton.accessibilityLabel = l10n_util::GetNSString(IDS_CLOSE); - // TODO(crbug.com/228611): Add IDR_ constant and use GetNativeImageNamed(). - UIImage* image = [UIImage imageNamed:@"infobar_close"]; + UIImage* image = [UIImage imageNamed:@"download_close"]; [_closeButton setImage:image forState:UIControlStateNormal]; [_closeButton addTarget:self
diff --git a/ios/chrome/browser/ui/download/resources/BUILD.gn b/ios/chrome/browser/ui/download/resources/BUILD.gn index 251aa8e7..1114401 100644 --- a/ios/chrome/browser/ui/download/resources/BUILD.gn +++ b/ios/chrome/browser/ui/download/resources/BUILD.gn
@@ -30,7 +30,14 @@ "done_badge.imageset/done_badge@3x.png", ] } - +imageset("download_close") { + sources = [ + "download_close.imageset/Contents.json", + "download_close.imageset/download_close.png", + "download_close.imageset/download_close@2x.png", + "download_close.imageset/download_close@3x.png", + ] +} imageset("error_badge") { sources = [ "error_badge.imageset/Contents.json",
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/Contents.json b/ios/chrome/browser/ui/download/resources/download_close.imageset/Contents.json similarity index 70% rename from ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/Contents.json rename to ios/chrome/browser/ui/download/resources/download_close.imageset/Contents.json index 2deb035b..21e8fb2 100644 --- a/ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/Contents.json +++ b/ios/chrome/browser/ui/download/resources/download_close.imageset/Contents.json
@@ -3,17 +3,17 @@ { "idiom": "universal", "scale": "1x", - "filename": "infobar_close.png" + "filename": "download_close.png" }, { "idiom": "universal", "scale": "2x", - "filename": "infobar_close@2x.png" + "filename": "download_close@2x.png" }, { "idiom": "universal", "scale": "3x", - "filename": "infobar_close@3x.png" + "filename": "download_close@3x.png" } ], "info": {
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close.png b/ios/chrome/browser/ui/download/resources/download_close.imageset/download_close.png similarity index 100% rename from ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close.png rename to ios/chrome/browser/ui/download/resources/download_close.imageset/download_close.png Binary files differ
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close@2x.png b/ios/chrome/browser/ui/download/resources/download_close.imageset/download_close@2x.png similarity index 100% rename from ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close@2x.png rename to ios/chrome/browser/ui/download/resources/download_close.imageset/download_close@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close@3x.png b/ios/chrome/browser/ui/download/resources/download_close.imageset/download_close@3x.png similarity index 100% rename from ios/chrome/browser/ui/infobars/resources/infobar_close.imageset/infobar_close@3x.png rename to ios/chrome/browser/ui/download/resources/download_close.imageset/download_close@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/infobars/BUILD.gn b/ios/chrome/browser/ui/infobars/BUILD.gn index d04797a0..e52fd886 100644 --- a/ios/chrome/browser/ui/infobars/BUILD.gn +++ b/ios/chrome/browser/ui/infobars/BUILD.gn
@@ -13,10 +13,8 @@ "infobar_view_sizing_delegate.h", ] deps = [ - "resources:infobar_close", "resources:infobar_downloading", "resources:infobar_popup_blocker", - "resources:infobar_shadow", "resources:infobar_warning", "//base", "//base:i18n",
diff --git a/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm b/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm index 3c713d9..6262707 100644 --- a/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm +++ b/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm
@@ -59,33 +59,7 @@ CGFloat horizontal_space_between_icon_and_text; }; -// This defines the layout metrics for Chrome iOS legacy UI. -// Some layout metrics defined as constants are inter-related. -const CGFloat kCloseButtonInnerPadding = 16.0; -const CGFloat kButtonsMarginTop = kCloseButtonInnerPadding; -const CGFloat kLabelMarginTop = kButtonsMarginTop + 5.0; // Baseline lowered. -const LayoutMetrics kLayoutMetricsLegacy = { - 20.0, // left_margin_on_first_line_when_icon_absent - 30.0, // minimum_space_between_right_and_left_aligned_widgets - 10.0, // right_margin - 10.0, // space_between_widgets - kCloseButtonInnerPadding, - 36.0, // button_height - 16.0, // button_margin - 8.0, // extra_button_margin_on_single_line - 8.0, // button_spacing - 8.0, // button_width_units - kButtonsMarginTop, - 16.0, // close_button_margin_left - 5.0, // label_line_spacing - 22.0, // label_margin_bottom - 8.0, // extra_margin_between_label_and_button - kLabelMarginTop, - 68.0, // minimum_infobar_height - 16.0 // horizontal_space_between_icon_and_text -}; - -const LayoutMetrics kLayoutMetricsPhase1 = { +const LayoutMetrics kLayoutMetrics = { 20.0, // left_margin_on_first_line_when_icon_absent 30.0, // minimum_space_between_right_and_left_aligned_widgets 10.0, // right_margin @@ -106,12 +80,6 @@ 16.0 // horizontal_space_between_icon_and_text }; -// Returns the layout metrics data structure. Returned value is never nil. -const LayoutMetrics* InfoBarLayoutMetrics() { - return IsRefreshInfobarEnabled() ? &kLayoutMetricsPhase1 - : &kLayoutMetricsLegacy; -} - // Color in RGB to be used as background of secondary actions button. const int kButton2TitleColor = 0x4285f4; // Corner radius for action buttons. @@ -123,30 +91,22 @@ // Returns the font for the Infobar's main body text. UIFont* InfoBarLabelFont() { - return IsRefreshInfobarEnabled() - ? [UIFont preferredFontForTextStyle:UIFontTextStyleBody] - : [MDCTypography subheadFont]; + return [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; } // Returns the font for the Infobar's toggle switch's (if one exists) body text. // This text label is usually of a slightly smaller font size relative to // InfoBarLabelFont(). UIFont* InfoBarSwitchLabelFont() { - return IsRefreshInfobarEnabled() - ? [UIFont preferredFontForTextStyle:UIFontTextStyleBody] - : [MDCTypography body1Font]; + return [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; } // Returns the font for the label on Infobar's action buttons. UIFont* InfoBarButtonLabelFont() { - DCHECK(IsRefreshInfobarEnabled()); return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; } UIImage* InfoBarCloseImage() { - if (!IsRefreshInfobarEnabled()) { - return [UIImage imageNamed:@"infobar_close"]; - } ui::ResourceBundle& resourceBundle = ui::ResourceBundle::GetSharedInstance(); return resourceBundle.GetNativeImageNamed(IDR_IOS_INFOBAR_CLOSE).ToUIImage(); } @@ -182,7 +142,7 @@ } - (id)initWithLabel:(NSString*)labelText isOn:(BOOL)isOn { - metrics_ = InfoBarLayoutMetrics(); + metrics_ = &kLayoutMetrics; // Creates switch and label. UILabel* tempLabel = [[UILabel alloc] initWithFrame:CGRectZero]; @@ -351,13 +311,7 @@ - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { - metrics_ = InfoBarLayoutMetrics(); - if (!IsRefreshInfobarEnabled()) { - // Make the drop shadow. - UIImage* shadowImage = [UIImage imageNamed:@"infobar_shadow"]; - shadow_ = [[UIImageView alloc] initWithImage:shadowImage]; - [self addSubview:shadow_]; - } + metrics_ = &kLayoutMetrics; [self setAccessibilityViewIsModal:YES]; } return self; @@ -777,9 +731,7 @@ action:(SEL)action { DCHECK(!closeButton_); UIImage* image = InfoBarCloseImage(); - closeButton_ = - [UIButton buttonWithType:IsRefreshInfobarEnabled() ? UIButtonTypeSystem - : UIButtonTypeCustom]; + closeButton_ = [UIButton buttonWithType:UIButtonTypeSystem]; [closeButton_ setExclusiveTouch:YES]; [closeButton_ setImage:image forState:UIControlStateNormal]; [closeButton_ addTarget:target @@ -787,10 +739,8 @@ forControlEvents:UIControlEventTouchUpInside]; [closeButton_ setTag:tag]; [closeButton_ setAccessibilityLabel:l10n_util::GetNSString(IDS_CLOSE)]; - if (IsRefreshInfobarEnabled()) { - closeButton_.tintColor = [UIColor blackColor]; - closeButton_.alpha = 0.20; - } + closeButton_.tintColor = [UIColor blackColor]; + closeButton_.alpha = 0.20; [self addSubview:closeButton_]; } @@ -809,9 +759,7 @@ [imageView_ removeFromSuperview]; } imageView_ = [[UIImageView alloc] initWithImage:image]; - if (IsRefreshInfobarEnabled()) { - imageView_.tintColor = UIColorFromRGB(kLeftIconTintColor); - } + imageView_.tintColor = UIColorFromRGB(kLeftIconTintColor); [self addSubview:imageView_]; } @@ -964,12 +912,9 @@ target:(id)target action:(SEL)action { MDCFlatButton* button = [[MDCFlatButton alloc] init]; - if (IsRefreshInfobarEnabled()) { - button.uppercaseTitle = NO; - button.layer.cornerRadius = kButtonCornerRadius; - [button setTitleFont:InfoBarButtonLabelFont() - forState:UIControlStateNormal]; - } + button.uppercaseTitle = NO; + button.layer.cornerRadius = kButtonCornerRadius; + [button setTitleFont:InfoBarButtonLabelFont() forState:UIControlStateNormal]; button.inkColor = [[palette tint300] colorWithAlphaComponent:0.5f]; [button setBackgroundColor:[palette tint500] forState:UIControlStateNormal]; [button setBackgroundColor:[UIColor colorWithWhite:0.8f alpha:1.0f]
diff --git a/ios/chrome/browser/ui/infobars/resources/BUILD.gn b/ios/chrome/browser/ui/infobars/resources/BUILD.gn index c060f75..282f2767 100644 --- a/ios/chrome/browser/ui/infobars/resources/BUILD.gn +++ b/ios/chrome/browser/ui/infobars/resources/BUILD.gn
@@ -22,23 +22,6 @@ ] } -imageset("infobar_shadow") { - sources = [ - "infobar_shadow.imageset/Contents.json", - "infobar_shadow.imageset/infobar_shadow.png", - "infobar_shadow.imageset/infobar_shadow@2x.png", - ] -} - -imageset("infobar_close") { - sources = [ - "infobar_close.imageset/Contents.json", - "infobar_close.imageset/infobar_close.png", - "infobar_close.imageset/infobar_close@2x.png", - "infobar_close.imageset/infobar_close@3x.png", - ] -} - imageset("infobar_popup_blocker") { sources = [ "infobar_popup_blocker.imageset/Contents.json",
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/Contents.json b/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/Contents.json deleted file mode 100644 index 21f76d4..0000000 --- a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/Contents.json +++ /dev/null
@@ -1,18 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x", - "filename": "infobar_shadow.png" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "infobar_shadow@2x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow.png b/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow.png deleted file mode 100644 index f560d17..0000000 --- a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow@2x.png b/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow@2x.png deleted file mode 100644 index 41d5ce1..0000000 --- a/ios/chrome/browser/ui/infobars/resources/infobar_shadow.imageset/infobar_shadow@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/ui_util.h b/ios/chrome/browser/ui/ui_util.h index 2d7f761f..c54a28e 100644 --- a/ios/chrome/browser/ui/ui_util.h +++ b/ios/chrome/browser/ui/ui_util.h
@@ -39,10 +39,6 @@ // Returns true if the device is an iPhone X. bool IsIPhoneX(); -// Returns whether the UI Refresh Infobar will be used. -// TODO (crbug.com/884722): Remove all use of this flag. -bool IsRefreshInfobarEnabled(); - // Returns whether the UI Refresh Location Bar will be used. // TODO (crbug.com/884723): Remove all use of this flag. bool IsRefreshLocationBarEnabled();
diff --git a/ios/chrome/browser/ui/ui_util.mm b/ios/chrome/browser/ui/ui_util.mm index e4f8d46..1001f6f0 100644 --- a/ios/chrome/browser/ui/ui_util.mm +++ b/ios/chrome/browser/ui/ui_util.mm
@@ -58,10 +58,6 @@ (height == 2436 || height == 2688 || height == 1792)); } -bool IsRefreshInfobarEnabled() { - return true; -} - bool IsRefreshLocationBarEnabled() { return true; }
diff --git a/ios/third_party/material_components_ios/README.chromium b/ios/third_party/material_components_ios/README.chromium index bc4282c..f906bf75 100644 --- a/ios/third_party/material_components_ios/README.chromium +++ b/ios/third_party/material_components_ios/README.chromium
@@ -1,7 +1,7 @@ Name: Material Components for iOS URL: https://github.com/material-components/material-components-ios Version: 0 -Revision: 827c67034ba293e6e4676689979571e471ec5486 +Revision: 50455404c6a72aa0540406325e787f0e2cf9b8d0 License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn index c1fc438..6b7ecca 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn
@@ -323,7 +323,7 @@ "fuchsia/audio_output_stream_fuchsia.cc", "fuchsia/audio_output_stream_fuchsia.h", ] - deps += [ "//third_party/fuchsia-sdk/sdk:media" ] + deps += [ "//third_party/fuchsia-sdk:media" ] } configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc index 5c82a5a..b7bcfa7 100644 --- a/media/audio/mac/audio_low_latency_input_mac.cc +++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -954,44 +954,51 @@ } if (audio_device_id != output_device_id_for_aec_) { - log_callback_.Run( - base::StringPrintf("AU in: Output device for AEC changed to '%s' (%d)", - output_device_id.c_str(), audio_device_id)); - SwitchVoiceProcessingOutputDevice(audio_device_id); + output_device_id_for_aec_ = audio_device_id; + log_callback_.Run(base::StringPrintf( + "AU in: Output device for AEC changed to '%s' (%d)", + output_device_id.c_str(), output_device_id_for_aec_)); + // Only restart the stream if it has previously been started. + if (audio_unit_) + ReinitializeVoiceProcessingAudioUnit(); } } -void AUAudioInputStream::SwitchVoiceProcessingOutputDevice( - AudioDeviceID output_device_id) { +void AUAudioInputStream::ReinitializeVoiceProcessingAudioUnit() { DCHECK(use_voice_processing_); + DCHECK(audio_unit_); - output_device_id_for_aec_ = output_device_id; - if (!audio_unit_) - return; - + const bool was_running = IsRunning(); OSStatus result = noErr; - if (IsRunning()) { + + if (was_running) { result = AudioOutputUnitStop(audio_unit_); DCHECK_EQ(result, noErr); } CloseAudioUnit(); + + // Reset things to a state similar to before the audio unit was opened. + // Most of these will be no-ops if the audio unit was opened but not started. SetInputCallbackIsActive(false); ReportAndResetStats(); io_buffer_frame_size_ = 0; got_input_callback_ = false; OpenVoiceProcessingAU(); - result = AudioOutputUnitStart(audio_unit_); - if (result != noErr) { - OSSTATUS_DLOG(ERROR, result) << "Failed to start acquiring data"; - Stop(); - return; + + if (was_running) { + result = AudioOutputUnitStart(audio_unit_); + if (result != noErr) { + OSSTATUS_DLOG(ERROR, result) << "Failed to start acquiring data"; + Stop(); + return; + } } log_callback_.Run(base::StringPrintf( "AU in: Successfully reinitialized AEC for output device id=%d.", - output_device_id)); + output_device_id_for_aec_)); } // static
diff --git a/media/audio/mac/audio_low_latency_input_mac.h b/media/audio/mac/audio_low_latency_input_mac.h index edb8da6..cc037a5c 100644 --- a/media/audio/mac/audio_low_latency_input_mac.h +++ b/media/audio/mac/audio_low_latency_input_mac.h
@@ -149,7 +149,7 @@ void CloseAudioUnit(); // Reinitializes the AudioUnit to use a new output device. - void SwitchVoiceProcessingOutputDevice(AudioDeviceID output_device_id); + void ReinitializeVoiceProcessingAudioUnit(); // Adds extra UMA stats when it has been detected that startup failed. void AddHistogramsForFailedStartup();
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc index 5438c94..1cce7d614 100644 --- a/media/audio/win/audio_low_latency_input_win.cc +++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -532,38 +532,44 @@ output_device_id_for_aec_ = output_device_id; - // Set devices. - Microsoft::WRL::ComPtr<IPropertyStore> ps; - HRESULT hr = voice_capture_dmo_->QueryInterface(IID_IPropertyStore, &ps); - if (FAILED(hr) || !ps) { - log_callback_.Run(base::StringPrintf( - "WASAPIAIS:SetOutputDeviceForAec: Getting DMO property store failed.")); - return; + if (opened_) { + // Set devices. + Microsoft::WRL::ComPtr<IPropertyStore> ps; + HRESULT hr = voice_capture_dmo_->QueryInterface(IID_IPropertyStore, &ps); + if (FAILED(hr) || !ps) { + log_callback_.Run( + base::StringPrintf("WASAPIAIS:SetOutputDeviceForAec: Getting DMO " + "property store failed.")); + return; + } + + if (!SetDmoDevices(ps.Get())) { + log_callback_.Run( + "WASAPIAIS:SetOutputDeviceForAec: Setting device indices failed."); + return; + } } - if (!SetDmoDevices(ps.Get())) { - log_callback_.Run( - "WASAPIAIS:SetOutputDeviceForAec: Setting device indices failed."); - return; - } + if (started_) { + DCHECK(opened_); + // Recreate the dummy render client on the new output. + HRESULT hr = audio_client_for_render_->Stop(); + if (FAILED(hr)) { + DLOG(ERROR) << "Failed to stop output streaming."; + } - // Recreate the dummy render client on the new output. - hr = audio_client_for_render_->Stop(); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to stop output streaming."; - } + CreateDummyRenderClientsForDmo(); - CreateDummyRenderClientsForDmo(); + if (!CoreAudioUtil::FillRenderEndpointBufferWithSilence( + audio_client_for_render_.Get(), audio_render_client_.Get())) { + DLOG(WARNING) << "Failed to pre-fill render buffer with silence."; + } - if (!CoreAudioUtil::FillRenderEndpointBufferWithSilence( - audio_client_for_render_.Get(), audio_render_client_.Get())) { - DLOG(WARNING) << "Failed to pre-fill render buffer with silence."; - } - - hr = audio_client_for_render_->Start(); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to start output streaming: " << std::hex << hr - << ", proceeding without rendering."; + hr = audio_client_for_render_->Start(); + if (FAILED(hr)) { + DLOG(ERROR) << "Failed to start output streaming: " << std::hex << hr + << ", proceeding without rendering."; + } } log_callback_.Run(base::StringPrintf(
diff --git a/media/cdm/cdm_proxy.h b/media/cdm/cdm_proxy.h index f20492a..8cd8ad3 100644 --- a/media/cdm/cdm_proxy.h +++ b/media/cdm/cdm_proxy.h
@@ -112,21 +112,31 @@ const std::vector<uint8_t>& input_data, CreateMediaCryptoSessionCB create_media_crypto_session_cb) = 0; + // Callback for SetKey(). + using SetKeyCB = base::OnceCallback<void(Status status)>; + // Sets a key in the proxy. // |crypto_session_id| is the crypto session for decryption. // |key_id| is the ID of the key. // |key_type| is the type of the key. // |key_blob| is the opaque key blob for decrypting or decoding. + // The status of the call is reported to |set_key_cb|. virtual void SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType key_type, - const std::vector<uint8_t>& key_blob) = 0; + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb) = 0; + + // Callback for RemoveKey(). + using RemoveKeyCB = base::OnceCallback<void(Status status)>; // Removes a key from the proxy. // |crypto_session_id| is the crypto session for decryption. // |key_id| is the ID of the key. + // The status of the call is reported to |remove_key_cb|. virtual void RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) = 0; + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb) = 0; private: DISALLOW_COPY_AND_ASSIGN(CdmProxy);
diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.cc b/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.cc index 38c78ef..115dcdf1 100644 --- a/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.cc +++ b/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.cc
@@ -32,7 +32,11 @@ cdm_proxy_->Initialize(); } -void CdmProxyHandler::SetKey(const std::vector<uint8_t>& response) { +void CdmProxyHandler::SetKey(const std::vector<uint8_t>& response, + SetKeyCB set_key_cb) { + DVLOG(2) << __func__; + DCHECK(!set_key_cb_); + set_key_cb_ = std::move(set_key_cb); cdm_proxy_->SetKey(crypto_session_id_, nullptr, 0, cdm::CdmProxy::kDecryptAndDecode, response.data(), response.size()); @@ -68,7 +72,7 @@ void CdmProxyHandler::OnProcessed(Status status, const uint8_t* output_data, uint32_t output_data_size) { - DVLOG(1) << __func__ << ": status = " << status; + DVLOG(2) << __func__ << ": status = " << status; if (status != Status::kOk || !std::equal(output_data, output_data + output_data_size, @@ -84,7 +88,7 @@ void CdmProxyHandler::OnMediaCryptoSessionCreated(Status status, uint32_t crypto_session_id, uint64_t output_data) { - DVLOG(1) << __func__ << ": status = " << status; + DVLOG(2) << __func__ << ": status = " << status; if (status != Status::kOk || crypto_session_id != kClearKeyCdmProxyMediaCryptoSessionId) { @@ -95,6 +99,18 @@ FinishInitialization(true); } +void CdmProxyHandler::OnKeySet(Status status) { + DVLOG(2) << __func__ << ": status = " << status; + DCHECK(set_key_cb_); + + std::move(set_key_cb_).Run(status == Status::kOk); +} + +void CdmProxyHandler::OnKeyRemoved(Status status) { + DVLOG(2) << __func__; + NOTREACHED(); +} + void CdmProxyHandler::NotifyHardwareReset() { DVLOG(1) << __func__; NOTREACHED();
diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.h b/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.h index dd5badb9..850d905 100644 --- a/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.h +++ b/media/cdm/library_cdm/clear_key_cdm/cdm_proxy_handler.h
@@ -16,6 +16,7 @@ class CdmProxyHandler : public cdm::CdmProxyClient { public: using InitCB = base::OnceCallback<void(bool success)>; + using SetKeyCB = base::OnceCallback<void(bool success)>; explicit CdmProxyHandler(CdmHostProxy* cdm_host_proxy); ~CdmProxyHandler() override; @@ -26,7 +27,7 @@ void Initialize(InitCB init_cb); // Push a response that contains a license to the CdmProxy. - void SetKey(const std::vector<uint8_t>& response); + void SetKey(const std::vector<uint8_t>& response, SetKeyCB set_key_cb); private: void FinishInitialization(bool success); @@ -41,10 +42,13 @@ void OnMediaCryptoSessionCreated(Status status, uint32_t crypto_session_id, uint64_t output_data) final; + void OnKeySet(Status status) final; + void OnKeyRemoved(Status status) final; void NotifyHardwareReset() final; CdmHostProxy* const cdm_host_proxy_ = nullptr; InitCB init_cb_; + SetKeyCB set_key_cb_; cdm::CdmProxy* cdm_proxy_ = nullptr; uint32_t crypto_session_id_ = 0u;
diff --git a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc index 6c60861..df63b79d 100644 --- a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc +++ b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc
@@ -558,8 +558,8 @@ promise_id), base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id))); - cdm_->LoadSession(ConvertSessionType(session_type), web_session_str, - std::move(promise)); + cdm_->LoadSession(ConvertSessionType(session_type), + std::move(web_session_str), std::move(promise)); } void ClearKeyCdm::UpdateSession(uint32_t promise_id, @@ -570,23 +570,54 @@ DVLOG(1) << __func__; std::string web_session_str(session_id, session_id_length); std::vector<uint8_t> response_vector(response, response + response_size); + auto pending_update_params = std::make_unique<UpdateParams>( + promise_id, std::move(web_session_str), response_vector); - // Push the license to CdmProxy. - // TODO(xhwang): There's a potential race condition here where key status - // update is dispatched in the render process first, which triggers the - // resume-decryption-after-no-key logic, and by the time we try to decrypt - // again in the ClearKeyCdmProxy (GPU process), SetKey() hasn't been - // dispatched yet. To solve this, handle no-key in ClearKeyCdmProxy. - if (cdm_proxy_handler_) - cdm_proxy_handler_->SetKey(response_vector); + // Push the license to the CdmProxy. The license will still be pushed to the + // |cdm_| after OnKeySet() is called, which then triggers + // OnSessionKeysChange(). This order is critical to avoid race conditions like + // OnSessionKeysChange() being called before the keys are actually available + // in the CdmProxy. + if (cdm_proxy_handler_) { + if (pending_update_params_) { + OnPromiseFailed(promise_id, CdmPromise::Exception::INVALID_STATE_ERROR, 0, + "Parallel updates not supported."); + return; + } + pending_update_params_ = std::move(pending_update_params); + cdm_proxy_handler_->SetKey( + response_vector, + base::BindOnce(&ClearKeyCdm::OnCdmProxyKeySet, base::Unretained(this))); + return; + } + + UpdateSessionInternal(std::move(pending_update_params)); +} + +void ClearKeyCdm::OnCdmProxyKeySet(bool success) { + DCHECK(pending_update_params_); + + if (!success) { + auto promise_id = pending_update_params_->promise_id; + pending_update_params_.reset(); + OnPromiseFailed(promise_id, CdmPromise::Exception::INVALID_STATE_ERROR, 0, + "Parallel updates not supported."); + return; + } + + UpdateSessionInternal(std::move(pending_update_params_)); +} + +void ClearKeyCdm::UpdateSessionInternal(std::unique_ptr<UpdateParams> params) { std::unique_ptr<media::SimpleCdmPromise> promise( new media::CdmCallbackPromise<>( base::Bind(&ClearKeyCdm::OnUpdateSuccess, base::Unretained(this), - promise_id, web_session_str), + params->promise_id, params->session_id), base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), - promise_id))); - cdm_->UpdateSession(web_session_str, response_vector, std::move(promise)); + params->promise_id))); + + cdm_->UpdateSession(params->session_id, params->response, std::move(promise)); } void ClearKeyCdm::OnUpdateSuccess(uint32_t promise_id, @@ -642,7 +673,7 @@ promise_id), base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id))); - cdm_->CloseSession(web_session_str, std::move(promise)); + cdm_->CloseSession(std::move(web_session_str), std::move(promise)); } void ClearKeyCdm::RemoveSession(uint32_t promise_id, @@ -657,7 +688,7 @@ promise_id), base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id))); - cdm_->RemoveSession(web_session_str, std::move(promise)); + cdm_->RemoveSession(std::move(web_session_str), std::move(promise)); } void ClearKeyCdm::SetServerCertificate(uint32_t promise_id, @@ -1162,4 +1193,13 @@ cdm_host_proxy_->OnInitialized(success); } +ClearKeyCdm::UpdateParams::UpdateParams(uint32_t promise_id, + std::string session_id, + std::vector<uint8_t> response) + : promise_id(promise_id), + session_id(std::move(session_id)), + response(std::move(response)) {} + +ClearKeyCdm::UpdateParams::~UpdateParams() {} + } // namespace media
diff --git a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h index 15abaac..61f1d4dd 100644 --- a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h +++ b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h
@@ -119,6 +119,17 @@ uint32_t storage_id_size) override; private: + struct UpdateParams { + UpdateParams(uint32_t promise_id, + std::string session_id, + std::vector<uint8_t> response); + ~UpdateParams(); + + const uint32_t promise_id; + const std::string session_id; + const std::vector<uint8_t> response; + }; + // ContentDecryptionModule callbacks. void OnSessionMessage(const std::string& session_id, CdmMessageType message_type, @@ -169,6 +180,9 @@ void InitializeCdmProxyHandler(); void OnCdmProxyHandlerInitialized(bool success); + void OnCdmProxyKeySet(bool success); + + void UpdateSessionInternal(std::unique_ptr<UpdateParams> params); int host_interface_version_ = 0; @@ -194,6 +208,8 @@ std::unique_ptr<FFmpegCdmAudioDecoder> audio_decoder_; #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER + std::unique_ptr<UpdateParams> pending_update_params_; + std::unique_ptr<CdmVideoDecoder> video_decoder_; std::unique_ptr<FileIOTestRunner> file_io_test_runner_; std::unique_ptr<CdmProxyHandler> cdm_proxy_handler_;
diff --git a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.cc b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.cc index bcf3347..953dacd 100644 --- a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.cc +++ b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.cc
@@ -87,7 +87,8 @@ void ClearKeyCdmProxy::SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType /* key_type */, - const std::vector<uint8_t>& key_blob) { + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb) { DVLOG(1) << __func__; if (!aes_decryptor_) @@ -95,10 +96,14 @@ aes_decryptor_->UpdateSession(kDummySessionId, key_blob, std::make_unique<IgnoreResponsePromise>()); + std::move(set_key_cb).Run(Status::kOk); } void ClearKeyCdmProxy::RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) {} + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb) { + std::move(remove_key_cb).Run(Status::kOk); +} Decryptor* ClearKeyCdmProxy::GetDecryptor() { DVLOG(1) << __func__;
diff --git a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.h b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.h index f9b9192..82babc0c 100644 --- a/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.h +++ b/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm_proxy.h
@@ -35,9 +35,11 @@ void SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType key_type, - const std::vector<uint8_t>& key_blob) final; + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb) final; void RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) final; + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb) final; // CdmContext implementation. Decryptor* GetDecryptor() final;
diff --git a/media/gpu/windows/d3d11_cdm_proxy.cc b/media/gpu/windows/d3d11_cdm_proxy.cc index f8ae64f..dbfd861 100644 --- a/media/gpu/windows/d3d11_cdm_proxy.cc +++ b/media/gpu/windows/d3d11_cdm_proxy.cc
@@ -498,26 +498,34 @@ void D3D11CdmProxy::SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType key_type, - const std::vector<uint8_t>& key_blob) { + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb) { auto crypto_session_it = crypto_session_map_.find(crypto_session_id); if (crypto_session_it == crypto_session_map_.end()) { DLOG(WARNING) << crypto_session_id << " did not map to a crypto session instance."; + std::move(set_key_cb).Run(Status::kFail); return; } + cdm_context_->SetKey(crypto_session_it->second.Get(), key_id, key_type, key_blob); + std::move(set_key_cb).Run(Status::kOk); } void D3D11CdmProxy::RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) { + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb) { auto crypto_session_it = crypto_session_map_.find(crypto_session_id); if (crypto_session_it == crypto_session_map_.end()) { DLOG(WARNING) << crypto_session_id << " did not map to a crypto session instance."; + std::move(remove_key_cb).Run(Status::kFail); return; } + cdm_context_->RemoveKey(crypto_session_it->second.Get(), key_id); + std::move(remove_key_cb).Run(Status::kOk); } void D3D11CdmProxy::SetCreateDeviceCallbackForTesting(
diff --git a/media/gpu/windows/d3d11_cdm_proxy.h b/media/gpu/windows/d3d11_cdm_proxy.h index 55088f5..0651f03 100644 --- a/media/gpu/windows/d3d11_cdm_proxy.h +++ b/media/gpu/windows/d3d11_cdm_proxy.h
@@ -59,9 +59,11 @@ void SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType key_type, - const std::vector<uint8_t>& key_blob) override; + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb) override; void RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) override; + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb) override; void SetCreateDeviceCallbackForTesting(D3D11CreateDeviceCB callback);
diff --git a/media/gpu/windows/d3d11_cdm_proxy_unittest.cc b/media/gpu/windows/d3d11_cdm_proxy_unittest.cc index a83a5f45..cbb6e2f 100644 --- a/media/gpu/windows/d3d11_cdm_proxy_unittest.cc +++ b/media/gpu/windows/d3d11_cdm_proxy_unittest.cc
@@ -74,6 +74,8 @@ MOCK_METHOD2(ProcessCallback, CdmProxy::ProcessCB::RunType); MOCK_METHOD3(CreateMediaCryptoSessionCallback, CdmProxy::CreateMediaCryptoSessionCB::RunType); + MOCK_METHOD1(SetKeyCallback, CdmProxy::SetKeyCB::RunType); + MOCK_METHOD1(RemoveKeyCallback, CdmProxy::RemoveKeyCB::RunType); }; class D3D11CdmProxyTest : public ::testing::Test { @@ -703,8 +705,11 @@ 0x01, 0x4f, 0x83, }; + EXPECT_CALL(callback_mock_, SetKeyCallback(CdmProxy::Status::kOk)); proxy_->SetKey(crypto_session_id_from_initialize, kAnyBlob, - CdmProxy::KeyType::kDecryptAndDecode, kAnyBlob); + CdmProxy::KeyType::kDecryptAndDecode, kAnyBlob, + base::BindOnce(&CallbackMock::SetKeyCallback, + base::Unretained(&callback_mock_))); base::WeakPtr<CdmContext> context = proxy_->GetCdmContext(); CdmProxyContext* proxy_context = context->GetCdmProxyContext(); @@ -737,8 +742,11 @@ 0xab, 0x01, 0x20, 0xd3, 0xee, 0x05, 0x99, 0x87, 0xff, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x7F, }; + EXPECT_CALL(callback_mock_, SetKeyCallback(CdmProxy::Status::kOk)); proxy_->SetKey(crypto_session_id_from_initialize, kKeyId, kTestKeyType, - kKeyBlob); + kKeyBlob, + base::BindOnce(&CallbackMock::SetKeyCallback, + base::Unretained(&callback_mock_))); std::string key_id_str(kKeyId.begin(), kKeyId.end()); auto decrypt_context = @@ -784,8 +792,11 @@ 0xab, 0x01, 0x20, 0xd3, 0xee, 0x05, 0x99, 0x87, 0xff, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x7F, }; + EXPECT_CALL(callback_mock_, SetKeyCallback(CdmProxy::Status::kOk)); proxy_->SetKey(crypto_session_id_from_initialize, kKeyId, kTestKeyType, - kKeyBlob); + kKeyBlob, + base::BindOnce(&CallbackMock::SetKeyCallback, + base::Unretained(&callback_mock_))); SetEvent(teardown_event_); run_loop.Run(); @@ -819,9 +830,15 @@ 0xab, 0x01, 0x20, 0xd3, 0xee, 0x05, 0x99, 0x87, 0xff, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x7F, }; + EXPECT_CALL(callback_mock_, SetKeyCallback(CdmProxy::Status::kOk)); + EXPECT_CALL(callback_mock_, RemoveKeyCallback(CdmProxy::Status::kOk)); proxy_->SetKey(crypto_session_id_from_initialize, kKeyId, kTestKeyType, - kKeyBlob); - proxy_->RemoveKey(crypto_session_id_from_initialize, kKeyId); + kKeyBlob, + base::BindOnce(&CallbackMock::SetKeyCallback, + base::Unretained(&callback_mock_))); + proxy_->RemoveKey(crypto_session_id_from_initialize, kKeyId, + base::BindOnce(&CallbackMock::RemoveKeyCallback, + base::Unretained(&callback_mock_))); std::string keyblob_str(kKeyId.begin(), kKeyId.end()); auto decrypt_context = @@ -830,12 +847,18 @@ } // Calling SetKey() and RemoveKey() for non-existent crypto session should -// not crash. +// fail but not crash. TEST_F(D3D11CdmProxyTest, SetRemoveKeyWrongCryptoSessionId) { const uint32_t kAnyCryptoSessionId = 0x9238; const std::vector<uint8_t> kEmpty; - proxy_->RemoveKey(kAnyCryptoSessionId, kEmpty); - proxy_->SetKey(kAnyCryptoSessionId, kEmpty, kTestKeyType, kEmpty); + EXPECT_CALL(callback_mock_, RemoveKeyCallback(CdmProxy::Status::kFail)); + EXPECT_CALL(callback_mock_, SetKeyCallback(CdmProxy::Status::kFail)); + proxy_->RemoveKey(kAnyCryptoSessionId, kEmpty, + base::BindOnce(&CallbackMock::RemoveKeyCallback, + base::Unretained(&callback_mock_))); + proxy_->SetKey(kAnyCryptoSessionId, kEmpty, kTestKeyType, kEmpty, + base::BindOnce(&CallbackMock::SetKeyCallback, + base::Unretained(&callback_mock_))); } TEST_F(D3D11CdmProxyTest, ProxyInvalidationInvalidatesCdmContext) {
diff --git a/media/midi/midi_manager.cc b/media/midi/midi_manager.cc index a00273d..cf62e189 100644 --- a/media/midi/midi_manager.cc +++ b/media/midi/midi_manager.cc
@@ -104,8 +104,12 @@ static_cast<Sample>(SendReceiveUsage::MAX) + 1); // Detach all clients so that they do not call MidiManager methods any more. + for (auto* client : pending_clients_) + client->Detach(); + pending_clients_.clear(); for (auto* client : clients_) client->Detach(); + clients_.clear(); session_thread_runner_ = nullptr; } @@ -129,8 +133,12 @@ if (initialization_state_ == InitializationState::COMPLETED) { // Platform dependent initialization was already finished for previously // initialized clients. - if (result_ == Result::OK) - AddInitialPorts(client); + if (result_ == Result::OK) { + for (const auto& info : input_ports_) + client->AddInputPort(info); + for (const auto& info : output_ports_) + client->AddOutputPort(info); + } // Complete synchronously with |result_|; clients_.insert(client); @@ -187,17 +195,6 @@ return clients_.size() != 0u; } -void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { - base::AutoLock auto_lock(lock_); - data_sent_ = true; - if (clients_.find(client) == clients_.end()) - return; - - // Continue to hold lock_ here in case another thread is currently doing - // EndSession. - client->AccumulateMidiBytesSent(n); -} - void MidiManager::DispatchSendMidiData(MidiManagerClient* client, uint32_t port_index, const std::vector<uint8_t>& data, @@ -210,22 +207,37 @@ } void MidiManager::CompleteInitialization(Result result) { - bool complete_asynchronously = false; - { - base::AutoLock auto_lock(lock_); - if (session_thread_runner_) { - if (session_thread_runner_->BelongsToCurrentThread()) { - complete_asynchronously = true; - } else { - session_thread_runner_->PostTask( - FROM_HERE, - base::BindOnce(&MidiManager::CompleteInitializationOnSessionThread, - base::Unretained(this), result)); - } + TRACE_EVENT0("midi", "MidiManager::CompleteInitialization"); + ReportUsage(Usage::INITIALIZED); + + base::AutoLock auto_lock(lock_); + UMA_HISTOGRAM_ENUMERATION("Media.Midi.InputPorts", input_ports_.size(), + kMaxUmaDevices + 1); + UMA_HISTOGRAM_ENUMERATION("Media.Midi.OutputPorts", output_ports_.size(), + kMaxUmaDevices + 1); + + if (!session_thread_runner_) + return; + DCHECK(session_thread_runner_->BelongsToCurrentThread()); + + DCHECK(!finalized_); + DCHECK(clients_.empty()); + DCHECK_EQ(initialization_state_, InitializationState::STARTED); + initialization_state_ = InitializationState::COMPLETED; + result_ = result; + + for (auto* client : pending_clients_) { + if (result_ == Result::OK) { + for (const auto& info : input_ports_) + client->AddInputPort(info); + for (const auto& info : output_ports_) + client->AddOutputPort(info); } + + clients_.insert(client); + client->CompleteStartSession(result_); } - if (complete_asynchronously) - CompleteInitializationOnSessionThread(result); + pending_clients_.clear(); } void MidiManager::AddInputPort(const MidiPortInfo& info) { @@ -260,6 +272,23 @@ client->SetOutputPortState(port_index, state); } +mojom::PortState MidiManager::GetOutputPortState(uint32_t port_index) { + base::AutoLock auto_lock(lock_); + DCHECK_LT(port_index, output_ports_.size()); + return output_ports_[port_index].state; +} + +void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { + base::AutoLock auto_lock(lock_); + data_sent_ = true; + if (clients_.find(client) == clients_.end()) + return; + + // Continue to hold lock_ here in case another thread is currently doing + // EndSession. + client->AccumulateMidiBytesSent(n); +} + void MidiManager::ReceiveMidiData(uint32_t port_index, const uint8_t* data, size_t length, @@ -271,38 +300,4 @@ client->ReceiveMidiData(port_index, data, length, timestamp); } -void MidiManager::CompleteInitializationOnSessionThread(Result result) { - TRACE_EVENT0("midi", "MidiManager::CompleteInitialization"); - ReportUsage(Usage::INITIALIZED); - - base::AutoLock auto_lock(lock_); - UMA_HISTOGRAM_ENUMERATION("Media.Midi.InputPorts", input_ports_.size(), - kMaxUmaDevices + 1); - UMA_HISTOGRAM_ENUMERATION("Media.Midi.OutputPorts", output_ports_.size(), - kMaxUmaDevices + 1); - - DCHECK(clients_.empty()); - DCHECK_EQ(initialization_state_, InitializationState::STARTED); - initialization_state_ = InitializationState::COMPLETED; - result_ = result; - - for (auto* client : pending_clients_) { - if (result_ == Result::OK) - AddInitialPorts(client); - - clients_.insert(client); - client->CompleteStartSession(result_); - } - pending_clients_.clear(); -} - -void MidiManager::AddInitialPorts(MidiManagerClient* client) { - lock_.AssertAcquired(); - - for (const auto& info : input_ports_) - client->AddInputPort(info); - for (const auto& info : output_ports_) - client->AddOutputPort(info); -} - } // namespace midi
diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h index 6319495..183bf57 100644 --- a/media/midi/midi_manager.h +++ b/media/midi/midi_manager.h
@@ -14,6 +14,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" +#include "base/thread_annotations.h" #include "base/time/time.h" #include "media/midi/midi_export.h" #include "media/midi/midi_port_info.h" @@ -108,10 +109,6 @@ // Returns true if there is at least one client that keep a session open. bool HasOpenSession(); - // Invoke AccumulateMidiBytesSent() for |client| safely. If the session was - // already closed, do nothing. - void AccumulateMidiBytesSent(MidiManagerClient* client, size_t n); - // DispatchSendMidiData() is called when MIDI data should be sent to the MIDI // system. // This method is supposed to return immediately and should not block. @@ -145,31 +142,34 @@ virtual void Finalize() {} // Called from a platform dependent implementation of StartInitialization(). - // The method can be called on any thread, and it invokes - // CompleteInitializationOnSessionThread() on the thread that ran - // StartSession() and distributes |result| to MIDIManagerClient objects in + // The method distributes |result| to MIDIManagerClient objects in // |pending_clients_|. void CompleteInitialization(mojom::Result result); - // The following methods can be called on any thread. + // The following five methods can be called on any thread to notify clients of + // status changes on ports, or to obtain port status. void AddInputPort(const MidiPortInfo& info); void AddOutputPort(const MidiPortInfo& info); void SetInputPortState(uint32_t port_index, mojom::PortState state); void SetOutputPortState(uint32_t port_index, mojom::PortState state); + mojom::PortState GetOutputPortState(uint32_t port_index); - // Dispatches to all clients. + // Invoke AccumulateMidiBytesSent() for |client| safely. If the session was + // already closed, do nothing. Can be called on any thread. + void AccumulateMidiBytesSent(MidiManagerClient* client, size_t n); + + // Dispatches to all clients. Can be called on any thread. void ReceiveMidiData(uint32_t port_index, const uint8_t* data, size_t length, base::TimeTicks time); + // Only for testing. size_t clients_size_for_testing() const { return clients_.size(); } size_t pending_clients_size_for_testing() const { return pending_clients_.size(); } - const MidiPortInfoList& input_ports() const { return input_ports_; } - const MidiPortInfoList& output_ports() const { return output_ports_; } MidiService* service() { return service_; } private: @@ -179,11 +179,9 @@ COMPLETED, }; - void CompleteInitializationOnSessionThread(mojom::Result result); - void AddInitialPorts(MidiManagerClient* client); - // Keeps track of all clients who wish to receive MIDI data. - std::set<MidiManagerClient*> clients_; + // TODO(toyoshim): Enable GUARDED_BY once a testing function is fixed. + std::set<MidiManagerClient*> clients_; // GUARDED_BY(lock_); // Keeps track of all clients who are waiting for CompleteStartSession(). std::set<MidiManagerClient*> pending_clients_; @@ -203,12 +201,12 @@ mojom::Result result_; // Keeps all MidiPortInfo. - MidiPortInfoList input_ports_; - MidiPortInfoList output_ports_; + MidiPortInfoList input_ports_ GUARDED_BY(lock_); + MidiPortInfoList output_ports_ GUARDED_BY(lock_); // Tracks if actual data transmission happens. - bool data_sent_; - bool data_received_; + bool data_sent_ GUARDED_BY(lock_); + bool data_received_ GUARDED_BY(lock_); // Protects members above. base::Lock lock_;
diff --git a/media/midi/midi_manager_android.cc b/media/midi/midi_manager_android.cc index 5c37ca88d..2522024 100644 --- a/media/midi/midi_manager_android.cc +++ b/media/midi/midi_manager_android.cc
@@ -97,8 +97,7 @@ // in the valid range. return; } - DCHECK_EQ(output_ports().size(), all_output_ports_.size()); - if (output_ports()[port_index].state == PortState::CONNECTED) { + if (GetOutputPortState(port_index) == PortState::CONNECTED) { // We treat send call as implicit open. // TODO(yhirano): Implement explicit open operation from the renderer. if (all_output_ports_[port_index]->Open()) { @@ -120,7 +119,7 @@ delay); service()->task_service()->PostBoundDelayedTask( TaskService::kDefaultRunnerId, - base::BindOnce(&MidiManager::AccumulateMidiBytesSent, + base::BindOnce(&MidiManagerAndroid::AccumulateMidiBytesSent, base::Unretained(this), client, data.size()), delay); } @@ -145,13 +144,19 @@ env, env->GetObjectArrayElement(devices, i)); AddDevice(std::make_unique<MidiDeviceAndroid>(env, raw_device, this)); } - CompleteInitialization(Result::OK); + service()->task_service()->PostBoundTask( + TaskService::kDefaultRunnerId, + base::BindOnce(&MidiManagerAndroid::CompleteInitialization, + base::Unretained(this), Result::OK)); } void MidiManagerAndroid::OnInitializationFailed( JNIEnv* env, const JavaParamRef<jobject>& caller) { - CompleteInitialization(Result::INITIALIZATION_ERROR); + service()->task_service()->PostBoundTask( + TaskService::kDefaultRunnerId, + base::BindOnce(&MidiManagerAndroid::CompleteInitialization, + base::Unretained(this), Result::INITIALIZATION_ERROR)); } void MidiManagerAndroid::OnAttached(JNIEnv* env,
diff --git a/media/midi/midi_manager_mac.cc b/media/midi/midi_manager_mac.cc index ff6ebc51..af1431d 100644 --- a/media/midi/midi_manager_mac.cc +++ b/media/midi/midi_manager_mac.cc
@@ -38,7 +38,7 @@ const size_t kEstimatedMaxPacketDataSize = kCoreMIDIMaxPacketListSize / 2; enum { - kDefaultRunnerNotUsedOnMac = TaskService::kDefaultRunnerId, + kSessionTaskRunner = TaskService::kDefaultRunnerId, kClientTaskRunner, }; @@ -160,7 +160,7 @@ OSStatus result = MIDIClientCreate(CFSTR("Chrome"), ReceiveMidiNotifyDispatch, this, &client); if (result != noErr || client == 0u) - return CompleteInitialization(Result::INITIALIZATION_ERROR); + return CompleteCoreMIDIInitialization(Result::INITIALIZATION_ERROR); { base::AutoLock lock(midi_client_lock_); @@ -173,11 +173,11 @@ result = MIDIInputPortCreate(client, CFSTR("MIDI Input"), ReadMidiDispatch, this, &midi_input_); if (result != noErr || midi_input_ == 0u) - return CompleteInitialization(Result::INITIALIZATION_ERROR); + return CompleteCoreMIDIInitialization(Result::INITIALIZATION_ERROR); result = MIDIOutputPortCreate(client, CFSTR("MIDI Output"), &midi_output_); if (result != noErr || midi_output_ == 0u) - return CompleteInitialization(Result::INITIALIZATION_ERROR); + return CompleteCoreMIDIInitialization(Result::INITIALIZATION_ERROR); // Following loop may miss some newly attached devices, but such device will // be captured by ReceiveMidiNotifyDispatch callback. @@ -207,7 +207,14 @@ for (size_t i = 0u; i < sources_.size(); ++i) MIDIPortConnectSource(midi_input_, sources_[i], reinterpret_cast<void*>(i)); - CompleteInitialization(Result::OK); + CompleteCoreMIDIInitialization(Result::OK); +} + +void MidiManagerMac::CompleteCoreMIDIInitialization(mojom::Result result) { + service()->task_service()->PostBoundTask( + kSessionTaskRunner, + base::BindOnce(&MidiManagerMac::CompleteInitialization, + base::Unretained(this), result)); } // static
diff --git a/media/midi/midi_manager_mac.h b/media/midi/midi_manager_mac.h index f967863..f945348d 100644 --- a/media/midi/midi_manager_mac.h +++ b/media/midi/midi_manager_mac.h
@@ -40,6 +40,10 @@ // StartInitialization(). void InitializeCoreMIDI(); + // Completes CoreMIDI initialization and asks the thread that ran + // StartInitialization() to call CompleteStartSession() safely. + void CompleteCoreMIDIInitialization(mojom::Result result); + // CoreMIDI callback for MIDI notification. // Receives MIDI related event notifications from CoreMIDI. static void ReceiveMidiNotifyDispatch(const MIDINotification* message,
diff --git a/media/midi/midi_manager_usb.cc b/media/midi/midi_manager_usb.cc index ba5ad73..c32bfff 100644 --- a/media/midi/midi_manager_usb.cc +++ b/media/midi/midi_manager_usb.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/bind.h" #include "base/logging.h" #include "base/strings/stringprintf.h" #include "media/midi/midi_service.h" @@ -26,7 +27,6 @@ // TODO(toyoshim): Remove following DCHECKs once the dynamic instantiation // mode is enabled by default. base::AutoLock lock(lock_); - DCHECK(initialize_callback_.is_null()); DCHECK(device_factory_); DCHECK(devices_.empty()); DCHECK(output_streams_.empty()); @@ -38,8 +38,7 @@ bool result = service()->task_service()->BindInstance(); DCHECK(result); - Initialize(base::BindOnce(&MidiManager::CompleteInitialization, - base::Unretained(this))); + Initialize(); } void MidiManagerUsb::Finalize() { @@ -49,7 +48,6 @@ // TODO(toyoshim): Remove following code once the dynamic instantiation mode // is enabled by default. base::AutoLock lock(lock_); - initialize_callback_ = Callback(); devices_.clear(); output_streams_.clear(); input_stream_.reset(); @@ -59,9 +57,7 @@ // which the constructor runs. } -void MidiManagerUsb::Initialize(Callback callback) { - initialize_callback_ = std::move(callback); - +void MidiManagerUsb::Initialize() { // This is safe because EnumerateDevices cancels the operation on destruction. device_factory_->EnumerateDevices( this, base::BindOnce(&MidiManagerUsb::OnEnumerateDevicesDone, @@ -140,19 +136,21 @@ void MidiManagerUsb::OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices) { - if (!result) { - std::move(initialize_callback_).Run(Result::INITIALIZATION_ERROR); - return; - } - input_stream_.reset(new UsbMidiInputStream(this)); - devices->swap(devices_); - for (size_t i = 0; i < devices_.size(); ++i) { - if (!AddPorts(devices_[i].get(), static_cast<int>(i))) { - std::move(initialize_callback_).Run(Result::INITIALIZATION_ERROR); - return; + if (result) { + input_stream_.reset(new UsbMidiInputStream(this)); + devices->swap(devices_); + for (size_t i = 0; i < devices_.size(); ++i) { + if (!AddPorts(devices_[i].get(), static_cast<int>(i))) { + result = false; + break; + } } } - std::move(initialize_callback_).Run(Result::OK); + service()->task_service()->PostBoundTask( + TaskService::kDefaultRunnerId, + base::BindOnce(&MidiManager::CompleteInitialization, + base::Unretained(this), + result ? Result::OK : Result::INITIALIZATION_ERROR)); } bool MidiManagerUsb::AddPorts(UsbMidiDevice* device, int device_id) {
diff --git a/media/midi/midi_manager_usb.h b/media/midi/midi_manager_usb.h index f45dae5..565881c 100644 --- a/media/midi/midi_manager_usb.h +++ b/media/midi/midi_manager_usb.h
@@ -12,8 +12,6 @@ #include <utility> #include <vector> -#include "base/bind.h" -#include "base/callback.h" #include "base/compiler_specific.h" #include "base/containers/hash_tables.h" #include "base/macros.h" @@ -69,16 +67,12 @@ const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } private: - using Callback = base::OnceCallback<void(mojom::Result)>; - // Initializes this object. - // When the initialization finishes, |callback| will be called with the - // result. + // When the initialization finishes, CompleteInitialization will be called + // with the result on the same thread, but asynchronously. // When this factory is destroyed during the operation, the operation - // will be canceled silently (i.e. |callback| will not be called). - // The function is public just for unit tests. Do not call this function - // outside code for testing. - void Initialize(Callback callback); + // will be canceled silently (i.e. CompleteInitialization will not be called). + void Initialize(); void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); bool AddPorts(UsbMidiDevice* device, int device_id); @@ -93,8 +87,6 @@ std::vector<std::unique_ptr<UsbMidiOutputStream>> output_streams_; std::unique_ptr<UsbMidiInputStream> input_stream_; - Callback initialize_callback_; - // A map from <endpoint_number, cable_number> to the index of input jacks. base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_;
diff --git a/media/midi/midi_manager_winrt.cc b/media/midi/midi_manager_winrt.cc index 78036674..e2ae5e4 100644 --- a/media/midi/midi_manager_winrt.cc +++ b/media/midi/midi_manager_winrt.cc
@@ -50,7 +50,7 @@ using mojom::Result; enum { - kDefaultRunnerNotUsedOnWinrt = TaskService::kDefaultRunnerId, + kDefaultTaskRunner = TaskService::kDefaultRunnerId, kComTaskRunner }; @@ -825,7 +825,10 @@ bool preload_success = base::win::ResolveCoreWinRTDelayload() && ScopedHString::ResolveCoreWinRTStringDelayload(); if (!preload_success) { - CompleteInitialization(Result::INITIALIZATION_ERROR); + service()->task_service()->PostBoundTask( + kDefaultTaskRunner, + base::BindOnce(&MidiManagerWinrt::CompleteInitialization, + base::Unretained(this), Result::INITIALIZATION_ERROR)); return; } @@ -836,7 +839,10 @@ port_manager_out_->StartWatcher())) { port_manager_in_->StopWatcher(); port_manager_out_->StopWatcher(); - CompleteInitialization(Result::INITIALIZATION_ERROR); + service()->task_service()->PostBoundTask( + kDefaultTaskRunner, + base::BindOnce(&MidiManagerWinrt::CompleteInitialization, + base::Unretained(this), Result::INITIALIZATION_ERROR)); } } @@ -869,8 +875,12 @@ DCHECK(service()->task_service()->IsOnTaskRunner(kComTaskRunner)); DCHECK(port_manager_ready_count_ < 2); - if (++port_manager_ready_count_ == 2) - CompleteInitialization(Result::OK); + if (++port_manager_ready_count_ == 2) { + service()->task_service()->PostBoundTask( + kDefaultTaskRunner, + base::BindOnce(&MidiManagerWinrt::CompleteInitialization, + base::Unretained(this), Result::OK)); + } } } // namespace midi
diff --git a/media/midi/midi_service.cc b/media/midi/midi_service.cc index 7e66f4e..0decb8b1 100644 --- a/media/midi/midi_service.cc +++ b/media/midi/midi_service.cc
@@ -34,9 +34,7 @@ MidiService::~MidiService() { base::AutoLock lock(lock_); - - manager_.reset(); - + DCHECK(!manager_); base::AutoLock threads_lock(threads_lock_); threads_.clear(); }
diff --git a/media/mojo/interfaces/cdm_proxy.mojom b/media/mojo/interfaces/cdm_proxy.mojom index ab65ee16..841d312a 100644 --- a/media/mojo/interfaces/cdm_proxy.mojom +++ b/media/mojo/interfaces/cdm_proxy.mojom
@@ -60,12 +60,12 @@ // |key_id| is the ID of the key. // |key_blob| is the opaque key blob for decrypting or decoding. SetKey(uint32 crypto_session_id, array<uint8> key_id, KeyType key_type, - array<uint8> key_blob); + array<uint8> key_blob) => (Status status); // Removes a key from the proxy. // |crypto_session_id| is the crypto session for decryption. // |key_id| is the ID of the key. - RemoveKey(uint32 crypto_session_id, array<uint8> key_id); + RemoveKey(uint32 crypto_session_id, array<uint8> key_id) => (Status status); }; // Client of CdmProxy.
diff --git a/media/mojo/services/mojo_cdm_proxy.cc b/media/mojo/services/mojo_cdm_proxy.cc index 010bc1e..b4de05c 100644 --- a/media/mojo/services/mojo_cdm_proxy.cc +++ b/media/mojo/services/mojo_cdm_proxy.cc
@@ -145,10 +145,15 @@ DVLOG(3) << __func__; CHECK(client_) << "Initialize not called."; + auto callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( + base::BindOnce(&MojoCdmProxy::OnKeySet, weak_factory_.GetWeakPtr()), + media::CdmProxy::Status::kFail); + cdm_proxy_ptr_->SetKey( crypto_session_id, std::vector<uint8_t>(key_id, key_id + key_id_size), ToMediaKeyType(key_type), - std::vector<uint8_t>(key_blob, key_blob + key_blob_size)); + std::vector<uint8_t>(key_blob, key_blob + key_blob_size), + std::move(callback)); } void MojoCdmProxy::RemoveKey(uint32_t crypto_session_id, @@ -157,8 +162,13 @@ DVLOG(3) << __func__; CHECK(client_) << "Initialize not called."; + auto callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( + base::BindOnce(&MojoCdmProxy::OnKeyRemoved, weak_factory_.GetWeakPtr()), + media::CdmProxy::Status::kFail); + cdm_proxy_ptr_->RemoveKey(crypto_session_id, - std::vector<uint8_t>(key_id, key_id + key_id_size)); + std::vector<uint8_t>(key_id, key_id + key_id_size), + std::move(callback)); } void MojoCdmProxy::NotifyHardwareReset() { @@ -198,4 +208,14 @@ output_data); } +void MojoCdmProxy::OnKeySet(media::CdmProxy::Status status) { + DVLOG(3) << __func__ << ": status = " << status; + client_->OnKeySet(ToCdmStatus(status)); +} + +void MojoCdmProxy::OnKeyRemoved(media::CdmProxy::Status status) { + DVLOG(3) << __func__ << ": status = " << status; + client_->OnKeyRemoved(ToCdmStatus(status)); +} + } // namespace media
diff --git a/media/mojo/services/mojo_cdm_proxy.h b/media/mojo/services/mojo_cdm_proxy.h index 4b0edfd..ecdd264f 100644 --- a/media/mojo/services/mojo_cdm_proxy.h +++ b/media/mojo/services/mojo_cdm_proxy.h
@@ -61,6 +61,8 @@ void OnMediaCryptoSessionCreated(media::CdmProxy::Status status, uint32_t crypto_session_id, uint64_t output_data); + void OnKeySet(media::CdmProxy::Status status); + void OnKeyRemoved(media::CdmProxy::Status status); mojom::CdmProxyPtr cdm_proxy_ptr_; cdm::CdmProxyClient* client_;
diff --git a/media/mojo/services/mojo_cdm_proxy_service.cc b/media/mojo/services/mojo_cdm_proxy_service.cc index 1f4f0f6..fe8559b 100644 --- a/media/mojo/services/mojo_cdm_proxy_service.cc +++ b/media/mojo/services/mojo_cdm_proxy_service.cc
@@ -57,15 +57,18 @@ void MojoCdmProxyService::SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, media::CdmProxy::KeyType key_type, - const std::vector<uint8_t>& key_blob) { + const std::vector<uint8_t>& key_blob, + SetKeyCallback callback) { DVLOG(3) << __func__; - cdm_proxy_->SetKey(crypto_session_id, key_id, key_type, key_blob); + cdm_proxy_->SetKey(crypto_session_id, key_id, key_type, key_blob, + std::move(callback)); } void MojoCdmProxyService::RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) { + const std::vector<uint8_t>& key_id, + RemoveKeyCallback callback) { DVLOG(3) << __func__; - cdm_proxy_->RemoveKey(crypto_session_id, key_id); + cdm_proxy_->RemoveKey(crypto_session_id, key_id, std::move(callback)); } void MojoCdmProxyService::NotifyHardwareReset() {
diff --git a/media/mojo/services/mojo_cdm_proxy_service.h b/media/mojo/services/mojo_cdm_proxy_service.h index a39d700..1737e5f 100644 --- a/media/mojo/services/mojo_cdm_proxy_service.h +++ b/media/mojo/services/mojo_cdm_proxy_service.h
@@ -44,9 +44,11 @@ void SetKey(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, media::CdmProxy::KeyType key_type, - const std::vector<uint8_t>& key_blob) final; + const std::vector<uint8_t>& key_blob, + SetKeyCallback callback) final; void RemoveKey(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id) final; + const std::vector<uint8_t>& key_id, + RemoveKeyCallback callback) final; // CdmProxy::Client implementation. void NotifyHardwareReset() final;
diff --git a/media/mojo/services/mojo_cdm_proxy_unittest.cc b/media/mojo/services/mojo_cdm_proxy_unittest.cc index e5249adf..0eec104 100644 --- a/media/mojo/services/mojo_cdm_proxy_unittest.cc +++ b/media/mojo/services/mojo_cdm_proxy_unittest.cc
@@ -66,14 +66,16 @@ void(const std::vector<uint8_t>& input_data, CreateMediaCryptoSessionCB create_media_crypto_session_cb)); - MOCK_METHOD4(SetKey, + MOCK_METHOD5(SetKey, void(uint32_t crypto_session_id, const std::vector<uint8_t>& key_id, KeyType key_type, - const std::vector<uint8_t>& key_blob)); - MOCK_METHOD2(RemoveKey, + const std::vector<uint8_t>& key_blob, + SetKeyCB set_key_cb)); + MOCK_METHOD3(RemoveKey, void(uint32_t crypto_session_id, - const std::vector<uint8_t>& key_id)); + const std::vector<uint8_t>& key_id, + RemoveKeyCB remove_key_cb)); // media::CdmContext implementation. CdmProxyContext* GetCdmProxyContext() override { @@ -102,6 +104,8 @@ void(Status status, uint32_t crypto_session_id, uint64_t output_data)); + MOCK_METHOD1(OnKeySet, void(Status status)); + MOCK_METHOD1(OnKeyRemoved, void(Status status)); MOCK_METHOD0(NotifyHardwareReset, void()); }; @@ -214,7 +218,11 @@ const std::vector<uint8_t> key_id = {8, 9}; const std::vector<uint8_t> key_blob = {10, 11, 12}; EXPECT_CALL(*mock_cdm_proxy_, - SetKey(crypto_session_id_, key_id, _, key_blob)); + SetKey(crypto_session_id_, key_id, _, key_blob, _)) + .WillOnce([&](auto, auto, auto, auto, auto set_key_cb) { + std::move(set_key_cb).Run(Status::kOk); + }); + EXPECT_CALL(client_, OnKeySet(StatusEq(Status::kOk))); cdm_proxy_->SetKey(crypto_session_id_, key_id.data(), key_id.size(), cdm::CdmProxy::KeyType::kDecryptOnly, key_blob.data(), key_blob.size()); @@ -223,7 +231,11 @@ void RemoveKey() { const std::vector<uint8_t> key_id = {13, 14}; - EXPECT_CALL(*mock_cdm_proxy_, RemoveKey(crypto_session_id_, key_id)); + EXPECT_CALL(*mock_cdm_proxy_, RemoveKey(crypto_session_id_, key_id, _)) + .WillOnce([&](auto, auto, auto remove_key_cb) { + std::move(remove_key_cb).Run(Status::kOk); + }); + EXPECT_CALL(client_, OnKeyRemoved(StatusEq(Status::kOk))); cdm_proxy_->RemoveKey(crypto_session_id_, key_id.data(), key_id.size()); base::RunLoop().RunUntilIdle(); }
diff --git a/media/webrtc/audio_processor.cc b/media/webrtc/audio_processor.cc index 7c3295a..7a1e4d6 100644 --- a/media/webrtc/audio_processor.cc +++ b/media/webrtc/audio_processor.cc
@@ -106,7 +106,7 @@ if (!audio_processing_) return; - render_delay_ = base::TimeTicks::Now() - playout_time; + render_delay_ = playout_time - base::TimeTicks::Now(); constexpr int kMaxChannels = 2; DCHECK_GE(parameters.channels(), 1);
diff --git a/net/BUILD.gn b/net/BUILD.gn index 3a2683b..b7a551a 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -45,13 +45,15 @@ is_arm_cast_shell_build = is_chromecast && (current_cpu == "arm" || current_cpu == "arm64") -# Python works only on Linux, MacOS and Windows. +# Python works only on Linux, MacOS and Windows so exclude the others, +# chromecast, android, fuchsia, ios. enable_python_utils = !is_arm_cast_shell_build && !is_android && !is_fuchsia && !is_ios -# Android, Chromecast and Fuchsia can't run testserver.py directly, so they -# use remote test server. -use_remote_test_server = !enable_python_utils +# Platforms that cannot use python_utils (like Android but see full +# list above) will instead use a remote server, except for iOS which +# won't get either. +use_remote_test_server = !enable_python_utils && !is_ios config("net_test_config") { if (use_remote_test_server) { @@ -2180,7 +2182,7 @@ } if (is_fuchsia) { - public_deps += [ "//third_party/fuchsia-sdk/sdk:netstack" ] + public_deps += [ "//third_party/fuchsia-sdk:netstack" ] } if (use_platform_icu_alternatives) { @@ -5372,7 +5374,7 @@ use_test_server = true deps += [ "//third_party/fuchsia-sdk:fidl_cpp", - "//third_party/fuchsia-sdk/sdk:netstack", + "//third_party/fuchsia-sdk:netstack", ] sources += [ "base/network_change_notifier_fuchsia_unittest.cc" ] }
diff --git a/net/base/network_change_notifier_fuchsia_unittest.cc b/net/base/network_change_notifier_fuchsia_unittest.cc index 5d896ae3..000c0da 100644 --- a/net/base/network_change_notifier_fuchsia_unittest.cc +++ b/net/base/network_change_notifier_fuchsia_unittest.cc
@@ -146,13 +146,8 @@ void GetStats(uint32_t nicid, GetStatsCallback callback) override {} void GetAggregateStats(GetAggregateStatsCallback callback) override {} void SetInterfaceStatus(uint32_t nicid, bool enabled) override {} - void AddEthernetDevice( - fidl::StringPtr topological_path, - fidl::InterfaceHandle<::zircon::ethernet::Device> device) override {} - void StartRouteTableTransaction( - fidl::InterfaceRequest<fuchsia::netstack::RouteTableTransaction> - routeTableTransaction, - StartRouteTableTransactionCallback callback) override {} + void SetRouteTable( + ::fidl::VectorPtr<fuchsia::netstack::RouteTableEntry> rt) override {} void SetInterfaceAddress(uint32_t nicid, fuchsia::netstack::NetAddress addr, uint8_t prefixLen,
diff --git a/services/audio/input_controller.cc b/services/audio/input_controller.cc index a7a53c2..9f6f0c49 100644 --- a/services/audio/input_controller.cc +++ b/services/audio/input_controller.cc
@@ -115,9 +115,10 @@ DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); } -void InputController::ProcessingHelper::ChangeStreamMonitor(Snoopable* stream) { +void InputController::ProcessingHelper::ChangeMonitoredStream( + Snoopable* stream) { DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); - TRACE_EVENT1("audio", "AIC ChangeStreamMonitor", "stream", stream); + TRACE_EVENT1("audio", "AIC ChangeMonitoredStream", "stream", stream); if (!audio_processor_) return; if (monitored_output_stream_ == stream) @@ -179,6 +180,27 @@ return audio_processor_.get(); } +void InputController::ProcessingHelper::StartMonitoringStream( + Snoopable* output_stream) { + DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); + DCHECK(audio_processor_); + ChangeMonitoredStream(output_stream); +} + +void InputController::ProcessingHelper::StopMonitoringStream( + Snoopable* output_stream) { + DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); + DCHECK(audio_processor_); + if (output_stream == monitored_output_stream_) + ChangeMonitoredStream(nullptr); +} + +void InputController::ProcessingHelper::StopAllStreamMonitoring() { + DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); + DCHECK(audio_processor_); + ChangeMonitoredStream(nullptr); +} + #endif // defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) // Private subclass of AIC that covers the state while capturing audio. @@ -420,7 +442,7 @@ #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) // Disconnect from any output stream, so we don't get called when we're gone. if (processing_helper_) - processing_helper_->ChangeStreamMonitor(nullptr); + processing_helper_->StopAllStreamMonitoring(); #endif std::string log_string; @@ -536,7 +558,7 @@ case media::EchoCancellationType::kAec3: #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) if (processing_helper_) - processing_helper_->ChangeStreamMonitor(output_stream); + processing_helper_->StartMonitoringStream(output_stream); #endif break; case media::EchoCancellationType::kDisabled: @@ -549,7 +571,7 @@ DCHECK_CALLED_ON_VALID_THREAD(owning_thread_); #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) if (processing_helper_) - processing_helper_->ChangeStreamMonitor(nullptr); + processing_helper_->StopMonitoringStream(output_stream); #endif }
diff --git a/services/audio/input_controller.h b/services/audio/input_controller.h index 9a6a0d2..e38c592 100644 --- a/services/audio/input_controller.h +++ b/services/audio/input_controller.h
@@ -201,13 +201,24 @@ void StartEchoCancellationDump(base::File file) final; void StopEchoCancellationDump() final; - // Starts and/or stops snooping and updates |monitored_output_stream_| - // appropriately. - void ChangeStreamMonitor(Snoopable* output_stream); - media::AudioProcessor* GetAudioProcessor(); + // Starts monitoring |output_stream| instead of the currently monitored + // stream, if any. + void StartMonitoringStream(Snoopable* output_stream); + + // Stops monitoring |output_stream|, provided it's the currently monitored + // stream. + void StopMonitoringStream(Snoopable* output_stream); + + // Stops monitoring |monitored_output_stream_|, if not null. + void StopAllStreamMonitoring(); + private: + // Starts and/or stops snooping and updates |monitored_output_stream_| + // appropriately. + void ChangeMonitoredStream(Snoopable* output_stream); + THREAD_CHECKER(owning_thread_); const mojo::Binding<mojom::AudioProcessorControls> binding_;
diff --git a/services/audio/public/cpp/output_device_unittest.cc b/services/audio/public/cpp/output_device_unittest.cc index 258fd47a..a7186a5 100644 --- a/services/audio/public/cpp/output_device_unittest.cc +++ b/services/audio/public/cpp/output_device_unittest.cc
@@ -182,7 +182,13 @@ task_env_.RunUntilIdle(); } -TEST_F(AudioServiceOutputDeviceTest, VerifyDataFlow) { +// Flaky on Linux Chromium OS ASan LSan (https://crbug.com/889845) +#if defined(OS_CHROMEOS) && defined(ADDRESS_SANITIZER) +#define MAYBE_VerifyDataFlow DISABLED_VerifyDataFlow +#else +#define MAYBE_VerifyDataFlow VerifyDataFlow +#endif +TEST_F(AudioServiceOutputDeviceTest, MAYBE_VerifyDataFlow) { auto params(media::AudioParameters::UnavailableDeviceParams()); params.set_frames_per_buffer(kFrames); ASSERT_EQ(2, params.channels());
diff --git a/services/identity/public/cpp/access_token_fetcher.cc b/services/identity/public/cpp/access_token_fetcher.cc index 7069df9..2e4043b 100644 --- a/services/identity/public/cpp/access_token_fetcher.cc +++ b/services/identity/public/cpp/access_token_fetcher.cc
@@ -81,9 +81,10 @@ std::unique_ptr<OAuth2TokenService::Request> request_deleter( std::move(access_token_request_)); - RunCallbackAndMaybeDie(GoogleServiceAuthError::AuthErrorNone(), - AccessTokenInfo(token_response.access_token, - token_response.expiration_time)); + RunCallbackAndMaybeDie( + GoogleServiceAuthError::AuthErrorNone(), + AccessTokenInfo(token_response.access_token, + token_response.expiration_time, token_response.id_token)); // Potentially dead after the above invocation; nothing to do except return. }
diff --git a/services/identity/public/cpp/access_token_fetcher_unittest.cc b/services/identity/public/cpp/access_token_fetcher_unittest.cc index 9862f533..28aade20 100644 --- a/services/identity/public/cpp/access_token_fetcher_unittest.cc +++ b/services/identity/public/cpp/access_token_fetcher_unittest.cc
@@ -44,8 +44,11 @@ AccessTokenFetcherTest() : signin_client_(&pref_service_), token_service_(&pref_service_), - access_token_info_("access token", - base::Time::Now() + base::TimeDelta::FromHours(1)) { + access_token_info_( + "access token", + base::Time::Now() + base::TimeDelta::FromHours(1), + std:: + string() /* TODO(https://crbug.com/889764): Check id_token is passed along */) { AccountTrackerService::RegisterPrefs(pref_service_.registry()); account_tracker_ = std::make_unique<AccountTrackerService>();
diff --git a/services/identity/public/cpp/access_token_info.cc b/services/identity/public/cpp/access_token_info.cc index d4c68091..f29bebd18 100644 --- a/services/identity/public/cpp/access_token_info.cc +++ b/services/identity/public/cpp/access_token_info.cc
@@ -8,7 +8,8 @@ bool operator==(const AccessTokenInfo& lhs, const AccessTokenInfo& rhs) { return (lhs.token == rhs.token) && - (lhs.expiration_time == rhs.expiration_time); + (lhs.expiration_time == rhs.expiration_time) && + (lhs.id_token == rhs.id_token); } } // namespace identity
diff --git a/services/identity/public/cpp/access_token_info.h b/services/identity/public/cpp/access_token_info.h index 0a615f9..4d12757 100644 --- a/services/identity/public/cpp/access_token_info.h +++ b/services/identity/public/cpp/access_token_info.h
@@ -20,10 +20,18 @@ // The time at which this access token will expire. base::Time expiration_time; + // Contains extra information regarding the user's currently registered + // services. It is uncommon for consumers to need to interact with this field. + // To interact with it, first parse it via gaia::ParseServiceFlags(). + std::string id_token; + AccessTokenInfo() = default; AccessTokenInfo(const std::string& token_param, - const base::Time& expiration_time_param) - : token(token_param), expiration_time(expiration_time_param) {} + const base::Time& expiration_time_param, + const std::string& id_token) + : token(token_param), + expiration_time(expiration_time_param), + id_token(id_token) {} }; // Defined for testing purposes only.
diff --git a/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc b/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc index d58fb78..372a4c9 100644 --- a/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc +++ b/services/identity/public/cpp/primary_account_access_token_fetcher_unittest.cc
@@ -48,8 +48,12 @@ StrictMock<MockCallback<AccessTokenFetcher::TokenCallback>>; PrimaryAccountAccessTokenFetcherTest() - : access_token_info_("access token", - base::Time::Now() + base::TimeDelta::FromHours(1)) {} + : access_token_info_( + "access token", + base::Time::Now() + base::TimeDelta::FromHours(1), + std:: + string() /* TODO(https://crbug.com/889764): Check id_token is passed along */) { + } ~PrimaryAccountAccessTokenFetcherTest() override { }
diff --git a/services/network/cors/cors_url_loader.cc b/services/network/cors/cors_url_loader.cc index fc8ab1ae..a89ac86 100644 --- a/services/network/cors/cors_url_loader.cc +++ b/services/network/cors/cors_url_loader.cc
@@ -190,7 +190,6 @@ DCHECK(!is_waiting_follow_redirect_call_); if (fetch_cors_flag_) { - // TODO(toyoshim): Reflect --allow-file-access-from-files flag. const auto error_status = CheckAccess( request_.url, response_head.headers->response_code(), GetHeaderString(response_head, header_names::kAccessControlAllowOrigin), @@ -226,7 +225,6 @@ // failure, then return a network error. if (fetch_cors_flag_ && IsCORSEnabledRequestMode(request_.fetch_request_mode)) { - // TODO(toyoshim): Reflect --allow-file-access-from-files flag. const auto error_status = CheckAccess( request_.url, response_head.headers->response_code(), GetHeaderString(response_head, header_names::kAccessControlAllowOrigin),
diff --git a/services/network/cors/preflight_controller.cc b/services/network/cors/preflight_controller.cc index 8828fa4..3d9b389 100644 --- a/services/network/cors/preflight_controller.cc +++ b/services/network/cors/preflight_controller.cc
@@ -120,15 +120,13 @@ base::Optional<CORSErrorStatus>* detected_error_status) { DCHECK(detected_error_status); - // TODO(toyoshim): Reflect --allow-file-access-from-files flag. *detected_error_status = CheckPreflightAccess( final_url, head.headers->response_code(), GetHeaderString(head.headers, header_names::kAccessControlAllowOrigin), GetHeaderString(head.headers, header_names::kAccessControlAllowCredentials), original_request.fetch_credentials_mode, - tainted ? url::Origin() : *original_request.request_initiator, - false /* allow_file_origin */); + tainted ? url::Origin() : *original_request.request_initiator); if (*detected_error_status) return nullptr;
diff --git a/services/network/public/cpp/cors/cors.cc b/services/network/public/cpp/cors/cors.cc index b117c22..e3b2993e 100644 --- a/services/network/public/cpp/cors/cors.cc +++ b/services/network/public/cpp/cors/cors.cc
@@ -43,18 +43,6 @@ return std::string(); } -// url::Origin::Serialize() serializes all Origins with a 'file' scheme to -// 'file://', but it isn't desirable for CORS check. Returns 'null' instead to -// be aligned with HTTP Origin header calculation in Blink SecurityOrigin. -// |allow_file_origin| is used to realize a behavior change that -// the --allow-file-access-from-files command-line flag needs. -// TODO(mkwst): Generalize and move to url/Origin. -std::string Serialize(const url::Origin& origin, bool allow_file_origin) { - if (!allow_file_origin && origin.scheme() == url::kFileScheme) - return "null"; - return origin.Serialize(); -} - // Returns true only if |header_value| satisfies ABNF: 1*DIGIT [ "." 1*DIGIT ] bool IsSimilarToDoubleABNF(const std::string& header_value) { if (header_value.empty()) @@ -135,8 +123,7 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, mojom::FetchCredentialsMode credentials_mode, - const url::Origin& origin, - bool allow_file_origin) { + const url::Origin& origin) { // TODO(toyoshim): This response status code check should not be needed. We // have another status code check after a CheckAccess() call if it is needed. if (!response_status_code) @@ -159,7 +146,7 @@ return CORSErrorStatus(mojom::CORSError::kWildcardOriginNotAllowed); } else if (!allow_origin_header) { return CORSErrorStatus(mojom::CORSError::kMissingAllowOriginHeader); - } else if (*allow_origin_header != Serialize(origin, allow_file_origin)) { + } else if (*allow_origin_header != origin.Serialize()) { // We do not use url::Origin::IsSameOriginWith() here for two reasons below. // 1. Allow "null" to match here. The latest spec does not have a clear // information about this (https://fetch.spec.whatwg.org/#cors-check), @@ -217,12 +204,10 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, mojom::FetchCredentialsMode actual_credentials_mode, - const url::Origin& origin, - bool allow_file_origin) { + const url::Origin& origin) { const auto error_status = CheckAccess(response_url, response_status_code, allow_origin_header, - allow_credentials_header, actual_credentials_mode, origin, - allow_file_origin); + allow_credentials_header, actual_credentials_mode, origin); if (!error_status) return base::nullopt;
diff --git a/services/network/public/cpp/cors/cors.h b/services/network/public/cpp/cors/cors.h index cbe6219..1269716 100644 --- a/services/network/public/cpp/cors/cors.h +++ b/services/network/public/cpp/cors/cors.h
@@ -56,8 +56,7 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, mojom::FetchCredentialsMode credentials_mode, - const url::Origin& origin, - bool allow_file_origin = false); + const url::Origin& origin); // Performs a CORS access check on the CORS-preflight response parameters. // According to the note at https://fetch.spec.whatwg.org/#cors-preflight-fetch @@ -70,8 +69,7 @@ const base::Optional<std::string>& allow_origin_header, const base::Optional<std::string>& allow_credentials_header, mojom::FetchCredentialsMode actual_credentials_mode, - const url::Origin& origin, - bool allow_file_origin = false); + const url::Origin& origin); // Given a redirected-to URL, checks if the location is allowed // according to CORS. That is:
diff --git a/skia/BUILD.gn b/skia/BUILD.gn index cfbf1aa8..250a595 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn
@@ -499,7 +499,7 @@ "ext/fontmgr_fuchsia.h", ] deps += [ - "//third_party/fuchsia-sdk/sdk:fonts", + "//third_party/fuchsia-sdk:fonts", "//third_party/icu:icuuc", ] } @@ -823,7 +823,7 @@ if (is_fuchsia) { sources += [ "ext/fontmgr_fuchsia_unittest.cc" ] deps += [ - "//third_party/fuchsia-sdk/sdk:fonts", + "//third_party/fuchsia-sdk:fonts", "//third_party/test_fonts", ] data_deps = [
diff --git a/testing/buildbot/filters/chromeos.single_process_mash.browser_tests.filter b/testing/buildbot/filters/chromeos.single_process_mash.browser_tests.filter index d829630..e31a8f2a 100644 --- a/testing/buildbot/filters/chromeos.single_process_mash.browser_tests.filter +++ b/testing/buildbot/filters/chromeos.single_process_mash.browser_tests.filter
@@ -172,6 +172,18 @@ # Default extension tests. -DefaultProfileExtensionBrowserTest.NoExtensionHosts +# Encrypted media tests are flaky due to race condition. crbug.com/880584 +-ECKEncryptedMediaTest.* +-EncryptedMediaTest.* +-CDM_9/ECKEncryptedMediaTest.* +-CDM_10/ECKEncryptedMediaTest.* +-CDM_11/ECKEncryptedMediaTest.* +-MSE_ClearKey/EncryptedMediaTest.* +-MSE_ExternalClearKey/EncryptedMediaTest.* +-MSE_Widevine/EncryptedMediaTest.* +-SRC_ClearKey/EncryptedMediaTest.* +-SRC_ExternalClearKey/EncryptedMediaTest.* + # Failing on ASAN bot. crbug.com/882631 -ExtensionWebRequestApiTest.WebRequestTypes @@ -192,6 +204,12 @@ -ManagedWithoutPermission/ManagedWithoutPermissionPlatformKeysTest.* -ManagedWithPermission/ManagedWithPermissionPlatformKeysTest.* +# Needs video surface layer support. Should be fixed when renderers don't use +# the window service for embedding. +# https://crbug.com/884589 https://crbug.com/881574 +-MediaEngagementBrowserTest.* +-MediaEngagementAutoplayBrowserTest.* + # Flaky https://crbug.com/887175 -PrerenderBrowserTest.PrerenderHTML5VideoJs
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index a89da6b..9ba4931 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -77,7 +77,6 @@ crbug.com/714962 external/wpt/css/css-fonts/font-features-across-space-3.html [ Pass ] crbug.com/591099 external/wpt/css/css-position/position-sticky-writing-modes.html [ Failure ] crbug.com/591099 external/wpt/css/css-rhythm/ [ Skip ] -crbug.com/714962 external/wpt/css/css-scroll-anchoring/wrapped-text.html [ Failure ] crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/polygon/shape-outside-polygon-017.html [ Pass ] crbug.com/845902 external/wpt/css/css-sizing/whitespace-and-break.html [ Pass ] crbug.com/591099 external/wpt/css/css-text/line-breaking/line-breaking-009.html [ Pass ] @@ -272,10 +271,10 @@ crbug.com/591099 external/wpt/media-source/mediasource-config-change-mp4-v-bitrate.html [ Failure ] crbug.com/591099 external/wpt/offscreen-canvas/convert-to-blob/offscreencanvas.convert.to.blob.html [ Pass ] crbug.com/591099 external/wpt/performance-timeline/po-observe.html [ Timeout ] -crbug.com/591099 external/wpt/picture-in-picture/request-picture-in-picture-twice.html [ Pass ] +crbug.com/591099 external/wpt/picture-in-picture/request-picture-in-picture-twice.html [ Pass Timeout ] crbug.com/591099 external/wpt/pointerevents/pointerevent_click_during_capture-manual.html [ Crash Timeout ] crbug.com/591099 external/wpt/quirks/line-height-calculation.html [ Failure ] -crbug.com/591099 external/wpt/requestidlecallback/callback-iframe.html [ Pass Timeout ] +crbug.com/591099 external/wpt/requestidlecallback/callback-iframe.html [ Pass ] crbug.com/591099 external/wpt/requestidlecallback/callback-timeout-when-busy.html [ Timeout ] crbug.com/591099 external/wpt/requestidlecallback/callback-timeout.html [ Timeout ] crbug.com/591099 external/wpt/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html [ Failure ] @@ -330,6 +329,7 @@ crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_outline_properties.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_outline_shorthand.html [ Failure ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/voice_object/voice_white-space_normal_wrapped.html [ Failure ] +crbug.com/591099 external/wpt/workers/Worker_ErrorEvent_error.htm [ Pass ] crbug.com/591099 external/wpt/workers/Worker_terminate_event_queue.htm [ Timeout ] crbug.com/591099 external/wpt/workers/baseurl/alpha/worker-in-worker.html [ Pass ] crbug.com/591099 external/wpt/workers/constructors/Worker/same-origin.html [ Timeout ] @@ -338,7 +338,7 @@ crbug.com/591099 external/wpt/xhr/send-content-type-string.htm [ Pass ] crbug.com/591099 external/wpt/xhr/send-entity-body-document.htm [ Pass ] crbug.com/591099 fast/backgrounds/quirks-mode-line-box-backgrounds.html [ Failure ] -crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Failure ] +crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Crash Failure ] crbug.com/591099 fast/block/float/nopaint-after-layer-destruction.html [ Failure ] crbug.com/591099 fast/block/float/nopaint-after-layer-destruction2.html [ Failure ] crbug.com/591099 fast/block/float/overlapping-floats-paint-hittest-order-1.html [ Failure ] @@ -346,7 +346,7 @@ crbug.com/591099 fast/borders/bidi-002.html [ Failure ] crbug.com/859497 fast/borders/bidi-009a.html [ Failure ] crbug.com/591099 fast/borders/inline-mask-overlay-image-outset-vertical-rl.html [ Failure ] -crbug.com/591099 fast/box-sizing/replaced.html [ Failure Pass ] +crbug.com/591099 fast/box-sizing/replaced.html [ Failure ] crbug.com/591099 fast/css-grid-layout/maximize-tracks-definite-indefinite-width.html [ Failure ] crbug.com/591099 fast/css-intrinsic-dimensions/height-positioned.html [ Failure ] crbug.com/807708 fast/css-intrinsic-dimensions/width-avoid-floats.html [ Failure ] @@ -358,13 +358,8 @@ crbug.com/835484 fast/css/outline-auto-empty-rects.html [ Failure ] crbug.com/835484 fast/css/outline-narrowLine.html [ Failure ] crbug.com/591099 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under.html [ Failure ] -crbug.com/591099 fast/events/touch/compositor-touch-hit-rects-continuation.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/compositor-touch-hit-rects-table.html [ Failure Pass ] +crbug.com/591099 fast/events/popup-allowed-from-gesture-initiated-event.html [ Failure ] crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/591099 fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure Pass ] crbug.com/591099 fast/events/wheel/mainthread-touchpad-fling-latching.html [ Pass ] crbug.com/591099 fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Pass ] crbug.com/591099 fast/forms/placeholder-position.html [ Failure ] @@ -379,7 +374,7 @@ crbug.com/591099 fast/overflow/overflow-update-transform.html [ Failure ] crbug.com/591099 fast/overflow/recompute-overflow-of-layout-root-container.html [ Failure ] crbug.com/591099 fast/replaced/table-replaced-element.html [ Failure ] -crbug.com/591099 fast/scrolling/scrollbar-tickmarks-hittest.html [ Failure Pass ] +crbug.com/591099 fast/scrolling/scrollbar-tickmarks-hittest.html [ Pass ] crbug.com/591099 fast/sub-pixel/sub-pixel-border-2.html [ Failure ] crbug.com/591099 fast/table/border-collapsing/004-vertical.html [ Failure ] crbug.com/591099 fast/table/border-collapsing/composited-cell-collapsed-border.html [ Failure ] @@ -422,7 +417,7 @@ crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-appcache.https.html [ Crash Failure ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.https.html [ Crash Failure Pass ] crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash ] -crbug.com/591099 idle-callback/test-runner-run-idle-tasks.html [ Crash Pass Timeout ] +crbug.com/591099 idle-callback/test-runner-run-idle-tasks.html [ Pass ] crbug.com/591099 images/color-profile-image-filter-all.html [ Failure ] crbug.com/591099 images/rendering-broken-block-flow-images.html [ Failure ] crbug.com/591099 images/rendering-broken-images.html [ Failure ] @@ -431,6 +426,8 @@ crbug.com/714962 inspector-protocol/layout-fonts/languages-emoji-rare-glyphs.js [ Failure ] crbug.com/591099 inspector-protocol/timeline/page-frames.js [ Failure ] crbug.com/591099 intersection-observer/v2/text-shadow.html [ Failure ] +crbug.com/591099 media/audio-controls-rendering.html [ Failure ] +crbug.com/591099 media/media-document-audio-repaint.html [ Failure ] crbug.com/591099 media/video-display-toggle.html [ Failure ] crbug.com/591099 media/video-layer-crash.html [ Failure ] crbug.com/591099 paint/float/float-under-inline-self-painting-change.html [ Failure ] @@ -510,26 +507,23 @@ crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-filter-all.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-block-flow-images.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-images.html [ Failure ] +crbug.com/591099 virtual/gpu/fast/canvas/canvas-arc-circumference.html [ Failure Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-color-over-image.html [ Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-blending-gradient-over-pattern.html [ Pass Timeout ] +crbug.com/591099 virtual/gpu/fast/canvas/canvas-ellipse-circumference.html [ Failure Pass ] crbug.com/591099 virtual/intersection-observer-v2/intersection-observer/v2/text-shadow.html [ Failure ] crbug.com/591099 virtual/layout_ng/ [ Skip ] crbug.com/824918 virtual/layout_ng_experimental/ [ Skip ] crbug.com/591099 virtual/mojo-blob-urls/external/wpt/FileAPI/url/sandboxed-iframe.html [ Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-continuation.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-table.html [ Failure Pass ] +crbug.com/591099 virtual/mouseevent_fractional/fast/events/popup-allowed-from-gesture-initiated-event.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/wheel/mainthread-touchpad-fling-latching.html [ Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/wheel/wheel-scroll-latching-on-scrollbar.html [ Pass ] crbug.com/591099 virtual/new-remote-playback-pipeline/ [ Skip ] crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/redirect/redirect-count.any.html [ Pass ] crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/redirect/redirect-count.any.worker.html [ Pass ] crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/request/request-keepalive-quota.html?include=slow-2 [ Pass ] -crbug.com/591099 virtual/outofblink-cors-ns/http/tests/fetch/chromium/release-handle-crash.html [ Crash Pass ] +crbug.com/591099 virtual/outofblink-cors-ns/http/tests/fetch/chromium/release-handle-crash.html [ Pass ] crbug.com/591099 virtual/outofblink-cors-ns/http/tests/security/cors-rfc1918/addressspace-document-appcache.https.html [ Crash Failure ] crbug.com/591099 virtual/outofblink-cors-ns/http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.https.html [ Crash Failure Pass ] crbug.com/591099 virtual/outofblink-cors-ns/http/tests/security/document-domain-canonicalizes.html [ Pass ] @@ -552,14 +546,11 @@ crbug.com/591099 virtual/stable/ [ Skip ] crbug.com/591099 virtual/threaded/ [ Skip ] crbug.com/591099 virtual/user-activation-v2/fast/events/mouse-cursor.html [ Failure ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-continuation.html [ Failure Pass ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.html [ Failure Pass ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure Pass ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-table.html [ Failure Pass ] +crbug.com/591099 virtual/user-activation-v2/fast/events/popup-allowed-from-gesture-initiated-event.html [ Failure ] crbug.com/591099 virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure Pass ] -crbug.com/591099 virtual/user-activation-v2/fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure Pass ] +crbug.com/591099 virtual/video-surface-layer/media/audio-controls-rendering.html [ Failure ] +crbug.com/591099 virtual/video-surface-layer/media/media-document-audio-repaint.html [ Failure ] crbug.com/591099 virtual/video-surface-layer/media/video-aspect-ratio.html [ Failure ] crbug.com/591099 virtual/video-surface-layer/media/video-display-toggle.html [ Failure ] -crbug.com/591099 virtual/video-surface-layer/media/video-layer-crash.html [ Failure ] +crbug.com/591099 virtual/video-surface-layer/media/video-layer-crash.html [ Crash Failure ] crbug.com/591099 virtual/webrtc-wpt-unified-plan/external/wpt/webrtc/RTCDTMFSender-ontonechange.https.html [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 89ae837..83a32bdf 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1838,7 +1838,6 @@ crbug.com/862716 [ Mac Linux Win ] css3/filters/effect-brightness-clamping-hw.html [ Failure Pass Timeout ] crbug.com/862806 [ Mac ] css3/filters/effect-drop-shadow-hw.html [ Failure Pass ] -crbug.com/862826 [ Mac Linux ] external/wpt/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html [ Failure Pass ] # gpuBenchmarking.pinchBy is busted on desktops for touchscreen pinch crbug.com/787615 [ Win Linux Fuchsia ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-zoom-in-slow.html [ Failure Pass ] @@ -5208,6 +5207,10 @@ crbug.com/886566 http/tests/csspaint/invalidation-border-image.html [ Pass Timeout ] crbug.com/886566 http/tests/csspaint/invalidation-content-image.html [ Pass Timeout ] +# Skia roll +crbug.com/884166 virtual/gpu/fast/canvas/canvas-arc-circumference.html [ Failure ] +crbug.com/884166 virtual/gpu/fast/canvas/canvas-ellipse-circumference.html [ Failure ] + # Enable AnimationWorklet tests for mainthread crbug.com/887659 animations/animationworklet/animation-worklet-inside-iframe.html [ Failure ] crbug.com/887659 animations/animationworklet/animator-animate.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json index f118ebb..422f6529 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json
@@ -98639,6 +98639,18 @@ {} ] ], + "html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border.html": [ + [ + "/html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border.html", + [ + [ + "/html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-border-gap-negative-margin.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-border-gap-negative-margin.html", @@ -98807,6 +98819,18 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html", + [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item.html", @@ -158758,6 +158782,11 @@ {} ] ], + "html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border-ref.html": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/META.yml": [ [ {} @@ -158888,6 +158917,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-ref.html": [ [ {} @@ -164748,6 +164782,11 @@ {} ] ], + "media-capabilities/encodingInfo-expected.txt": [ + [ + {} + ] + ], "media-capabilities/idlharness-expected.txt": [ [ {} @@ -208096,6 +208135,12 @@ {} ] ], + "dom/events/shadow-relatedTarget.html": [ + [ + "/dom/events/shadow-relatedTarget.html", + {} + ] + ], "dom/historical.html": [ [ "/dom/historical.html", @@ -227424,6 +227469,12 @@ {} ] ], + "html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html": [ + [ + "/html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html", + {} + ] + ], "html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html": [ [ "/html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html", @@ -232797,7 +232848,9 @@ "html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html": [ [ "/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html", - {} + { + "timeout": "long" + } ] ], "html/syntax/parsing/the-end.html": [ @@ -235000,6 +235053,12 @@ {} ] ], + "media-capabilities/encodingInfo.html": [ + [ + "/media-capabilities/encodingInfo.html", + {} + ] + ], "media-capabilities/idlharness.any.js": [ [ "/media-capabilities/idlharness.any.html", @@ -238526,6 +238585,18 @@ {} ] ], + "navigation-timing/dom_interactive_image_document.html": [ + [ + "/navigation-timing/dom_interactive_image_document.html", + {} + ] + ], + "navigation-timing/dom_interactive_media_document.html": [ + [ + "/navigation-timing/dom_interactive_media_document.html", + {} + ] + ], "navigation-timing/idlharness.window.js": [ [ "/navigation-timing/idlharness.window.html", @@ -367035,6 +367106,10 @@ "241dda8b66f8c8fe128e736bcb073479aee634a9", "support" ], + "dom/events/shadow-relatedTarget.html": [ + "713555b7d8ab6117d12c70d08185335246e44e1a", + "testharness" + ], "dom/historical-expected.txt": [ "2c0959b792338984140c1b30f5a9e2baab7f95ec", "support" @@ -374544,7 +374619,7 @@ "support" ], "fullscreen/api/document-exit-fullscreen-timing-manual.html": [ - "7a536363a213782bde010c93bc26677b62bb2f2a", + "6ccc365c711500024898c336d0cbe8679c2cf32c", "manual" ], "fullscreen/api/document-exit-fullscreen-twice-manual.html": [ @@ -374588,7 +374663,7 @@ "manual" ], "fullscreen/api/element-ready-check-containing-iframe-manual.html": [ - "8ba2ab71b158603e1af466d69b91412626ff8722", + "0649549265682b7eb8c0f851603d816e89e1cf47", "manual" ], "fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html": [ @@ -374612,7 +374687,7 @@ "support" ], "fullscreen/api/element-ready-check-not-allowed-manual.html": [ - "1e18be5e677b3b27c553e961f71ae44d85225a8e", + "fa5a923b2b2641b8d3181c587560a554ab621b3e", "manual" ], "fullscreen/api/element-ready-check-not-in-document-manual.html": [ @@ -374624,7 +374699,7 @@ "testharness" ], "fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html": [ - "dc2a99c1e83369ca72d3ea564e056cd21cba63ab", + "6d5bed19f3b12c0b83dfb29cb0df282d52980ef3", "manual" ], "fullscreen/api/element-request-fullscreen-and-move-manual.html": [ @@ -374684,7 +374759,7 @@ "support" ], "fullscreen/api/element-request-fullscreen-timing-manual.html": [ - "359b688b42722678182b7809baca65c64a59c824", + "1ebf7518c3c0712994dafdcd2bf02a467b4aae9e", "manual" ], "fullscreen/api/element-request-fullscreen-top-manual.html": [ @@ -374732,7 +374807,7 @@ "testharness" ], "fullscreen/model/move-to-fullscreen-iframe-manual.html": [ - "69082cacc2b451556ad0675f9fb876dcf3136d92", + "59b2c4330f25bd3811cd088fcabd925022038947", "manual" ], "fullscreen/model/move-to-iframe-manual.html": [ @@ -374784,7 +374859,7 @@ "manual" ], "fullscreen/rendering/ua-style-iframe-manual.html": [ - "bf93aa28c3f10e65cf975f5a14833eff7b9ee688", + "f2a227437a5455e530e46cb0ff06d1ec18fc9bab", "manual" ], "fullscreen/trusted-click.js": [ @@ -383683,6 +383758,14 @@ "59c5ca70d41cc969aed7ac6a531c1ca9a5f82f0f", "reftest" ], + "html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border-ref.html": [ + "2f313f3395ff237c131fdf7646b07541734e5dad", + "support" + ], + "html/rendering/non-replaced-elements/tables/transformed-tbody-tr-collapsed-border.html": [ + "5f131e6658ae1bc7f013974d6975122d5cba2c97", + "reftest" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/META.yml": [ "f5b533c377160c77541187a301647e174069bd6d", "support" @@ -383923,6 +384006,14 @@ "edd2600d4a0749d281e7ed1b4da4aefbd7c686ba", "testharness" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html": [ + "8023c5255ff2db03f315246ecb7cfdea829f08cc", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html": [ + "ba58d353a01f2b284e5c296455e6b54b6f705d0b", + "reftest" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-ref.html": [ "ee76e93b64e1da9ab5883c328d9fff1eb865acb1", "support" @@ -387055,6 +387146,10 @@ "d245bf0b96451b3419e0e69bda86fe4859c9cbfe", "testharness" ], + "html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html": [ + "57189a0b884d3a55e4bb2ba1a1d3aa83066c0eb3", + "testharness" + ], "html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html": [ "c339525ebd177ac6249b4cf802b89881bfd99b1a", "testharness" @@ -392500,7 +392595,7 @@ "testharness" ], "html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html": [ - "e1f9995117f7b9974576e7e4ffb3d01e15b2deaa", + "bec3364adffec6c3ea66fb3e3f5bcaa6d244a3da", "testharness" ], "html/syntax/parsing/test.js": [ @@ -395644,7 +395739,15 @@ "support" ], "media-capabilities/decodingInfo.html": [ - "f3fca4184e4c3f56db700dae390a7416bc3a910a", + "982bc1746685871bfa424c88b6eab8d1d00478de", + "testharness" + ], + "media-capabilities/encodingInfo-expected.txt": [ + "a8c1a00f9e4d08854fe3fae072427fafd4c3b30f", + "support" + ], + "media-capabilities/encodingInfo.html": [ + "5c0e3189082eda87fe44a77262f3b4156783fa39", "testharness" ], "media-capabilities/idlharness-expected.txt": [ @@ -399435,6 +399538,14 @@ "0264dfb0bfbbb8adacb6f88ea82970dfd8ccb81d", "support" ], + "navigation-timing/dom_interactive_image_document.html": [ + "36742f0eff6d07c7c0694b066dfa017f0d1042be", + "testharness" + ], + "navigation-timing/dom_interactive_media_document.html": [ + "e4e45725d83605b519ce74ea8ff4561dcd3d7595", + "testharness" + ], "navigation-timing/idlharness.window.js": [ "8cc3546b3c27a9d93ee5621584d83d56a308513c", "testharness"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/dom/events/shadow-relatedTarget.html b/third_party/WebKit/LayoutTests/external/wpt/dom/events/shadow-relatedTarget.html new file mode 100644 index 0000000..713555b7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/dom/events/shadow-relatedTarget.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<!-- + This test is adopted from Olli Pettay's test case at + http://mozilla.pettay.fi/shadow_focus.html +--> +<div id="host"></div> +<input id="lightInput"> +<script> +const root = host.attachShadow({ mode: "closed" }); +root.innerHTML = "<input id='shadowInput'>"; + +async_test((test) => { + root.getElementById("shadowInput").focus(); + window.addEventListener("focus", test.step_func_done((e) => { + assert_equals(e.relatedTarget, host); + }, "relatedTarget should be pointing to shadow host."), true); + lightInput.focus(); +}, "relatedTarget should not leak at capturing phase, at window object."); + +async_test((test) => { + root.getElementById("shadowInput").focus(); + lightInput.addEventListener("focus", test.step_func_done((e) => { + assert_equals(e.relatedTarget, host); + }, "relatedTarget should be pointing to shadow host."), true); + lightInput.focus(); +}, "relatedTarget should not leak at target."); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-timing-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-timing-manual.html index 7a536363..6ccc365 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-timing-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/document-exit-fullscreen-timing-manual.html
@@ -20,7 +20,7 @@ const events = []; const callback = t.step_func(event => { // fullscreenElement should have changed before either event is fired. - assert_equals(document.fullscreenElement, null, `fullscreenElement in {event.type} event`); + assert_equals(document.fullscreenElement, null, `fullscreenElement in ${event.type} event`); events.push(event.type); if (event.type == 'fullscreenchange') { step_timeout(t.unreached_func('timer callback'));
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html index 8ba2ab7..0649549 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html
@@ -7,18 +7,19 @@ <iframe allowfullscreen></iframe> <iframe allowfullscreen></iframe> <script> -async_test(function(t) -{ - var iframes = document.getElementsByTagName("iframe"); - trusted_request(t, iframes[0].contentDocument.body, document.body); - iframes[0].contentDocument.onfullscreenchange = t.step_func(function() - { - assert_equals(document.fullscreenElement, iframes[0]); - trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body); - iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() { - assert_equals(document.fullscreenElement, iframes[1]); - }); - iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error"); - }); -}); +// wait for load event to avoid https://bugzil.la/1493878 +window.onload = function() { + async_test(function(t) { + var iframes = document.getElementsByTagName("iframe"); + trusted_request(t, iframes[0].contentDocument.body, document.body); + iframes[0].contentDocument.onfullscreenchange = t.step_func(function() { + assert_equals(document.fullscreenElement, iframes[0]); + trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body); + iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() { + assert_equals(document.fullscreenElement, iframes[1]); + }); + iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error"); + }); + }); +}; </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-not-allowed-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-not-allowed-manual.html index 1e18be5e..fa5a923 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-not-allowed-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-not-allowed-manual.html
@@ -6,14 +6,16 @@ <div id="log"></div> <iframe></iframe> <script> -async_test(function(t) -{ - var iframe = document.querySelector("iframe"); - document.onfullscreenchange = t.unreached_func("document fullscreenchange event"); - document.onfullscreenerror = t.unreached_func("document fullscreenerror event"); - iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event"); - iframe.contentDocument.onfullscreenerror = t.step_func_done(); - assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag"); - trusted_request(t, iframe.contentDocument.body, document.body); -}); +// wait for load event to avoid https://bugzil.la/1493878 +window.onload = function() { + async_test(function(t) { + var iframe = document.querySelector("iframe"); + document.onfullscreenchange = t.unreached_func("document fullscreenchange event"); + document.onfullscreenerror = t.unreached_func("document fullscreenerror event"); + iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event"); + iframe.contentDocument.onfullscreenerror = t.step_func_done(); + assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag"); + trusted_request(t, iframe.contentDocument.body, document.body); + }); +}; </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html index dc2a99c..6d5bed1 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html
@@ -6,37 +6,40 @@ <div id="log"></div> <iframe allowfullscreen></iframe> <script> -async_test(t => { - const iframe = document.querySelector('iframe'); - const iframeDoc = iframe.contentDocument; - const iframeBody = iframeDoc.body; +// wait for load event to avoid https://bugzil.la/1493878 +window.onload = function() { + async_test(t => { + const iframe = document.querySelector('iframe'); + const iframeDoc = iframe.contentDocument; + const iframeBody = iframeDoc.body; - let count = 0; - document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => { - count++; - assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events'); - // Both when entering and exiting, the fullscreenchange event is fired first - // on the outer document and then on the iframe's document. This is because - // the events are fired in animation frame tasks, which run in "frame tree" - // order. - const expected = { - target: count == 1 || count == 3 ? iframe : iframeBody, - outerFullscreenElement: count <= 2 ? iframe : null, - innerFullscreenElement: count <= 2 ? iframeBody : null, - }; - assert_equals(event.target, expected.target, 'event target'); - assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement'); - assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement'); - if (count == 2) { - iframeDoc.exitFullscreen(); - } else if (count == 4) { - // Done, but set timeout to fail on extra events. - step_timeout(t.step_func_done()); - } + let count = 0; + document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => { + count++; + assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events'); + // Both when entering and exiting, the fullscreenchange event is fired first + // on the outer document and then on the iframe's document. This is because + // the events are fired in animation frame tasks, which run in "frame tree" + // order. + const expected = { + target: count == 1 || count == 3 ? iframe : iframeBody, + outerFullscreenElement: count <= 2 ? iframe : null, + innerFullscreenElement: count <= 2 ? iframeBody : null, + }; + assert_equals(event.target, expected.target, 'event target'); + assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement'); + assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement'); + if (count == 2) { + iframeDoc.exitFullscreen(); + } else if (count == 4) { + // Done, but set timeout to fail on extra events. + step_timeout(t.step_func_done()); + } + }); + document.onfullscreenerror = t.unreached_func('fullscreenerror event'); + iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event'); + + trusted_request(t, iframeBody, iframeBody); }); - document.onfullscreenerror = t.unreached_func('fullscreenerror event'); - iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event'); - - trusted_request(t, iframeBody, iframeBody); -}); +}; </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-timing-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-timing-manual.html index 359b688..1ebf7518 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-timing-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-timing-manual.html
@@ -28,21 +28,25 @@ }, 'Timing of fullscreenchange and resize events'); async_test(t => { - var promise = document.createElement('a').requestFullscreen(); - var promise_executed = false; - if (promise) { - promise.catch(()=>{promise_executed = true; }); - } else { - // if promises aren't supported treat it as executed. - promise_executed = true; - } + // Gecko throttles requestAnimationFrame before the first paint, so + // wrap the test to work around that. + requestAnimationFrame(t.step_func(() => { + var promise = document.createElement('a').requestFullscreen(); + var promise_executed = false; + if (promise) { + promise.catch(()=>{promise_executed = true; }); + } else { + // if promises aren't supported treat it as executed. + promise_executed = true; + } - // If fullscreenerror is an animation frame event, then animation frame - // callbacks should be run after it is fired, before the timer callback. - document.onfullscreenerror = t.step_func(() => { - assert_true(promise_executed, "promise executed"); - step_timeout(t.unreached_func('timer callback')); - requestAnimationFrame(t.step_func_done()); - }); + // If fullscreenerror is an animation frame event, then animation frame + // callbacks should be run after it is fired, before the timer callback. + document.onfullscreenerror = t.step_func(() => { + assert_true(promise_executed, "promise executed"); + step_timeout(t.unreached_func('timer callback')); + requestAnimationFrame(t.step_func_done()); + }); + })); }, 'Timing of fullscreenerror event'); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/model/move-to-fullscreen-iframe-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/model/move-to-fullscreen-iframe-manual.html index 69082ca..59b2c43 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/model/move-to-fullscreen-iframe-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/model/move-to-fullscreen-iframe-manual.html
@@ -5,33 +5,36 @@ <script src="../trusted-click.js"></script> <iframe allowfullscreen></iframe> <script> -async_test(t => { - const iframe = document.querySelector('iframe'); - const iframeDoc = iframe.contentDocument; +// wait for load event to avoid https://bugzil.la/1493878 +window.onload = function() { + async_test(t => { + const iframe = document.querySelector('iframe'); + const iframeDoc = iframe.contentDocument; - // Enter fullscreen for the iframe's body element. - trusted_request(t, iframeDoc.body, iframeDoc.body); - document.onfullscreenchange = t.step_func(() => { - assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element"); - assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element"); + // Enter fullscreen for the iframe's body element. + trusted_request(t, iframeDoc.body, iframeDoc.body); + document.onfullscreenchange = t.step_func(() => { + assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element"); + assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element"); - // Then, move the outer document's body into the iframe. This is an unusual - // thing to do, but means that the iframe is removed from its document and - // should trigger fullscreen exit. - iframeDoc.documentElement.appendChild(document.body); + // Then, move the outer document's body into the iframe. This is an unusual + // thing to do, but means that the iframe is removed from its document and + // should trigger fullscreen exit. + iframeDoc.documentElement.appendChild(document.body); - // If we exit in an orderly fashion, that's all one can ask for. - document.onfullscreenchange = t.step_func_done(() => { - assert_equals(document.fullscreenElement, null, "document's final fullscreen element"); + // If we exit in an orderly fashion, that's all one can ask for. + document.onfullscreenchange = t.step_func_done(() => { + assert_equals(document.fullscreenElement, null, "document's final fullscreen element"); - // Because the iframe was removed, its browsing context was discarded and - // its contentDocument has become null. Because that browsing context was - // neither a descendant browsing context nor had an active document, - // nothing at all was done with it in the exit fullscreen algorithm, so - // its fullscreenElement is unchanged. - assert_equals(iframe.contentDocument, null, "iframe's content document"); - assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element"); + // Because the iframe was removed, its browsing context was discarded and + // its contentDocument has become null. Because that browsing context was + // neither a descendant browsing context nor had an active document, + // nothing at all was done with it in the exit fullscreen algorithm, so + // its fullscreenElement is unchanged. + assert_equals(iframe.contentDocument, null, "iframe's content document"); + assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element"); + }); }); }); -}); +}; </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/rendering/ua-style-iframe-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/rendering/ua-style-iframe-manual.html index bf93aa28..f2a22743 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/rendering/ua-style-iframe-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/rendering/ua-style-iframe-manual.html
@@ -14,21 +14,32 @@ <div id="log"></div> <div id="ancestor"><iframe></iframe></div> <script> +function assert_dir_properties(style, propBase, value, state) { + for (let dir of ["Top", "Right", "Bottom", "Left"]) { + let prop = propBase.replace('{}', dir); + assert_equals(style[prop], value, `${state} ${prop} style`); + } +} + async_test(t => { const ancestor = document.getElementById('ancestor'); const iframe = ancestor.firstChild; const initialStyle = getComputedStyle(iframe); - assert_equals(initialStyle.border, '1px solid rgb(0, 0, 255)', 'initial border style'); - assert_equals(initialStyle.padding, '1px', 'initial padding style'); + assert_dir_properties(initialStyle, 'border{}Width', '1px', 'initial'); + assert_dir_properties(initialStyle, 'border{}Style', 'solid', 'initial'); + assert_dir_properties(initialStyle, 'border{}Color', 'rgb(0, 0, 255)', 'initial'); + assert_dir_properties(initialStyle, 'padding{}', '1px', 'initial'); assert_equals(initialStyle.transform, 'matrix(0.5, 0, 0, 0.5, 0, 0)', 'initial transform style'); trusted_request(t, iframe); document.addEventListener('fullscreenchange', t.step_func_done(() => { const fullscreenStyle = getComputedStyle(iframe); - assert_equals(fullscreenStyle.border, '0px none rgb(0, 0, 0)', 'fullscreen border style'); - assert_equals(fullscreenStyle.padding, '0px', 'fullscreen padding style'); + assert_dir_properties(fullscreenStyle, 'border{}Width', '0px', 'fullscreen'); + assert_dir_properties(fullscreenStyle, 'border{}Style', 'none', 'fullscreen'); + assert_dir_properties(fullscreenStyle, 'border{}Color', 'rgb(0, 0, 0)', 'fullscreen'); + assert_dir_properties(fullscreenStyle, 'padding{}', '0px', 'fullscreen'); assert_equals(fullscreenStyle.transform, 'none', 'fullscreen transform style'); })); });
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html new file mode 100644 index 0000000..8023c52 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering-ref.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Reference for legend and display: list-item numbering</title> +<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="http://www.mozilla.org/"> + +<style> +ol { margin: 0; padding: 0; border: none; } +ol > * { margin: 0 40px; padding: 0; } +</style> + +<ol> + <li value="2">B</li> + <li value="1">A</li> + <li value="3">C</li> +</ol>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html new file mode 100644 index 0000000..ba58d35 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-list-item-numbering.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Legend and display: list-item numbering</title> +<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="http://www.mozilla.org/"> +<link rel=match href="legend-list-item-numbering-ref.html"> + +<style> +fieldset { margin: 0; padding: 0; border: none; list-style-type: decimal; } +fieldset > * { margin: 0 40px; padding: 0; display: list-item; } +</style> + +<fieldset> + <div>A</div> + <legend>B</legend> + <div>C</div> +</fieldset>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html new file mode 100644 index 0000000..57189a0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe-nosrc.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>Check processing of iframe without src and srcdoc attribute</title> +<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id="log"></div> +<iframe></iframe> +<script> + let iframe = document.querySelector("iframe"); + + async_test(t => { + let originDoc = iframe.contentDocument; + window.addEventListener("load", t.step_func_done(() => { + assert_equals(iframe.contentDocument, originDoc, "contentDocument shouldn't be changed"); + })); + }, "iframe.contentDocument should not be changed"); + + async_test(t => { + iframe.addEventListener("load", t.unreached_func()); + window.addEventListener("load", () => t.done()); + }, "load event of iframe should not be fired after processing the element"); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html b/third_party/WebKit/LayoutTests/external/wpt/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html index e1f9995..bec3364a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html +++ b/third_party/WebKit/LayoutTests/external/wpt/html/syntax/parsing/template/creating-an-element-for-the-token/template-owner-document.html
@@ -2,6 +2,7 @@ <html> <head> <title>HTML Templates: ownerDocument property of the element in template</title> +<meta name="timeout" content="long"> <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru"> <meta name="assert" content="ownerDocument property of the element appended to template must be set to the template contents owner of the ownerDocument of the template element">
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/target-in-different-window.html b/third_party/WebKit/LayoutTests/external/wpt/intersection-observer/target-in-different-window.html similarity index 74% rename from third_party/WebKit/LayoutTests/intersection-observer/target-in-different-window.html rename to third_party/WebKit/LayoutTests/external/wpt/intersection-observer/target-in-different-window.html index 10dabb5..cf8fe4e 100644 --- a/third_party/WebKit/LayoutTests/intersection-observer/target-in-different-window.html +++ b/third_party/WebKit/LayoutTests/external/wpt/intersection-observer/target-in-different-window.html
@@ -1,6 +1,6 @@ <!DOCTYPE html> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> <script src="./resources/intersection-observer-test-utils.js"></script> <script> @@ -9,7 +9,7 @@ function waitForPopupNotification(f) { popup.requestAnimationFrame(function() { - popup.setTimeout(function() { popup.setTimeout(f); }); + popup.requestAnimationFrame(function() { popup.setTimeout(f); }); }); } @@ -18,19 +18,19 @@ entries = entries.concat(changes); }); popup = window.open(); + t.add_cleanup(() => popup.close()); target = popup.document.createElement('div'); target.style.width = "100px"; target.style.height = "100px"; observer.observe(target); - waitForPopupNotification(() => { + waitForPopupNotification(t.step_func(() => { assert_equals(entries.length, 1, "Initial notification for detached target."); assert_equals(entries[0].isIntersecting, false, "not intersecting"); popup.document.body.appendChild(target); - waitForPopupNotification(() => { + waitForPopupNotification(t.step_func_done(() => { assert_equals(entries.length, 2, "Notification after insertion into popup."); assert_equals(entries[1].isIntersecting, true, "intersecting"); - t.done(); - }); - }); + })); + })); }, "IntersectionObserver with target in a different window."); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist b/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist index e39672d..50ed2f5 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist +++ b/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist
@@ -169,6 +169,7 @@ SET TIMEOUT: html/webappapis/scripting/processing-model-2/* SET TIMEOUT: IndexedDB/* SET TIMEOUT: infrastructure/* +SET TIMEOUT: intersection-observer/target-in-different-window.html SET TIMEOUT: media-source/mediasource-util.js SET TIMEOUT: media-source/URL-createObjectURL-revoke.html SET TIMEOUT: mixed-content/generic/sanity-checker.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html index f3fca41..982bc1746 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html
@@ -291,7 +291,8 @@ async_test(t => { var validTypes = [ 'file', 'media-source' ]; - var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource' ]; + var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource', + 'record', 'transmission' ]; var validPromises = []; var invalidCaught = 0;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo-expected.txt new file mode 100644 index 0000000..a8c1a00 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo-expected.txt
@@ -0,0 +1,29 @@ +This is a testharness.js-based test. +PASS Test that encodingInfo rejects if it doesn't get a configuration +PASS Test that encodingInfo rejects if the MediaConfiguration isn't valid +PASS Test that encodingInfo rejects if the MediaConfiguration does not have a type +PASS Test that encodingInfo rejects if the configuration doesn't have an audio or video field +PASS Test that encodingInfo rejects if the video configuration has a negative framerate +PASS Test that encodingInfo rejects if the video configuration has a framerate set to 0 +PASS Test that encodingInfo rejects if the video configuration has a framerate set to Infinity +PASS Test that encodingInfo rejects if the video configuration contentType doesn't parse +PASS Test that encodingInfo rejects if the video configuration contentType isn't of type video +PASS Test that encodingInfo rejects if the video configuration contentType has more than one parameter +PASS Test that encodingInfo rejects if the video configuration contentType has one parameter that isn't codecs +PASS Test that encodingInfo() accepts framerate in the form of x/y +PASS Test that encodingInfo() rejects framerate in the form of x/0 +PASS Test that encodingInfo() rejects framerate in the form of 0/y +PASS Test that encodingInfo() rejects framerate in the form of -x/y +PASS Test that encodingInfo() rejects framerate in the form of x/-y +PASS Test that encodingInfo() rejects framerate in the form of x/ +PASS Test that encodingInfo() accepts framerate with 'e' +PASS Test that encodingInfo() accepts framerate as fraction with decimals +PASS Test that encodingInfo() rejects framerate with trailing unallowed characters +PASS Test that encodingInfo rejects if the audio configuration contenType doesn't parse +PASS Test that encodingInfo rejects if the audio configuration contentType isn't of type audio +PASS Test that encodingInfo rejects if the audio configuration contentType has more than one parameters +PASS Test that encodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs +PASS Test that encodingInfo returns a valid MediaCapabilitiesInfo objects +FAIL Test that encodingInfo rejects if the MediaConfiguration does not have a valid type assert_unreached: Promise.all should not reject for valid types Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html new file mode 100644 index 0000000..5c0e318 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html
@@ -0,0 +1,328 @@ +<!DOCTYPE html> +<title>MediaCapabilities.decodingInfo()</title> +<script src=/resources/testharness.js></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +// Minimal VideoConfiguration that will be allowed per spec. All optional +// properties are missing. +var minimalVideoConfiguration = { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, +}; + +// Minimal AudioConfiguration that will be allowed per spec. All optional +// properties are missing. +var minimalAudioConfiguration = { + contentType: 'audio/webm; codecs="opus"', +}; + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo()); +}, "Test that encodingInfo rejects if it doesn't get a configuration"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({})); +}, "Test that encodingInfo rejects if the MediaConfiguration isn't valid"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + video: minimalVideoConfiguration, + audio: minimalAudioConfiguration, + })); +}, "Test that encodingInfo rejects if the MediaConfiguration does not have a type"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + })); +}, "Test that encodingInfo rejects if the configuration doesn't have an audio or video field"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: -1, + }, + })); +}, "Test that encodingInfo rejects if the video configuration has a negative framerate"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 0, + }, + })); +}, "Test that encodingInfo rejects if the video configuration has a framerate set to 0"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: Infinity, + }, + })); +}, "Test that encodingInfo rejects if the video configuration has a framerate set to Infinity"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'fgeoa', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that encodingInfo rejects if the video configuration contentType doesn't parse"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'audio/fgeoa', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that encodingInfo rejects if the video configuration contentType isn't of type video"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"; foo="bar"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that encodingInfo rejects if the video configuration contentType has more than one parameter"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; foo="bar"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that encodingInfo rejects if the video configuration contentType has one parameter that isn't codecs"); + +promise_test(t => { + return navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24000/1001', + } + }); +}, "Test that encodingInfo() accepts framerate in the form of x/y"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24000/0', + } + })); +}, "Test that encodingInfo() rejects framerate in the form of x/0"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '0/10001', + } + })); +}, "Test that encodingInfo() rejects framerate in the form of 0/y"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '-24000/10001', + } + })); +}, "Test that encodingInfo() rejects framerate in the form of -x/y"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24000/-10001', + } + })); +}, "Test that encodingInfo() rejects framerate in the form of x/-y"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24000/', + } + })); +}, "Test that encodingInfo() rejects framerate in the form of x/"); + +promise_test(t => { + return navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24000/1e4', + } + }); +}, "Test that encodingInfo() accepts framerate with 'e'"); + +promise_test(t => { + return navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '24/1.0001', + } + }); +}, "Test that encodingInfo() accepts framerate as fraction with decimals"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: '1/3x', + } + })); +}, "Test that encodingInfo() rejects framerate with trailing unallowed characters"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + audio: { contentType: 'fgeoa' }, + })); +}, "Test that encodingInfo rejects if the audio configuration contenType doesn't parse"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + audio: { contentType: 'video/fgeoa' }, + })); +}, "Test that encodingInfo rejects if the audio configuration contentType isn't of type audio"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + audio: { contentType: 'audio/webm; codecs="opus"; foo="bar"' }, + })); +}, "Test that encodingInfo rejects if the audio configuration contentType has more than one parameters"); + +promise_test(t => { + return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({ + type: 'record', + audio: { contentType: 'audio/webm; foo="bar"' }, + })); +}, "Test that encodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs"); + +promise_test(t => { + return navigator.mediaCapabilities.encodingInfo({ + type: 'record', + video: minimalVideoConfiguration, + audio: minimalAudioConfiguration, + }).then(ability => { + assert_idl_attribute(ability, 'supported'); + assert_idl_attribute(ability, 'smooth'); + assert_idl_attribute(ability, 'powerEfficient'); + }); +}, "Test that encodingInfo returns a valid MediaCapabilitiesInfo objects"); + +async_test(t => { + var validTypes = [ 'record', 'transmission' ]; + var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource', + 'file', 'media-source', ]; + + var validPromises = []; + var invalidCaught = 0; + + validTypes.forEach(type => { + validPromises.push(navigator.mediaCapabilities.encodingInfo({ + type: type, + video: minimalVideoConfiguration, + audio: minimalAudioConfiguration, + })); + }); + + // validTypes are tested via Promise.all(validPromises) because if one of the + // promises fail, Promise.all() will reject. This mechanism can't be used for + // invalid types which will be tested individually and increment invalidCaught + // when rejected until the amount of rejection matches the expectation. + Promise.all(validPromises).then(t.step_func(() => { + for (var i = 0; i < invalidTypes.length; ++i) { + navigator.mediaCapabilities.encodingInfo({ + type: invalidTypes[i], + video: minimalVideoConfiguration, + audio: minimalAudioConfiguration, + }).then(t.unreached_func(), t.step_func(e => { + assert_equals(e.name, 'TypeError'); + ++invalidCaught; + if (invalidCaught == invalidTypes.length) + t.done(); + })); + } + }), t.unreached_func('Promise.all should not reject for valid types')); +}, "Test that encodingInfo rejects if the MediaConfiguration does not have a valid type"); + +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt b/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt index 917d96da..5dec52cf 100644 --- a/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents-expected.txt
@@ -5,11 +5,11 @@ PASS internals.touchStartOrMoveEventHandlerCount(document) is 0 PASS internals.touchStartOrMoveEventHandlerCount(document) is 0 -PASS internals.touchStartOrMoveEventHandlerCount(document) is 1 +PASS internals.touchStartOrMoveEventHandlerCount(document) is 2 PASS internals.touchEndOrCancelEventHandlerCount(document) is 0 -PASS internals.touchStartOrMoveEventHandlerCount(document) is 1 +PASS internals.touchStartOrMoveEventHandlerCount(document) is 2 PASS internals.touchEndOrCancelEventHandlerCount(document) is 1 -PASS internals.touchStartOrMoveEventHandlerCount(document) is 1 +PASS internals.touchStartOrMoveEventHandlerCount(document) is 2 PASS internals.touchEndOrCancelEventHandlerCount(document) is 0 PASS internals.touchStartOrMoveEventHandlerCount(document) is 0 PASS successfullyParsed is true
diff --git a/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents.html b/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents.html index 222f0cf4..b658ee6 100644 --- a/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents.html +++ b/third_party/WebKit/LayoutTests/fast/events/touch/touch-input-element-change-documents.html
@@ -6,7 +6,7 @@ shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0'); - // There is one touchable Input element in Audio's shadow DOM when controls are enabled. + // There are two touchable Input element in Audio's shadow DOM when controls are enabled. var input = document.createElement('audio'); input.setAttribute("controls", true); var container = document.getElementById('container'); @@ -14,15 +14,15 @@ shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0'); container.appendChild(input); - shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '1'); + shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2'); shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '0'); input.ontouchend = function() { }; - shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '1'); + shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2'); shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '1'); input.ontouchend = null; - shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '1'); + shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2'); shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '0'); document.implementation.createDocument("", "", null).adoptNode(input);
diff --git a/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html b/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html index 350116d4..b0aef12 100644 --- a/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html +++ b/third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html
@@ -6,10 +6,6 @@ <audio controls></audio> <script> async_test(function(t) { - // This test is not valid for modern media controls. - if (internals.runtimeFlags.modernMediaControlsEnabled) - t.done(); - var audio = document.querySelector("audio"); audio.src = "content/test.oga"; assert_equals(audio.volume, 1);
diff --git a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html b/third_party/WebKit/LayoutTests/media/controls-volume-slider.html deleted file mode 100644 index 6b41b75..0000000 --- a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html +++ /dev/null
@@ -1,31 +0,0 @@ -<!DOCTYPE html> -<title>media controls volume slider</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<script src="media-controls.js"></script> -<audio controls></audio> -<script> -async_test(function(t) { - // This test is not valid for modern media controls. - if (internals.runtimeFlags.modernMediaControlsEnabled) - t.done(); - - var audio = document.querySelector("audio"); - audio.src = "content/test.oga"; - assert_equals(audio.volume, 1); - - audio.onloadedmetadata = t.step_func(function() { - // click the middle of the volume slider - var coords = mediaControlsButtonCoordinates(audio, "volume-slider"); - eventSender.mouseMoveTo(coords[0], coords[1]); - eventSender.mouseDown(); - eventSender.mouseMoveTo(coords[0]-1, coords[1]); - eventSender.mouseMoveTo(coords[0], coords[1]); - eventSender.mouseUp(); - - assert_greater_than(audio.volume, 0.4); - assert_less_than(audio.volume, 0.6); - audio.onvolumechange = t.step_func_done(); - }); -}); -</script>
diff --git a/third_party/WebKit/LayoutTests/media/controls/volume-slider.html b/third_party/WebKit/LayoutTests/media/controls/volume-slider.html new file mode 100644 index 0000000..a10e45f --- /dev/null +++ b/third_party/WebKit/LayoutTests/media/controls/volume-slider.html
@@ -0,0 +1,103 @@ +<!DOCTYPE html> +<title>media controls volume slider</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../media-controls.js"></script> +<body></body> +<script> +// Ensure that we will show the volume slider. +internals.settings.setPreferHiddenVolumeControls(false); + +var video = document.createElement('video'); +var videoWithAudio = document.createElement('video'); +var audio = document.createElement('audio'); + +const testElements = [video, videoWithAudio, audio]; +let currentTest = 0; + +testElements.forEach(element => { + element.controls = true; + element.preload = 'none'; +}); + +video.id = 'video'; +videoWithAudio.id = 'video-with-audio'; +audio.id = 'audio'; + +video.src = '../content/test.webm' +videoWithAudio.src = '../content/test.oga'; +audio.src = '../content/test.oga'; + + +async_test(function(t) { + runNextTest(t); +}); + +// Need to run each test synchronously to avoid the race conditions causing the +// slider to open/close. +function runNextTest(t) { + if (currentTest == testElements.length) { + t.done(); + } + + const testElement = testElements[currentTest]; + currentTest++; + + document.body.append(testElement); + testMediaElement(t, testElement); +} + +function testMediaElement(t, element) { + const muteBtn = muteButton(element); + const volumeSlider = volumeSliderElement(element); + const currentTime = currentTimeElement(element); + + assert_equals(element.volume, 1, element.id + ': volume should start at 1'); + assert_false(isVolumeSliderOpen(element), element.id + ': volume slider should start closed'); + + // Hovering over the mute button before preloading should not open the volume + // slider. + hoverOverControl(muteBtn, t.step_func(() => { + assert_false(isVolumeSliderOpen(element), element.id + ': volume slider should not open before metadata load'); + + // Move the cursor away from the mute button and start testing the loaded + // state. + hoverOverControl(currentTime, t.step_func(() => { + element.load(); + })); + })); + + element.onloadedmetadata = t.step_func(function() { + assert_false(isVolumeSliderOpen(element), element.id + ': volume slider should not open on metadata load'); + + // Hovering over the mute button after preloading should open the volume + // slider. + hoverOverControl(muteBtn, t.step_func(() => { + assert_true(isVolumeSliderOpen(element), element.id + ': volume slider should open when hovering the mute button'); + + // Moving the cursor onto the volume slider should not hide the volume slider. + hoverOverControl(volumeSlider, t.step_func(() => { + assert_true(isVolumeSliderOpen(element), element.id + ': volume slider should remain open when hovering the volume slider'); + + // Wait for the volume slider to be completely open. + runAfterVolumeSliderAnimationEnds(t.step_func(() => { + + // Clicking on the middle of the slider should change the volume. + singleTapOnControl(volumeSlider, t.step_func(() => { + assert_greater_than(element.volume, 0.4, element.id + ': clicking on volume slider should change volume'); + assert_less_than(element.volume, 0.6, element.id + ': clicking on volume slider should change volume'); + + // Moving away from the element should close the volume slider. + hoverOverControl(currentTime, t.step_func(() => { + assert_false(isVolumeSliderOpen(element), element.id + ': volume slider should close when no longer hovered'); + + // Kick off the next test. + runNextTest(t); + })); + })); + })); + })); + })); + }); +} +</script>
diff --git a/third_party/WebKit/LayoutTests/media/media-controls.js b/third_party/WebKit/LayoutTests/media/media-controls.js index a382550..083af60 100644 --- a/third_party/WebKit/LayoutTests/media/media-controls.js +++ b/third_party/WebKit/LayoutTests/media/media-controls.js
@@ -291,6 +291,20 @@ return mediaControlsButton(videoElement, 'mute-button'); } +function volumeSliderElement(videoElement) { + return mediaControlsButton(videoElement, 'volume-slider'); +} + +function isVolumeSliderOpen(videoElement) { + return !volumeSliderElement(videoElement).classList.contains('closed'); +} + +function runAfterVolumeSliderAnimationEnds(func) { + // 300ms timer plus 200ms slack. + const volumeSliderTimeoutMs = 300 + 200; + setTimeout(func, volumeSliderTimeoutMs); +} + function timelineElement(videoElement) { return mediaControlsButton(videoElement, 'timeline'); } @@ -513,6 +527,18 @@ singleTapAtCoordinates(coordinates[0], coordinates[1], callback); } +function hoverOverControl(control, callback) { + const coordinates = elementCoordinates(control); + chrome.gpuBenchmarking.pointerActionSequence([ + { + source: 'mouse', + actions: [ + { name: 'pointerMove', x: coordinates[0], y: coordinates[1] } + ] + } + ], callback); +} + // This function does not work on Mac due to crbug.com/613672. When using this // function, add an entry into TestExpectations to skip on Mac. function singleTouchAtCoordinates(xPos, yPos, callback) {
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.txt index 5942709d..6ee230bf 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.txt
@@ -36,3 +36,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 79x4 [bgcolor=#000000DE] layer at (218,129) size 0x4 LayoutBlockFlow (positioned) {DIV} at (79,0) size 0x4 [bgcolor=#0000008A] +layer at (234,107) size 0x48 transparent + LayoutSlider {INPUT} at (226,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (234,129) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (234,129) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/audio-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/audio-controls-rendering-expected.txt index cf165fd..7d810216 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/audio-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/audio-controls-rendering-expected.txt
@@ -44,6 +44,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,69) size 111x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4 [bgcolor=#0000008A] +layer at (266,47) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (266,69) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (266,69) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,118) size 320x54 LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 320x54 layer at (8,118) size 320x54 @@ -72,6 +84,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,143) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,121) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,143) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,143) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,192) size 320x100 LayoutMedia (positioned) {AUDIO} at (8,192) size 320x100 [bgcolor=#0000FF] layer at (8,192) size 320x100 @@ -102,3 +126,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,263) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,241) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,263) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,263) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls-after-reload-expected.txt index 6a910896..07d397e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls-after-reload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls-strict-expected.txt index e7c6f76..14b3278f 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls-strict-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-expected.txt index c63448f..5d39a85 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (114,48) size 110x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (242,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (242,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (242,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (242,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (242,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,452) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-strict-expected.txt index 1021b18..22b3e5e6 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls-styling-strict-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (556,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (556,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (556,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (556,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (556,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls-without-preload-expected.txt index 7d0d78da..119340a 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls-without-preload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls/lazy-loaded-style-expected.txt index 88fec36..9c7d82f 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls/lazy-loaded-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls/lazy-loaded-style-expected.txt
@@ -28,6 +28,18 @@ LayoutBlockFlow {DIV} at (84,48) size 220x0 LayoutButton {INPUT} at (304,0) size 48x48 LayoutButton {INPUT} at (352,0) size 48x48 +layer at (312,236) size 0x48 transparent + LayoutSlider {INPUT} at (304,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (312,258) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (312,258) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,284) size 400x24 LayoutSlider {INPUT} at (0,276) size 400x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 368x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/controls/video-controls-with-cast-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/controls/video-controls-with-cast-rendering-expected.txt index f6ff60a0..a6e883e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/controls/video-controls-with-cast-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/controls/video-controls-with-cast-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,465) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,487) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,487) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,513) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,710) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,732) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,758) size 320x24 backgroundClip at (8,542) size 320x58 clip at (8,542) size 320x58 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/media-document-audio-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/media-document-audio-repaint-expected.txt index 244b3d5..dea7f23 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/media-document-audio-repaint-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/media-document-audio-repaint-expected.txt
@@ -47,3 +47,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 55x4 [bgcolor=#000000DE] layer at (226,211) size 55x4 LayoutBlockFlow (positioned) {DIV} at (55,0) size 55x4 [bgcolor=#0000008A] + layer at (298,189) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 + layer at (298,211) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 + layer at (298,211) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/video-controls-rendering-expected.txt index 4a755e4..63195ebd 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/video-controls-rendering-expected.txt
@@ -37,6 +37,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -72,6 +84,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,452) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -109,6 +133,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,692) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,714) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,740) size 320x24 backgroundClip at (8,524) size 320x76 clip at (8,524) size 320x76 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/video-display-toggle-expected.txt index 48a046f..1e6ca8e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/video-display-toggle-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,196) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,218) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,218) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,244) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/media/video-zoom-controls-expected.txt index 6fd4a392..b75f1d0 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/media/video-zoom-controls-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (114,72) size 0x0 LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 +layer at (171,157) size 0x72 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (171,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (171,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (171,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (171,190) size 27x6 backgroundClip at (171,190) size 18x6 clip at (171,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#9D968E] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -69,6 +81,18 @@ LayoutBlockFlow {DIV} at (114,72) size 0x0 LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 +layer at (162,381) size 12x71 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (167,414) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (167,414) size 19x9 clip at (167,414) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (167,414) size 2x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (167,414) size 28x10 backgroundClip at (167,414) size 19x9 clip at (167,414) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#9D968E] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt index 88fec36..9c7d82f 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/lazy-loaded-style-expected.txt
@@ -28,6 +28,18 @@ LayoutBlockFlow {DIV} at (84,48) size 220x0 LayoutButton {INPUT} at (304,0) size 48x48 LayoutButton {INPUT} at (352,0) size 48x48 +layer at (312,236) size 0x48 transparent + LayoutSlider {INPUT} at (304,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (312,258) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (312,258) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,284) size 400x24 LayoutSlider {INPUT} at (0,276) size 400x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 368x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/video-controls-with-cast-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/video-controls-with-cast-rendering-expected.txt index f6ff60a0..a6e883e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/video-controls-with-cast-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/new-remote-playback-pipeline/media/controls/video-controls-with-cast-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,465) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,487) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,487) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,513) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,710) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,732) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,758) size 320x24 backgroundClip at (8,542) size 320x58 clip at (8,542) size 320x58 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.txt similarity index 68% rename from third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.txt rename to third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.txt index 0356b04..7d810216 100644 --- a/third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.txt
@@ -4,8 +4,8 @@ LayoutBlockFlow {HTML} at (0,0) size 800x600 LayoutBlockFlow {BODY} at (8,8) size 784x584 LayoutBlockFlow {P} at (0,0) size 784x20 - LayoutText {#text} at (0,0) size 146x19 - text run at (0,0) width 146: "Test controls placement." + LayoutText {#text} at (0,0) size 152x19 + text run at (0,0) width 152: "Test controls placement." LayoutBlockFlow (anonymous) at (0,36) size 784x168 LayoutBR {BR} at (300,54) size 0x0 LayoutBR {BR} at (0,54) size 0x19 @@ -23,7 +23,7 @@ layer at (8,44) size 300x54 scrollHeight 55 LayoutFlexibleBox {DIV} at (0,0) size 300x54 LayoutButton {INPUT} at (10,11) size 32x32 - LayoutSlider {INPUT} at (115,-1) size 143x56 [color=#C4C4C4] + LayoutSlider {INPUT} at (115,-1) size 143x56 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,26) size 111x4 LayoutButton {INPUT} at (258,11) size 32x32 layer at (55,63) size 28x16 transparent @@ -44,6 +44,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,69) size 111x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4 [bgcolor=#0000008A] +layer at (266,47) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (266,69) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (266,69) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,118) size 320x54 LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 320x54 layer at (8,118) size 320x54 @@ -51,7 +63,7 @@ layer at (8,118) size 320x54 scrollHeight 55 LayoutFlexibleBox {DIV} at (0,0) size 320x54 LayoutButton {INPUT} at (10,11) size 32x32 - LayoutSlider {INPUT} at (115,-1) size 163x56 [color=#C4C4C4] + LayoutSlider {INPUT} at (115,-1) size 163x56 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,26) size 131x4 LayoutButton {INPUT} at (278,11) size 32x32 layer at (55,137) size 28x16 transparent @@ -72,6 +84,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,143) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,121) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,143) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,143) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,192) size 320x100 LayoutMedia (positioned) {AUDIO} at (8,192) size 320x100 [bgcolor=#0000FF] layer at (8,192) size 320x100 @@ -81,7 +105,7 @@ layer at (8,238) size 320x54 scrollHeight 55 LayoutFlexibleBox {DIV} at (0,0) size 320x54 LayoutButton {INPUT} at (10,11) size 32x32 - LayoutSlider {INPUT} at (115,-1) size 163x56 [color=#C4C4C4] + LayoutSlider {INPUT} at (115,-1) size 163x56 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,26) size 131x4 LayoutButton {INPUT} at (278,11) size 32x32 layer at (55,257) size 28x16 transparent @@ -102,3 +126,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,263) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,241) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,263) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,263) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-after-reload-expected.txt index f06767b4..b61bba8e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-after-reload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-strict-expected.txt index 5d68ba9..71f1589 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-strict-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.txt index a63b3240..4006d6d 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (194,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (194,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (194,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (194,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (194,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,452) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-strict-expected.txt index ef10baec..87f4643 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-strict-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (508,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (508,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (508,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (508,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (508,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-without-preload-expected.txt index 7b333fd..73d2da6 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-without-preload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls/video-controls-with-cast-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls/video-controls-with-cast-rendering-expected.txt index f6ff60a0..a6e883e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls/video-controls-with-cast-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls/video-controls-with-cast-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,465) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,487) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,487) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,487) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,513) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,710) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,732) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,732) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,758) size 320x24 backgroundClip at (8,542) size 320x58 clip at (8,542) size 320x58 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.txt new file mode 100644 index 0000000..dea7f23 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.txt
@@ -0,0 +1,61 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x600 + LayoutBlockFlow {HTML} at (0,0) size 800x600 + LayoutBlockFlow {BODY} at (8,8) size 784x584 + LayoutBlockFlow {P} at (0,0) size 784x20 + LayoutText {#text} at (0,0) size 741x19 + text run at (0,0) width 651: "This tests that in a standalone media document with audio content, the media element repaints correctly " + text run at (651,0) width 90: "while playing." + LayoutBlockFlow (anonymous) at (0,36) size 784x334 + LayoutText {#text} at (0,0) size 0x0 +layer at (8,44) size 384x334 + LayoutIFrame {IFRAME} at (0,0) size 384x334 [border: (2px inset #EEEEEE)] + layer at (0,0) size 380x330 + LayoutView at (0,0) size 380x330 + layer at (0,0) size 380x330 + LayoutBlockFlow {HTML} at (0,0) size 380x330 + LayoutBlockFlow {BODY} at (8,8) size 364x314 [bgcolor=#000000] + layer at (40,90) size 300x150 + LayoutVideo (positioned) {VIDEO} at (40,90) size 300x150 + layer at (40,90) size 300x150 + LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x150 + layer at (40,186) size 300x54 + LayoutFlexibleBox {DIV} at (0,96) size 300x54 [bgcolor=#F1F3F4] + layer at (40,186) size 300x54 scrollHeight 55 + LayoutFlexibleBox {DIV} at (0,0) size 300x54 + LayoutButton {INPUT} at (10,11) size 32x32 + LayoutButton {INPUT} at (258,11) size 32x32 + layer at (87,205) size 28x16 transparent + LayoutBlockFlow {DIV} at (47,19) size 28x16 + LayoutText {#text} at (0,0) size 28x16 + text run at (0,0) width 28: "0:00" + layer at (119,205) size 36x16 transparent + LayoutBlockFlow {DIV} at (79,19) size 36x16 + LayoutText {#text} at (0,0) size 36x16 + text run at (0,0) width 36: "/ 0:01" + layer at (155,185) size 143x56 backgroundClip at (40,186) size 300x54 clip at (40,186) size 300x54 + LayoutSlider {INPUT} at (115,-1) size 143x56 [color=#9D968E] + LayoutFlexibleBox {DIV} at (16,26) size 111x4 + layer at (171,211) size 111x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 111x4 [bgcolor=#00000033] + layer at (220,207) size 12x12 + LayoutBlockFlow (relative positioned) {DIV} at (49.48,-4) size 12x12 [bgcolor=#000000DE] + layer at (171,211) size 111x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4 + layer at (171,211) size 55x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 55x4 [bgcolor=#000000DE] + layer at (226,211) size 55x4 + LayoutBlockFlow (positioned) {DIV} at (55,0) size 55x4 [bgcolor=#0000008A] + layer at (298,189) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 + layer at (298,211) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 + layer at (298,211) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-controls-rendering-expected.txt index c353a2f..a9b0006 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-controls-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,452) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,692) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,714) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,740) size 320x24 backgroundClip at (8,524) size 320x76 clip at (8,524) size 320x76 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-display-toggle-expected.txt index c90c691d..ec3ccd9 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-display-toggle-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,196) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,218) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,218) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,244) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#9D968E] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-zoom-controls-expected.txt index c7920b1a..7bc22b6 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/video-zoom-controls-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 LayoutButton {INPUT} at (258,0) size 72x72 +layer at (171,157) size 0x72 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (171,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (171,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (171,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (171,190) size 27x6 backgroundClip at (171,190) size 18x6 clip at (171,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#9D968E] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -71,6 +83,18 @@ LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 LayoutButton {INPUT} at (258,0) size 72x72 +layer at (162,381) size 12x71 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#9D968E] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (167,414) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (167,414) size 19x9 clip at (167,414) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (167,414) size 2x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (167,414) size 28x10 backgroundClip at (167,414) size 19x9 clip at (167,414) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#9D968E] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.txt index ddbecbf8..0e200c9 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.txt
@@ -36,3 +36,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 81x4 [bgcolor=#000000DE] layer at (218,129) size 0x4 LayoutBlockFlow (positioned) {DIV} at (81,0) size 0x4 [bgcolor=#0000008A] +layer at (234,107) size 0x48 transparent + LayoutSlider {INPUT} at (226,3) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (234,129) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (234,129) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt index bc3dc40..e7c837b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
@@ -44,6 +44,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (137,67) size 113x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 113x4 [bgcolor=#0000008A] +layer at (266,45) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (266,67) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (266,67) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (266,67) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (266,67) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,114) size 320x54 LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 320x54 layer at (8,114) size 320x54 @@ -72,6 +84,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (137,139) size 133x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 133x4 [bgcolor=#0000008A] +layer at (286,117) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,139) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,139) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,139) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,139) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,186) size 320x100 LayoutMedia (positioned) {AUDIO} at (8,186) size 320x100 [bgcolor=#0000FF] layer at (8,186) size 320x100 @@ -102,3 +126,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (137,257) size 133x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 133x4 [bgcolor=#0000008A] +layer at (286,235) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,257) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,257) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,257) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,257) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls-after-reload-expected.txt index 5a7649b..234ca03 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-after-reload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,210) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls-strict-expected.txt index a9fcefc..dc9fd62 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-strict-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,218) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.txt index 080de0e..6cd702a6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (112.28,48) size 111.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (242,210) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (242,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (242,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (242,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (242,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,450) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,472) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,472) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,498) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-strict-expected.txt index 1e3b2972..cc003e6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-strict-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,218) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (556,218) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (556,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (556,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (556,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (556,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls-without-preload-expected.txt index e7d5444..c7910e7 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-without-preload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,210) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt index 5c7ae40..0239b40 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls/lazy-loaded-style-expected.txt
@@ -28,6 +28,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 221.72x0 LayoutButton {INPUT} at (304,0) size 48x48 LayoutButton {INPUT} at (352,0) size 48x48 +layer at (312,236) size 0x48 transparent + LayoutSlider {INPUT} at (304,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (312,258) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (312,258) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,284) size 400x24 LayoutSlider {INPUT} at (0,276) size 400x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 368x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.txt index 8d4791ce..570c126 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.txt
@@ -47,3 +47,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 56x4 [bgcolor=#000000DE] layer at (225,211) size 56x4 LayoutBlockFlow (positioned) {DIV} at (56,0) size 56x4 [bgcolor=#0000008A] + layer at (298,189) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 + layer at (298,211) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 + layer at (298,211) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt index ad88353..9b2361e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/video-controls-rendering-expected.txt
@@ -37,6 +37,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,210) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -72,6 +84,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,450) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,472) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,472) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,498) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -109,6 +133,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,690) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,712) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,738) size 320x24 backgroundClip at (8,522) size 320x78 clip at (8,522) size 320x78 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/video-display-toggle-expected.txt index e39e6f3..31c9da1f 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/video-display-toggle-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (82.28,48) size 141.72x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,194) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,216) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,216) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,216) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,216) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,242) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.txt index 931643e..368eaff 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (111.75,72) size 0x0 LayoutButton {INPUT} at (111.75,0) size 72x72 LayoutButton {INPUT} at (183.75,0) size 72x72 +layer at (169,157) size 0x72 transparent + LayoutSlider {INPUT} at (111.75,0) size 0x72 [color=#909090] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (169,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (169,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (169,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (169,190) size 27x6 backgroundClip at (169,190) size 18x6 clip at (169,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#909090] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -69,6 +81,18 @@ LayoutBlockFlow {DIV} at (111.75,72) size 0x0 LayoutButton {INPUT} at (111.75,0) size 72x72 LayoutButton {INPUT} at (183.75,0) size 72x72 +layer at (159,381) size 13x71 transparent + LayoutSlider {INPUT} at (111.75,0) size 0x72 [color=#909090] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (165,413) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (165,413) size 19x9 clip at (165,413) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (165,413) size 1x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (165,413) size 28x11 backgroundClip at (165,413) size 19x9 clip at (165,413) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#909090] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-after-reload-expected.txt index c151c88d..7313fec 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-after-reload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,210) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-strict-expected.txt index 3ef1eed..ca359621 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-strict-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,218) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-expected.txt index 55a6c6a..c4383e6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (194,210) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (194,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (194,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (194,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (194,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,450) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,472) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,472) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,498) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-strict-expected.txt index 329d87a..12d4853 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-styling-strict-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,218) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (508,218) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (508,240) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (508,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (508,240) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (508,240) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,266) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-without-preload-expected.txt index efb8146..3a95ed90 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/controls-without-preload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,210) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-controls-rendering-expected.txt index 0a78852..15b32fd 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-controls-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,210) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,232) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,232) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,232) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,258) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,450) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,472) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,472) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,472) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,498) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,690) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,712) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,712) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,738) size 320x24 backgroundClip at (8,522) size 320x78 clip at (8,522) size 320x78 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-display-toggle-expected.txt index fded7cb..9d4ff732 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-display-toggle-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,194) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#909090] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,216) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,216) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,216) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,216) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,242) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#909090] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.txt index dbbd5b60..de9743c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (111.75,0) size 72x72 LayoutButton {INPUT} at (183.75,0) size 72x72 LayoutButton {INPUT} at (255.75,0) size 72x72 +layer at (169,157) size 0x72 transparent + LayoutSlider {INPUT} at (111.75,0) size 0x72 [color=#909090] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (169,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (169,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (169,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (169,190) size 27x6 backgroundClip at (169,190) size 18x6 clip at (169,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#909090] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -71,6 +83,18 @@ LayoutButton {INPUT} at (111.75,0) size 72x72 LayoutButton {INPUT} at (183.75,0) size 72x72 LayoutButton {INPUT} at (255.75,0) size 72x72 +layer at (159,381) size 13x71 transparent + LayoutSlider {INPUT} at (111.75,0) size 0x72 [color=#909090] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (165,413) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (165,413) size 19x9 clip at (165,413) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (165,413) size 1x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (165,413) size 28x11 backgroundClip at (165,413) size 19x9 clip at (165,413) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#909090] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.txt index b5ec188..62c32bc4 100644 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.txt
@@ -36,3 +36,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 79x4 [bgcolor=#000000DE] layer at (218,129) size 0x4 LayoutBlockFlow (positioned) {DIV} at (79,0) size 0x4 [bgcolor=#0000008A] +layer at (234,107) size 0x48 transparent + LayoutSlider {INPUT} at (226,3) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (234,129) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (234,129) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (234,129) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt index 0356b04..ac57b4c 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt
@@ -44,6 +44,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,69) size 111x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4 [bgcolor=#0000008A] +layer at (266,47) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (266,69) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (266,69) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (266,69) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,118) size 320x54 LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 320x54 layer at (8,118) size 320x54 @@ -72,6 +84,18 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,143) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,121) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,143) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,143) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,143) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A] layer at (8,192) size 320x100 LayoutMedia (positioned) {AUDIO} at (8,192) size 320x100 [bgcolor=#0000FF] layer at (8,192) size 320x100 @@ -102,3 +126,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] layer at (139,263) size 131x4 LayoutBlockFlow (positioned) {DIV} at (0,0) size 131x4 [bgcolor=#0000008A] +layer at (286,241) size 0x48 transparent + LayoutSlider {INPUT} at (278,3) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (286,263) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (286,263) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] +layer at (286,263) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls-after-reload-expected.txt index 12c66097..4afee152 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-after-reload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls-strict-expected.txt index 924dd960..b918b54 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-strict-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.txt index 1dab6803..2ef96fe 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (114,48) size 110x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (242,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (242,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (242,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (242,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (242,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,452) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-strict-expected.txt index 7784370..b0a7e915 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-strict-expected.txt
@@ -36,6 +36,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -71,6 +83,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (556,220) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (556,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (556,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (556,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (556,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls-without-preload-expected.txt index 68d7c0d3..f7fa29b7 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-without-preload-expected.txt
@@ -32,6 +32,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls/lazy-loaded-style-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/controls/lazy-loaded-style-expected.txt index ac46c74b..45b6a1a 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls/lazy-loaded-style-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls/lazy-loaded-style-expected.txt
@@ -28,6 +28,18 @@ LayoutBlockFlow {DIV} at (84,48) size 220x0 LayoutButton {INPUT} at (304,0) size 48x48 LayoutButton {INPUT} at (352,0) size 48x48 +layer at (312,236) size 0x48 transparent + LayoutSlider {INPUT} at (304,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (312,258) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (312,258) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (312,258) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,284) size 400x24 LayoutSlider {INPUT} at (0,276) size 400x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 368x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.txt index 045b764..0a7e0fc9 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.txt
@@ -47,3 +47,15 @@ LayoutBlockFlow (positioned) {DIV} at (0,0) size 55x4 [bgcolor=#000000DE] layer at (226,211) size 55x4 LayoutBlockFlow (positioned) {DIV} at (55,0) size 55x4 [bgcolor=#0000008A] + layer at (298,189) size 0x48 transparent + LayoutSlider {INPUT} at (258,3) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 + layer at (298,211) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#00000033] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 + layer at (298,211) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#000000DE] + layer at (298,211) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#0000008A]
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/video-controls-rendering-expected.txt index cafb2b7..8c638bf 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/video-controls-rendering-expected.txt
@@ -37,6 +37,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,212) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -72,6 +84,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,452) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -109,6 +133,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,692) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,714) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,740) size 320x24 backgroundClip at (8,524) size 320x76 clip at (8,524) size 320x76 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/video-display-toggle-expected.txt index aac2fc20..2a7de13 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/video-display-toggle-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (84,48) size 140x0 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (232,196) size 0x48 transparent + LayoutSlider {INPUT} at (224,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (232,218) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (232,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (232,218) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (232,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,244) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt index e054622..98970df 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt
@@ -31,6 +31,18 @@ LayoutBlockFlow {DIV} at (114,72) size 0x0 LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 +layer at (171,157) size 0x72 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (171,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (171,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (171,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (171,190) size 27x6 backgroundClip at (171,190) size 18x6 clip at (171,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -69,6 +81,18 @@ LayoutBlockFlow {DIV} at (114,72) size 0x0 LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 +layer at (162,381) size 12x71 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (167,414) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (167,414) size 19x9 clip at (167,414) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (167,414) size 2x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (167,414) size 28x10 backgroundClip at (167,414) size 19x9 clip at (167,414) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-after-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-after-reload-expected.txt index f037626d..54d48a6b 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-after-reload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-after-reload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-strict-expected.txt index aff3cba..1bf1fb5 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-strict-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-expected.txt index 5dad45e..76ff76fe 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (194,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (194,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (194,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (194,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (194,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (18,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,452) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-strict-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-strict-expected.txt index 636197a..45bacc33 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-strict-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-styling-strict-expected.txt
@@ -37,6 +37,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -73,6 +85,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (508,220) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (508,242) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (508,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (508,242) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (508,242) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (332,268) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-without-preload-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-without-preload-expected.txt index da472927..a4e2426 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-without-preload-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/controls-without-preload-expected.txt
@@ -33,6 +33,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-controls-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-controls-rendering-expected.txt index b6dbc8d..4ce55d8 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-controls-rendering-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-controls-rendering-expected.txt
@@ -38,6 +38,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,212) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,234) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,234) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,234) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,260) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -74,6 +86,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,452) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,474) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,474) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,474) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,500) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4 @@ -112,6 +136,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,692) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,714) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,714) size 12x4 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,740) size 320x24 backgroundClip at (8,524) size 320x76 clip at (8,524) size 320x76 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-display-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-display-toggle-expected.txt index 14583eb..1c3d168 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-display-toggle-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-display-toggle-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (176,0) size 48x48 LayoutButton {INPUT} at (224,0) size 48x48 LayoutButton {INPUT} at (272,0) size 48x48 +layer at (184,196) size 0x48 transparent + LayoutSlider {INPUT} at (176,0) size 0x48 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,22) size 0x4 +layer at (184,218) size 12x4 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-4) size 12x12 [bgcolor=#FFFFFF] +layer at (184,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 +layer at (184,218) size 0x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x4 [bgcolor=#FFFFFF] +layer at (184,218) size 12x4 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 12x4 [bgcolor=#FFFFFF8A] layer at (8,244) size 320x24 LayoutSlider {INPUT} at (0,216) size 320x24 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (16,0) size 288x4
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-zoom-controls-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-zoom-controls-expected.txt index 2a9b709..dd0be87 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-zoom-controls-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/video-surface-layer/media/video-zoom-controls-expected.txt
@@ -32,6 +32,18 @@ LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 LayoutButton {INPUT} at (258,0) size 72x72 +layer at (171,157) size 0x72 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (171,190) size 18x6 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (171,190) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (171,190) size 0x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (171,190) size 27x6 backgroundClip at (171,190) size 18x6 clip at (171,190) size 18x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (57,229) size 240x36 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (24,0) size 192x6 @@ -71,6 +83,18 @@ LayoutButton {INPUT} at (114,0) size 72x72 LayoutButton {INPUT} at (186,0) size 72x72 LayoutButton {INPUT} at (258,0) size 72x72 +layer at (162,381) size 12x71 transparent + LayoutSlider {INPUT} at (114,0) size 0x72 [color=#C4C4C4] + LayoutFlexibleBox {DIV} at (0,33) size 0x6 +layer at (167,414) size 19x9 + LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 18x6 [bgcolor=#FFFFFF4D] + LayoutBlockFlow {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] +layer at (167,414) size 19x9 clip at (167,414) size 18x6 scrollWidth 27 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 18x6 +layer at (167,414) size 2x6 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] +layer at (167,414) size 28x10 backgroundClip at (167,414) size 19x9 clip at (167,414) size 19x9 + LayoutBlockFlow (positioned) {DIV} at (0,0) size 27x6 [bgcolor=#FFFFFF8A] layer at (43,432) size 243x77 LayoutSlider {INPUT} at (0,144) size 240x36 [color=#C4C4C4] LayoutFlexibleBox {DIV} at (24,0) size 192x6
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index caf2c23..8defe0ac 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -1427,11 +1427,13 @@ getter cornerPoints getter rawValue method constructor + method toJSON interface DetectedFace attribute @@toStringTag getter boundingBox getter landmarks method constructor + method toJSON interface DetectedText attribute @@toStringTag getter boundingBox
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index aeb5c2a..22712944 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -437,7 +437,6 @@ "web/web_external_popup_menu_client.h", "web/web_file_chooser_completion.h", "web/web_file_chooser_params.h", - "web/web_find_options.h", "web/web_form_control_element.h", "web/web_form_element.h", "web/web_frame.h",
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index 4ecca06..ead1da6 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -40,6 +40,7 @@ #include "base/memory/scoped_refptr.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/string_piece.h" +#include "base/threading/thread.h" #include "base/time/time.h" #include "components/viz/common/surfaces/frame_sink_id.h" #include "mojo/public/cpp/system/data_pipe.h" @@ -444,9 +445,20 @@ // for any other purpose. std::unique_ptr<WebThread> CreateWebAudioThread(); + // Create and initialize the compositor thread. The thread is saved in + // Platform, and will be accessible through CompositorThread(). + void InitializeCompositorThread(const WebThreadCreationParams&); + // Returns an interface to the current thread. WebThread* CurrentThread(); + // Returns an interface to the main thread. + WebThread* MainThread(); + + // Returns an interface to the compositor thread. This can be null if the + // renderer was created with threaded rendering disabled. + WebThread* CompositorThread(); + // Returns a blame context for attributing top-level work which does not // belong to a particular frame scope. virtual BlameContext* GetTopLevelBlameContext() { return nullptr; } @@ -478,15 +490,6 @@ // Returns a value such as "en-US". virtual WebString DefaultLocale() { return WebString(); } - // Returns an interface to the main thread. Can be null if blink was - // initialized on a thread without a message loop. - WebThread* MainThread() const; - - // Returns an interface to the compositor thread. This can be null if the - // renderer was created with threaded rendering desabled. - virtual WebThread* CompositorThread() const { return 0; } - - // Returns an interface to the IO task runner. virtual scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const { return nullptr; @@ -754,8 +757,6 @@ virtual bool IsTakingV8ContextSnapshot() { return false; } protected: - void RegisterExtraThreadToTLS(WebThread*); - WebThread* main_thread_; private: @@ -772,10 +773,11 @@ // Platform's main thread. See testing_platform_support.h for this. std::unique_ptr<WebThread> owned_main_thread_; + std::unique_ptr<WebThread> compositor_thread_; + // We can't use WTF stuff here. Ultimately these should go away (see comments // near CreateThread()), though. base::ThreadLocalStorage::Slot current_thread_slot_; - base::Lock create_thread_lock_; }; } // namespace blink
diff --git a/third_party/blink/public/platform/web_localized_string.h b/third_party/blink/public/platform/web_localized_string.h index 7856672..bd19f6f 100644 --- a/third_party/blink/public/platform/web_localized_string.h +++ b/third_party/blink/public/platform/web_localized_string.h
@@ -79,6 +79,7 @@ kAXMediaVideoElement, kAXMediaVideoElementHelp, kAXMediaVideoSliderHelp, + kAXMediaVolumeSliderHelp, kAXMediaEnterPictureInPictureButton, kAXMediaEnterPictureInPictureButtonHelp, kAXMediaExitPictureInPictureButton,
diff --git a/third_party/blink/public/platform/web_thread.h b/third_party/blink/public/platform/web_thread.h index d7b39bc..90425ab0 100644 --- a/third_party/blink/public/platform/web_thread.h +++ b/third_party/blink/public/platform/web_thread.h
@@ -114,7 +114,7 @@ base::sequence_manager::TaskTimeObserver*) {} // Returns the scheduler associated with the thread. - virtual ThreadScheduler* Scheduler() const = 0; + virtual ThreadScheduler* Scheduler() = 0; virtual ~WebThread() = default;
diff --git a/third_party/blink/public/web/web_find_options.h b/third_party/blink/public/web/web_find_options.h deleted file mode 100644 index 68fd1a00..0000000 --- a/third_party/blink/public/web/web_find_options.h +++ /dev/null
@@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_FIND_OPTIONS_H_ -#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_FIND_OPTIONS_H_ - -#include "third_party/blink/public/platform/web_string.h" - -namespace blink { - -// Options used when performing a find-in-page query. -struct WebFindOptions { - // Whether to search forward or backward within the page. - bool forward; - - // Whether search should be case-sensitive. - bool match_case; - - // Whether this operation is the first request or a follow-up. - bool find_next; - - // Force a re-search of the frame: typically used when forcing a re-search - // after the frame navigates. - bool force; - - // Signifies whether we should force text scoping to happen immediately - // or not. Only used for testing purposes. - bool run_synchronously_for_testing; - - WebFindOptions() - : forward(true), - match_case(false), - find_next(false), - force(false), - run_synchronously_for_testing(false) {} -}; - -} // namespace blink - -#endif
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h index 146be4c..395e648 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h
@@ -12,7 +12,6 @@ #include "base/unguessable_token.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/frame/sandbox_flags.h" -#include "third_party/blink/public/mojom/frame/find_in_page.mojom-shared.h" #include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_focus_type.h" @@ -59,7 +58,6 @@ struct WebConsoleMessage; struct WebContentSecurityPolicyViolation; struct WebNavigationParams; -struct WebFindOptions; struct WebMediaPlayerAction; struct WebPrintParams; struct WebPrintPresetOptions; @@ -683,7 +681,7 @@ // Find-in-page ----------------------------------------------------------- - // Searches a frame for a given string. + // Searches a frame for a given string. Only used for testing. // // If a match is found, this function will select it (scrolling down to // make it visible if needed) and fill in selectionRect with the @@ -693,19 +691,13 @@ // highlighting. // // Returns true if the search string was found, false otherwise. - virtual bool Find(int identifier, - const WebString& search_text, - const WebFindOptions&, - bool wrap_within_frame, - bool* active_now = nullptr) = 0; - - // Notifies the frame that we are no longer interested in searching. This - // will abort any asynchronous scoping effort already under way (see the - // function TextFinder::scopeStringMatches for details) and erase all - // tick-marks and highlighting from the previous search. It will also - // follow the specified StopFindAction. - // TODO(rakina): Stop exposing this when possible. - virtual void StopFindingForTesting(mojom::StopFindAction) = 0; + virtual bool FindForTesting(int identifier, + const WebString& search_text, + bool match_case, + bool forward, + bool find_next, + bool force, + bool wrap_within_frame) = 0; // Set the tickmarks for the frame. This will override the default tickmarks // generated by find results. If this is called with an empty array, the
diff --git a/third_party/blink/renderer/bindings/scripts/v8_dictionary.py b/third_party/blink/renderer/bindings/scripts/v8_dictionary.py index 88c4d22..a746080 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_dictionary.py +++ b/third_party/blink/renderer/bindings/scripts/v8_dictionary.py
@@ -137,14 +137,16 @@ return cpp_default_value, v8_default_value cpp_default_value, v8_default_value = default_values() - cpp_name = to_snake_case(v8_utilities.cpp_name(member)) + cpp_value = member.name + 'CppValue' + v8_value = member.name + 'Value' + has_value_or_default = member.name + 'HasValueOrDefault' getter_name = getter_name_for_dictionary_member(member) is_deprecated_dictionary = unwrapped_idl_type.name == 'Dictionary' return { 'cpp_default_value': cpp_default_value, - 'cpp_name': cpp_name, 'cpp_type': unwrapped_idl_type.cpp_type, + 'cpp_value': cpp_value, 'cpp_value_to_v8_value': unwrapped_idl_type.cpp_value_to_v8_value( cpp_value='impl.%s()' % getter_name, isolate='isolate', creation_context='creationContext', @@ -165,11 +167,13 @@ 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(member), # [OriginTrialEnabled] 'runtime_enabled_feature_name': v8_utilities.runtime_enabled_feature_name(member), # [RuntimeEnabled] 'setter_name': setter_name_for_dictionary_member(member), + 'has_value_or_default': has_value_or_default, 'null_setter_name': null_setter_name_for_dictionary_member(member), 'v8_default_value': v8_default_value, + 'v8_value': v8_value, 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( - extended_attributes, member.name + 'Value', - member.name + 'CppValue', isolate='isolate', use_exception_state=True), + extended_attributes, v8_value, cpp_value, isolate='isolate', + use_exception_state=True), }
diff --git a/third_party/blink/renderer/bindings/templates/dictionary_v8.cpp.tmpl b/third_party/blink/renderer/bindings/templates/dictionary_v8.cpp.tmpl index 20df71d..1573a02 100644 --- a/third_party/blink/renderer/bindings/templates/dictionary_v8.cpp.tmpl +++ b/third_party/blink/renderer/bindings/templates/dictionary_v8.cpp.tmpl
@@ -63,12 +63,12 @@ {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %} {% filter runtime_enabled(feature_name) %} {% for member in member_list %} - v8::Local<v8::Value> {{member.name}}Value; - if (!v8Object->Get(context, keys[{{members.index(member)}}].Get(isolate)).ToLocal(&{{member.name}}Value)) { + v8::Local<v8::Value> {{member.v8_value}}; + if (!v8Object->Get(context, keys[{{members.index(member)}}].Get(isolate)).ToLocal(&{{member.v8_value}})) { exceptionState.RethrowV8Exception(block.Exception()); return; } - if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) { + if ({{member.v8_value}}.IsEmpty() || {{member.v8_value}}->IsUndefined()) { {% if member.is_required %} exceptionState.ThrowTypeError("required member {{member.name}} is undefined."); return; @@ -76,7 +76,7 @@ // Do nothing. {% endif %} {% if member.is_nullable and not member.is_string_type %}{# String types handle null via V8StringResource #} - } else if ({{member.name}}Value->IsNull()) { + } else if ({{member.v8_value}}->IsNull()) { impl.{{member.null_setter_name}}(); {% endif %} } else { @@ -85,22 +85,22 @@ {% endif %} {{v8_value_to_local_cpp_value(member) | trim | indent}} {% if member.is_interface_type %} - if (!{{member.name}}CppValue) { + if (!{{member.cpp_value}}) { exceptionState.ThrowTypeError("member {{member.name}} is not of type {{member.idl_type}}."); return; } {% endif %} {% if member.enum_values %} {{declare_enum_validation_variable(member.enum_values) | trim | indent}} - if (!IsValidEnum({{member.name}}CppValue, validValues, base::size(validValues), "{{member.enum_type}}", exceptionState)) + if (!IsValidEnum({{member.cpp_value}}, validValues, base::size(validValues), "{{member.enum_type}}", exceptionState)) return; {% elif member.is_object %} - if (!{{member.name}}CppValue.IsObject()) { + if (!{{member.cpp_value}}.IsObject()) { exceptionState.ThrowTypeError("member {{member.name}} is not an object."); return; } {% endif %} - impl.{{member.setter_name}}({{member.name}}CppValue); + impl.{{member.setter_name}}({{member.cpp_value}}); } {% endfor %} @@ -138,33 +138,33 @@ {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %} {% filter runtime_enabled(feature_name) %} {% for member in member_list %} - v8::Local<v8::Value> {{member.name}}Value; - bool {{member.name}}HasValueOrDefault = false; + v8::Local<v8::Value> {{member.v8_value}}; + bool {{member.has_value_or_default}} = false; if (impl.{{member.has_method_name}}()) { {% if member.is_object %} DCHECK(impl.{{member.getter_name}}().IsObject()); {% endif %} - {{member.name}}Value = {{member.cpp_value_to_v8_value}}; - {{member.name}}HasValueOrDefault = true; + {{member.v8_value}} = {{member.cpp_value_to_v8_value}}; + {{member.has_value_or_default}} = true; {% if member.v8_default_value %} } else { - {{member.name}}Value = {{member.v8_default_value}}; - {{member.name}}HasValueOrDefault = true; + {{member.v8_value}} = {{member.v8_default_value}}; + {{member.has_value_or_default}} = true; {% elif member.is_nullable and not member.has_explicit_presence %} } else { - {{member.name}}Value = v8::Null(isolate); - {{member.name}}HasValueOrDefault = true; + {{member.v8_value}} = v8::Null(isolate); + {{member.has_value_or_default}} = true; {% elif member.is_required %} } else { NOTREACHED(); {% endif %} } - {# The HasValueOrDefault variable will be optimized out. + {# The _has_value_or_default variable will be optimized out. If there is a default value, the compiler will notice that all branches set it to true. If there is not, then the compiler will inline this call into the only branch that sets it to true. Either way, the code is efficient and the variable is completely elided. #} - if ({{member.name}}HasValueOrDefault && - !V8CallBoolean(dictionary->CreateDataProperty(context, keys[{{members.index(member)}}].Get(isolate), {{member.name}}Value))) { + if ({{member.has_value_or_default}} && + !V8CallBoolean(dictionary->CreateDataProperty(context, keys[{{members.index(member)}}].Get(isolate), {{member.v8_value}}))) { return false; }
diff --git a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl index b79b759a..9de161a 100644 --- a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
@@ -121,9 +121,9 @@ private: static const FilterOperations& InitialFilterInternal() { - DEFINE_STATIC_LOCAL(FilterOperationsWrapper, ops, + DEFINE_STATIC_LOCAL(Persistent<FilterOperationsWrapper>, ops, (FilterOperationsWrapper::Create())); - return ops.Operations(); + return ops->Operations(); } };
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.cc b/third_party/blink/renderer/core/animation/scroll_timeline.cc index 5cd324d..e85a1755 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.cc +++ b/third_party/blink/renderer/core/animation/scroll_timeline.cc
@@ -17,9 +17,9 @@ namespace { using ActiveScrollTimelineSet = HeapHashCountedSet<WeakMember<Node>>; ActiveScrollTimelineSet& GetActiveScrollTimelineSet() { - DEFINE_STATIC_LOCAL(ActiveScrollTimelineSet, set, + DEFINE_STATIC_LOCAL(Persistent<ActiveScrollTimelineSet>, set, (new ActiveScrollTimelineSet)); - return set; + return *set; } bool StringToScrollDirection(String scroll_direction,
diff --git a/third_party/blink/renderer/core/css/css_default_style_sheets.cc b/third_party/blink/renderer/core/css/css_default_style_sheets.cc index e68e8cea..8e34a4c 100644 --- a/third_party/blink/renderer/core/css/css_default_style_sheets.cc +++ b/third_party/blink/renderer/core/css/css_default_style_sheets.cc
@@ -46,21 +46,21 @@ using namespace HTMLNames; CSSDefaultStyleSheets& CSSDefaultStyleSheets::Instance() { - DEFINE_STATIC_LOCAL(CSSDefaultStyleSheets, css_default_style_sheets, - (new CSSDefaultStyleSheets)); - return css_default_style_sheets; + DEFINE_STATIC_LOCAL(Persistent<CSSDefaultStyleSheets>, + css_default_style_sheets, (new CSSDefaultStyleSheets)); + return *css_default_style_sheets; } static const MediaQueryEvaluator& ScreenEval() { - DEFINE_STATIC_LOCAL(MediaQueryEvaluator, static_screen_eval, + DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, static_screen_eval, (new MediaQueryEvaluator("screen"))); - return static_screen_eval; + return *static_screen_eval; } static const MediaQueryEvaluator& PrintEval() { - DEFINE_STATIC_LOCAL(MediaQueryEvaluator, static_print_eval, + DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, static_print_eval, (new MediaQueryEvaluator("print"))); - return static_print_eval; + return *static_print_eval; } static StyleSheetContents* ParseUASheet(const String& str) {
diff --git a/third_party/blink/renderer/core/css/css_path_value.cc b/third_party/blink/renderer/core/css/css_path_value.cc index 97d2b38..5382bad7 100644 --- a/third_party/blink/renderer/core/css/css_path_value.cc +++ b/third_party/blink/renderer/core/css/css_path_value.cc
@@ -48,8 +48,8 @@ } // namespace CSSPathValue& CSSPathValue::EmptyPathValue() { - DEFINE_STATIC_LOCAL(CSSPathValue, empty, (CreatePathValue())); - return empty; + DEFINE_STATIC_LOCAL(Persistent<CSSPathValue>, empty, (CreatePathValue())); + return *empty; } String CSSPathValue::CustomCSSText() const {
diff --git a/third_party/blink/renderer/core/css/css_style_rule.cc b/third_party/blink/renderer/core/css/css_style_rule.cc index eedc5dac..c2e6d1b4 100644 --- a/third_party/blink/renderer/core/css/css_style_rule.cc +++ b/third_party/blink/renderer/core/css/css_style_rule.cc
@@ -36,8 +36,9 @@ using SelectorTextCache = HeapHashMap<WeakMember<const CSSStyleRule>, String>; static SelectorTextCache& GetSelectorTextCache() { - DEFINE_STATIC_LOCAL(SelectorTextCache, cache, (new SelectorTextCache)); - return cache; + DEFINE_STATIC_LOCAL(Persistent<SelectorTextCache>, cache, + (new SelectorTextCache)); + return *cache; } CSSStyleRule::CSSStyleRule(StyleRule* style_rule, CSSStyleSheet* parent)
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc index a43153e..3bfcd9ac 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc
@@ -31,10 +31,10 @@ const CSSValue* AnimationDelay::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, value, + Persistent<CSSValue>, value, (CSSPrimitiveValue::Create(CSSTimingData::InitialDelay(), CSSPrimitiveValue::UnitType::kSeconds))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc index 454d4f52..8572a3a 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc
@@ -43,9 +43,9 @@ } const CSSValue* AnimationDirection::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueNormal))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc index 2c47c2b..b4fba58 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc
@@ -31,10 +31,10 @@ const CSSValue* AnimationDuration::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, value, + Persistent<CSSValue>, value, (CSSPrimitiveValue::Create(CSSTimingData::InitialDuration(), CSSPrimitiveValue::UnitType::kSeconds))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc index a2e15918..fa1c4ab 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc
@@ -42,9 +42,9 @@ } const CSSValue* AnimationFillMode::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueNone))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc index a60bce0..e8c25fd0 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc
@@ -43,10 +43,10 @@ const CSSValue* AnimationIterationCount::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, value, + Persistent<CSSValue>, value, (CSSPrimitiveValue::Create(CSSAnimationData::InitialIterationCount(), CSSPrimitiveValue::UnitType::kNumber))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc index 960f30a8..4b708e8 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc
@@ -40,9 +40,9 @@ } const CSSValue* AnimationName::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueNone))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc index 534e768..418090b 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc
@@ -41,9 +41,9 @@ } const CSSValue* AnimationPlayState::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueRunning))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc index 909a2b8..19983eb 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc
@@ -31,9 +31,9 @@ } const CSSValue* AnimationTimingFunction::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueEase))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc index 95f4b965..43fcc5ef 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc
@@ -30,13 +30,13 @@ const CSSValue* BorderImageOutset::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, zeroInteger, + Persistent<CSSValue>, zeroInteger, (CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kInteger))); DEFINE_STATIC_LOCAL( - CSSQuadValue, value, - (CSSQuadValue::Create(&zeroInteger, &zeroInteger, &zeroInteger, - &zeroInteger, CSSQuadValue::kSerializeAsQuad))); - return &value; + Persistent<CSSQuadValue>, value, + (CSSQuadValue::Create(zeroInteger, zeroInteger, zeroInteger, zeroInteger, + CSSQuadValue::kSerializeAsQuad))); + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc index c044d5b..4a9bcb09 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc
@@ -28,9 +28,9 @@ } const CSSValue* BorderImageRepeat::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueStretch))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc index 3fa08c8..3376506 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc
@@ -29,10 +29,10 @@ } const CSSValue* BorderImageSlice::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSPrimitiveValue::Create( 100, CSSPrimitiveValue::UnitType::kPercentage))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc index 89c11300..8f5375a8 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc
@@ -33,9 +33,9 @@ } const CSSValue* BorderImageSource::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueNone))); - return &value; + return value; } void BorderImageSource::ApplyValue(StyleResolverState& state,
diff --git a/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc index 4ca54fb..d981f2b 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc
@@ -30,13 +30,13 @@ const CSSValue* BorderImageWidth::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, oneInteger, + Persistent<CSSValue>, oneInteger, (CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kInteger))); DEFINE_STATIC_LOCAL( - CSSQuadValue, value, - (CSSQuadValue::Create(&oneInteger, &oneInteger, &oneInteger, &oneInteger, + Persistent<CSSQuadValue>, value, + (CSSQuadValue::Create(oneInteger, oneInteger, oneInteger, oneInteger, CSSQuadValue::kSerializeAsQuad))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc index 0e38cbf..5fb5fc3 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc
@@ -31,10 +31,10 @@ const CSSValue* TransitionDelay::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, value, + Persistent<CSSValue>, value, (CSSPrimitiveValue::Create(CSSTimingData::InitialDelay(), CSSPrimitiveValue::UnitType::kSeconds))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc index 2ddf706..4055c98 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc
@@ -31,10 +31,10 @@ const CSSValue* TransitionDuration::InitialValue() const { DEFINE_STATIC_LOCAL( - CSSValue, value, + Persistent<CSSValue>, value, (CSSPrimitiveValue::Create(CSSTimingData::InitialDuration(), CSSPrimitiveValue::UnitType::kSeconds))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc index a296813..2d5db6a 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc
@@ -34,9 +34,9 @@ } const CSSValue* TransitionProperty::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueAll))); - return &value; + return value; } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc index 8e0d46d..fe47504 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc
@@ -31,9 +31,9 @@ } const CSSValue* TransitionTimingFunction::InitialValue() const { - DEFINE_STATIC_LOCAL(CSSValue, value, + DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value, (CSSIdentifierValue::Create(CSSValueEase))); - return &value; + return value; } } // namespace CSSLonghand
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 ab2b1ad..183a581 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc
@@ -118,19 +118,21 @@ ComputedStyle* StyleResolver::style_not_yet_available_; static CSSPropertyValueSet* LeftToRightDeclaration() { - DEFINE_STATIC_LOCAL(MutableCSSPropertyValueSet, left_to_right_decl, + DEFINE_STATIC_LOCAL(Persistent<MutableCSSPropertyValueSet>, + left_to_right_decl, (MutableCSSPropertyValueSet::Create(kHTMLQuirksMode))); - if (left_to_right_decl.IsEmpty()) - left_to_right_decl.SetProperty(CSSPropertyDirection, CSSValueLtr); - return &left_to_right_decl; + if (left_to_right_decl->IsEmpty()) + left_to_right_decl->SetProperty(CSSPropertyDirection, CSSValueLtr); + return left_to_right_decl; } static CSSPropertyValueSet* RightToLeftDeclaration() { - DEFINE_STATIC_LOCAL(MutableCSSPropertyValueSet, right_to_left_decl, + DEFINE_STATIC_LOCAL(Persistent<MutableCSSPropertyValueSet>, + right_to_left_decl, (MutableCSSPropertyValueSet::Create(kHTMLQuirksMode))); - if (right_to_left_decl.IsEmpty()) - right_to_left_decl.SetProperty(CSSPropertyDirection, CSSValueRtl); - return &right_to_left_decl; + if (right_to_left_decl->IsEmpty()) + right_to_left_decl->SetProperty(CSSPropertyDirection, CSSValueRtl); + return right_to_left_decl; } static void CollectScopedResolversForHostedShadowTrees(
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 b9406ce..1d94c51 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.cc +++ b/third_party/blink/renderer/core/css/style_property_serializer.cc
@@ -1072,15 +1072,15 @@ const CSSValue& repeat_xcss_value, const CSSValue& repeat_ycss_value) { // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. - DEFINE_STATIC_LOCAL(CSSIdentifierValue, initial_repeat_value, + DEFINE_STATIC_LOCAL(Persistent<CSSIdentifierValue>, initial_repeat_value, (CSSIdentifierValue::Create(CSSValueRepeat))); const CSSIdentifierValue& repeat_x = repeat_xcss_value.IsInitialValue() - ? initial_repeat_value + ? *initial_repeat_value : ToCSSIdentifierValue(repeat_xcss_value); const CSSIdentifierValue& repeat_y = repeat_ycss_value.IsInitialValue() - ? initial_repeat_value + ? *initial_repeat_value : ToCSSIdentifierValue(repeat_ycss_value); CSSValueID repeat_x_value_id = repeat_x.GetValueID(); CSSValueID repeat_y_value_id = repeat_y.GetValueID();
diff --git a/third_party/blink/renderer/core/dom/child_list_mutation_scope.cc b/third_party/blink/renderer/core/dom/child_list_mutation_scope.cc index ff89079..5413c5ee 100644 --- a/third_party/blink/renderer/core/dom/child_list_mutation_scope.cc +++ b/third_party/blink/renderer/core/dom/child_list_mutation_scope.cc
@@ -46,8 +46,8 @@ AccumulatorMap; static AccumulatorMap& GetAccumulatorMap() { - DEFINE_STATIC_LOCAL(AccumulatorMap, map, (new AccumulatorMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<AccumulatorMap>, map, (new AccumulatorMap)); + return *map; } ChildListMutationAccumulator::ChildListMutationAccumulator(
diff --git a/third_party/blink/renderer/core/dom/context_features.cc b/third_party/blink/renderer/core/dom/context_features.cc index b629205..ff09ee9 100644 --- a/third_party/blink/renderer/core/dom/context_features.cc +++ b/third_party/blink/renderer/core/dom/context_features.cc
@@ -41,9 +41,9 @@ ContextFeatures& ContextFeatures::DefaultSwitch() { DEFINE_STATIC_LOCAL( - ContextFeatures, instance, + Persistent<ContextFeatures>, instance, (ContextFeatures::Create(ContextFeaturesClient::Empty()))); - return instance; + return *instance; } bool ContextFeatures::PagePopupEnabled(Document* document) {
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index fcab90ce..d0abca1 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -2213,7 +2213,6 @@ EvaluateMediaQueryListIfNeeded(); UpdateUseShadowTreesIfNeeded(); - // For V0 Shadow DOM or V1 Shadow DOM without IncrementalShadowDOM UpdateDistributionForLegacyDistributedNodes(); UpdateActiveStyle(); @@ -7635,8 +7634,9 @@ #ifndef NDEBUG static WeakDocumentSet& liveDocumentSet() { - DEFINE_STATIC_LOCAL(WeakDocumentSet, set, (new WeakDocumentSet)); - return set; + DEFINE_STATIC_LOCAL(blink::Persistent<WeakDocumentSet>, set, + (new WeakDocumentSet)); + return *set; } void showLiveDocumentInstances() {
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index 27d215b1..45b2278 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -341,7 +341,8 @@ "<div><select><option>012</option></div>"); Element* const select_element = GetDocument().QuerySelector("select"); const Position& position = - Position::AfterNode(*select_element->UserAgentShadowRoot()); + Position(*select_element->UserAgentShadowRoot(), + select_element->UserAgentShadowRoot()->CountChildren()); Range* const range = Document::CreateRangeAdjustedToTreeScope(GetDocument(), position); EXPECT_EQ(range->startContainer(), select_element->parentNode());
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 1491431..c1b5ef52 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -174,10 +174,10 @@ // bunch more logic for transferring the callbacks between Pages when elements // are moved around. ScrollCustomizationCallbacks& GetScrollCustomizationCallbacks() { - DEFINE_STATIC_LOCAL(ScrollCustomizationCallbacks, + DEFINE_STATIC_LOCAL(Persistent<ScrollCustomizationCallbacks>, scroll_customization_callbacks, (new ScrollCustomizationCallbacks)); - return scroll_customization_callbacks; + return *scroll_customization_callbacks; } } // namespace @@ -2728,7 +2728,6 @@ return *shadow_root; } -// TODO(kochi): inline this. ShadowRoot* Element::GetShadowRoot() const { return HasRareData() ? GetElementRareData()->GetShadowRoot() : nullptr; }
diff --git a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc index db7462a..5b4781f 100644 --- a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc +++ b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc
@@ -82,17 +82,17 @@ // before dispatchSimulatedClick() returns. This vector is here just to // prevent the code from running into an infinite recursion of // dispatchSimulatedClick(). - DEFINE_STATIC_LOCAL(HeapHashSet<Member<Node>>, + DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<Member<Node>>>, nodes_dispatching_simulated_clicks, (new HeapHashSet<Member<Node>>)); if (IsDisabledFormControl(&node)) return; - if (nodes_dispatching_simulated_clicks.Contains(&node)) + if (nodes_dispatching_simulated_clicks->Contains(&node)) return; - nodes_dispatching_simulated_clicks.insert(&node); + nodes_dispatching_simulated_clicks->insert(&node); if (mouse_event_options == kSendMouseOverUpDownEvents) EventDispatcher(node, *MouseEvent::Create(EventTypeNames::mouseover, @@ -121,7 +121,7 @@ underlying_event, creation_scope)) .Dispatch(); - nodes_dispatching_simulated_clicks.erase(&node); + nodes_dispatching_simulated_clicks->erase(&node); } // https://dom.spec.whatwg.org/#dispatching-events
diff --git a/third_party/blink/renderer/core/dom/events/event_target.cc b/third_party/blink/renderer/core/dom/events/event_target.cc index 95de7fc..6c34fb3 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.cc +++ b/third_party/blink/renderer/core/dom/events/event_target.cc
@@ -128,8 +128,7 @@ const Event& event, RegisteredEventListener* registered_listener, base::TimeDelta delayed) { - if (registered_listener->Callback()->GetType() != - EventListener::kJSEventListenerType) + if (registered_listener->Callback()->IsNativeBased()) return; String message_text = String::Format(
diff --git a/third_party/blink/renderer/core/dom/events/window_event_context.cc b/third_party/blink/renderer/core/dom/events/window_event_context.cc index cf6ac7fe..0ba5635 100644 --- a/third_party/blink/renderer/core/dom/events/window_event_context.cc +++ b/third_party/blink/renderer/core/dom/events/window_event_context.cc
@@ -45,6 +45,7 @@ return; window_ = ToDocument(top_node_event_context.GetNode())->domWindow(); target_ = top_node_event_context.Target(); + related_target_ = top_node_event_context.RelatedTarget(); } bool WindowEventContext::HandleLocalEvents(Event& event) { @@ -53,6 +54,8 @@ event.SetTarget(Target()); event.SetCurrentTarget(Window()); + if (RelatedTarget()) + event.SetRelatedTargetIfExists(RelatedTarget()); window_->FireEventListeners(event); return true; } @@ -60,6 +63,7 @@ void WindowEventContext::Trace(blink::Visitor* visitor) { visitor->Trace(window_); visitor->Trace(target_); + visitor->Trace(related_target_); } } // namespace blink
diff --git a/third_party/blink/renderer/core/dom/events/window_event_context.h b/third_party/blink/renderer/core/dom/events/window_event_context.h index 133a6096..07d72e5 100644 --- a/third_party/blink/renderer/core/dom/events/window_event_context.h +++ b/third_party/blink/renderer/core/dom/events/window_event_context.h
@@ -43,6 +43,7 @@ LocalDOMWindow* Window() const; EventTarget* Target() const; + EventTarget* RelatedTarget() const; bool HandleLocalEvents(Event&); void Trace(blink::Visitor*); @@ -50,6 +51,7 @@ private: Member<LocalDOMWindow> window_; Member<EventTarget> target_; + Member<EventTarget> related_target_; DISALLOW_COPY_AND_ASSIGN(WindowEventContext); }; @@ -61,6 +63,10 @@ return target_.Get(); } +inline EventTarget* WindowEventContext::RelatedTarget() const { + return related_target_.Get(); +} + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_WINDOW_EVENT_CONTEXT_H_
diff --git a/third_party/blink/renderer/core/dom/mutation_observer.cc b/third_party/blink/renderer/core/dom/mutation_observer.cc index a330c7b..85793581 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer.cc +++ b/third_party/blink/renderer/core/dom/mutation_observer.cc
@@ -219,9 +219,9 @@ } static MutationObserverSet& ActiveMutationObservers() { - DEFINE_STATIC_LOCAL(MutationObserverSet, active_observers, + DEFINE_STATIC_LOCAL(Persistent<MutationObserverSet>, active_observers, (new MutationObserverSet)); - return active_observers; + return *active_observers; } using SlotChangeList = HeapVector<Member<HTMLSlotElement>>; @@ -230,14 +230,15 @@ // similar-origin browsing context. // https://html.spec.whatwg.org/multipage/browsers.html#unit-of-related-similar-origin-browsing-contexts static SlotChangeList& ActiveSlotChangeList() { - DEFINE_STATIC_LOCAL(SlotChangeList, slot_change_list, (new SlotChangeList)); - return slot_change_list; + DEFINE_STATIC_LOCAL(Persistent<SlotChangeList>, slot_change_list, + (new SlotChangeList)); + return *slot_change_list; } static MutationObserverSet& SuspendedMutationObservers() { - DEFINE_STATIC_LOCAL(MutationObserverSet, suspended_observers, + DEFINE_STATIC_LOCAL(Persistent<MutationObserverSet>, suspended_observers, (new MutationObserverSet)); - return suspended_observers; + return *suspended_observers; } static void EnsureEnqueueMicrotask() {
diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc index 17537d8..43b367d 100644 --- a/third_party/blink/renderer/core/dom/node.cc +++ b/third_party/blink/renderer/core/dom/node.cc
@@ -2109,8 +2109,9 @@ using EventTargetDataMap = HeapHashMap<WeakMember<Node>, TraceWrapperMember<EventTargetData>>; static EventTargetDataMap& GetEventTargetDataMap() { - DEFINE_STATIC_LOCAL(EventTargetDataMap, map, (new EventTargetDataMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<EventTargetDataMap>, map, + (new EventTargetDataMap)); + return *map; } EventTargetData* Node::GetEventTargetData() {
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h index 3a2090e7..8acd2ce 100644 --- a/third_party/blink/renderer/core/dom/node.h +++ b/third_party/blink/renderer/core/dom/node.h
@@ -327,9 +327,6 @@ // If this node is in a shadow tree, returns its shadow host. Otherwise, // returns nullptr. - // TODO(kochi): crbug.com/507413 ownerShadowHost() can return nullptr even - // when it is in a shadow tree but its root is detached from its host. This - // can happen when handling queued events (e.g. during execCommand()). Element* OwnerShadowHost() const; // crbug.com/569532: containingShadowRoot() can return nullptr even if // isInShadowTree() returns true. @@ -500,8 +497,7 @@ void SetNeedsStyleInvalidation(); // This needs to be called before using FlatTreeTraversal. - // Once 1) IncrementalShadowDOM is launched, and 2) Shadow DOM v0 is removed, - // this function can be removed. + // Once Shadow DOM v0 is removed, this function can be removed. void UpdateDistributionForFlatTreeTraversal() { UpdateDistributionInternal(); }
diff --git a/third_party/blink/renderer/core/dom/presentation_attribute_style.cc b/third_party/blink/renderer/core/dom/presentation_attribute_style.cc index 031cc5c..e894ce9 100644 --- a/third_party/blink/renderer/core/dom/presentation_attribute_style.cc +++ b/third_party/blink/renderer/core/dom/presentation_attribute_style.cc
@@ -75,9 +75,9 @@ Member<PresentationAttributeCacheEntry>, AlreadyHashed>; static PresentationAttributeCache& GetPresentationAttributeCache() { - DEFINE_STATIC_LOCAL(PresentationAttributeCache, cache, + DEFINE_STATIC_LOCAL(Persistent<PresentationAttributeCache>, cache, (new PresentationAttributeCache)); - return cache; + return *cache; } static bool AttributeNameSort(const std::pair<StringImpl*, AtomicString>& p1,
diff --git a/third_party/blink/renderer/core/dom/shadow_root_v0.cc b/third_party/blink/renderer/core/dom/shadow_root_v0.cc index e475ad7..41971ed 100644 --- a/third_party/blink/renderer/core/dom/shadow_root_v0.cc +++ b/third_party/blink/renderer/core/dom/shadow_root_v0.cc
@@ -125,15 +125,15 @@ const HeapVector<Member<V0InsertionPoint>>& ShadowRootV0::DescendantInsertionPoints() { - DEFINE_STATIC_LOCAL(HeapVector<Member<V0InsertionPoint>>, empty_list, - (new HeapVector<Member<V0InsertionPoint>>)); + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<V0InsertionPoint>>>, + empty_list, (new HeapVector<Member<V0InsertionPoint>>)); if (descendant_insertion_points_is_valid_) return descendant_insertion_points_; descendant_insertion_points_is_valid_ = true; if (!ContainsInsertionPoints()) - return empty_list; + return *empty_list; HeapVector<Member<V0InsertionPoint>> insertion_points; for (V0InsertionPoint& insertion_point :
diff --git a/third_party/blink/renderer/core/dom/tree_ordered_map.cc b/third_party/blink/renderer/core/dom/tree_ordered_map.cc index 54bc633..b02ac81 100644 --- a/third_party/blink/renderer/core/dom/tree_ordered_map.cc +++ b/third_party/blink/renderer/core/dom/tree_ordered_map.cc
@@ -155,12 +155,12 @@ const AtomicString& key, const TreeScope& scope) const { DCHECK(key); - DEFINE_STATIC_LOCAL(HeapVector<Member<Element>>, empty_vector, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<Element>>>, empty_vector, (new HeapVector<Member<Element>>)); Map::iterator it = map_.find(key); if (it == map_.end()) - return empty_vector; + return *empty_vector; Member<MapEntry>& entry = it->value; DCHECK(entry->count);
diff --git a/third_party/blink/renderer/core/dom/tree_scope.cc b/third_party/blink/renderer/core/dom/tree_scope.cc index f1dfd1e..70fe641 100644 --- a/third_party/blink/renderer/core/dom/tree_scope.cc +++ b/third_party/blink/renderer/core/dom/tree_scope.cc
@@ -127,12 +127,12 @@ const HeapVector<Member<Element>>& TreeScope::GetAllElementsById( const AtomicString& element_id) const { - DEFINE_STATIC_LOCAL(HeapVector<Member<Element>>, empty_vector, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<Element>>>, empty_vector, (new HeapVector<Member<Element>>)); if (element_id.IsEmpty()) - return empty_vector; + return *empty_vector; if (!elements_by_id_) - return empty_vector; + return *empty_vector; return elements_by_id_->GetAllElementsById(element_id, *this); }
diff --git a/third_party/blink/renderer/core/dom/weak_identifier_map.h b/third_party/blink/renderer/core/dom/weak_identifier_map.h index fad6fad..07b2d9a 100644 --- a/third_party/blink/renderer/core/dom/weak_identifier_map.h +++ b/third_party/blink/renderer/core/dom/weak_identifier_map.h
@@ -102,9 +102,9 @@ WeakIdentifierMap<T, ##__VA_ARGS__>& \ WeakIdentifierMap<T, ##__VA_ARGS__>::Instance() { \ using RefType = WeakIdentifierMap<T, ##__VA_ARGS__>; \ - DEFINE_STATIC_LOCAL(RefType, map_instance, \ + DEFINE_STATIC_LOCAL(Persistent<RefType>, map_instance, \ (new WeakIdentifierMap<T, ##__VA_ARGS__>())); \ - return map_instance; \ + return *map_instance; \ } } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/editing_style.cc b/third_party/blink/renderer/core/editing/editing_style.cc index d307947..75fba860 100644 --- a/third_party/blink/renderer/core/editing/editing_style.cc +++ b/third_party/blink/renderer/core/editing/editing_style.cc
@@ -970,32 +970,32 @@ static const HeapVector<Member<HTMLElementEquivalent>>& HtmlElementEquivalents() { - DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLElementEquivalent>>, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<HTMLElementEquivalent>>>, html_element_equivalents, (new HeapVector<Member<HTMLElementEquivalent>>)); - if (!html_element_equivalents.size()) { - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + if (!html_element_equivalents->size()) { + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyFontWeight, CSSValueBold, HTMLNames::bTag)); - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyFontWeight, CSSValueBold, HTMLNames::strongTag)); - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyVerticalAlign, CSSValueSub, HTMLNames::subTag)); - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyVerticalAlign, CSSValueSuper, HTMLNames::supTag)); - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyFontStyle, CSSValueItalic, HTMLNames::iTag)); - html_element_equivalents.push_back(HTMLElementEquivalent::Create( + html_element_equivalents->push_back(HTMLElementEquivalent::Create( CSSPropertyFontStyle, CSSValueItalic, HTMLNames::emTag)); - html_element_equivalents.push_back(HTMLTextDecorationEquivalent::Create( + html_element_equivalents->push_back(HTMLTextDecorationEquivalent::Create( CSSValueUnderline, HTMLNames::uTag)); - html_element_equivalents.push_back(HTMLTextDecorationEquivalent::Create( + html_element_equivalents->push_back(HTMLTextDecorationEquivalent::Create( CSSValueLineThrough, HTMLNames::sTag)); - html_element_equivalents.push_back(HTMLTextDecorationEquivalent::Create( + html_element_equivalents->push_back(HTMLTextDecorationEquivalent::Create( CSSValueLineThrough, HTMLNames::strikeTag)); } - return html_element_equivalents; + return *html_element_equivalents; } bool EditingStyle::ConflictsWithImplicitStyleOfElement( @@ -1023,26 +1023,26 @@ static const HeapVector<Member<HTMLAttributeEquivalent>>& HtmlAttributeEquivalents() { - DEFINE_STATIC_LOCAL(HeapVector<Member<HTMLAttributeEquivalent>>, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<HTMLAttributeEquivalent>>>, html_attribute_equivalents, (new HeapVector<Member<HTMLAttributeEquivalent>>)); - if (!html_attribute_equivalents.size()) { + if (!html_attribute_equivalents->size()) { // elementIsStyledSpanOrHTMLEquivalent depends on the fact each // HTMLAttriuteEquivalent matches exactly one attribute of exactly one // element except dirAttr. - html_attribute_equivalents.push_back(HTMLAttributeEquivalent::Create( + html_attribute_equivalents->push_back(HTMLAttributeEquivalent::Create( CSSPropertyColor, HTMLNames::fontTag, HTMLNames::colorAttr)); - html_attribute_equivalents.push_back(HTMLAttributeEquivalent::Create( + html_attribute_equivalents->push_back(HTMLAttributeEquivalent::Create( CSSPropertyFontFamily, HTMLNames::fontTag, HTMLNames::faceAttr)); - html_attribute_equivalents.push_back(HTMLFontSizeEquivalent::Create()); + html_attribute_equivalents->push_back(HTMLFontSizeEquivalent::Create()); - html_attribute_equivalents.push_back(HTMLAttributeEquivalent::Create( + html_attribute_equivalents->push_back(HTMLAttributeEquivalent::Create( CSSPropertyDirection, HTMLNames::dirAttr)); - html_attribute_equivalents.push_back(HTMLAttributeEquivalent::Create( + html_attribute_equivalents->push_back(HTMLAttributeEquivalent::Create( CSSPropertyUnicodeBidi, HTMLNames::dirAttr)); } - return html_attribute_equivalents; + return *html_attribute_equivalents; } bool EditingStyle::ConflictsWithImplicitStyleOfAttributes( @@ -1317,17 +1317,17 @@ static const CSSValueList& MergeTextDecorationValues( const CSSValueList& merged_value, const CSSValueList& value_to_merge) { - DEFINE_STATIC_LOCAL(CSSIdentifierValue, underline, + DEFINE_STATIC_LOCAL(Persistent<CSSIdentifierValue>, underline, (CSSIdentifierValue::Create(CSSValueUnderline))); - DEFINE_STATIC_LOCAL(CSSIdentifierValue, line_through, + DEFINE_STATIC_LOCAL(Persistent<CSSIdentifierValue>, line_through, (CSSIdentifierValue::Create(CSSValueLineThrough))); CSSValueList& result = *merged_value.Copy(); - if (value_to_merge.HasValue(underline) && !merged_value.HasValue(underline)) - result.Append(underline); + if (value_to_merge.HasValue(*underline) && !merged_value.HasValue(*underline)) + result.Append(*underline); - if (value_to_merge.HasValue(line_through) && - !merged_value.HasValue(line_through)) - result.Append(line_through); + if (value_to_merge.HasValue(*line_through) && + !merged_value.HasValue(*line_through)) + result.Append(*line_through); return result; } @@ -1655,14 +1655,14 @@ const CSSValue* text_decoration = style->GetPropertyCSSValue(CSSPropertyTextDecorationLine); if (text_decoration && text_decoration->IsValueList()) { - DEFINE_STATIC_LOCAL(CSSIdentifierValue, underline, + DEFINE_STATIC_LOCAL(Persistent<CSSIdentifierValue>, underline, (CSSIdentifierValue::Create(CSSValueUnderline))); - DEFINE_STATIC_LOCAL(CSSIdentifierValue, line_through, + DEFINE_STATIC_LOCAL(Persistent<CSSIdentifierValue>, line_through, (CSSIdentifierValue::Create(CSSValueLineThrough))); CSSValueList* new_text_decoration = ToCSSValueList(text_decoration)->Copy(); - if (new_text_decoration->RemoveAll(underline)) + if (new_text_decoration->RemoveAll(*underline)) apply_underline_ = true; - if (new_text_decoration->RemoveAll(line_through)) + if (new_text_decoration->RemoveAll(*line_through)) apply_line_through_ = true; // If trimTextDecorations, delete underline and line-through
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder.cc b/third_party/blink/renderer/core/editing/finder/text_finder.cc index 71f01cf..95c4e1d1 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder.cc +++ b/third_party/blink/renderer/core/editing/finder/text_finder.cc
@@ -34,7 +34,6 @@ #include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/public/platform/web_scroll_into_view_params.h" #include "third_party/blink/public/platform/web_vector.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/renderer/core/accessibility/ax_object_cache_base.h" @@ -81,10 +80,11 @@ class TextFinder::IdleScopeStringMatchesCallback : public ScriptedIdleTaskController::IdleTask { public: - static IdleScopeStringMatchesCallback* Create(TextFinder* text_finder, - int identifier, - const WebString& search_text, - const WebFindOptions& options) { + static IdleScopeStringMatchesCallback* Create( + TextFinder* text_finder, + int identifier, + const WebString& search_text, + const mojom::blink::FindOptions& options) { return new IdleScopeStringMatchesCallback(text_finder, identifier, search_text, options); } @@ -108,11 +108,11 @@ IdleScopeStringMatchesCallback(TextFinder* text_finder, int identifier, const WebString& search_text, - const WebFindOptions& options) + const mojom::blink::FindOptions& options) : text_finder_(text_finder), identifier_(identifier), search_text_(search_text), - options_(options) { + options_(options.Clone()) { callback_handle_ = text_finder->GetFrame()->GetDocument()->RequestIdleCallback( this, IdleRequestOptions()); @@ -120,14 +120,14 @@ void invoke(IdleDeadline* deadline) override { text_finder_->ResumeScopingStringMatches(deadline, identifier_, - search_text_, options_); + search_text_, *options_); } Member<TextFinder> text_finder_; int callback_handle_ = 0; const int identifier_; const WebString search_text_; - const WebFindOptions options_; + mojom::blink::FindOptionsPtr options_; }; static void ScrollToVisible(Range* match) { @@ -150,7 +150,7 @@ bool TextFinder::Find(int identifier, const WebString& search_text, - const WebFindOptions& options, + const mojom::blink::FindOptions& options, bool wrap_within_frame, bool* active_now) { if (!options.find_next) @@ -388,9 +388,10 @@ } } -void TextFinder::StartScopingStringMatches(int identifier, - const WebString& search_text, - const WebFindOptions& options) { +void TextFinder::StartScopingStringMatches( + int identifier, + const WebString& search_text, + const mojom::blink::FindOptions& options) { CancelPendingScopingEffort(); // This is a brand new search, so we need to reset everything. @@ -426,7 +427,7 @@ void TextFinder::ScopeStringMatches(IdleDeadline* deadline, int identifier, const WebString& search_text, - const WebFindOptions& options) { + const mojom::blink::FindOptions& options) { if (!ShouldScopeMatches(search_text, options)) { FinishCurrentScopingEffort(identifier); return; @@ -847,7 +848,7 @@ } bool TextFinder::ShouldScopeMatches(const String& search_text, - const WebFindOptions& options) { + const mojom::blink::FindOptions& options) { // Don't scope if we can't find a frame or a view. // The user may have closed the tab/application, so abort. LocalFrame* frame = OwnerFrame().GetFrame(); @@ -879,9 +880,10 @@ return true; } -void TextFinder::ScopeStringMatchesSoon(int identifier, - const WebString& search_text, - const WebFindOptions& options) { +void TextFinder::ScopeStringMatchesSoon( + int identifier, + const WebString& search_text, + const mojom::blink::FindOptions& options) { DCHECK_EQ(idle_scoping_callback_, nullptr); // If it's for testing, run the scoping immediately. // TODO(rakina): Change to use general solution when it's available. @@ -897,10 +899,11 @@ } } -void TextFinder::ResumeScopingStringMatches(IdleDeadline* deadline, - int identifier, - const WebString& search_text, - const WebFindOptions& options) { +void TextFinder::ResumeScopingStringMatches( + IdleDeadline* deadline, + int identifier, + const WebString& search_text, + const mojom::blink::FindOptions& options) { idle_scoping_callback_.Clear(); ScopeStringMatches(deadline, identifier, search_text, options);
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder.h b/third_party/blink/renderer/core/editing/finder/text_finder.h index aa3a531e..65c7c6b 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder.h +++ b/third_party/blink/renderer/core/editing/finder/text_finder.h
@@ -32,6 +32,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_FINDER_TEXT_FINDER_H_ #include "base/macros.h" +#include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/platform/web_float_point.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/geometry/float_rect.h" @@ -46,7 +47,6 @@ class Range; class WebLocalFrameImpl; class WebString; -struct WebFindOptions; struct WebFloatPoint; struct WebFloatRect; struct WebRect; @@ -58,7 +58,7 @@ bool Find(int identifier, const WebString& search_text, - const WebFindOptions&, + const mojom::blink::FindOptions& options, bool wrap_within_frame, bool* active_now = nullptr); void ClearActiveFindMatch(); @@ -74,7 +74,7 @@ // asyncronously calls scopeStringMatches(). void StartScopingStringMatches(int identifier, const WebString& search_text, - const WebFindOptions&); + const mojom::blink::FindOptions& options); // Cancels any outstanding requests for scoping string matches on the frame. void CancelPendingScopingEffort(); @@ -166,7 +166,7 @@ // is a repeat search that already returned nothing last time the same prefix // was searched. bool ShouldScopeMatches(const WTF::String& search_text, - const WebFindOptions&); + const mojom::blink::FindOptions&); // Removes the current frame from the global scoping effort and triggers any // updates if appropriate. This method does not mark the scoping operation @@ -189,18 +189,18 @@ void ScopeStringMatches(IdleDeadline* deadline, int identifier, const WebString& search_text, - const WebFindOptions&); + const mojom::blink::FindOptions&); // Queue up a deferred call to scopeStringMatches. void ScopeStringMatchesSoon(int identifier, const WebString& search_text, - const WebFindOptions&); + const mojom::blink::FindOptions&); // Called by an IdleScopeStringMatchesCallback instance. void ResumeScopingStringMatches(IdleDeadline* deadline, int identifier, const WebString& search_text, - const WebFindOptions&); + const mojom::blink::FindOptions&); // Determines whether to invalidate the content area and scrollbar. void InvalidateIfNecessary();
diff --git a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc index a5dcce0..db53617 100644 --- a/third_party/blink/renderer/core/editing/finder/text_finder_test.cc +++ b/third_party/blink/renderer/core/editing/finder/text_finder_test.cc
@@ -8,7 +8,6 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_float_rect.h" #include "third_party/blink/public/web/web_document.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node_list.h" #include "third_party/blink/renderer/core/dom/range.h" @@ -80,10 +79,11 @@ int identifier = 0; WebString search_text(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. bool wrap_within_frame = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); Range* active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -92,8 +92,8 @@ EXPECT_EQ(text_node, active_match->endContainer()); EXPECT_EQ(10u, active_match->endOffset()); - find_options.find_next = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -103,7 +103,7 @@ EXPECT_EQ(20u, active_match->endOffset()); // Should wrap to the first match. - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -114,10 +114,10 @@ // Search in the reverse order. identifier = 1; - find_options = WebFindOptions(); - find_options.forward = false; + find_options = mojom::blink::FindOptions::New(); + find_options->forward = false; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -126,8 +126,8 @@ EXPECT_EQ(text_node, active_match->endContainer()); EXPECT_EQ(20u, active_match->endOffset()); - find_options.find_next = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -137,7 +137,7 @@ EXPECT_EQ(10u, active_match->endOffset()); // Wrap to the first match (last occurence in the document). - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -153,7 +153,8 @@ int identifier = 0; WebString search_text(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. bool wrap_within_frame = true; // Set viewport scale to 20 in order to simulate zoom-in @@ -170,7 +171,7 @@ GetDocument().UpdateStyleAndLayout(); // In case of autosizing, scale _should_ change - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); ASSERT_TRUE(GetTextFinder().ActiveMatch()); ASSERT_EQ(1, visual_viewport.Scale()); // in this case to 1 @@ -181,7 +182,7 @@ GetDocument().GetTextAutosizer()->UpdatePageInfo(); GetDocument().UpdateStyleAndLayout(); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); ASSERT_TRUE(GetTextFinder().ActiveMatch()); ASSERT_EQ(20, visual_viewport.Scale()); @@ -193,10 +194,11 @@ int identifier = 0; WebString search_text(String("Boo")); - WebFindOptions find_options; // Default + add testing flag. + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. bool wrap_within_frame = true; - EXPECT_FALSE(GetTextFinder().Find(identifier, search_text, find_options, + EXPECT_FALSE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); EXPECT_FALSE(GetTextFinder().ActiveMatch()); } @@ -214,13 +216,14 @@ int identifier = 0; WebString search_text(String("foo")); - WebFindOptions find_options; // Default + add testing flag. + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. bool wrap_within_frame = true; // TextIterator currently returns the matches in the flat treeorder, so // in this case the matches will be returned in the order of // <i> -> <u> -> <b>. - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); Range* active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -229,8 +232,8 @@ EXPECT_EQ(text_in_i_element, active_match->endContainer()); EXPECT_EQ(3u, active_match->endOffset()); - find_options.find_next = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -239,7 +242,7 @@ EXPECT_EQ(text_in_u_element, active_match->endContainer()); EXPECT_EQ(3u, active_match->endOffset()); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -249,7 +252,7 @@ EXPECT_EQ(3u, active_match->endOffset()); // Should wrap to the first match. - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -260,10 +263,10 @@ // Fresh search in the reverse order. identifier = 1; - find_options = WebFindOptions(); - find_options.forward = false; + find_options = mojom::blink::FindOptions::New(); + find_options->forward = false; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -272,8 +275,8 @@ EXPECT_EQ(text_in_b_element, active_match->endContainer()); EXPECT_EQ(3u, active_match->endOffset()); - find_options.find_next = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -282,7 +285,7 @@ EXPECT_EQ(text_in_u_element, active_match->endContainer()); EXPECT_EQ(3u, active_match->endOffset()); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -292,7 +295,7 @@ EXPECT_EQ(3u, active_match->endOffset()); // And wrap. - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame)); active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -310,12 +313,13 @@ int identifier = 0; WebString search_text(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); EXPECT_EQ(2, GetTextFinder().TotalMatchCount()); WebVector<WebFloatRect> match_rects = GetTextFinder().FindMatchRects(); @@ -343,14 +347,15 @@ int identifier = 0; WebString search_text1(String("XFindMe")); WebString search_text2(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text1, - find_options); + *find_options); GetTextFinder().StartScopingStringMatches(identifier, search_text2, - find_options); + *find_options); // Only searchText2 should be highlighted. EXPECT_EQ(2, GetTextFinder().TotalMatchCount()); @@ -373,12 +378,13 @@ int identifier = 0; WebString search_text(String("fOO")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); // TextIterator currently returns the matches in the flat tree order, // so in this case the matches will be returned in the order of @@ -402,12 +408,13 @@ int identifier = 0; WebString search_text(String("ab ab")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); EXPECT_EQ(2, GetTextFinder().TotalMatchCount()); WebVector<WebFloatRect> match_rects = GetTextFinder().FindMatchRects(); @@ -424,12 +431,13 @@ int identifier = 0; WebString search_text(String("aba")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); // We shouldn't find overlapped matches. EXPECT_EQ(1, GetTextFinder().TotalMatchCount()); @@ -446,12 +454,13 @@ int identifier = 0; WebString search_text(String("ab")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); EXPECT_EQ(3, GetTextFinder().TotalMatchCount()); WebVector<WebFloatRect> match_rects = GetTextFinder().FindMatchRects(); @@ -467,20 +476,21 @@ int identifier = 0; WebString search_text(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; bool wrap_within_frame = true; bool active_now; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); - find_options.find_next = true; - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame, &active_now)); EXPECT_TRUE(active_now); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame, &active_now)); EXPECT_TRUE(active_now); @@ -490,7 +500,7 @@ i_element->SetInnerHTMLFromString("ZZFindMe"); GetDocument().UpdateStyleAndLayout(); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame, &active_now)); Range* active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -499,11 +509,11 @@ EXPECT_EQ(8u, active_match->endOffset()); // Restart full search and check that added text is found. - find_options.find_next = false; + find_options->find_next = false; GetTextFinder().ResetMatchCount(); GetTextFinder().CancelPendingScopingEffort(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); EXPECT_EQ(2, GetTextFinder().TotalMatchCount()); @@ -523,17 +533,18 @@ int identifier = 0; WebString search_text(String("FindMe")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; bool wrap_within_frame = true; bool active_now = false; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); - find_options.find_next = true; - ASSERT_FALSE(GetTextFinder().Find(identifier, search_text, find_options, + find_options->find_next = true; + ASSERT_FALSE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame, &active_now)); EXPECT_FALSE(active_now); @@ -543,7 +554,7 @@ i_element->SetInnerHTMLFromString("ZZFindMe"); GetDocument().UpdateStyleAndLayout(); - ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, find_options, + ASSERT_TRUE(GetTextFinder().Find(identifier, search_text, *find_options, wrap_within_frame, &active_now)); Range* active_match = GetTextFinder().ActiveMatch(); ASSERT_TRUE(active_match); @@ -552,11 +563,11 @@ EXPECT_EQ(8u, active_match->endOffset()); // Restart full search and check that added text is found. - find_options.find_next = false; + find_options->find_next = false; GetTextFinder().ResetMatchCount(); GetTextFinder().CancelPendingScopingEffort(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); EXPECT_EQ(1, GetTextFinder().TotalMatchCount()); @@ -605,15 +616,16 @@ GetDocument().UpdateStyleAndLayout(); int identifier = 0; - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); // There will be only one iteration before timeout, because increment // of the TimeProxyPlatform timer is greater than timeout threshold. GetTextFinder().StartScopingStringMatches(identifier, search_pattern, - find_options); + *find_options); EXPECT_EQ(4, GetTextFinder().TotalMatchCount()); }
diff --git a/third_party/blink/renderer/core/editing/position.cc b/third_party/blink/renderer/core/editing/position.cc index ff3df18..3412120 100644 --- a/third_party/blink/renderer/core/editing/position.cc +++ b/third_party/blink/renderer/core/editing/position.cc
@@ -97,25 +97,23 @@ : anchor_node_(const_cast<Node*>(anchor_node)), offset_(0), anchor_type_(anchor_type) { - if (!anchor_node_) { - anchor_type_ = PositionAnchorType::kOffsetInAnchor; - return; - } +#if DCHECK_IS_ON() + DCHECK(anchor_node_); + DCHECK_NE(anchor_type_, PositionAnchorType::kOffsetInAnchor); + DCHECK(CanBeAnchorNode<Strategy>(anchor_node_.Get())) << anchor_node_; if (anchor_node_->IsTextNode()) { DCHECK(anchor_type_ == PositionAnchorType::kBeforeAnchor || - anchor_type_ == PositionAnchorType::kAfterAnchor); + anchor_type_ == PositionAnchorType::kAfterAnchor) + << *this; return; } - if (anchor_node_->IsDocumentNode()) { - // Since |RangeBoundaryPoint| can't represent before/after Document, we - // should not use them. - DCHECK(IsBeforeChildren() || IsAfterChildren()) << anchor_type_; + if (!Strategy::Parent(*anchor_node_)) { + // Before/After |anchor_node_| should have a parent node for converting + // to offset in anchor position. + DCHECK(IsBeforeChildren() || IsAfterChildren()) << *this; return; } -#if DCHECK_IS_ON() - DCHECK(CanBeAnchorNode<Strategy>(anchor_node_.Get())) << anchor_node_; #endif - DCHECK_NE(anchor_type_, PositionAnchorType::kOffsetInAnchor); } // TODO(editing-dev): Once we change type of |anchor_node_| to @@ -190,8 +188,12 @@ case PositionAnchorType::kOffsetInAnchor: return anchor_node_.Get(); case PositionAnchorType::kBeforeAnchor: - case PositionAnchorType::kAfterAnchor: - return Strategy::Parent(*anchor_node_); + case PositionAnchorType::kAfterAnchor: { + Node* const parent = Strategy::Parent(*anchor_node_); + // TODO(https://crbug.com/889737), Once we fix the issue, we should have + // |DCHECK(parent)|. + return parent; + } } NOTREACHED(); return nullptr;
diff --git a/third_party/blink/renderer/core/editing/position_test.cc b/third_party/blink/renderer/core/editing/position_test.cc index f166b6011..c43cbfa 100644 --- a/third_party/blink/renderer/core/editing/position_test.cc +++ b/third_party/blink/renderer/core/editing/position_test.cc
@@ -201,12 +201,6 @@ EXPECT_EQ(PositionInFlatTree(host, PositionAnchorType::kBeforeChildren), ToPositionInFlatTree( Position(shadow_root, PositionAnchorType::kBeforeChildren))); - EXPECT_EQ(PositionInFlatTree(host, PositionAnchorType::kAfterAnchor), - ToPositionInFlatTree( - Position(shadow_root, PositionAnchorType::kAfterAnchor))); - EXPECT_EQ(PositionInFlatTree(host, PositionAnchorType::kBeforeAnchor), - ToPositionInFlatTree( - Position(shadow_root, PositionAnchorType::kBeforeAnchor))); } TEST_F(PositionTest,
diff --git a/third_party/blink/renderer/core/editing/selection_editor.cc b/third_party/blink/renderer/core/editing/selection_editor.cc index b440db6..83922c86 100644 --- a/third_party/blink/renderer/core/editing/selection_editor.cc +++ b/third_party/blink/renderer/core/editing/selection_editor.cc
@@ -163,6 +163,14 @@ static Position ComputePositionForChildrenRemoval(const Position& position, ContainerNode& container) { Node* node = position.ComputeContainerNode(); +#if DCHECK_IS_ON() + DCHECK(node) << position; +#else + // TODO(https://crbug.com/882592): Once we know the root cause, we should + // get rid of following if-statement. + if (!node) + return position; +#endif if (container.ContainsIncludingHostElements(*node)) return Position::FirstPositionInNode(container); return position;
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index fd5eccc9..b939907 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -62,7 +62,6 @@ #include "third_party/blink/public/web/web_device_emulation_params.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document_loader.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_form_element.h" #include "third_party/blink/public/web/web_frame_content_dumper.h" #include "third_party/blink/public/web/web_frame_widget.h" @@ -4865,14 +4864,14 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "find.html"); ASSERT_TRUE(web_view_helper.LocalMainFrame()); - WebLocalFrame* frame = web_view_helper.LocalMainFrame(); + WebLocalFrameImpl* frame = web_view_helper.LocalMainFrame(); const int kFindIdentifier = 12345; - WebFindOptions options; + auto options = mojom::blink::FindOptions::New(); // Find in a <div> element. - EXPECT_TRUE(frame->Find(kFindIdentifier, WebString::FromUTF8("bar1"), options, - false)); - frame->StopFindingForTesting( + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("bar1"), *options, false)); + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); WebRange range = frame->SelectionRange(); EXPECT_EQ(5, range.StartOffset()); @@ -4880,11 +4879,11 @@ EXPECT_TRUE(frame->GetDocument().FocusedElement().IsNull()); // Find in an <input> value. - EXPECT_TRUE(frame->Find(kFindIdentifier, WebString::FromUTF8("bar2"), options, - false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("bar2"), *options, false)); // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the // selection on the found text. - frame->StopFindingForTesting( + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); range = frame->SelectionRange(); ASSERT_FALSE(range.IsNull()); @@ -4893,11 +4892,11 @@ EXPECT_TRUE(frame->GetDocument().FocusedElement().HasHTMLTagName("input")); // Find in a <textarea> content. - EXPECT_TRUE(frame->Find(kFindIdentifier, WebString::FromUTF8("bar3"), options, - false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("bar3"), *options, false)); // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the // selection on the found text. - frame->StopFindingForTesting( + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); range = frame->SelectionRange(); ASSERT_FALSE(range.IsNull()); @@ -4906,11 +4905,11 @@ EXPECT_TRUE(frame->GetDocument().FocusedElement().HasHTMLTagName("textarea")); // Find in a contentEditable element. - EXPECT_TRUE(frame->Find(kFindIdentifier, WebString::FromUTF8("bar4"), options, - false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("bar4"), *options, false)); // Confirm stopFinding(WebLocalFrame::StopFindActionKeepSelection) sets the // selection on the found text. - frame->StopFindingForTesting( + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); range = frame->SelectionRange(); ASSERT_FALSE(range.IsNull()); @@ -4921,12 +4920,12 @@ EXPECT_TRUE(frame->GetDocument().FocusedElement().HasHTMLTagName("div")); // Find in <select> content. - EXPECT_FALSE(frame->Find(kFindIdentifier, WebString::FromUTF8("bar5"), - options, false)); + EXPECT_FALSE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("bar5"), *options, false)); // If there are any matches, stopFinding will set the selection on the found // text. However, we do not expect any matches, so check that the selection // is null. - frame->StopFindingForTesting( + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); range = frame->SelectionRange(); ASSERT_TRUE(range.IsNull()); @@ -5100,20 +5099,21 @@ const int kFindIdentifier = 12345; const int kNumResults = 17; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; find_in_page_client.SetFrame(main_frame); - EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); EXPECT_TRUE(find_in_page_client.FindResultsAreReady()); @@ -5171,31 +5171,33 @@ const int kFindIdentifier = 7777; const int kActiveIndex = 1; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; find_in_page_client.SetFrame(main_frame); - EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); - EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); - main_frame->StopFindingForTesting( + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); + main_frame->GetFindInPage()->StopFinding( mojom::StopFindAction::kStopFindActionClearSelection); for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); @@ -5205,14 +5207,14 @@ const char* kFindStringNew = "e"; WebString search_text_new = WebString::FromUTF8(kFindStringNew); - EXPECT_TRUE( - main_frame->Find(kFindIdentifier, search_text_new, options, false)); + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text_new, *options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches( - kFindIdentifier, search_text_new, options); + kFindIdentifier, search_text_new, *options); } RunPendingTasks(); @@ -5234,8 +5236,8 @@ const char kFindString[] = "result"; const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient main_find_in_page_client; @@ -5247,9 +5249,10 @@ // Detach the frame before finding. RemoveElementById(main_frame, "frame"); - EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); - EXPECT_FALSE( - second_frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); + EXPECT_FALSE(second_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); RunPendingTasks(); EXPECT_FALSE(main_find_in_page_client.FindResultsAreReady()); @@ -5259,7 +5262,7 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); @@ -5280,8 +5283,8 @@ const char kFindString[] = "result"; const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; @@ -5289,7 +5292,8 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { - EXPECT_TRUE(frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); } RunPendingTasks(); EXPECT_FALSE(find_in_page_client.FindResultsAreReady()); @@ -5302,7 +5306,7 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); @@ -5323,8 +5327,8 @@ const char kFindString[] = "result"; const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; @@ -5332,7 +5336,8 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { - EXPECT_TRUE(frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); } RunPendingTasks(); EXPECT_FALSE(find_in_page_client.FindResultsAreReady()); @@ -5342,7 +5347,7 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } // The first startScopingStringMatches will have reset the state. Detach @@ -5352,7 +5357,7 @@ for (WebLocalFrameImpl* frame = main_frame; frame; frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); } RunPendingTasks(); EXPECT_TRUE(find_in_page_client.FindResultsAreReady()); @@ -5371,8 +5376,8 @@ const char kFindString[] = "result"; const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; @@ -5381,9 +5386,10 @@ // Check that child frame exists. EXPECT_TRUE(!!main_frame->TraverseNext()); - for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) { - EXPECT_FALSE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, - options, false)); + for (WebLocalFrameImpl* frame = main_frame; frame; + frame = static_cast<WebLocalFrameImpl*>(frame->TraverseNext())) { + EXPECT_FALSE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); } RunPendingTasks(); @@ -5404,17 +5410,18 @@ const char kFindString[] = "foo"; const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8(kFindString); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); TestFindInPageClient find_in_page_client; find_in_page_client.SetFrame(main_frame); - EXPECT_TRUE(main_frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(main_frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false)); main_frame->EnsureTextFinder().ResetMatchCount(); main_frame->EnsureTextFinder().StartScopingStringMatches( - kFindIdentifier, search_text, options); + kFindIdentifier, search_text, *options); RunPendingTasks(); EXPECT_TRUE(find_in_page_client.FindResultsAreReady()); @@ -5464,20 +5471,20 @@ const int kFindIdentifier = 12345; static const char* kFindString = "foo"; WebString search_text = WebString::FromUTF8(kFindString); - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; bool active_now; frame->EnsureTextFinder().ResetMatchCount(); frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); RunPendingTasks(); EXPECT_TRUE(find_in_page_client.FindResultsAreReady()); // Find in a <div> element. - options.find_next = true; - EXPECT_TRUE( - frame->Find(kFindIdentifier, search_text, options, false, &active_now)); + options->find_next = true; + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false, &active_now)); EXPECT_TRUE(active_now); // Insert new text, which contains occurence of |searchText|. @@ -5487,14 +5494,14 @@ "document.body.insertBefore(newTextNode, textArea);")); // Find in a <input> element. - EXPECT_TRUE( - frame->Find(kFindIdentifier, search_text, options, false, &active_now)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false, &active_now)); EXPECT_TRUE(active_now); // Find in the inserted text node. - EXPECT_TRUE( - frame->Find(kFindIdentifier, search_text, options, false, &active_now)); - frame->StopFindingForTesting( + EXPECT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, search_text, *options, false, &active_now)); + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); WebRange range = frame->SelectionRange(); EXPECT_EQ(5, range.StartOffset()); @@ -5546,13 +5553,13 @@ find_in_page_client.SetFrame(frame); const int kFindIdentifier = 12345; - mojom::blink::FindOptionsPtr options(mojom::blink::FindOptions::New()); + auto options = mojom::blink::FindOptions::New(); options->run_synchronously_for_testing = true; options->find_next = false; options->forward = true; // The first search that will start the scoping process. frame->GetFindInPage()->Find(kFindIdentifier, search_pattern, - options.Clone()); + options->Clone()); EXPECT_FALSE(find_in_page_client.FindResultsAreReady()); RunPendingTasks(); @@ -5562,7 +5569,7 @@ options->find_next = true; // The second search will jump to the next match without any scoping. frame->GetFindInPage()->Find(kFindIdentifier, search_pattern, - options.Clone()); + options->Clone()); // Run pending tasks to make sure IncreaseMatchCount calls passes. RunPendingTasks(); EXPECT_EQ(2, find_in_page_client.Count()); @@ -5576,7 +5583,7 @@ // The third search will find a new match and initiate a new scoping. frame->GetFindInPage()->Find(kFindIdentifier, search_pattern, - options.Clone()); + options->Clone()); RunPendingTasks(); EXPECT_EQ(3, find_in_page_client.Count()); @@ -5589,19 +5596,19 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "find.html"); ASSERT_TRUE(web_view_helper.LocalMainFrame()); - WebLocalFrame* frame = web_view_helper.LocalMainFrame(); + WebLocalFrameImpl* frame = web_view_helper.LocalMainFrame(); const int kFindIdentifier = 12345; - WebFindOptions options; + auto options = mojom::blink::FindOptions::New(); // Set active match - ASSERT_TRUE( - frame->Find(kFindIdentifier, WebString::FromUTF8("foo"), options, false)); + ASSERT_TRUE(frame->GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("foo"), *options, false)); // Move to another page. FrameTestHelpers::LoadFrame(frame, base_url_ + "hello_world.html"); // Stop Find-In-Page. |TextFinder::active_match_| still hold a |Range| in // "find.html". - frame->StopFindingForTesting( + frame->GetFindInPage()->StopFinding( blink::mojom::StopFindAction::kStopFindActionKeepSelection); // Pass if not crash. See http://crbug.com/719880 for details. @@ -11330,15 +11337,16 @@ frame_view->GetScrollableArea()->SetScrollOffset(ScrollOffset(3000, 1000), kProgrammaticScroll); - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8("test"); const int kFindIdentifier = 12345; - EXPECT_TRUE(frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal(kFindIdentifier, search_text, + *options, false)); frame->EnsureTextFinder().ResetMatchCount(); frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); // Get the tickmarks for the original find request. Vector<IntRect> original_tickmarks; @@ -11392,15 +11400,16 @@ frame_view->GetScrollableArea()->SetScrollOffset(ScrollOffset(3000, 1000), kProgrammaticScroll); - WebFindOptions options; - options.run_synchronously_for_testing = true; + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; WebString search_text = WebString::FromUTF8("test"); const int kFindIdentifier = 12345; - EXPECT_TRUE(frame->Find(kFindIdentifier, search_text, options, false)); + EXPECT_TRUE(frame->GetFindInPage()->FindInternal(kFindIdentifier, search_text, + *options, false)); frame->EnsureTextFinder().ResetMatchCount(); frame->EnsureTextFinder().StartScopingStringMatches(kFindIdentifier, - search_text, options); + search_text, *options); WebVector<WebFloatRect> web_match_rects = frame->EnsureTextFinder().FindMatchRects();
diff --git a/third_party/blink/renderer/core/exported/web_page_popup_impl.cc b/third_party/blink/renderer/core/exported/web_page_popup_impl.cc index 2bd3f31..9f6539c 100644 --- a/third_party/blink/renderer/core/exported/web_page_popup_impl.cc +++ b/third_party/blink/renderer/core/exported/web_page_popup_impl.cc
@@ -295,10 +295,10 @@ main_settings.GetPrimaryPointerType()); ProvideContextFeaturesTo(*page_, std::make_unique<PagePopupFeaturesClient>()); - DEFINE_STATIC_LOCAL(LocalFrameClient, empty_local_frame_client, + DEFINE_STATIC_LOCAL(Persistent<LocalFrameClient>, empty_local_frame_client, (EmptyLocalFrameClient::Create())); LocalFrame* frame = - LocalFrame::Create(&empty_local_frame_client, *page_, nullptr); + LocalFrame::Create(empty_local_frame_client, *page_, nullptr); frame->SetPagePopupOwner(popup_client_->OwnerElement()); frame->SetView(LocalFrameView::Create(*frame)); frame->Init();
diff --git a/third_party/blink/renderer/core/fetch/body_stream_buffer.cc b/third_party/blink/renderer/core/fetch/body_stream_buffer.cc index b219885..aabb7b8 100644 --- a/third_party/blink/renderer/core/fetch/body_stream_buffer.cc +++ b/third_party/blink/renderer/core/fetch/body_stream_buffer.cc
@@ -377,19 +377,20 @@ } void BodyStreamBuffer::CloseAndLockAndDisturb(ExceptionState& exception_state) { + CHECK(!ExecutionContext::From(script_state_)->IsContextDestroyed()); + if (stream_broken_) { + exception_state.ThrowDOMException( + DOMExceptionCode::kInvalidStateError, + "Body stream has suffered a fatal error and cannot be disturbed"); + return; + } // Speculative fix for https://crbug.com/882599. Stop the stream from being // garbage collected while this function is executing. // TODO(ricea): Remove this when a better solution is found or if it doesn't // work. v8::Local<v8::Value> stream_handle = stream_.NewLocal(script_state_->GetIsolate()); - if (stream_handle.IsEmpty()) { - stream_broken_ = true; - exception_state.ThrowDOMException( - DOMExceptionCode::kInvalidStateError, - "Body stream has suffered a fatal error and cannot be disturbed"); - return; - } + CHECK(!stream_handle.IsEmpty()); base::Optional<bool> is_readable = IsStreamReadable(exception_state); if (exception_state.HadException())
diff --git a/third_party/blink/renderer/core/fetch/global_fetch.cc b/third_party/blink/renderer/core/fetch/global_fetch.cc index a62d026..2d21c80e 100644 --- a/third_party/blink/renderer/core/fetch/global_fetch.cc +++ b/third_party/blink/renderer/core/fetch/global_fetch.cc
@@ -59,9 +59,12 @@ return ScriptPromise(); probe::willSendXMLHttpOrFetchNetworkRequest(execution_context, r->url()); - auto promise = fetch_manager_->Fetch( - script_state, r->PassRequestData(script_state, exception_state), - r->signal(), exception_state); + FetchRequestData* request_data = + r->PassRequestData(script_state, exception_state); + if (exception_state.HadException()) + return ScriptPromise(); + auto promise = fetch_manager_->Fetch(script_state, request_data, + r->signal(), exception_state); if (exception_state.HadException()) return ScriptPromise();
diff --git a/third_party/blink/renderer/core/frame/find_in_page.cc b/third_party/blink/renderer/core/frame/find_in_page.cc index 1c13d55..59db2913 100644 --- a/third_party/blink/renderer/core/frame/find_in_page.cc +++ b/third_party/blink/renderer/core/frame/find_in_page.cc
@@ -31,7 +31,6 @@ #include "third_party/blink/renderer/core/frame/find_in_page.h" #include "third_party/blink/public/web/web_document.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/public/web/web_plugin.h" #include "third_party/blink/public/web/web_plugin_document.h" @@ -89,18 +88,10 @@ bool result = false; bool active_now = false; - WebFindOptions web_options; - web_options.forward = options->forward; - web_options.match_case = options->match_case; - web_options.find_next = options->find_next; - web_options.force = options->force; - web_options.run_synchronously_for_testing = - options->run_synchronously_for_testing; - // Search for an active match only if this frame is focused or if this is a - // find next request. + // find next if (frame_->IsFocused() || options->find_next) { - result = FindInternal(request_id, search_text, web_options, + result = FindInternal(request_id, search_text, *options, false /* wrap_within_frame */, &active_now); } @@ -136,24 +127,35 @@ return; } - // Start a new scoping request. If the scoping function determines that it + // Start a new scoping If the scoping function determines that it // needs to scope, it will defer until later. EnsureTextFinder().StartScopingStringMatches(request_id, search_text, - web_options); + *options); } -bool WebLocalFrameImpl::Find(int identifier, - const WebString& search_text, - const WebFindOptions& options, - bool wrap_within_frame, - bool* active_now) { - return find_in_page_->FindInternal(identifier, search_text, options, - wrap_within_frame, active_now); +bool WebLocalFrameImpl::FindForTesting(int identifier, + const WebString& search_text, + bool match_case, + bool forward, + bool find_next, + bool force, + bool wrap_within_frame) { + auto options = mojom::blink::FindOptions::New(); + options->match_case = match_case; + options->forward = forward; + options->find_next = find_next; + options->force = force; + options->run_synchronously_for_testing = true; + bool result = find_in_page_->FindInternal(identifier, search_text, *options, + wrap_within_frame, nullptr); + find_in_page_->StopFinding( + mojom::blink::StopFindAction::kStopFindActionKeepSelection); + return result; } bool FindInPage::FindInternal(int identifier, const WebString& search_text, - const WebFindOptions& options, + const mojom::blink::FindOptions& options, bool wrap_within_frame, bool* active_now) { if (!frame_->GetFrame()) @@ -172,10 +174,6 @@ wrap_within_frame, active_now); } -void WebLocalFrameImpl::StopFindingForTesting(mojom::StopFindAction action) { - find_in_page_->StopFinding(action); -} - void FindInPage::StopFinding(mojom::StopFindAction action) { WebPlugin* const plugin = GetWebPluginForFind(); if (plugin) {
diff --git a/third_party/blink/renderer/core/frame/find_in_page.h b/third_party/blink/renderer/core/frame/find_in_page.h index 7b311253..6bdc6922 100644 --- a/third_party/blink/renderer/core/frame/find_in_page.h +++ b/third_party/blink/renderer/core/frame/find_in_page.h
@@ -21,7 +21,6 @@ class WebLocalFrameImpl; class WebString; -struct WebFindOptions; struct WebFloatRect; class CORE_EXPORT FindInPage final @@ -36,7 +35,7 @@ bool FindInternal(int identifier, const WebString& search_text, - const WebFindOptions&, + const mojom::blink::FindOptions&, bool wrap_within_frame, bool* active_now = nullptr);
diff --git a/third_party/blink/renderer/core/frame/find_in_page_test.cc b/third_party/blink/renderer/core/frame/find_in_page_test.cc index cb9f3bd..1c945bb1 100644 --- a/third_party/blink/renderer/core/frame/find_in_page_test.cc +++ b/third_party/blink/renderer/core/frame/find_in_page_test.cc
@@ -6,7 +6,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" -#include "third_party/blink/public/web/web_find_options.h" #include "third_party/blink/renderer/core/editing/finder/text_finder.h" #include "third_party/blink/renderer/core/frame/frame_test_helpers.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -81,12 +80,13 @@ int identifier = 0; WebString search_text(String("aA")); - WebFindOptions find_options; // Default + add testing flag. - find_options.run_synchronously_for_testing = true; + auto find_options = + mojom::blink::FindOptions::New(); // Default + add testing flag. + find_options->run_synchronously_for_testing = true; GetTextFinder().ResetMatchCount(); GetTextFinder().StartScopingStringMatches(identifier, search_text, - find_options); + *find_options); int rects_version = GetTextFinder().FindMatchMarkersVersion(); FindInPageCallbackReceiver callback_receiver;
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc index 6d0f0ea5..c3c6c4f 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -133,8 +133,9 @@ } static ChromeClient& GetEmptyChromeClient() { - DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::Create())); - return client; + DEFINE_STATIC_LOCAL(Persistent<EmptyChromeClient>, client, + (EmptyChromeClient::Create())); + return *client; } ChromeClient& Frame::GetChromeClient() const {
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index bc97baf2..32fba67 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -190,15 +190,16 @@ using DOMWindowSet = HeapHashCountedSet<WeakMember<LocalDOMWindow>>; static DOMWindowSet& WindowsWithUnloadEventListeners() { - DEFINE_STATIC_LOCAL(DOMWindowSet, windows_with_unload_event_listeners, - (new DOMWindowSet)); - return windows_with_unload_event_listeners; + DEFINE_STATIC_LOCAL(Persistent<DOMWindowSet>, + windows_with_unload_event_listeners, (new DOMWindowSet)); + return *windows_with_unload_event_listeners; } static DOMWindowSet& WindowsWithBeforeUnloadEventListeners() { - DEFINE_STATIC_LOCAL(DOMWindowSet, windows_with_before_unload_event_listeners, + DEFINE_STATIC_LOCAL(Persistent<DOMWindowSet>, + windows_with_before_unload_event_listeners, (new DOMWindowSet)); - return windows_with_before_unload_event_listeners; + return *windows_with_before_unload_event_listeners; } static void TrackUnloadEventListener(LocalDOMWindow* dom_window) {
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h index 67321e1..b2b1f552 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -35,6 +35,8 @@ #include <set> #include "base/single_thread_task_runner.h" + +#include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/platform/web_file_system_type.h" #include "third_party/blink/public/web/devtools_agent.mojom-blink.h" #include "third_party/blink/public/web/web_history_commit_type.h" @@ -320,12 +322,13 @@ void DidCallAddSearchProvider() override; void DidCallIsSearchProviderInstalled() override; void ReplaceSelection(const WebString&) override; - bool Find(int identifier, - const WebString& search_text, - const WebFindOptions&, - bool wrap_within_frame, - bool* active_now = nullptr) override; - void StopFindingForTesting(mojom::StopFindAction) override; + bool FindForTesting(int identifier, + const WebString& search_text, + bool match_case, + bool forward, + bool force, + bool find_next, + bool wrap_within_frame) override; void SetTickmarks(const WebVector<WebRect>&) override; WebNode ContextMenuNode() const override; WebFrameWidget* FrameWidget() const override;
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc index a6f9e01..31ee757 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
@@ -124,8 +124,9 @@ HeapHashMap<WeakMember<Element>, Fullscreen::RequestType>; ElementRequestTypeMap& FullscreenFlagMap() { - DEFINE_STATIC_LOCAL(ElementRequestTypeMap, map, (new ElementRequestTypeMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<ElementRequestTypeMap>, map, + (new ElementRequestTypeMap)); + return *map; } bool HasFullscreenFlag(Element& element) {
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_upgrade_sorter_test.cc b/third_party/blink/renderer/core/html/custom/custom_element_upgrade_sorter_test.cc index 9bd894a..431aa916 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_upgrade_sorter_test.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_upgrade_sorter_test.cc
@@ -196,6 +196,4 @@ EXPECT_EQ(d, elements[2].Get()); } -// TODO(kochi): Add test cases which uses HTML imports. - } // namespace blink
diff --git a/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.cc b/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.cc index 2c25735d..cd2b1f7 100644 --- a/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.cc +++ b/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.cc
@@ -20,9 +20,9 @@ V0CustomElementMicrotaskDispatcher& V0CustomElementMicrotaskDispatcher::Instance() { - DEFINE_STATIC_LOCAL(V0CustomElementMicrotaskDispatcher, instance, + DEFINE_STATIC_LOCAL(Persistent<V0CustomElementMicrotaskDispatcher>, instance, (new V0CustomElementMicrotaskDispatcher)); - return instance; + return *instance; } void V0CustomElementMicrotaskDispatcher::Enqueue(
diff --git a/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.cc b/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.cc index 4ddf5f61..637440bd 100644 --- a/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.cc +++ b/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.cc
@@ -41,8 +41,9 @@ ElementObserverMap; static ElementObserverMap& ElementObservers() { - DEFINE_STATIC_LOCAL(ElementObserverMap, map, (new ElementObserverMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<ElementObserverMap>, map, + (new ElementObserverMap)); + return *map; } void V0CustomElementObserver::NotifyElementWasDestroyed(Element* element) {
diff --git a/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.cc b/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.cc index 447f21bb..ea9b988 100644 --- a/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.cc +++ b/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.cc
@@ -42,9 +42,9 @@ wtf_size_t V0CustomElementProcessingStack::element_queue_end_ = kNumSentinels; V0CustomElementProcessingStack& V0CustomElementProcessingStack::Instance() { - DEFINE_STATIC_LOCAL(V0CustomElementProcessingStack, instance, + DEFINE_STATIC_LOCAL(Persistent<V0CustomElementProcessingStack>, instance, (new V0CustomElementProcessingStack)); - return instance; + return *instance; } // Dispatches callbacks when popping the processing stack.
diff --git a/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.cc b/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.cc index 74eb92e0..42c3237 100644 --- a/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.cc +++ b/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.cc
@@ -51,9 +51,9 @@ ElementCallbackQueueMap; static ElementCallbackQueueMap& CallbackQueues() { - DEFINE_STATIC_LOCAL(ElementCallbackQueueMap, map, + DEFINE_STATIC_LOCAL(Persistent<ElementCallbackQueueMap>, map, (new ElementCallbackQueueMap)); - return map; + return *map; } static V0CustomElementCallbackQueue& EnsureCallbackQueue(Element* element) {
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 2cf841f..320afef 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -54,8 +54,8 @@ using PluginSet = HeapHashSet<Member<WebPluginContainerImpl>>; PluginSet& PluginsPendingDispose() { - DEFINE_STATIC_LOCAL(PluginSet, set, (new PluginSet)); - return set; + DEFINE_STATIC_LOCAL(Persistent<PluginSet>, set, (new PluginSet)); + return *set; } bool DoesParentAllowLazyLoadingChildren(Document& document) {
diff --git a/third_party/blink/renderer/core/html/html_table_element.cc b/third_party/blink/renderer/core/html/html_table_element.cc index 85c52c0..54fa5ee 100644 --- a/third_party/blink/renderer/core/html/html_table_element.cc +++ b/third_party/blink/renderer/core/html/html_table_element.cc
@@ -466,21 +466,21 @@ // Setting the border to 'hidden' allows it to win over any border // set on the table's cells during border-conflict resolution. if (rules_attr_ != kUnsetRules) { - DEFINE_STATIC_LOCAL(CSSPropertyValueSet, solid_border_style, + DEFINE_STATIC_LOCAL(Persistent<CSSPropertyValueSet>, solid_border_style, (CreateBorderStyle(CSSValueHidden))); - return &solid_border_style; + return solid_border_style; } return nullptr; } if (border_color_attr_) { - DEFINE_STATIC_LOCAL(CSSPropertyValueSet, solid_border_style, + DEFINE_STATIC_LOCAL(Persistent<CSSPropertyValueSet>, solid_border_style, (CreateBorderStyle(CSSValueSolid))); - return &solid_border_style; + return solid_border_style; } - DEFINE_STATIC_LOCAL(CSSPropertyValueSet, outset_border_style, + DEFINE_STATIC_LOCAL(Persistent<CSSPropertyValueSet>, outset_border_style, (CreateBorderStyle(CSSValueOutset))); - return &outset_border_style; + return outset_border_style; } HTMLTableElement::CellBorders HTMLTableElement::GetCellBorders() const { @@ -582,13 +582,13 @@ return nullptr; if (rows) { - DEFINE_STATIC_LOCAL(CSSPropertyValueSet, row_border_style, + DEFINE_STATIC_LOCAL(Persistent<CSSPropertyValueSet>, row_border_style, (CreateGroupBorderStyle(true))); - return &row_border_style; + return row_border_style; } - DEFINE_STATIC_LOCAL(CSSPropertyValueSet, column_border_style, + DEFINE_STATIC_LOCAL(Persistent<CSSPropertyValueSet>, column_border_style, (CreateGroupBorderStyle(false))); - return &column_border_style; + return column_border_style; } bool HTMLTableElement::IsURLAttribute(const Attribute& attribute) const {
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index b931294..f85fb0f8 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -208,8 +208,9 @@ } DocumentElementSetMap& DocumentToElementSetMap() { - DEFINE_STATIC_LOCAL(DocumentElementSetMap, map, (new DocumentElementSetMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<DocumentElementSetMap>, map, + (new DocumentElementSetMap)); + return *map; } void AddElementToDocumentMap(HTMLMediaElement* element, Document* document) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc index 5cab6b9b..59b9423 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -759,7 +759,7 @@ ScriptForbiddenScope::AllowUserAgentScript allow_script; - DEFINE_STATIC_LOCAL(LocalFrameClient, dummy_local_frame_client, + DEFINE_STATIC_LOCAL(Persistent<LocalFrameClient>, dummy_local_frame_client, (EmptyLocalFrameClient::Create())); Page::PageClients page_clients; FillWithEmptyClients(page_clients); @@ -797,7 +797,7 @@ overlay_settings.SetAcceleratedCompositingEnabled(false); LocalFrame* frame = - LocalFrame::Create(&dummy_local_frame_client, *overlay_page_, nullptr); + LocalFrame::Create(dummy_local_frame_client, *overlay_page_, nullptr); frame->SetView(LocalFrameView::Create(*frame)); frame->Init(); frame->View()->SetCanHaveScrollbars(false);
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor.cc b/third_party/blink/renderer/core/layout/scroll_anchor.cc index 3edcb634..a1ed238 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor.cc
@@ -99,9 +99,7 @@ local_bounds.ShiftMaxYEdgeTo(max_y); } } else if (layout_object->IsText()) { - // TODO(skobes): Use first and last InlineTextBox only? - for (InlineTextBox* box : ToLayoutText(layout_object)->TextBoxes()) - local_bounds.Unite(box->FrameRect()); + local_bounds.Unite(ToLayoutText(layout_object)->LinesBoundingBox()); } else { // Only LayoutBox and LayoutText are supported. NOTREACHED();
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc index 02cbfa04..95aacab 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc
@@ -854,10 +854,6 @@ // element(meaning its corresponding LayoutObject can't be the anchor object) // that restoration will still succeed. TEST_P(ScrollAnchorTest, RestoreAnchorSucceedsForNonBoxNonTextElement) { - // TODO(crbug.com/889449): The test fails in LayoutNG mode. - if (RuntimeEnabledFeatures::LayoutNGEnabled()) - return; - SetBodyInnerHTML( "<style> body { height: 1000px; margin: 0; } div { height: 100px } " "</style>" @@ -919,4 +915,21 @@ EXPECT_TRUE(GetScrollAnchor(LayoutViewport()).AnchorObject()); EXPECT_EQ(LayoutViewport()->ScrollOffsetInt().Height(), 0); } + +TEST_P(ScrollAnchorTest, DeleteAnonymousBlockCrash) { + SetBodyInnerHTML(R"HTML( + <div> + <div id="deleteMe" style="height:20000px;"></div> + torsk + </div> + )HTML"); + + // Removing #deleteMe will also remove the anonymous block around the text + // node. This would cause NG to point to dead layout objects, prior to + // https://chromium-review.googlesource.com/1193868 and therefore crash. + + ScrollLayoutViewport(ScrollOffset(0, 20000)); + GetDocument().getElementById("deleteMe")->remove(); + Update(); +} }
diff --git a/third_party/blink/renderer/core/layout/text_autosizer_test.cc b/third_party/blink/renderer/core/layout/text_autosizer_test.cc index fde0c2e..e0c52fa 100644 --- a/third_party/blink/renderer/core/layout/text_autosizer_test.cc +++ b/third_party/blink/renderer/core/layout/text_autosizer_test.cc
@@ -38,9 +38,9 @@ return GetTextAutosizerClient(); } TextAutosizerClient& GetTextAutosizerClient() const { - DEFINE_STATIC_LOCAL(TextAutosizerClient, client, + DEFINE_STATIC_LOCAL(Persistent<TextAutosizerClient>, client, (TextAutosizerClient::Create())); - return client; + return *client; } void set_device_scale_factor(float device_scale_factor) { GetTextAutosizerClient().set_device_scale_factor(device_scale_factor);
diff --git a/third_party/blink/renderer/core/loader/empty_clients.cc b/third_party/blink/renderer/core/loader/empty_clients.cc index 65883223..7e5edfa 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.cc +++ b/third_party/blink/renderer/core/loader/empty_clients.cc
@@ -46,9 +46,9 @@ namespace blink { void FillWithEmptyClients(Page::PageClients& page_clients) { - DEFINE_STATIC_LOCAL(ChromeClient, dummy_chrome_client, + DEFINE_STATIC_LOCAL(Persistent<ChromeClient>, dummy_chrome_client, (EmptyChromeClient::Create())); - page_clients.chrome_client = &dummy_chrome_client; + page_clients.chrome_client = dummy_chrome_client; } class EmptyPopupMenu : public PopupMenu {
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc index 350dd36..eaf3cfa 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc
@@ -103,9 +103,9 @@ device_pixel_ratio_header_value_(1.0), has_device_pixel_ratio_header_value_(false), image_(std::move(image)) { - DEFINE_STATIC_LOCAL(NullImageResourceInfo, null_info, + DEFINE_STATIC_LOCAL(Persistent<NullImageResourceInfo>, null_info, (new NullImageResourceInfo())); - info_ = &null_info; + info_ = null_info; } ImageResourceContent* ImageResourceContent::CreateLoaded(
diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc index a29412cd..4277312 100644 --- a/third_party/blink/renderer/core/page/page.cc +++ b/third_party/blink/renderer/core/page/page.cc
@@ -89,13 +89,13 @@ // Set of all live pages; includes internal Page objects that are // not observable from scripts. static Page::PageSet& AllPages() { - DEFINE_STATIC_LOCAL(Page::PageSet, pages, (new Page::PageSet)); - return pages; + DEFINE_STATIC_LOCAL(Persistent<Page::PageSet>, pages, (new Page::PageSet)); + return *pages; } Page::PageSet& Page::OrdinaryPages() { - DEFINE_STATIC_LOCAL(Page::PageSet, pages, (new Page::PageSet)); - return pages; + DEFINE_STATIC_LOCAL(Persistent<Page::PageSet>, pages, (new Page::PageSet)); + return *pages; } void Page::InsertOrdinaryPageForTesting(Page* page) {
diff --git a/third_party/blink/renderer/core/page/scrolling/scroll_into_view_test.cc b/third_party/blink/renderer/core/page/scrolling/scroll_into_view_test.cc index 4da47eb4..51e08d0 100644 --- a/third_party/blink/renderer/core/page/scrolling/scroll_into_view_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/scroll_into_view_test.cc
@@ -3,10 +3,11 @@ // found in the LICENSE file. #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/web/web_find_options.h" +#include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink.h" #include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/renderer/bindings/core/v8/scroll_into_view_options_or_boolean.h" #include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/frame/find_in_page.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/scroll_into_view_options.h" #include "third_party/blink/renderer/core/frame/scroll_to_options.h" @@ -488,10 +489,10 @@ Compositor().BeginFrame(); ASSERT_EQ(container->scrollTop(), 0); const int kFindIdentifier = 12345; - WebFindOptions options; - options.run_synchronously_for_testing = true; - MainFrame().Find(kFindIdentifier, WebString::FromUTF8("hello"), options, - false); + auto options = mojom::blink::FindOptions::New(); + options->run_synchronously_for_testing = true; + MainFrame().GetFindInPage()->FindInternal( + kFindIdentifier, WebString::FromUTF8("hello"), *options, false); ASSERT_EQ(container->scrollTop(), 0); }
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index dfd3ba9..c7b8bd6 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -2542,10 +2542,10 @@ HeapVector<Member<PaintLayerScrollableArea>>& PaintLayerScrollableArea::PreventRelayoutScope::NeedsRelayoutList() { - DEFINE_STATIC_LOCAL(HeapVector<Member<PaintLayerScrollableArea>>, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<PaintLayerScrollableArea>>>, needs_relayout_list, (new HeapVector<Member<PaintLayerScrollableArea>>)); - return needs_relayout_list; + return *needs_relayout_list; } int PaintLayerScrollableArea::FreezeScrollbarsScope::count_ = 0; @@ -2581,10 +2581,10 @@ HeapVector<Member<PaintLayerScrollableArea>>& PaintLayerScrollableArea::DelayScrollOffsetClampScope::NeedsClampList() { - DEFINE_STATIC_LOCAL(HeapVector<Member<PaintLayerScrollableArea>>, + DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<PaintLayerScrollableArea>>>, needs_clamp_list, (new HeapVector<Member<PaintLayerScrollableArea>>)); - return needs_clamp_list; + return *needs_clamp_list; } ScrollbarTheme& PaintLayerScrollableArea::GetPageScrollbarTheme() const {
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm index 5ceea1d6..5cf9015 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm
@@ -100,16 +100,17 @@ typedef HeapHashSet<WeakMember<Scrollbar>> ScrollbarSet; static ScrollbarSet& GetScrollbarSet() { - DEFINE_STATIC_LOCAL(ScrollbarSet, set, (new ScrollbarSet)); - return set; + DEFINE_STATIC_LOCAL(Persistent<ScrollbarSet>, set, (new ScrollbarSet)); + return *set; } typedef HeapHashMap<WeakMember<Scrollbar>, RetainPtr<BlinkScrollbarObserver>> ScrollbarPainterMap; static ScrollbarPainterMap& GetScrollbarPainterMap() { - DEFINE_STATIC_LOCAL(ScrollbarPainterMap, map, (new ScrollbarPainterMap)); - return map; + DEFINE_STATIC_LOCAL(Persistent<ScrollbarPainterMap>, map, + (new ScrollbarPainterMap)); + return *map; } static bool SupportsExpandedScrollbars() {
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc index b6be47d70..5549886 100644 --- a/third_party/blink/renderer/core/svg/svg_element.cc +++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -640,9 +640,10 @@ } static HeapHashSet<WeakMember<SVGElement>>& EmptyInstances() { - DEFINE_STATIC_LOCAL(HeapHashSet<WeakMember<SVGElement>>, empty_instances, + DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<WeakMember<SVGElement>>>, + empty_instances, (new HeapHashSet<WeakMember<SVGElement>>)); - return empty_instances; + return *empty_instances; } const HeapHashSet<WeakMember<SVGElement>>& SVGElement::InstancesForElement() @@ -1247,9 +1248,9 @@ SVGElementSet& SVGElement::GetDependencyTraversalVisitedSet() { // This strong reference is safe, as it is guaranteed that this set will be // emptied at the end of recursion in NotifyIncomingReferences. - DEFINE_STATIC_LOCAL(SVGElementSet, invalidating_dependencies, + DEFINE_STATIC_LOCAL(Persistent<SVGElementSet>, invalidating_dependencies, (new SVGElementSet)); - return invalidating_dependencies; + return *invalidating_dependencies; } void SVGElement::RebuildAllIncomingReferences() {
diff --git a/third_party/blink/renderer/core/testing/core_unit_test_helper.cc b/third_party/blink/renderer/core/testing/core_unit_test_helper.cc index 366e634..19983aa6 100644 --- a/third_party/blink/renderer/core/testing/core_unit_test_helper.cc +++ b/third_party/blink/renderer/core/testing/core_unit_test_helper.cc
@@ -34,8 +34,9 @@ } ChromeClient& RenderingTest::GetChromeClient() const { - DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::Create())); - return client; + DEFINE_STATIC_LOCAL(Persistent<EmptyChromeClient>, client, + (EmptyChromeClient::Create())); + return *client; } RenderingTest::RenderingTest(LocalFrameClient* local_frame_client)
diff --git a/third_party/blink/renderer/core/xml/xpath_evaluator.cc b/third_party/blink/renderer/core/xml/xpath_evaluator.cc index 7aff1032..f0dfb4b 100644 --- a/third_party/blink/renderer/core/xml/xpath_evaluator.cc +++ b/third_party/blink/renderer/core/xml/xpath_evaluator.cc
@@ -36,7 +36,7 @@ namespace blink { -using namespace XPath; +using namespace xpath; XPathExpression* XPathEvaluator::createExpression( const String& expression,
diff --git a/third_party/blink/renderer/core/xml/xpath_expression.cc b/third_party/blink/renderer/core/xml/xpath_expression.cc index 74764999..a32a06c 100644 --- a/third_party/blink/renderer/core/xml/xpath_expression.cc +++ b/third_party/blink/renderer/core/xml/xpath_expression.cc
@@ -36,7 +36,7 @@ namespace blink { -using namespace XPath; +using namespace xpath; XPathExpression::XPathExpression() = default;
diff --git a/third_party/blink/renderer/core/xml/xpath_expression.h b/third_party/blink/renderer/core/xml/xpath_expression.h index 6dcaade..cf2f0d1 100644 --- a/third_party/blink/renderer/core/xml/xpath_expression.h +++ b/third_party/blink/renderer/core/xml/xpath_expression.h
@@ -38,7 +38,7 @@ class XPathNSResolver; class XPathResult; -namespace XPath { +namespace xpath { class Expression; } @@ -61,7 +61,7 @@ private: XPathExpression(); - Member<XPath::Expression> top_expression_; + Member<xpath::Expression> top_expression_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_expression_node.cc b/third_party/blink/renderer/core/xml/xpath_expression_node.cc index bfe054f2..5b11857e 100644 --- a/third_party/blink/renderer/core/xml/xpath_expression_node.cc +++ b/third_party/blink/renderer/core/xml/xpath_expression_node.cc
@@ -29,7 +29,7 @@ #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink { -namespace XPath { +namespace xpath { EvaluationContext::EvaluationContext(Node& context_node) : node(context_node), @@ -49,5 +49,5 @@ ParseNode::Trace(visitor); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_expression_node.h b/third_party/blink/renderer/core/xml/xpath_expression_node.h index 9b1b3dc..1c2162d 100644 --- a/third_party/blink/renderer/core/xml/xpath_expression_node.h +++ b/third_party/blink/renderer/core/xml/xpath_expression_node.h
@@ -37,7 +37,7 @@ namespace blink { -namespace XPath { +namespace xpath { struct CORE_EXPORT EvaluationContext { STACK_ALLOCATED(); @@ -108,7 +108,7 @@ DISALLOW_COPY_AND_ASSIGN(Expression); }; -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_functions.cc b/third_party/blink/renderer/core/xml/xpath_functions.cc index 9d5a1acc..601fb67 100644 --- a/third_party/blink/renderer/core/xml/xpath_functions.cc +++ b/third_party/blink/renderer/core/xml/xpath_functions.cc
@@ -41,7 +41,7 @@ #include <limits> namespace blink { -namespace XPath { +namespace xpath { static inline bool IsWhitespace(UChar c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; @@ -770,5 +770,5 @@ return function; } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_functions.h b/third_party/blink/renderer/core/xml/xpath_functions.h index 5ece3131..a84afe0 100644 --- a/third_party/blink/renderer/core/xml/xpath_functions.h +++ b/third_party/blink/renderer/core/xml/xpath_functions.h
@@ -32,7 +32,7 @@ namespace blink { -namespace XPath { +namespace xpath { class CORE_EXPORT Function : public Expression { public: @@ -53,7 +53,7 @@ CORE_EXPORT Function* CreateFunction(const String& name, HeapVector<Member<Expression>>&); -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_functions_test.cc b/third_party/blink/renderer/core/xml/xpath_functions_test.cc index 3030d9c..e89e4db 100644 --- a/third_party/blink/renderer/core/xml/xpath_functions_test.cc +++ b/third_party/blink/renderer/core/xml/xpath_functions_test.cc
@@ -25,35 +25,35 @@ public: XPathContext() : document_(Document::CreateForTest()), context_(*document_) {} - XPath::EvaluationContext& Context() { return context_; } + xpath::EvaluationContext& Context() { return context_; } Document& GetDocument() { return *document_; } private: const Member<Document> document_; - XPath::EvaluationContext context_; + xpath::EvaluationContext context_; }; -using XPathArguments = HeapVector<Member<XPath::Expression>>; +using XPathArguments = HeapVector<Member<xpath::Expression>>; static String Substring(XPathArguments& args) { XPathContext xpath; - XPath::Expression* call = XPath::CreateFunction("substring", args); - XPath::Value result = call->Evaluate(xpath.Context()); + xpath::Expression* call = xpath::CreateFunction("substring", args); + xpath::Value result = call->Evaluate(xpath.Context()); return result.ToString(); } static String Substring(const char* string, double pos) { XPathArguments args; - args.push_back(new XPath::StringExpression(string)); - args.push_back(new XPath::Number(pos)); + args.push_back(new xpath::StringExpression(string)); + args.push_back(new xpath::Number(pos)); return Substring(args); } static String Substring(const char* string, double pos, double len) { XPathArguments args; - args.push_back(new XPath::StringExpression(string)); - args.push_back(new XPath::Number(pos)); - args.push_back(new XPath::Number(len)); + args.push_back(new xpath::StringExpression(string)); + args.push_back(new xpath::Number(pos)); + args.push_back(new xpath::Number(len)); return Substring(args); }
diff --git a/third_party/blink/renderer/core/xml/xpath_grammar.y b/third_party/blink/renderer/core/xml/xpath_grammar.y index ed6999d6..02f81a9 100644 --- a/third_party/blink/renderer/core/xml/xpath_grammar.y +++ b/third_party/blink/renderer/core/xml/xpath_grammar.y
@@ -49,29 +49,29 @@ #define YYDEBUG 0 #define YYMAXDEPTH 10000 -using blink::XPath::Step; +using blink::xpath::Step; %} %pure-parser -%parse-param { blink::XPath::Parser* parser } +%parse-param { blink::xpath::Parser* parser } %union { - blink::XPath::Step::Axis axis; - blink::XPath::Step::NodeTest* node_test; - blink::XPath::NumericOp::Opcode num_op; - blink::XPath::EqTestOp::Opcode eq_op; + blink::xpath::Step::Axis axis; + blink::xpath::Step::NodeTest* node_test; + blink::xpath::NumericOp::Opcode num_op; + blink::xpath::EqTestOp::Opcode eq_op; String* str; - blink::XPath::Expression* expr; - blink::HeapVector<blink::Member<blink::XPath::Predicate>>* pred_list; - blink::HeapVector<blink::Member<blink::XPath::Expression>>* arg_list; - blink::XPath::Step* step; - blink::XPath::LocationPath* location_path; + blink::xpath::Expression* expr; + blink::HeapVector<blink::Member<blink::xpath::Predicate>>* pred_list; + blink::HeapVector<blink::Member<blink::xpath::Expression>>* arg_list; + blink::xpath::Step* step; + blink::xpath::LocationPath* location_path; } %{ -static int xpathyylex(YYSTYPE* yylval) { return blink::XPath::Parser::Current()->Lex(yylval); } +static int xpathyylex(YYSTYPE* yylval) { return blink::xpath::Parser::Current()->Lex(yylval); } static void xpathyyerror(void*, const char*) { } %} @@ -138,7 +138,7 @@ AbsoluteLocationPath: '/' { - $$ = new blink::XPath::LocationPath; + $$ = new blink::xpath::LocationPath; } | '/' RelativeLocationPath @@ -156,7 +156,7 @@ RelativeLocationPath: Step { - $$ = new blink::XPath::LocationPath; + $$ = new blink::xpath::LocationPath; $$->AppendStep($1); } | @@ -272,13 +272,13 @@ PredicateList: Predicate { - $$ = new blink::HeapVector<blink::Member<blink::XPath::Predicate>>; - $$->push_back(new blink::XPath::Predicate($1)); + $$ = new blink::HeapVector<blink::Member<blink::xpath::Predicate>>; + $$->push_back(new blink::xpath::Predicate($1)); } | PredicateList Predicate { - $$->push_back(new blink::XPath::Predicate($2)); + $$->push_back(new blink::xpath::Predicate($2)); } ; @@ -311,7 +311,7 @@ PrimaryExpr: VARIABLEREFERENCE { - $$ = new blink::XPath::VariableReference(*$1); + $$ = new blink::xpath::VariableReference(*$1); parser->DeleteString($1); } | @@ -322,13 +322,13 @@ | LITERAL { - $$ = new blink::XPath::StringExpression(*$1); + $$ = new blink::xpath::StringExpression(*$1); parser->DeleteString($1); } | NUMBER { - $$ = new blink::XPath::Number($1->ToDouble()); + $$ = new blink::xpath::Number($1->ToDouble()); parser->DeleteString($1); } | @@ -338,7 +338,7 @@ FunctionCall: FUNCTIONNAME '(' ')' { - $$ = blink::XPath::CreateFunction(*$1); + $$ = blink::xpath::CreateFunction(*$1); if (!$$) YYABORT; parser->DeleteString($1); @@ -346,7 +346,7 @@ | FUNCTIONNAME '(' ArgumentList ')' { - $$ = blink::XPath::CreateFunction(*$1, *$3); + $$ = blink::xpath::CreateFunction(*$1, *$3); if (!$$) YYABORT; parser->DeleteString($1); @@ -356,7 +356,7 @@ ArgumentList: Argument { - $$ = new blink::HeapVector<blink::Member<blink::XPath::Expression>>; + $$ = new blink::HeapVector<blink::Member<blink::xpath::Expression>>; $$->push_back($1); } | @@ -375,7 +375,7 @@ | UnionExpr '|' PathExpr { - $$ = new blink::XPath::Union; + $$ = new blink::xpath::Union; $$->AddSubExpression($1); $$->AddSubExpression($3); } @@ -392,14 +392,14 @@ FilterExpr '/' RelativeLocationPath { $3->SetAbsolute(true); - $$ = new blink::XPath::Path($1, $3); + $$ = new blink::xpath::Path($1, $3); } | FilterExpr DescendantOrSelf RelativeLocationPath { $3->InsertFirstStep($2); $3->SetAbsolute(true); - $$ = new blink::XPath::Path($1, $3); + $$ = new blink::xpath::Path($1, $3); } ; @@ -408,7 +408,7 @@ | PrimaryExpr PredicateList { - $$ = new blink::XPath::Filter($1, *$2); + $$ = new blink::xpath::Filter($1, *$2); } ; @@ -417,7 +417,7 @@ | OrExpr OR AndExpr { - $$ = new blink::XPath::LogicalOp(blink::XPath::LogicalOp::kOP_Or, $1, $3); + $$ = new blink::xpath::LogicalOp(blink::xpath::LogicalOp::kOP_Or, $1, $3); } ; @@ -426,7 +426,7 @@ | AndExpr AND EqualityExpr { - $$ = new blink::XPath::LogicalOp(blink::XPath::LogicalOp::kOP_And, $1, $3); + $$ = new blink::xpath::LogicalOp(blink::xpath::LogicalOp::kOP_And, $1, $3); } ; @@ -435,7 +435,7 @@ | EqualityExpr EQOP RelationalExpr { - $$ = new blink::XPath::EqTestOp($2, $1, $3); + $$ = new blink::xpath::EqTestOp($2, $1, $3); } ; @@ -444,7 +444,7 @@ | RelationalExpr RELOP AdditiveExpr { - $$ = new blink::XPath::EqTestOp($2, $1, $3); + $$ = new blink::xpath::EqTestOp($2, $1, $3); } ; @@ -453,12 +453,12 @@ | AdditiveExpr PLUS MultiplicativeExpr { - $$ = new blink::XPath::NumericOp(blink::XPath::NumericOp::kOP_Add, $1, $3); + $$ = new blink::xpath::NumericOp(blink::xpath::NumericOp::kOP_Add, $1, $3); } | AdditiveExpr MINUS MultiplicativeExpr { - $$ = new blink::XPath::NumericOp(blink::XPath::NumericOp::kOP_Sub, $1, $3); + $$ = new blink::xpath::NumericOp(blink::xpath::NumericOp::kOP_Sub, $1, $3); } ; @@ -467,7 +467,7 @@ | MultiplicativeExpr MULOP UnaryExpr { - $$ = new blink::XPath::NumericOp($2, $1, $3); + $$ = new blink::xpath::NumericOp($2, $1, $3); } ; @@ -476,7 +476,7 @@ | MINUS UnaryExpr { - $$ = new blink::XPath::Negative; + $$ = new blink::xpath::Negative; $$->AddSubExpression($2); } ;
diff --git a/third_party/blink/renderer/core/xml/xpath_node_set.cc b/third_party/blink/renderer/core/xml/xpath_node_set.cc index 940a75d2d..145e8ec 100644 --- a/third_party/blink/renderer/core/xml/xpath_node_set.cc +++ b/third_party/blink/renderer/core/xml/xpath_node_set.cc
@@ -31,7 +31,7 @@ #include "third_party/blink/renderer/core/dom/node_traversal.h" namespace blink { -namespace XPath { +namespace xpath { // When a node set is large, sorting it by traversing the whole document is // better (we can assume that we aren't dealing with documents that we cannot @@ -277,5 +277,5 @@ return nodes_.at(0).Get(); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_node_set.h b/third_party/blink/renderer/core/xml/xpath_node_set.h index 1347ca7..0ac2f06 100644 --- a/third_party/blink/renderer/core/xml/xpath_node_set.h +++ b/third_party/blink/renderer/core/xml/xpath_node_set.h
@@ -32,7 +32,7 @@ namespace blink { -namespace XPath { +namespace xpath { class NodeSet final : public GarbageCollected<NodeSet> { public: @@ -96,7 +96,7 @@ HeapVector<Member<Node>> nodes_; }; -} // namespace XPath +} // namespace xpath } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_XML_XPATH_NODE_SET_H_
diff --git a/third_party/blink/renderer/core/xml/xpath_parser.cc b/third_party/blink/renderer/core/xml/xpath_parser.cc index a4ec424..2d19a692 100644 --- a/third_party/blink/renderer/core/xml/xpath_parser.cc +++ b/third_party/blink/renderer/core/xml/xpath_parser.cc
@@ -38,7 +38,7 @@ namespace blink { -using namespace XPath; +using namespace xpath; Parser* Parser::current_parser_ = nullptr;
diff --git a/third_party/blink/renderer/core/xml/xpath_parser.h b/third_party/blink/renderer/core/xml/xpath_parser.h index 5880f2a2..46e69a1 100644 --- a/third_party/blink/renderer/core/xml/xpath_parser.h +++ b/third_party/blink/renderer/core/xml/xpath_parser.h
@@ -38,7 +38,7 @@ class ExceptionState; class XPathNSResolver; -namespace XPath { +namespace xpath { class Expression; class LocationPath; @@ -118,9 +118,9 @@ DISALLOW_COPY_AND_ASSIGN(Parser); }; -} // namespace XPath +} // namespace xpath } // namespace blink -int xpathyyparse(blink::XPath::Parser*); +int xpathyyparse(blink::xpath::Parser*); #endif
diff --git a/third_party/blink/renderer/core/xml/xpath_path.cc b/third_party/blink/renderer/core/xml/xpath_path.cc index 7038ddffe..fd910fc3 100644 --- a/third_party/blink/renderer/core/xml/xpath_path.cc +++ b/third_party/blink/renderer/core/xml/xpath_path.cc
@@ -34,7 +34,7 @@ #include "third_party/blink/renderer/core/xml/xpath_value.h" namespace blink { -namespace XPath { +namespace xpath { Filter::Filter(Expression* expr, HeapVector<Member<Predicate>>& predicates) : expr_(expr) { @@ -198,6 +198,6 @@ return v; } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_path.h b/third_party/blink/renderer/core/xml/xpath_path.h index 46938a58..034e077 100644 --- a/third_party/blink/renderer/core/xml/xpath_path.h +++ b/third_party/blink/renderer/core/xml/xpath_path.h
@@ -32,7 +32,7 @@ namespace blink { -namespace XPath { +namespace xpath { class Predicate; class Step; @@ -90,7 +90,7 @@ Member<LocationPath> path_; }; -} // namespace XPath +} // namespace xpath } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_XML_XPATH_PATH_H_
diff --git a/third_party/blink/renderer/core/xml/xpath_predicate.cc b/third_party/blink/renderer/core/xml/xpath_predicate.cc index f6a94c20..a6716549 100644 --- a/third_party/blink/renderer/core/xml/xpath_predicate.cc +++ b/third_party/blink/renderer/core/xml/xpath_predicate.cc
@@ -34,7 +34,7 @@ namespace blink { -namespace XPath { +namespace xpath { Number::Number(double value) : value_(value) {} @@ -275,6 +275,6 @@ return result.ToBoolean(); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_predicate.h b/third_party/blink/renderer/core/xml/xpath_predicate.h index 8d71184..ac0fd98 100644 --- a/third_party/blink/renderer/core/xml/xpath_predicate.h +++ b/third_party/blink/renderer/core/xml/xpath_predicate.h
@@ -34,7 +34,7 @@ namespace blink { -namespace XPath { +namespace xpath { class CORE_EXPORT Number final : public Expression { public: @@ -136,7 +136,7 @@ DISALLOW_COPY_AND_ASSIGN(Predicate); }; -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_result.cc b/third_party/blink/renderer/core/xml/xpath_result.cc index 60da3f1..58785a13 100644 --- a/third_party/blink/renderer/core/xml/xpath_result.cc +++ b/third_party/blink/renderer/core/xml/xpath_result.cc
@@ -33,7 +33,7 @@ namespace blink { -using namespace XPath; +using namespace xpath; XPathResult::XPathResult(EvaluationContext& context, const Value& value) : value_(value), node_set_position_(0), dom_tree_version_(0) {
diff --git a/third_party/blink/renderer/core/xml/xpath_result.h b/third_party/blink/renderer/core/xml/xpath_result.h index e1afaeb..b685466 100644 --- a/third_party/blink/renderer/core/xml/xpath_result.h +++ b/third_party/blink/renderer/core/xml/xpath_result.h
@@ -38,7 +38,7 @@ class ExceptionState; class Node; -namespace XPath { +namespace xpath { struct EvaluationContext; } @@ -59,8 +59,8 @@ kFirstOrderedNodeType = 9 }; - static XPathResult* Create(XPath::EvaluationContext& context, - const XPath::Value& value) { + static XPathResult* Create(xpath::EvaluationContext& context, + const xpath::Value& value) { return new XPathResult(context, value); } @@ -78,18 +78,18 @@ Node* iterateNext(ExceptionState&); Node* snapshotItem(unsigned index, ExceptionState&); - const XPath::Value& GetValue() const { return value_; } + const xpath::Value& GetValue() const { return value_; } void Trace(blink::Visitor*) override; private: - XPathResult(XPath::EvaluationContext&, const XPath::Value&); - XPath::NodeSet& GetNodeSet() { return *node_set_; } + XPathResult(xpath::EvaluationContext&, const xpath::Value&); + xpath::NodeSet& GetNodeSet() { return *node_set_; } - XPath::Value value_; + xpath::Value value_; unsigned node_set_position_; - Member<XPath::NodeSet> - node_set_; // FIXME: why duplicate the node set stored in m_value? + // FIXME: why duplicate the node set stored in value_? + Member<xpath::NodeSet> node_set_; unsigned short result_type_; Member<Document> document_; uint64_t dom_tree_version_;
diff --git a/third_party/blink/renderer/core/xml/xpath_step.cc b/third_party/blink/renderer/core/xml/xpath_step.cc index e48e904..36543c41 100644 --- a/third_party/blink/renderer/core/xml/xpath_step.cc +++ b/third_party/blink/renderer/core/xml/xpath_step.cc
@@ -36,7 +36,7 @@ #include "third_party/blink/renderer/core/xmlns_names.h" namespace blink { -namespace XPath { +namespace xpath { Step::Step(Axis axis, const NodeTest& node_test) : axis_(axis), node_test_(new NodeTest(node_test)) {} @@ -455,6 +455,6 @@ NOTREACHED(); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_step.h b/third_party/blink/renderer/core/xml/xpath_step.h index 8c3fa81..7082de8 100644 --- a/third_party/blink/renderer/core/xml/xpath_step.h +++ b/third_party/blink/renderer/core/xml/xpath_step.h
@@ -35,7 +35,7 @@ class Node; -namespace XPath { +namespace xpath { class Predicate; @@ -136,7 +136,7 @@ bool OptimizeStepPair(Step*, Step*); -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_util.cc b/third_party/blink/renderer/core/xml/xpath_util.cc index 9d5cd81..7b51773 100644 --- a/third_party/blink/renderer/core/xml/xpath_util.cc +++ b/third_party/blink/renderer/core/xml/xpath_util.cc
@@ -31,7 +31,7 @@ #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { -namespace XPath { +namespace xpath { bool IsRootDomNode(Node* node) { return node && !node->parentNode(); @@ -84,5 +84,5 @@ return false; } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_util.h b/third_party/blink/renderer/core/xml/xpath_util.h index 44a00ba..ddf04f5 100644 --- a/third_party/blink/renderer/core/xml/xpath_util.h +++ b/third_party/blink/renderer/core/xml/xpath_util.h
@@ -33,7 +33,7 @@ class Node; -namespace XPath { +namespace xpath { // @return whether the given node is the root node bool IsRootDomNode(Node*); @@ -45,7 +45,7 @@ // @return whether the given node is a valid context node bool IsValidContextNode(Node*); -} // namespace XPath +} // namespace xpath } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_XML_XPATH_UTIL_H_
diff --git a/third_party/blink/renderer/core/xml/xpath_value.cc b/third_party/blink/renderer/core/xml/xpath_value.cc index 5b9ea55..402f907 100644 --- a/third_party/blink/renderer/core/xml/xpath_value.cc +++ b/third_party/blink/renderer/core/xml/xpath_value.cc
@@ -34,7 +34,7 @@ #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink { -namespace XPath { +namespace xpath { const Value::AdoptTag Value::kAdopt = {}; @@ -51,8 +51,9 @@ context->had_type_conversion_error = true; if (!data_) { - DEFINE_STATIC_LOCAL(NodeSet, empty_node_set, (NodeSet::Create())); - return empty_node_set; + DEFINE_STATIC_LOCAL(Persistent<NodeSet>, empty_node_set, + (NodeSet::Create())); + return *empty_node_set; } return data_->GetNodeSet(); @@ -138,5 +139,5 @@ return String(); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_value.h b/third_party/blink/renderer/core/xml/xpath_value.h index 0ce7834..6d3e3aa 100644 --- a/third_party/blink/renderer/core/xml/xpath_value.h +++ b/third_party/blink/renderer/core/xml/xpath_value.h
@@ -33,7 +33,7 @@ namespace blink { -namespace XPath { +namespace xpath { struct EvaluationContext; @@ -141,7 +141,7 @@ inline Value::Value(bool value) : type_(kBooleanValue), bool_(value), number_(0) {} -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_variable_reference.cc b/third_party/blink/renderer/core/xml/xpath_variable_reference.cc index 4f5f175..67b1cb5 100644 --- a/third_party/blink/renderer/core/xml/xpath_variable_reference.cc +++ b/third_party/blink/renderer/core/xml/xpath_variable_reference.cc
@@ -29,7 +29,7 @@ #include "third_party/blink/renderer/core/xml/xpath_value.h" namespace blink { -namespace XPath { +namespace xpath { VariableReference::VariableReference(const String& name) : name_(name) {} @@ -43,5 +43,5 @@ return bindings.at(name_); } -} // namespace XPath +} // namespace xpath } // namespace blink
diff --git a/third_party/blink/renderer/core/xml/xpath_variable_reference.h b/third_party/blink/renderer/core/xml/xpath_variable_reference.h index d867e23..30c2377f 100644 --- a/third_party/blink/renderer/core/xml/xpath_variable_reference.h +++ b/third_party/blink/renderer/core/xml/xpath_variable_reference.h
@@ -30,7 +30,7 @@ namespace blink { -namespace XPath { +namespace xpath { // Variable references are not used with XPathEvaluator. class VariableReference final : public Expression { @@ -47,7 +47,7 @@ String name_; }; -} // namespace XPath +} // namespace xpath } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_XML_XPATH_VARIABLE_REFERENCE_H_
diff --git a/third_party/blink/renderer/modules/accessibility/ax_media_controls.cc b/third_party/blink/renderer/modules/accessibility/ax_media_controls.cc index a7771a5..664ad27 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_media_controls.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_media_controls.cc
@@ -59,6 +59,10 @@ case kMediaSlider: return AccessibilityMediaTimeline::Create(layout_object, ax_object_cache); + case kMediaVolumeSlider: + return AccessibilityMediaVolumeSlider::Create(layout_object, + ax_object_cache); + case kMediaCurrentTimeDisplay: case kMediaTimeRemainingDisplay: return AccessibilityMediaTimeDisplay::Create(layout_object, @@ -79,7 +83,6 @@ case kMediaTimelineContainer: case kMediaTrackSelectionCheckmark: case kMediaVolumeSliderContainer: - case kMediaVolumeSlider: case kMediaVolumeSliderThumb: case kMediaExitFullscreenButton: case kMediaCastOffButton: @@ -163,7 +166,6 @@ case kMediaTrackSelectionCheckmark: case kMediaControlsPanel: case kMediaVolumeSliderContainer: - case kMediaVolumeSlider: case kMediaVolumeSliderThumb: case kMediaOverflowList: case kMediaScrubbingMessage: @@ -179,6 +181,7 @@ return QueryString( WebLocalizedString::kAXMediaDisplayCutoutFullscreenButton); case kMediaSlider: + case kMediaVolumeSlider: NOTREACHED(); return QueryString(WebLocalizedString::kAXMediaDefault); } @@ -237,7 +240,6 @@ case kMediaTrackSelectionCheckmark: case kMediaControlsPanel: case kMediaVolumeSliderContainer: - case kMediaVolumeSlider: case kMediaVolumeSliderThumb: case kMediaOverflowList: case kMediaDownloadButton: @@ -245,6 +247,7 @@ case kMediaAnimatedArrowContainer: return QueryString(WebLocalizedString::kAXMediaDefault); case kMediaSlider: + case kMediaVolumeSlider: NOTREACHED(); return QueryString(WebLocalizedString::kAXMediaDefault); } @@ -295,13 +298,13 @@ case kMediaTimeRemainingDisplay: case kMediaSliderThumb: case kMediaTrackSelectionCheckmark: - case kMediaVolumeSlider: case kMediaVolumeSliderThumb: case kMediaScrubbingMessage: case kMediaAnimatedArrowContainer: return ax::mojom::Role::kUnknown; case kMediaSlider: + case kMediaVolumeSlider: // Not using AccessibilityMediaControl. NOTREACHED(); return ax::mojom::Role::kUnknown; @@ -380,6 +383,37 @@ } // +// AccessibilityMediaVolumeSlider + +AccessibilityMediaVolumeSlider::AccessibilityMediaVolumeSlider( + LayoutObject* layout_object, + AXObjectCacheImpl& ax_object_cache) + : AXSlider(layout_object, ax_object_cache) {} + +AXObject* AccessibilityMediaVolumeSlider::Create( + LayoutObject* layout_object, + AXObjectCacheImpl& ax_object_cache) { + return new AccessibilityMediaVolumeSlider(layout_object, ax_object_cache); +} + +String AccessibilityMediaVolumeSlider::Description( + ax::mojom::NameFrom name_from, + ax::mojom::DescriptionFrom& description_from, + AXObjectVector* description_objects) const { + return QueryString(WebLocalizedString::kAXMediaVolumeSliderHelp); +} + +bool AccessibilityMediaVolumeSlider::InternalSetAccessibilityFocusAction() { + MediaControlElementsHelper::NotifyMediaControlAccessibleFocus(GetElement()); + return AXSlider::InternalSetAccessibilityFocusAction(); +} + +bool AccessibilityMediaVolumeSlider::InternalClearAccessibilityFocusAction() { + MediaControlElementsHelper::NotifyMediaControlAccessibleBlur(GetElement()); + return AXSlider::InternalClearAccessibilityFocusAction(); +} + +// // AccessibilityMediaTimeDisplay AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(
diff --git a/third_party/blink/renderer/modules/accessibility/ax_media_controls.h b/third_party/blink/renderer/modules/accessibility/ax_media_controls.h index 0bdc9984..fc7c71c 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_media_controls.h +++ b/third_party/blink/renderer/modules/accessibility/ax_media_controls.h
@@ -80,6 +80,24 @@ DISALLOW_COPY_AND_ASSIGN(AccessibilityMediaTimeline); }; +class AccessibilityMediaVolumeSlider final : public AXSlider { + public: + static AXObject* Create(LayoutObject*, AXObjectCacheImpl&); + ~AccessibilityMediaVolumeSlider() override = default; + + String Description(ax::mojom::NameFrom, + ax::mojom::DescriptionFrom&, + AXObjectVector* description_objects) const override; + + bool InternalSetAccessibilityFocusAction() override; + bool InternalClearAccessibilityFocusAction() override; + + private: + AccessibilityMediaVolumeSlider(LayoutObject*, AXObjectCacheImpl&); + + DISALLOW_COPY_AND_ASSIGN(AccessibilityMediaVolumeSlider); +}; + class AXMediaControlsContainer final : public AccessibilityMediaControl { public: static AXObject* Create(LayoutObject*, AXObjectCacheImpl&);
diff --git a/third_party/blink/renderer/modules/battery/battery_dispatcher.cc b/third_party/blink/renderer/modules/battery/battery_dispatcher.cc index 7dc24a0..a5948bf 100644 --- a/third_party/blink/renderer/modules/battery/battery_dispatcher.cc +++ b/third_party/blink/renderer/modules/battery/battery_dispatcher.cc
@@ -13,9 +13,9 @@ namespace blink { BatteryDispatcher& BatteryDispatcher::Instance() { - DEFINE_STATIC_LOCAL(BatteryDispatcher, battery_dispatcher, + DEFINE_STATIC_LOCAL(Persistent<BatteryDispatcher>, battery_dispatcher, (new BatteryDispatcher)); - return battery_dispatcher; + return *battery_dispatcher; } BatteryDispatcher::BatteryDispatcher() : has_latest_data_(false) {}
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.cc b/third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.cc index f3771a1..78725b41 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.cc +++ b/third_party/blink/renderer/modules/gamepad/gamepad_dispatcher.cc
@@ -14,9 +14,9 @@ using device::mojom::blink::GamepadHapticsManager; GamepadDispatcher& GamepadDispatcher::Instance() { - DEFINE_STATIC_LOCAL(GamepadDispatcher, gamepad_dispatcher, + DEFINE_STATIC_LOCAL(Persistent<GamepadDispatcher>, gamepad_dispatcher, (new GamepadDispatcher)); - return gamepad_dispatcher; + return *gamepad_dispatcher; } void GamepadDispatcher::SampleGamepads(device::Gamepads& gamepads) {
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_mute_button_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_mute_button_element.cc index 34f2aff..da173711 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_mute_button_element.cc +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_mute_button_element.cc
@@ -64,6 +64,18 @@ event.SetDefaultHandled(); } + if (!IsOverflowElement()) { + if (event.type() == EventTypeNames::mouseover || + event.type() == EventTypeNames::focus) { + GetMediaControls().OpenVolumeSliderIfNecessary(); + } + + if (event.type() == EventTypeNames::mouseout || + event.type() == EventTypeNames::blur) { + GetMediaControls().CloseVolumeSliderIfNecessary(); + } + } + MediaControlInputElement::DefaultEventHandler(event); }
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.cc index afc97376..2ffacc5f 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.cc +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.h" #include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/renderer/core/dom/dom_token_list.h" #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/html/media/html_media_element.h" #include "third_party/blink/renderer/core/html_names.h" @@ -14,12 +15,22 @@ namespace blink { +namespace { + +const char kClosedCSSClass[] = "closed"; + +} // anonymous namespace + MediaControlVolumeSliderElement::MediaControlVolumeSliderElement( MediaControlsImpl& media_controls) : MediaControlSliderElement(media_controls, kMediaVolumeSlider) { setAttribute(HTMLNames::maxAttr, "1"); SetShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider")); SetVolumeInternal(MediaElement().volume()); + + // The slider starts closed in modern media controls. + if (MediaControlsImpl::IsModern()) + CloseSlider(); } void MediaControlVolumeSliderElement::SetVolume(double volume) { @@ -30,6 +41,14 @@ SetVolumeInternal(volume); } +void MediaControlVolumeSliderElement::OpenSlider() { + classList().Remove(kClosedCSSClass); +} + +void MediaControlVolumeSliderElement::CloseSlider() { + classList().Add(kClosedCSSClass); +} + bool MediaControlVolumeSliderElement::WillRespondToMouseMoveEvents() { if (!isConnected() || !GetDocument().IsActive()) return false; @@ -75,6 +94,16 @@ MediaElement().setMuted(false); SetVolumeInternal(volume); } + + if (event.type() == EventTypeNames::mouseover || + event.type() == EventTypeNames::focus) { + GetMediaControls().OpenVolumeSliderIfNecessary(); + } + + if (event.type() == EventTypeNames::mouseout || + event.type() == EventTypeNames::blur) { + GetMediaControls().CloseVolumeSliderIfNecessary(); + } } void MediaControlVolumeSliderElement::SetVolumeInternal(double volume) {
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.h b/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.h index 2e9962f..dc37b48d 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.h +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_volume_slider_element.h
@@ -19,6 +19,9 @@ // TODO: who calls this? void SetVolume(double); + void OpenSlider(); + void CloseSlider(); + // MediaControlInputElement overrides. bool WillRespondToMouseMoveEvents() override; bool WillRespondToMouseClickEvents() override;
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc b/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc index 2c98b636..cc6c9eac 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_impl.cc
@@ -573,12 +573,9 @@ timeline_ = new MediaControlTimelineElement(*this); mute_button_ = new MediaControlMuteButtonElement(*this); - // The volume slider should be shown if we are using the legacy controls. - if (!IsModern()) { - volume_slider_ = new MediaControlVolumeSliderElement(*this); - if (PreferHiddenVolumeControls(GetDocument())) - volume_slider_->SetIsWanted(false); - } + volume_slider_ = new MediaControlVolumeSliderElement(*this); + if (PreferHiddenVolumeControls(GetDocument())) + volume_slider_->SetIsWanted(false); if (RuntimeEnabledFeatures::PictureInPictureEnabled() && GetDocument().GetSettings() && @@ -669,9 +666,15 @@ panel_->ParserAppendChild(timeline_); - button_panel->ParserAppendChild(mute_button_); + // On modern controls, the volume slider is to the left of the mute button. + if (IsModern()) { + MaybeParserAppendChild(button_panel, volume_slider_); + button_panel->ParserAppendChild(mute_button_); + } else { + button_panel->ParserAppendChild(mute_button_); + MaybeParserAppendChild(button_panel, volume_slider_); + } - MaybeParserAppendChild(button_panel, volume_slider_); MaybeParserAppendChild(button_panel, picture_in_picture_button_); button_panel->ParserAppendChild(fullscreen_button_); @@ -1440,6 +1443,8 @@ if (!MediaElement().ShouldShowControls()) return; + OpenVolumeSliderIfNecessary(); + keep_showing_until_timer_fires_ = true; StartHideMediaControlsTimer(); MaybeShow(); @@ -1451,6 +1456,8 @@ if (MediaElement().ShouldShowControls()) return; + CloseVolumeSliderIfNecessary(); + keep_showing_until_timer_fires_ = false; ResetHideMediaControlsTimer(); } @@ -1514,8 +1521,7 @@ timeline_->OnMediaKeyboardEvent(&event); return; } - // We don't allow the user to change the volume on modern media controls. - if (!IsModern() && (key == "ArrowDown" || key == "ArrowUp")) { + if (volume_slider_ && (key == "ArrowDown" || key == "ArrowUp")) { for (int i = 0; i < 5; i++) volume_slider_->OnMediaKeyboardEvent(&event); return; @@ -2130,6 +2136,30 @@ StartHideMediaControlsTimer(); } +void MediaControlsImpl::OpenVolumeSliderIfNecessary() { + if (ShouldOpenVolumeSlider()) + volume_slider_->OpenSlider(); +} + +void MediaControlsImpl::CloseVolumeSliderIfNecessary() { + if (ShouldCloseVolumeSlider()) + volume_slider_->CloseSlider(); +} + +bool MediaControlsImpl::ShouldOpenVolumeSlider() const { + if (!volume_slider_ || !IsModern()) + return false; + + return !PreferHiddenVolumeControls(GetDocument()); +} + +bool MediaControlsImpl::ShouldCloseVolumeSlider() const { + if (!volume_slider_ || !IsModern()) + return false; + + return !(volume_slider_->IsHovered() || mute_button_->IsHovered()); +} + const MediaControlDownloadButtonElement& MediaControlsImpl::DownloadButton() const { return *download_button_;
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_impl.h b/third_party/blink/renderer/modules/media_controls/media_controls_impl.h index 74033af..c0572a0 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_impl.h +++ b/third_party/blink/renderer/modules/media_controls/media_controls_impl.h
@@ -137,6 +137,9 @@ void ToggleOverflowMenu(); bool OverflowMenuVisible(); + void OpenVolumeSliderIfNecessary(); + void CloseVolumeSliderIfNecessary(); + void ShowOverlayCastButtonIfNeeded(); // Methods call by the scrubber. @@ -267,6 +270,9 @@ void HideCursor(); void ShowCursor(); + bool ShouldOpenVolumeSlider() const; + bool ShouldCloseVolumeSlider() const; + void ElementSizeChangedTimerFired(TimerBase*); // Hide elements that don't fit, and show those things that we want which
diff --git a/third_party/blink/renderer/modules/media_controls/resources/modernMediaControls.css b/third_party/blink/renderer/modules/media_controls/resources/modernMediaControls.css index 5dc6f1d..a70c65d 100644 --- a/third_party/blink/renderer/modules/media_controls/resources/modernMediaControls.css +++ b/third_party/blink/renderer/modules/media_controls/resources/modernMediaControls.css
@@ -464,60 +464,28 @@ padding: 0 32px 20px 32px; } -/* TODO(https://crbug.com/857120): All these are the same, so these are unnecessary. */ -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i], -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background { +input[pseudo="-webkit-media-controls-timeline" i], +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background, +input[pseudo="-webkit-media-controls-volume-slider" i], +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-background { height: 4px; } -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i], -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background { - height: 4px; -} - -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i], -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background { - height: 4px; -} - -/* TODO(https://crbug.com/857120): All these are the same, so these are unnecessary. */ -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { +input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb, +input[pseudo="-webkit-media-controls-volume-slider" i]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4px; } -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { - width: 12px; - height: 12px; - margin-top: -4px; -} - -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { - width: 12px; - height: 12px; - margin-top: -4px; -} - -/* TODO(https://crbug.com/857120): All these are the same, so these are unnecessary. */ -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-small input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { - border-radius: 2px; -} - -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-medium input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { - border-radius: 2px; -} - -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, -video::-webkit-media-controls.sizing-large input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-media-controls-segmented-track { border-radius: 2px; } @@ -550,7 +518,8 @@ background-position: center right; } -input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-media-controls-segmented-track { -webkit-appearance: -internal-media-control; flex: 1; @@ -558,12 +527,14 @@ border-radius: 2px; position: relative; } -video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track { +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-media-controls-segmented-track, +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-media-controls-segmented-track { background: rgba(255, 255, 255, .3); box-shadow: 0 2px 10px 0 rgba(0,0,0,0.5); } -input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { +input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb, +input[pseudo="-webkit-media-controls-volume-slider" i]::-webkit-slider-thumb { -webkit-appearance: -internal-media-control; background: rgba(0, 0, 0, .87); box-shadow: 0 0 10px 0 #fff; @@ -575,7 +546,8 @@ flex: 0 0 0; } -video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb { +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb, +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-volume-slider" i]::-webkit-slider-thumb { background: #FFFFFF; box-shadow: unset; } @@ -584,7 +556,8 @@ display: none; } -input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-background, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-background { position: absolute; width: 100%; top: 0; @@ -593,30 +566,53 @@ } input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, -input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after { position: absolute; height: 4px; } -input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before { background: rgba(0, 0, 0, .87); border-radius: 100px; } -video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before { +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-before, +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-before { background: rgba(255, 255, 255, 1); } -input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after { +input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after { background: rgba(0, 0, 0, .54); border-radius: 2px; } -video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after { +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-timeline" i]::-internal-track-segment-highlight-after, +video::-webkit-media-controls:not(.audio-only) input[pseudo="-webkit-media-controls-volume-slider" i]::-internal-track-segment-highlight-after { background: rgba(255, 255, 255, .54); } audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider { - display: none; + -webkit-appearance: -internal-media-control; + + height: 4px; + width: 100px; + transition: width 0.3s; + margin: 0; + padding: 22px 0 22px 0; /* (48px button panel height - 4px slider height) / 2 for top/bottom */ + background: transparent; + /* This prevents layout issues in quirks mode. */ + box-sizing: unset !important; +} + +audio::-webkit-media-controls-volume-slider.closed, +video::-webkit-media-controls-volume-slider.closed { + width: 0; + opacity: 0; + pointer-events: none; + transition: width 0.3s ease, opacity 0.28s step-end; } /**
diff --git a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_dispatcher.cc b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_dispatcher.cc index 9d51475..67512ed9 100644 --- a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_dispatcher.cc +++ b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_dispatcher.cc
@@ -11,10 +11,10 @@ namespace blink { ScreenOrientationDispatcher& ScreenOrientationDispatcher::Instance() { - DEFINE_STATIC_LOCAL(ScreenOrientationDispatcher, + DEFINE_STATIC_LOCAL(Persistent<ScreenOrientationDispatcher>, screen_orientation_dispatcher, (new ScreenOrientationDispatcher)); - return screen_orientation_dispatcher; + return *screen_orientation_dispatcher; } ScreenOrientationDispatcher::ScreenOrientationDispatcher() = default;
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc b/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc index 402e2f6..09cafa6 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc +++ b/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/modules/shapedetection/detected_barcode.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h" #include "third_party/blink/renderer/core/geometry/dom_rect.h" namespace blink { @@ -39,6 +40,21 @@ bounding_box_(bounding_box), corner_points_(corner_points) {} +ScriptValue DetectedBarcode::toJSONForBinding(ScriptState* script_state) const { + V8ObjectBuilder result(script_state); + result.AddString("rawValue", rawValue()); + result.Add("boundingBox", boundingBox()->toJSONForBinding(script_state)); + Vector<ScriptValue> corner_points; + for (const auto& corner_point : corner_points_) { + V8ObjectBuilder builder(script_state); + builder.AddNumber("x", corner_point.x()); + builder.AddNumber("y", corner_point.y()); + corner_points.push_back(builder.GetScriptValue()); + } + result.Add("cornerPoints", corner_points); + return result.GetScriptValue(); +} + void DetectedBarcode::Trace(blink::Visitor* visitor) { visitor->Trace(bounding_box_); visitor->Trace(corner_points_);
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_barcode.h b/third_party/blink/renderer/modules/shapedetection/detected_barcode.h index 69dcfd9..c6f2fe11 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_barcode.h +++ b/third_party/blink/renderer/modules/shapedetection/detected_barcode.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_DETECTED_BARCODE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_DETECTED_BARCODE_H_ +#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/modules/imagecapture/point_2d.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -24,6 +25,8 @@ const String& rawValue() const; DOMRectReadOnly* boundingBox() const; const HeapVector<Point2D>& cornerPoints() const; + + ScriptValue toJSONForBinding(ScriptState*) const; void Trace(blink::Visitor*) override; private:
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_barcode.idl b/third_party/blink/renderer/modules/shapedetection/detected_barcode.idl index 8d6aa75..6878cf7 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_barcode.idl +++ b/third_party/blink/renderer/modules/shapedetection/detected_barcode.idl
@@ -14,4 +14,6 @@ // 4 corner points in clockwise direction starting with top-left. Due to // possible perspective distortions, this is not necessarily a rectangle. [SameObject, SaveSameObject] readonly attribute FrozenArray<Point2D> cornerPoints; + + serializer = { attribute }; };
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_face.cc b/third_party/blink/renderer/modules/shapedetection/detected_face.cc index 00863ff..8228b01 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_face.cc +++ b/third_party/blink/renderer/modules/shapedetection/detected_face.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/modules/shapedetection/detected_face.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h" #include "third_party/blink/renderer/core/geometry/dom_rect.h" namespace blink { @@ -36,6 +37,27 @@ const HeapVector<Landmark>& landmarks) : bounding_box_(bounding_box), landmarks_(landmarks) {} +ScriptValue DetectedFace::toJSONForBinding(ScriptState* script_state) const { + V8ObjectBuilder result(script_state); + result.Add("boundingBox", boundingBox()->toJSONForBinding(script_state)); + Vector<ScriptValue> landmarks; + for (const auto& landmark : landmarks_) { + V8ObjectBuilder landmark_builder(script_state); + landmark_builder.AddString("type", landmark.type()); + Vector<ScriptValue> locations; + for (const auto& location : landmark.locations()) { + V8ObjectBuilder location_builder(script_state); + location_builder.AddNumber("x", location.x()); + location_builder.AddNumber("y", location.y()); + locations.push_back(location_builder.GetScriptValue()); + } + landmark_builder.Add("locations", locations); + landmarks.push_back(landmark_builder.GetScriptValue()); + } + result.Add("landmarks", landmarks); + return result.GetScriptValue(); +} + void DetectedFace::Trace(blink::Visitor* visitor) { visitor->Trace(bounding_box_); visitor->Trace(landmarks_);
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_face.h b/third_party/blink/renderer/modules/shapedetection/detected_face.h index 0e5268a..6935e843 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_face.h +++ b/third_party/blink/renderer/modules/shapedetection/detected_face.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_DETECTED_FACE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_SHAPEDETECTION_DETECTED_FACE_H_ +#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/shapedetection/landmark.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -24,6 +25,7 @@ DOMRectReadOnly* boundingBox() const; const HeapVector<Landmark>& landmarks() const; + ScriptValue toJSONForBinding(ScriptState*) const; void Trace(blink::Visitor*) override; private:
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_face.idl b/third_party/blink/renderer/modules/shapedetection/detected_face.idl index fda03e7..e45b7c2 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_face.idl +++ b/third_party/blink/renderer/modules/shapedetection/detected_face.idl
@@ -11,4 +11,6 @@ // TODO(xianglu): Implement any other fields. https://crbug.com/646083 [SameObject] readonly attribute DOMRectReadOnly boundingBox; [SameObject, SaveSameObject] readonly attribute FrozenArray<Landmark> landmarks; + + serializer = { attribute }; };
diff --git a/third_party/blink/renderer/platform/exported/platform.cc b/third_party/blink/renderer/platform/exported/platform.cc index 8105683..67423a3 100644 --- a/third_party/blink/renderer/platform/exported/platform.cc +++ b/third_party/blink/renderer/platform/exported/platform.cc
@@ -141,8 +141,7 @@ // and Platform::UnsetMainThreadTaskRunnerForTesting(). bool IsCurrentThread() const override { return WTF::IsMainThread(); } - // TODO(yutak): Remove the const qualifier so we don't have to use mutable. - ThreadScheduler* Scheduler() const override { return &scheduler_; } + ThreadScheduler* Scheduler() override { return &scheduler_; } scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const override { if (main_thread_task_runner_for_testing_) return main_thread_task_runner_for_testing_; @@ -158,7 +157,7 @@ private: bool IsSimpleMainThread() const override { return true; } - mutable scheduler::SimpleThreadScheduler scheduler_; + scheduler::SimpleThreadScheduler scheduler_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_for_testing_; }; @@ -274,7 +273,7 @@ return g_platform; } -WebThread* Platform::MainThread() const { +WebThread* Platform::MainThread() { return main_thread_; } @@ -342,8 +341,18 @@ event->Signal(); } -void Platform::RegisterExtraThreadToTLS(WebThread* thread) { - WaitUntilWebThreadTLSUpdate(thread); +void Platform::InitializeCompositorThread( + const WebThreadCreationParams& params) { + DCHECK(!compositor_thread_); + std::unique_ptr<scheduler::WebThreadBase> compositor_thread = + scheduler::WebThreadBase::CreateCompositorThread(params); + compositor_thread->Init(); + WaitUntilWebThreadTLSUpdate(compositor_thread.get()); + compositor_thread_ = std::move(compositor_thread); +} + +WebThread* Platform::CompositorThread() { + return compositor_thread_.get(); } std::unique_ptr<WebGraphicsContext3DProvider>
diff --git a/third_party/blink/renderer/platform/heap/thread_state.cc b/third_party/blink/renderer/platform/heap/thread_state.cc index c94a3f0..21060b5 100644 --- a/third_party/blink/renderer/platform/heap/thread_state.cc +++ b/third_party/blink/renderer/platform/heap/thread_state.cc
@@ -1167,6 +1167,35 @@ "BlinkGC.TimeForGlobalWeakProcessing", event.scope_data[ThreadHeapStatsCollector::kMarkWeakProcessing]); + constexpr base::TimeDelta kSlowIncrementalMarkingFinalizeTheshold = + base::TimeDelta::FromMilliseconds(40); + if (event.scope_data[ThreadHeapStatsCollector::kIncrementalMarkingFinalize] > + kSlowIncrementalMarkingFinalizeTheshold) { + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.IncrementalMarkingFinalize", + event + .scope_data[ThreadHeapStatsCollector::kIncrementalMarkingFinalize]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.AtomicPhaseMarking", + event.scope_data[ThreadHeapStatsCollector::kAtomicPhaseMarking]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.VisitCrossThreadPersistents", + event.scope_data + [ThreadHeapStatsCollector::kVisitCrossThreadPersistents]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.VisitDOMWrappers", + event.scope_data[ThreadHeapStatsCollector::kVisitDOMWrappers]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.MarkWeakProcessing", + event.scope_data[ThreadHeapStatsCollector::kMarkWeakProcessing]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.InvokePreFinalizers", + event.scope_data[ThreadHeapStatsCollector::kInvokePreFinalizers]); + UMA_HISTOGRAM_TIMES( + "BlinkGC.SlowIncrementalMarkingFinalize.EagerSweep", + event.scope_data[ThreadHeapStatsCollector::kEagerSweep]); + } + DEFINE_STATIC_LOCAL(CustomCountHistogram, object_size_before_gc_histogram, ("BlinkGC.ObjectSizeBeforeGC", 1, 4 * 1024 * 1024, 50)); object_size_before_gc_histogram.Count(
diff --git a/third_party/blink/renderer/platform/heap/trace_traits.h b/third_party/blink/renderer/platform/heap/trace_traits.h index b7473d8..fe947740 100644 --- a/third_party/blink/renderer/platform/heap/trace_traits.h +++ b/third_party/blink/renderer/platform/heap/trace_traits.h
@@ -40,6 +40,8 @@ template <typename T> class WeakMember; template <typename T> +class Persistent; +template <typename T> class WeakPersistent; template <typename T, bool = NeedsAdjustPointer<T>::value>
diff --git a/third_party/blink/renderer/platform/loader/cors/cors.cc b/third_party/blink/renderer/platform/loader/cors/cors.cc index eb0ad5f..4d1a48a 100644 --- a/third_party/blink/renderer/platform/loader/cors/cors.cc +++ b/third_party/blink/renderer/platform/loader/cors/cors.cc
@@ -67,6 +67,14 @@ return request_headers; } +url::Origin AsUrlOrigin(const SecurityOrigin& origin) { + // "file:" origin is treated like an opaque unique origin when + // allow-file-access-from-files is not specified. Such origin is not + // opaque (i.e., IsOpaque() returns false) but still serializes to + // "null". + return origin.ToString() == "null" ? url::Origin() : origin.ToUrlOrigin(); +} + } // namespace namespace CORS { @@ -77,15 +85,12 @@ const HTTPHeaderMap& response_header, network::mojom::FetchCredentialsMode credentials_mode, const SecurityOrigin& origin) { - std::unique_ptr<SecurityOrigin::PrivilegeData> privilege = - origin.CreatePrivilegeData(); return network::cors::CheckAccess( response_url, response_status_code, GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Origin), GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Credentials), - credentials_mode, origin.ToUrlOrigin(), - !privilege->block_local_access_from_local_origin_); + credentials_mode, AsUrlOrigin(origin)); } base::Optional<network::CORSErrorStatus> CheckPreflightAccess( @@ -94,15 +99,12 @@ const HTTPHeaderMap& response_header, network::mojom::FetchCredentialsMode actual_credentials_mode, const SecurityOrigin& origin) { - std::unique_ptr<SecurityOrigin::PrivilegeData> privilege = - origin.CreatePrivilegeData(); return network::cors::CheckPreflightAccess( response_url, response_status_code, GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Origin), GetHeaderValue(response_header, HTTPNames::Access_Control_Allow_Credentials), - actual_credentials_mode, origin.ToUrlOrigin(), - !privilege->block_local_access_from_local_origin_); + actual_credentials_mode, AsUrlOrigin(origin)); } base::Optional<network::CORSErrorStatus> CheckRedirectLocation( @@ -112,7 +114,7 @@ CORSFlag cors_flag) { base::Optional<url::Origin> origin_to_pass; if (origin) - origin_to_pass = origin->ToUrlOrigin(); + origin_to_pass = AsUrlOrigin(*origin); // Blink-side implementations rewrite the origin instead of setting the // tainted flag. @@ -198,7 +200,7 @@ CORSFlag cors_flag) { base::Optional<url::Origin> origin_to_pass; if (origin) - origin_to_pass = origin->ToUrlOrigin(); + origin_to_pass = AsUrlOrigin(*origin); return network::cors::CalculateResponseTainting( url, request_mode, origin_to_pass, cors_flag == CORSFlag::Set); }
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc index e310341e..77bc3376 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
@@ -178,9 +178,9 @@ } static ResourceFetcher::ResourceFetcherSet& MainThreadFetchersSet() { - DEFINE_STATIC_LOCAL(ResourceFetcher::ResourceFetcherSet, fetchers, + DEFINE_STATIC_LOCAL(Persistent<ResourceFetcher::ResourceFetcherSet>, fetchers, (new ResourceFetcher::ResourceFetcherSet)); - return fetchers; + return *fetchers; } ResourceLoadPriority AdjustPriorityWithPriorityHint(
diff --git a/third_party/blink/renderer/platform/scheduler/child/webthread_base.cc b/third_party/blink/renderer/platform/scheduler/child/webthread_base.cc index 8d80881..da5796c 100644 --- a/third_party/blink/renderer/platform/scheduler/child/webthread_base.cc +++ b/third_party/blink/renderer/platform/scheduler/child/webthread_base.cc
@@ -96,7 +96,6 @@ public: explicit WebThreadForCompositor(const WebThreadCreationParams& params) : WebThreadImplForWorkerScheduler(params) { - Init(); } ~WebThreadForCompositor() override = default;
diff --git a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc index 1d01b3e5..0c6d9d0 100644 --- a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc
@@ -96,7 +96,7 @@ return thread_->GetThreadId(); } -blink::ThreadScheduler* WebThreadImplForWorkerScheduler::Scheduler() const { +blink::ThreadScheduler* WebThreadImplForWorkerScheduler::Scheduler() { return non_main_thread_scheduler_.get(); }
diff --git a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h index 1114407..53ebf8b6 100644 --- a/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/child/webthread_impl_for_worker_scheduler.h
@@ -37,7 +37,7 @@ ~WebThreadImplForWorkerScheduler() override; // WebThread implementation. - ThreadScheduler* Scheduler() const override; + ThreadScheduler* Scheduler() override; PlatformThreadId ThreadId() const override; scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const override;
diff --git a/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.cc b/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.cc index 09dfa78..541e3c28 100644 --- a/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.cc +++ b/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.cc
@@ -24,7 +24,7 @@ return thread_id_; } -blink::ThreadScheduler* WebThreadImplForRendererScheduler::Scheduler() const { +blink::ThreadScheduler* WebThreadImplForRendererScheduler::Scheduler() { return scheduler_; }
diff --git a/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.h b/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.h index d1d8f46..2bf7bd1 100644 --- a/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/renderer/webthread_impl_for_renderer_scheduler.h
@@ -26,7 +26,7 @@ ~WebThreadImplForRendererScheduler() override; // WebThread implementation. - ThreadScheduler* Scheduler() const override; + ThreadScheduler* Scheduler() override; PlatformThreadId ThreadId() const override; scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const override;
diff --git a/third_party/blink/renderer/platform/supplementable.h b/third_party/blink/renderer/platform/supplementable.h index 356a674e..155fc00 100644 --- a/third_party/blink/renderer/platform/supplementable.h +++ b/third_party/blink/renderer/platform/supplementable.h
@@ -40,6 +40,16 @@ // What you should know about Supplementable and Supplement // ======================================================== +// Supplementable allows a garbage-collected object to be extended with +// additional data. +// +// Most commonly, this is used to attach data to a central object, such as +// LocalFrame, so that it can be easily accessed. This is similar to adding a +// member to that class (e.g. it is kept alive while the supplementable is), +// except that it occupies less memory if not used, and can be done in cases +// that would otherwise be a layering violation. For example, it is common for +// features implemented in modules/ to supplement classes in core/. +// // Supplementable and Supplement instances are meant to be thread local. They // should only be accessed from within the thread that created them. The // 2 classes are not designed for safe access from another thread. Violating
diff --git a/third_party/blink/renderer/platform/testing/testing_platform_support_with_custom_scheduler.cc b/third_party/blink/renderer/platform/testing/testing_platform_support_with_custom_scheduler.cc index 01af9a3..dfc26986 100644 --- a/third_party/blink/renderer/platform/testing/testing_platform_support_with_custom_scheduler.cc +++ b/third_party/blink/renderer/platform/testing/testing_platform_support_with_custom_scheduler.cc
@@ -21,7 +21,7 @@ DCHECK(WTF::IsMainThread()); return true; } - ThreadScheduler* Scheduler() const override { return scheduler_; } + ThreadScheduler* Scheduler() override { return scheduler_; } private: ThreadScheduler* scheduler_;
diff --git a/third_party/blink/renderer/platform/wtf/std_lib_extras.h b/third_party/blink/renderer/platform/wtf/std_lib_extras.h index c17bbec..94f9924f 100644 --- a/third_party/blink/renderer/platform/wtf/std_lib_extras.h +++ b/third_party/blink/renderer/platform/wtf/std_lib_extras.h
@@ -49,9 +49,7 @@ // Use |DEFINE_STATIC_LOCAL()| to declare and define a static local variable // (|static T;|) so that it is leaked and its destructors are not called at -// exit. T may also be a Blink garbage collected object, in which case it is -// wrapped up by an off-heap |Persistent<T>| reference to the object, keeping -// it alive across GCs. +// exit. // // A |DEFINE_STATIC_LOCAL()| static should only be used on the thread it was // created on. @@ -68,8 +66,6 @@ DEFINE_STATIC_LOCAL_IMPL(Type, Name, Arguments, true) namespace blink { -template <typename T> -class Persistent; } // namespace blink @@ -78,30 +74,13 @@ template <typename Type> class StaticSingleton final { public: - template <typename T, - bool = WTF::IsGarbageCollectedType<T>::value && - !WTF::IsPersistentReferenceType<T>::value> + template <typename T> struct Wrapper { using type = T; static T& Unwrap(T* singleton) { return *singleton; } }; - template <typename T> - struct Wrapper<T, true> { - using type = blink::Persistent<T>; - - static T& Unwrap(blink::Persistent<T>* singleton) { - DCHECK(singleton); - // If this assert triggers, you're supplying an empty ("()") 'Arguments' - // argument to DEFINE_STATIC_LOCAL() - it must be the heap object you wish - // to create as a static singleton and wrapped up with a Persistent - // reference. - DCHECK(*singleton); - return **singleton; - } - }; - using WrapperType = typename Wrapper<Type>::type; // To cooperate with leak detection(LSan) for Blink garbage collected objects, @@ -120,6 +99,8 @@ thread_(WTF::internal::CurrentThreadSyscall()) #endif { + static_assert(!WTF::IsGarbageCollectedType<Type>::value, + "Garbage collected objects must be wrapped in a Persistent"); LEAK_SANITIZER_REGISTER_STATIC_LOCAL(WrapperType, instance_.Get()); }
diff --git a/third_party/blink/tools/audit_non_blink_usage.py b/third_party/blink/tools/audit_non_blink_usage.py index acd308d..9ca4a03 100755 --- a/third_party/blink/tools/audit_non_blink_usage.py +++ b/third_party/blink/tools/audit_non_blink_usage.py
@@ -213,12 +213,10 @@ 'skia::.+', 'url::.+', - # Nested namespace under the blink namespace for CSSValue classes. + # Nested namespaces under the blink namespace 'cssvalue::.+', - - # Scheduler code lives in the scheduler namespace for historical - # reasons. 'scheduler::.+', + 'xpath::.+', # Third-party libraries that don't depend on non-Blink Chrome code # are OK.
diff --git a/third_party/fuchsia-sdk/BUILD.gn b/third_party/fuchsia-sdk/BUILD.gn index 19b0fa5..704e8f4 100644 --- a/third_party/fuchsia-sdk/BUILD.gn +++ b/third_party/fuchsia-sdk/BUILD.gn
@@ -153,6 +153,157 @@ ] } +fuchsia_sdk_fidl_pkg("fonts") { + namespace = "fuchsia" + namespace_path = "fuchsia" + sources = [ + "font_provider.fidl", + ] + deps = [ + ":mem", + ] +} + +fuchsia_sdk_fidl_pkg("gfx") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + sources = [ + "commands.fidl", + "display_info.fidl", + "events.fidl", + "hit.fidl", + "nodes.fidl", + "renderer.fidl", + "resources.fidl", + "shapes.fidl", + "types.fidl", + ] + deps = [ + ":images", + ":mem", + ":vectorial", + ] +} + +fuchsia_sdk_fidl_pkg("images") { + namespace = "fuchsia" + namespace_path = "fuchsia" + sources = [ + "encoded_image.fidl", + "image_info.fidl", + "image_pipe.fidl", + "memory_type.fidl", + "presentation_info.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("input") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + sources = [ + "commands.fidl", + "ime_service.fidl", + "input_connection.fidl", + "input_device_registry.fidl", + "input_dispatcher.fidl", + "input_event_constants.fidl", + "input_events.fidl", + "input_reports.fidl", + "text_editing.fidl", + "text_input.fidl", + "usages.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("math") { + namespace = "fuchsia" + namespace_path = "fuchsia" + sources = [ + "math.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("media") { + namespace = "fuchsia" + namespace_path = "fuchsia" + + sources = [ + "audio.fidl", + "audio_device_enumerator.fidl", + "audio_in.fidl", + "audio_out.fidl", + "gain_control.fidl", + "stream.fidl", + "stream_type.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("mem") { + namespace = "fuchsia" + namespace_path = "fuchsia" + + sources = [ + "buffer.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("netstack") { + namespace = "fuchsia" + namespace_path = "fuchsia" + + sources = [ + "net_address.fidl", + "netstack.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("oldhttp") { + namespace = "fuchsia.net" + namespace_path = "fuchsia/net" + sources = [ + "http_error.fidl", + "http_header.fidl", + "http_service.fidl", + "url_body.fidl", + "url_loader.fidl", + "url_request.fidl", + "url_response.fidl", + ] + deps = [ + ":mem", + ] +} + +fuchsia_sdk_fidl_pkg("policy") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + sources = [ + "display_usage.fidl", + "presentation.fidl", + "presenter.fidl", + ] + deps = [ + ":viewsv1", + ] +} + +fuchsia_sdk_fidl_pkg("scenic") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + sources = [ + "commands.fidl", + "events.fidl", + "scenic.fidl", + "session.fidl", + ] + deps = [ + ":gfx", + ":input", + ":sys", + ":views", + ] +} + fuchsia_sdk_pkg("svc") { sources = [ "include/lib/svc/dir.h", @@ -161,6 +312,79 @@ libs = [ "svc" ] } +fuchsia_sdk_fidl_pkg("sys") { + namespace = "fuchsia" + namespace_path = "fuchsia" + + sources = [ + "component_controller.fidl", + "environment.fidl", + "environment_controller.fidl", + "flat_namespace.fidl", + "launcher.fidl", + "loader.fidl", + "runner.fidl", + "service_provider.fidl", + ] + deps = [ + ":mem", + ] +} + +fuchsia_sdk_fidl_pkg("vectorial") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + sources = [ + "commands.fidl", + "events.fidl", + ] +} + +fuchsia_sdk_fidl_pkg("views") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + + sources = [ + "commands.fidl", + "events.fidl", + ] + deps = [ + ":gfx", + ":images", + ] +} + +fuchsia_sdk_fidl_pkg("viewsv1") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + + sources = [ + "view_containers.fidl", + "view_manager.fidl", + "view_properties.fidl", + "view_provider.fidl", + "view_tree_token.fidl", + "view_trees.fidl", + "views.fidl", + ] + deps = [ + ":gfx", + ":images", + ":math", + ":scenic", + ":viewsv1token", + ] +} + +fuchsia_sdk_fidl_pkg("viewsv1token") { + namespace = "fuchsia.ui" + namespace_path = "fuchsia/ui" + + sources = [ + "view_token.fidl", + ] +} + fuchsia_sdk_pkg("zx") { sources = [ "channel.cpp",
diff --git a/third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni b/third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni index 042fa12..b9b10054 100644 --- a/third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni +++ b/third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni
@@ -13,7 +13,8 @@ # Parameters: # package_name - Name of the library. target_name is used if name # is not specified explicitly. -# namespace - FIDL namespace. +# namespace, namespace_path - FIDL namespace. See fidl_library.gni +# for details. # sources - List of sources relative to sdk/fidl/${name}. # deps - List of dependencies. template("fuchsia_sdk_fidl_pkg") { @@ -34,10 +35,20 @@ library_name = _package_name if (defined(invoker.namespace)) { + assert(defined(invoker.namespace_path), + "SDK packages with namespace must specify namespace_path") namespace = invoker.namespace + namespace_path = invoker.namespace_path + + _library_name = "${namespace}.${_package_name}" + } else { + _library_name = _package_name } - sources = invoker.sources + sources = [] + foreach(file, invoker.sources) { + sources += [ "sdk/fidl/${_library_name}/${file}" ] + } } }
diff --git a/third_party/fuchsia-sdk/gen_build_defs.py b/third_party/fuchsia-sdk/gen_build_defs.py deleted file mode 100755 index 28a1fa3..0000000 --- a/third_party/fuchsia-sdk/gen_build_defs.py +++ /dev/null
@@ -1,105 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 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. -# -# Generates a single BUILD.gn file with build targets generated using the -# manifest files in the SDK. - -import json -import os -import subprocess -import sys - - -# Inserted at the top of the generated BUILD.gn file. -_GENERATED_PREAMBLE = """# DO NOT EDIT! This file was generated by -# //third_party/fuchsia-sdk/gen_build_defs.py. -# Any changes made to this file will be discarded. - -import("//third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni") - -""" - - -def SerializeListOfStrings(strings): - """Outputs a list of strings in GN-friendly, double-quoted format.""" - - return '[' + ','.join(['"{}"'.format(s) for s in strings]) + ']' - - -def ConvertFidlLibrary(json): - """Massages the manifest data to match the format required by the GN build - and outputs a GN target for the FIDL library - - Arguments: - json: The parsed manifest JSON. - Returns: - The GN target definition, represented as a string.""" - - json['deps'] = SerializeListOfStrings( - [':' + dep.split('.')[-1] for dep in json['deps']]) - json['sources'] = SerializeListOfStrings(json['sources']) - - name_tokenized = json['name'].split('.') - json['shortname'] = name_tokenized[-1] - json['namespace'] = '.'.join(name_tokenized[:-1]) - - return """fuchsia_sdk_fidl_pkg("{shortname}") {{ - namespace = "{namespace}" - public_deps = {deps} - sources = {sources} - }}""".format(**json) - - -def ConvertNoOp(json): - """Null implementation of a conversion function. No output is generated.""" - - return "" - - -"""Maps manifest type strings to relevant conversion functions.""" -_CONVERSION_FUNCTION_MAP = { - 'fidl_library': ConvertFidlLibrary, - - # TODO(888753): Add conversion routines for these manifest types and migrate - # existing dependents of //third_party/fuchsia_sdk/BUILD.gn to use the - # generated targets instead. The migration can be executed incrementally. - 'cc_source_library': ConvertNoOp, - 'cc_prebuilt_library': ConvertNoOp, - 'host_tool': ConvertNoOp, - 'image': ConvertNoOp, - 'loadable_module': ConvertNoOp, - 'sysroot': ConvertNoOp, -} - - -def ConvertSdkManifests(): - sdk_base_dir = os.path.join(os.path.dirname(__file__), 'sdk') - toplevel_meta = json.load(open(os.path.join(sdk_base_dir, 'meta', - 'manifest.json'))) - - build_output_path = os.path.join(sdk_base_dir, 'BUILD.gn') - with open(build_output_path, 'w') as buildfile: - buildfile.write(_GENERATED_PREAMBLE) - - for next_part in toplevel_meta['parts']: - parsed = json.load(open(os.path.join(sdk_base_dir, next_part))) - if 'type' not in parsed: - raise Exception("Couldn't find 'type' node in %s." % next_part) - - convert_function = _CONVERSION_FUNCTION_MAP.get(parsed['type']) - if convert_function is None: - raise Exception('Unexpected SDK artifact type %s in %s.' % - (parsed['type'], next_part)) - buildfile.write(convert_function(parsed)) - - # Use 'gn format' to make the buildfile readable. - gn_path = os.path.join(os.path.dirname(__file__), os.path.pardir, - os.path.pardir, 'buildtools', 'linux64', 'gn') - subprocess.check_call([gn_path, 'format', build_output_path], - stdout=open(os.devnull)) - - -if __name__ == '__main__': - sys.exit(ConvertSdkManifests())
diff --git a/third_party/libprotobuf-mutator/BUILD.gn b/third_party/libprotobuf-mutator/BUILD.gn index c329eaf..4f38f0c 100644 --- a/third_party/libprotobuf-mutator/BUILD.gn +++ b/third_party/libprotobuf-mutator/BUILD.gn
@@ -10,36 +10,32 @@ source_set("libprotobuf-mutator") { testonly = true - # Dont allow building on windows to avoid tryjob failure. This is OK since - # libFuzzer doesn't build on windows anyway. - if (!is_win) { - configs += [ ":include_config" ] + configs += [ ":include_config" ] - # Remove *San and coverage for a performance boost. - configs -= not_fuzzed_remove_configs - configs += [ "//build/config/sanitizers:not_fuzzed" ] + # Remove *San and coverage for a performance boost. + configs -= not_fuzzed_remove_configs + configs += [ "//build/config/sanitizers:not_fuzzed" ] - public_configs = [ ":include_config" ] - sources = [ - "src/src/binary_format.cc", - "src/src/libfuzzer/libfuzzer_macro.cc", - "src/src/libfuzzer/libfuzzer_mutator.cc", - "src/src/mutator.cc", - "src/src/text_format.cc", - "src/src/utf8_fix.cc", - ] + public_configs = [ ":include_config" ] + sources = [ + "src/src/binary_format.cc", + "src/src/libfuzzer/libfuzzer_macro.cc", + "src/src/libfuzzer/libfuzzer_mutator.cc", + "src/src/mutator.cc", + "src/src/text_format.cc", + "src/src/utf8_fix.cc", + ] - # Allow users of LPM to use protobuf reflection and other features from - # protobuf_full. - public_deps = [ - "//third_party/protobuf:protobuf_full", - ] + # Allow users of LPM to use protobuf reflection and other features from + # protobuf_full. + public_deps = [ + "//third_party/protobuf:protobuf_full", + ] - # Let ClusterFuzz builders know to not build targets that depend on - # libprotobuf-mutator for AFL. - if (use_afl) { - all_dependent_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] - } + # Let ClusterFuzz builders know to not build targets that depend on + # libprotobuf-mutator for AFL. + if (use_afl) { + all_dependent_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] } }
diff --git a/third_party/webrtc_overrides/BUILD.gn b/third_party/webrtc_overrides/BUILD.gn index 4695e6bf..7923d5de 100644 --- a/third_party/webrtc_overrides/BUILD.gn +++ b/third_party/webrtc_overrides/BUILD.gn
@@ -57,19 +57,17 @@ cflags = [ "/wd4005" ] } + # When WebRTC is built as part of Chromium it should exclude the default + # implementation of field_trial unless it is building for NACL or Chromecast. + # This configuration happens here: + # https://cs.chromium.org/chromium/src/third_party/webrtc/webrtc.gni?l=44-51&rcl=95c56eebe0a2b31ad5752138d15b431124e17d36 if (is_nacl) { - # For NACL, we have to add a default implementation for field_trial and - # runtime_enabled_features. deps += [ "//native_client_sdk/src/libraries/nacl_io", - "//third_party/webrtc/system_wrappers:field_trial_default", "//third_party/webrtc/system_wrappers:runtime_enabled_features_default", ] } else if (is_chromecast) { - # Cast builds use the default implementation for field_trial and - # runtime_enabled_features. deps += [ - "//third_party/webrtc/system_wrappers:field_trial_default", "//third_party/webrtc/system_wrappers:runtime_enabled_features_default", ] } else {
diff --git a/third_party/widevine/cdm/BUILD.gn b/third_party/widevine/cdm/BUILD.gn index 55b471ea..6f8f50c3 100644 --- a/third_party/widevine/cdm/BUILD.gn +++ b/third_party/widevine/cdm/BUILD.gn
@@ -2,17 +2,21 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/buildflag_header.gni") import("//build/config/chrome_build.gni") import("//build/config/features.gni") import("//media/cdm/library_cdm/cdm_paths.gni") import("//media/media_options.gni") import("//third_party/widevine/cdm/widevine.gni") -# Internal Cast builds set enable_widevine=true to bring in Widevine support. -# TODO(xhwang): Support component updated CDM on other platforms and remove this -# assert. -assert(!enable_widevine || is_win || is_mac || is_chromecast, - "Component updated CDM only supported on Windows and Mac for now.") +buildflag_header("buildflags") { + header = "buildflags.h" + + flags = [ + "ENABLE_WIDEVINE=$enable_widevine", + "SHOULD_BUNDLE_WIDEVINE_CDM=$should_bundle_widevine_cdm", + ] +} widevine_arch = current_cpu if (widevine_arch == "x86") { @@ -22,6 +26,8 @@ widevine_cdm_binary_files = [] widevine_cdm_manifest_file = [] +# TODO(xhwang): widevine_cdm_version.h is only used in few places. Clean this up +# so we don't need to copy it in most cases. if (should_bundle_widevine_cdm) { if (is_chromeos) { widevine_cdm_version_h_file = @@ -44,13 +50,6 @@ } else { assert(false, "Platform not supported to bundle Widevine CDM.") } -} else if (is_android) { - # Always available on Android regardless of branding. - widevine_cdm_version_h_file = "android/widevine_cdm_version.h" -} else if (enable_widevine) { - # TODO(crbug.com/349182): Remove after we replace WIDEVINE_CDM_AVAILABLE with - # ENABLE_WIDEVINE build flag. - widevine_cdm_version_h_file = "stub/widevine_cdm_version.h" } else { # No branding, use the default one. widevine_cdm_version_h_file = "widevine_cdm_version.h" @@ -126,6 +125,7 @@ ":widevine_cdm_binary", ":widevine_cdm_manifest", ] + # Needed at build time e.g. for mac bundle (//chrome:chrome_framework). public_deps = [ ":widevine_cdm_binary",
diff --git a/third_party/widevine/cdm/android/widevine_cdm_version.h b/third_party/widevine/cdm/android/widevine_cdm_version.h deleted file mode 100644 index 98e6bde..0000000 --- a/third_party/widevine/cdm/android/widevine_cdm_version.h +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright (c) 2013 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 WIDEVINE_CDM_VERSION_H_ -#define WIDEVINE_CDM_VERSION_H_ - -// Indicates that the Widevine CDM is available. -#define WIDEVINE_CDM_AVAILABLE - -#endif // WIDEVINE_CDM_VERSION_H_
diff --git a/third_party/widevine/cdm/stub/widevine_cdm_version.h b/third_party/widevine/cdm/stub/widevine_cdm_version.h deleted file mode 100644 index 659683b..0000000 --- a/third_party/widevine/cdm/stub/widevine_cdm_version.h +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright (c) 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. - -// This is a stand-in for a generated file that is available when the -// Widevine CDM is available. - -#ifndef WIDEVINE_CDM_VERSION_H_ -#define WIDEVINE_CDM_VERSION_H_ - -#include "third_party/widevine/cdm/widevine_cdm_common.h" - -#define WIDEVINE_CDM_AVAILABLE - -#endif // WIDEVINE_CDM_VERSION_H_
diff --git a/third_party/widevine/cdm/widevine.gni b/third_party/widevine/cdm/widevine.gni index 35de2ec..15c8328 100644 --- a/third_party/widevine/cdm/widevine.gni +++ b/third_party/widevine/cdm/widevine.gni
@@ -6,17 +6,18 @@ import("//media/media_options.gni") declare_args() { - # Allow Widevine key system support in Chromium. - enable_widevine = false + # Enables Widevine key system support. Enabled by default in Google Chrome or + # on Android. Can be optionally enabled in Chromium. + enable_widevine = is_chrome_branded || is_android } enable_widevine_cdm_host_verification = - (is_chrome_branded || enable_widevine) && enable_cdm_host_verification + enable_widevine && enable_cdm_host_verification # Only bundle Widevine CDM in Google Chrome builds. # TODO: Provide prebuilt libraries for ARM64. -should_bundle_widevine_cdm = - is_chrome_branded && enable_library_cdms && target_cpu != "arm64" +should_bundle_widevine_cdm = enable_widevine && is_chrome_branded && + enable_library_cdms && target_cpu != "arm64" template("widevine_sign_file") { # For official builds, generate a signature file for |file| which will
diff --git a/third_party/widevine/cdm/widevine_cdm_version.h b/third_party/widevine/cdm/widevine_cdm_version.h index 08aa5b9..dd6efed0 100644 --- a/third_party/widevine/cdm/widevine_cdm_version.h +++ b/third_party/widevine/cdm/widevine_cdm_version.h
@@ -8,9 +8,7 @@ #ifndef WIDEVINE_CDM_VERSION_H_ #define WIDEVINE_CDM_VERSION_H_ -// If the Widevine CDM were available, we would include -// third_party/widevine/cdm/widevine_cdm_common.h and define two things: -// - WIDEVINE_CDM_AVAILABLE (to indicate availability), and +// If the Widevine CDM is available define the following: // - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available // as a string, e.g., "1.0.123.456").
diff --git a/tools/binary_size/libsupersize/generate_milestone_report.py b/tools/binary_size/libsupersize/generate_milestone_report.py index eb13d7ce..02b0608 100755 --- a/tools/binary_size/libsupersize/generate_milestone_report.py +++ b/tools/binary_size/libsupersize/generate_milestone_report.py
@@ -36,6 +36,8 @@ import re import subprocess +import archive +import diff import html_report @@ -109,10 +111,12 @@ yield report -def _FetchSizeFile(path): - if path is None: - return None - return cStringIO.StringIO(subprocess.check_output(['gsutil.py', 'cat', path])) +def _SizeInfoFromGsPath(path): + size_contents = subprocess.check_output(['gsutil.py', 'cat', path]) + file_obj = cStringIO.StringIO(size_contents) + ret = archive.LoadAndPostProcessSizeInfo(path, file_obj=file_obj) + file_obj.close() + return ret def _PossibleReportFiles(): @@ -163,18 +167,11 @@ if e.errno != errno.EEXIST: raise - before_file = _FetchSizeFile(before_size_path) # May be None. - after_file = _FetchSizeFile(after_size_path) - with codecs.open(outpath, 'w', encoding='ascii') as out_file: - html_report.BuildReport( - out_file, - size_file=(after_size_path, after_file), - before_size_file=(before_size_path, before_file), - all_symbols=True, - ) - if before_file is not None: - before_file.close() - after_file.close() + size_info = _SizeInfoFromGsPath(after_size_path) + if before_size_path: + size_info = diff.Diff(_SizeInfoFromGsPath(before_size_path), size_info) + + html_report.BuildReportFromSizeInfo(outpath, size_info, all_symbols=True) return outpath
diff --git a/tools/fuchsia/local-sdk.py b/tools/fuchsia/local-sdk.py index e6997a20..e5974d0 100755 --- a/tools/fuchsia/local-sdk.py +++ b/tools/fuchsia/local-sdk.py
@@ -91,10 +91,6 @@ shutil.rmtree(tempdir) os.chdir(original_dir) - subprocess.check_call([os.path.join(REPOSITORY_ROOT, 'third_party', - 'fuchsia-sdk', - 'gen_build_defs.py')]) - return 0
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 54351111..5be3888 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -9932,6 +9932,11 @@ </description> </action> +<action name="ManagementPageViewed"> + <owner>hunyadym@chromium.org</owner> + <description>The chrome://management page was viewed.</description> +</action> + <action name="MaxButton_Clk_ExitFS"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 8f4318f..66c20436 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -9908,6 +9908,71 @@ </summary> </histogram> +<histogram name="BlinkGC.SlowIncrementalMarkingFinalize.AtomicPhaseMarking" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of finishing marking the transitive closure of objects during the + final Blink garbage collection pause. Only recorded when incremental marking + finalization took at least 40ms. + </summary> +</histogram> + +<histogram name="BlinkGC.SlowIncrementalMarkingFinalize.EagerSweep" units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time taken to run eager sweep finalizers finalizers. Only + recorded when incremental marking finalization took at least 40ms. + </summary> +</histogram> + +<histogram + name="BlinkGC.SlowIncrementalMarkingFinalize.IncrementalMarkingFinalize" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time for incremental marking finalization. Only recorded when + incremental marking finalization took at least 40ms. + </summary> +</histogram> + +<histogram name="BlinkGC.SlowIncrementalMarkingFinalize.InvokePreFinalizers" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time taken to invoke pre finalizers. Only recorded when + incremental marking finalization took at least 40ms. + </summary> +</histogram> + +<histogram name="BlinkGC.SlowIncrementalMarkingFinalize.MarkWeakProcessing" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time taken for weak processing. Only recorded when incremental + marking finalization took at least 40ms. + </summary> +</histogram> + +<histogram + name="BlinkGC.SlowIncrementalMarkingFinalize.VisitCrossThreadPersistents" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time taken to visit cross thread persistents. Only recorded when + incremental marking finalization took at least 40ms. + </summary> +</histogram> + +<histogram name="BlinkGC.SlowIncrementalMarkingFinalize.VisitDOMWrappers" + units="ms"> + <owner>oilpan-reviews@chromium.org</owner> + <summary> + Duration of time taken to visit DOM wrappers. Only recorded when incremental + marking finalization took at least 40ms. + </summary> +</histogram> + <histogram name="BlinkGC.TimeForCoalesce" units="ms"> <owner>haraken@chromium.org</owner> <owner>hpayer@chromium.org</owner> @@ -103507,28 +103572,6 @@ </summary> </histogram> -<histogram name="Sync.AppsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during app association.</summary> -</histogram> - -<histogram name="Sync.AppsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of app configuration failures.</summary> -</histogram> - -<histogram name="Sync.AppSettingsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during app settings association.</summary> -</histogram> - -<histogram name="Sync.AppSettingsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of app settings configuration failures. - </summary> -</histogram> - <histogram name="Sync.AppSettingsStartFailure" enum="SyncStartResult"> <obsolete> Replaced by AppSettingsConfigureFailure. See crbug.com/478226. @@ -103556,6 +103599,13 @@ </summary> </histogram> +<histogram base="true" name="Sync.AssociationTime" units="ms" + expires_after="2019-10-01"> + <owner>jkrcal@chromium.org</owner> + <owner>mastiz@chromium.org</owner> + <summary>Time taken during association of this data type.</summary> +</histogram> + <histogram name="Sync.Attachments.DownloadChecksumResult" enum="BooleanMatched"> <obsolete> Deprecated 2018-04, Sync attachments were never launched. @@ -103661,17 +103711,10 @@ </summary> </histogram> -<histogram name="Sync.AutofillAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during autofill association.</summary> -</histogram> - -<histogram name="Sync.AutofillConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of autofill configuration failures.</summary> -</histogram> - <histogram name="Sync.AutofillProfileAssociationTime" units="ms"> + <obsolete> + Replaced by Sync.AutofillProfilesAssociationTime. + </obsolete> <owner>zea@chromium.org</owner> <summary> Time taken during autofill profile association (M18 and earlier were @@ -103691,19 +103734,6 @@ </summary> </histogram> -<histogram name="Sync.AutofillProfilesAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during autofill profile association.</summary> -</histogram> - -<histogram name="Sync.AutofillProfilesConfigureFailure" - enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of autofill profile configuration failures. - </summary> -</histogram> - <histogram name="Sync.AutofillProfilesStartFailure" enum="SyncStartResult"> <obsolete> Replaced by AutofillProfilesConfigureFailure. See crbug.com/478226. @@ -103825,16 +103855,6 @@ </summary> </histogram> -<histogram name="Sync.BookmarksAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during bookmark association.</summary> -</histogram> - -<histogram name="Sync.BookmarksConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of bookmark configuration failures.</summary> -</histogram> - <histogram name="Sync.BookmarksDuplicationsAtAssociation"> <owner>stanisc@chromium.org</owner> <summary> @@ -103914,6 +103934,15 @@ <summary>Count of model association failures for each type.</summary> </histogram> +<histogram base="true" name="Sync.ConfigureFailure" enum="SyncConfigureResult" + expires_after="2020-04-01"> + <owner>jkrcal@chromium.org</owner> + <owner>mastiz@chromium.org</owner> + <summary> + Enumeration of types of configuration failures of this data type. + </summary> +</histogram> + <histogram name="Sync.ConfigureTime.ABORTED" units="ms"> <obsolete> Replaced by Sync.ConfigureTime_Long.ABORTED in m21. @@ -104185,16 +104214,6 @@ </summary> </histogram> -<histogram name="Sync.DictionaryAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during dictionary association.</summary> -</histogram> - -<histogram name="Sync.DictionaryConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of dictionary configuration failures.</summary> -</histogram> - <histogram name="Sync.DictionaryStartFailure" enum="SyncStartResult"> <obsolete> Replaced by DictionaryConfigureFailure. See crbug.com/478226. @@ -104315,29 +104334,6 @@ </summary> </histogram> -<histogram name="Sync.ExtensionsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during extension association.</summary> -</histogram> - -<histogram name="Sync.ExtensionsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of extension configuration failures.</summary> -</histogram> - -<histogram name="Sync.ExtensionSettingsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during extension settings association.</summary> -</histogram> - -<histogram name="Sync.ExtensionSettingsConfigureFailure" - enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of extension settings configuration failures. - </summary> -</histogram> - <histogram name="Sync.ExtensionSettingsStartFailure" enum="SyncStartResult"> <obsolete> Replaced by ExtensionSettingsConfigureFailure. See crbug.com/478226. @@ -104393,18 +104389,6 @@ <summary>Number of synced favicons at initialization time.</summary> </histogram> -<histogram name="Sync.FaviconImagesAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during favicon images association.</summary> -</histogram> - -<histogram name="Sync.FaviconImagesConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of favicon images configuration failures. - </summary> -</histogram> - <histogram name="Sync.FaviconImagesStartFailure" enum="SyncStartResult"> <obsolete> Replaced by FaviconImagesConfigureFailure. See crbug.com/478226. @@ -104426,19 +104410,6 @@ </summary> </histogram> -<histogram name="Sync.FaviconTrackingAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during favicon tracking association.</summary> -</histogram> - -<histogram name="Sync.FaviconTrackingConfigureFailure" - enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of favicon tracking configuration failures. - </summary> -</histogram> - <histogram name="Sync.FaviconTrackingStartFailure" enum="SyncStartResult"> <obsolete> Replaced by FaviconTrackingConfigureFailure. See crbug.com/478226. @@ -105094,16 +105065,6 @@ </summary> </histogram> -<histogram name="Sync.PasswordsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during password association.</summary> -</histogram> - -<histogram name="Sync.PasswordsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of password configuration failures.</summary> -</histogram> - <histogram name="Sync.PasswordsStartFailure" enum="SyncStartResult"> <obsolete> Replaced by PasswordsConfigureFailure. See crbug.com/478226. @@ -105177,16 +105138,6 @@ </summary> </histogram> -<histogram name="Sync.PreferencesAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during preference association.</summary> -</histogram> - -<histogram name="Sync.PreferencesConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of preference configuration failures.</summary> -</histogram> - <histogram name="Sync.PreferencesStartFailure" enum="SyncStartResult"> <obsolete> Replaced by PreferencesConfigureFailure. See crbug.com/478226. @@ -105305,18 +105256,6 @@ </summary> </histogram> -<histogram name="Sync.SearchEnginesAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during search engine association.</summary> -</histogram> - -<histogram name="Sync.SearchEnginesConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of search engine configuration failures. - </summary> -</histogram> - <histogram name="Sync.SearchEnginesStartFailure" enum="SyncStartResult"> <obsolete> Replaced by SearchEnginesConfigureFailure. See crbug.com/478226. @@ -105372,11 +105311,6 @@ </summary> </histogram> -<histogram name="Sync.SessionsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during session association.</summary> -</histogram> - <histogram name="Sync.SessionsBadForeignHashOnMergeCount" units="Sessions Entries"> <owner>skym@chromium.org</owner> @@ -105387,11 +105321,6 @@ </summary> </histogram> -<histogram name="Sync.SessionsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of session configuration failures.</summary> -</histogram> - <histogram name="Sync.SessionsRefreshDelay" units="ms"> <owner>zea@chromium.org</owner> <summary> @@ -105534,25 +105463,6 @@ </summary> </histogram> -<histogram name="Sync.SyncedNotificationsAssociationTime" units="ms"> - <obsolete> - Deprecated in M53. - </obsolete> - <owner>zea@chromium.org</owner> - <summary>Time taken during synced notifications association.</summary> -</histogram> - -<histogram name="Sync.SyncedNotificationsConfigureFailure" - enum="SyncConfigureResult"> - <obsolete> - Deprecated in M53. - </obsolete> - <owner>zea@chromium.org</owner> - <summary> - Enumeration of types of synced notifications configuration failures. - </summary> -</histogram> - <histogram name="Sync.SyncedNotificationsStartFailure" enum="SyncStartResult"> <obsolete> Deprecated in M53. Replaced by SyncedNotificationsConfigureFailure. See @@ -105615,16 +105525,6 @@ </summary> </histogram> -<histogram name="Sync.ThemesAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during theme association.</summary> -</histogram> - -<histogram name="Sync.ThemesConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of theme configuration failures.</summary> -</histogram> - <histogram name="Sync.ThemesStartFailure" enum="SyncStartResult"> <obsolete> Replaced by ThemesConfigureFailure. See crbug.com/478226. @@ -105699,16 +105599,6 @@ </summary> </histogram> -<histogram name="Sync.TypedUrlsAssociationTime" units="ms"> - <owner>zea@chromium.org</owner> - <summary>Time taken during typed url association.</summary> -</histogram> - -<histogram name="Sync.TypedUrlsConfigureFailure" enum="SyncConfigureResult"> - <owner>zea@chromium.org</owner> - <summary>Enumeration of types of typed url configuration failures.</summary> -</histogram> - <histogram name="Sync.TypedUrlsStartFailure" enum="SyncStartResult"> <obsolete> Replaced by TypedUrlsConfigureFailure. See crbug.com/478226. @@ -132138,9 +132028,18 @@ <histogram_suffixes name="SyncModelType" separator="."> <suffix name="APP" label="APP"/> <suffix name="APP_LIST" label="APP_LIST"/> - <suffix name="APP_NOTIFICATION" label="APP_NOTIFICATION"/> + <suffix name="APP_NOTIFICATION" label="APP_NOTIFICATION"> + <obsolete> + Deprecated 2/2017. + </obsolete> + </suffix> <suffix name="APP_SETTING" label="APP_SETTING"/> - <suffix name="ARTICLE" label="ARTICLE"/> + <suffix name="ARC_PACKAGE" label="ARC_PACKAGE"/> + <suffix name="ARTICLE" label="ARTICLE"> + <obsolete> + Deprecated 7/2018. + </obsolete> + </suffix> <suffix name="AUTOFILL" label="AUTOFILL"/> <suffix name="AUTOFILL_PROFILE" label="AUTOFILL_PROFILE"/> <suffix name="AUTOFILL_WALLET" label="AUTOFILL_WALLET"/> @@ -132154,21 +132053,40 @@ <suffix name="FAVICON_IMAGE" label="FAVICON_IMAGE"/> <suffix name="FAVICON_TRACKING" label="FAVICON_TRACKING"/> <suffix name="HISTORY_DELETE_DIRECTIVE" label="HISTORY_DELETE_DIRECTIVE"/> - <suffix name="MANAGED_USER" label="MANAGED_USER"/> + <suffix name="MANAGED_USER" label="MANAGED_USER"> + <obsolete> + Deprecated 4/2018. + </obsolete> + </suffix> <suffix name="MANAGED_USER_SETTING" label="MANAGED_USER_SETTING"/> <suffix name="MANAGED_USER_SHARED_SETTING" - label="MANAGED_USER_SHARED_SETTING"/> + label="MANAGED_USER_SHARED_SETTING"> + <obsolete> + Deprecated 4/2018. + </obsolete> + </suffix> <suffix name="MANAGED_USER_WHITELIST" label="MANAGED_USER_WHITELIST"/> <suffix name="MOUNTAIN_SHARE" label="MOUNTAIN_SHARE"/> <suffix name="NIGORI" label="NIGORI"/> <suffix name="PASSWORD" label="PASSWORD"/> <suffix name="PREFERENCE" label="PREFERENCE"/> + <suffix name="PRINTERS" label="PRINTERS"/> <suffix name="PRIORITY_PREFERENCE" label="PRIORITY_PREFERENCE"/> + <suffix name="PROXY_TABS" label="PROXY_TABS"/> + <suffix name="READING_LIST" label="READING_LIST"/> <suffix name="SEARCH_ENGINE" label="SEARCH_ENGINE"/> <suffix name="SESSION" label="SESSION"/> - <suffix name="SYNCED_NOTIFICATION" label="SYNCED_NOTIFICATION"/> + <suffix name="SYNCED_NOTIFICATION" label="SYNCED_NOTIFICATION"> + <obsolete> + Deprecated in M53. + </obsolete> + </suffix> <suffix name="SYNCED_NOTIFICATION_APP_INFO" - label="SYNCED_NOTIFICATION_APP_INFO"/> + label="SYNCED_NOTIFICATION_APP_INFO"> + <obsolete> + Deprecated in M53. + </obsolete> + </suffix> <suffix name="THEME" label="THEME"/> <suffix name="TYPED_URL" label="TYPED_URL"/> <suffix name="USER_CONSENT" label="USER_CONSENT"/> @@ -132196,6 +132114,74 @@ <affected-histogram name="Sync.ModelTypeMemoryKB"/> </histogram_suffixes> +<histogram_suffixes name="SyncModelTypeByMacro" separator="" ordering="prefix"> + <suffix name="AppList" label="App list"/> + <suffix name="AppNotifications" label="App notifications"> + <obsolete> + Deprecated 2/2017. + </obsolete> + </suffix> + <suffix name="Apps" label="Apps"/> + <suffix name="AppSettings" label="App settings"/> + <suffix name="ArcPackage" label="Arc package"/> + <suffix name="Article" label="Article"> + <obsolete> + Deprecated 7/2018. + </obsolete> + </suffix> + <suffix name="Autofill" label="Autocomplete"/> + <suffix name="AutofillProfiles" label="Autofill profiles"/> + <suffix name="AutofillWallet" label="Autofill wallet"/> + <suffix name="AutofillWalletMetadata" label="Autofill wallet metadata"/> + <suffix name="Bookmarks" label="Bookmarks"/> + <suffix name="DeviceInfo" label="Device info"/> + <suffix name="Dictionary" label="Dictionary"/> + <suffix name="Experiments" label="Experiments"/> + <suffix name="Extensions" label="Extensions"/> + <suffix name="ExtensionSettings" label="Extension settings"/> + <suffix name="FaviconImages" label="Favicon images"/> + <suffix name="FaviconTracking" label="Favicon tracking"/> + <suffix name="HistoryDeleteDirectives" label="History delete directives"/> + <suffix name="ManagedUser" label="Managed user"> + <obsolete> + Deprecated 4/2018. + </obsolete> + </suffix> + <suffix name="ManagedUserSetting" label="Managed user setting"/> + <suffix name="ManagedUserSharedSetting" label="Managed user shared setting"> + <obsolete> + Deprecated 4/2018. + </obsolete> + </suffix> + <suffix name="ManagedUserWhitelist" label="Managed user whitelist"/> + <suffix name="MountainShares" label="Mountain shares"/> + <suffix name="Nigori" label="Nigori"/> + <suffix name="Passwords" label="Passwords"/> + <suffix name="Preferences" label="Preferences"/> + <suffix name="Printers" label="Printers"/> + <suffix name="PriorityPreferences" label="Priority preferences"/> + <suffix name="ReadingList" label="Reading list"/> + <suffix name="SearchEngines" label="Search engines"/> + <suffix name="Sessions" label="Sessions"/> + <suffix name="SyncedNotificationAppInfo" label="Synced notification app info"> + <obsolete> + Deprecated in M53. + </obsolete> + </suffix> + <suffix name="SyncedNotifications" label="Synced notifications"> + <obsolete> + Deprecated in M53. + </obsolete> + </suffix> + <suffix name="Themes" label="Themes"/> + <suffix name="TypedUrls" label="Typed urls"/> + <suffix name="UserConsents" label="User consents"/> + <suffix name="UserEvents" label="User events"/> + <suffix name="WifiCredentials" label="Wifi credentials"/> + <affected-histogram name="Sync.AssociationTime"/> + <affected-histogram name="Sync.ConfigureFailure"/> +</histogram_suffixes> + <histogram_suffixes name="SyzygyStartupTime" separator="_"> <obsolete> No longer logged.
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index 7b5a71f2..737d51c 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -137,9 +137,6 @@ # Benchmark: oortonline crbug.com/815181 [ Win ] oortonline_tbmv2/http://oortonline.gl/#run [ Skip ] -# Benchmark: power.typical_10_mobile -crbug.com/887546 [ Android ] power.typical_10_mobile/http://m.chiebukuro.yahoo.co.jp/detail/q10136829180 [ Skip ] - # Benchmark: rendering.desktop crbug.com/350692 [ All ] rendering.desktop/microsoft_performance [ Skip ] crbug.com/755556 [ Mac ] rendering.desktop/mix_blend_mode_animation_difference [ Skip ]
diff --git a/tools/perf/page_sets/data/system_health_desktop.json b/tools/perf/page_sets/data/system_health_desktop.json index 147fa5f..865a988 100644 --- a/tools/perf/page_sets/data/system_health_desktop.json +++ b/tools/perf/page_sets/data/system_health_desktop.json
@@ -240,6 +240,9 @@ "play:media:soundcloud": { "DEFAULT": "system_health_desktop_030.wprgo" }, + "play:media:soundcloud:2018": { + "DEFAULT": "system_health_desktop_57d9c71c88.wprgo" + }, "search:portal:google": { "DEFAULT": "system_health_desktop_022.wprgo" }
diff --git a/tools/perf/page_sets/data/system_health_desktop_57d9c71c88.wprgo.sha1 b/tools/perf/page_sets/data/system_health_desktop_57d9c71c88.wprgo.sha1 new file mode 100644 index 0000000..1eeff224 --- /dev/null +++ b/tools/perf/page_sets/data/system_health_desktop_57d9c71c88.wprgo.sha1
@@ -0,0 +1 @@ +57d9c71c88accb07a365fd975c3c8054eeb19880 \ No newline at end of file
diff --git a/tools/perf/page_sets/system_health/media_stories.py b/tools/perf/page_sets/system_health/media_stories.py index e3b432de..37f39b9 100644 --- a/tools/perf/page_sets/system_health/media_stories.py +++ b/tools/perf/page_sets/system_health/media_stories.py
@@ -88,7 +88,26 @@ STOP_SELECTOR = '.playControl.playControls__icon.sc-ir.playing' TIME_SELECTOR = '.playbackTimeline__timePassed>span[aria-hidden=true]' SEARCH_SELECTOR = '.headerSearch' - SEARCH_QUERY = 'SSmooth Jazz' # First S for some reason gets ommited. + SEARCH_QUERY = 'SSmooth Jazz' # First S for some reason gets omitted. + + def _NavigateToMedia(self, action_runner): + self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR) + action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. + action_runner.EnterText(self.SEARCH_QUERY) + action_runner.PressKey('Return') + + +class SoundCloudDesktopStory2018(_MediaStory): + """Load soundcloud.com, search for "Smooth Jazz", then play a song.""" + NAME = 'play:media:soundcloud:2018' + URL = 'https://soundcloud.com' + TAGS = [story_tags.YEAR_2018] + + PLAY_SELECTOR = '.sc-button-play.playButton.sc-button.sc-button-xlarge' + STOP_SELECTOR = '.playControl.sc-ir.playing' + TIME_SELECTOR = '.playbackTimeline__timePassed>span[aria-hidden=true]' + SEARCH_SELECTOR = '.headerSearch' + SEARCH_QUERY = 'SSmooth Jazz' # First S for some reason gets omitted. def _NavigateToMedia(self, action_runner): self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR)
diff --git a/ui/aura/mus/mus_mouse_location_updater.cc b/ui/aura/mus/mus_mouse_location_updater.cc index 32aa588..ce61eab4 100644 --- a/ui/aura/mus/mus_mouse_location_updater.cc +++ b/ui/aura/mus/mus_mouse_location_updater.cc
@@ -38,27 +38,17 @@ } void MusMouseLocationUpdater::OnEventProcessingStarted(const ui::Event& event) { - if (!IsMouseEventWithLocation(event) || - Env::GetInstance()->always_use_last_mouse_location_) { + Env* env = Env::GetInstance(); + if (!IsMouseEventWithLocation(event) || env->always_use_last_mouse_location_) return; - } is_processing_trigger_event_ = true; - gfx::Point location_in_screen = event.AsMouseEvent()->root_location(); // event.target() may not exist in some tests. - if (event.target()) { - aura::Window* root_window = - static_cast<aura::Window*>(event.target())->GetRootWindow(); - auto* screen_position_client = - aura::client::GetScreenPositionClient(root_window); - // screen_position_client may not exist in tests. - if (screen_position_client) { - screen_position_client->ConvertPointToScreen(root_window, - &location_in_screen); - } - } - Env::GetInstance()->SetLastMouseLocation(location_in_screen); - Env::GetInstance()->get_last_mouse_location_from_mus_ = false; + const gfx::Point screen_location = + event.target() ? event.target()->GetScreenLocation(*event.AsMouseEvent()) + : event.AsMouseEvent()->root_location(); + env->SetLastMouseLocation(screen_location); + env->get_last_mouse_location_from_mus_ = false; } void MusMouseLocationUpdater::OnEventProcessingFinished() {
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 8991ae7..a7dcd85 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc
@@ -1252,6 +1252,16 @@ static_cast<Window*>(target)); } +gfx::PointF Window::GetScreenLocationF(const ui::LocatedEvent& event) const { + DCHECK_EQ(this, event.target()); + gfx::PointF screen_location(event.root_location_f()); + const Window* root = GetRootWindow(); + auto* screen_position_client = aura::client::GetScreenPositionClient(root); + if (screen_position_client) + screen_position_client->ConvertPointToScreen(root, &screen_location); + return screen_location; +} + std::unique_ptr<ui::Layer> Window::RecreateLayer() { WindowOcclusionTracker::ScopedPauseOcclusionTracking pause_occlusion_tracking;
diff --git a/ui/aura/window.h b/ui/aura/window.h index 990924a..540bb3cc 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h
@@ -559,6 +559,7 @@ ui::EventTargeter* GetEventTargeter() override; void ConvertEventToTarget(ui::EventTarget* target, ui::LocatedEvent* event) override; + gfx::PointF GetScreenLocationF(const ui::LocatedEvent& event) const override; // Updates the layer name based on the window's name and id. void UpdateLayerName();
diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc index 8ef6631..997f66f5 100644 --- a/ui/aura/window_targeter.cc +++ b/ui/aura/window_targeter.cc
@@ -137,11 +137,9 @@ // This is used for bezel gesture events (eg. swiping in from screen edge). display::Display display = display::Screen::GetScreen()->GetDisplayNearestWindow(root_window); - gfx::Point screen_location = event.root_location(); - if (client::GetScreenPositionClient(root_window)) { - client::GetScreenPositionClient(root_window) - ->ConvertPointToScreen(root_window, &screen_location); - } + const gfx::Point screen_location = + event.target() ? event.target()->GetScreenLocation(event) + : event.root_location(); if (!display.bounds().Contains(screen_location)) return root_window; }
diff --git a/ui/base/ime/BUILD.gn b/ui/base/ime/BUILD.gn index 3b77aa70..072e0a38 100644 --- a/ui/base/ime/BUILD.gn +++ b/ui/base/ime/BUILD.gn
@@ -242,7 +242,7 @@ ] deps += [ - "//third_party/fuchsia-sdk/sdk:input", + "//third_party/fuchsia-sdk:input", "//ui/events", "//ui/events:dom_keycode_converter", ]
diff --git a/ui/base/ui_base_features.cc b/ui/base/ui_base_features.cc index 809c0d9c..4ca78b4 100644 --- a/ui/base/ui_base_features.cc +++ b/ui/base/ui_base_features.cc
@@ -155,16 +155,10 @@ } #if BUILDFLAG(MAC_VIEWS_BROWSER) -// Causes Views browser builds to use Views browser windows by default rather -// than Cocoa browser windows. -const base::Feature kViewsBrowserWindows{"ViewsBrowserWindows", - base::FEATURE_ENABLED_BY_DEFAULT}; - -// Returns whether a Views-capable browser build should use the Cocoa browser -// UI. bool IsViewsBrowserCocoa() { - return !base::FeatureList::IsEnabled(kViewsBrowserWindows) && - !base::FeatureList::IsEnabled(kExperimentalUi); + // TODO(https://crbug.com/832676): Delete all code guarded on this function + // returning true and then remove this function. + return false; } #endif // BUILDFLAG(MAC_VIEWS_BROWSER) #endif // defined(OS_MACOSX)
diff --git a/ui/base/ui_base_features.h b/ui/base/ui_base_features.h index 2edf82a..dce8a9f 100644 --- a/ui/base/ui_base_features.h +++ b/ui/base/ui_base_features.h
@@ -75,10 +75,10 @@ UI_BASE_EXPORT bool HostWindowsInAppShimProcess(); #if BUILDFLAG(MAC_VIEWS_BROWSER) -UI_BASE_EXPORT extern const base::Feature kViewsBrowserWindows; - // Returns whether a Views-capable browser build should use the Cocoa browser -// UI. +// UI. Always returns false. +// TODO(https://crbug.com/832676): Delete all code guarded on this function +// returning true and then remove this function. UI_BASE_EXPORT bool IsViewsBrowserCocoa(); #endif // BUILDFLAG(MAC_VIEWS_BROWSER) #endif // defined(OS_MACOSX)
diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn index 118d5a5..3db5568a 100644 --- a/ui/events/BUILD.gn +++ b/ui/events/BUILD.gn
@@ -306,7 +306,7 @@ "fuchsia/input_event_dispatcher.h", "fuchsia/input_event_dispatcher_delegate.h", ] - public_deps += [ "//third_party/fuchsia-sdk/sdk:input" ] + public_deps += [ "//third_party/fuchsia-sdk:input" ] } }
diff --git a/ui/events/blink/web_input_event.cc b/ui/events/blink/web_input_event.cc index e693fc2e..5f318baf 100644 --- a/ui/events/blink/web_input_event.cc +++ b/ui/events/blink/web_input_event.cc
@@ -8,6 +8,7 @@ #include "ui/events/blink/blink_event_util.h" #include "ui/events/blink/blink_features.h" #include "ui/events/event.h" +#include "ui/events/event_target.h" #include "ui/events/event_utils.h" #include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/keyboard_code_conversion.h" @@ -24,12 +25,8 @@ namespace { -gfx::PointF GetScreenLocationFromEvent( - const LocatedEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { - DCHECK(!screen_location_callback.is_null()); - return event.target() ? screen_location_callback.Run(event) +gfx::PointF GetScreenLocationFromEvent(const LocatedEvent& event) { + return event.target() ? event.target()->GetScreenLocationF(event) : event.root_location_f(); } @@ -232,12 +229,11 @@ // The only place where an Event's data differs from what the underlying // PlatformEvent would provide is position data. We would like to provide // coordinates relative to its hosting window, rather than the top level -// platform window. To do this a callback is accepted to allow for clients to -// map the coordinates. +// platform window. The event target is used to get the screen coordinates. // // The approach is to fully construct a blink::WebInputEvent from the // Event's PlatformEvent, and then replace the coordinate fields with -// the translated values from the Event. +// the translated values from the Event (and EventTarget). // // The exception is mouse events on linux. The MouseEvent contains enough // necessary information to construct a WebMouseEvent. So instead of extracting @@ -246,10 +242,7 @@ // MouseEvent. This will not be necessary once only XInput2 is supported. // -blink::WebMouseEvent MakeWebMouseEvent( - const MouseEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { +blink::WebMouseEvent MakeWebMouseEvent(const MouseEvent& event) { // Construct an untranslated event from the platform event data. blink::WebMouseEvent webkit_event = #if defined(OS_WIN) @@ -273,17 +266,13 @@ return webkit_event; #endif - const gfx::PointF screen_point = - GetScreenLocationFromEvent(event, screen_location_callback); + const gfx::PointF screen_point = GetScreenLocationFromEvent(event); webkit_event.SetPositionInScreen(screen_point.x(), screen_point.y()); return webkit_event; } -blink::WebMouseWheelEvent MakeWebMouseWheelEvent( - const MouseWheelEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { +blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const MouseWheelEvent& event) { #if defined(OS_WIN) // Construct an untranslated event from the platform event data. blink::WebMouseWheelEvent webkit_event = @@ -302,17 +291,13 @@ // |event|. webkit_event.SetPositionInWidget(event.x(), event.y()); - const gfx::PointF screen_point = - GetScreenLocationFromEvent(event, screen_location_callback); + const gfx::PointF screen_point = GetScreenLocationFromEvent(event); webkit_event.SetPositionInScreen(screen_point.x(), screen_point.y()); return webkit_event; } -blink::WebMouseWheelEvent MakeWebMouseWheelEvent( - const ScrollEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { +blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ScrollEvent& event) { #if defined(OS_WIN) // Construct an untranslated event from the platform event data. blink::WebMouseWheelEvent webkit_event = @@ -331,8 +316,7 @@ // |event|. webkit_event.SetPositionInWidget(event.x(), event.y()); - const gfx::PointF screen_point = - GetScreenLocationFromEvent(event, screen_location_callback); + const gfx::PointF screen_point = GetScreenLocationFromEvent(event); webkit_event.SetPositionInScreen(screen_point.x(), screen_point.y()); return webkit_event; @@ -363,30 +347,22 @@ return webkit_event; } -blink::WebGestureEvent MakeWebGestureEvent( - const GestureEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { +blink::WebGestureEvent MakeWebGestureEvent(const GestureEvent& event) { blink::WebGestureEvent gesture_event = MakeWebGestureEventFromUIEvent(event); gesture_event.SetPositionInWidget(event.location_f()); - const gfx::PointF screen_point = - GetScreenLocationFromEvent(event, screen_location_callback); + const gfx::PointF screen_point = GetScreenLocationFromEvent(event); gesture_event.SetPositionInScreen(screen_point); return gesture_event; } -blink::WebGestureEvent MakeWebGestureEvent( - const ScrollEvent& event, - const base::Callback<gfx::PointF(const LocatedEvent& event)>& - screen_location_callback) { +blink::WebGestureEvent MakeWebGestureEvent(const ScrollEvent& event) { blink::WebGestureEvent gesture_event = MakeWebGestureEventFromUiEvent(event); gesture_event.SetPositionInWidget(event.location_f()); - const gfx::PointF screen_point = - GetScreenLocationFromEvent(event, screen_location_callback); + const gfx::PointF screen_point = GetScreenLocationFromEvent(event); gesture_event.SetPositionInScreen(screen_point); return gesture_event;
diff --git a/ui/events/blink/web_input_event.h b/ui/events/blink/web_input_event.h index 17d90025a..277851a 100644 --- a/ui/events/blink/web_input_event.h +++ b/ui/events/blink/web_input_event.h
@@ -5,7 +5,6 @@ #ifndef UI_EVENTS_BLINK_WEB_INPUT_EVENT_H_ #define UI_EVENTS_BLINK_WEB_INPUT_EVENT_H_ -#include "base/callback.h" #include "third_party/blink/public/platform/web_gesture_event.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_keyboard_event.h" @@ -15,42 +14,17 @@ namespace ui { class GestureEvent; class KeyEvent; -class LocatedEvent; class MouseEvent; class MouseWheelEvent; class ScrollEvent; -// Several methods take a |screen_location_callback| which should translate the -// provided coordinates relative to the hosting window, rather than the top -// level platform window. -// -// If a valid event cannot be created, then the returned events will have the -// type UNKNOWN. -// -// TODO(jonross): Ideally this callback would not be needed. The callback should -// be removed once ui::Event::root_location has been deprecated and replaced -// with ui::Event::screen_location (crbug.com/608547) -blink::WebMouseEvent MakeWebMouseEvent( - const MouseEvent& event, - const base::Callback<gfx::PointF(const ui::LocatedEvent& event)>& - screen_location_callback); -blink::WebMouseWheelEvent MakeWebMouseWheelEvent( - const MouseWheelEvent& event, - const base::Callback<gfx::PointF(const ui::LocatedEvent& event)>& - screen_location_callback); -blink::WebMouseWheelEvent MakeWebMouseWheelEvent( - const ScrollEvent& event, - const base::Callback<gfx::PointF(const ui::LocatedEvent& event)>& - screen_location_callback); +// If a valid event cannot be created, the returned event type will be UNKNOWN. +blink::WebMouseEvent MakeWebMouseEvent(const MouseEvent& event); +blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const MouseWheelEvent& event); +blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ScrollEvent& event); blink::WebKeyboardEvent MakeWebKeyboardEvent(const KeyEvent& event); -blink::WebGestureEvent MakeWebGestureEvent( - const GestureEvent& event, - const base::Callback<gfx::PointF(const ui::LocatedEvent& event)>& - screen_location_callback); -blink::WebGestureEvent MakeWebGestureEvent( - const ScrollEvent& event, - const base::Callback<gfx::PointF(const ui::LocatedEvent& event)>& - screen_location_callback); +blink::WebGestureEvent MakeWebGestureEvent(const GestureEvent& event); +blink::WebGestureEvent MakeWebGestureEvent(const ScrollEvent& event); blink::WebGestureEvent MakeWebGestureEventFlingCancel( const blink::WebMouseWheelEvent& wheel_event);
diff --git a/ui/events/blink/web_input_event_unittest.cc b/ui/events/blink/web_input_event_unittest.cc index ae13e46..c304c99 100644 --- a/ui/events/blink/web_input_event_unittest.cc +++ b/ui/events/blink/web_input_event_unittest.cc
@@ -7,7 +7,6 @@ #include <stddef.h> #include <stdint.h> -#include "base/bind.h" #include "base/macros.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,14 +26,6 @@ namespace ui { -namespace { - -gfx::PointF GetScreenLocationFromEvent(const LocatedEvent& event) { - return event.root_location_f(); -} - -} // namespace - // Checks that MakeWebKeyboardEvent makes a DOM3 spec compliant key event. // crbug.com/127142 TEST(WebInputEventTest, TestMakeWebKeyboardEvent) { @@ -251,8 +242,7 @@ MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -268,8 +258,7 @@ MouseEvent ui_event(ET_MOUSE_RELEASED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, EF_LEFT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -285,8 +274,7 @@ MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_MIDDLE_MOUSE_BUTTON, EF_MIDDLE_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -302,8 +290,7 @@ MouseEvent ui_event(ET_MOUSE_RELEASED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, EF_MIDDLE_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -319,8 +306,7 @@ MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_RIGHT_MOUSE_BUTTON, EF_RIGHT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -336,8 +322,7 @@ MouseEvent ui_event(ET_MOUSE_RELEASED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, EF_RIGHT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -352,8 +337,7 @@ base::TimeTicks timestamp = EventTimeForNow(); MouseEvent ui_event(ET_MOUSE_MOVED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, 0); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -369,8 +353,7 @@ MouseEvent ui_event(ET_MOUSE_MOVED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON, 0); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -386,8 +369,7 @@ MouseEvent ui_event( ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON | EF_SHIFT_DOWN, EF_LEFT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -403,8 +385,7 @@ MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(blink::WebPointerProperties::PointerType::kMouse, webkit_event.pointer_type); @@ -431,8 +412,7 @@ MouseEvent ui_event(ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321), timestamp, EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON, pointer_details); - blink::WebMouseEvent webkit_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent webkit_event = MakeWebMouseEvent(ui_event); EXPECT_EQ(blink::WebPointerProperties::PointerType::kPen, webkit_event.pointer_type); @@ -455,8 +435,7 @@ -MouseWheelEvent::kWheelDelta * 2), gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, 0); - blink::WebMouseWheelEvent webkit_event = MakeWebMouseWheelEvent( - ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseWheelEvent webkit_event = MakeWebMouseWheelEvent(ui_event); EXPECT_EQ(EventFlagsToWebEventModifiers(ui_event.flags()), webkit_event.GetModifiers()); EXPECT_EQ(timestamp, webkit_event.TimeStamp()); @@ -510,8 +489,7 @@ ui::MouseEvent(ui::ET_UNKNOWN, gfx::Point(), gfx::Point(), base::TimeTicks(), 0, 0), kDeltaX, kDeltaY); - blink::WebMouseWheelEvent web_event = - MakeWebMouseWheelEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseWheelEvent web_event = MakeWebMouseWheelEvent(ui_event); ASSERT_EQ(blink::WebInputEvent::kMouseWheel, web_event.GetType()); ASSERT_EQ(0, web_event.GetModifiers()); ASSERT_EQ(kDeltaX, web_event.delta_x); @@ -543,8 +521,7 @@ ui::MouseEvent ui_event(tests[i].ui_type, tests[i].location, tests[i].screen_location, base::TimeTicks(), tests[i].ui_modifiers, 0); - blink::WebMouseEvent web_event = - MakeWebMouseEvent(ui_event, base::Bind(&GetScreenLocationFromEvent)); + blink::WebMouseEvent web_event = MakeWebMouseEvent(ui_event); ASSERT_TRUE(blink::WebInputEvent::IsMouseEventType(web_event.GetType())); ASSERT_EQ(tests[i].web_type, web_event.GetType()); ASSERT_EQ(tests[i].web_modifiers, web_event.GetModifiers());
diff --git a/ui/events/event_target.cc b/ui/events/event_target.cc index 431a66a6..09c115a 100644 --- a/ui/events/event_target.cc +++ b/ui/events/event_target.cc
@@ -8,18 +8,25 @@ #include "base/logging.h" #include "ui/events/event.h" +#include "ui/gfx/geometry/point_conversions.h" namespace ui { -EventTarget::EventTarget() - : target_handler_(NULL) { -} +EventTarget::EventTarget() = default; -EventTarget::~EventTarget() { -} +EventTarget::~EventTarget() = default; void EventTarget::ConvertEventToTarget(EventTarget* target, - LocatedEvent* event) { + LocatedEvent* event) {} + +gfx::PointF EventTarget::GetScreenLocationF( + const ui::LocatedEvent& event) const { + NOTREACHED(); + return event.root_location_f(); +} + +gfx::Point EventTarget::GetScreenLocation(const ui::LocatedEvent& event) const { + return gfx::ToFlooredPoint(GetScreenLocationF(event)); } void EventTarget::AddPreTargetHandler(EventHandler* handler,
diff --git a/ui/events/event_target.h b/ui/events/event_target.h index 4314aca..7c47527 100644 --- a/ui/events/event_target.h +++ b/ui/events/event_target.h
@@ -12,6 +12,8 @@ #include "base/macros.h" #include "ui/events/event_handler.h" #include "ui/events/events_export.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/point_f.h" namespace ui { @@ -54,6 +56,10 @@ virtual void ConvertEventToTarget(EventTarget* target, LocatedEvent* event); + // Get |event|'s screen location, using the EventTarget's screen location. + virtual gfx::PointF GetScreenLocationF(const LocatedEvent& event) const; + gfx::Point GetScreenLocation(const LocatedEvent& event) const; + // Priority levels for PreTargetHandlers. enum class Priority { // The Accessibility level is the highest, and gets events before @@ -120,7 +126,7 @@ EventHandlerPriorityList pre_target_list_; EventHandlerList post_target_list_; - EventHandler* target_handler_; + EventHandler* target_handler_ = nullptr; DISALLOW_COPY_AND_ASSIGN(EventTarget); };
diff --git a/ui/file_manager/file_manager/background/js/BUILD.gn b/ui/file_manager/file_manager/background/js/BUILD.gn index d560e75..6ce1485b 100644 --- a/ui/file_manager/file_manager/background/js/BUILD.gn +++ b/ui/file_manager/file_manager/background/js/BUILD.gn
@@ -262,19 +262,9 @@ deps = [ ":app_windows", + "../../../externs:webview_tag", "../../common/js:error_util", ] - - # The callback test_util_base.js passes to chrome.runtime.onMessageExternal() - # requires chrome_extensions.js, which has a dependency on chrome.js. Ensure - # the externs are introduced at the same time (in this order). Note we are - # lucky the list below also sorts in this order, or we'd need some other fix. - # A compile error results if the dependency walker encounters a target - # that puts chrome_extensions.js into the argument list before chrome.js. - externs_list = [ - "$externs_path/chrome.js", - "$externs_path/chrome_extensions.js", - ] } js_library("volume_info_impl") {
diff --git a/ui/file_manager/file_manager/background/js/test_util_base.js b/ui/file_manager/file_manager/background/js/test_util_base.js index a49d360..5b037d52 100644 --- a/ui/file_manager/file_manager/background/js/test_util_base.js +++ b/ui/file_manager/file_manager/background/js/test_util_base.js
@@ -32,6 +32,7 @@ // The hidden attribute is not in the element.attributes even if // element.hasAttribute('hidden') is true. hidden: !!element.hidden, + hasShadowRoot: !!element.shadowRoot }; const styleNames = opt_styleNames || []; @@ -258,6 +259,30 @@ }; /** + * Executes a script in the context of the first <webview> element contained in + * the window, including shadow DOM subtrees if given, and returns the script + * result via the callback. + * + * @param {Window} contentWindow Window to be tested. + * @param {!Array<string>} targetQuery Query for the <webview> element. + * |targetQuery[0]| specifies the first element. |targetQuery[1]| specifies + * an element inside the shadow DOM of the first element, etc. The last + * targetQuery item must return the <webview> element. + * @param {string} script Javascript code to be executed within the <webview>. + * @param {function(*)} callback Callback function to be called with the + * result of the |script|. + */ +test.util.async.deepExecuteScriptInWebView = function( + contentWindow, targetQuery, script, callback) { + const webviews = + test.util.sync.deepQuerySelectorAll_(contentWindow.document, targetQuery); + if (!webviews || webviews.length !== 1) + throw new Error('<webview> not found: [' + targetQuery.join(',') + ']'); + const webview = /** @type {WebView} */ (webviews[0]); + webview.executeScript({code: script}, callback); +}; + +/** * Gets the information of the active element. * * @param {Window} contentWindow Window to be tested.
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js index 471a0c6..a4170af 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -1713,9 +1713,9 @@ DirectoryTree.prototype.updateSubElementsFromList = function(recursive) { // First, current items which is not included in the dataModel should be // removed. - for (var i = 0; i < this.items.length;) { - var found = false; - for (var j = 0; j < this.dataModel.length; j++) { + for (let i = 0; i < this.items.length;) { + let found = false; + for (let j = 0; j < this.dataModel.length; j++) { // Comparison by references, which is safe here, as model items are long // living. if (this.items[i].modelItem === this.dataModel.item(j)) { @@ -1733,18 +1733,20 @@ } // Next, insert items which is in dataModel but not in current items. - var modelIndex = 0; - var itemIndex = 0; - // Starts with TOP_SECTION so first section doesn't get the separator line. - var previousSection = NavigationSection.TOP; + let modelIndex = 0; + let itemIndex = 0; + // Initialize with first item's section so the first root doesn't get a + // divider line at the top. + let previousSection = this.dataModel.item(modelIndex).section; while (modelIndex < this.dataModel.length) { const currentItem = this.items[itemIndex]; if (itemIndex < this.items.length && currentItem.modelItem === this.dataModel.item(modelIndex)) { - var modelItem = currentItem.modelItem; - if (previousSection !== modelItem.section) - currentItem.setAttribute('section-start', previousSection); - previousSection = modelItem.section; + const modelItem = currentItem.modelItem; + if (previousSection !== modelItem.section) { + currentItem.setAttribute('section-start', modelItem.section); + previousSection = modelItem.section; + } if (recursive && currentItem instanceof VolumeItem) currentItem.updateSubDirectories(true); // EntryListItem can contain volumes that might have been updated: ask @@ -1753,13 +1755,13 @@ if (currentItem instanceof EntryListItem) currentItem.updateSubDirectories(true); } else { - var modelItem = this.dataModel.item(modelIndex); + const modelItem = this.dataModel.item(modelIndex); if (modelItem) { - var item = DirectoryTree.createDirectoryItem(modelItem, this); + const item = DirectoryTree.createDirectoryItem(modelItem, this); if (item) { this.addAt(item, itemIndex); if (previousSection !== modelItem.section) - item.setAttribute('section-start', previousSection); + item.setAttribute('section-start', modelItem.section); } previousSection = modelItem.section; }
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.html b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.html index 0cff23b..0e7d0d18 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.html +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.html
@@ -12,6 +12,8 @@ <script src="../../../../../../ui/webui/resources/js/cr/ui/array_data_model.js"></script> <script src="../../../../../../ui/webui/resources/js/cr/ui/tree.js"></script> <script src="../../../../../../ui/webui/resources/js/load_time_data.js"></script> + <script src="../../../../../../ui/webui/resources/js/assert.js"></script> + <script src="../../../../../../ui/webui/resources/js/util.js"></script> <script src="../../../common/js/async_util.js"></script> <script src="../../../common/js/mock_entry.js"></script> @@ -29,6 +31,7 @@ <script src="../../../background/js/mock_volume_manager.js"></script> <script src="../mock_directory_model.js"></script> <script src="../mock_navigation_list_model.js"></script> + <script src="../mock_folder_shortcut_data_model.js"></script> <script src="../navigation_list_model.js"></script> <script src="../constants.js"></script> <script src="directory_tree.js"></script>
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js index fdf75d73e..3240ee72 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree_unittest.js
@@ -19,7 +19,8 @@ DRIVE_OFFLINE_COLLECTION_LABEL: 'Offline', DRIVE_SHARED_WITH_ME_COLLECTION_LABEL: 'Shared with me', REMOVABLE_DIRECTORY_LABEL: 'External Storage', - ARCHIVE_DIRECTORY_LABEL: 'Archives' + ARCHIVE_DIRECTORY_LABEL: 'Archives', + MY_FILES_ROOT_LABEL: 'My files', }; function setUp() { @@ -262,6 +263,64 @@ } /** + * Test case for updateSubElementsFromList setting section-start attribute. + * + * 'section-start' attribute is used to display a line divider between + * "sections" in the directory tree. This is calculated in NavigationListModel. + */ +function testUpdateSubElementsFromListSections() { + // Creates elements. + const parentElement = document.createElement('div'); + const directoryTree = document.createElement('div'); + parentElement.appendChild(directoryTree); + + // Creates mocks. + const directoryModel = new MockDirectoryModel(); + const volumeManager = new MockVolumeManager(); + const fileOperationManager = { + addEventListener: function(name, callback) {} + }; + + const treeModel = new NavigationListModel( + volumeManager, + new MockFolderShortcutDataModel([]), + null, /* recentItem */ + null, /* addNewServicesItem */ + false /* opt_disableMyFilesNavigation */ + ); + + const myFilesItem = treeModel.item(0); + const driveItem = treeModel.item(1); + + assertEquals(NavigationSection.MY_FILES, myFilesItem.section); + assertEquals(NavigationSection.CLOUD, driveItem.section); + + DirectoryTree.decorate(directoryTree, directoryModel, volumeManager, + null, fileOperationManager, true); + directoryTree.dataModel = treeModel; + directoryTree.updateSubElementsFromList(false); + + // First element should not have section-start attribute, to not display a + // division line in the first section. + // My files: + assertEquals(null, directoryTree.items[0].getAttribute('section-start')); + + // Drive should have section-start, because it's a new section but not the + // first section. + assertEquals( + NavigationSection.CLOUD, + directoryTree.items[1].getAttribute('section-start')); + + // Regenerate so it re-calculates the 'section-start' without creating the + // DirectoryItem. + directoryTree.updateSubElementsFromList(false); + assertEquals( + NavigationSection.CLOUD, + directoryTree.items[1].getAttribute('section-start')); + +} + +/** * Test case for updateSubElementsFromList. * * Mounts/unmounts removable and archive volumes, and checks these volumes come
diff --git a/ui/file_manager/integration_tests/file_manager/drive_specific.js b/ui/file_manager/integration_tests/file_manager/drive_specific.js index dd24d71..4dc1dda 100644 --- a/ui/file_manager/integration_tests/file_manager/drive_specific.js +++ b/ui/file_manager/integration_tests/file_manager/drive_specific.js
@@ -344,8 +344,10 @@ StepsRunner.run(steps); }; +/** + * Pin hello.txt in the old Drive client. + */ testcase.PRE_driveMigratePinnedFile = function() { - // Pin a file. testPromise( setupAndWaitUntilReady(null, RootPath.DRIVE).then(function(results) { var windowId = results.windowId; @@ -388,6 +390,9 @@ })); }; +/** + * Verify hello.txt is still pinned after migrating to DriveFS. + */ testcase.driveMigratePinnedFile = function() { // After enabling DriveFS, ensure the file is still pinned. testPromise( @@ -430,6 +435,10 @@ return `${year}-${month}-${day}`; } +/** + * Test that a images within a DCIM directory on removable media is backed up to + * Drive, in the Chrome OS Cloud backup/<current date> directory. + */ testcase.driveBackupPhotos = function() { let appId; @@ -499,3 +508,143 @@ } ]); }; + +/** + * Create some dirty files in Drive. + * + * Create /root/never-sync.txt and /root/A/never-sync.txt. These files will + * never complete syncing to the fake drive service so will remain dirty + * forever. + */ +testcase.PRE_driveRecoverDirtyFiles = function() { + let appId; + StepsRunner.run([ + function() { + setupAndWaitUntilReady( + null, RootPath.DOWNLOADS, this.next, [ENTRIES.neverSync], + [ENTRIES.directoryA]); + }, + // Select never-sync.txt. + function(results) { + appId = results.windowId; + + remoteCall.callRemoteTestUtil('selectFile', appId, ['never-sync.txt']) + .then(this.next); + }, + // Copy it. + function(result) { + chrome.test.assertTrue(result, 'selectFile failed'); + + return remoteCall + .callRemoteTestUtil( + 'fakeKeyDown', appId, ['#file-list', 'c', true, false, false]) + .then(this.next); + }, + // Navigate to My Drive. + function(result) { + chrome.test.assertTrue(result, 'copy failed'); + + return remoteCall + .navigateWithDirectoryTree(appId, '/root', 'My Drive', 'drive') + .then(this.next); + }, + // Paste. + function() { + return remoteCall + .callRemoteTestUtil( + 'fakeKeyDown', appId, ['#file-list', 'v', true, false, false]) + .then(this.next); + }, + // Wait for the paste to complete. + function(result) { + chrome.test.assertTrue(result, 'paste failed'); + const expectedEntryRows = [ + ENTRIES.neverSync.getExpectedRow(), + ENTRIES.directoryA.getExpectedRow(), + ]; + remoteCall + .waitForFiles( + appId, expectedEntryRows, {ignoreLastModifiedTime: true}) + .then(this.next); + }, + // Navigate to My Drive/A. + function() { + return remoteCall + .navigateWithDirectoryTree(appId, '/root/A', 'My Drive', 'drive') + .then(this.next); + }, + // Paste. + function() { + return remoteCall + .callRemoteTestUtil( + 'fakeKeyDown', appId, ['#file-list', 'v', true, false, false]) + .then(this.next); + }, + // Wait for the paste to complete. + function(result) { + chrome.test.assertTrue(result, 'paste failed'); + const expectedEntryRows = [ENTRIES.neverSync.getExpectedRow()]; + remoteCall + .waitForFiles( + appId, expectedEntryRows, {ignoreLastModifiedTime: true}) + .then(this.next); + }, + function() { + checkIfNoErrorsOccured(this.next); + }, + ]); +}; + +/** + * Verify that when enabling DriveFS, the dirty files are recovered to + * Downloads/Recovered files from Google Drive. The directory structure should + * be flattened with uniquified names: + * - never-sync.txt + * - never-sync (1).txt + */ +testcase.driveRecoverDirtyFiles = function() { + let appId; + // After enabling DriveFS, ensure the dirty files have been recovered into + // Downloads. + StepsRunner.run([ + function() { + setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next, [], []); + }, + // Wait for the Recovered files directory to be in Downloads. + function(results) { + appId = results.windowId; + + const expectedEntryRows = [ + ENTRIES.neverSync.getExpectedRow(), + ['Recovered files from Google Drive', '--', 'Folder'], + ]; + remoteCall + .waitForFiles( + appId, expectedEntryRows, {ignoreLastModifiedTime: true}) + .then(this.next); + }, + // Navigate to the recovered files directory. + function() { + return remoteCall + .navigateWithDirectoryTree( + appId, '/Recovered files from Google Drive', 'Downloads') + .then(this.next); + }, + // Ensure it contains never-sync.txt and never-sync (1).txt. + function() { + var uniquifiedNeverSync = ENTRIES.neverSync.getExpectedRow(); + uniquifiedNeverSync[0] = 'never-sync (1).txt'; + const expectedEntryRows = [ + ENTRIES.neverSync.getExpectedRow(), + uniquifiedNeverSync, + ]; + remoteCall + .waitForFiles( + appId, expectedEntryRows, {ignoreLastModifiedTime: true}) + .then(this.next); + }, + function() { + checkIfNoErrorsOccured(this.next); + }, + ]); +};
diff --git a/ui/file_manager/integration_tests/file_manager/quick_view.js b/ui/file_manager/integration_tests/file_manager/quick_view.js index aaf964d..db4d419 100644 --- a/ui/file_manager/integration_tests/file_manager/quick_view.js +++ b/ui/file_manager/integration_tests/file_manager/quick_view.js
@@ -254,3 +254,68 @@ }, ]); }; + +/** + * Tests opening Quick View and scrolling its <webview> which contains a tall + * text document. + */ +testcase.openQuickViewScrollText = function() { + const caller = getCaller(); + let appId; + + function checkQuickViewTextScrollY(scrollY) { + if (Number(scrollY.toString()) < 100) + return pending(caller, 'Waiting for Quick View to scroll.'); + return; + } + + const textView = ['#quick-view', 'webview']; + + StepsRunner.run([ + // Open Files app on Downloads containing ENTRIES.tallText. + function() { + setupAndWaitUntilReady( + null, RootPath.DOWNLOADS, this.next, [ENTRIES.tallText], []); + }, + // Open the file in Quick View. + function(results) { + appId = results.windowId; + const openSteps = openQuickViewSteps(appId, ENTRIES.tallText.nameText); + StepsRunner.run(openSteps).then(this.next); + }, + // Get the Quick View <webview> scrollY. + function() { + const getScrollY = 'window.scrollY'; + remoteCall + .callRemoteTestUtil( + 'deepExecuteScriptInWebView', appId, [textView, getScrollY]) + .then(this.next); + }, + // Check: the initial <webview> scrollY should be 0. + function(result) { + chrome.test.assertEq('0', result.toString()); + this.next(); + }, + // Scroll the Quick View <webview> in the Y direction (down). + function() { + const doScrollTo = 'window.scrollTo(0,1000)'; + remoteCall + .callRemoteTestUtil( + 'deepExecuteScriptInWebView', appId, [textView, doScrollTo]) + .then(this.next); + }, + // Check: the <webview> should be scrolled in the Y direction. + function() { + repeatUntil(function() { + const getScrollY = 'window.scrollY'; + return remoteCall + .callRemoteTestUtil( + 'deepExecuteScriptInWebView', appId, [textView, getScrollY]) + .then(checkQuickViewTextScrollY); + }).then(this.next); + }, + function(results) { + checkIfNoErrorsOccured(this.next); + }, + ]); +};
diff --git a/ui/file_manager/integration_tests/remote_call.js b/ui/file_manager/integration_tests/remote_call.js index 0e08480a..cc7b888 100644 --- a/ui/file_manager/integration_tests/remote_call.js +++ b/ui/file_manager/integration_tests/remote_call.js
@@ -555,7 +555,7 @@ .then(() => { // Entries within Drive starts with /root/ but it isn't displayed in the // breadcrubms used by waitUntilCurrentDirectoryIsChanged. - path = path.replace(/^\/root\//, '/').replace(/^\/team_drives/, ''); + path = path.replace(/^\/root/, '').replace(/^\/team_drives/, ''); // Wait until the Files app is navigated to the path. return this.waitUntilCurrentDirectoryIsChanged(
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js index da08468..b499fcc1 100644 --- a/ui/file_manager/integration_tests/test_util.js +++ b/ui/file_manager/integration_tests/test_util.js
@@ -482,6 +482,17 @@ typeText: 'OGG audio' }), + tallText: new TestEntryInfo({ + type: EntryType.FILE, + sourceFileName: 'tall.txt', + targetPath: 'tall.txt', + mimeType: 'text/plain', + lastModifiedTime: 'Sep 4, 1998, 12:34 PM', + nameText: 'tall.txt', + sizeText: '546 bytes', + typeText: 'Plain text', + }), + pinned: new TestEntryInfo({ type: EntryType.FILE, sourceFileName: 'text.txt', @@ -796,4 +807,15 @@ canShare: true }, }), + + neverSync: new TestEntryInfo({ + type: EntryType.FILE, + sourceFileName: 'text.txt', + targetPath: 'never-sync.txt', + mimeType: 'text/plain', + lastModifiedTime: 'Sep 4, 1998, 12:34 PM', + nameText: 'never-sync.txt', + sizeText: '51 bytes', + typeText: 'Plain text' + }), };
diff --git a/ui/file_manager/integration_tests/video_player/check_elements.js b/ui/file_manager/integration_tests/video_player/check_elements.js index 8cfeb300..52a9a907 100644 --- a/ui/file_manager/integration_tests/video_player/check_elements.js +++ b/ui/file_manager/integration_tests/video_player/check_elements.js
@@ -16,8 +16,13 @@ return Promise.all([ remoteCallVideoPlayer.waitForElement(appId, 'html[i18n-processed]'), remoteCallVideoPlayer.waitForElement(appId, 'div#video-player'), - remoteCallVideoPlayer.waitForElement( - appId, '#video-container > video'), + remoteCallVideoPlayer.waitForElement(appId, '#video-container > video'), + remoteCallVideoPlayer.waitForElement(appId, 'files-icon-button.play') + .then(function(element) { + // files-icon-button is a Polymer element and should have a + // shadowRoot. + chrome.test.assertTrue(element.hasShadowRoot); + }), ]); }); };
diff --git a/ui/file_manager/video_player/video_player.html b/ui/file_manager/video_player/video_player.html index eb3bf31..f3c1ca1d 100644 --- a/ui/file_manager/video_player/video_player.html +++ b/ui/file_manager/video_player/video_player.html
@@ -15,8 +15,8 @@ <link rel="stylesheet" type="text/css" href="css/arrow_box.css"> <link rel="stylesheet" type="text/css" href="css/cast_menu.css"> - <link rel="import" href="chrome://resources/polymer/v1_0/paper-slider/paper-slider.html"> <link rel="import" href="chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/elements/files_icon_button.html"> + <link rel="import" href="chrome://resources/polymer/v1_0/paper-slider/paper-slider.html"> <style is="custom-style"> files-icon-button {
diff --git a/ui/ozone/demo/BUILD.gn b/ui/ozone/demo/BUILD.gn index 5b7e605..683e964 100644 --- a/ui/ozone/demo/BUILD.gn +++ b/ui/ozone/demo/BUILD.gn
@@ -39,7 +39,7 @@ ] if (is_fuchsia) { - deps += [ "//third_party/fuchsia-sdk/sdk:policy" ] + deps += [ "//third_party/fuchsia-sdk:policy" ] } }
diff --git a/ui/ozone/platform/scenic/BUILD.gn b/ui/ozone/platform/scenic/BUILD.gn index 3722c13..faedc7c1 100644 --- a/ui/ozone/platform/scenic/BUILD.gn +++ b/ui/ozone/platform/scenic/BUILD.gn
@@ -33,12 +33,12 @@ deps = [ "//base", "//skia", - "//third_party/fuchsia-sdk/sdk:gfx", - "//third_party/fuchsia-sdk/sdk:images", - "//third_party/fuchsia-sdk/sdk:mem", - "//third_party/fuchsia-sdk/sdk:scenic", - "//third_party/fuchsia-sdk/sdk:viewsv1", - "//third_party/fuchsia-sdk/sdk:viewsv1token", + "//third_party/fuchsia-sdk:gfx", + "//third_party/fuchsia-sdk:images", + "//third_party/fuchsia-sdk:mem", + "//third_party/fuchsia-sdk:scenic", + "//third_party/fuchsia-sdk:viewsv1", + "//third_party/fuchsia-sdk:viewsv1token", "//ui/base", "//ui/display/manager", "//ui/events:dom_keycode_converter",
diff --git a/ui/platform_window/BUILD.gn b/ui/platform_window/BUILD.gn index af5ef67..dbfac362 100644 --- a/ui/platform_window/BUILD.gn +++ b/ui/platform_window/BUILD.gn
@@ -24,7 +24,7 @@ if (is_fuchsia) { public_deps = [ - "//third_party/fuchsia-sdk/sdk:viewsv1token", + "//third_party/fuchsia-sdk:viewsv1token", ] } }
diff --git a/ui/views/corewm/tooltip_controller.cc b/ui/views/corewm/tooltip_controller.cc index 02cd71a..77d84cac 100644 --- a/ui/views/corewm/tooltip_controller.cc +++ b/ui/views/corewm/tooltip_controller.cc
@@ -95,16 +95,14 @@ // If |target| has capture all events go to it, even if the mouse is // really over another window. Find the real window the mouse is over. - gfx::Point screen_loc(event.location()); - aura::client::GetScreenPositionClient(event_target->GetRootWindow())-> - ConvertPointToScreen(event_target, &screen_loc); + const gfx::Point screen_loc = event.target()->GetScreenLocation(event); display::Screen* screen = display::Screen::GetScreen(); aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); if (!target) return NULL; gfx::Point target_loc(screen_loc); - aura::client::GetScreenPositionClient(target->GetRootWindow())-> - ConvertPointFromScreen(target, &target_loc); + aura::client::GetScreenPositionClient(target->GetRootWindow()) + ->ConvertPointFromScreen(target, &target_loc); aura::Window* screen_target = target->GetEventHandlerForPoint(target_loc); if (!IsValidTarget(event_target, screen_target)) return NULL;
diff --git a/ui/views/view.cc b/ui/views/view.cc index d238fad..1a1636af 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc
@@ -1191,6 +1191,13 @@ event->ConvertLocationToTarget(this, static_cast<View*>(target)); } +gfx::PointF View::GetScreenLocationF(const ui::LocatedEvent& event) const { + DCHECK_EQ(this, event.target()); + gfx::Point screen_location(event.location()); + ConvertPointToScreen(this, &screen_location); + return gfx::PointF(screen_location); +} + // Accelerators ---------------------------------------------------------------- void View::AddAccelerator(const ui::Accelerator& accelerator) {
diff --git a/ui/views/view.h b/ui/views/view.h index 4248609..161e015 100644 --- a/ui/views/view.h +++ b/ui/views/view.h
@@ -888,6 +888,7 @@ ui::EventTargeter* GetEventTargeter() override; void ConvertEventToTarget(ui::EventTarget* target, ui::LocatedEvent* event) override; + gfx::PointF GetScreenLocationF(const ui::LocatedEvent& event) const override; // Overridden from ui::EventHandler: void OnKeyEvent(ui::KeyEvent* event) override;
diff --git a/webrunner/BUILD.gn b/webrunner/BUILD.gn index 7c4a04b..c3f7842 100644 --- a/webrunner/BUILD.gn +++ b/webrunner/BUILD.gn
@@ -211,6 +211,7 @@ fidl_library("fidl") { library_name = "web" namespace = "chromium" + namespace_path = "chromium" sources = [ "fidl/context.fidl", @@ -221,9 +222,9 @@ ] public_deps = [ - "//third_party/fuchsia-sdk/sdk:gfx", - "//third_party/fuchsia-sdk/sdk:sys", - "//third_party/fuchsia-sdk/sdk:viewsv1", + "//third_party/fuchsia-sdk:gfx", + "//third_party/fuchsia-sdk:sys", + "//third_party/fuchsia-sdk:viewsv1", ] }
diff --git a/webrunner/net_http/BUILD.gn b/webrunner/net_http/BUILD.gn index 5c51d980..db0eeeb 100644 --- a/webrunner/net_http/BUILD.gn +++ b/webrunner/net_http/BUILD.gn
@@ -21,8 +21,8 @@ deps = [ "//base:base", "//net:net", - "//third_party/fuchsia-sdk/sdk:oldhttp", - "//third_party/fuchsia-sdk/sdk:sys", + "//third_party/fuchsia-sdk:oldhttp", + "//third_party/fuchsia-sdk:sys", ] }