diff --git a/BUILD.gn b/BUILD.gn index a4eb066..7bce8b89 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -517,11 +517,6 @@ deps += [ "//breakpad:crash_inspector", "//breakpad:dump_syms", - - # XPC service is in developement and guarded against the - # enable_xpc_notifications, in the meantime however we still - # need compile coverage in the bots. - "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", "//third_party/apple_sample_code", "//third_party/molokocacao", ]
diff --git a/DEPS b/DEPS index 9ead570..a6751a9 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '43b9c6bbf66b0927a99062c68dff9ea8358f82db', + 'skia_revision': '14987ebb97f491f1b5bc776252b5ddbf65b8fca0', # 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': '982bb12bf0f50cafcd230c797e11abd65ea6ac3c', + 'v8_revision': '07b2253a044bffa43697c6a43aaccb68c7e82af4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '80a58afe727a9698ce0c861d5c573ddb57fa2ac3', + 'catapult_revision': '3680efbfbcc7f2e6f4d15cab3f3f4e3d45cbbbfb', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/ash/accelerators/accelerator_commands_aura.cc b/ash/accelerators/accelerator_commands_aura.cc index 88ad889..241d449 100644 --- a/ash/accelerators/accelerator_commands_aura.cc +++ b/ash/accelerators/accelerator_commands_aura.cc
@@ -17,13 +17,12 @@ void ToggleTouchHudProjection() { base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); - bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); - Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); + bool enabled = Shell::Get()->is_touch_hud_projection_enabled(); + Shell::Get()->SetTouchHudProjectionEnabled(!enabled); } bool IsInternalDisplayZoomEnabled() { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); return display_manager->IsDisplayUIScalingEnabled() || display_manager->IsInUnifiedMode(); } @@ -34,21 +33,19 @@ else base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down")); - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); return display_manager->ZoomInternalDisplay(up); } void ResetInternalDisplayZoom() { base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset")); - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); display_manager->ResetInternalDisplayZoom(); } void Unpin() { WmWindow* pinned_window = - Shell::GetInstance()->screen_pinning_controller()->pinned_window(); + Shell::Get()->screen_pinning_controller()->pinned_window(); if (pinned_window) pinned_window->GetWindowState()->Restore(); }
diff --git a/ash/accelerators/accelerator_controller_delegate_aura.cc b/ash/accelerators/accelerator_controller_delegate_aura.cc index 294ab8d..00d7f421 100644 --- a/ash/accelerators/accelerator_controller_delegate_aura.cc +++ b/ash/accelerators/accelerator_controller_delegate_aura.cc
@@ -47,21 +47,21 @@ using base::UserMetricsAction; bool CanHandleMagnifyScreen() { - return Shell::GetInstance()->magnification_controller()->IsEnabled(); + return Shell::Get()->magnification_controller()->IsEnabled(); } // Magnify the screen void HandleMagnifyScreen(int delta_index) { - if (Shell::GetInstance()->magnification_controller()->IsEnabled()) { + if (Shell::Get()->magnification_controller()->IsEnabled()) { // TODO(yoshiki): Move the following logic to MagnificationController. - float scale = Shell::GetInstance()->magnification_controller()->GetScale(); + float scale = Shell::Get()->magnification_controller()->GetScale(); // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. int scale_index = std::floor(std::log(scale) / std::log(kMagnificationScaleFactor) + 0.5); int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); - Shell::GetInstance()->magnification_controller()->SetScale( + Shell::Get()->magnification_controller()->SetScale( std::pow(kMagnificationScaleFactor, new_scale_index), true); } } @@ -83,7 +83,7 @@ // Rotates the screen. void HandleRotateScreen() { - if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) + if (Shell::Get()->display_manager()->IsInUnifiedMode()) return; base::RecordAction(UserMetricsAction("Accel_Rotate_Screen")); @@ -91,8 +91,8 @@ display::Display display = display::Screen::GetScreen()->GetDisplayNearestPoint(point); const display::ManagedDisplayInfo& display_info = - Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); - Shell::GetInstance()->display_configuration_controller()->SetDisplayRotation( + Shell::Get()->display_manager()->GetDisplayInfo(display.id()); + Shell::Get()->display_configuration_controller()->SetDisplayRotation( display.id(), GetNextRotation(display_info.GetActiveRotation()), display::Display::ROTATION_SOURCE_USER); } @@ -100,14 +100,14 @@ void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); DCHECK(screenshot_delegate); - Shell::GetInstance()->screenshot_controller()->StartWindowScreenshotSession( + Shell::Get()->screenshot_controller()->StartWindowScreenshotSession( screenshot_delegate); } void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) { base::RecordAction(UserMetricsAction("Accel_Take_Partial_Screenshot")); DCHECK(screenshot_delegate); - Shell::GetInstance()->screenshot_controller()->StartPartialScreenshotSession( + Shell::Get()->screenshot_controller()->StartPartialScreenshotSession( screenshot_delegate, true /* draw_overlay_immediately */); } @@ -132,15 +132,14 @@ // TODO(rjkroege): This is not correct behaviour on devices with more than // two screens. Behave the same as mirroring: fail and notify if there are // three or more screens. - Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( - Shell::GetInstance()->display_manager()->GetSecondaryDisplay().id()); + Shell::Get()->display_configuration_controller()->SetPrimaryDisplayId( + Shell::Get()->display_manager()->GetSecondaryDisplay().id()); } void HandleToggleMirrorMode() { base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); - bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); - Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( - mirror); + bool mirror = !Shell::Get()->display_manager()->IsInMirrorMode(); + Shell::Get()->display_configuration_controller()->SetMirrorMode(mirror); } bool CanHandleTouchHud() { @@ -263,7 +262,7 @@ const ui::Accelerator& accelerator) { switch (action) { case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: - Shell::GetInstance()->display_manager()->ToggleDisplayScaleFactor(); + Shell::Get()->display_manager()->ToggleDisplayScaleFactor(); break; case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: debug::ToggleShowDebugBorders(); @@ -275,18 +274,18 @@ debug::ToggleShowPaintRects(); break; case DEV_ADD_REMOVE_DISPLAY: - Shell::GetInstance()->display_manager()->AddRemoveDisplay(); + Shell::Get()->display_manager()->AddRemoveDisplay(); break; case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen(); break; case DEV_TOGGLE_UNIFIED_DESKTOP: - Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled( - !Shell::GetInstance()->display_manager()->unified_desktop_enabled()); + Shell::Get()->display_manager()->SetUnifiedDesktopEnabled( + !Shell::Get()->display_manager()->unified_desktop_enabled()); break; case LOCK_PRESSED: case LOCK_RELEASED: - Shell::GetInstance()->power_button_controller()->OnLockButtonEvent( + Shell::Get()->power_button_controller()->OnLockButtonEvent( action == LOCK_PRESSED, base::TimeTicks()); break; case MAGNIFY_SCREEN_ZOOM_IN: @@ -300,7 +299,7 @@ if (!base::SysInfo::IsRunningOnChromeOS()) { // There is no powerd, the Chrome OS power manager, in linux desktop, // so call the PowerButtonController here. - Shell::GetInstance()->power_button_controller()->OnPowerButtonEvent( + Shell::Get()->power_button_controller()->OnPowerButtonEvent( action == POWER_PRESSED, base::TimeTicks()); } // We don't do anything with these at present on the device,
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 2a5d178..c5206dad 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -814,8 +814,7 @@ app_list::test::TestAppListPresenter test_app_list_presenter; Shell::Get()->app_list()->SetAppListPresenter( test_app_list_presenter.CreateInterfacePtrAndBind()); - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); // The press event should not toggle the AppList, the release should instead. EXPECT_FALSE( @@ -1030,7 +1029,7 @@ // test::AshTestBase: void SetUp() override { AshTestBase::SetUp(); - Shell::GetInstance()->lock_state_controller()->set_animator_for_test( + Shell::Get()->lock_state_controller()->set_animator_for_test( new test::TestSessionStateAnimator); } @@ -1058,7 +1057,7 @@ // Power key (reserved) should always be handled. test::LockStateControllerTestApi test_api( - Shell::GetInstance()->lock_state_controller()); + Shell::Get()->lock_state_controller()); EXPECT_FALSE(test_api.is_animating_lock()); generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); EXPECT_TRUE(test_api.is_animating_lock()); @@ -1110,7 +1109,7 @@ // Power key (reserved) should always be handled. test::LockStateControllerTestApi test_api( - Shell::GetInstance()->lock_state_controller()); + Shell::Get()->lock_state_controller()); EXPECT_FALSE(test_api.is_animating_lock()); generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); EXPECT_TRUE(test_api.is_animating_lock()); @@ -1228,8 +1227,7 @@ } TEST_F(AcceleratorControllerTest, DisallowedWithNoWindow) { - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
diff --git a/ash/accelerators/accelerator_interactive_uitest_chromeos.cc b/ash/accelerators/accelerator_interactive_uitest_chromeos.cc index 48ca2b9..99068b46 100644 --- a/ash/accelerators/accelerator_interactive_uitest_chromeos.cc +++ b/ash/accelerators/accelerator_interactive_uitest_chromeos.cc
@@ -60,7 +60,7 @@ void SetUp() override { AshInteractiveUITestBase::SetUp(); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); chromeos::NetworkHandler::Initialize(); } @@ -68,7 +68,7 @@ void TearDown() override { chromeos::NetworkHandler::Shutdown(); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); AshInteractiveUITestBase::TearDown(); }
diff --git a/ash/accelerators/magnifier_key_scroller.cc b/ash/accelerators/magnifier_key_scroller.cc index 342edbe..d5565ea 100644 --- a/ash/accelerators/magnifier_key_scroller.cc +++ b/ash/accelerators/magnifier_key_scroller.cc
@@ -24,7 +24,7 @@ switches::kAshEnableMagnifierKeyScroller); return (magnifier_key_scroller_enabled || has_switch) && - ash::Shell::GetInstance()->magnification_controller()->IsEnabled(); + ash::Shell::Get()->magnification_controller()->IsEnabled(); } // static @@ -58,7 +58,7 @@ void MagnifierKeyScroller::OnKeyHold(const ui::KeyEvent* event) { MagnificationController* controller = - Shell::GetInstance()->magnification_controller(); + Shell::Get()->magnification_controller(); switch (event->key_code()) { case ui::VKEY_UP: controller->SetScrollDirection(MagnificationController::SCROLL_UP); @@ -79,7 +79,7 @@ void MagnifierKeyScroller::OnKeyUnhold(const ui::KeyEvent* event) { MagnificationController* controller = - Shell::GetInstance()->magnification_controller(); + Shell::Get()->magnification_controller(); controller->SetScrollDirection(MagnificationController::SCROLL_NONE); }
diff --git a/ash/accelerators/magnifier_key_scroller_unittest.cc b/ash/accelerators/magnifier_key_scroller_unittest.cc index 15439ae..b886bf9d5 100644 --- a/ash/accelerators/magnifier_key_scroller_unittest.cc +++ b/ash/accelerators/magnifier_key_scroller_unittest.cc
@@ -46,8 +46,8 @@ wm::ActivateWindow(window.get()); MagnifierKeyScroller::ScopedEnablerForTest scoped; - Shell* shell = Shell::GetInstance(); - MagnificationController* controller = shell->magnification_controller(); + MagnificationController* controller = + Shell::Get()->magnification_controller(); controller->SetEnabled(true); EXPECT_EQ("200,150", controller->GetWindowPosition().ToString());
diff --git a/ash/accelerators/spoken_feedback_toggler.cc b/ash/accelerators/spoken_feedback_toggler.cc index 942208a..3a052ca 100644 --- a/ash/accelerators/spoken_feedback_toggler.cc +++ b/ash/accelerators/spoken_feedback_toggler.cc
@@ -53,7 +53,7 @@ void SpokenFeedbackToggler::OnKeyHold(const ui::KeyEvent* event) { if (!toggled_) { toggled_ = true; - Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback( + Shell::Get()->accessibility_delegate()->ToggleSpokenFeedback( A11Y_NOTIFICATION_SHOW); } }
diff --git a/ash/accelerators/spoken_feedback_toggler_unittest.cc b/ash/accelerators/spoken_feedback_toggler_unittest.cc index 6835fa3..29be01c 100644 --- a/ash/accelerators/spoken_feedback_toggler_unittest.cc +++ b/ash/accelerators/spoken_feedback_toggler_unittest.cc
@@ -17,8 +17,7 @@ TEST_F(SpokenFeedbackTogglerTest, Basic) { SpokenFeedbackToggler::ScopedEnablerForTest scoped; - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); ui::test::EventGenerator& generator = GetEventGenerator(); EXPECT_FALSE(delegate->IsSpokenFeedbackEnabled());
diff --git a/ash/app_list/app_list_presenter_delegate.cc b/ash/app_list/app_list_presenter_delegate.cc index a425ee5..cfc805f0 100644 --- a/ash/app_list/app_list_presenter_delegate.cc +++ b/ash/app_list/app_list_presenter_delegate.cc
@@ -66,7 +66,7 @@ app_list::AppListPresenterImpl* presenter, app_list::AppListViewDelegateFactory* view_delegate_factory) : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } AppListPresenterDelegate::~AppListPresenterDelegate() { @@ -75,10 +75,10 @@ keyboard::KeyboardController::GetInstance(); if (keyboard_controller) keyboard_controller->RemoveObserver(this); - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); WmWindow* window = WmWindow::Get(view_->GetWidget()->GetNativeWindow()); window->GetRootWindowController()->GetShelf()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() { @@ -108,7 +108,7 @@ keyboard::KeyboardController::GetInstance(); if (keyboard_controller) keyboard_controller->AddObserver(this); - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); WmShelf* shelf = WmShelf::ForWindow(wm_root_window); shelf->AddObserver(this);
diff --git a/ash/ash_touch_exploration_manager_chromeos.cc b/ash/ash_touch_exploration_manager_chromeos.cc index cfbdf23..9603980 100644 --- a/ash/ash_touch_exploration_manager_chromeos.cc +++ b/ash/ash_touch_exploration_manager_chromeos.cc
@@ -30,7 +30,7 @@ base::CommandLine::ForCurrentProcess()->HasSwitch( chromeos::switches::kEnableChromeVoxArcSupport)) { Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); UpdateTouchExplorationState(); } @@ -40,7 +40,7 @@ Shell::Get()->system_tray_notifier(); if (system_tray_notifier) system_tray_notifier->RemoveAccessibilityObserver(this); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); } @@ -62,8 +62,8 @@ } void AshTouchExplorationManager::SilenceSpokenFeedback() { - if (Shell::GetInstance()->accessibility_delegate()->IsSpokenFeedbackEnabled()) - Shell::GetInstance()->accessibility_delegate()->SilenceSpokenFeedback(); + if (Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) + Shell::Get()->accessibility_delegate()->SilenceSpokenFeedback(); } void AshTouchExplorationManager::PlayVolumeAdjustEarcon() { @@ -71,30 +71,29 @@ return; if (!audio_handler_->IsOutputMuted() && audio_handler_->GetOutputVolumePercent() != 100) { - Shell::GetInstance()->accessibility_delegate()->PlayEarcon( + Shell::Get()->accessibility_delegate()->PlayEarcon( chromeos::SOUND_VOLUME_ADJUST); } } void AshTouchExplorationManager::PlayPassthroughEarcon() { - Shell::GetInstance()->accessibility_delegate()->PlayEarcon( + Shell::Get()->accessibility_delegate()->PlayEarcon( chromeos::SOUND_PASSTHROUGH); } void AshTouchExplorationManager::PlayExitScreenEarcon() { - Shell::GetInstance()->accessibility_delegate()->PlayEarcon( + Shell::Get()->accessibility_delegate()->PlayEarcon( chromeos::SOUND_EXIT_SCREEN); } void AshTouchExplorationManager::PlayEnterScreenEarcon() { - Shell::GetInstance()->accessibility_delegate()->PlayEarcon( + Shell::Get()->accessibility_delegate()->PlayEarcon( chromeos::SOUND_ENTER_SCREEN); } void AshTouchExplorationManager::HandleAccessibilityGesture( ui::AXGesture gesture) { - Shell::GetInstance()->accessibility_delegate()->HandleAccessibilityGesture( - gesture); + Shell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); } void AshTouchExplorationManager::OnDisplayMetricsChanged( @@ -107,15 +106,13 @@ void AshTouchExplorationManager::PlaySpokenFeedbackToggleCountdown( int tick_count) { - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); if (delegate->ShouldToggleSpokenFeedbackViaTouch()) delegate->PlaySpokenFeedbackToggleCountdown(tick_count); } void AshTouchExplorationManager::ToggleSpokenFeedback() { - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); if (delegate->ShouldToggleSpokenFeedbackViaTouch()) delegate->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_SHOW); } @@ -144,7 +141,7 @@ !enable_chromevox_arc_support_; const bool spoken_feedback_enabled = - Shell::GetInstance()->accessibility_delegate()->IsSpokenFeedbackEnabled(); + Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); if (!touch_accessibility_enabler_) { // Always enable gesture to toggle spoken feedback. @@ -165,7 +162,7 @@ .work_area(); touch_exploration_controller_->SetExcludeBounds(work_area); SilenceSpokenFeedback(); - Shell::GetInstance()->accessibility_delegate()->ClearFocusHighlight(); + Shell::Get()->accessibility_delegate()->ClearFocusHighlight(); } else { touch_exploration_controller_->SetExcludeBounds(gfx::Rect()); }
diff --git a/ash/aura/key_event_watcher_aura.cc b/ash/aura/key_event_watcher_aura.cc index 66a8a8d..332c3ee 100644 --- a/ash/aura/key_event_watcher_aura.cc +++ b/ash/aura/key_event_watcher_aura.cc
@@ -10,11 +10,11 @@ namespace ash { KeyEventWatcherAura::KeyEventWatcherAura() { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } KeyEventWatcherAura::~KeyEventWatcherAura() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void KeyEventWatcherAura::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/ash/aura/pointer_watcher_adapter.cc b/ash/aura/pointer_watcher_adapter.cc index c9e54ca..b965668 100644 --- a/ash/aura/pointer_watcher_adapter.cc +++ b/ash/aura/pointer_watcher_adapter.cc
@@ -17,11 +17,11 @@ namespace ash { PointerWatcherAdapter::PointerWatcherAdapter() { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } PointerWatcherAdapter::~PointerWatcherAdapter() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void PointerWatcherAdapter::AddPointerWatcher(
diff --git a/ash/aura/wm_shell_aura.cc b/ash/aura/wm_shell_aura.cc index af9ecb7..fdc12f52 100644 --- a/ash/aura/wm_shell_aura.cc +++ b/ash/aura/wm_shell_aura.cc
@@ -60,13 +60,13 @@ void WmShellAura::Shutdown() { if (added_display_observer_) - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); pointer_watcher_adapter_.reset(); WmShell::Shutdown(); - Shell::GetInstance()->window_tree_host_manager()->Shutdown(); + Shell::Get()->window_tree_host_manager()->Shutdown(); } bool WmShellAura::IsRunningInMash() const { @@ -79,36 +79,34 @@ WmWindow* WmShellAura::GetPrimaryRootWindow() { return WmWindow::Get( - Shell::GetInstance()->window_tree_host_manager()->GetPrimaryRootWindow()); + Shell::Get()->window_tree_host_manager()->GetPrimaryRootWindow()); } WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) { - return WmWindow::Get(Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_id)); + return WmWindow::Get( + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_id)); } const display::ManagedDisplayInfo& WmShellAura::GetDisplayInfo( int64_t display_id) const { - return Shell::GetInstance()->display_manager()->GetDisplayInfo(display_id); + return Shell::Get()->display_manager()->GetDisplayInfo(display_id); } bool WmShellAura::IsActiveDisplayId(int64_t display_id) const { - return Shell::GetInstance()->display_manager()->IsActiveDisplayId(display_id); + return Shell::Get()->display_manager()->IsActiveDisplayId(display_id); } display::Display WmShellAura::GetFirstDisplay() const { - return Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list()[0]; + return Shell::Get()->display_manager()->software_mirroring_display_list()[0]; } bool WmShellAura::IsInUnifiedMode() const { - return Shell::GetInstance()->display_manager()->IsInUnifiedMode(); + return Shell::Get()->display_manager()->IsInUnifiedMode(); } bool WmShellAura::IsInUnifiedModeIgnoreMirroring() const { - return Shell::GetInstance() + return Shell::Get() ->display_manager() ->current_default_multi_display_mode() == display::DisplayManager::UNIFIED; @@ -116,26 +114,26 @@ void WmShellAura::SetDisplayWorkAreaInsets(WmWindow* window, const gfx::Insets& insets) { - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->UpdateWorkAreaOfDisplayNearestWindow(window->aura_window(), insets); } void WmShellAura::LockCursor() { - Shell::GetInstance()->cursor_manager()->LockCursor(); + Shell::Get()->cursor_manager()->LockCursor(); } void WmShellAura::UnlockCursor() { - Shell::GetInstance()->cursor_manager()->UnlockCursor(); + Shell::Get()->cursor_manager()->UnlockCursor(); } bool WmShellAura::IsMouseEventsEnabled() { - return Shell::GetInstance()->cursor_manager()->IsMouseEventsEnabled(); + return Shell::Get()->cursor_manager()->IsMouseEventsEnabled(); } std::vector<WmWindow*> WmShellAura::GetAllRootWindows() { aura::Window::Windows root_windows = - Shell::GetInstance()->window_tree_host_manager()->GetAllRootWindows(); + Shell::Get()->window_tree_host_manager()->GetAllRootWindows(); std::vector<WmWindow*> wm_windows(root_windows.size()); for (size_t i = 0; i < root_windows.size(); ++i) wm_windows[i] = WmWindow::Get(root_windows[i]); @@ -143,7 +141,7 @@ } void WmShellAura::RecordUserMetricsAction(UserMetricsAction action) { - Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); + Shell::Get()->metrics()->RecordUserMetricsAction(action); } void WmShellAura::RecordGestureAction(GestureActionType action) { @@ -151,8 +149,7 @@ } void WmShellAura::RecordTaskSwitchMetric(TaskSwitchSource source) { - Shell::GetInstance()->metrics()->task_switch_metrics_recorder().OnTaskSwitch( - source); + Shell::Get()->metrics()->task_switch_metrics_recorder().OnTaskSwitch(source); } std::unique_ptr<WindowResizer> WmShellAura::CreateDragWindowResizer( @@ -201,13 +198,13 @@ } SessionStateDelegate* WmShellAura::GetSessionStateDelegate() { - return Shell::GetInstance()->session_state_delegate(); + return Shell::Get()->session_state_delegate(); } void WmShellAura::AddDisplayObserver(WmDisplayObserver* observer) { if (!added_display_observer_) { added_display_observer_ = true; - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); } display_observers_.AddObserver(observer); } @@ -230,17 +227,15 @@ } void WmShellAura::ToggleIgnoreExternalKeyboard() { - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); } void WmShellAura::SetLaserPointerEnabled(bool enabled) { - Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled); + Shell::Get()->laser_pointer_controller()->SetEnabled(enabled); } void WmShellAura::SetPartialMagnifierEnabled(bool enabled) { - Shell::GetInstance()->partial_magnification_controller()->SetEnabled(enabled); + Shell::Get()->partial_magnification_controller()->SetEnabled(enabled); } void WmShellAura::CreatePointerWatcherAdapter() { @@ -248,14 +243,13 @@ } void WmShellAura::CreatePrimaryHost() { - Shell::GetInstance()->window_tree_host_manager()->Start(); + Shell::Get()->window_tree_host_manager()->Start(); AshWindowTreeHostInitParams ash_init_params; - Shell::GetInstance()->window_tree_host_manager()->CreatePrimaryHost( - ash_init_params); + Shell::Get()->window_tree_host_manager()->CreatePrimaryHost(ash_init_params); } void WmShellAura::InitHosts(const ShellInitParams& init_params) { - Shell::GetInstance()->window_tree_host_manager()->InitHosts(); + Shell::Get()->window_tree_host_manager()->InitHosts(); } std::unique_ptr<AcceleratorController>
diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 55a70b3..174a7bd1 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc
@@ -101,10 +101,10 @@ enabled_ = enabled; if (enabled_) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); autoclick_controller_common_->CancelAutoclick(); } else { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } }
diff --git a/ash/autoclick/autoclick_unittest.cc b/ash/autoclick/autoclick_unittest.cc index 73d21ff..446a67d 100644 --- a/ash/autoclick/autoclick_unittest.cc +++ b/ash/autoclick/autoclick_unittest.cc
@@ -63,7 +63,7 @@ void SetUp() override { test::AshTestBase::SetUp(); - Shell::GetInstance()->AddPreTargetHandler(&mouse_event_capturer_); + Shell::Get()->AddPreTargetHandler(&mouse_event_capturer_); GetAutoclickController()->SetAutoclickDelay(base::TimeDelta()); // Move mouse to deterministic location at the start of each test. @@ -72,12 +72,12 @@ // Make sure the display is initialized so we don't fail the test due to any // input events caused from creating the display. if (!WmShell::Get()->IsRunningInMash()) - Shell::GetInstance()->display_manager()->UpdateDisplays(); + Shell::Get()->display_manager()->UpdateDisplays(); RunAllPendingInMessageLoop(); } void TearDown() override { - Shell::GetInstance()->RemovePreTargetHandler(&mouse_event_capturer_); + Shell::Get()->RemovePreTargetHandler(&mouse_event_capturer_); test::AshTestBase::TearDown(); } @@ -94,7 +94,7 @@ } AutoclickController* GetAutoclickController() { - return Shell::GetInstance()->autoclick_controller(); + return Shell::Get()->autoclick_controller(); } private:
diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc index a95f9f6..7fecc54 100644 --- a/ash/common/accelerators/accelerator_controller.cc +++ b/ash/common/accelerators/accelerator_controller.cc
@@ -380,9 +380,7 @@ // When spoken feedback is enabled, we should neither toggle the list nor // consume the key since Search+Shift is one of the shortcuts the a11y // feature uses. crbug.com/132296 - if (Shell::GetInstance() - ->accessibility_delegate() - ->IsSpokenFeedbackEnabled()) + if (Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) return false; } return true; @@ -521,8 +519,8 @@ } bool CanHandleShowStylusTools() { - return Shell::GetInstance()->palette_delegate() && - Shell::GetInstance()->palette_delegate()->ShouldShowPalette(); + return Shell::Get()->palette_delegate() && + Shell::Get()->palette_delegate()->ShouldShowPalette(); } void HandleSuspend() { @@ -612,13 +610,13 @@ message_center::MessageCenter::Get()->AddNotification( std::move(notification)); - Shell::GetInstance()->accessibility_delegate()->ToggleHighContrast(); + Shell::Get()->accessibility_delegate()->ToggleHighContrast(); } void HandleToggleSpokenFeedback() { base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); - Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback( + Shell::Get()->accessibility_delegate()->ToggleSpokenFeedback( A11Y_NOTIFICATION_SHOW); } @@ -1258,7 +1256,7 @@ } if (Shell::Get()->mru_window_tracker()->BuildMruWindowList().empty() && actions_needing_window_.find(action) != actions_needing_window_.end()) { - Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( + Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( A11Y_ALERT_WINDOW_NEEDED); return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; }
diff --git a/ash/common/accelerators/debug_commands.cc b/ash/common/accelerators/debug_commands.cc index b4269f23..fbbffef 100644 --- a/ash/common/accelerators/debug_commands.cc +++ b/ash/common/accelerators/debug_commands.cc
@@ -109,7 +109,7 @@ void HandleToggleWallpaperMode() { static int index = 0; WallpaperController* wallpaper_controller = - Shell::GetInstance()->wallpaper_controller(); + Shell::Get()->wallpaper_controller(); switch (++index % 4) { case 0: Shell::Get()->wallpaper_delegate()->InitializeWallpaper(); @@ -192,7 +192,7 @@ HandlePrintWindowHierarchy(); break; case DEBUG_SHOW_TOAST: - Shell::GetInstance()->toast_manager()->Show( + Shell::Get()->toast_manager()->Show( ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */, base::ASCIIToUTF16("Dismiss"))); break;
diff --git a/ash/common/frame/header_view.cc b/ash/common/frame/header_view.cc index 462c670c..c55a9ed 100644 --- a/ash/common/frame/header_view.cc +++ b/ash/common/frame/header_view.cc
@@ -31,11 +31,11 @@ header_painter_->Init(target_widget_, this, caption_button_container_); UpdateAvatarIcon(); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } HeaderView::~HeaderView() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void HeaderView::SchedulePaintForTitle() {
diff --git a/ash/common/keyboard/keyboard_ui.cc b/ash/common/keyboard/keyboard_ui.cc index f7be5dc..1b996396 100644 --- a/ash/common/keyboard/keyboard_ui.cc +++ b/ash/common/keyboard/keyboard_ui.cc
@@ -39,9 +39,7 @@ // to the appropriate keyboard functions. } bool IsEnabled() override { - return Shell::GetInstance() - ->accessibility_delegate() - ->IsVirtualKeyboardEnabled(); + return Shell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); } // AccessibilityObserver:
diff --git a/ash/common/mojo_interface_factory.cc b/ash/common/mojo_interface_factory.cc index e18be58..b7ec654 100644 --- a/ash/common/mojo_interface_factory.cc +++ b/ash/common/mojo_interface_factory.cc
@@ -85,7 +85,7 @@ void BindWallpaperRequestOnMainThread( mojom::WallpaperControllerRequest request) { - Shell::GetInstance()->wallpaper_controller()->BindRequest(std::move(request)); + Shell::Get()->wallpaper_controller()->BindRequest(std::move(request)); } } // namespace
diff --git a/ash/common/scoped_root_window_for_new_windows.cc b/ash/common/scoped_root_window_for_new_windows.cc index 55c59d2..df7bd41 100644 --- a/ash/common/scoped_root_window_for_new_windows.cc +++ b/ash/common/scoped_root_window_for_new_windows.cc
@@ -12,11 +12,11 @@ ScopedRootWindowForNewWindows::ScopedRootWindowForNewWindows( WmWindow* new_root) { DCHECK(new_root); - Shell::GetInstance()->scoped_root_window_for_new_windows_ = new_root; + Shell::Get()->scoped_root_window_for_new_windows_ = new_root; } ScopedRootWindowForNewWindows::~ScopedRootWindowForNewWindows() { - Shell::GetInstance()->scoped_root_window_for_new_windows_ = nullptr; + Shell::Get()->scoped_root_window_for_new_windows_ = nullptr; } } // namespace ash
diff --git a/ash/common/shelf/shelf_layout_manager.cc b/ash/common/shelf/shelf_layout_manager.cc index 426a9b9..20112a8 100644 --- a/ash/common/shelf/shelf_layout_manager.cc +++ b/ash/common/shelf/shelf_layout_manager.cc
@@ -159,9 +159,9 @@ keyboard_observer_(this) { DCHECK(shelf_widget_); DCHECK(wm_shelf_); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); WmShell::Get()->AddLockStateObserver(this); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); Shell::Get()->session_controller()->AddSessionStateObserver(this); state_.session_state = Shell::Get()->session_controller()->GetSessionState(); } @@ -172,7 +172,7 @@ for (auto& observer : observers_) observer.WillDeleteShelfLayoutManager(); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); WmShell::Get()->RemoveLockStateObserver(this); Shell::Get()->session_controller()->RemoveSessionStateObserver(this); } @@ -180,7 +180,7 @@ void ShelfLayoutManager::PrepareForShutdown() { in_shutdown_ = true; // Stop observing changes to avoid updating a partially destructed shelf. - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); } bool ShelfLayoutManager::IsVisible() const {
diff --git a/ash/common/shelf/shelf_locking_manager.cc b/ash/common/shelf/shelf_locking_manager.cc index 84bfcbfa..a63bf59 100644 --- a/ash/common/shelf/shelf_locking_manager.cc +++ b/ash/common/shelf/shelf_locking_manager.cc
@@ -20,13 +20,13 @@ controller->GetSessionState() != session_manager::SessionState::ACTIVE; screen_locked_ = controller->IsScreenLocked(); controller->AddSessionStateObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } ShelfLockingManager::~ShelfLockingManager() { WmShell::Get()->RemoveLockStateObserver(this); Shell::Get()->session_controller()->RemoveSessionStateObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void ShelfLockingManager::OnLockStateChanged(bool locked) {
diff --git a/ash/common/shelf/shelf_widget.cc b/ash/common/shelf/shelf_widget.cc index b18416c6..b41ab3e 100644 --- a/ash/common/shelf/shelf_widget.cc +++ b/ash/common/shelf/shelf_widget.cc
@@ -135,7 +135,7 @@ shelf_view_(nullptr), background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_, - Shell::GetInstance()->wallpaper_controller()), + Shell::Get()->wallpaper_controller()), activating_as_fallback_(false) { DCHECK(wm_shelf_); background_animator_.AddObserver(this);
diff --git a/ash/common/shelf/shelf_window_watcher.cc b/ash/common/shelf/shelf_window_watcher.cc index 090f296..8178432 100644 --- a/ash/common/shelf/shelf_window_watcher.cc +++ b/ash/common/shelf/shelf_window_watcher.cc
@@ -145,7 +145,7 @@ user_window_observer_(this), observed_container_windows_(&container_window_observer_), observed_user_windows_(&user_window_observer_) { - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) OnDisplayAdded(display); display::Screen::GetScreen()->AddObserver(this); @@ -153,7 +153,7 @@ ShelfWindowWatcher::~ShelfWindowWatcher() { display::Screen::GetScreen()->RemoveObserver(this); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); } void ShelfWindowWatcher::AddShelfItem(aura::Window* window) {
diff --git a/ash/common/shelf/wm_shelf.cc b/ash/common/shelf/wm_shelf.cc index 74247105..20735dd 100644 --- a/ash/common/shelf/wm_shelf.cc +++ b/ash/common/shelf/wm_shelf.cc
@@ -42,10 +42,10 @@ public: explicit AutoHideEventHandler(ShelfLayoutManager* shelf_layout_manager) : shelf_layout_manager_(shelf_layout_manager) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } ~AutoHideEventHandler() override { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } // Overridden from ui::EventHandler: @@ -175,8 +175,7 @@ shelf_widget_->OnShelfAlignmentChanged(); shelf_layout_manager_->LayoutShelf(); Shell::Get()->shelf_controller()->NotifyShelfAlignmentChanged(this); - Shell::GetInstance()->NotifyShelfAlignmentChanged( - GetWindow()->GetRootWindow()); + Shell::Get()->NotifyShelfAlignmentChanged(GetWindow()->GetRootWindow()); } bool WmShelf::IsHorizontalAlignment() const { @@ -220,7 +219,7 @@ auto_hide_behavior_ = auto_hide_behavior; Shell::Get()->shelf_controller()->NotifyShelfAutoHideBehaviorChanged(this); - Shell::GetInstance()->NotifyShelfAutoHideBehaviorChanged( + Shell::Get()->NotifyShelfAutoHideBehaviorChanged( GetWindow()->GetRootWindow()); }
diff --git a/ash/common/system/chromeos/brightness/tray_brightness.cc b/ash/common/system/chromeos/brightness/tray_brightness.cc index b5262021..f9f8033 100644 --- a/ash/common/system/chromeos/brightness/tray_brightness.cc +++ b/ash/common/system/chromeos/brightness/tray_brightness.cc
@@ -113,7 +113,7 @@ tri_view->AddView(TriView::Container::CENTER, slider_); if (is_default_view_) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); SetVisible(Shell::Get() ->maximize_mode_controller() ->IsMaximizeModeWindowManagerEnabled()); @@ -124,7 +124,7 @@ BrightnessView::~BrightnessView() { if (is_default_view_) - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void BrightnessView::SetBrightnessPercent(double percent) {
diff --git a/ash/common/system/chromeos/cast/tray_cast.cc b/ash/common/system/chromeos/cast/tray_cast.cc index efab106..2e08c675 100644 --- a/ash/common/system/chromeos/cast/tray_cast.cc +++ b/ash/common/system/chromeos/cast/tray_cast.cc
@@ -422,14 +422,14 @@ TrayCast::TrayCast(SystemTray* system_tray) : SystemTrayItem(system_tray, UMA_CAST) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->cast_config()->AddObserver(this); Shell::Get()->cast_config()->RequestDeviceRefresh(); } TrayCast::~TrayCast() { Shell::Get()->cast_config()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void TrayCast::StartCastForTest(const std::string& receiver_id) {
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc index 72f81e6..be1e7cf 100644 --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
@@ -377,7 +377,7 @@ } AccessibilityDelegate* accessibility_delegate = - Shell::GetInstance()->accessibility_delegate(); + Shell::Get()->accessibility_delegate(); // Fails to show the keyboard. if (accessibility_delegate->IsVirtualKeyboardEnabled()) return; @@ -410,9 +410,8 @@ } bool ImeMenuTray::ShouldShowKeyboardToggle() const { - return keyboard_suppressed_ && !Shell::GetInstance() - ->accessibility_delegate() - ->IsVirtualKeyboardEnabled(); + return keyboard_suppressed_ && + !Shell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); } base::string16 ImeMenuTray::GetAccessibleNameForTray() { @@ -528,8 +527,7 @@ if (!force_show_keyboard_) return; - Shell::GetInstance()->accessibility_delegate()->SetVirtualKeyboardEnabled( - false); + Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); force_show_keyboard_ = false; }
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc index 1b8273e8..dbbc5201 100644 --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc
@@ -259,7 +259,7 @@ EXPECT_TRUE(IsBubbleShown()); AccessibilityDelegate* accessibility_delegate = - Shell::GetInstance()->accessibility_delegate(); + Shell::Get()->accessibility_delegate(); accessibility_delegate->SetVirtualKeyboardEnabled(true); EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); @@ -278,7 +278,7 @@ TEST_F(ImeMenuTrayTest, ForceToShowEmojiKeyset) { AccessibilityDelegate* accessibility_delegate = - Shell::GetInstance()->accessibility_delegate(); + Shell::Get()->accessibility_delegate(); accessibility_delegate->SetVirtualKeyboardEnabled(false); ASSERT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled());
diff --git a/ash/common/system/chromeos/network/sms_observer_unittest.cc b/ash/common/system/chromeos/network/sms_observer_unittest.cc index 4aea419..f9c05a6c 100644 --- a/ash/common/system/chromeos/network/sms_observer_unittest.cc +++ b/ash/common/system/chromeos/network/sms_observer_unittest.cc
@@ -45,9 +45,7 @@ SmsObserverTest() {} ~SmsObserverTest() override {} - SmsObserver* GetSmsObserver() { - return Shell::GetInstance()->sms_observer_.get(); - } + SmsObserver* GetSmsObserver() { return Shell::Get()->sms_observer_.get(); } private: DISALLOW_COPY_AND_ASSIGN(SmsObserverTest);
diff --git a/ash/common/system/chromeos/palette/palette_tray.cc b/ash/common/system/chromeos/palette/palette_tray.cc index 197e75ab..a5ab72d 100644 --- a/ash/common/system/chromeos/palette/palette_tray.cc +++ b/ash/common/system/chromeos/palette/palette_tray.cc
@@ -164,7 +164,7 @@ tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset); tray_container()->AddChildView(icon_); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->session_controller()->AddSessionStateObserver(this); ui::InputDeviceManager::GetInstance()->AddObserver(this); } @@ -174,7 +174,7 @@ bubble_->bubble_view()->reset_delegate(); ui::InputDeviceManager::GetInstance()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); Shell::Get()->session_controller()->RemoveSessionStateObserver(this); } @@ -287,7 +287,7 @@ if (!palette_utils::HasStylusInput()) return; - PaletteDelegate* palette_delegate = Shell::GetInstance()->palette_delegate(); + PaletteDelegate* palette_delegate = Shell::Get()->palette_delegate(); // Don't do anything if the palette should not be shown or if the user has // disabled it all-together. @@ -399,7 +399,7 @@ } void PaletteTray::Initialize() { - PaletteDelegate* delegate = Shell::GetInstance()->palette_delegate(); + PaletteDelegate* delegate = Shell::Get()->palette_delegate(); // |delegate| can be null in tests. if (!delegate) return;
diff --git a/ash/common/system/chromeos/palette/tools/capture_region_mode.cc b/ash/common/system/chromeos/palette/tools/capture_region_mode.cc index dd0c016..afa2683 100644 --- a/ash/common/system/chromeos/palette/tools/capture_region_mode.cc +++ b/ash/common/system/chromeos/palette/tools/capture_region_mode.cc
@@ -46,9 +46,9 @@ ToastData toast(kToastId, l10n_util::GetStringUTF16( IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_TOAST), kToastDurationMs, base::Optional<base::string16>()); - Shell::GetInstance()->toast_manager()->Show(toast); + Shell::Get()->toast_manager()->Show(toast); - Shell::GetInstance()->palette_delegate()->TakePartialScreenshot(base::Bind( + Shell::Get()->palette_delegate()->TakePartialScreenshot(base::Bind( &CaptureRegionMode::OnScreenshotDone, weak_factory_.GetWeakPtr())); delegate()->HidePalette(); } @@ -58,7 +58,7 @@ // If the user manually cancelled the action we need to make sure to cancel // the screenshot session as well. - Shell::GetInstance()->palette_delegate()->CancelPartialScreenshot(); + Shell::Get()->palette_delegate()->CancelPartialScreenshot(); } views::View* CaptureRegionMode::CreateView() {
diff --git a/ash/common/system/chromeos/palette/tools/capture_screen_action.cc b/ash/common/system/chromeos/palette/tools/capture_screen_action.cc index 29cfd10..2c300a25 100644 --- a/ash/common/system/chromeos/palette/tools/capture_screen_action.cc +++ b/ash/common/system/chromeos/palette/tools/capture_screen_action.cc
@@ -31,7 +31,7 @@ delegate()->DisableTool(GetToolId()); delegate()->HidePaletteImmediately(); - Shell::GetInstance()->palette_delegate()->TakeScreenshot(); + Shell::Get()->palette_delegate()->TakeScreenshot(); } views::View* CaptureScreenAction::CreateView() {
diff --git a/ash/common/system/chromeos/palette/tools/create_note_action.cc b/ash/common/system/chromeos/palette/tools/create_note_action.cc index bbdc251..b01cf0f 100644 --- a/ash/common/system/chromeos/palette/tools/create_note_action.cc +++ b/ash/common/system/chromeos/palette/tools/create_note_action.cc
@@ -29,14 +29,14 @@ void CreateNoteAction::OnEnable() { CommonPaletteTool::OnEnable(); - Shell::GetInstance()->palette_delegate()->CreateNote(); + Shell::Get()->palette_delegate()->CreateNote(); delegate()->DisableTool(GetToolId()); delegate()->HidePalette(); } views::View* CreateNoteAction::CreateView() { - if (!Shell::GetInstance()->palette_delegate()->HasNoteApp()) + if (!Shell::Get()->palette_delegate()->HasNoteApp()) return nullptr; return CreateDefaultView(
diff --git a/ash/common/system/chromeos/palette/tools/create_note_unittest.cc b/ash/common/system/chromeos/palette/tools/create_note_unittest.cc index d8af84c..c2ba8fe6 100644 --- a/ash/common/system/chromeos/palette/tools/create_note_unittest.cc +++ b/ash/common/system/chromeos/palette/tools/create_note_unittest.cc
@@ -35,8 +35,7 @@ } TestPaletteDelegate* test_palette_delegate() { - return static_cast<TestPaletteDelegate*>( - Shell::GetInstance()->palette_delegate()); + return static_cast<TestPaletteDelegate*>(Shell::Get()->palette_delegate()); } protected:
diff --git a/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc b/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc index f66426d1..29cfe26 100644 --- a/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc +++ b/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc
@@ -34,8 +34,7 @@ } TestPaletteDelegate* test_palette_delegate() { - return static_cast<TestPaletteDelegate*>( - Shell::GetInstance()->palette_delegate()); + return static_cast<TestPaletteDelegate*>(Shell::Get()->palette_delegate()); } protected:
diff --git a/ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc b/ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc index 3920c4ed..ecf05f1 100644 --- a/ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc +++ b/ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc
@@ -29,12 +29,12 @@ ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray) : ScreenTrayItem(system_tray, UMA_SCREEN_CAPTURE) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->system_tray_notifier()->AddScreenCaptureObserver(this); } ScreenCaptureTrayItem::~ScreenCaptureTrayItem() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); Shell::Get()->system_tray_notifier()->RemoveScreenCaptureObserver(this); }
diff --git a/ash/common/system/chromeos/session/logout_confirmation_controller.cc b/ash/common/system/chromeos/session/logout_confirmation_controller.cc index e93d6ac..01933d75 100644 --- a/ash/common/system/chromeos/session/logout_confirmation_controller.cc +++ b/ash/common/system/chromeos/session/logout_confirmation_controller.cc
@@ -28,14 +28,14 @@ dialog_(NULL), logout_timer_(false, false) { if (Shell::HasInstance()) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->system_tray_notifier()->AddLastWindowClosedObserver(this); } } LogoutConfirmationController::~LogoutConfirmationController() { if (Shell::HasInstance()) { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); Shell::Get()->system_tray_notifier()->RemoveLastWindowClosedObserver(this); } if (dialog_)
diff --git a/ash/common/system/chromeos/tray_caps_lock.cc b/ash/common/system/chromeos/tray_caps_lock.cc index d7432cda..132c3b67 100644 --- a/ash/common/system/chromeos/tray_caps_lock.cc +++ b/ash/common/system/chromeos/tray_caps_lock.cc
@@ -159,7 +159,7 @@ caps_lock_enabled_ = enabled; // Send an a11y alert. - Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( + Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( enabled ? A11Y_ALERT_CAPS_ON : A11Y_ALERT_CAPS_OFF); if (tray_view())
diff --git a/ash/common/system/ime/tray_ime_chromeos.cc b/ash/common/system/ime/tray_ime_chromeos.cc index 501bd53..e395bd2 100644 --- a/ash/common/system/ime/tray_ime_chromeos.cc +++ b/ash/common/system/ime/tray_ime_chromeos.cc
@@ -206,9 +206,8 @@ } bool TrayIME::ShouldShowKeyboardToggle() { - return keyboard_suppressed_ && !Shell::GetInstance() - ->accessibility_delegate() - ->IsVirtualKeyboardEnabled(); + return keyboard_suppressed_ && + !Shell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); } base::string16 TrayIME::GetDefaultViewLabel(bool show_ime_label) {
diff --git a/ash/common/system/ime/tray_ime_chromeos_unittest.cc b/ash/common/system/ime/tray_ime_chromeos_unittest.cc index 8530e4f..8221b50 100644 --- a/ash/common/system/ime/tray_ime_chromeos_unittest.cc +++ b/ash/common/system/ime/tray_ime_chromeos_unittest.cc
@@ -60,8 +60,7 @@ }; void TrayIMETest::SetAccessibilityKeyboardEnabled(bool enabled) { - Shell::GetInstance()->accessibility_delegate()->SetVirtualKeyboardEnabled( - enabled); + Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(enabled); keyboard::SetAccessibilityKeyboardEnabled(enabled); AccessibilityNotificationVisibility notification = enabled ? A11Y_NOTIFICATION_SHOW : A11Y_NOTIFICATION_NONE;
diff --git a/ash/common/system/overview/overview_button_tray.cc b/ash/common/system/overview/overview_button_tray.cc index 8eaeaf8a..8f85033 100644 --- a/ash/common/system/overview/overview_button_tray.cc +++ b/ash/common/system/overview/overview_button_tray.cc
@@ -33,12 +33,12 @@ // horizontal shelf, no separator is required. set_separator_visibility(false); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->session_controller()->AddSessionStateObserver(this); } OverviewButtonTray::~OverviewButtonTray() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); Shell::Get()->session_controller()->RemoveSessionStateObserver(this); }
diff --git a/ash/common/system/tiles/tiles_default_view.cc b/ash/common/system/tiles/tiles_default_view.cc index 1e3ebed..07b71018 100644 --- a/ash/common/system/tiles/tiles_default_view.cc +++ b/ash/common/system/tiles/tiles_default_view.cc
@@ -123,7 +123,7 @@ ->RequestLockScreen(); } else if (sender == power_button_) { shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN); - Shell::GetInstance()->lock_state_controller()->RequestShutdown(); + Shell::Get()->lock_state_controller()->RequestShutdown(); } owner_->system_tray()->CloseSystemBubble();
diff --git a/ash/common/system/tray/system_tray.cc b/ash/common/system/tray/system_tray.cc index ee60335..8f3f1945 100644 --- a/ash/common/system/tray/system_tray.cc +++ b/ash/common/system/tray/system_tray.cc
@@ -134,9 +134,7 @@ // If ChromeVox is enabled, focus the default item if no item is focused and // there isn't a delayed close. - if (Shell::GetInstance() - ->accessibility_delegate() - ->IsSpokenFeedbackEnabled() && + if (Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled() && !is_persistent) { bubble_->FocusDefaultIfNeeded(); } @@ -165,11 +163,11 @@ public: explicit ActivationObserver(SystemTray* tray) : tray_(tray) { DCHECK(tray_); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); } ~ActivationObserver() override { - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); } // WmActivationObserver: @@ -474,9 +472,7 @@ if (system_bubble_.get() && creation_type == BUBBLE_USE_EXISTING) { system_bubble_->bubble()->UpdateView(items, bubble_type); // If ChromeVox is enabled, focus the default item if no item is focused. - if (Shell::GetInstance() - ->accessibility_delegate() - ->IsSpokenFeedbackEnabled()) + if (Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) system_bubble_->bubble()->FocusDefaultIfNeeded(); } else { // Cleanup the existing bubble before showing a new one. Otherwise, it's
diff --git a/ash/common/system/tray/system_tray_unittest.cc b/ash/common/system/tray/system_tray_unittest.cc index 05dc12b..8f4f0206 100644 --- a/ash/common/system/tray/system_tray_unittest.cc +++ b/ash/common/system/tray/system_tray_unittest.cc
@@ -518,8 +518,7 @@ TEST_F(SystemTrayTest, WithSystemModal) { // Check if the accessibility item is created even with system modal dialog. - Shell::GetInstance()->accessibility_delegate()->SetVirtualKeyboardEnabled( - true); + Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(true); std::unique_ptr<views::Widget> widget(CreateTestWidget( new ModalWidgetDelegate, kShellWindowId_SystemModalContainer, gfx::Rect(0, 0, 100, 100)));
diff --git a/ash/common/system/tray_accessibility.cc b/ash/common/system/tray_accessibility.cc index 47eb8fb..3d32c7a 100644 --- a/ash/common/system/tray_accessibility.cc +++ b/ash/common/system/tray_accessibility.cc
@@ -57,8 +57,7 @@ }; uint32_t GetAccessibilityState() { - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); uint32_t state = A11Y_NONE; if (delegate->IsSpokenFeedbackEnabled()) state |= A11Y_SPOKEN_FEEDBACK; @@ -226,8 +225,7 @@ void AccessibilityDetailedView::AppendAccessibilityList() { CreateScrollableList(); - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); spoken_feedback_view_ = AddScrollListItem( l10n_util::GetStringUTF16( @@ -334,8 +332,7 @@ } void AccessibilityDetailedView::HandleViewClicked(views::View* view) { - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); UserMetricsAction user_action; if (view == spoken_feedback_view_) { user_action = delegate->IsSpokenFeedbackEnabled() @@ -479,8 +476,7 @@ // - "Enable accessibility menu" on chrome://settings is checked; // - or any of accessibility features is enabled // Otherwise, not shows it. - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); if (login_ != LoginStatus::NOT_LOGGED_IN && !delegate->ShouldShowAccessibilityMenu() && // On login screen, keeps the initial visibility of the menu.
diff --git a/ash/common/system/web_notification/ash_popup_alignment_delegate.cc b/ash/common/system/web_notification/ash_popup_alignment_delegate.cc index b32732b..c1a5c3ed 100644 --- a/ash/common/system/web_notification/ash_popup_alignment_delegate.cc +++ b/ash/common/system/web_notification/ash_popup_alignment_delegate.cc
@@ -40,7 +40,7 @@ AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() { if (screen_) screen_->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); shelf_->RemoveObserver(this); } @@ -50,7 +50,7 @@ screen_ = screen; work_area_ = display.work_area(); screen->AddObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); if (tray_bubble_height_ > 0) UpdateWorkArea(); }
diff --git a/ash/common/test/test_shelf_delegate.cc b/ash/common/test/test_shelf_delegate.cc index 65565d1..51104ed 100644 --- a/ash/common/test/test_shelf_delegate.cc +++ b/ash/common/test/test_shelf_delegate.cc
@@ -42,10 +42,8 @@ // shelf is created, to simulate ChromeLauncherController's behavior. class ShelfInitializer : public ShellObserver { public: - ShelfInitializer() { Shell::GetInstance()->AddShellObserver(this); } - ~ShelfInitializer() override { - Shell::GetInstance()->RemoveShellObserver(this); - } + ShelfInitializer() { Shell::Get()->AddShellObserver(this); } + ~ShelfInitializer() override { Shell::Get()->RemoveShellObserver(this); } // ShellObserver: void OnShelfCreatedForRootWindow(WmWindow* root_window) override {
diff --git a/ash/common/wallpaper/wallpaper_controller.cc b/ash/common/wallpaper/wallpaper_controller.cc index db86f201..09864d6 100644 --- a/ash/common/wallpaper/wallpaper_controller.cc +++ b/ash/common/wallpaper/wallpaper_controller.cc
@@ -94,7 +94,7 @@ wallpaper_reload_delay_(kWallpaperReloadDelayMs), task_runner_(task_runner) { WmShell::Get()->AddDisplayObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); Shell::Get()->session_controller()->AddSessionStateObserver(this); } @@ -104,7 +104,7 @@ if (color_calculator_) color_calculator_->RemoveObserver(this); WmShell::Get()->RemoveDisplayObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); Shell::Get()->session_controller()->RemoveSessionStateObserver(this); }
diff --git a/ash/common/wallpaper/wallpaper_controller_unittest.cc b/ash/common/wallpaper/wallpaper_controller_unittest.cc index 4cb2fba3..13503743 100644 --- a/ash/common/wallpaper/wallpaper_controller_unittest.cc +++ b/ash/common/wallpaper/wallpaper_controller_unittest.cc
@@ -122,7 +122,7 @@ WmShell::Get()->GetPrimaryRootWindow()->GetRootWindowController(); root_window_controller->SetWallpaperWidgetController(nullptr); root_window_controller->SetAnimatingWallpaperWidgetController(nullptr); - controller_ = Shell::GetInstance()->wallpaper_controller(); + controller_ = Shell::Get()->wallpaper_controller(); wallpaper_delegate_ = static_cast<test::TestWallpaperDelegate*>( Shell::Get()->wallpaper_delegate()); controller_->set_wallpaper_reload_delay_for_test(0); @@ -231,8 +231,7 @@ }; TEST_F(WallpaperControllerTest, BasicReparenting) { - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); controller->CreateEmptyWallpaper(); // Wallpaper view/window exists in the wallpaper container and nothing is in @@ -264,8 +263,7 @@ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Create the wallpaper and its view. - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); controller->CreateEmptyWallpaper(); // The new wallpaper is ready to animate. @@ -290,8 +288,7 @@ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Reset wallpaper state, see ControllerOwnership above. - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); controller->CreateEmptyWallpaper(); // Run wallpaper show animation to completion. @@ -338,8 +335,7 @@ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Reset wallpaper state, see ControllerOwnership above. - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); controller->CreateEmptyWallpaper(); // Run wallpaper show animation to completion. @@ -391,7 +387,7 @@ // that the resized image is the expected size. controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); EXPECT_TRUE(image.BackedBySameObjectAs(controller_->GetWallpaper())); - RunAllBlockingPoolTasksUntilIdle(Shell::GetInstance()->blocking_pool().get()); + RunAllBlockingPoolTasksUntilIdle(Shell::Get()->blocking_pool().get()); gfx::ImageSkia resized_image = controller_->GetWallpaper(); EXPECT_FALSE(image.BackedBySameObjectAs(resized_image)); EXPECT_EQ(gfx::Size(320, 200).ToString(), resized_image.size().ToString()); @@ -400,7 +396,7 @@ // previously-resized image instead of doing another resize // (http://crbug.com/321402). controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); - RunAllBlockingPoolTasksUntilIdle(Shell::GetInstance()->blocking_pool().get()); + RunAllBlockingPoolTasksUntilIdle(Shell::Get()->blocking_pool().get()); EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); }
diff --git a/ash/common/wallpaper/wallpaper_view.cc b/ash/common/wallpaper/wallpaper_view.cc index 8fedb4a..325f59e 100644 --- a/ash/common/wallpaper/wallpaper_view.cc +++ b/ash/common/wallpaper/wallpaper_view.cc
@@ -126,8 +126,7 @@ // to fill the wallpaper. Ideally the image should be larger than the largest // display supported, if not we will scale and center it if the layout is // wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED. - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); gfx::ImageSkia wallpaper = controller->GetWallpaper(); wallpaper::WallpaperLayout layout = controller->GetWallpaperLayout(); @@ -193,8 +192,7 @@ } views::Widget* CreateWallpaper(WmWindow* root_window, int container_id) { - WallpaperController* controller = - Shell::GetInstance()->wallpaper_controller(); + WallpaperController* controller = Shell::Get()->wallpaper_controller(); WallpaperDelegate* wallpaper_delegate = Shell::Get()->wallpaper_delegate(); views::Widget* wallpaper_widget = new views::Widget;
diff --git a/ash/common/wm/lock_layout_manager.cc b/ash/common/wm/lock_layout_manager.cc index 1b5c27e..568c4777 100644 --- a/ash/common/wm/lock_layout_manager.cc +++ b/ash/common/wm/lock_layout_manager.cc
@@ -21,7 +21,7 @@ window_(window), root_window_(window->GetRootWindow()), keyboard_observer_(this) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); root_window_->aura_window()->AddObserver(this); if (keyboard::KeyboardController::GetInstance()) keyboard_observer_.Add(keyboard::KeyboardController::GetInstance()); @@ -34,7 +34,7 @@ for (WmWindow* child : window_->GetChildren()) child->aura_window()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void LockLayoutManager::OnWindowResized() {
diff --git a/ash/common/wm/maximize_mode/maximize_mode_controller.cc b/ash/common/wm/maximize_mode/maximize_mode_controller.cc index 037ce1a..a08e7a2 100644 --- a/ash/common/wm/maximize_mode/maximize_mode_controller.cc +++ b/ash/common/wm/maximize_mode/maximize_mode_controller.cc
@@ -111,7 +111,7 @@ tablet_mode_switch_is_on_(false), lid_is_closed_(false), weak_factory_(this) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); WmShell::Get()->RecordUserMetricsAction(UMA_MAXIMIZE_MODE_INITIALLY_DISABLED); // TODO(jonross): Do not create MaximizeModeController if the flag is @@ -130,7 +130,7 @@ } MaximizeModeController::~MaximizeModeController() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); if (IsEnabled()) { WmShell::Get()->RemoveDisplayObserver(this); @@ -162,17 +162,17 @@ // TODO(jonross): Move the maximize mode notifications from ShellObserver // to MaximizeModeController::Observer shell->RecordUserMetricsAction(UMA_MAXIMIZE_MODE_ENABLED); - Shell::GetInstance()->NotifyMaximizeModeStarted(); + Shell::Get()->NotifyMaximizeModeStarted(); observers_.ForAllPtrs([](mojom::TouchViewObserver* observer) { observer->OnTouchViewToggled(true); }); } else { - Shell::GetInstance()->NotifyMaximizeModeEnding(); + Shell::Get()->NotifyMaximizeModeEnding(); maximize_mode_window_manager_.reset(); shell->RecordUserMetricsAction(UMA_MAXIMIZE_MODE_DISABLED); - Shell::GetInstance()->NotifyMaximizeModeEnded(); + Shell::Get()->NotifyMaximizeModeEnded(); observers_.ForAllPtrs([](mojom::TouchViewObserver* observer) { observer->OnTouchViewToggled(false);
diff --git a/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc index d4a3e88..89e62cb 100644 --- a/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc +++ b/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc
@@ -48,7 +48,7 @@ for (aura::Window* window : added_windows_) window->RemoveObserver(this); added_windows_.clear(); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); display::Screen::GetScreen()->RemoveObserver(this); EnableBackdropBehindTopWindowOnEachDisplay(false); RemoveWindowCreationObservers(); @@ -206,7 +206,7 @@ AddWindowCreationObservers(); EnableBackdropBehindTopWindowOnEachDisplay(true); display::Screen::GetScreen()->AddObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); event_handler_ = WmShell::Get()->CreateMaximizeModeEventHandler(); } @@ -276,7 +276,7 @@ DCHECK(observed_container_windows_.empty()); // Observe window activations/creations in the default containers on all root // windows. - for (aura::Window* root : Shell::GetInstance()->GetAllRootWindows()) { + for (aura::Window* root : Shell::Get()->GetAllRootWindows()) { aura::Window* default_container = root->GetChildById(kShellWindowId_DefaultContainer); DCHECK(!base::ContainsKey(observed_container_windows_, default_container));
diff --git a/ash/common/wm/mru_window_tracker.cc b/ash/common/wm/mru_window_tracker.cc index f8864bb0..57a392f 100644 --- a/ash/common/wm/mru_window_tracker.cc +++ b/ash/common/wm/mru_window_tracker.cc
@@ -102,11 +102,11 @@ // MruWindowTracker, public: MruWindowTracker::MruWindowTracker() : ignore_window_activations_(false) { - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); } MruWindowTracker::~MruWindowTracker() { - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); for (WmWindow* window : mru_windows_) window->aura_window()->RemoveObserver(this); }
diff --git a/ash/common/wm/overview/window_selector.cc b/ash/common/wm/overview/window_selector.cc index ede2565..369104f 100644 --- a/ash/common/wm/overview/window_selector.cc +++ b/ash/common/wm/overview/window_selector.cc
@@ -306,12 +306,12 @@ DCHECK(!grid_list_.empty()); UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); shell->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); // Send an a11y alert. - Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( + Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); UpdateShelfVisibility(); @@ -375,7 +375,7 @@ for (WmWindow* window : observed_windows_) window->aura_window()->RemoveObserver(this); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); if (restore_focus_window_) restore_focus_window_->aura_window()->RemoveObserver(this);
diff --git a/ash/common/wm/overview/window_selector_controller.cc b/ash/common/wm/overview/window_selector_controller.cc index ccf96490..95c78bc 100644 --- a/ash/common/wm/overview/window_selector_controller.cc +++ b/ash/common/wm/overview/window_selector_controller.cc
@@ -65,7 +65,7 @@ if (windows.empty()) return false; - Shell::GetInstance()->NotifyOverviewModeStarting(); + Shell::Get()->NotifyOverviewModeStarting(); window_selector_.reset(new WindowSelector(this)); window_selector_->Init(windows); OnSelectionStarted(); @@ -98,7 +98,7 @@ window_selector_->Shutdown(); window_selector_.reset(); last_selection_time_ = base::Time::Now(); - Shell::GetInstance()->NotifyOverviewModeEnded(); + Shell::Get()->NotifyOverviewModeEnded(); } void WindowSelectorController::AddDelayedAnimationObserver(
diff --git a/ash/common/wm/panels/panel_frame_view.cc b/ash/common/wm/panels/panel_frame_view.cc index c6546d7..0cfefd0 100644 --- a/ash/common/wm/panels/panel_frame_view.cc +++ b/ash/common/wm/panels/panel_frame_view.cc
@@ -28,11 +28,11 @@ DCHECK(!frame_->widget_delegate()->CanMaximize()); if (frame_type != FRAME_NONE) InitHeaderPainter(); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } PanelFrameView::~PanelFrameView() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void PanelFrameView::SetFrameColors(SkColor active_frame_color,
diff --git a/ash/common/wm/panels/panel_layout_manager.cc b/ash/common/wm/panels/panel_layout_manager.cc index c910aab..29d2759e 100644 --- a/ash/common/wm/panels/panel_layout_manager.cc +++ b/ash/common/wm/panels/panel_layout_manager.cc
@@ -258,9 +258,9 @@ keyboard_observer_(this), weak_factory_(this) { DCHECK(panel_container); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); WmShell::Get()->AddDisplayObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } PanelLayoutManager::~PanelLayoutManager() { @@ -290,9 +290,9 @@ } panel_windows_.clear(); WmShell* shell = panel_container_->GetShell(); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); shell->RemoveDisplayObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void PanelLayoutManager::StartDragging(WmWindow* panel) {
diff --git a/ash/common/wm/screen_dimmer.cc b/ash/common/wm/screen_dimmer.cc index 5986b5d..40b671d2 100644 --- a/ash/common/wm/screen_dimmer.cc +++ b/ash/common/wm/screen_dimmer.cc
@@ -29,13 +29,13 @@ is_dimming_(false), at_bottom_(false), window_dimmers_(base::MakeUnique<WindowUserData<WindowDimmer>>()) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } ScreenDimmer::~ScreenDimmer() { // Usage in chrome results in ScreenDimmer outliving the shell. if (Shell::HasInstance()) - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void ScreenDimmer::SetDimming(bool should_dim) {
diff --git a/ash/common/wm/window_positioning_utils.cc b/ash/common/wm/window_positioning_utils.cc index 88e3246..99738613 100644 --- a/ash/common/wm/window_positioning_utils.cc +++ b/ash/common/wm/window_positioning_utils.cc
@@ -179,8 +179,7 @@ // Restore focused/active window. if (focused && tracker.Contains(focused->aura_window())) { focused->SetFocused(); - Shell::GetInstance()->set_root_window_for_new_windows( - focused->GetRootWindow()); + Shell::Get()->set_root_window_for_new_windows(focused->GetRootWindow()); } else if (active && tracker.Contains(active->aura_window())) { active->Activate(); }
diff --git a/ash/common/wm/workspace/workspace_layout_manager.cc b/ash/common/wm/workspace/workspace_layout_manager.cc index 453a3b6..6766bc7 100644 --- a/ash/common/wm/workspace/workspace_layout_manager.cc +++ b/ash/common/wm/workspace/workspace_layout_manager.cc
@@ -45,8 +45,8 @@ work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)), is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr), keyboard_observer_(this) { - Shell::GetInstance()->AddShellObserver(this); - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->AddShellObserver(this); + Shell::Get()->activation_client()->AddObserver(this); root_window_->aura_window()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); DCHECK(window->aura_window()->GetProperty(kSnapChildrenToPixelBoundary)); @@ -61,8 +61,8 @@ window->aura_window()->RemoveObserver(this); } display::Screen::GetScreen()->RemoveObserver(this); - Shell::GetInstance()->activation_client()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); + Shell::Get()->RemoveShellObserver(this); } void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( @@ -380,8 +380,7 @@ return; bool is_fullscreen = wm::GetWindowForFullscreenMode(window_) != nullptr; if (is_fullscreen != is_fullscreen_) { - Shell::GetInstance()->NotifyFullscreenStateChanged(is_fullscreen, - root_window_); + Shell::Get()->NotifyFullscreenStateChanged(is_fullscreen, root_window_); is_fullscreen_ = is_fullscreen; } }
diff --git a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc index 4cb9806..fa34c20 100644 --- a/ash/common/wm/workspace/workspace_layout_manager_unittest.cc +++ b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
@@ -67,12 +67,10 @@ class TestShellObserver : public ShellObserver { public: TestShellObserver() : call_count_(0), is_fullscreen_(false) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } - ~TestShellObserver() override { - Shell::GetInstance()->RemoveShellObserver(this); - } + ~TestShellObserver() override { Shell::Get()->RemoveShellObserver(this); } void OnFullscreenStateChanged(bool is_fullscreen, WmWindow* root_window) override {
diff --git a/ash/common/wm_window.cc b/ash/common/wm_window.cc index 151fc502..5216083 100644 --- a/ash/common/wm_window.cc +++ b/ash/common/wm_window.cc
@@ -669,7 +669,7 @@ return; } ResizeShadowController* resize_shadow_controller = - Shell::GetInstance()->resize_shadow_controller(); + Shell::Get()->resize_shadow_controller(); if (resize_shadow_controller) resize_shadow_controller->ShowShadow(window_, component); } @@ -680,7 +680,7 @@ return; } ResizeShadowController* resize_shadow_controller = - Shell::GetInstance()->resize_shadow_controller(); + Shell::Get()->resize_shadow_controller(); if (resize_shadow_controller) resize_shadow_controller->HideShadow(window_); }
diff --git a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc index 9f8683c..ad389bf 100644 --- a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc +++ b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc
@@ -63,20 +63,16 @@ } bool RotationLocked() { - return Shell::GetInstance() - ->screen_orientation_controller() - ->rotation_locked(); + return Shell::Get()->screen_orientation_controller()->rotation_locked(); } bool UserRotationLocked() { - return Shell::GetInstance() - ->screen_orientation_controller() - ->user_rotation_locked(); + return Shell::Get()->screen_orientation_controller()->user_rotation_locked(); } void SetDisplayRotationById(int64_t display_id, display::Display::Rotation rotation) { - Shell::GetInstance()->display_manager()->SetDisplayRotation( + Shell::Get()->display_manager()->SetDisplayRotation( display_id, rotation, display::Display::ROTATION_SOURCE_USER); } @@ -88,8 +84,7 @@ scoped_refptr<chromeos::AccelerometerUpdate> update( new chromeos::AccelerometerUpdate()); update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), lid.z()); - Shell::GetInstance()->screen_orientation_controller()->OnAccelerometerUpdated( - update); + Shell::Get()->screen_orientation_controller()->OnAccelerometerUpdated(update); } // Attaches the NativeView of |web_contents| to |parent| without changing the @@ -106,7 +101,7 @@ void AttachAndActivateWebContents(content::WebContents* web_contents, aura::Window* parent) { AttachWebContents(web_contents, parent); - Shell::GetInstance()->activation_client()->ActivateWindow(parent); + Shell::Get()->activation_client()->ActivateWindow(parent); } } // namespace @@ -144,23 +139,20 @@ void SetSystemRotationLocked(bool rotation_locked) { test::ScreenOrientationControllerTestApi( - Shell::GetInstance()->screen_orientation_controller()) + Shell::Get()->screen_orientation_controller()) .SetRotationLocked(rotation_locked); } void SetUserRotationLocked(bool rotation_locked) { - if (Shell::GetInstance() - ->screen_orientation_controller() - ->user_rotation_locked() != rotation_locked) { - Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + if (Shell::Get()->screen_orientation_controller()->user_rotation_locked() != + rotation_locked) { + Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); } } blink::WebScreenOrientationLockType UserLockedOrientation() const { test::ScreenOrientationControllerTestApi test_api( - Shell::GetInstance()->screen_orientation_controller()); + Shell::Get()->screen_orientation_controller()); return test_api.UserLockedOrientation(); } @@ -292,7 +284,7 @@ ASSERT_TRUE(RotationLocked()); aura::client::ActivationClient* activation_client = - Shell::GetInstance()->activation_client(); + Shell::Get()->activation_client(); activation_client->ActivateWindow(focus_window2.get()); EXPECT_FALSE(RotationLocked()); @@ -315,7 +307,7 @@ EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); aura::client::ActivationClient* activation_client = - Shell::GetInstance()->activation_client(); + Shell::Get()->activation_client(); activation_client->ActivateWindow(focus_window2.get()); EXPECT_TRUE(RotationLocked()); EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); @@ -358,7 +350,7 @@ EXPECT_FALSE(RotationLocked()); aura::client::ActivationClient* activation_client = - Shell::GetInstance()->activation_client(); + Shell::Get()->activation_client(); activation_client->ActivateWindow(focus_window2.get()); EXPECT_FALSE(RotationLocked()); @@ -454,9 +446,8 @@ // triggered by the accelerometer. TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { EnableMaximizeMode(true); - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); display::test::DisplayManagerTestApi(display_manager()) .SetFirstDisplayAsInternalDisplay(); @@ -692,7 +683,7 @@ ->GetDisplayInfo(kInternalDisplayId) .GetActiveRotation()); test::ScreenOrientationControllerTestApi( - Shell::GetInstance()->screen_orientation_controller()) + Shell::Get()->screen_orientation_controller()) .SetDisplayRotation(kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); @@ -703,7 +694,7 @@ TEST_F(ScreenOrientationControllerTest, UserRotationLockedOrientation) { ScreenOrientationController* orientation_controller = - Shell::GetInstance()->screen_orientation_controller(); + Shell::Get()->screen_orientation_controller(); orientation_controller->ToggleUserRotationLock(); EXPECT_TRUE(orientation_controller->user_rotation_locked()); EXPECT_EQ(blink::WebScreenOrientationLockLandscapePrimary, @@ -771,7 +762,7 @@ ASSERT_FALSE(UserRotationLocked()); ScreenOrientationController* orientation_controller = - Shell::GetInstance()->screen_orientation_controller(); + Shell::Get()->screen_orientation_controller(); ASSERT_FALSE(orientation_controller->user_rotation_locked()); orientation_controller->ToggleUserRotationLock(); ASSERT_TRUE(orientation_controller->user_rotation_locked()); @@ -781,7 +772,7 @@ EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); aura::client::ActivationClient* activation_client = - Shell::GetInstance()->activation_client(); + Shell::Get()->activation_client(); // Activating any will switch to the natural orientation. activation_client->ActivateWindow(focus_window2.get()); EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
diff --git a/ash/content/keyboard_overlay/keyboard_overlay_view.cc b/ash/content/keyboard_overlay/keyboard_overlay_view.cc index c09e038..a05d38b 100644 --- a/ash/content/keyboard_overlay/keyboard_overlay_view.cc +++ b/ash/content/keyboard_overlay/keyboard_overlay_view.cc
@@ -37,7 +37,7 @@ KeyboardOverlayView::~KeyboardOverlayView() {} void KeyboardOverlayView::Cancel() { - Shell::GetInstance()->overlay_filter()->Deactivate(this); + Shell::Get()->overlay_filter()->Deactivate(this); views::Widget* widget = GetWidget(); if (widget) widget->Close(); @@ -66,7 +66,7 @@ void KeyboardOverlayView::ShowDialog(content::BrowserContext* context, WebContentsHandler* handler, const GURL& url) { - if (Shell::GetInstance()->overlay_filter()->IsActive()) + if (Shell::Get()->overlay_filter()->IsActive()) return; KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( @@ -75,7 +75,7 @@ new KeyboardOverlayView(context, delegate, handler); delegate->Show(view); - Shell::GetInstance()->overlay_filter()->Activate(view); + Shell::Get()->overlay_filter()->Activate(view); } void KeyboardOverlayView::WindowClosing() {
diff --git a/ash/content/screen_orientation_delegate_chromeos.cc b/ash/content/screen_orientation_delegate_chromeos.cc index a946257..12b59c8 100644 --- a/ash/content/screen_orientation_delegate_chromeos.cc +++ b/ash/content/screen_orientation_delegate_chromeos.cc
@@ -27,25 +27,21 @@ void ScreenOrientationDelegateChromeos::Lock( content::WebContents* web_contents, blink::WebScreenOrientationLockType lock_orientation) { - Shell::GetInstance() - ->screen_orientation_controller() - ->LockOrientationForWindow( - WmWindow::Get(web_contents->GetNativeView()), lock_orientation, - ScreenOrientationController::LockCompletionBehavior::None); + Shell::Get()->screen_orientation_controller()->LockOrientationForWindow( + WmWindow::Get(web_contents->GetNativeView()), lock_orientation, + ScreenOrientationController::LockCompletionBehavior::None); } bool ScreenOrientationDelegateChromeos::ScreenOrientationProviderSupported() { - return Shell::GetInstance() + return Shell::Get() ->screen_orientation_controller() ->ScreenOrientationProviderSupported(); } void ScreenOrientationDelegateChromeos::Unlock( content::WebContents* web_contents) { - Shell::GetInstance() - ->screen_orientation_controller() - ->UnlockOrientationForWindow( - WmWindow::Get(web_contents->GetNativeView())); + Shell::Get()->screen_orientation_controller()->UnlockOrientationForWindow( + WmWindow::Get(web_contents->GetNativeView())); } } // namespace ash
diff --git a/ash/debug.cc b/ash/debug.cc index fe37889..9ffce24 100644 --- a/ash/debug.cc +++ b/ash/debug.cc
@@ -13,8 +13,7 @@ namespace debug { void ToggleShowDebugBorders() { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); std::unique_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) { @@ -28,8 +27,7 @@ } void ToggleShowFpsCounter() { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); std::unique_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) { @@ -43,8 +41,7 @@ } void ToggleShowPaintRects() { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); std::unique_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) {
diff --git a/ash/default_wallpaper_delegate.cc b/ash/default_wallpaper_delegate.cc index 48c28b48..6931faa 100644 --- a/ash/default_wallpaper_delegate.cc +++ b/ash/default_wallpaper_delegate.cc
@@ -28,7 +28,7 @@ void DefaultWallpaperDelegate::UpdateWallpaper(bool clear_cache) {} void DefaultWallpaperDelegate::InitializeWallpaper() { - Shell::GetInstance()->wallpaper_controller()->CreateEmptyWallpaper(); + Shell::Get()->wallpaper_controller()->CreateEmptyWallpaper(); } bool DefaultWallpaperDelegate::CanOpenSetWallpaperPage() {
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index 0e1abed3..0bdbdc7 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc
@@ -48,7 +48,7 @@ const display::Display display_2x = screen->GetDisplayNearestWindow(root); const display::ManagedDisplayInfo display_info_2x = - Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); + Shell::Get()->display_manager()->GetDisplayInfo(display_2x.id()); // The |bounds_in_pixel()| should report bounds in pixel coordinate. EXPECT_EQ("1,1 2000x1800", display_info_2x.bounds_in_native().ToString());
diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc index 4c654c5..46cb1587 100644 --- a/ash/display/cursor_window_controller.cc +++ b/ash/display/cursor_window_controller.cc
@@ -138,7 +138,7 @@ if (display.is_valid()) SetDisplay(display); } else { - aura::Window* mirror_window = Shell::GetInstance() + aura::Window* mirror_window = Shell::Get() ->window_tree_host_manager() ->mirror_window_controller() ->GetWindow(); @@ -156,15 +156,15 @@ // TODO(oshima): Do not updatethe composition cursor when crossing // display in unified desktop mode for now. crbug.com/517222. - if (Shell::GetInstance()->display_manager()->IsInUnifiedMode() && + if (Shell::Get()->display_manager()->IsInUnifiedMode() && display.id() != display::DisplayManager::kUnifiedDisplayId) { return; } display_ = display; - aura::Window* root_window = Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display.id()); if (!root_window) return; @@ -244,7 +244,7 @@ } else { // Use the original device scale factor instead of the display's, which // might have been adjusted for the UI scale. - const float original_scale = Shell::GetInstance() + const float original_scale = Shell::Get() ->display_manager() ->GetDisplayInfo(display_.id()) .device_scale_factor();
diff --git a/ash/display/cursor_window_controller_unittest.cc b/ash/display/cursor_window_controller_unittest.cc index bb87800..3609b64 100644 --- a/ash/display/cursor_window_controller_unittest.cc +++ b/ash/display/cursor_window_controller_unittest.cc
@@ -49,9 +49,8 @@ } void SetCursorCompositionEnabled(bool enabled) { - cursor_window_controller_ = Shell::GetInstance() - ->window_tree_host_manager() - ->cursor_window_controller(); + cursor_window_controller_ = + Shell::Get()->window_tree_host_manager()->cursor_window_controller(); cursor_window_controller_->SetCursorCompositingEnabled(enabled); } @@ -68,7 +67,7 @@ UpdateDisplay("200x200,200x200*2/r"); WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); int64_t primary_display_id = window_tree_host_manager->GetPrimaryDisplayId(); int64_t secondary_display_id = display_manager()->GetSecondaryDisplay().id(); aura::Window* primary_root = @@ -119,7 +118,7 @@ TEST_F(CursorWindowControllerTest, VisibilityTest) { ASSERT_TRUE(GetCursorWindow()); EXPECT_TRUE(GetCursorWindow()->IsVisible()); - aura::client::CursorClient* client = Shell::GetInstance()->cursor_manager(); + aura::client::CursorClient* client = Shell::Get()->cursor_manager(); client->HideCursor(); ASSERT_TRUE(GetCursorWindow()); EXPECT_FALSE(GetCursorWindow()->IsVisible());
diff --git a/ash/display/display_animator_chromeos.cc b/ash/display/display_animator_chromeos.cc index fee1bf4..d7956d2 100644 --- a/ash/display/display_animator_chromeos.cc +++ b/ash/display/display_animator_chromeos.cc
@@ -93,11 +93,11 @@ } // namespace DisplayAnimatorChromeOS::DisplayAnimatorChromeOS() : weak_ptr_factory_(this) { - Shell::GetInstance()->display_configurator()->AddObserver(this); + Shell::Get()->display_configurator()->AddObserver(this); } DisplayAnimatorChromeOS::~DisplayAnimatorChromeOS() { - Shell::GetInstance()->display_configurator()->RemoveObserver(this); + Shell::Get()->display_configurator()->RemoveObserver(this); ClearHidingLayers(); } @@ -109,7 +109,7 @@ // hiding the root windows, we put a black layer over a root window for // safety. These layers remain to hide root windows and will be deleted // after the animation of OnDisplayModeChanged(). - for (aura::Window* root_window : Shell::GetInstance()->GetAllRootWindows()) { + for (aura::Window* root_window : Shell::Get()->GetAllRootWindows()) { std::unique_ptr<ui::Layer> hiding_layer = base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); hiding_layer->SetColor(SK_ColorBLACK); @@ -158,7 +158,7 @@ // Schedules the fade-in effect for all root windows. Because we put the // black layers for fade-out, here we actually turn those black layers // invisible. - for (aura::Window* root_window : Shell::GetInstance()->GetAllRootWindows()) { + for (aura::Window* root_window : Shell::Get()->GetAllRootWindows()) { ui::Layer* hiding_layer = nullptr; if (hiding_layers_.find(root_window) == hiding_layers_.end()) { // In case of the transition from mirroring->non-mirroring, new root
diff --git a/ash/display/display_configuration_controller_unittest.cc b/ash/display/display_configuration_controller_unittest.cc index 652b2661..bd3a8b3 100644 --- a/ash/display/display_configuration_controller_unittest.cc +++ b/ash/display/display_configuration_controller_unittest.cc
@@ -29,12 +29,12 @@ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); test::DisplayConfigurationControllerTestApi testapi( - Shell::GetInstance()->display_configuration_controller()); + Shell::Get()->display_configuration_controller()); ScreenRotationAnimator* screen_rotation_animator = testapi.GetScreenRotationAnimatorForDisplay(display.id()); EXPECT_EQ(1, testapi.DisplayScreenRotationAnimatorMapSize()); - Shell::GetInstance()->display_manager()->SetDisplayRotation( + Shell::Get()->display_manager()->SetDisplayRotation( display.id(), display::Display::ROTATE_0, display::Display::RotationSource::ROTATION_SOURCE_USER); screen_rotation_animator->Rotate(
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 6822c7da..7280626 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc
@@ -975,8 +975,7 @@ TEST_F(DisplayManagerTest, NoMirrorInThreeDisplays) { UpdateDisplay("640x480,320x200,400x300"); - ash::Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( - true); + ash::Shell::Get()->display_configuration_controller()->SetMirrorMode(true); EXPECT_FALSE(display_manager()->IsInMirrorMode()); EXPECT_EQ(3u, display_manager()->GetNumDisplays()); EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED), @@ -1062,7 +1061,7 @@ updated_display_info2.GetOverscanInsetsInPixel().ToString()); // Make sure switching primary display applies the overscan offset only once. - ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( + ash::Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( display_manager()->GetSecondaryDisplay().id()); EXPECT_EQ("-500,0 500x500", display_manager()->GetSecondaryDisplay().bounds().ToString()); @@ -1452,7 +1451,7 @@ GetDisplayForId(internal_display_id).bounds().ToString()); EXPECT_EQ("500,0 100x100", GetDisplayForId(10).bounds().ToString()); - ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( + ash::Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( secondary_display_info.id()); EXPECT_EQ("-500,0 500x500", GetDisplayForId(internal_display_id).bounds().ToString()); @@ -2236,7 +2235,7 @@ EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); WindowTreeHostManager* window_tree_host_manager = - ash::Shell::GetInstance()->window_tree_host_manager(); + ash::Shell::Get()->window_tree_host_manager(); EXPECT_TRUE( window_tree_host_manager->mirror_window_controller()->GetWindow()); @@ -2264,7 +2263,7 @@ aura::Window::Windows root_windows = Shell::GetAllRootWindows(); EXPECT_FALSE(root_windows[0]->Contains(test_api.GetCursorWindow())); - Shell::GetInstance()->SetCursorCompositingEnabled(true); + Shell::Get()->SetCursorCompositingEnabled(true); EXPECT_TRUE(root_windows[0]->Contains(test_api.GetCursorWindow())); @@ -2277,7 +2276,7 @@ root_windows = Shell::GetAllRootWindows(); EXPECT_TRUE(root_windows[0]->Contains(test_api.GetCursorWindow())); - Shell::GetInstance()->SetCursorCompositingEnabled(false); + Shell::Get()->SetCursorCompositingEnabled(false); } TEST_F(DisplayManagerTest, MirroredLayout) { @@ -2394,8 +2393,7 @@ TEST_F(DisplayManagerTest, UpdateDisplayWithHostOrigin) { UpdateDisplay("100x200,300x400"); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc index bb2c0a60..8573520e 100644 --- a/ash/display/display_util.cc +++ b/ash/display/display_util.cc
@@ -150,7 +150,7 @@ if (update_last_location_now) { gfx::Point new_point_in_screen; - if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) { + if (Shell::Get()->display_manager()->IsInUnifiedMode()) { new_point_in_screen = point_in_host; // First convert to the unified host. host->ConvertPixelsToDIP(&new_point_in_screen);
diff --git a/ash/display/extended_mouse_warp_controller.cc b/ash/display/extended_mouse_warp_controller.cc index c83bf07..ac31b33b 100644 --- a/ash/display/extended_mouse_warp_controller.cc +++ b/ash/display/extended_mouse_warp_controller.cc
@@ -36,9 +36,8 @@ // Helper method that maps a display::Display to an aura::Window. aura::Window* GetRootWindowForDisplayId(int64_t display_id) { - return Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_id); + return Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_id); } // Helper method that maps an aura::Window to display id; @@ -101,8 +100,7 @@ ExtendedMouseWarpController::ExtendedMouseWarpController( aura::Window* drag_source) : drag_source_root_(drag_source), allow_non_native_event_(false) { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source) : display::kInvalidDisplayId; display::Displays display_list = display_manager->active_display_list();
diff --git a/ash/display/extended_mouse_warp_controller_unittest.cc b/ash/display/extended_mouse_warp_controller_unittest.cc index ccc276a..9160864 100644 --- a/ash/display/extended_mouse_warp_controller_unittest.cc +++ b/ash/display/extended_mouse_warp_controller_unittest.cc
@@ -24,7 +24,7 @@ protected: MouseCursorEventFilter* event_filter() { - return Shell::GetInstance()->mouse_cursor_filter(); + return Shell::Get()->mouse_cursor_filter(); } ExtendedMouseWarpController* mouse_warp_controller() {
diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 035ab953..858dc66 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc
@@ -114,8 +114,7 @@ }; display::DisplayManager::MultiDisplayMode GetCurrentMultiDisplayMode() { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); return display_manager->IsInUnifiedMode() ? display::DisplayManager::UNIFIED : (display_manager->IsInMirrorMode() @@ -148,8 +147,7 @@ void MirrorWindowController::UpdateWindow( const std::vector<display::ManagedDisplayInfo>& display_info_list) { static int mirror_host_count = 0; - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); const display::Display& primary = display::Screen::GetScreen()->GetPrimaryDisplay(); const display::ManagedDisplayInfo& source_display_info = @@ -181,13 +179,13 @@ aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost(); host->SetSharedInputMethod( - Shell::GetInstance()->window_tree_host_manager()->input_method()); + Shell::Get()->window_tree_host_manager()->input_method()); host->window()->SetName( base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++)); host->compositor()->SetBackgroundColor(SK_ColorBLACK); // No need to remove the observer because the WindowTreeHostManager // outlives the host. - host->AddObserver(Shell::GetInstance()->window_tree_host_manager()); + host->AddObserver(Shell::Get()->window_tree_host_manager()); host->AddObserver(this); // TODO(oshima): TouchHUD is using idkey. InitRootWindowSettings(host->window())->display_id = display_info.id(); @@ -203,7 +201,7 @@ if (display_manager->IsInUnifiedMode()) { host_info->ash_host->ConfineCursorToRootWindow(); AshWindowTreeHost* unified_ash_host = - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->GetAshWindowTreeHostForDisplayId( display::Screen::GetScreen()->GetPrimaryDisplay().id()); @@ -262,8 +260,7 @@ void MirrorWindowController::UpdateWindow() { if (mirroring_host_info_map_.empty()) return; - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); std::vector<display::ManagedDisplayInfo> display_info_list; for (auto& pair : mirroring_host_info_map_) display_info_list.push_back(display_manager->GetDisplayInfo(pair.first)); @@ -300,7 +297,7 @@ reflector_->OnMirroringCompositorResized(); // No need to update the transformer as new transformer is already set // in UpdateWindow. - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->UpdateLocation(); @@ -310,8 +307,7 @@ } aura::Window* MirrorWindowController::GetWindow() { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); if (!display_manager->IsInMirrorMode() || mirroring_host_info_map_.empty()) return nullptr; DCHECK_EQ(1U, mirroring_host_info_map_.size()); @@ -326,9 +322,8 @@ if (pair.second->ash_host->AsWindowTreeHost()->window() == root) { // Sanity check to catch an error early. int64_t id = pair.first; - const display::Displays& list = Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list(); + const display::Displays& list = + Shell::Get()->display_manager()->software_mirroring_display_list(); auto iter = std::find_if( list.begin(), list.end(), [id](const display::Display& display) { return display.id() == id; }); @@ -364,7 +359,7 @@ aura::client::SetCaptureClient(host->window(), nullptr); delete capture_client; - host->RemoveObserver(Shell::GetInstance()->window_tree_host_manager()); + host->RemoveObserver(Shell::Get()->window_tree_host_manager()); host->RemoveObserver(this); host_info->ash_host->PrepareForShutdown(); reflector_->RemoveMirroringLayer(host_info->mirror_window->layer());
diff --git a/ash/display/mirror_window_controller_unittest.cc b/ash/display/mirror_window_controller_unittest.cc index 321381e..55fce11 100644 --- a/ash/display/mirror_window_controller_unittest.cc +++ b/ash/display/mirror_window_controller_unittest.cc
@@ -78,7 +78,7 @@ display_manager()->SetMultiDisplayMode(display::DisplayManager::MIRRORING); UpdateDisplay("400x400,400x400"); - aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::Get()->GetPrimaryRootWindow(); std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( &test_window_delegate, 0, gfx::Rect(50, 50, 100, 100), root)); window->Show(); @@ -124,7 +124,7 @@ display_manager()->SetMultiDisplayMode(display::DisplayManager::MIRRORING); UpdateDisplay("400x400,400x400"); - aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::Get()->GetPrimaryRootWindow(); std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( &test_window_delegate, 0, gfx::Rect(50, 50, 100, 100), root)); window->Show(); @@ -178,7 +178,7 @@ // Test with device scale factor. UpdateDisplay("400x600*2,400x600"); - aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::Get()->GetPrimaryRootWindow(); ui::test::EventGenerator generator(root); generator.MoveMouseToInHost(10, 20); @@ -207,7 +207,7 @@ // cursor's display. TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorMoveOnEnter) { aura::Env* env = aura::Env::GetInstance(); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); WindowTreeHostManager* window_tree_host_manager = shell->window_tree_host_manager();
diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc index 0844e0a..8cea699d 100644 --- a/ash/display/mouse_cursor_event_filter.cc +++ b/ash/display/mouse_cursor_event_filter.cc
@@ -16,16 +16,16 @@ namespace ash { MouseCursorEventFilter::MouseCursorEventFilter() : mouse_warp_enabled_(true) { - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); } MouseCursorEventFilter::~MouseCursorEventFilter() { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); } void MouseCursorEventFilter::ShowSharedEdgeIndicator(aura::Window* from) { - mouse_warp_controller_ = ash::CreateMouseWarpController( - Shell::GetInstance()->display_manager(), from); + mouse_warp_controller_ = + ash::CreateMouseWarpController(Shell::Get()->display_manager(), from); } void MouseCursorEventFilter::HideSharedEdgeIndicator() { @@ -37,8 +37,8 @@ } void MouseCursorEventFilter::OnDisplayConfigurationChanged() { - mouse_warp_controller_ = ash::CreateMouseWarpController( - Shell::GetInstance()->display_manager(), nullptr); + mouse_warp_controller_ = + ash::CreateMouseWarpController(Shell::Get()->display_manager(), nullptr); } void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { @@ -54,7 +54,7 @@ return; } - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->UpdateLocation();
diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index 73812e1..d1139c4 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc
@@ -22,7 +22,7 @@ protected: MouseCursorEventFilter* event_filter() { - return Shell::GetInstance()->mouse_cursor_filter(); + return Shell::Get()->mouse_cursor_filter(); } bool TestIfMouseWarpsAt(const gfx::Point& point_in_screen) { @@ -39,7 +39,7 @@ TEST_F(MouseCursorEventFilterTest, WarpMouse) { UpdateDisplay("500x500,500x500"); - ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::GetInstance() + ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::Get() ->display_manager() ->GetCurrentDisplayLayout() .placement_list[0] @@ -76,7 +76,7 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentSizeDisplays) { UpdateDisplay("500x500,600x600"); // the second one is larger. - ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::GetInstance() + ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::Get() ->display_manager() ->GetCurrentDisplayLayout() .placement_list[0] @@ -101,7 +101,7 @@ TEST_F(MouseCursorEventFilterTest, WarpMouseDifferentScaleDisplaysInNative) { UpdateDisplay("500x500,600x600*2"); - ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::GetInstance() + ASSERT_EQ(display::DisplayPlacement::RIGHT, Shell::Get() ->display_manager() ->GetCurrentDisplayLayout() .placement_list[0] @@ -145,8 +145,7 @@ display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), display::DisplayPlacement::RIGHT, 0)); - test::CursorManagerTestApi cursor_test_api( - Shell::GetInstance()->cursor_manager()); + test::CursorManagerTestApi cursor_test_api(Shell::Get()->cursor_manager()); EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); TestIfMouseWarpsAt(gfx::Point(399, 200));
diff --git a/ash/display/resolution_notification_controller.cc b/ash/display/resolution_notification_controller.cc index 9775277..f4fcece 100644 --- a/ash/display/resolution_notification_controller.cc +++ b/ash/display/resolution_notification_controller.cc
@@ -138,8 +138,7 @@ new_resolution(new_resolution), accept_callback(accept_callback), timeout_count(0) { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); if (!display::Display::HasInternalDisplay() && display_manager->num_connected_displays() == 1u) { timeout_count = kTimeoutInSec; @@ -154,12 +153,12 @@ } ResolutionNotificationController::ResolutionNotificationController() { - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); } ResolutionNotificationController::~ResolutionNotificationController() { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); } @@ -216,8 +215,8 @@ data.should_make_spoken_feedback_for_popup_updates = enable_spoken_feedback; - const base::string16 display_name = base::UTF8ToUTF16( - Shell::GetInstance()->display_manager()->GetDisplayNameForId( + const base::string16 display_name = + base::UTF8ToUTF16(Shell::Get()->display_manager()->GetDisplayNameForId( change_info_->display_id)); const base::string16 message = (change_info_->new_resolution->size() == @@ -281,8 +280,7 @@ scoped_refptr<display::ManagedDisplayMode> old_resolution = change_info_->old_resolution; change_info_.reset(); - Shell::GetInstance()->display_manager()->SetDisplayMode(display_id, - old_resolution); + Shell::Get()->display_manager()->SetDisplayMode(display_id, old_resolution); } void ResolutionNotificationController::OnDisplayAdded( @@ -303,7 +301,7 @@ return; change_info_->current_resolution = - Shell::GetInstance()->display_manager()->GetActiveModeForDisplayId( + Shell::Get()->display_manager()->GetActiveModeForDisplayId( change_info_->display_id); CreateOrUpdateNotification(true); if (g_use_timer && change_info_->timeout_count > 0) {
diff --git a/ash/display/resolution_notification_controller_unittest.cc b/ash/display/resolution_notification_controller_unittest.cc index 30a7295..0c43487b 100644 --- a/ash/display/resolution_notification_controller_unittest.cc +++ b/ash/display/resolution_notification_controller_unittest.cc
@@ -132,7 +132,7 @@ static void TickTimer() { controller()->OnTimerTick(); } static ResolutionNotificationController* controller() { - return Shell::GetInstance()->resolution_notification_controller(); + return Shell::Get()->resolution_notification_controller(); } int accept_count() const { return accept_count_; }
diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc index 2cb292f..ca1225e0 100644 --- a/ash/display/root_window_transformers.cc +++ b/ash/display/root_window_transformers.cc
@@ -54,7 +54,7 @@ gfx::Transform CreateRotationTransform(aura::Window* root_window, const display::Display& display) { display::ManagedDisplayInfo info = - Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); + Shell::Get()->display_manager()->GetDisplayInfo(display.id()); // TODO(oshima): Add animation. (crossfade+rotation, or just cross-fade) #if defined(OS_WIN) @@ -96,8 +96,7 @@ } gfx::Transform CreateMagnifierTransform(aura::Window* root_window) { - MagnificationController* magnifier = - Shell::GetInstance()->magnification_controller(); + MagnificationController* magnifier = Shell::Get()->magnification_controller(); float magnifier_scale = 1.f; gfx::Point magnifier_offset; if (magnifier && magnifier->IsEnabled()) { @@ -138,8 +137,7 @@ public: AshRootWindowTransformer(aura::Window* root, const display::Display& display) : root_window_(root) { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); display::ManagedDisplayInfo info = display_manager->GetDisplayInfo(display.id()); host_insets_ = info.GetOverscanInsetsInPixel(); @@ -282,7 +280,7 @@ display::Display unified_display = display::Screen::GetScreen()->GetPrimaryDisplay(); display::ManagedDisplayInfo display_info = - Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); + Shell::Get()->display_manager()->GetDisplayInfo(display.id()); root_bounds_ = gfx::Rect(display_info.bounds_in_native().size()); float scale = root_bounds_.height() / static_cast<float>(screen_bounds.height()) /
diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index fdcc28b..60617a1e 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc
@@ -154,11 +154,10 @@ #endif TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { - MagnificationController* magnifier = - Shell::GetInstance()->magnification_controller(); + MagnificationController* magnifier = Shell::Get()->magnification_controller(); TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -251,12 +250,12 @@ GetActiveDisplayRotation(display2_id)); magnifier->SetEnabled(false); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(RootWindowTransformersTest, ScaleAndMagnify) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("600x400*2@1.5,500x300"); @@ -265,8 +264,7 @@ display1.id()); display::Display display2 = display_manager()->GetSecondaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); - MagnificationController* magnifier = - Shell::GetInstance()->magnification_controller(); + MagnificationController* magnifier = Shell::Get()->magnification_controller(); magnifier->SetEnabled(true); EXPECT_EQ(2.0f, magnifier->GetScale()); @@ -294,20 +292,19 @@ EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); magnifier->SetEnabled(false); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(RootWindowTransformersTest, MAYBE_TouchScaleAndMagnify) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("200x200*2"); display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* root_window = root_windows[0]; ui::test::EventGenerator generator(root_window); - MagnificationController* magnifier = - Shell::GetInstance()->magnification_controller(); + MagnificationController* magnifier = Shell::Get()->magnification_controller(); magnifier->SetEnabled(true); EXPECT_FLOAT_EQ(2.0f, magnifier->GetScale()); @@ -330,14 +327,13 @@ event_handler.scroll_y_offset_ordinal()); magnifier->SetEnabled(false); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); - MagnificationController* magnifier = - Shell::GetInstance()->magnification_controller(); + Shell::Get()->AddPreTargetHandler(&event_handler); + MagnificationController* magnifier = Shell::Get()->magnification_controller(); // Test 1 UpdateDisplay("600x400*2/r@1.5"); @@ -416,7 +412,7 @@ magnifier->SetEnabled(false); EXPECT_FLOAT_EQ(1.0f, magnifier->GetScale()); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) {
diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc index a248668..b8bc03b 100644 --- a/ash/display/screen_ash.cc +++ b/ash/display/screen_ash.cc
@@ -30,7 +30,7 @@ display::Screen* screen_for_shutdown = nullptr; display::DisplayManager* GetDisplayManager() { - return Shell::GetInstance()->display_manager(); + return Shell::Get()->display_manager(); } class ScreenForShutdown : public display::Screen {
diff --git a/ash/display/screen_orientation_controller_chromeos.cc b/ash/display/screen_orientation_controller_chromeos.cc index c0ef3d6..358ac4f 100644 --- a/ash/display/screen_orientation_controller_chromeos.cc +++ b/ash/display/screen_orientation_controller_chromeos.cc
@@ -160,14 +160,14 @@ rotation_locked_orientation_(blink::WebScreenOrientationLockAny), user_rotation_(display::Display::ROTATE_0), current_rotation_(display::Display::ROTATE_0) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } ScreenOrientationController::~ScreenOrientationController() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this); WmShell::Get()->RemoveDisplayObserver(this); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); for (auto& windows : lock_info_map_) windows.first->aura_window()->RemoveObserver(this); } @@ -185,7 +185,7 @@ blink::WebScreenOrientationLockType lock_orientation, LockCompletionBehavior lock_completion_behavior) { if (lock_info_map_.empty()) - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); if (!requesting_window->aura_window()->HasObserver(this)) requesting_window->aura_window()->AddObserver(this); @@ -198,7 +198,7 @@ void ScreenOrientationController::UnlockOrientationForWindow(WmWindow* window) { lock_info_map_.erase(window); if (lock_info_map_.empty()) - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); window->aura_window()->RemoveObserver(this); ApplyLockForActiveWindow(); } @@ -207,7 +207,7 @@ for (auto pair : lock_info_map_) pair.first->aura_window()->RemoveObserver(this); lock_info_map_.clear(); - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); SetRotationLockedInternal(false); if (user_rotation_ != current_rotation_) SetDisplayRotation(user_rotation_, display::Display::ROTATION_SOURCE_USER); @@ -346,7 +346,7 @@ base::AutoReset<bool> auto_ignore_display_configuration_updates( &ignore_display_configuration_updates_, true); - Shell::GetInstance()->display_configuration_controller()->SetDisplayRotation( + Shell::Get()->display_configuration_controller()->SetDisplayRotation( display::Display::InternalDisplayId(), rotation, source); } @@ -364,7 +364,7 @@ user_locked_orientation_ = orientation; base::AutoReset<bool> auto_ignore_display_configuration_updates( &ignore_display_configuration_updates_, true); - Shell::GetInstance()->display_manager()->RegisterDisplayRotationProperties( + Shell::Get()->display_manager()->RegisterDisplayRotationProperties( user_rotation_locked(), OrientationToRotation(user_locked_orientation_)); ApplyLockForActiveWindow(); @@ -515,8 +515,7 @@ } void ScreenOrientationController::LoadDisplayRotationProperties() { - display::DisplayManager* display_manager = - Shell::GetInstance()->display_manager(); + display::DisplayManager* display_manager = Shell::Get()->display_manager(); if (!display_manager->registered_internal_display_rotation_lock()) return; user_locked_orientation_ = RotationToOrientation( @@ -525,7 +524,7 @@ void ScreenOrientationController::ApplyLockForActiveWindow() { MruWindowTracker::WindowList mru_windows( - Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); + Shell::Get()->mru_window_tracker()->BuildMruWindowList()); for (WmWindow* window : mru_windows) { if (!window->GetTargetVisibility())
diff --git a/ash/display/screen_position_controller_unittest.cc b/ash/display/screen_position_controller_unittest.cc index 96605ab..3c9135c 100644 --- a/ash/display/screen_position_controller_unittest.cc +++ b/ash/display/screen_position_controller_unittest.cc
@@ -48,7 +48,7 @@ namespace { ScreenPositionController* GetScreenPositionController() { - ShellTestApi test_api(Shell::GetInstance()); + ShellTestApi test_api(Shell::Get()); return test_api.screen_position_controller(); } @@ -105,8 +105,7 @@ UpdateDisplay("100+100-200x200,100+500-200x200"); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); EXPECT_EQ( "100,100", root_windows[0]->GetHost()->GetBoundsInPixels().origin().ToString()); @@ -194,8 +193,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenHiDPI) { UpdateDisplay("50+50-200x200*2,50+300-300x300"); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); EXPECT_EQ("50,50 200x200", root_windows[0]->GetHost()->GetBoundsInPixels().ToString()); EXPECT_EQ("50,300 300x300", @@ -242,8 +240,7 @@ // Move |window_| to the 2nd. window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), display_manager()->GetSecondaryDisplay()); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); EXPECT_EQ(root_windows[1], window_->GetRootWindow()); // The point is on the 2nd host. (50,70) on 2n host - @@ -274,8 +271,7 @@ // Move |window_| to the 2nd. window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), display_manager()->GetSecondaryDisplay()); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); EXPECT_EQ(root_windows[1], window_->GetRootWindow()); // The point is on the 2nd host. (50,70) - ro @@ -341,8 +337,7 @@ EXPECT_TRUE(window_->GetBoundsInScreen().Contains( aura::Env::GetInstance()->last_mouse_location())); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); aura::WindowTracker tracker; tracker.Add(root_windows[1]); std::unique_ptr<ConvertToScreenEventHandler> event_handler(
diff --git a/ash/display/shutdown_observer_chromeos.cc b/ash/display/shutdown_observer_chromeos.cc index 145d2f5..a9540e3e 100644 --- a/ash/display/shutdown_observer_chromeos.cc +++ b/ash/display/shutdown_observer_chromeos.cc
@@ -12,11 +12,11 @@ ShutdownObserver::ShutdownObserver( display::DisplayConfigurator* display_configurator) : display_configurator_(display_configurator) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } ShutdownObserver::~ShutdownObserver() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void ShutdownObserver::OnAppTerminating() {
diff --git a/ash/display/unified_mouse_warp_controller.cc b/ash/display/unified_mouse_warp_controller.cc index c0adecb..ec347e2 100644 --- a/ash/display/unified_mouse_warp_controller.cc +++ b/ash/display/unified_mouse_warp_controller.cc
@@ -29,7 +29,7 @@ AshWindowTreeHost* GetMirroringAshWindowTreeHostForDisplayId( int64_t display_id) { - return Shell::GetInstance() + return Shell::Get() ->window_tree_host_manager() ->mirror_window_controller() ->GetAshWindowTreeHostForDisplayId(display_id); @@ -41,9 +41,7 @@ aura::WindowTreeHost* FindMirroringWindowTreeHostFromScreenPoint( const gfx::Point& point_in_screen) { display::Displays mirroring_display_list = - Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list(); + Shell::Get()->display_manager()->software_mirroring_display_list(); auto iter = display::FindDisplayContainingPoint(mirroring_display_list, point_in_screen); if (iter == mirroring_display_list.end()) @@ -79,9 +77,7 @@ aura::client::GetCursorClient(target->GetRootWindow()); if (cursor_client) { display::Displays mirroring_display_list = - Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list(); + Shell::Get()->display_manager()->software_mirroring_display_list(); auto iter = display::FindDisplayContainingPoint(mirroring_display_list, point_in_unified_host); if (iter != mirroring_display_list.end() && @@ -121,9 +117,8 @@ } void UnifiedMouseWarpController::ComputeBounds() { - display::Displays display_list = Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list(); + display::Displays display_list = + Shell::Get()->display_manager()->software_mirroring_display_list(); if (display_list.size() < 2) { LOG(ERROR) << "Mirroring Display lost during re-configuration"; @@ -155,9 +150,8 @@ bool in_second_edge = second_edge_bounds_in_native_.Contains(point_in_native); if (!in_first_edge && !in_second_edge) return false; - display::Displays display_list = Shell::GetInstance() - ->display_manager() - ->software_mirroring_display_list(); + display::Displays display_list = + Shell::Get()->display_manager()->software_mirroring_display_list(); // Wait updating the cursor until the cursor moves to the new display // to avoid showing the wrong sized cursor at the source display. current_cursor_display_id_ =
diff --git a/ash/display/unified_mouse_warp_controller_unittest.cc b/ash/display/unified_mouse_warp_controller_unittest.cc index ba35fe0..956b9b1 100644 --- a/ash/display/unified_mouse_warp_controller_unittest.cc +++ b/ash/display/unified_mouse_warp_controller_unittest.cc
@@ -49,7 +49,7 @@ *point_in_mirroring_host = *point_in_unified_host; // Convert from mirroring host to unified host. AshWindowTreeHost* ash_host = - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->mirror_window_controller() ->GetAshWindowTreeHostForDisplayId(info.id()); @@ -62,9 +62,7 @@ bool TestIfMouseWarpsAt(const gfx::Point& point_in_native) { static_cast<UnifiedMouseWarpController*>( - Shell::GetInstance() - ->mouse_cursor_filter() - ->mouse_warp_controller_for_test()) + Shell::Get()->mouse_cursor_filter()->mouse_warp_controller_for_test()) ->update_location_for_test(); int64_t orig_mirroring_display_id; gfx::Point point_in_unified_host; @@ -97,7 +95,7 @@ } MouseCursorEventFilter* event_filter() { - return Shell::GetInstance()->mouse_cursor_filter(); + return Shell::Get()->mouse_cursor_filter(); } UnifiedMouseWarpController* mouse_warp_controller() {
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc index 1f6c065..f3e1f8d 100644 --- a/ash/display/window_tree_host_manager.cc +++ b/ash/display/window_tree_host_manager.cc
@@ -79,7 +79,7 @@ #endif display::DisplayManager* GetDisplayManager() { - return Shell::GetInstance()->display_manager(); + return Shell::Get()->display_manager(); } void SetDisplayPropertiesOnHost(AshWindowTreeHost* ash_host, @@ -247,7 +247,7 @@ void WindowTreeHostManager::Start() { display::Screen::GetScreen()->AddObserver(this); - Shell::GetInstance()->display_manager()->set_delegate(this); + Shell::Get()->display_manager()->set_delegate(this); } void WindowTreeHostManager::Shutdown() { @@ -256,7 +256,7 @@ // Unset the display manager's delegate here because // DisplayManager outlives WindowTreeHostManager. - Shell::GetInstance()->display_manager()->set_delegate(nullptr); + Shell::Get()->display_manager()->set_delegate(nullptr); cursor_window_controller_.reset(); mirror_window_controller_.reset(); @@ -524,7 +524,7 @@ // The cursor's native position did not change but its screen position did // change. This occurs when the scale factor or the rotation of the display // that the cursor is on changes. - Shell::GetInstance()->cursor_manager()->SetDisplay(target_display); + Shell::Get()->cursor_manager()->SetDisplay(target_display); // Update the cursor's root location. This ends up dispatching a synthetic // mouse move. The synthetic mouse move updates the composited cursor's @@ -564,9 +564,9 @@ // Magnifier controllers keep pointers to the current root window. // Update them here to avoid accessing them later. - Shell::GetInstance()->magnification_controller()->SwitchTargetRootWindow( + Shell::Get()->magnification_controller()->SwitchTargetRootWindow( ash_host->AsWindowTreeHost()->window(), false); - Shell::GetInstance() + Shell::Get() ->partial_magnification_controller() ->SwitchTargetRootWindowIfNeeded( ash_host->AsWindowTreeHost()->window()); @@ -579,8 +579,7 @@ ash::SystemTray* old_tray = GetRootWindowController(to_delete->AsWindowTreeHost()->window()) ->GetSystemTray(); - ash::SystemTray* new_tray = - ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* new_tray = ash::Shell::Get()->GetPrimarySystemTray(); if (old_tray->GetWidget()->IsVisible()) { new_tray->SetVisible(true); new_tray->GetWidget()->Show(); @@ -789,7 +788,7 @@ } display::DisplayConfigurator* WindowTreeHostManager::display_configurator() { - return Shell::GetInstance()->display_configurator(); + return Shell::Get()->display_configurator(); } ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME(
diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc index 2f1a3bc..c7a5f90 100644 --- a/ash/display/window_tree_host_manager_unittest.cc +++ b/ash/display/window_tree_host_manager_unittest.cc
@@ -77,7 +77,7 @@ changed_display_id_(0), focus_changed_count_(0), activation_changed_count_(0) { - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) ->AddObserver(this); @@ -86,7 +86,7 @@ } ~TestObserver() override { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) ->RemoveObserver(this); @@ -262,7 +262,7 @@ // ash::ShellSelegate: void PreInit() override { - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); } // ash::WindowTreeHostManager::Observer: @@ -292,8 +292,7 @@ test::AshTestBase::SetUp(); } void TearDown() override { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver( - startup_helper_); + Shell::Get()->window_tree_host_manager()->RemoveObserver(startup_helper_); test::AshTestBase::TearDown(); } @@ -710,8 +709,7 @@ // avoid getting the OnDisplayConfigurationChanged() call twice in // SetDisplayUIScale. Note that this scenario will never happen on // real devices. - Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( - secondary_id); + Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId(secondary_id); EXPECT_EQ(1, observer.CountAndReset()); display::test::DisplayManagerTestApi(display_manager()) @@ -738,7 +736,7 @@ TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) { WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); UpdateDisplay("200x200,300x300"); display_manager()->SetLayoutForCurrentDisplays( @@ -797,7 +795,7 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); UpdateDisplay("200x200,300x300"); display::Display primary_display = @@ -973,7 +971,7 @@ EXPECT_EQ(primary_id, display::Screen::GetScreen()->GetPrimaryDisplay().id()); WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); aura::Window* primary_root = window_tree_host_manager->GetRootWindowForDisplayId(primary_id); @@ -1095,7 +1093,7 @@ EXPECT_EQ(primary_id, display::Screen::GetScreen()->GetPrimaryDisplay().id()); WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); // Make non_primary_ids[2] primary. window_tree_host_manager->SetPrimaryDisplayId(non_primary_ids[2]); @@ -1174,9 +1172,9 @@ TEST_F(WindowTreeHostManagerTest, OverscanInsets) { WindowTreeHostManager* window_tree_host_manager = - Shell::GetInstance()->window_tree_host_manager(); + Shell::Get()->window_tree_host_manager(); TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -1216,12 +1214,12 @@ &point); EXPECT_EQ("15,10", point.ToString()); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(WindowTreeHostManagerTest, Rotate) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -1295,12 +1293,12 @@ generator1.MoveMouseToInHost(50, 40); EXPECT_EQ("69,159", event_handler.GetLocationAndReset()); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("600x400*2@1.5,500x300"); @@ -1330,12 +1328,12 @@ EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(WindowTreeHostManagerTest, TouchScale) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("200x200*2"); display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -1359,12 +1357,12 @@ EXPECT_EQ(event_handler.scroll_y_offset(), event_handler.scroll_y_offset_ordinal()); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) { TestEventHandler event_handler; - Shell::GetInstance()->AddPreTargetHandler(&event_handler); + Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("600x400*2/r@1.5"); @@ -1416,7 +1414,7 @@ generator.MoveMouseToInHost(0, 399); EXPECT_EQ("0,0", event_handler.GetLocationAndReset()); - Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + Shell::Get()->RemovePreTargetHandler(&event_handler); } // Make sure that the compositor based mirroring can switch @@ -1632,7 +1630,7 @@ UpdateDisplay("200x200,200x200*2/r"); aura::Env* env = aura::Env::GetInstance(); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); WindowTreeHostManager* window_tree_host_manager = shell->window_tree_host_manager(); test::CursorManagerTestApi test_api(shell->cursor_manager()); @@ -1656,7 +1654,7 @@ TEST_F(WindowTreeHostManagerTest, UpdateMouseLocationAfterDisplayChange_PrimaryDisconnected) { aura::Env* env = aura::Env::GetInstance(); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); WindowTreeHostManager* window_tree_host_manager = shell->window_tree_host_manager(); test::CursorManagerTestApi test_api(shell->cursor_manager()); @@ -1689,10 +1687,9 @@ TEST_F(WindowTreeHostManagerTest, GetRootWindowForDisplayIdDuringDisplayDisconnection) { UpdateDisplay("300x300,200x200"); - aura::Window* root2 = Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId( - display_manager()->GetSecondaryDisplay().id()); + aura::Window* root2 = + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_manager()->GetSecondaryDisplay().id()); views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( nullptr, root2, gfx::Rect(350, 0, 100, 100)); views::View* view = new views::View();
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 1d07181..cc41feef 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc
@@ -135,13 +135,13 @@ drag_drop_window_delegate_(new DragDropTrackerDelegate(this)), current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE), weak_factory_(this) { - Shell::GetInstance()->PrependPreTargetHandler(this); + Shell::Get()->PrependPreTargetHandler(this); WmShell::Get()->AddDisplayObserver(this); } DragDropController::~DragDropController() { WmShell::Get()->RemoveDisplayObserver(this); - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); Cleanup(); if (cancel_animation_) cancel_animation_->End(); @@ -442,7 +442,7 @@ cursor = ui::kCursorAlias; else if (op & ui::DragDropTypes::DRAG_MOVE) cursor = ui::kCursorGrabbing; - ash::Shell::GetInstance()->cursor_manager()->SetCursor(cursor); + ash::Shell::Get()->cursor_manager()->SetCursor(cursor); } } @@ -459,7 +459,7 @@ void DragDropController::Drop(aura::Window* target, const ui::LocatedEvent& event) { - ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); + ash::Shell::Get()->cursor_manager()->SetCursor(ui::kCursorPointer); // We must guarantee that a target gets a OnDragEntered before Drop. WebKit // depends on not getting a Drop without DragEnter. This behavior is @@ -514,7 +514,7 @@ } void DragDropController::DoDragCancel(int drag_cancel_animation_duration_ms) { - ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); + ash::Shell::Get()->cursor_manager()->SetCursor(ui::kCursorPointer); // |drag_window_| can be NULL if we have just started the drag and have not // received any DragUpdates, or, if the |drag_window_| gets destroyed during
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 47b719f..9896a38 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -936,8 +936,7 @@ // across displays when drag is cancelled. TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { UpdateDisplay("400x400,400x400"); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) { aura::client::SetDragDropClient(*iter, drag_drop_controller_.get()); @@ -1014,7 +1013,7 @@ // Verifies that a drag is aborted if a display is disconnected during the drag. TEST_F(DragDropControllerTest, DragCancelOnDisplayDisconnect) { UpdateDisplay("400x400,400x400"); - for (aura::Window* root : Shell::GetInstance()->GetAllRootWindows()) { + for (aura::Window* root : Shell::Get()->GetAllRootWindows()) { aura::client::SetDragDropClient(root, drag_drop_controller_.get()); }
diff --git a/ash/drag_drop/drag_drop_interactive_uitest.cc b/ash/drag_drop/drag_drop_interactive_uitest.cc index 4c0e0d0..dacca73 100644 --- a/ash/drag_drop/drag_drop_interactive_uitest.cc +++ b/ash/drag_drop/drag_drop_interactive_uitest.cc
@@ -117,8 +117,7 @@ // during drag & drop operation. TEST_F(DragDropTest, DragDropAcrossMultiDisplay) { UpdateDisplay("400x400,400x400"); - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); views::View* draggable_view = new DraggableView(); draggable_view->set_drag_controller(NULL); draggable_view->SetBounds(0, 0, 100, 100);
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index a0f2c50..444f39b 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc
@@ -36,9 +36,9 @@ void SetSecondaryDisplayLayout(display::DisplayPlacement::Position position) { std::unique_ptr<display::DisplayLayout> layout = - Shell::GetInstance()->display_manager()->GetCurrentDisplayLayout().Copy(); + Shell::Get()->display_manager()->GetCurrentDisplayLayout().Copy(); layout->placement_list[0].position = position; - Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( + Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( std::move(layout)); } @@ -258,7 +258,7 @@ aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type()); EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type()); - Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy); + Shell::Get()->cursor_manager()->SetCursor(ui::kCursorCopy); EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type()); EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type()); } @@ -697,7 +697,7 @@ TEST_F(ExtendedDesktopTest, OpenSystemTray) { UpdateDisplay("500x600,600x400"); - SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); ASSERT_FALSE(tray->HasSystemBubble()); ui::test::EventGenerator& event_generator(GetEventGenerator()); @@ -833,7 +833,7 @@ TEST_F(ExtendedDesktopTest, PassiveGrab) { EventLocationRecordingEventHandler event_handler; - ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); + ash::Shell::Get()->AddPreTargetHandler(&event_handler); UpdateDisplay("300x300,200x200"); @@ -856,7 +856,7 @@ generator.MoveMouseTo(400, 150); EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); - ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); + ash::Shell::Get()->RemovePreTargetHandler(&event_handler); } } // namespace ash
diff --git a/ash/first_run/desktop_cleaner.cc b/ash/first_run/desktop_cleaner.cc index 48b630a..a170489 100644 --- a/ash/first_run/desktop_cleaner.cc +++ b/ash/first_run/desktop_cleaner.cc
@@ -92,7 +92,7 @@ DesktopCleaner::DesktopCleaner() { // TODO(dzhioev): Add support for secondary displays. - aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow(); for (size_t i = 0; i < arraysize(kContainerIdsToHide); ++i) { aura::Window* container = Shell::GetContainer(root_window, kContainerIdsToHide[i]);
diff --git a/ash/first_run/first_run_helper_impl.cc b/ash/first_run/first_run_helper_impl.cc index 321351c7..325d474 100644 --- a/ash/first_run/first_run_helper_impl.cc +++ b/ash/first_run/first_run_helper_impl.cc
@@ -41,11 +41,11 @@ } // anonymous namespace FirstRunHelperImpl::FirstRunHelperImpl() : widget_(CreateFirstRunWindow()) { - Shell::GetInstance()->overlay_filter()->Activate(this); + Shell::Get()->overlay_filter()->Activate(this); } FirstRunHelperImpl::~FirstRunHelperImpl() { - Shell::GetInstance()->overlay_filter()->Deactivate(this); + Shell::Get()->overlay_filter()->Deactivate(this); if (IsTrayBubbleOpened()) CloseTrayBubble(); widget_->Close(); @@ -75,29 +75,29 @@ } void FirstRunHelperImpl::OpenTrayBubble() { - SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = Shell::Get()->GetPrimarySystemTray(); tray->ShowPersistentDefaultView(); } void FirstRunHelperImpl::CloseTrayBubble() { - SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = Shell::Get()->GetPrimarySystemTray(); DCHECK(tray->HasSystemBubble()) << "Tray bubble is closed already."; tray->CloseSystemBubble(); } bool FirstRunHelperImpl::IsTrayBubbleOpened() { - SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = Shell::Get()->GetPrimarySystemTray(); return tray->HasSystemBubble(); } gfx::Rect FirstRunHelperImpl::GetTrayBubbleBounds() { - SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = Shell::Get()->GetPrimarySystemTray(); views::View* bubble = tray->GetSystemBubble()->bubble_view(); return bubble->GetBoundsInScreen(); } gfx::Rect FirstRunHelperImpl::GetHelpButtonBounds() { - SystemTray* tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* tray = Shell::Get()->GetPrimarySystemTray(); views::View* help_button = tray->GetHelpButtonView(); return help_button->GetBoundsInScreen(); }
diff --git a/ash/first_run/first_run_helper_unittest.cc b/ash/first_run/first_run_helper_unittest.cc index 20b70fc..feca789 100644 --- a/ash/first_run/first_run_helper_unittest.cc +++ b/ash/first_run/first_run_helper_unittest.cc
@@ -63,7 +63,7 @@ void SetUp() override { AshTestBase::SetUp(); CheckContainersAreVisible(); - helper_.reset(ash::Shell::GetInstance()->CreateFirstRunHelper()); + helper_.reset(ash::Shell::Get()->CreateFirstRunHelper()); helper_->AddObserver(this); helper_->GetOverlayWidget()->Show(); } @@ -76,7 +76,7 @@ } void CheckContainersAreVisible() const { - aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow(); std::vector<int> containers_to_check = DesktopCleaner::GetContainersToHideForTest(); for (size_t i = 0; i < containers_to_check.size(); ++i) { @@ -87,7 +87,7 @@ } void CheckContainersAreHidden() const { - aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow(); std::vector<int> containers_to_check = DesktopCleaner::GetContainersToHideForTest(); for (size_t i = 0; i < containers_to_check.size(); ++i) {
diff --git a/ash/high_contrast/high_contrast_controller.cc b/ash/high_contrast/high_contrast_controller.cc index 0cb98a5..ea3c8e5 100644 --- a/ash/high_contrast/high_contrast_controller.cc +++ b/ash/high_contrast/high_contrast_controller.cc
@@ -12,11 +12,11 @@ namespace ash { HighContrastController::HighContrastController() : enabled_(false) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } HighContrastController::~HighContrastController() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void HighContrastController::SetEnabled(bool enabled) {
diff --git a/ash/laser/laser_pointer_controller.cc b/ash/laser/laser_pointer_controller.cc index 390d97148..f23fe1f 100644 --- a/ash/laser/laser_pointer_controller.cc +++ b/ash/laser/laser_pointer_controller.cc
@@ -44,7 +44,7 @@ base::Bind(&LaserPointerController::AddStationaryPoint, base::Unretained(this)), true /* is_repeating */)) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); int64_t presentation_delay_ms; // Use device specific presentation delay if specified. @@ -58,7 +58,7 @@ } LaserPointerController::~LaserPointerController() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void LaserPointerController::SetEnabled(bool enabled) {
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index a26f7d2a..76915e5 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc
@@ -277,7 +277,7 @@ scale_(kNonMagnifiedScale), scroll_direction_(SCROLL_NONE), disable_move_magnifier_delay_(false) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); root_window_->AddObserver(this); point_of_interest_ = root_window_->bounds().CenterPoint(); } @@ -289,7 +289,7 @@ root_window_->RemoveObserver(this); - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void MagnificationControllerImpl::RedrawKeepingMousePosition(float scale, @@ -565,8 +565,7 @@ return; ValidateScale(&scale); - Shell::GetInstance()->accessibility_delegate()->SaveScreenMagnifierScale( - scale); + Shell::Get()->accessibility_delegate()->SaveScreenMagnifierScale(scale); RedrawKeepingMousePosition(scale, animate); } @@ -597,7 +596,7 @@ if (!is_enabled_ && input_method) input_method->AddObserver(this); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); float scale = shell->accessibility_delegate()->GetSavedScreenMagnifierScale(); if (scale <= 0.0f)
diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc index 1dacc27..7c0906f 100644 --- a/ash/magnifier/magnification_controller_unittest.cc +++ b/ash/magnifier/magnification_controller_unittest.cc
@@ -80,7 +80,7 @@ } ash::MagnificationController* GetMagnificationController() const { - return ash::Shell::GetInstance()->magnification_controller(); + return ash::Shell::Get()->magnification_controller(); } gfx::Rect GetViewport() const { @@ -672,7 +672,7 @@ // Make sure that unified desktop can enter magnified mode. TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { - Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); + Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(true); EXPECT_EQ(1.0f, GetMagnificationController()->GetScale());
diff --git a/ash/magnifier/partial_magnification_controller.cc b/ash/magnifier/partial_magnification_controller.cc index fd9e04e..89c6130 100644 --- a/ash/magnifier/partial_magnification_controller.cc +++ b/ash/magnifier/partial_magnification_controller.cc
@@ -206,13 +206,13 @@ }; PartialMagnificationController::PartialMagnificationController() { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } PartialMagnificationController::~PartialMagnificationController() { CloseMagnifierWindow(); - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void PartialMagnificationController::SetEnabled(bool enabled) {
diff --git a/ash/magnifier/partial_magnification_controller_unittest.cc b/ash/magnifier/partial_magnification_controller_unittest.cc index 1c8e4b5bc..b58ccf4 100644 --- a/ash/magnifier/partial_magnification_controller_unittest.cc +++ b/ash/magnifier/partial_magnification_controller_unittest.cc
@@ -42,17 +42,17 @@ void SetUp() override { AshTestBase::SetUp(); - Shell::GetInstance()->display_manager()->UpdateDisplays(); + Shell::Get()->display_manager()->UpdateDisplays(); } protected: PartialMagnificationController* GetController() const { - return Shell::GetInstance()->partial_magnification_controller(); + return Shell::Get()->partial_magnification_controller(); } PartialMagnificationControllerTestApi GetTestApi() const { return PartialMagnificationControllerTestApi( - Shell::GetInstance()->partial_magnification_controller()); + Shell::Get()->partial_magnification_controller()); } private:
diff --git a/ash/metrics/desktop_task_switch_metric_recorder.cc b/ash/metrics/desktop_task_switch_metric_recorder.cc index 2c0a9cc..133e299a 100644 --- a/ash/metrics/desktop_task_switch_metric_recorder.cc +++ b/ash/metrics/desktop_task_switch_metric_recorder.cc
@@ -13,11 +13,11 @@ DesktopTaskSwitchMetricRecorder::DesktopTaskSwitchMetricRecorder() : last_active_task_window_(nullptr) { - Shell::GetInstance()->activation_client()->AddObserver(this); + Shell::Get()->activation_client()->AddObserver(this); } DesktopTaskSwitchMetricRecorder::~DesktopTaskSwitchMetricRecorder() { - Shell::GetInstance()->activation_client()->RemoveObserver(this); + Shell::Get()->activation_client()->RemoveObserver(this); } void DesktopTaskSwitchMetricRecorder::OnWindowActivated(
diff --git a/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc b/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc index 2dcf49f..2af3877 100644 --- a/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc +++ b/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc
@@ -26,8 +26,8 @@ // Test fixture for the DesktopTaskSwitchMetricsRecorder class. NOTE: This // fixture extends AshTestBase so that the UserMetricsRecorder instance required -// by the test target can be obtained through Shell::GetInstance()->metrics() -// and the test target is not the same instance as the one owned by the +// by the test target can be obtained through Shell::Get()->metrics() and the +// test target is not the same instance as the one owned by the // UserMetricsRecorder instance. class DesktopTaskSwitchMetricRecorderTest : public test::AshTestBase { public: @@ -341,8 +341,7 @@ aura::Window* positionable_window = CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10)); - Shell::GetInstance()->activation_client()->ActivateWindow( - positionable_window); + Shell::Get()->activation_client()->ActivateWindow(positionable_window); EXPECT_EQ(0, GetActionCount()); }
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index 97434bd..7ca11171 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc
@@ -130,7 +130,7 @@ break; const aura::Window::Windows& children = - Shell::GetContainer(Shell::GetInstance()->GetPrimaryRootWindow(), + Shell::GetContainer(Shell::Get()->GetPrimaryRootWindow(), current_container_id) ->children(); // Reverse iterate over the child windows so that they are processed in @@ -606,7 +606,7 @@ void UserMetricsRecorder::OnShellInitialized() { // Lazy creation of the DesktopTaskSwitchMetricRecorder because it accesses - // Shell::GetInstance() which is not available when |this| is instantiated. + // Shell::Get() which is not available when |this| is instantiated. if (!desktop_task_switch_metric_recorder_) { desktop_task_switch_metric_recorder_.reset( new DesktopTaskSwitchMetricRecorder());
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc index 726201c..3375fec 100644 --- a/ash/mus/bridge/wm_shell_mus.cc +++ b/ash/mus/bridge/wm_shell_mus.cc
@@ -250,7 +250,7 @@ void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { if (GetAshConfig() == Config::MUS) { - Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); + Shell::Get()->metrics()->RecordUserMetricsAction(action); return; } // TODO: http://crbug.com/616581. @@ -259,10 +259,8 @@ void WmShellMus::RecordTaskSwitchMetric(TaskSwitchSource source) { if (GetAshConfig() == Config::MUS) { - Shell::GetInstance() - ->metrics() - ->task_switch_metrics_recorder() - .OnTaskSwitch(source); + Shell::Get()->metrics()->task_switch_metrics_recorder().OnTaskSwitch( + source); return; } // TODO: http://crbug.com/616581. @@ -349,9 +347,8 @@ } SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { - return session_state_delegate_ - ? session_state_delegate_.get() - : Shell::GetInstance()->session_state_delegate(); + return session_state_delegate_ ? session_state_delegate_.get() + : Shell::Get()->session_state_delegate(); } void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { @@ -397,9 +394,7 @@ void WmShellMus::ToggleIgnoreExternalKeyboard() { if (GetAshConfig() == Config::MUS) { - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); return; } @@ -408,7 +403,7 @@ void WmShellMus::SetLaserPointerEnabled(bool enabled) { if (GetAshConfig() == Config::MUS) { - Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled); + Shell::Get()->laser_pointer_controller()->SetEnabled(enabled); return; } @@ -417,8 +412,7 @@ void WmShellMus::SetPartialMagnifierEnabled(bool enabled) { if (GetAshConfig() == Config::MUS) { - Shell::GetInstance()->partial_magnification_controller()->SetEnabled( - enabled); + Shell::Get()->partial_magnification_controller()->SetEnabled(enabled); return; }
diff --git a/ash/mus/context_menu_mus.cc b/ash/mus/context_menu_mus.cc index b012596..3962e78 100644 --- a/ash/mus/context_menu_mus.cc +++ b/ash/mus/context_menu_mus.cc
@@ -47,7 +47,7 @@ ? SHELF_AUTO_HIDE_BEHAVIOR_NEVER : SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); } else if (command_id == MENU_CHANGE_WALLPAPER) { - Shell::GetInstance()->wallpaper_controller()->OpenSetWallpaperPage(); + Shell::Get()->wallpaper_controller()->OpenSetWallpaperPage(); } }
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc index 1eba1abe..d05ea5d 100644 --- a/ash/mus/window_manager.cc +++ b/ash/mus/window_manager.cc
@@ -560,11 +560,11 @@ } bool WindowManager::IsWindowActive(aura::Window* window) { - return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; + return Shell::Get()->activation_client()->GetActiveWindow() == window; } void WindowManager::OnWmDeactivateWindow(aura::Window* window) { - Shell::GetInstance()->activation_client()->DeactivateWindow(window); + Shell::Get()->activation_client()->DeactivateWindow(window); } } // namespace mus
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 6ba028a..d3f4f493 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc
@@ -375,8 +375,7 @@ // Notify shell observers that the shelf has been created. // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will // require changing AttachedPanelWidgetTargeter's access to WmShelf. - Shell::GetInstance()->NotifyShelfCreatedForRootWindow( - WmWindow::Get(GetRootWindow())); + Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow())); wm_shelf_->shelf_widget()->PostCreateShelf(); } @@ -540,7 +539,7 @@ } void RootWindowController::Shutdown() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); touch_exploration_manager_.reset(); @@ -633,7 +632,7 @@ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kAshTouchHud)) set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); - if (Shell::GetInstance()->is_touch_hud_projection_enabled()) + if (Shell::Get()->is_touch_hud_projection_enabled()) EnableTouchHudProjection(); } @@ -649,8 +648,8 @@ return; } DCHECK(keyboard_controller); - Shell::GetInstance()->NotifyVirtualKeyboardActivated( - true, WmWindow::Get(GetRootWindow())); + Shell::Get()->NotifyVirtualKeyboardActivated(true, + WmWindow::Get(GetRootWindow())); aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); DCHECK(parent); aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); @@ -674,7 +673,7 @@ keyboard_controller->HideKeyboard( keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); parent->RemoveChild(keyboard_container); - Shell::GetInstance()->NotifyVirtualKeyboardActivated( + Shell::Get()->NotifyVirtualKeyboardActivated( false, WmWindow::Get(GetRootWindow())); } } @@ -752,7 +751,7 @@ void RootWindowController::Init(RootWindowType root_window_type) { aura::Window* root_window = GetRootWindow(); WmShell* wm_shell = WmShell::Get(); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); shell->InitRootWindow(root_window); CreateContainers(); @@ -1081,7 +1080,7 @@ // The root window for new windows is being destroyed. Switch to the primary // root window if possible. WmWindow* primary_root = WmShell::Get()->GetPrimaryRootWindow(); - Shell::GetInstance()->set_root_window_for_new_windows( + Shell::Get()->set_root_window_for_new_windows( primary_root == root ? nullptr : primary_root); } }
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index c6e08ca..fc24224 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc
@@ -538,7 +538,7 @@ TEST_F(RootWindowControllerTest, MultipleDisplaysGetWindowForFullscreenMode) { UpdateDisplay("600x600,600x600"); Shell::RootWindowControllerList controllers = - Shell::GetInstance()->GetAllRootWindowControllers(); + Shell::Get()->GetAllRootWindowControllers(); Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); w1->Maximize(); @@ -575,7 +575,7 @@ TEST_F(RootWindowControllerTest, GetRootWindowController) { UpdateDisplay("600x600,600x600"); Shell::RootWindowControllerList controllers = - Shell::GetInstance()->GetAllRootWindowControllers(); + Shell::Get()->GetAllRootWindowControllers(); ASSERT_EQ(2u, controllers.size()); // Test null. @@ -668,14 +668,14 @@ observer1.SetWindow(window1); window1->Init(ui::LAYER_NOT_DRAWN); aura::client::ParentWindowWithContext( - window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); + window1, Shell::Get()->GetPrimaryRootWindow(), gfx::Rect()); DestroyedWindowObserver observer2; aura::Window* window2 = new aura::Window(NULL); window2->set_owned_by_parent(false); observer2.SetWindow(window2); window2->Init(ui::LAYER_NOT_DRAWN); - Shell::GetInstance()->GetPrimaryRootWindow()->AddChild(window2); + Shell::Get()->GetPrimaryRootWindow()->AddChild(window2); Shell::GetPrimaryRootWindowController()->CloseChildWindows(); @@ -697,7 +697,7 @@ keyboard::switches::kEnableVirtualKeyboard); test::AshTestBase::SetUp(); keyboard::SetTouchKeyboardEnabled(true); - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); } void TearDown() override { @@ -768,8 +768,8 @@ UpdateDisplay("500x500,500x500"); display::Display secondary_display = - Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + Shell::Get()->display_manager()->GetSecondaryDisplay(); + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(secondary_display.id(), display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); @@ -777,11 +777,9 @@ // does. ASSERT_NE(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, display::Screen::GetScreen()->GetPrimaryDisplay().touch_support()); - ASSERT_EQ(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, - Shell::GetInstance() - ->display_manager() - ->GetSecondaryDisplay() - .touch_support()); + ASSERT_EQ( + display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + Shell::Get()->display_manager()->GetSecondaryDisplay().touch_support()); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* primary_root_window = Shell::GetPrimaryRootWindow(); @@ -823,23 +821,21 @@ UpdateDisplay("500x500,500x500"); const int64_t primary_display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(primary_display_id, display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); const int64_t secondary_display_id = - Shell::GetInstance()->display_manager()->GetSecondaryDisplay().id(); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + Shell::Get()->display_manager()->GetSecondaryDisplay().id(); + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetTouchSupport(secondary_display_id, display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE); // Both of displays have touch capability. ASSERT_EQ(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, display::Screen::GetScreen()->GetPrimaryDisplay().touch_support()); - ASSERT_EQ(display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, - Shell::GetInstance() - ->display_manager() - ->GetSecondaryDisplay() - .touch_support()); + ASSERT_EQ( + display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE, + Shell::Get()->display_manager()->GetSecondaryDisplay().touch_support()); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* primary_root_window = Shell::GetPrimaryRootWindow(); @@ -968,7 +964,7 @@ aura::WindowTracker tracker; tracker.Add(keyboard_container); // Reinitialize the keyboard. - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); // keyboard_container should no longer be present. EXPECT_FALSE(tracker.Contains(keyboard_container)); }
diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc index 102b8d0..b78ccd15 100644 --- a/ash/rotator/screen_rotation_animator.cc +++ b/ash/rotator/screen_rotation_animator.cc
@@ -58,14 +58,14 @@ } display::Display::Rotation GetCurrentScreenRotation(int64_t display_id) { - return Shell::GetInstance() + return Shell::Get() ->display_manager() ->GetDisplayInfo(display_id) .GetActiveRotation(); } bool IsDisplayIdValid(int64_t display_id) { - return Shell::GetInstance()->display_manager()->IsDisplayIdValid(display_id); + return Shell::Get()->display_manager()->IsDisplayIdValid(display_id); } // 180 degree rotations should animate clock-wise. @@ -77,9 +77,8 @@ } aura::Window* GetRootWindow(int64_t display_id) { - return Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_id); + return Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_id); } // Returns true if the rotation between |initial_rotation| and |new_rotation| is @@ -242,7 +241,7 @@ std::unique_ptr<LayerCleanupObserver> old_layer_cleanup_observer( new LayerCleanupObserver(weak_factory_.GetWeakPtr())); - Shell::GetInstance()->display_manager()->SetDisplayRotation( + Shell::Get()->display_manager()->SetDisplayRotation( display_id_, rotation_request->new_rotation, rotation_request->source); const gfx::Rect rotated_screen_bounds = root_window->GetTargetBounds();
diff --git a/ash/rotator/screen_rotation_animator_unittest.cc b/ash/rotator/screen_rotation_animator_unittest.cc index 1b464c6..9a84d05 100644 --- a/ash/rotator/screen_rotation_animator_unittest.cc +++ b/ash/rotator/screen_rotation_animator_unittest.cc
@@ -19,7 +19,7 @@ namespace { display::Display::Rotation GetDisplayRotation(int64_t display_id) { - return Shell::GetInstance() + return Shell::Get() ->display_manager() ->GetDisplayInfo(display_id) .GetActiveRotation(); @@ -27,7 +27,7 @@ void SetDisplayRotation(int64_t display_id, display::Display::Rotation rotation) { - Shell::GetInstance()->display_manager()->SetDisplayRotation( + Shell::Get()->display_manager()->SetDisplayRotation( display_id, rotation, display::Display::RotationSource::ROTATION_SOURCE_USER); }
diff --git a/ash/shelf/shelf_bezel_event_handler.cc b/ash/shelf/shelf_bezel_event_handler.cc index da40409..3b62a8b 100644 --- a/ash/shelf/shelf_bezel_event_handler.cc +++ b/ash/shelf/shelf_bezel_event_handler.cc
@@ -18,11 +18,11 @@ ShelfBezelEventHandler::ShelfBezelEventHandler(WmShelf* shelf) : shelf_(shelf), in_touch_drag_(false) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } ShelfBezelEventHandler::~ShelfBezelEventHandler() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void ShelfBezelEventHandler::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 5ea85267..3ac49be5 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -754,7 +754,7 @@ UpdateDisplay("800x600,800x600"); // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. // http://crbug.com/698043. - Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( + Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), display::DisplayPlacement::RIGHT, 0)); // Put the primary monitor's shelf on the display boundary. @@ -1051,7 +1051,7 @@ // The tested behavior relies on the app list presenter implementation. test::TestAppListViewPresenterImpl app_list_presenter_impl; - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); @@ -1064,7 +1064,7 @@ // Show the app list; only the shelf on the same display should be shown. app_list_presenter_impl.Show(GetPrimaryDisplayId()); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); EXPECT_TRUE(app_list_presenter_impl.GetTargetVisibility()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf_1->GetAutoHideState()); @@ -1073,7 +1073,7 @@ // Hide the app list, both shelves should be hidden. app_list_presenter_impl.Dismiss(); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); EXPECT_FALSE(app_list_presenter_impl.GetTargetVisibility()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); @@ -1132,7 +1132,7 @@ wm_shell->SimulateModalWindowOpenForTesting(true); EXPECT_TRUE(wm_shell->IsSystemModalWindowOpen()); EXPECT_FALSE(wm::CanActivateWindow(window)); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); } @@ -1179,7 +1179,7 @@ EXPECT_TRUE(wm_shell->IsSystemModalWindowOpen()); EXPECT_FALSE(wm::CanActivateWindow(window_1)); EXPECT_FALSE(wm::CanActivateWindow(window_2)); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_1->GetVisibilityState()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_1->GetAutoHideState()); EXPECT_EQ(SHELF_AUTO_HIDE, shelf_2->GetVisibilityState()); @@ -1594,9 +1594,8 @@ window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); - Shell::GetInstance() - ->lock_state_controller() - ->StartLockAnimationAndLockImmediately(false); + Shell::Get()->lock_state_controller()->StartLockAnimationAndLockImmediately( + false); EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); } @@ -1726,7 +1725,7 @@ if (WmShell::Get()->IsRunningInMash()) return; - Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); + Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(true); UpdateDisplay("500x400, 500x400"); StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); @@ -1781,7 +1780,7 @@ ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); keyboard::SetAccessibilityKeyboardEnabled(true); InitKeyboardBounds(); - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); keyboard::KeyboardController* kb_controller = keyboard::KeyboardController::GetInstance(); gfx::Rect orig_work_area( @@ -1819,7 +1818,7 @@ ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); InitKeyboardBounds(); - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); keyboard::KeyboardController* kb_controller = keyboard::KeyboardController::GetInstance(); gfx::Rect orig_work_area(
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index c38e786..1c61e03 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc
@@ -333,11 +333,9 @@ public: ShelfInitializer(ShelfAlignment alignment, ShelfAutoHideBehavior auto_hide) : alignment_(alignment), auto_hide_(auto_hide) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } - ~ShelfInitializer() override { - Shell::GetInstance()->RemoveShellObserver(this); - } + ~ShelfInitializer() override { Shell::Get()->RemoveShellObserver(this); } // ShellObserver: void OnShelfCreatedForRootWindow(WmWindow* root_window) override {
diff --git a/ash/shell.cc b/ash/shell.cc index 053206c..1d7e60c4 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -286,7 +286,7 @@ // static WmWindow* Shell::GetWmRootWindowForNewWindows() { CHECK(Shell::HasInstance()); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); if (shell->scoped_root_window_for_new_windows_) return shell->scoped_root_window_for_new_windows_; return shell->root_window_for_new_windows_; @@ -314,7 +314,7 @@ // static Config Shell::GetAshConfig() { - return GetInstance()->wm_shell_->GetAshConfig(); + return Get()->wm_shell_->GetAshConfig(); } views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView(
diff --git a/ash/shell.h b/ash/shell.h index 4c0bd56a..b185c031 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -202,9 +202,6 @@ static Shell* CreateInstance(const ShellInitParams& init_params); // Should never be called before |CreateInstance()|. - // TODO: deprecated. Use Get() instead. GetInstance() will be renamed close - // to branch point. - static Shell* GetInstance() { return Get(); } static Shell* Get(); // Returns true if the ash shell has been instantiated.
diff --git a/ash/shell/content/client/shell_browser_main_parts.cc b/ash/shell/content/client/shell_browser_main_parts.cc index ab54ee8..1be1942 100644 --- a/ash/shell/content/client/shell_browser_main_parts.cc +++ b/ash/shell/content/client/shell_browser_main_parts.cc
@@ -61,7 +61,7 @@ // Overridden from views::TestViewsDelegate: views::NonClientFrameView* CreateDefaultNonClientFrameView( views::Widget* widget) override { - return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); + return ash::Shell::Get()->CreateDefaultNonClientFrameView(widget); } void OnBeforeWidgetInit( views::Widget::InitParams* params,
diff --git a/ash/shell/example_session_controller_client.cc b/ash/shell/example_session_controller_client.cc index 9469007..aebf375a 100644 --- a/ash/shell/example_session_controller_client.cc +++ b/ash/shell/example_session_controller_client.cc
@@ -46,12 +46,12 @@ void ExampleSessionControllerClient::RequestLockScreen() { TestSessionControllerClient::RequestLockScreen(); shell::CreateLockScreen(); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); } void ExampleSessionControllerClient::UnlockScreen() { TestSessionControllerClient::UnlockScreen(); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); } } // namespace shell
diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc index 9d39c0d..fdcd500 100644 --- a/ash/shell/lock_view.cc +++ b/ash/shell/lock_view.cc
@@ -98,8 +98,7 @@ widget->GetNativeView()->Focus(); // TODO: it shouldn't be necessary to invoke UpdateTooltip() here. - Shell::GetInstance()->tooltip_controller()->UpdateTooltip( - widget->GetNativeView()); + Shell::Get()->tooltip_controller()->UpdateTooltip(widget->GetNativeView()); } } // namespace shell
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 76e8528..d15aee8f0 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc
@@ -462,7 +462,7 @@ if (WmShell::Get()->IsRunningInMash()) return; - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); ui::EventTargetTestApi test_api(shell); test::ShellTestApi shell_test_api(shell);
diff --git a/ash/system/chromeos/power/power_event_observer.cc b/ash/system/chromeos/power/power_event_observer.cc index b18e340f..2e44427 100644 --- a/ash/system/chromeos/power/power_event_observer.cc +++ b/ash/system/chromeos/power/power_event_observer.cc
@@ -71,7 +71,7 @@ } void PowerEventObserver::BrightnessChanged(int level, bool user_initiated) { - Shell::GetInstance()->power_button_controller()->OnScreenBrightnessChanged( + Shell::Get()->power_button_controller()->OnScreenBrightnessChanged( static_cast<double>(level)); } @@ -122,7 +122,7 @@ // TODO(derat): After mus exposes a method for suspending displays, call it // here: http://crbug.com/692193 if (!WmShell::Get()->IsRunningInMash()) { - Shell::GetInstance()->display_configurator()->SuspendDisplays(base::Bind( + Shell::Get()->display_configurator()->SuspendDisplays(base::Bind( &OnSuspendDisplaysCompleted, chromeos::DBusThreadManager::Get() ->GetPowerManagerClient() ->GetSuspendReadinessCallback())); @@ -133,7 +133,7 @@ // TODO(derat): After mus exposes a method for resuming displays, call it // here: http://crbug.com/692193 if (!WmShell::Get()->IsRunningInMash()) - Shell::GetInstance()->display_configurator()->ResumeDisplays(); + Shell::Get()->display_configurator()->ResumeDisplays(); Shell::Get()->system_tray_notifier()->NotifyRefreshClock(); // If the suspend request was being blocked while waiting for the lock
diff --git a/ash/system/chromeos/power/tablet_power_button_controller.cc b/ash/system/chromeos/power/tablet_power_button_controller.cc index 29c586a9..349399be 100644 --- a/ash/system/chromeos/power/tablet_power_button_controller.cc +++ b/ash/system/chromeos/power/tablet_power_button_controller.cc
@@ -82,21 +82,21 @@ weak_ptr_factory_(this) { chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); // TODO(mash): Provide a way for this class to observe stylus events: // http://crbug.com/682460 if (ui::InputDeviceManager::HasInstance()) ui::InputDeviceManager::GetInstance()->AddObserver(this); - Shell::GetInstance()->PrependPreTargetHandler(this); + Shell::Get()->PrependPreTargetHandler(this); GetInitialBacklightsForcedOff(); } TabletPowerButtonController::~TabletPowerButtonController() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); if (ui::InputDeviceManager::HasInstance()) ui::InputDeviceManager::GetInstance()->RemoveObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( this); } @@ -222,7 +222,7 @@ delegate->UpdateTouchscreenStatusFromPrefs(); // Send an a11y alert. - Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert( + Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( forced_off ? A11Y_ALERT_SCREEN_OFF : A11Y_ALERT_SCREEN_ON); }
diff --git a/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc b/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc index ae059342..6a1917b 100644 --- a/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc +++ b/ash/system/chromeos/power/tablet_power_button_controller_unittest.cc
@@ -56,8 +56,8 @@ switches::kAshEnableTouchView); AshTestBase::SetUp(); - lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); - tablet_controller_ = Shell::GetInstance() + lock_state_controller_ = Shell::Get()->lock_state_controller(); + tablet_controller_ = Shell::Get() ->power_button_controller() ->tablet_power_button_controller_for_test(); test_api_ = base::MakeUnique<TabletPowerButtonController::TestApi>(
diff --git a/ash/system/chromeos/power/video_activity_notifier.cc b/ash/system/chromeos/power/video_activity_notifier.cc index 09360e6..f18e5dc 100644 --- a/ash/system/chromeos/power/video_activity_notifier.cc +++ b/ash/system/chromeos/power/video_activity_notifier.cc
@@ -25,14 +25,14 @@ video_state_(detector->state()), screen_is_locked_(Shell::Get()->session_controller()->IsScreenLocked()) { detector_->AddObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); MaybeNotifyPowerManager(); UpdateTimer(); } VideoActivityNotifier::~VideoActivityNotifier() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); detector_->RemoveObserver(this); }
diff --git a/ash/system/chromeos/rotation/tray_rotation_lock.cc b/ash/system/chromeos/rotation/tray_rotation_lock.cc index 58edb69..7dbf7c5 100644 --- a/ash/system/chromeos/rotation/tray_rotation_lock.cc +++ b/ash/system/chromeos/rotation/tray_rotation_lock.cc
@@ -34,9 +34,7 @@ } bool IsUserRotationLocked() { - return Shell::GetInstance() - ->screen_orientation_controller() - ->user_rotation_locked(); + return Shell::Get()->screen_orientation_controller()->user_rotation_locked(); } } // namespace @@ -92,14 +90,14 @@ SetInkDropMode(InkDropHostView::InkDropMode::ON); SetVisible(IsMaximizeModeWindowManagerEnabled()); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); if (IsMaximizeModeWindowManagerEnabled()) - Shell::GetInstance()->screen_orientation_controller()->AddObserver(this); + Shell::Get()->screen_orientation_controller()->AddObserver(this); } RotationLockDefaultView::~RotationLockDefaultView() { StopObservingRotation(); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void RotationLockDefaultView::Update() { @@ -121,7 +119,7 @@ void RotationLockDefaultView::StopObservingRotation() { ScreenOrientationController* controller = - Shell::GetInstance()->screen_orientation_controller(); + Shell::Get()->screen_orientation_controller(); if (controller) controller->RemoveObserver(this); } @@ -133,16 +131,14 @@ } bool RotationLockDefaultView::PerformAction(const ui::Event& event) { - Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); return true; } void RotationLockDefaultView::OnMaximizeModeStarted() { Update(); SetVisible(true); - Shell::GetInstance()->screen_orientation_controller()->AddObserver(this); + Shell::Get()->screen_orientation_controller()->AddObserver(this); } void RotationLockDefaultView::OnMaximizeModeEnded() { @@ -160,11 +156,11 @@ : TrayImageItem(system_tray, kSystemTrayRotationLockLockedIcon, UMA_ROTATION_LOCK) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } TrayRotationLock::~TrayRotationLock() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void TrayRotationLock::OnUserRotationLockChanged() { @@ -179,7 +175,7 @@ void TrayRotationLock::OnMaximizeModeStarted() { tray_view()->SetVisible(IsUserRotationLocked()); - Shell::GetInstance()->screen_orientation_controller()->AddObserver(this); + Shell::Get()->screen_orientation_controller()->AddObserver(this); } void TrayRotationLock::OnMaximizeModeEnded() { @@ -189,7 +185,7 @@ void TrayRotationLock::DestroyTrayView() { StopObservingRotation(); - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); TrayImageItem::DestroyTrayView(); } @@ -211,7 +207,7 @@ void TrayRotationLock::StopObservingRotation() { ScreenOrientationController* controller = - Shell::GetInstance()->screen_orientation_controller(); + Shell::Get()->screen_orientation_controller(); if (controller) controller->RemoveObserver(this); }
diff --git a/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc b/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc index 1676ddb..df2cefc 100644 --- a/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc +++ b/ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc
@@ -133,9 +133,7 @@ TearDownViews(); Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( true); - Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget()); EXPECT_TRUE(tray_view()->visible()); Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( @@ -149,9 +147,7 @@ ASSERT_FALSE(tray_view()->visible()); Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( true); - Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); EXPECT_TRUE(tray_view()->visible()); Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( false); @@ -220,7 +216,7 @@ MaximizeModeController* maximize_mode_controller = Shell::Get()->maximize_mode_controller(); ScreenOrientationController* screen_orientation_controller = - Shell::GetInstance()->screen_orientation_controller(); + Shell::Get()->screen_orientation_controller(); ASSERT_FALSE(screen_orientation_controller->rotation_locked()); maximize_mode_controller->EnableMaximizeModeWindowManager(true); ASSERT_FALSE(tray_view()->visible()); @@ -262,9 +258,7 @@ Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( true); DestroyTrayView(); - Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( false); }
diff --git a/ash/system/chromeos/screen_layout_observer.cc b/ash/system/chromeos/screen_layout_observer.cc index 92157c4..205e4042 100644 --- a/ash/system/chromeos/screen_layout_observer.cc +++ b/ash/system/chromeos/screen_layout_observer.cc
@@ -39,7 +39,7 @@ namespace { display::DisplayManager* GetDisplayManager() { - return Shell::GetInstance()->display_manager(); + return Shell::Get()->display_manager(); } base::string16 GetDisplayName(int64_t display_id) { @@ -337,7 +337,7 @@ // Don't display notifications for accelerometer triggered screen rotations. // See http://crbug.com/364949 - if (Shell::GetInstance() + if (Shell::Get() ->screen_orientation_controller() ->ignore_display_configuration_updates()) { return;
diff --git a/ash/system/chromeos/screen_layout_observer_unittest.cc b/ash/system/chromeos/screen_layout_observer_unittest.cc index 193b254..50bf615 100644 --- a/ash/system/chromeos/screen_layout_observer_unittest.cc +++ b/ash/system/chromeos/screen_layout_observer_unittest.cc
@@ -55,7 +55,7 @@ ScreenLayoutObserverTest::~ScreenLayoutObserverTest() {} ScreenLayoutObserver* ScreenLayoutObserverTest::GetScreenLayoutObserver() { - return Shell::GetInstance()->screen_layout_observer(); + return Shell::Get()->screen_layout_observer(); } void ScreenLayoutObserverTest::CloseNotification() { @@ -103,9 +103,8 @@ } TEST_F(ScreenLayoutObserverTest, DisplayNotifications) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400"); display::Display::SetInternalDisplayId(display_manager()->first_display_id()); @@ -207,9 +206,8 @@ // Verify that notification shows up when display is switched from dock mode to // extend mode. TEST_F(ScreenLayoutObserverTest, DisplayConfigurationChangedTwice) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); EXPECT_EQ(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL), @@ -237,9 +235,8 @@ TEST_F(ScreenLayoutObserverTest, UpdateAfterSuppressDisplayNotification) { UpdateDisplay("400x400,200x200"); - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); // Rotate the second. UpdateDisplay("400x400,200x200/r"); @@ -253,9 +250,8 @@ // Verify that no notification is shown when overscan of a screen is changed. TEST_F(ScreenLayoutObserverTest, OverscanDisplay) { UpdateDisplay("400x400, 300x300"); - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); display::Display::SetInternalDisplayId(display_manager()->first_display_id()); // /o creates the default overscan. @@ -264,7 +260,7 @@ EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); // Reset the overscan. - Shell::GetInstance()->display_manager()->SetOverscanInsets( + Shell::Get()->display_manager()->SetOverscanInsets( display_manager()->GetSecondaryDisplay().id(), gfx::Insets()); EXPECT_TRUE(GetDisplayNotificationText().empty()); EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); @@ -273,9 +269,8 @@ // Tests that exiting mirror mode by closing the lid shows the correct "exiting // mirror mode" message. TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfDockedModeMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); display::Display::SetInternalDisplayId( display_manager()->GetSecondaryDisplay().id()); @@ -299,9 +294,8 @@ // Tests that exiting mirror mode because of adding a third display shows the // correct "3+ displays mirror mode is not supported" message. TEST_F(ScreenLayoutObserverTest, ExitMirrorModeBecauseOfThirdDisplayMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); display::Display::SetInternalDisplayId( display_manager()->GetSecondaryDisplay().id()); @@ -325,9 +319,8 @@ // correct message. TEST_F(ScreenLayoutObserverTest, ExitMirrorModeNoInternalDisplayBecauseOfDisplayRemovedMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); display::Display::SetInternalDisplayId( display_manager()->GetSecondaryDisplay().id()); @@ -350,9 +343,8 @@ // Tests notification messages shown when adding and removing displays in // extended mode. TEST_F(ScreenLayoutObserverTest, AddingRemovingDisplayExtendedModeMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400"); EXPECT_TRUE(GetDisplayNotificationText().empty()); @@ -375,9 +367,8 @@ // Tests notification messages shown when entering and exiting unified desktop // mode. TEST_F(ScreenLayoutObserverTest, EnteringExitingUnifiedModeMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400"); EXPECT_TRUE(GetDisplayNotificationText().empty()); @@ -416,9 +407,8 @@ // Special case: Tests notification messages shown when entering docked mode // by closing the lid and the internal display is the secondary display. TEST_F(ScreenLayoutObserverTest, DockedModeWithExternalPrimaryDisplayMessage) { - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); EXPECT_EQ(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL),
diff --git a/ash/system/toast/toast_manager_unittest.cc b/ash/system/toast/toast_manager_unittest.cc index 4ae8eeac..e25b45bf 100644 --- a/ash/system/toast/toast_manager_unittest.cc +++ b/ash/system/toast/toast_manager_unittest.cc
@@ -34,7 +34,7 @@ void SetUp() override { test::AshTestBase::SetUp(); - manager_ = Shell::GetInstance()->toast_manager(); + manager_ = Shell::Get()->toast_manager(); manager_->ResetSerialForTesting(); EXPECT_EQ(0, GetToastSerial());
diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index 5b00cc1..6e420ad 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc
@@ -257,9 +257,8 @@ if (WmShell::Get()->IsRunningInMash()) return; - Shell::GetInstance() - ->screen_layout_observer() - ->set_show_notifications_for_testing(true); + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( + true); UpdateDisplay("400x400,200x200"); // UpdateDisplay() creates the display notifications, so popup is visible. EXPECT_TRUE(GetTray()->IsPopupVisible());
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 4de0ba7e..edeefcd5 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc
@@ -138,7 +138,7 @@ Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); // TODO: mus/mash needs to support CursorManager. http://crbug.com/637853. if (Shell::GetAshConfig() == Config::CLASSIC) - Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); + Shell::Get()->cursor_manager()->EnableMouseEvents(); // Changing GestureConfiguration shouldn't make tests fail. These values // prevent unexpected events from being generated during tests. Such as @@ -152,7 +152,7 @@ void AshTestBase::TearDown() { teardown_called_ = true; - Shell::GetInstance()->OnAppTerminating(); + Shell::Get()->OnAppTerminating(); // Flush the message loop to finish pending release tasks. RunAllPendingInMessageLoop(); @@ -174,7 +174,7 @@ // static SystemTray* AshTestBase::GetPrimarySystemTray() { - return Shell::GetInstance()->GetPrimarySystemTray(); + return Shell::Get()->GetPrimarySystemTray(); } ui::test::EventGenerator& AshTestBase::GetEventGenerator() { @@ -187,7 +187,7 @@ // static display::Display::Rotation AshTestBase::GetActiveDisplayRotation(int64_t id) { - return Shell::GetInstance() + return Shell::Get() ->display_manager() ->GetDisplayInfo(id) .GetActiveRotation(); @@ -203,8 +203,7 @@ if (Shell::GetAshConfig() != Config::CLASSIC) { ash_test_helper_->UpdateDisplayForMash(display_specs); } else { - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .UpdateDisplay(display_specs); } } @@ -341,7 +340,7 @@ case BLOCKED_BY_LOCK_SCREEN: SetSessionStarted(true); Shell::Get()->session_controller()->LockScreenAndFlushForTest(); - Shell::GetInstance()->OnLockStateChanged(true); + Shell::Get()->OnLockStateChanged(true); break; case BLOCKED_BY_LOGIN_SCREEN: SetSessionStarted(false); @@ -366,23 +365,19 @@ if (WmShell::Get()->IsRunningInMash()) return; - Shell::GetInstance()->RemovePreTargetHandler( - Shell::GetInstance() - ->window_tree_host_manager() - ->input_method_event_handler()); + Shell::Get()->RemovePreTargetHandler( + Shell::Get()->window_tree_host_manager()->input_method_event_handler()); } display::DisplayManager* AshTestBase::display_manager() { - return Shell::GetInstance()->display_manager(); + return Shell::Get()->display_manager(); } bool AshTestBase::TestIfMouseWarpsAt(ui::test::EventGenerator& event_generator, const gfx::Point& point_in_screen) { - DCHECK(!Shell::GetInstance()->display_manager()->IsInUnifiedMode()); + DCHECK(!Shell::Get()->display_manager()->IsInUnifiedMode()); static_cast<ExtendedMouseWarpController*>( - Shell::GetInstance() - ->mouse_cursor_filter() - ->mouse_warp_controller_for_test()) + Shell::Get()->mouse_cursor_filter()->mouse_warp_controller_for_test()) ->allow_non_native_event_for_test(); display::Screen* screen = display::Screen::GetScreen(); display::Display original_display = @@ -398,7 +393,7 @@ void AshTestBase::SwapPrimaryDisplay() { if (display::Screen::GetScreen()->GetNumDisplays() <= 1) return; - Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( + Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( display_manager()->GetSecondaryDisplay().id()); }
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index b18a6c9..89e610fe 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc
@@ -142,11 +142,11 @@ aura::test::EnvTestHelper().SetInputStateLookup( std::unique_ptr<aura::InputStateLookup>()); + Shell* shell = Shell::Get(); session_controller_client_.reset( - new TestSessionControllerClient(Shell::Get()->session_controller())); + new TestSessionControllerClient(shell->session_controller())); session_controller_client_->InitializeAndBind(); - Shell* shell = Shell::GetInstance(); if (start_session) session_controller_client_->CreatePredefinedUserSessions(1); @@ -158,8 +158,7 @@ shell->screen_layout_observer()->set_show_notifications_for_testing(false); // DisplayManager is specific to classic-ash. - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(shell->display_manager()) .DisableChangeDisplayUponHostResize(); DisplayConfigurationControllerTestApi( shell->display_configuration_controller()) @@ -278,7 +277,7 @@ display::Display AshTestHelper::GetSecondaryDisplay() { if (config_ == Config::CLASSIC) - return Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); + return Shell::Get()->display_manager()->GetSecondaryDisplay(); std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId(); CHECK_LE(2U, roots.size());
diff --git a/ash/test/ash_test_impl_aura.cc b/ash/test/ash_test_impl_aura.cc index 75fb8ec..6cda4e0 100644 --- a/ash/test/ash_test_impl_aura.cc +++ b/ash/test/ash_test_impl_aura.cc
@@ -79,15 +79,15 @@ } display::Display AshTestImplAura::GetSecondaryDisplay() { - return Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); + return Shell::Get()->display_manager()->GetSecondaryDisplay(); } bool AshTestImplAura::SetSecondaryDisplayPlacement( display::DisplayPlacement::Position position, int offset) { - Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( - display::test::CreateDisplayLayout( - Shell::GetInstance()->display_manager(), position, 0)); + Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( + display::test::CreateDisplayLayout(Shell::Get()->display_manager(), + position, 0)); return true; }
diff --git a/ash/test/ash_test_views_delegate.cc b/ash/test/ash_test_views_delegate.cc index 256e768a..980b6d32 100644 --- a/ash/test/ash_test_views_delegate.cc +++ b/ash/test/ash_test_views_delegate.cc
@@ -21,7 +21,7 @@ if (!params->parent && !params->context && ash::Shell::HasInstance()) { // If the window has neither a parent nor a context add to the root. - params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); + params->parent = ash::Shell::Get()->GetPrimaryRootWindow(); } }
diff --git a/ash/test/cursor_manager_test_api.cc b/ash/test/cursor_manager_test_api.cc index f5b033d..4d3e8788 100644 --- a/ash/test/cursor_manager_test_api.cc +++ b/ash/test/cursor_manager_test_api.cc
@@ -30,13 +30,13 @@ display::Display::Rotation CursorManagerTestApi::GetCurrentCursorRotation() const { - return ShellTestApi(Shell::GetInstance()) + return ShellTestApi(Shell::Get()) .ash_native_cursor_manager() ->image_cursors_->GetRotation(); } float CursorManagerTestApi::GetCurrentCursorScale() const { - return ShellTestApi(Shell::GetInstance()) + return ShellTestApi(Shell::Get()) .ash_native_cursor_manager() ->image_cursors_->GetScale(); }
diff --git a/ash/test/mirror_window_test_api.cc b/ash/test/mirror_window_test_api.cc index 5f687f8..8a65b84 100644 --- a/ash/test/mirror_window_test_api.cc +++ b/ash/test/mirror_window_test_api.cc
@@ -16,7 +16,7 @@ namespace test { const aura::WindowTreeHost* MirrorWindowTestApi::GetHost() const { - aura::Window* window = Shell::GetInstance() + aura::Window* window = Shell::Get() ->window_tree_host_manager() ->mirror_window_controller() ->GetWindow(); @@ -24,14 +24,14 @@ } int MirrorWindowTestApi::GetCurrentCursorType() const { - return Shell::GetInstance() + return Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->cursor_type_; } const gfx::Point& MirrorWindowTestApi::GetCursorHotPoint() const { - return Shell::GetInstance() + return Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->hot_point_; @@ -43,7 +43,7 @@ } const aura::Window* MirrorWindowTestApi::GetCursorWindow() const { - return Shell::GetInstance() + return Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->cursor_window_.get();
diff --git a/ash/test/shell_test_api.cc b/ash/test/shell_test_api.cc index c81507e..a955c37 100644 --- a/ash/test/shell_test_api.cc +++ b/ash/test/shell_test_api.cc
@@ -13,7 +13,7 @@ namespace ash { namespace test { -ShellTestApi::ShellTestApi() : ShellTestApi(Shell::GetInstance()) {} +ShellTestApi::ShellTestApi() : ShellTestApi(Shell::Get()) {} ShellTestApi::ShellTestApi(Shell* shell) : shell_(shell) {}
diff --git a/ash/test/test_wallpaper_delegate.cc b/ash/test/test_wallpaper_delegate.cc index 1296314..6ffeaf3 100644 --- a/ash/test/test_wallpaper_delegate.cc +++ b/ash/test/test_wallpaper_delegate.cc
@@ -17,7 +17,7 @@ void TestWallpaperDelegate::UpdateWallpaper(bool clear_cache) { DefaultWallpaperDelegate::UpdateWallpaper(clear_cache); if (!custom_wallpaper_.isNull()) { - Shell::GetInstance()->wallpaper_controller()->SetWallpaperImage( + Shell::Get()->wallpaper_controller()->SetWallpaperImage( custom_wallpaper_, wallpaper::WALLPAPER_LAYOUT_STRETCH); } update_wallpaper_count_++;
diff --git a/ash/tooltips/tooltip_controller_unittest.cc b/ash/tooltips/tooltip_controller_unittest.cc index f73dc6e..30adb05 100644 --- a/ash/tooltips/tooltip_controller_unittest.cc +++ b/ash/tooltips/tooltip_controller_unittest.cc
@@ -119,16 +119,16 @@ return; // Disable mouse event which hides the cursor and check again. - ash::Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); + ash::Shell::Get()->cursor_manager()->DisableMouseEvents(); RunAllPendingInMessageLoop(); - EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_FALSE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); helper_->UpdateIfRequired(); EXPECT_FALSE(helper_->IsTooltipVisible()); // Enable mouse event which shows the cursor and re-check. - ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); + ash::Shell::Get()->cursor_manager()->EnableMouseEvents(); RunAllPendingInMessageLoop(); - EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_TRUE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); helper_->UpdateIfRequired(); EXPECT_TRUE(helper_->IsTooltipVisible()); }
diff --git a/ash/touch/ash_touch_transform_controller.cc b/ash/touch/ash_touch_transform_controller.cc index bc7be76..3681476 100644 --- a/ash/touch/ash_touch_transform_controller.cc +++ b/ash/touch/ash_touch_transform_controller.cc
@@ -13,11 +13,11 @@ display::DisplayConfigurator* display_configurator, display::DisplayManager* display_manager) : TouchTransformController(display_configurator, display_manager) { - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); } AshTouchTransformController::~AshTouchTransformController() { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); } void AshTouchTransformController::OnDisplaysInitialized() {
diff --git a/ash/touch/touch_hud_debug.cc b/ash/touch/touch_hud_debug.cc index 7979873..fa40050 100644 --- a/ash/touch/touch_hud_debug.cc +++ b/ash/touch/touch_hud_debug.cc
@@ -323,7 +323,7 @@ canvas_(NULL), label_container_(NULL) { const display::Display& display = - Shell::GetInstance()->display_manager()->GetDisplayForId(display_id()); + Shell::Get()->display_manager()->GetDisplayForId(display_id()); views::View* content = widget()->GetContentsView(); @@ -356,7 +356,7 @@ // static std::unique_ptr<base::DictionaryValue> TouchHudDebug::GetAllAsDictionary() { std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); - aura::Window::Windows roots = Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows roots = Shell::Get()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = roots.begin(); iter != roots.end(); ++iter) { RootWindowController* controller = GetRootWindowController(*iter);
diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc index 4e302568..2292576f0 100644 --- a/ash/touch/touch_observer_hud.cc +++ b/ash/touch/touch_observer_hud.cc
@@ -22,7 +22,7 @@ root_window_(initial_root), widget_(NULL) { const display::Display& display = - Shell::GetInstance()->display_manager()->GetDisplayForId(display_id_); + Shell::Get()->display_manager()->GetDisplayForId(display_id_); views::View* content = new views::View; @@ -47,14 +47,14 @@ // Observe changes in display size and mode to update touch HUD. display::Screen::GetScreen()->AddObserver(this); - Shell::GetInstance()->display_configurator()->AddObserver(this); - Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + Shell::Get()->display_configurator()->AddObserver(this); + Shell::Get()->window_tree_host_manager()->AddObserver(this); root_window_->AddPreTargetHandler(this); } TouchObserverHUD::~TouchObserverHUD() { - Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); - Shell::GetInstance()->display_configurator()->RemoveObserver(this); + Shell::Get()->window_tree_host_manager()->RemoveObserver(this); + Shell::Get()->display_configurator()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); widget_->RemoveObserver(this); @@ -126,9 +126,9 @@ if (root_window_) return; - root_window_ = Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_id_); + root_window_ = + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_id_); views::Widget::ReparentNativeView( widget_->GetNativeView(),
diff --git a/ash/touch/touch_observer_hud_unittest.cc b/ash/touch/touch_observer_hud_unittest.cc index bca43314..72634fb 100644 --- a/ash/touch/touch_observer_hud_unittest.cc +++ b/ash/touch/touch_observer_hud_unittest.cc
@@ -31,9 +31,9 @@ // Initialize display infos. They should be initialized after Ash // environment is set up, i.e., after test::AshTestBase::SetUp(). - internal_display_id_ = display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) - .SetFirstDisplayAsInternalDisplay(); + internal_display_id_ = + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) + .SetFirstDisplayAsInternalDisplay(); external_display_id_ = 10; mirrored_display_id_ = 11; @@ -118,7 +118,7 @@ protected: WindowTreeHostManager* GetWindowTreeHostManager() { - return Shell::GetInstance()->window_tree_host_manager(); + return Shell::Get()->window_tree_host_manager(); } const display::Display& GetInternalDisplay() { @@ -267,11 +267,11 @@ ~TouchHudProjectionTest() override {} void EnableTouchHudProjection() { - Shell::GetInstance()->SetTouchHudProjectionEnabled(true); + Shell::Get()->SetTouchHudProjectionEnabled(true); } void DisableTouchHudProjection() { - Shell::GetInstance()->SetTouchHudProjectionEnabled(false); + Shell::Get()->SetTouchHudProjectionEnabled(false); } TouchHudProjection* GetInternalTouchHudProjection() {
diff --git a/ash/utility/screenshot_controller.cc b/ash/utility/screenshot_controller.cc index 5728596..d483fa0 100644 --- a/ash/utility/screenshot_controller.cc +++ b/ash/utility/screenshot_controller.cc
@@ -34,7 +34,7 @@ // monitors. it will stop the mouse at the any edge of the screen. must // swtich back on when the screenshot is complete. void EnableMouseWarp(bool enable) { - Shell::GetInstance()->mouse_cursor_filter()->set_mouse_warp_enabled(enable); + Shell::Get()->mouse_cursor_filter()->set_mouse_warp_enabled(enable); } class ScreenshotWindowTargeter : public aura::WindowTargeter { @@ -54,9 +54,9 @@ display::Display display = display::Screen::GetScreen()->GetDisplayNearestPoint(location); - aura::Window* root_window = Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display.id()); position_client->ConvertPointFromScreen(root_window, &location); @@ -235,13 +235,13 @@ screenshot_delegate_(nullptr) { // Keep this here and don't move it to StartPartialScreenshotSession(), as it // needs to be pre-pended by MouseCursorEventFilter in Shell::Init(). - Shell::GetInstance()->PrependPreTargetHandler(this); + Shell::Get()->PrependPreTargetHandler(this); } ScreenshotController::~ScreenshotController() { if (screenshot_delegate_) CancelScreenshotSession(); - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void ScreenshotController::StartWindowScreenshotSession( @@ -261,8 +261,8 @@ } SetSelectedWindow(wm::GetActiveWindow()); - cursor_setter_.reset(new ScopedCursorSetter( - Shell::GetInstance()->cursor_manager(), ui::kCursorCross)); + cursor_setter_.reset( + new ScopedCursorSetter(Shell::Get()->cursor_manager(), ui::kCursorCross)); EnableMouseWarp(true); } @@ -286,8 +286,8 @@ } if (!pen_events_only_) { - cursor_setter_.reset(new ScopedCursorSetter( - Shell::GetInstance()->cursor_manager(), ui::kCursorCross)); + cursor_setter_.reset(new ScopedCursorSetter(Shell::Get()->cursor_manager(), + ui::kCursorCross)); } EnableMouseWarp(false); @@ -340,7 +340,7 @@ // called before ctor is called. cursor_setter_.reset(); cursor_setter_.reset(new ScopedCursorSetter( - Shell::GetInstance()->cursor_manager(), ui::kCursorNone)); + Shell::Get()->cursor_manager(), ui::kCursorNone)); } Update(event); }
diff --git a/ash/utility/screenshot_controller_unittest.cc b/ash/utility/screenshot_controller_unittest.cc index 3b65da59b..2b9503d 100644 --- a/ash/utility/screenshot_controller_unittest.cc +++ b/ash/utility/screenshot_controller_unittest.cc
@@ -28,7 +28,7 @@ protected: ScreenshotController* screenshot_controller() { - return Shell::GetInstance()->screenshot_controller(); + return Shell::Get()->screenshot_controller(); } bool TestIfMouseWarpsAt(const gfx::Point& point_in_screen) { @@ -53,11 +53,11 @@ } const gfx::Point& GetStartPosition() const { - return Shell::GetInstance()->screenshot_controller()->start_position_; + return Shell::Get()->screenshot_controller()->start_position_; } const aura::Window* GetCurrentSelectedWindow() const { - return Shell::GetInstance()->screenshot_controller()->selected_; + return Shell::Get()->screenshot_controller()->selected_; } aura::Window* CreateSelectableWindow(const gfx::Rect& rect) { @@ -257,7 +257,7 @@ // cursor. See http://crbug.com/462229 TEST_F(PartialScreenshotControllerTest, MouseWarpTest) { // Create two displays. - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); UpdateDisplay("500x500,500x500"); EXPECT_EQ(2U, shell->display_manager()->GetNumDisplays()); @@ -273,7 +273,7 @@ } TEST_F(PartialScreenshotControllerTest, VisibilityTest) { - aura::client::CursorClient* client = Shell::GetInstance()->cursor_manager(); + aura::client::CursorClient* client = Shell::Get()->cursor_manager(); GetEventGenerator().PressKey(ui::VKEY_A, 0); GetEventGenerator().ReleaseKey(ui::VKEY_A, 0); @@ -296,8 +296,8 @@ // Make sure ScreenshotController doesn't prevent handling of large // cursor. See http://crbug.com/459214 TEST_F(PartialScreenshotControllerTest, LargeCursor) { - Shell::GetInstance()->cursor_manager()->SetCursorSet(ui::CURSOR_SET_LARGE); - Shell::GetInstance() + Shell::Get()->cursor_manager()->SetCursorSet(ui::CURSOR_SET_LARGE); + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->SetCursorCompositingEnabled(true);
diff --git a/ash/virtual_keyboard_controller.cc b/ash/virtual_keyboard_controller.cc index c0ec291e..cd6c786 100644 --- a/ash/virtual_keyboard_controller.cc +++ b/ash/virtual_keyboard_controller.cc
@@ -45,7 +45,7 @@ ->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); for (RootWindowController* controller : - Shell::GetInstance()->GetAllRootWindowControllers()) { + Shell::Get()->GetAllRootWindowControllers()) { if (display::Screen::GetScreen() ->GetDisplayNearestWindow(controller->GetRootWindow()) .id() == display_id) { @@ -73,13 +73,13 @@ has_internal_keyboard_(false), has_touchscreen_(false), ignore_external_keyboard_(false) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); ui::InputDeviceManager::GetInstance()->AddObserver(this); UpdateDevices(); } VirtualKeyboardController::~VirtualKeyboardController() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); ui::InputDeviceManager::GetInstance()->RemoveObserver(this); } @@ -211,9 +211,9 @@ if (is_enabled == was_enabled) return; if (is_enabled) { - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); } else { - Shell::GetInstance()->DeactivateKeyboard(); + Shell::Get()->DeactivateKeyboard(); } }
diff --git a/ash/virtual_keyboard_controller_unittest.cc b/ash/virtual_keyboard_controller_unittest.cc index d66383f..422259e0 100644 --- a/ash/virtual_keyboard_controller_unittest.cc +++ b/ash/virtual_keyboard_controller_unittest.cc
@@ -196,17 +196,13 @@ ASSERT_TRUE(IsVirtualKeyboardSuppressed()); // Toggle show keyboard. Keyboard should be visible. ResetObserver(); - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); ASSERT_TRUE(keyboard::IsKeyboardEnabled()); ASSERT_TRUE(notified()); ASSERT_TRUE(IsVirtualKeyboardSuppressed()); // Toggle show keyboard. Keyboard should be hidden. ResetObserver(); - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); ASSERT_FALSE(keyboard::IsKeyboardEnabled()); ASSERT_TRUE(notified()); ASSERT_TRUE(IsVirtualKeyboardSuppressed()); @@ -275,17 +271,13 @@ ASSERT_TRUE(IsVirtualKeyboardSuppressed()); // Toggle show keyboard. Keyboard should be visible. ResetObserver(); - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); ASSERT_TRUE(keyboard::IsKeyboardEnabled()); ASSERT_TRUE(notified()); ASSERT_TRUE(IsVirtualKeyboardSuppressed()); // Toggle show keyboard. Keyboard should be hidden. ResetObserver(); - Shell::GetInstance() - ->virtual_keyboard_controller() - ->ToggleIgnoreExternalKeyboard(); + Shell::Get()->virtual_keyboard_controller()->ToggleIgnoreExternalKeyboard(); ASSERT_FALSE(keyboard::IsKeyboardEnabled()); ASSERT_TRUE(notified()); ASSERT_TRUE(IsVirtualKeyboardSuppressed());
diff --git a/ash/wm/ash_focus_rules_unittest.cc b/ash/wm/ash_focus_rules_unittest.cc index 0909d33b..3f1e51ee 100644 --- a/ash/wm/ash_focus_rules_unittest.cc +++ b/ash/wm/ash_focus_rules_unittest.cc
@@ -41,7 +41,7 @@ void RequestLockScreen() override { TestSessionControllerClient::RequestLockScreen(); CreateLockScreen(); - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); } void UnlockScreen() override { @@ -51,7 +51,7 @@ lock_screen_widget_.reset(nullptr); } - Shell::GetInstance()->UpdateShelfVisibility(); + Shell::Get()->UpdateShelfVisibility(); } private:
diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc index d79bd5d..1bbafbf5 100644 --- a/ash/wm/ash_native_cursor_manager.cc +++ b/ash/wm/ash_native_cursor_manager.cc
@@ -19,34 +19,31 @@ namespace { void SetCursorOnAllRootWindows(gfx::NativeCursor cursor) { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) (*iter)->GetHost()->SetCursor(cursor); - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->SetCursor(cursor); } void NotifyCursorVisibilityChange(bool visible) { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) (*iter)->GetHost()->OnCursorVisibilityChanged(visible); - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->SetVisibility(visible); } void NotifyMouseEventsEnableStateChange(bool enabled) { - aura::Window::Windows root_windows = - Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) (*iter)->GetHost()->dispatcher()->OnMouseEventsEnableStateChanged(enabled); @@ -63,7 +60,7 @@ void AshNativeCursorManager::SetNativeCursorEnabled(bool enabled) { native_cursor_enabled_ = enabled; - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); SetCursor(cursor_manager->GetCursor(), cursor_manager); } @@ -73,7 +70,7 @@ DCHECK(display.is_valid()); // Use the platform's device scale factor instead of the display's, which // might have been adjusted for the UI scale. - const float original_scale = Shell::GetInstance() + const float original_scale = Shell::Get() ->display_manager() ->GetDisplayInfo(display.id()) .device_scale_factor(); @@ -84,7 +81,7 @@ if (image_cursors_->SetDisplay(display, cursor_scale)) SetCursor(delegate->GetCursor(), delegate); - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->SetDisplay(display); @@ -124,7 +121,7 @@ if (delegate->IsCursorVisible()) SetCursor(delegate->GetCursor(), delegate); - Shell::GetInstance() + Shell::Get() ->window_tree_host_manager() ->cursor_window_controller() ->SetCursorSet(cursor_set);
diff --git a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc index 8abfaa4..62a07c4 100644 --- a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc +++ b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc
@@ -56,7 +56,7 @@ #endif TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); test::CursorManagerTestApi test_api(cursor_manager); display::ManagedDisplayInfo display_info1 =
diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index e806b749..0b5d327 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc
@@ -56,7 +56,7 @@ typedef test::AshTestBase AshNativeCursorManagerTest; TEST_F(AshNativeCursorManagerTest, LockCursor) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); cursor_manager->SetCursor(ui::kCursorCopy); @@ -98,7 +98,7 @@ } TEST_F(AshNativeCursorManagerTest, SetCursor) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); cursor_manager->SetCursor(ui::kCursorCopy); EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); @@ -109,7 +109,7 @@ } TEST_F(AshNativeCursorManagerTest, SetCursorSet) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet()); @@ -125,7 +125,7 @@ } TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); UpdateDisplay("800x100*2"); EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); @@ -137,7 +137,7 @@ } TEST_F(AshNativeCursorManagerTest, FractionalScale) { - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); // Cursor should use the resource scale factor. UpdateDisplay("800x100*1.25"); @@ -148,17 +148,17 @@ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); display::Display::SetInternalDisplayId(display_id); - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetDisplayUIScale(display_id, 0.5f); EXPECT_EQ( 1.0f, display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetDisplayUIScale(display_id, 1.0f); // 2x display should keep using 2x cursor regardless of the UI scale. @@ -167,7 +167,7 @@ 2.0f, display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); - display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetDisplayUIScale(display_id, 2.0f); EXPECT_EQ( 1.0f,
diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index 0ccaf949..ce9d6d6 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc
@@ -31,7 +31,7 @@ DragWindowResizer::~DragWindowResizer() { if (window_state_) window_state_->DeleteDragDetails(); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); shell->mouse_cursor_filter()->set_mouse_warp_enabled(true); shell->mouse_cursor_filter()->HideSharedEdgeIndicator(); if (instance_ == this) @@ -126,7 +126,7 @@ // |mouse_warp_mode_| should be set to WARP_DRAG so that the user could move a // window/tab to another display. MouseCursorEventFilter* mouse_cursor_filter = - Shell::GetInstance()->mouse_cursor_filter(); + Shell::Get()->mouse_cursor_filter(); mouse_cursor_filter->set_mouse_warp_enabled(ShouldAllowMouseWarp()); if (ShouldAllowMouseWarp()) mouse_cursor_filter->ShowSharedEdgeIndicator(
diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc index 410022bdf..565c2c1e 100644 --- a/ash/wm/drag_window_resizer_unittest.cc +++ b/ash/wm/drag_window_resizer_unittest.cc
@@ -542,8 +542,7 @@ // Verifies if the resizer sets and resets // MouseCursorEventFilter::mouse_warp_mode_ as expected. TEST_F(DragWindowResizerTest, WarpMousePointer) { - MouseCursorEventFilter* event_filter = - Shell::GetInstance()->mouse_cursor_filter(); + MouseCursorEventFilter* event_filter = Shell::Get()->mouse_cursor_filter(); ASSERT_TRUE(event_filter); window_->SetBounds(gfx::Rect(0, 0, 50, 60)); @@ -592,8 +591,7 @@ aura::Window::Windows root_windows = Shell::GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); - test::CursorManagerTestApi cursor_test_api( - Shell::GetInstance()->cursor_manager()); + test::CursorManagerTestApi cursor_test_api(Shell::Get()->cursor_manager()); // Move window from the root window with 1.0 device scale factor to the root // window with 2.0 device scale factor. {
diff --git a/ash/wm/event_client_impl.cc b/ash/wm/event_client_impl.cc index 69de5326..424d192 100644 --- a/ash/wm/event_client_impl.cc +++ b/ash/wm/event_client_impl.cc
@@ -50,7 +50,7 @@ } ui::EventTarget* EventClientImpl::GetToplevelEventTarget() { - return Shell::GetInstance(); + return Shell::Get(); } } // namespace ash
diff --git a/ash/wm/immersive_fullscreen_controller_unittest.cc b/ash/wm/immersive_fullscreen_controller_unittest.cc index 66fe12c..51f524e 100644 --- a/ash/wm/immersive_fullscreen_controller_unittest.cc +++ b/ash/wm/immersive_fullscreen_controller_unittest.cc
@@ -515,7 +515,7 @@ // Set up initial state. UpdateDisplay("800x600,800x600"); - ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( + ash::Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), display::DisplayPlacement::TOP, 0));
diff --git a/ash/wm/immersive_gesture_handler_aura.cc b/ash/wm/immersive_gesture_handler_aura.cc index c157d661..7acc2ee 100644 --- a/ash/wm/immersive_gesture_handler_aura.cc +++ b/ash/wm/immersive_gesture_handler_aura.cc
@@ -28,11 +28,11 @@ ImmersiveGestureHandlerAura::ImmersiveGestureHandlerAura( ImmersiveFullscreenController* controller) : immersive_fullscreen_controller_(controller) { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } ImmersiveGestureHandlerAura::~ImmersiveGestureHandlerAura() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void ImmersiveGestureHandlerAura::OnGestureEvent(ui::GestureEvent* event) {
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 36f083b..2a549d95 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc
@@ -160,7 +160,7 @@ shutting_down_ = true; - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); // TODO(derat): Remove these null checks once mash instantiates a // CursorManager. if (shell->cursor_manager()) { @@ -196,7 +196,7 @@ // This is also the case when the user signs off. if (!shutting_down_) { shutting_down_ = true; - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); if (shell->cursor_manager()) { shell->cursor_manager()->HideCursor(); shell->cursor_manager()->LockCursor(); @@ -269,7 +269,7 @@ VLOG(1) << "OnPreShutdownAnimationTimeout"; shutting_down_ = true; - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); if (shell->cursor_manager()) shell->cursor_manager()->HideCursor(); @@ -285,7 +285,7 @@ } base::TimeDelta sound_duration = - Shell::GetInstance()->accessibility_delegate()->PlayShutdownSound(); + Shell::Get()->accessibility_delegate()->PlayShutdownSound(); sound_duration = std::min(sound_duration, base::TimeDelta::FromMilliseconds(kMaxShutdownSoundDurationMs)); @@ -305,7 +305,7 @@ } void LockStateController::StartCancellableShutdownAnimation() { - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); // Hide cursor, but let it reappear if the mouse moves. if (shell->cursor_manager()) shell->cursor_manager()->HideCursor();
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index 5c18242..0a52e8a 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc
@@ -36,7 +36,7 @@ namespace { bool cursor_visible() { - return Shell::GetInstance()->cursor_manager()->IsCursorVisible(); + return Shell::Get()->cursor_manager()->IsCursorVisible(); } void CheckCalledCallback(bool* flag) { @@ -80,13 +80,13 @@ test_animator_ = new TestSessionStateAnimator; - lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); + lock_state_controller_ = Shell::Get()->lock_state_controller(); lock_state_controller_->set_animator_for_test(test_animator_); test_api_.reset(new LockStateControllerTestApi(lock_state_controller_)); test_api_->set_shutdown_controller(&test_shutdown_controller_); - power_button_controller_ = Shell::GetInstance()->power_button_controller(); + power_button_controller_ = Shell::Get()->power_button_controller(); shell_delegate_ = static_cast<TestShellDelegate*>(Shell::Get()->shell_delegate());
diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc index 153f758..2bbd8a3 100644 --- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc +++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -83,8 +83,7 @@ // Set the first display to be the internal display for the accelerometer // screen rotation tests. - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); }
diff --git a/ash/wm/maximize_mode/maximize_mode_event_handler_aura.cc b/ash/wm/maximize_mode/maximize_mode_event_handler_aura.cc index 749d249..35e5902 100644 --- a/ash/wm/maximize_mode/maximize_mode_event_handler_aura.cc +++ b/ash/wm/maximize_mode/maximize_mode_event_handler_aura.cc
@@ -11,11 +11,11 @@ namespace wm { MaximizeModeEventHandlerAura::MaximizeModeEventHandlerAura() { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); } MaximizeModeEventHandlerAura::~MaximizeModeEventHandlerAura() { - Shell::GetInstance()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(this); } void MaximizeModeEventHandlerAura::OnTouchEvent(ui::TouchEvent* event) {
diff --git a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc index 41f48491..3007324 100644 --- a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc
@@ -22,7 +22,7 @@ input_controller->IsInternalTouchpadEnabled()) { should_ignore_touch_pad_ = false; input_controller->SetInternalTouchpadEnabled(false); - Shell::GetInstance()->cursor_manager()->HideCursor(); + Shell::Get()->cursor_manager()->HideCursor(); } // Allow the acccessible keys present on the side of some devices to continue @@ -42,7 +42,7 @@ if (!should_ignore_touch_pad_) { input_controller->SetInternalTouchpadEnabled(true); - Shell::GetInstance()->cursor_manager()->ShowCursor(); + Shell::Get()->cursor_manager()->ShowCursor(); } input_controller->SetInternalKeyboardFilter(false /* enable_filter */,
diff --git a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc index 8089766..cc7a99b490 100644 --- a/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc +++ b/ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc
@@ -49,13 +49,13 @@ void SetMouseLocationInScreen(const gfx::Point& screen_location) { const display::Display& display = - Shell::GetInstance()->display_manager()->FindDisplayContainingPoint( + Shell::Get()->display_manager()->FindDisplayContainingPoint( screen_location); if (!display.is_valid()) return; - aura::Window* root_window = Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display.id()); gfx::Point host_location(screen_location); aura::client::ScreenPositionClient* client = aura::client::GetScreenPositionClient(root_window); @@ -88,7 +88,7 @@ // |touchpad_device_id_| will remain |kDeviceIdNone|. touchpad_device_id_ = xi_dev_list[i].deviceid; device_data_manager->DisableDevice(touchpad_device_id_); - Shell::GetInstance()->cursor_manager()->HideCursor(); + Shell::Get()->cursor_manager()->HideCursor(); } } else if (device_name == kCoreKeyboardName) { core_keyboard_device_id_ = xi_dev_list[i].deviceid; @@ -123,7 +123,7 @@ ui::DeviceDataManager::GetInstance()); if (touchpad_device_id_ != kDeviceIdNone) { device_data_manager->EnableDevice(touchpad_device_id_); - Shell::GetInstance()->cursor_manager()->ShowCursor(); + Shell::Get()->cursor_manager()->ShowCursor(); } if (keyboard_device_id_ != kDeviceIdNone) device_data_manager->EnableDevice(keyboard_device_id_);
diff --git a/ash/wm/overlay_event_filter_unittest.cc b/ash/wm/overlay_event_filter_unittest.cc index 618e4d8..37a2294 100644 --- a/ash/wm/overlay_event_filter_unittest.cc +++ b/ash/wm/overlay_event_filter_unittest.cc
@@ -20,15 +20,15 @@ TestOverlayDelegate d1; TestOverlayDelegate d2; - Shell::GetInstance()->overlay_filter()->Activate(&d1); + Shell::Get()->overlay_filter()->Activate(&d1); EXPECT_EQ(0, d1.GetCancelCountAndReset()); EXPECT_EQ(0, d2.GetCancelCountAndReset()); - Shell::GetInstance()->overlay_filter()->Activate(&d2); + Shell::Get()->overlay_filter()->Activate(&d2); EXPECT_EQ(1, d1.GetCancelCountAndReset()); EXPECT_EQ(0, d2.GetCancelCountAndReset()); - Shell::GetInstance()->overlay_filter()->Cancel(); + Shell::Get()->overlay_filter()->Cancel(); EXPECT_EQ(0, d1.GetCancelCountAndReset()); EXPECT_EQ(1, d2.GetCancelCountAndReset()); }
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index 19ad95e..c90f08c 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc
@@ -378,8 +378,7 @@ // Tests that an a11y alert is sent on entering overview mode. TEST_F(WindowSelectorTest, A11yAlertOnOverviewMode) { gfx::Rect bounds(0, 0, 400, 400); - AccessibilityDelegate* delegate = - Shell::GetInstance()->accessibility_delegate(); + AccessibilityDelegate* delegate = Shell::Get()->accessibility_delegate(); std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); @@ -1258,7 +1257,7 @@ bool drag_canceled_by_test = false; gfx::Rect bounds(0, 0, 400, 400); std::unique_ptr<aura::Window> window(CreateWindow(bounds)); - test::ShellTestApi shell_test_api(Shell::GetInstance()); + test::ShellTestApi shell_test_api(Shell::Get()); DragDropController* drag_drop_controller = shell_test_api.drag_drop_controller(); ui::OSExchangeData data; @@ -1312,7 +1311,7 @@ if (WmShell::Get()->IsRunningInMash()) return; - aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow(); UpdateDisplay("600x200"); EXPECT_EQ("0,0 600x200", root_window->bounds().ToString()); gfx::Rect window_bounds(0, 0, 150, 150); @@ -1448,7 +1447,7 @@ return; UpdateDisplay("400x400,400x400"); - Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( + Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), display::DisplayPlacement::LEFT, 0)); aura::Window::Windows root_windows = Shell::GetAllRootWindows();
diff --git a/ash/wm/panels/attached_panel_window_targeter.cc b/ash/wm/panels/attached_panel_window_targeter.cc index 55845ea0..0f458c5 100644 --- a/ash/wm/panels/attached_panel_window_targeter.cc +++ b/ash/wm/panels/attached_panel_window_targeter.cc
@@ -23,11 +23,11 @@ panel_container_(container), panel_layout_manager_(panel_layout_manager), default_touch_extend_(default_touch_extend) { - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } AttachedPanelWindowTargeter::~AttachedPanelWindowTargeter() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); } void AttachedPanelWindowTargeter::OnShelfCreatedForRootWindow(
diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc index f20307a..43c9cf4 100644 --- a/ash/wm/panels/panel_layout_manager_unittest.cc +++ b/ash/wm/panels/panel_layout_manager_unittest.cc
@@ -311,8 +311,7 @@ std::vector<display::ManagedDisplayInfo> info_list; const int64_t internal_display_id = - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); // Create the primary display info. @@ -348,8 +347,7 @@ std::vector<display::ManagedDisplayInfo> info_list; const int64_t internal_display_id = - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); // Create the primary display info.
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc index 8031ac50..c67c5e0e 100644 --- a/ash/wm/power_button_controller.cc +++ b/ash/wm/power_button_controller.cc
@@ -43,13 +43,13 @@ tablet_controller_.reset( new TabletPowerButtonController(lock_state_controller_)); } - Shell::GetInstance()->display_configurator()->AddObserver(this); - Shell::GetInstance()->PrependPreTargetHandler(this); + Shell::Get()->display_configurator()->AddObserver(this); + Shell::Get()->PrependPreTargetHandler(this); } PowerButtonController::~PowerButtonController() { - Shell::GetInstance()->RemovePreTargetHandler(this); - Shell::GetInstance()->display_configurator()->RemoveObserver(this); + Shell::Get()->RemovePreTargetHandler(this); + Shell::Get()->display_configurator()->RemoveObserver(this); tablet_controller_.reset(); chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( this); @@ -87,7 +87,7 @@ // Take screenshot on power button down plus volume down when in touch view. if (should_take_screenshot) { - SystemTray* system_tray = Shell::GetInstance()->GetPrimarySystemTray(); + SystemTray* system_tray = Shell::Get()->GetPrimarySystemTray(); if (system_tray && system_tray->GetTrayAudio()) system_tray->GetTrayAudio()->HideDetailedView(false);
diff --git a/ash/wm/resize_shadow_and_cursor_unittest.cc b/ash/wm/resize_shadow_and_cursor_unittest.cc index 96cce7a..3bc725cf 100644 --- a/ash/wm/resize_shadow_and_cursor_unittest.cc +++ b/ash/wm/resize_shadow_and_cursor_unittest.cc
@@ -70,9 +70,8 @@ } const ResizeShadow* GetShadow() const { - return Shell::GetInstance() - ->resize_shadow_controller() - ->GetShadowForWindowForTest(window_); + return Shell::Get()->resize_shadow_controller()->GetShadowForWindowForTest( + window_); } // Returns the hit test code if there is a resize shadow. Returns HTNOWHERE if @@ -101,7 +100,7 @@ // Returns the current cursor type. int GetCurrentCursorType() const { - CursorManagerTestApi test_api(ash::Shell::GetInstance()->cursor_manager()); + CursorManagerTestApi test_api(ash::Shell::Get()->cursor_manager()); return test_api.GetCurrentCursor().native_type(); }
diff --git a/ash/wm/screen_pinning_controller.cc b/ash/wm/screen_pinning_controller.cc index 9aa1cad7..a6e1df1 100644 --- a/ash/wm/screen_pinning_controller.cc +++ b/ash/wm/screen_pinning_controller.cc
@@ -230,7 +230,7 @@ pinned_window_ = nullptr; } - Shell::GetInstance()->NotifyPinnedStateChanged(pinned_window); + Shell::Get()->NotifyPinnedStateChanged(pinned_window); } void ScreenPinningController::OnWindowAddedToPinnedContainer(
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index 41d43a9..9dcfd92 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc
@@ -23,7 +23,7 @@ if (event->type() == ui::ET_MOUSE_PRESSED && ui::GetTouchScreensAvailability() == ui::TouchScreensAvailability::ENABLED) { - Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_MOUSE_DOWN); + Shell::Get()->metrics()->RecordUserMetricsAction(UMA_MOUSE_DOWN); } }
diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 063cec1d..5b1a54c 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc
@@ -128,8 +128,7 @@ test::AshTestBase::SetUp(); // Enable brightness key. - display::test::DisplayManagerTestApi( - Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); }
diff --git a/ash/wm/video_detector.cc b/ash/wm/video_detector.cc index 6a7779c1..d7a5f72 100644 --- a/ash/wm/video_detector.cc +++ b/ash/wm/video_detector.cc
@@ -84,11 +84,11 @@ window_observer_manager_(this), is_shutting_down_(false) { aura::Env::GetInstance()->AddObserver(this); - Shell::GetInstance()->AddShellObserver(this); + Shell::Get()->AddShellObserver(this); } VideoDetector::~VideoDetector() { - Shell::GetInstance()->RemoveShellObserver(this); + Shell::Get()->RemoveShellObserver(this); aura::Env::GetInstance()->RemoveObserver(this); }
diff --git a/ash/wm/video_detector_unittest.cc b/ash/wm/video_detector_unittest.cc index 33a5c95..3343c06e 100644 --- a/ash/wm/video_detector_unittest.cc +++ b/ash/wm/video_detector_unittest.cc
@@ -70,7 +70,7 @@ void SetUp() override { AshTestBase::SetUp(); observer_.reset(new TestObserver); - detector_ = Shell::GetInstance()->video_detector(); + detector_ = Shell::Get()->video_detector(); detector_->AddObserver(observer_.get()); now_ = base::TimeTicks::Now(); @@ -198,7 +198,7 @@ TEST_F(VideoDetectorTest, DontReportDuringShutdown) { std::unique_ptr<aura::Window> window = CreateTestWindow(gfx::Rect(0, 0, 1024, 768)); - Shell::GetInstance()->OnAppTerminating(); + Shell::Get()->OnAppTerminating(); SendUpdates(window.get(), kMinRect, kMinFps + 5, 2 * kMinDuration); EXPECT_TRUE(observer_->empty()); }
diff --git a/ash/wm/window_cycle_event_filter_aura.cc b/ash/wm/window_cycle_event_filter_aura.cc index d77397a..4f2d0fd 100644 --- a/ash/wm/window_cycle_event_filter_aura.cc +++ b/ash/wm/window_cycle_event_filter_aura.cc
@@ -13,17 +13,17 @@ namespace ash { WindowCycleEventFilterAura::WindowCycleEventFilterAura() { - Shell::GetInstance()->AddPreTargetHandler(this); + Shell::Get()->AddPreTargetHandler(this); // Handling release of "Alt" must come before other pretarget handlers // (specifically, the partial screenshot handler). See crbug.com/651939 // We can't do all key event handling that early though because it prevents // other accelerators (like triggering a partial screenshot) from working. - Shell::GetInstance()->PrependPreTargetHandler(&alt_release_handler_); + Shell::Get()->PrependPreTargetHandler(&alt_release_handler_); } WindowCycleEventFilterAura::~WindowCycleEventFilterAura() { - Shell::GetInstance()->RemovePreTargetHandler(this); - Shell::GetInstance()->RemovePreTargetHandler(&alt_release_handler_); + Shell::Get()->RemovePreTargetHandler(this); + Shell::Get()->RemovePreTargetHandler(&alt_release_handler_); } void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 7d4936ca..4008f83 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc
@@ -643,7 +643,7 @@ std::unique_ptr<CustomEventHandler> f2(new CustomEventHandler); // Adds them to root window event filter. - ::wm::CompoundEventFilter* env_filter = Shell::GetInstance()->env_filter(); + ::wm::CompoundEventFilter* env_filter = Shell::Get()->env_filter(); env_filter->AddHandler(f1.get()); env_filter->AddHandler(f2.get()); @@ -712,8 +712,7 @@ return; ui::test::EventGenerator& generator = GetEventGenerator(); - ::wm::CursorManager* cursor_manager = - ash::Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = ash::Shell::Get()->cursor_manager(); generator.MoveMouseTo(gfx::Point(0, 0)); EXPECT_TRUE(cursor_manager->IsCursorVisible()); @@ -736,8 +735,7 @@ return; ui::test::EventGenerator& generator = GetEventGenerator(); - ::wm::CursorManager* cursor_manager = - ash::Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = ash::Shell::Get()->cursor_manager(); // Pressing a key hides the cursor but does not disable mouse events. generator.PressKey(ui::VKEY_A, ui::EF_NONE); @@ -761,7 +759,7 @@ return; ui::test::EventGenerator& generator = GetEventGenerator(); - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); ASSERT_TRUE(cursor_manager->IsCursorVisible()); @@ -786,8 +784,7 @@ return; ui::test::EventGenerator& generator = GetEventGenerator(); - ::wm::CursorManager* cursor_manager = - ash::Shell::GetInstance()->cursor_manager(); + ::wm::CursorManager* cursor_manager = ash::Shell::Get()->cursor_manager(); std::unique_ptr<aura::Window> w1( CreateTestWindowInShell(SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100)));
diff --git a/ash/wm/workspace/multi_window_resize_controller_unittest.cc b/ash/wm/workspace/multi_window_resize_controller_unittest.cc index 6fd0a13..f68d47baa 100644 --- a/ash/wm/workspace/multi_window_resize_controller_unittest.cc +++ b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
@@ -55,7 +55,7 @@ void SetUp() override { test::AshTestBase::SetUp(); WorkspaceController* wc = - test::ShellTestApi(Shell::GetInstance()).workspace_controller(); + test::ShellTestApi(Shell::Get()).workspace_controller(); WorkspaceEventHandler* event_handler = WorkspaceControllerTestHelper(wc).GetEventHandler(); resize_controller_ =
diff --git a/ash/wm/workspace/workspace_layout_manager_keyboard_unittest.cc b/ash/wm/workspace/workspace_layout_manager_keyboard_unittest.cc index d19b6718..8122f5f 100644 --- a/ash/wm/workspace/workspace_layout_manager_keyboard_unittest.cc +++ b/ash/wm/workspace/workspace_layout_manager_keyboard_unittest.cc
@@ -105,7 +105,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChangeWorkAreaInNonStickyMode) { keyboard::SetAccessibilityKeyboardEnabled(true); InitKeyboardBounds(); - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); keyboard::KeyboardController* kb_controller = keyboard::KeyboardController::GetInstance(); @@ -158,7 +158,7 @@ keyboard::SetAccessibilityKeyboardEnabled(true); InitKeyboardBounds(); - Shell::GetInstance()->CreateKeyboard(); + Shell::Get()->CreateKeyboard(); keyboard::KeyboardController* kb_controller = keyboard::KeyboardController::GetInstance();
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index 9953da1b..1ee01407 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -80,7 +80,7 @@ aura::Window* root = Shell::GetPrimaryRootWindow(); gfx::Rect root_bounds(root->bounds()); EXPECT_EQ(800, root_bounds.width()); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); window_.reset(new aura::Window(&delegate_)); window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); window_->Init(ui::LAYER_NOT_DRAWN); @@ -418,7 +418,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); window_->SetBounds(gfx::Rect(300, 100, 300, 200)); window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); @@ -504,7 +504,7 @@ window_->SetBounds(gfx::Rect(0, 300, 400, 300)); window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); - Shell* shell = Shell::GetInstance(); + Shell* shell = Shell::Get(); ui::test::EventGenerator generator(window_->GetRootWindow()); // The cursor should not be locked initially. @@ -782,8 +782,8 @@ // Makes sure we don't allow dragging below the work area. TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 10, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 10, 0)); ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays()); @@ -808,11 +808,11 @@ UpdateDisplay("800x600,800x600"); ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 10, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 10, 0)); // Positions the secondary display at the bottom the primary display. - Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( + Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), display::DisplayPlacement::BOTTOM, 0)); @@ -835,8 +835,8 @@ resizer->RevertDrag(); } - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 10, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 10, 0)); { window_->SetBounds(gfx::Rect(100, 200, 300, 400)); std::unique_ptr<WindowResizer> resizer( @@ -869,8 +869,8 @@ // Makes sure we don't allow dragging off the top of the work area. TEST_F(WorkspaceWindowResizerTest, DontDragOffTop) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(10, 0, 0, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(10, 0, 0, 0)); window_->SetBounds(gfx::Rect(100, 200, 300, 400)); std::unique_ptr<WindowResizer> resizer( @@ -881,8 +881,8 @@ } TEST_F(WorkspaceWindowResizerTest, ResizeBottomOutsideWorkArea) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); window_->SetBounds(gfx::Rect(100, 200, 300, 380)); std::unique_ptr<WindowResizer> resizer( @@ -893,8 +893,8 @@ } TEST_F(WorkspaceWindowResizerTest, ResizeWindowOutsideLeftWorkArea) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); int left = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).x(); int pixels_to_left_border = 50; int window_width = 300; @@ -910,8 +910,8 @@ } TEST_F(WorkspaceWindowResizerTest, ResizeWindowOutsideRightWorkArea) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); int right = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).right(); int pixels_to_right_border = 50; @@ -930,8 +930,8 @@ } TEST_F(WorkspaceWindowResizerTest, ResizeWindowOutsideBottomWorkArea) { - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); int bottom = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); int delta_to_bottom = 50; @@ -953,8 +953,8 @@ TEST_F(WorkspaceWindowResizerTest, DragWindowOutsideRightToSecondaryDisplay) { // Only primary display. Changes the window position to fit within the // display. - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); int right = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).right(); int pixels_to_right_border = 50; @@ -972,8 +972,8 @@ // With secondary display. Operation itself is same but doesn't change // the position because the window is still within the secondary display. UpdateDisplay("1000x600,600x400"); - Shell::GetInstance()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), - gfx::Insets(0, 0, 50, 0)); + Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(), + gfx::Insets(0, 0, 50, 0)); window_->SetBounds(gfx::Rect(window_x, 100, window_width, 380)); resizer->Drag(CalculateDragPoint(*resizer, window_width, 0), 0); EXPECT_EQ(base::IntToString(window_x + window_width) + ",100 " + @@ -1528,7 +1528,7 @@ TEST_F(WorkspaceWindowResizerTest, DontRewardRightmostWindowForOverflows) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1559,7 +1559,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExceedMaxWidth) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1588,7 +1588,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExceedMaxHeight) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1617,7 +1617,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExceedMinHeight) { UpdateDisplay("600x500"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1646,7 +1646,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExpandRightmostPastMaxWidth) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1672,7 +1672,7 @@ TEST_F(WorkspaceWindowResizerTest, MoveAttachedWhenGrownToMaxSize) { UpdateDisplay("600x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1699,7 +1699,7 @@ TEST_F(WorkspaceWindowResizerTest, MainWindowHonoursMaxWidth) { UpdateDisplay("400x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100)); @@ -1726,7 +1726,7 @@ TEST_F(WorkspaceWindowResizerTest, MainWindowHonoursMinWidth) { UpdateDisplay("400x800"); aura::Window* root = Shell::GetPrimaryRootWindow(); - Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); + Shell::Get()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. window_->SetBounds(gfx::Rect(100, 100, 100, 100));
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index 9011354e..70e99f7 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc
@@ -624,7 +624,7 @@ gfx::Insets insets = display::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); insets.Set(0, 0, insets.bottom() + 30, 0); - Shell::GetInstance()->SetDisplayWorkAreaInsets(w1.get(), insets); + Shell::Get()->SetDisplayWorkAreaInsets(w1.get(), insets); // Switch to w1. The window should have moved. wm::ActivateWindow(w1.get()); @@ -700,8 +700,7 @@ // Window with a transient parent. We set the transient parent to the root, // which would never happen but is enough to exercise the bug. std::unique_ptr<Window> w1(CreateTestWindowUnparented()); - ::wm::AddTransientChild(Shell::GetInstance()->GetPrimaryRootWindow(), - w1.get()); + ::wm::AddTransientChild(Shell::Get()->GetPrimaryRootWindow(), w1.get()); w1->SetBounds(gfx::Rect(10, 11, 250, 251)); ParentWindowInPrimaryRootWindow(w1.get()); w1->Show();
diff --git a/base/win/scoped_comptr.h b/base/win/scoped_comptr.h index 3d05a3b..ac704e0 100644 --- a/base/win/scoped_comptr.h +++ b/base/win/scoped_comptr.h
@@ -46,7 +46,7 @@ static_assert( sizeof(ScopedComPtr<Interface, interface_id>) == sizeof(Interface*), "ScopedComPtrSize"); - Release(); + Reset(); } Interface* get() const { return ptr_; } @@ -57,12 +57,14 @@ // ScopedComPtr instance. // Note that this function equates to IUnknown::Release and should not // be confused with e.g. unique_ptr::release(). - void Release() { + unsigned long Reset() { + unsigned long ref = 0; Interface* temp = ptr_; if (temp) { ptr_ = nullptr; - temp->Release(); + ref = temp->Release(); } + return ref; } // Sets the internal pointer to NULL and returns the held object without
diff --git a/base/win/scoped_comptr_unittest.cc b/base/win/scoped_comptr_unittest.cc index 18bdc4c..3cde314 100644 --- a/base/win/scoped_comptr_unittest.cc +++ b/base/win/scoped_comptr_unittest.cc
@@ -19,8 +19,8 @@ struct Dummy { Dummy() : adds(0), releases(0) { } - void AddRef() { ++adds; } - void Release() { ++releases; } + unsigned long AddRef() { return ++adds; } + unsigned long Release() { return ++releases; } int adds; int releases; @@ -51,7 +51,7 @@ ScopedComPtr<IUnknown> qi_test; EXPECT_HRESULT_SUCCEEDED(mem_alloc.QueryInterface(IID_PPV_ARGS(&qi_test))); EXPECT_TRUE(qi_test.get() != NULL); - qi_test.Release(); + qi_test.Reset(); // test ScopedComPtr& constructor ScopedComPtr<IMalloc> copy1(mem_alloc); @@ -63,7 +63,7 @@ copy1 = naked_copy; // Test the =(T*) operator. naked_copy->Release(); - copy1.Release(); + copy1.Reset(); EXPECT_FALSE(copy1.IsSameObject(unk2.get())); // unk2 is valid, copy1 is not // test Interface* constructor @@ -72,7 +72,7 @@ EXPECT_TRUE(SUCCEEDED(unk.QueryFrom(mem_alloc.get()))); EXPECT_TRUE(unk.get() != NULL); - unk.Release(); + unk.Reset(); EXPECT_TRUE(unk.get() == NULL); EXPECT_TRUE(unk.IsSameObject(copy1.get())); // both are NULL }
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc index f574809..856b00f 100644 --- a/base/win/shortcut.cc +++ b/base/win/shortcut.cc
@@ -29,14 +29,14 @@ const wchar_t* shortcut, ScopedComPtr<IShellLink>* i_shell_link, ScopedComPtr<IPersistFile>* i_persist_file) { - i_shell_link->Release(); - i_persist_file->Release(); + i_shell_link->Reset(); + i_persist_file->Reset(); if (FAILED(i_shell_link->CreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER)) || FAILED(i_persist_file->QueryFrom(i_shell_link->get())) || (shortcut && FAILED((*i_persist_file)->Load(shortcut, STGM_READWRITE)))) { - i_shell_link->Release(); - i_persist_file->Release(); + i_shell_link->Reset(); + i_persist_file->Reset(); } } @@ -158,15 +158,15 @@ // Release the interfaces to the old shortcut to make sure it doesn't prevent // overwriting it if needed. - old_i_persist_file.Release(); - old_i_shell_link.Release(); + old_i_persist_file.Reset(); + old_i_shell_link.Reset(); HRESULT result = i_persist_file->Save(shortcut_path.value().c_str(), TRUE); // Release the interfaces in case the SHChangeNotify call below depends on // the operations above being fully completed. - i_persist_file.Release(); - i_shell_link.Release(); + i_persist_file.Reset(); + i_shell_link.Reset(); // If we successfully created/updated the icon, notify the shell that we have // done so.
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py index 5261ff2..d01e36ee 100644 --- a/build/android/pylib/instrumentation/instrumentation_test_instance.py +++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -321,8 +321,8 @@ raise TestListPickleException( '%s newer than %s.' % (jar_path, pickle_path)) - with open(pickle_path, 'r') as pickle_file: - pickle_data = pickle.loads(pickle_file.read()) + with open(pickle_path, 'r') as f: + pickle_data = pickle.load(f) jar_md5 = md5sum.CalculateHostMd5Sums(jar_path)[jar_path] if pickle_data['VERSION'] != _PICKLE_FORMAT_VERSION:
diff --git a/build/android/pylib/local/device/local_device_perf_test_run.py b/build/android/pylib/local/device/local_device_perf_test_run.py index 19e2003..7e4538d 100644 --- a/build/android/pylib/local/device/local_device_perf_test_run.py +++ b/build/android/pylib/local/device/local_device_perf_test_run.py
@@ -206,10 +206,10 @@ pickled = os.path.join(constants.PERF_OUTPUT_DIR, result['name']) if os.path.exists(pickled): with file(pickled, 'r') as f: - previous = pickle.loads(f.read()) + previous = pickle.load(f) result['output'] = previous['output'] + result['output'] with file(pickled, 'w') as f: - f.write(pickle.dumps(result)) + pickle.dump(result, f) def _TestTearDown(self): if self._output_dir:
diff --git a/build/android/pylib/perf/perf_test_instance.py b/build/android/pylib/perf/perf_test_instance.py index c897f18..69ecf4c 100644 --- a/build/android/pylib/perf/perf_test_instance.py +++ b/build/android/pylib/perf/perf_test_instance.py
@@ -26,7 +26,7 @@ return None with file(file_name, 'r') as f: - return pickle.loads(f.read()) + return pickle.load(f) def _GetChromiumRevision():
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py index 89e7dca..77000b9 100755 --- a/build/android/resource_sizes.py +++ b/build/android/resource_sizes.py
@@ -299,6 +299,8 @@ None) def FindLargest(self): + if not self._zip_infos: + return None return max(self._zip_infos, key=lambda i: i.file_size) def ComputeZippedSize(self):
diff --git a/build/android/test_runner.pydeps b/build/android/test_runner.pydeps index 2bf69ff..31b3ef5 100644 --- a/build/android/test_runner.pydeps +++ b/build/android/test_runner.pydeps
@@ -47,7 +47,6 @@ ../../third_party/catapult/devil/devil/android/sdk/aapt.py ../../third_party/catapult/devil/devil/android/sdk/adb_wrapper.py ../../third_party/catapult/devil/devil/android/sdk/build_tools.py -../../third_party/catapult/devil/devil/android/sdk/gce_adb_wrapper.py ../../third_party/catapult/devil/devil/android/sdk/intent.py ../../third_party/catapult/devil/devil/android/sdk/keyevent.py ../../third_party/catapult/devil/devil/android/sdk/shared_prefs.py
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h index e7cf3c35..6ffdcce5 100644 --- a/cc/input/input_handler.h +++ b/cc/input/input_handler.h
@@ -113,7 +113,8 @@ // Binds a client to this handler to receive notifications. Only one client // can be bound to an InputHandler. The client must live at least until the // handler calls WillShutdown() on the client. - virtual void BindToClient(InputHandlerClient* client) = 0; + virtual void BindToClient(InputHandlerClient* client, + bool wheel_scroll_latching_enabled) = 0; // Selects a layer to be scrolled using the |scroll_state| start position. // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index b7bf08f..7adf840 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -240,8 +240,10 @@ is_likely_to_require_a_draw_(false), has_valid_compositor_frame_sink_(false), mutator_(nullptr), + scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId), has_scrolled_by_wheel_(false), - has_scrolled_by_touch_(false) { + has_scrolled_by_touch_(false), + touchpad_and_wheel_scroll_latching_enabled_(false) { DCHECK(mutator_host_); mutator_host_->SetMutatorHostClient(this); @@ -2542,9 +2544,11 @@ return active_tree_->CurrentBrowserControlsShownRatio(); } -void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { +void LayerTreeHostImpl::BindToClient(InputHandlerClient* client, + bool wheel_scroll_latching_enabled) { DCHECK(input_handler_client_ == NULL); input_handler_client_ = client; + touchpad_and_wheel_scroll_latching_enabled_ = wheel_scroll_latching_enabled; } InputHandler::ScrollStatus LayerTreeHostImpl::TryScroll( @@ -2869,8 +2873,8 @@ // this does not currently go through the scroll customization machinery // that ScrollBy uses for non-animated wheel scrolls. scroll_status = ScrollBegin(&scroll_state, WHEEL); - scroll_node = scroll_tree.CurrentlyScrollingNode(); if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { + scroll_animating_latched_node_id_ = ScrollTree::kInvalidNodeId; ScrollStateData scroll_state_end_data; scroll_state_end_data.is_ending = true; ScrollState scroll_state_end(scroll_state_end_data); @@ -2985,6 +2989,12 @@ if (!scroll_node->scrollable) continue; + if (touchpad_and_wheel_scroll_latching_enabled_ && + scroll_animating_latched_node_id_ != ScrollTree::kInvalidNodeId && + scroll_node->id != scroll_animating_latched_node_id_) { + continue; + } + bool scrolls_main_viewport_scroll_layer = viewport()->MainScrollLayer() && viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; @@ -3000,15 +3010,19 @@ viewport()->ScrollAnimated(pending_delta, delayed_by); // Viewport::ScrollAnimated returns pending_delta as long as it starts // an animation. - if (scrolled == pending_delta) + if (scrolled == pending_delta) { + scroll_animating_latched_node_id_ = scroll_node->id; return scroll_status; + } break; } gfx::Vector2dF scroll_delta = ComputeScrollDelta(scroll_node, pending_delta); - if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) + if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) { + scroll_animating_latched_node_id_ = scroll_node->id; return scroll_status; + } pending_delta -= scroll_delta; }
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index d5c54e5a..103a98c45 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -152,7 +152,8 @@ ~LayerTreeHostImpl() override; // InputHandler implementation - void BindToClient(InputHandlerClient* client) override; + void BindToClient(InputHandlerClient* client, + bool wheel_scroll_latching_enabled) override; InputHandler::ScrollStatus ScrollBegin( ScrollState* scroll_state, InputHandler::ScrollInputType type) override; @@ -853,6 +854,11 @@ std::unique_ptr<PendingTreeDurationHistogramTimer> pending_tree_duration_timer_; + // The id of the scroll node to which scroll animations must latch. + // This gets reset at ScrollAnimatedBegin, and updated the first time that a + // scroll animation is created in ScrollAnimated. + int scroll_animating_latched_node_id_; + // These callbacks are stored here to be transfered to the main thread when we // begin main frame. These callbacks must only be called on the main thread. std::vector<base::Closure> completed_image_decode_callbacks_; @@ -862,6 +868,8 @@ bool has_scrolled_by_wheel_; bool has_scrolled_by_touch_; + bool touchpad_and_wheel_scroll_latching_enabled_; + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); };
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 74ef1a4..5350b1a 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -552,6 +552,58 @@ } }; +class TestInputHandlerClient : public InputHandlerClient { + public: + TestInputHandlerClient() + : page_scale_factor_(0.f), + min_page_scale_factor_(-1.f), + max_page_scale_factor_(-1.f) {} + ~TestInputHandlerClient() override {} + + // InputHandlerClient implementation. + void WillShutdown() override {} + void Animate(base::TimeTicks time) override {} + void MainThreadHasStoppedFlinging() override {} + void ReconcileElasticOverscrollAndRootScroll() override {} + void UpdateRootLayerStateForSynchronousInputHandler( + const gfx::ScrollOffset& total_scroll_offset, + const gfx::ScrollOffset& max_scroll_offset, + const gfx::SizeF& scrollable_size, + float page_scale_factor, + float min_page_scale_factor, + float max_page_scale_factor) override { + DCHECK(total_scroll_offset.x() <= max_scroll_offset.x()); + DCHECK(total_scroll_offset.y() <= max_scroll_offset.y()); + last_set_scroll_offset_ = total_scroll_offset; + max_scroll_offset_ = max_scroll_offset; + scrollable_size_ = scrollable_size; + page_scale_factor_ = page_scale_factor; + min_page_scale_factor_ = min_page_scale_factor; + max_page_scale_factor_ = max_page_scale_factor; + } + void DeliverInputForBeginFrame() override {} + + gfx::ScrollOffset last_set_scroll_offset() { return last_set_scroll_offset_; } + + gfx::ScrollOffset max_scroll_offset() const { return max_scroll_offset_; } + + gfx::SizeF scrollable_size() const { return scrollable_size_; } + + float page_scale_factor() const { return page_scale_factor_; } + + float min_page_scale_factor() const { return min_page_scale_factor_; } + + float max_page_scale_factor() const { return max_page_scale_factor_; } + + private: + gfx::ScrollOffset last_set_scroll_offset_; + gfx::ScrollOffset max_scroll_offset_; + gfx::SizeF scrollable_size_; + float page_scale_factor_; + float min_page_scale_factor_; + float max_page_scale_factor_; +}; + TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { // Note: It is not possible to disable the renderer once it has been set, // so we do not need to test that disabling the renderer notifies us @@ -5456,6 +5508,106 @@ } } +TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedLatchToChild) { + // Enable wheel scroll latching flag. + TestInputHandlerClient input_handler_client; + host_impl_->BindToClient(&input_handler_client, true); + + // Scroll a child layer beyond its maximum scroll range and make sure the + // parent layer isn't scrolled. + gfx::Size surface_size(100, 100); + gfx::Size content_size(150, 150); + + LayerImpl* root = + CreateBasicVirtualViewportLayers(surface_size, surface_size); + root->test_properties()->force_render_surface = true; + + root->test_properties()->force_render_surface = true; + std::unique_ptr<LayerImpl> grand_child = + CreateScrollableLayer(13, content_size, root); + + std::unique_ptr<LayerImpl> child = + CreateScrollableLayer(12, content_size, root); + LayerImpl* grand_child_layer = grand_child.get(); + child->test_properties()->AddChild(std::move(grand_child)); + + LayerImpl* child_layer = child.get(); + root->test_properties()->AddChild(std::move(child)); + host_impl_->active_tree()->SetElementIdsForTesting(); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); + host_impl_->active_tree()->DidBecomeActive(); + + grand_child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), + gfx::ScrollOffset(0, 30)); + child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), + gfx::ScrollOffset(0, 50)); + + host_impl_->SetViewportSize(surface_size); + DrawFrame(); + + base::TimeTicks start_time = + base::TimeTicks() + base::TimeDelta::FromMilliseconds(10); + + BeginFrameArgs begin_frame_args = + CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); + + EXPECT_EQ( + InputHandler::SCROLL_ON_IMPL_THREAD, + host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, -100)).thread); + + begin_frame_args.frame_time = start_time; + begin_frame_args.sequence_number++; + host_impl_->WillBeginImplFrame(begin_frame_args); + host_impl_->Animate(); + host_impl_->UpdateAnimationState(true); + + EXPECT_EQ(gfx::ScrollOffset(0, 30), grand_child_layer->CurrentScrollOffset()); + host_impl_->DidFinishImplFrame(); + + begin_frame_args.frame_time = + start_time + base::TimeDelta::FromMilliseconds(200); + begin_frame_args.sequence_number++; + host_impl_->WillBeginImplFrame(begin_frame_args); + host_impl_->Animate(); + host_impl_->UpdateAnimationState(true); + + EXPECT_EQ(gfx::ScrollOffset(0, 0), grand_child_layer->CurrentScrollOffset()); + EXPECT_EQ(gfx::ScrollOffset(0, 50), child_layer->CurrentScrollOffset()); + host_impl_->DidFinishImplFrame(); + + // Second ScrollAnimated should still latch to the grand_child_layer. + EXPECT_EQ( + InputHandler::SCROLL_ON_IMPL_THREAD, + host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, -100)).thread); + + begin_frame_args.frame_time = + start_time + base::TimeDelta::FromMilliseconds(250); + begin_frame_args.sequence_number++; + host_impl_->WillBeginImplFrame(begin_frame_args); + host_impl_->Animate(); + host_impl_->UpdateAnimationState(true); + host_impl_->DidFinishImplFrame(); + + begin_frame_args.frame_time = + start_time + base::TimeDelta::FromMilliseconds(450); + begin_frame_args.sequence_number++; + host_impl_->WillBeginImplFrame(begin_frame_args); + host_impl_->Animate(); + host_impl_->UpdateAnimationState(true); + + EXPECT_EQ(gfx::ScrollOffset(0, 0), grand_child_layer->CurrentScrollOffset()); + EXPECT_EQ(gfx::ScrollOffset(0, 50), child_layer->CurrentScrollOffset()); + host_impl_->DidFinishImplFrame(); + + // Tear down the LayerTreeHostImpl before the InputHandlerClient. + host_impl_->ReleaseCompositorFrameSink(); + host_impl_ = nullptr; +} + TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { // Scroll a child layer beyond its maximum scroll range and make sure the // the scroll doesn't bubble up to the parent layer. @@ -6001,58 +6153,6 @@ inner_viewport_scroll_layer->MaxScrollOffset()); } -class TestInputHandlerClient : public InputHandlerClient { - public: - TestInputHandlerClient() - : page_scale_factor_(0.f), - min_page_scale_factor_(-1.f), - max_page_scale_factor_(-1.f) {} - ~TestInputHandlerClient() override {} - - // InputHandlerClient implementation. - void WillShutdown() override {} - void Animate(base::TimeTicks time) override {} - void MainThreadHasStoppedFlinging() override {} - void ReconcileElasticOverscrollAndRootScroll() override {} - void UpdateRootLayerStateForSynchronousInputHandler( - const gfx::ScrollOffset& total_scroll_offset, - const gfx::ScrollOffset& max_scroll_offset, - const gfx::SizeF& scrollable_size, - float page_scale_factor, - float min_page_scale_factor, - float max_page_scale_factor) override { - DCHECK(total_scroll_offset.x() <= max_scroll_offset.x()); - DCHECK(total_scroll_offset.y() <= max_scroll_offset.y()); - last_set_scroll_offset_ = total_scroll_offset; - max_scroll_offset_ = max_scroll_offset; - scrollable_size_ = scrollable_size; - page_scale_factor_ = page_scale_factor; - min_page_scale_factor_ = min_page_scale_factor; - max_page_scale_factor_ = max_page_scale_factor; - } - void DeliverInputForBeginFrame() override {} - - gfx::ScrollOffset last_set_scroll_offset() { return last_set_scroll_offset_; } - - gfx::ScrollOffset max_scroll_offset() const { return max_scroll_offset_; } - - gfx::SizeF scrollable_size() const { return scrollable_size_; } - - float page_scale_factor() const { return page_scale_factor_; } - - float min_page_scale_factor() const { return min_page_scale_factor_; } - - float max_page_scale_factor() const { return max_page_scale_factor_; } - - private: - gfx::ScrollOffset last_set_scroll_offset_; - gfx::ScrollOffset max_scroll_offset_; - gfx::SizeF scrollable_size_; - float page_scale_factor_; - float min_page_scale_factor_; - float max_page_scale_factor_; -}; - TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { TestInputHandlerClient scroll_watcher; host_impl_->SetViewportSize(gfx::Size(10, 20)); @@ -6062,7 +6162,7 @@ clip_layer->SetBounds(gfx::Size(10, 20)); host_impl_->active_tree()->BuildPropertyTreesForTesting(); - host_impl_->BindToClient(&scroll_watcher); + host_impl_->BindToClient(&scroll_watcher, false); gfx::Vector2dF initial_scroll_delta(10.f, 10.f); scroll_layer->layer_tree_impl()
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 807fd80..ed31a02 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -1319,7 +1319,7 @@ void BindInputHandlerOnCompositorThread( const base::WeakPtr<InputHandler>& input_handler, ThreadCheckingInputHandlerClient* client) { - input_handler->BindToClient(client); + input_handler->BindToClient(client, false); } TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { @@ -1876,7 +1876,7 @@ void BindInputHandler(base::WeakPtr<InputHandler> input_handler) { DCHECK(task_runner_provider()->IsImplThread()); - input_handler->BindToClient(&input_handler_client_); + input_handler->BindToClient(&input_handler_client_, false); scroll_elasticity_helper_ = input_handler->CreateScrollElasticityHelper(); DCHECK(scroll_elasticity_helper_); }
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index fad74112a..3dd8150 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -487,20 +487,18 @@ } } - if (enable_xpc_notifications) { - bundle_data("chrome_framework_services") { - sources = [ - "$root_out_dir/AlertNotificationService.xpc", - ] + bundle_data("chrome_framework_services") { + sources = [ + "$root_out_dir/AlertNotificationService.xpc", + ] - outputs = [ - "{{bundle_root_dir}}/XPCServices/{{source_file_part}}", - ] + outputs = [ + "{{bundle_root_dir}}/XPCServices/{{source_file_part}}", + ] - public_deps = [ - "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", - ] - } + public_deps = [ + "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", + ] } tweak_info_plist("chrome_app_plist") { @@ -1103,6 +1101,7 @@ framework_contents = [ "Helpers", "Resources", + "XPCServices", ] if (is_chrome_branded) { @@ -1117,9 +1116,6 @@ if (_should_bundle_widevine) { framework_contents += [ "Libraries" ] } - if (enable_xpc_notifications) { - framework_contents += [ "XPCServices" ] - } } configs += [ "//build/config/compiler:wexit_time_destructors" ] @@ -1138,6 +1134,7 @@ ":chrome_framework_helpers", ":chrome_framework_plugins", ":chrome_framework_resources", + ":chrome_framework_services", ":packed_resources", ":widevine_cdm_library", "//build/config/sanitizers:deps", @@ -1148,10 +1145,6 @@ deps += [ ":default_apps" ] } - if (enable_xpc_notifications) { - deps += [ ":chrome_framework_services" ] - } - ldflags = [ "-Wl,-install_name,@executable_path/../Versions/$chrome_version_full/$chrome_framework_name.framework/$chrome_framework_name", "-compatibility_version", @@ -1227,15 +1220,12 @@ # the list of _dsyms in :chrome_dsym_archive. _chrome_symbols_sources = [ _framework_binary_path, + "$root_out_dir/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService", "$root_out_dir/$chrome_helper_name.app/Contents/MacOS/$chrome_helper_name", "$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name", "$root_out_dir/crashpad_handler", ] - if (enable_xpc_notifications) { - _chrome_symbols_sources += [ "$root_out_dir/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService" ] - } - # It is possible to run dump_syms on unstripped products without dSYMs, # but doing so isn't logical and won't happen in practice. action_foreach("chrome_dump_syms") { @@ -1262,12 +1252,9 @@ ":chrome_framework", ":chrome_helper_app", "//breakpad:dump_syms", + "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", "//third_party/crashpad/crashpad/handler:crashpad_handler", ] - - if (enable_xpc_notifications) { - deps += [ "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service" ] - } } action("chrome_dsym_archive") { @@ -1278,16 +1265,13 @@ # directory it cannot be listed as a source file). The targets that # generate both the dSYM and binary image are listed in deps. _dsyms = [ + "$root_out_dir/AlertNotificationService.dSYM", "$root_out_dir/$chrome_framework_name.dSYM", "$root_out_dir/$chrome_helper_name.dSYM", "$root_out_dir/$chrome_product_full_name.dSYM", "$root_out_dir/crashpad_handler.dSYM", ] - if (enable_xpc_notifications) { - _dsyms += [ "$root_out_dir/AlertNotificationService.dSYM" ] - } - sources = _chrome_symbols_sources _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2" @@ -1303,12 +1287,9 @@ ":chrome_app", ":chrome_framework", ":chrome_helper_app", + "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", "//third_party/crashpad/crashpad/handler:crashpad_handler", ] - - if (enable_xpc_notifications) { - deps += [ "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service" ] - } } } else { group("chrome_dump_syms") {
diff --git a/chrome/android/java/res/drawable/selectable_item_highlight.xml b/chrome/android/java/res/drawable/selectable_item_highlight.xml index 0ba396f..60b8cde0 100644 --- a/chrome/android/java/res/drawable/selectable_item_highlight.xml +++ b/chrome/android/java/res/drawable/selectable_item_highlight.xml
@@ -6,4 +6,4 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@color/selectable_list_item_highlight_color" /> -</selector> \ No newline at end of file +</selector>
diff --git a/chrome/android/java/res/layout/number_roll_view.xml b/chrome/android/java/res/layout/number_roll_view.xml index 91069d5..03dba8f 100644 --- a/chrome/android/java/res/layout/number_roll_view.xml +++ b/chrome/android/java/res/layout/number_roll_view.xml
@@ -27,4 +27,4 @@ android:singleLine="true" android:textColor="@android:color/white" android:textSize="20sp" /> -</org.chromium.chrome.browser.widget.NumberRollView> \ No newline at end of file +</org.chromium.chrome.browser.widget.NumberRollView>
diff --git a/chrome/android/java/res/layout/search_toolbar.xml b/chrome/android/java/res/layout/search_toolbar.xml index 0e4bd63..d4f4b466 100644 --- a/chrome/android/java/res/layout/search_toolbar.xml +++ b/chrome/android/java/res/layout/search_toolbar.xml
@@ -36,5 +36,4 @@ android:contentDescription="@string/accessibility_toolbar_btn_delete_url" android:visibility="invisible" chrome:tint="@color/dark_mode_tint" /> - -</LinearLayout> \ No newline at end of file +</LinearLayout>
diff --git a/chrome/android/java/res/layout/selectable_item_highlight_view.xml b/chrome/android/java/res/layout/selectable_item_highlight_view.xml index 242c2a3..2295c4a3 100644 --- a/chrome/android/java/res/layout/selectable_item_highlight_view.xml +++ b/chrome/android/java/res/layout/selectable_item_highlight_view.xml
@@ -7,4 +7,4 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/highlight" android:layout_width="match_parent" - android:layout_height="match_parent" /> \ No newline at end of file + android:layout_height="match_parent" />
diff --git a/chrome/android/java/res/layout/selectable_list_layout.xml b/chrome/android/java/res/layout/selectable_list_layout.xml index 47f9b9d..55eef22 100644 --- a/chrome/android/java/res/layout/selectable_list_layout.xml +++ b/chrome/android/java/res/layout/selectable_list_layout.xml
@@ -38,7 +38,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> - </FrameLayout> + </FrameLayout> <org.chromium.chrome.browser.widget.FadingShadowView android:id="@+id/shadow" @@ -46,4 +46,4 @@ android:layout_height="@dimen/action_bar_shadow_height" android:layout_marginTop="?attr/actionBarSize" /> -</merge> \ No newline at end of file +</merge>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java index 8c35b9677..39be015 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -558,19 +558,11 @@ } @CalledByNative - private boolean exitWebVR() { + private boolean exitWebVRPresent() { if (!mInVr) return false; mVrShell.setWebVrModeEnabled(false); - if (mVrSupportLevel == VR_CARDBOARD) { - // Transition screen is not available for Cardboard only (non-Daydream) devices. - // TODO(bshe): Fix this once b/33490788 is fixed. - shutdownVR(false /* isPausing */, false /* showTransition */); - } else { - // TODO(bajones): Once VR Shell can be invoked outside of WebVR this - // should no longer exit the shell outright. Need a way to determine - // how VrShell was created. - shutdownVR( - false /* isPausing */, !isVrShellEnabled(mVrSupportLevel) /* showTransition */); + if (!isVrShellEnabled(mVrSupportLevel)) { + shutdownVR(false /* isPausing */, true /* showTransition */); } return true; } @@ -692,6 +684,8 @@ if (!mInVr) return; mInVr = false; mRequestedWebVR = false; + // Transition screen is not available for Cardboard only (non-Daydream) devices. + // TODO(bshe): Fix this once b/33490788 is fixed. boolean transition = mVrSupportLevel == VR_DAYDREAM && showTransition; if (!isPausing) { if (!transition || !mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent())) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java index 2be764a..9e4877e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
@@ -726,8 +726,8 @@ } }); - mSettleAnimator.start(); setInternalCurrentState(SHEET_STATE_SCROLLING); + mSettleAnimator.start(); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java index ec07ca4..01021fc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java
@@ -4,17 +4,12 @@ package org.chromium.chrome.browser.contextualsearch; -import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; - import android.content.Context; import android.net.Uri; -import android.support.test.filters.SmallTest; import android.widget.LinearLayout; import org.chromium.base.ThreadUtils; -import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.Restriction; -import org.chromium.base.test.util.RetryOnFailure; +import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManagerWrapper; @@ -251,11 +246,13 @@ /** * Tests that a Tap gesture followed by tapping empty space closes the panel. + * + * Disabled because of flakiness. See crbug.com/706663 */ - @SmallTest - @Feature({"ContextualSearch"}) - @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) - @RetryOnFailure + //@SmallTest + //@Feature({"ContextualSearch"}) + //@Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) + @DisabledTest public void testTextTapFollowedByNonTextTap() { assertTrue(mPanelManager.getRequestPanelShowCount() == 0);
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6b38b38..ade7ac6 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -12255,6 +12255,9 @@ <message name="IDS_VR_SHELL_UI_RELOAD_BUTTON" desc="Text under the VR scene reload page button"> Reload </message> + <message name="IDS_VR_SHELL_UI_EXIT_PRESENT_BUTTON" desc="Text under the VR scene exit present button"> + Exit Presentation + </message> <message name="IDS_VR_SHELL_NEW_TAB_BUTTON" desc="Text on the VR scene new tab button"> New Tab </message> @@ -12291,9 +12294,6 @@ Load full site </message> </if> - <message name="IDS_FILTERED_DECEPTIVE_CONTENT_RELOAD_ACTION" desc="Button which reloads the page after a toggle is checked which prompts the user to reload."> - Reload - </message> <if expr="use_titlecase"> <message name="IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE" desc="In Title Case: title of the prompt which is shown to inform the user when Chrome blocks some potentially deceptive content on the site. This happens as an additional layer of protection when users proceed through the Safe Browsing interstitial to view the site regardless."> Content Blocked
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index f0d38d6..d3f7c7c 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -2596,8 +2596,8 @@ <message name="IDS_SETTINGS_USERS_RESTRICT_SIGNIN_LABEL" desc="Label for the setting for restricting sign in to specific users."> Restrict sign-in to the following users: </message> - <message name="IDS_SETTINGS_USERS_DEVICE_OWNER_LABEL" desc="Label for the device owner."> - (owner) + <message name="IDS_SETTINGS_USERS_DEVICE_OWNER_LABEL" desc="Label for a user who is the device owner."> + <ph name="USER_NAME">$1<ex>John Smith</ex></ph> (owner) </message> <message name="IDS_SETTINGS_USERS_ADD_USERS" desc="Label the dialog for adding users."> Add person
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 3e5e15d6..124efb6a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2079,6 +2079,11 @@ flag_descriptions::kEnableContentSuggestionsNewFaviconServerDescription, kOsAndroid, FEATURE_VALUE_TYPE(ntp_snippets::kPublisherFaviconsFromNewServerFeature)}, + {"enable-content-suggestions-settings", + flag_descriptions::kEnableContentSuggestionsSettingsName, + flag_descriptions::kEnableContentSuggestionsSettingsDescription, + kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kContentSuggestionsSettings)}, {"enable-ntp-remote-suggestions", flag_descriptions::kEnableNtpRemoteSuggestionsName, flag_descriptions::kEnableNtpRemoteSuggestionsDescription, kOsAndroid,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index dbe98dfd2..84da95b 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -123,7 +123,7 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kContentSuggestionsSettings{ - "ContentSuggestionsSettings", base::FEATURE_ENABLED_BY_DEFAULT}; + "ContentSuggestionsSettings", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kContextualSearchSingleActions{ "ContextualSearchSingleActions", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc index 5878c72..f4547ff 100644 --- a/chrome/browser/android/vr_shell/vr_shell.cc +++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -386,6 +386,13 @@ device_id)); } +void VrShell::SetSubmitClient( + device::mojom::VRSubmitFrameClientPtr submit_client) { + PostToGlThreadWhenReady( + base::Bind(&VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(), + base::Passed(submit_client.PassInterface()))); +} + base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( JNIEnv* env, const JavaParamRef<jobject>& obj) { @@ -420,10 +427,6 @@ } void VrShell::GvrDelegateReady() { - PostToGlThreadWhenReady(base::Bind( - &VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(), - base::Passed( - delegate_provider_->TakeSubmitFrameClient().PassInterface()))); delegate_provider_->SetPresentingDelegate(this, gvr_api_); } @@ -501,6 +504,9 @@ ui_input_manager_->GenerateKeyboardEvent(char_value, modifiers); return; } + case EXIT_PRESENT: + delegate_provider_->ExitWebVRPresent(); + return; #if defined(ENABLE_VR_SHELL_UI_DEV) case RELOAD_UI: ui_contents_->GetController().Reload(content::ReloadType::NORMAL, false);
diff --git a/chrome/browser/android/vr_shell/vr_shell.h b/chrome/browser/android/vr_shell/vr_shell.h index 2ece266..bf668d5 100644 --- a/chrome/browser/android/vr_shell/vr_shell.h +++ b/chrome/browser/android/vr_shell/vr_shell.h
@@ -67,6 +67,7 @@ SHOW_TAB, OPEN_NEW_TAB, KEY_EVENT, + EXIT_PRESENT, }; class VrMetricsHelper; @@ -196,7 +197,7 @@ void MainFrameWasResized(bool width_changed) override; void WebContentsDestroyed() override; - // device::GvrDelegate implementation + // device::GvrDelegate implementation. void SetWebVRSecureOrigin(bool secure_origin) override; void SubmitWebVRFrame(int16_t frame_index, const gpu::MailboxHolder& mailbox) override; @@ -212,6 +213,10 @@ const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, uint32_t device_id) override; + // device::PresentingGvrDelegate implementation. + void SetSubmitClient( + device::mojom::VRSubmitFrameClientPtr submit_client) override; + void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); bool vr_shell_enabled_;
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc index 6257853b..297168d 100644 --- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc +++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/android/jni_android.h" +#include "base/callback_helpers.h" #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" #include "device/vr/android/gvr/gvr_delegate.h" #include "device/vr/android/gvr/gvr_device.h" @@ -29,6 +30,9 @@ device_provider_->Device()->OnExitPresent(); device_provider_->Device()->OnDelegateChanged(); } + if (!present_callback_.is_null()) { + base::ResetAndReturn(&present_callback_).Run(false); + } } device::GvrDelegateProvider* VrShellDelegate::CreateVrShellDelegate() { @@ -63,6 +67,12 @@ } presenting_delegate_->UpdateVSyncInterval(timebase_nanos_, interval_seconds_); + + if (pending_successful_present_request_) { + presenting_delegate_->SetSubmitClient(std::move(submit_client_)); + base::ResetAndReturn(&present_callback_).Run(true); + pending_successful_present_request_ = false; + } } void VrShellDelegate::RemoveDelegate() { @@ -76,10 +86,21 @@ void VrShellDelegate::SetPresentResult(JNIEnv* env, const JavaParamRef<jobject>& obj, - jboolean result) { + jboolean success) { CHECK(!present_callback_.is_null()); - present_callback_.Run(result); - present_callback_.Reset(); + if (success && !presenting_delegate_) { + // We have to wait until the GL thread is ready since we have to pass it + // the VRSubmitFrameClient. + pending_successful_present_request_ = true; + return; + } + + if (success) { + presenting_delegate_->SetSubmitClient(std::move(submit_client_)); + } + + base::ResetAndReturn(&present_callback_).Run(success); + pending_successful_present_request_ = false; } void VrShellDelegate::DisplayActivate(JNIEnv* env, @@ -122,10 +143,6 @@ delete this; } -device::mojom::VRSubmitFrameClientPtr VrShellDelegate::TakeSubmitFrameClient() { - return std::move(submit_client_); -} - void VrShellDelegate::SetDeviceProvider( device::GvrDeviceProvider* device_provider) { if (device_provider_ == device_provider) @@ -170,7 +187,9 @@ // VRShell is no longer needed by WebVR, allow it to shut down if it's not // being used elsewhere. JNIEnv* env = AttachCurrentThread(); - Java_VrShellDelegate_exitWebVR(env, j_vr_shell_delegate_.obj()); + if (Java_VrShellDelegate_exitWebVRPresent(env, j_vr_shell_delegate_.obj())) { + device_provider_->Device()->OnExitPresent(); + } } void VrShellDelegate::CreateNonPresentingDelegate() {
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.h b/chrome/browser/android/vr_shell/vr_shell_delegate.h index e58ded2..fc09693f 100644 --- a/chrome/browser/android/vr_shell/vr_shell_delegate.h +++ b/chrome/browser/android/vr_shell/vr_shell_delegate.h
@@ -41,7 +41,7 @@ void SetPresentResult(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, - jboolean result); + jboolean success); void DisplayActivate(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); void UpdateVSyncInterval(JNIEnv* env, @@ -51,17 +51,18 @@ void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); - device::mojom::VRSubmitFrameClientPtr TakeSubmitFrameClient(); device::GvrDeviceProvider* device_provider() { return device_provider_; } + // device::GvrDelegateProvider implementation. + void ExitWebVRPresent() override; + private: - // device::GvrDelegateProvider implementation + // device::GvrDelegateProvider implementation. void SetDeviceProvider(device::GvrDeviceProvider* device_provider) override; void ClearDeviceProvider() override; void RequestWebVRPresent(device::mojom::VRSubmitFrameClientPtr submit_client, const base::Callback<void(bool)>& callback) override; - void ExitWebVRPresent() override; device::GvrDelegate* GetDelegate() override; void SetListeningForActivate(bool listening) override; @@ -75,6 +76,7 @@ int64_t timebase_nanos_ = 0; double interval_seconds_ = 0; device::mojom::VRSubmitFrameClientPtr submit_client_; + bool pending_successful_present_request_ = false; DISALLOW_COPY_AND_ASSIGN(VrShellDelegate); };
diff --git a/chrome/browser/background/OWNERS b/chrome/browser/background/OWNERS index 3e63b462..6c3424e 100644 --- a/chrome/browser/background/OWNERS +++ b/chrome/browser/background/OWNERS
@@ -1 +1,3 @@ atwilson@chromium.org + +# COMPONENT: Platform>Apps>BackgroundPage
diff --git a/chrome/browser/browsing_data/browsing_data_remover_delegate.h b/chrome/browser/browsing_data/browsing_data_remover_delegate.h index 69600a8..4483fd7 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/browsing_data_remover_delegate.h
@@ -23,15 +23,21 @@ class BrowsingDataRemoverDelegate { public: + // Determines whether |origin| matches |origin_type_mask| given + // the |special_storage_policy|. + typedef base::Callback<bool(int origin_type_mask, + const GURL& origin, + storage::SpecialStoragePolicy* policy)> + EmbedderOriginTypeMatcher; + virtual ~BrowsingDataRemoverDelegate() {} - // Determines whether |origin| matches |origin_type_mask| - // given the |special_storage_policy|. |origin_type_mask| should only contain - // embedder-specific datatypes. - virtual bool DoesOriginMatchEmbedderMask( - int origin_type_mask, - const GURL& origin, - storage::SpecialStoragePolicy* special_storage_policy) const = 0; + // Returns a MaskMatcherFunction to match embedder's origin types. + // This MaskMatcherFunction will be called with an |origin_type_mask| + // parameter containing ONLY embedder-defined origin types, and must be able + // to handle ALL embedder-defined typed. It must be static and support + // being called on the UI and IO thread. + virtual EmbedderOriginTypeMatcher GetOriginTypeMatcher() const = 0; // Removes embedder-specific data. virtual void RemoveEmbedderData(
diff --git a/chrome/browser/browsing_data/browsing_data_remover_impl.cc b/chrome/browser/browsing_data/browsing_data_remover_impl.cc index b157897..68de911c 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_impl.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_impl.cc
@@ -60,23 +60,50 @@ return base::Bind(&IgnoreArgumentHelper<T>, callback); } -bool DoesOriginMatchMaskAndUrls( - const base::WeakPtr<BrowsingDataRemoverImpl>& remover_weak_ptr, +// Returns whether |origin| matches |origin_type_mask| given the special +// storage |policy|; and if |predicate| is not null, then also whether +// it matches |predicate|. If |origin_type_mask| contains embedder-specific +// datatypes, |embedder_matcher| must not be null; the decision for those +// datatypes will be delegated to it. +bool DoesOriginMatchMaskAndURLs( int origin_type_mask, const base::Callback<bool(const GURL&)>& predicate, + const BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher& + embedder_matcher, const GURL& origin, - storage::SpecialStoragePolicy* special_storage_policy) { - // If BrowsingDataRemoverImpl is null, it is not possible to determine which - // origins should have their data deleted, and so we do not delete - // anything. This is not a problem, because this can only happen shortly - // before shutdown and thus the deletion would likely not be able to - // finish anyway. - if (!remover_weak_ptr) + storage::SpecialStoragePolicy* policy) { + if (!predicate.is_null() && !predicate.Run(origin)) return false; - return predicate.Run(origin) && - remover_weak_ptr->DoesOriginMatchMask(origin_type_mask, origin, - special_storage_policy); + const std::vector<std::string>& schemes = url::GetWebStorageSchemes(); + bool is_web_scheme = + (std::find(schemes.begin(), schemes.end(), origin.GetOrigin().scheme()) != + schemes.end()); + + // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB. + if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) && + is_web_scheme && + (origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB)) { + return true; + } + origin_type_mask &= ~BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB; + + // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. + if (policy && policy->IsStorageProtected(origin.GetOrigin()) && + is_web_scheme && + (origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB)) { + return true; + } + origin_type_mask &= ~BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB; + + DCHECK(embedder_matcher || !origin_type_mask) + << "The mask contains embedder-defined origin types, but there is no " + << "embedder delegate matcher to process them."; + + if (!embedder_matcher.is_null()) + return embedder_matcher.Run(origin_type_mask, origin, policy); + + return false; } void ClearHttpAuthCacheOnIOThread( @@ -213,35 +240,13 @@ int origin_type_mask, const GURL& origin, storage::SpecialStoragePolicy* policy) const { - const std::vector<std::string>& schemes = url::GetWebStorageSchemes(); - bool is_web_scheme = - (std::find(schemes.begin(), schemes.end(), origin.GetOrigin().scheme()) != - schemes.end()); + BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher embedder_matcher; + if (embedder_delegate_) + embedder_matcher = embedder_delegate_->GetOriginTypeMatcher(); - // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB. - if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) && - is_web_scheme && (origin_type_mask & ORIGIN_TYPE_UNPROTECTED_WEB)) { - return true; - } - origin_type_mask &= ~ORIGIN_TYPE_UNPROTECTED_WEB; - - // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. - if (policy && policy->IsStorageProtected(origin.GetOrigin()) && - is_web_scheme && (origin_type_mask & ORIGIN_TYPE_PROTECTED_WEB)) { - return true; - } - origin_type_mask &= ~ORIGIN_TYPE_PROTECTED_WEB; - - DCHECK(embedder_delegate_ || !origin_type_mask) - << "The mask contains embedder-defined origin types, but there is no " - << "embedder delegate to process them."; - - if (embedder_delegate_) { - return embedder_delegate_->DoesOriginMatchEmbedderMask(origin_type_mask, - origin, policy); - } - - return false; + return DoesOriginMatchMaskAndURLs(origin_type_mask, + base::Callback<bool(const GURL&)>(), + embedder_matcher, origin, policy); } void BrowsingDataRemoverImpl::Remove(const base::Time& delete_begin, @@ -501,10 +506,14 @@ cookie_matcher = filter_builder.BuildCookieFilter(); } + BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher embedder_matcher; + if (embedder_delegate_) + embedder_matcher = embedder_delegate_->GetOriginTypeMatcher(); + storage_partition->ClearData( storage_partition_remove_mask, quota_storage_remove_mask, - base::Bind(&DoesOriginMatchMaskAndUrls, weak_ptr_factory_.GetWeakPtr(), - origin_type_mask_, filter), + base::Bind(&DoesOriginMatchMaskAndURLs, origin_type_mask_, filter, + embedder_matcher), cookie_matcher, delete_begin_, delete_end_, clear_storage_partition_data_.GetCompletionCallback()); } @@ -647,8 +656,7 @@ // are scheduled. BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&BrowsingDataRemoverImpl::RunNextTask, - weak_ptr_factory_.GetWeakPtr())); + base::Bind(&BrowsingDataRemoverImpl::RunNextTask, GetWeakPtr())); } void BrowsingDataRemoverImpl::NotifyIfDone() { @@ -661,10 +669,21 @@ if (completion_inhibitor_) { completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( - this, base::Bind(&BrowsingDataRemoverImpl::Notify, - weak_ptr_factory_.GetWeakPtr())); + this, base::Bind(&BrowsingDataRemoverImpl::Notify, GetWeakPtr())); return; } Notify(); } + +base::WeakPtr<BrowsingDataRemoverImpl> BrowsingDataRemoverImpl::GetWeakPtr() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + base::WeakPtr<BrowsingDataRemoverImpl> weak_ptr = + weak_ptr_factory_.GetWeakPtr(); + + // Immediately bind the weak pointer to the UI thread. This makes it easier + // to discover potential misuse on the IO thread. + weak_ptr.get(); + + return weak_ptr; +}
diff --git a/chrome/browser/browsing_data/browsing_data_remover_impl.h b/chrome/browser/browsing_data/browsing_data_remover_impl.h index 9889aea0..41281c14 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_impl.h +++ b/chrome/browser/browsing_data/browsing_data_remover_impl.h
@@ -205,6 +205,9 @@ // Returns true if we're all done. bool AllDone(); + // Retrieve a UI thread-bound weak pointer to this BrowsingDataRemoverImpl. + base::WeakPtr<BrowsingDataRemoverImpl> GetWeakPtr(); + // The browser context we're to remove from. content::BrowserContext* browser_context_;
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index 8397636..0cf44b96 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -236,6 +236,33 @@ http_session->CloseAllConnections(); } +// Returned by ChromeBrowsingDataRemoverDelegate::GetOriginTypeMatcher(). +bool DoesOriginMatchEmbedderMask(int origin_type_mask, + const GURL& origin, + storage::SpecialStoragePolicy* policy) { + DCHECK_EQ( + 0, + origin_type_mask & + (ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EMBEDDER_BEGIN - 1)) + << "|origin_type_mask| can only contain origin types defined in " + << "the embedder."; + +#if BUILDFLAG(ENABLE_EXTENSIONS) + // Packaged apps and extensions match iff EXTENSION. + if ((origin.GetOrigin().scheme() == extensions::kExtensionScheme) && + (origin_type_mask & + ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EXTENSION)) { + return true; + } + origin_type_mask &= ~ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EXTENSION; +#endif + + DCHECK(!origin_type_mask) + << "DoesOriginMatchEmbedderMask must handle all origin types."; + + return false; +} + } // namespace ChromeBrowsingDataRemoverDelegate::SubTask::SubTask( @@ -312,27 +339,9 @@ template_url_sub_.reset(); } -bool ChromeBrowsingDataRemoverDelegate::DoesOriginMatchEmbedderMask( - int origin_type_mask, - const GURL& origin, - storage::SpecialStoragePolicy* policy) const { - DCHECK_EQ(0, origin_type_mask & (ORIGIN_TYPE_EMBEDDER_BEGIN - 1)) - << "|origin_type_mask| can only contain origin types defined in " - << "the embedder."; - -#if BUILDFLAG(ENABLE_EXTENSIONS) - // Packaged apps and extensions match iff EXTENSION. - if ((origin.GetOrigin().scheme() == extensions::kExtensionScheme) && - (origin_type_mask & ORIGIN_TYPE_EXTENSION)) { - return true; - } - origin_type_mask &= ~ORIGIN_TYPE_EXTENSION; -#endif - - DCHECK(!origin_type_mask) - << "DoesOriginMatchEmbedderMask must handle all origin types."; - - return false; +BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher +ChromeBrowsingDataRemoverDelegate::GetOriginTypeMatcher() const { + return base::Bind(DoesOriginMatchEmbedderMask); } void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h index 17a19c46..ef048e8 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
@@ -173,10 +173,8 @@ ~ChromeBrowsingDataRemoverDelegate() override; // BrowsingDataRemoverDelegate: - bool DoesOriginMatchEmbedderMask( - int origin_type_mask, - const GURL& origin, - storage::SpecialStoragePolicy* special_storage_policy) const override; + BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher GetOriginTypeMatcher() + const override; void RemoveEmbedderData( const base::Time& delete_begin, const base::Time& delete_end,
diff --git a/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.cc index e38e3653..ff46b00 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.cc
@@ -14,11 +14,9 @@ DCHECK(!expected_calls_.size()) << "Expectations were set but not verified."; } -bool MockBrowsingDataRemoverDelegate::DoesOriginMatchEmbedderMask( - int origin_type_mask, - const GURL& origin, - storage::SpecialStoragePolicy* special_storage_policy) const { - return false; +BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher +MockBrowsingDataRemoverDelegate::GetOriginTypeMatcher() const { + return BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher(); } void MockBrowsingDataRemoverDelegate::RemoveEmbedderData(
diff --git a/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.h index ad7cb916..6f69e288 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/mock_browsing_data_remover_delegate.h
@@ -19,10 +19,8 @@ ~MockBrowsingDataRemoverDelegate() override; // BrowsingDataRemoverDelegate: - bool DoesOriginMatchEmbedderMask( - int origin_type_mask, - const GURL& origin, - storage::SpecialStoragePolicy* special_storage_policy) const override; + BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher GetOriginTypeMatcher() + const override; void RemoveEmbedderData( const base::Time& delete_begin, const base::Time& delete_end,
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 59c39b45..b9d75d0 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -135,7 +135,6 @@ "//ui/views/controls/webview", "//ui/web_dialogs", "//url", - "//v8", ] data_deps = [
diff --git a/chrome/browser/chromeos/accessibility/accessibility_highlight_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_highlight_manager.cc index 90024dc5..15ef6cf 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_highlight_manager.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_highlight_manager.cc
@@ -38,7 +38,7 @@ AccessibilityFocusRingController::GetInstance()->HideCaretRing(); AccessibilityFocusRingController::GetInstance()->HideCursorRing(); - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); if (shell && registered_observers_) { shell->RemovePreTargetHandler(this); shell->cursor_manager()->RemoveObserver(this); @@ -65,7 +65,7 @@ } void AccessibilityHighlightManager::RegisterObservers() { - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); shell->AddPreTargetHandler(this); shell->cursor_manager()->AddObserver(this); registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, @@ -131,7 +131,7 @@ } bool AccessibilityHighlightManager::IsCursorVisible() { - return ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible(); + return ash::Shell::Get()->cursor_manager()->IsCursorVisible(); } void AccessibilityHighlightManager::UpdateFocusAndCaretHighlights() {
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc index 0052d3c..df35212 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -416,10 +416,10 @@ NotifyAccessibilityStatusChanged(details); - ash::Shell::GetInstance()->cursor_manager()->SetCursorSet( + ash::Shell::Get()->cursor_manager()->SetCursorSet( enabled ? ui::CURSOR_SET_LARGE : ui::CURSOR_SET_NORMAL); - ash::Shell::GetInstance()->SetLargeCursorSizeInDip(large_cursor_size_in_dip); - ash::Shell::GetInstance()->SetCursorCompositingEnabled( + ash::Shell::Get()->SetLargeCursorSizeInDip(large_cursor_size_in_dip); + ash::Shell::Get()->SetCursorCompositingEnabled( ShouldEnableCursorCompositing()); } @@ -457,7 +457,7 @@ return; sticky_keys_enabled_ = enabled; - ash::Shell::GetInstance()->sticky_keys_controller()->Enable(enabled); + ash::Shell::Get()->sticky_keys_controller()->Enable(enabled); } void AccessibilityManager::EnableSpokenFeedback( @@ -552,8 +552,8 @@ NotifyAccessibilityStatusChanged(details); - ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); - ash::Shell::GetInstance()->SetCursorCompositingEnabled( + ash::Shell::Get()->high_contrast_controller()->SetEnabled(enabled); + ash::Shell::Get()->SetCursorCompositingEnabled( ShouldEnableCursorCompositing()); } @@ -683,7 +683,7 @@ return; } - ash::Shell::GetInstance()->autoclick_controller()->SetEnabled(enabled); + ash::Shell::Get()->autoclick_controller()->SetEnabled(enabled); } void AccessibilityManager::SetAutoclickDelay(int delay_ms) { @@ -721,7 +721,7 @@ return; } - ash::Shell::GetInstance()->autoclick_controller()->SetAutoclickDelay( + ash::Shell::Get()->autoclick_controller()->SetAutoclickDelay( autoclick_delay_ms_); } @@ -760,9 +760,9 @@ // might still be enabled and a forced reset is required to pick up the // layout change. if (keyboard::IsKeyboardEnabled()) - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); else - ash::Shell::GetInstance()->DeactivateKeyboard(); + ash::Shell::Get()->DeactivateKeyboard(); } else { // TODO(mash): Support on-screen keyboard. See http://crbug.com/646565 NOTIMPLEMENTED(); @@ -802,7 +802,7 @@ enabled, ash::A11Y_NOTIFICATION_NONE); NotifyAccessibilityStatusChanged(details); - ash::Shell::GetInstance()->audio_a11y_controller()->SetOutputMono(enabled); + ash::Shell::Get()->audio_a11y_controller()->SetOutputMono(enabled); } void AccessibilityManager::SetCaretHighlightEnabled(bool enabled) { @@ -1044,7 +1044,7 @@ // Sticky keys is implemented only in ash. // TODO(dpolukhin): support Athena, crbug.com/408733. if (!ash_util::IsRunningInMash()) { - ash::Shell::GetInstance()->sticky_keys_controller()->SetModifiersEnabled( + ash::Shell::Get()->sticky_keys_controller()->SetModifiersEnabled( manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), manager->IsAltGrUsedByCurrentInputMethod()); }
diff --git a/chrome/browser/chromeos/accessibility/magnification_controller_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_controller_browsertest.cc index 62230e7b5..da4db5c 100644 --- a/chrome/browser/chromeos/accessibility/magnification_controller_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/magnification_controller_browsertest.cc
@@ -45,7 +45,7 @@ } ash::MagnificationController* GetMagnificationController() { - return ash::Shell::GetInstance()->magnification_controller(); + return ash::Shell::Get()->magnification_controller(); } bool IsMagnifierEnabled() {
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager.cc b/chrome/browser/chromeos/accessibility/magnification_manager.cc index 60b53ba..7b19e03 100644 --- a/chrome/browser/chromeos/accessibility/magnification_manager.cc +++ b/chrome/browser/chromeos/accessibility/magnification_manager.cc
@@ -154,11 +154,10 @@ enabled_ = enabled; if (type_ == ash::MAGNIFIER_FULL) { - ash::Shell::GetInstance()->magnification_controller()->SetEnabled( - enabled_); + ash::Shell::Get()->magnification_controller()->SetEnabled(enabled_); MonitorFocusInPageChange(); } else { - ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled( + ash::Shell::Get()->partial_magnification_controller()->SetEnabled( enabled_); } } @@ -177,9 +176,8 @@ keep_focus_centered_ = keep_focus_centered; if (type_ == ash::MAGNIFIER_FULL) { - ash::Shell::GetInstance() - ->magnification_controller() - ->SetKeepFocusCentered(keep_focus_centered_); + ash::Shell::Get()->magnification_controller()->SetKeepFocusCentered( + keep_focus_centered_); } } @@ -221,8 +219,8 @@ if (AccessibilityManager::Get()) { AccessibilityManager::Get()->NotifyAccessibilityStatusChanged(details); - if (ash::Shell::GetInstance()) { - ash::Shell::GetInstance()->SetCursorCompositingEnabled( + if (ash::Shell::Get()) { + ash::Shell::Get()->SetCursorCompositingEnabled( AccessibilityManager::Get()->ShouldEnableCursorCompositing()); } } @@ -271,10 +269,9 @@ case content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE: { content::FocusedNodeDetails* node_details = content::Details<content::FocusedNodeDetails>(details).ptr(); - ash::Shell::GetInstance() - ->magnification_controller() - ->HandleFocusedNodeChanged(node_details->is_editable_node, - node_details->node_bounds_in_screen); + ash::Shell::Get()->magnification_controller()->HandleFocusedNodeChanged( + node_details->is_editable_node, + node_details->node_bounds_in_screen); break; } }
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc index 77f9eec..b057f6c 100644 --- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
@@ -43,12 +43,11 @@ } void SetFullScreenMagnifierScale(double scale) { - ash::Shell::GetInstance()-> - magnification_controller()->SetScale(scale, false); + ash::Shell::Get()->magnification_controller()->SetScale(scale, false); } double GetFullScreenMagnifierScale() { - return ash::Shell::GetInstance()->magnification_controller()->GetScale(); + return ash::Shell::Get()->magnification_controller()->GetScale(); } void SetSavedFullScreenMagnifierScale(double scale) {
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_browsertest.cc b/chrome/browser/chromeos/accessibility/select_to_speak_browsertest.cc index 8910da96..06826fe7 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_browsertest.cc
@@ -33,8 +33,7 @@ AccessibilityManager::Get()->SetSelectToSpeakEnabled(true); extension_load_waiter.Wait(); - aura::Window* root_window = - ash::Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::Get()->GetPrimaryRootWindow(); generator_.reset(new ui::test::EventGenerator(root_window)); ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); @@ -47,7 +46,7 @@ }; IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, SpeakStatusTray) { - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); gfx::Rect tray_bounds = tray->GetBoundsInScreen(); // Hold down Search and click a few pixels into the status tray bounds.
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc index 4bc5f68..b9b9ba15 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
@@ -19,17 +19,13 @@ namespace chromeos { SelectToSpeakEventHandler::SelectToSpeakEventHandler() { - if (ash::Shell::HasInstance()) { - ash::Shell::GetInstance()->GetPrimaryRootWindow()->AddPreTargetHandler( - this); - } + if (ash::Shell::HasInstance()) + ash::Shell::Get()->GetPrimaryRootWindow()->AddPreTargetHandler(this); } SelectToSpeakEventHandler::~SelectToSpeakEventHandler() { - if (ash::Shell::HasInstance()) { - ash::Shell::GetInstance()->GetPrimaryRootWindow()->RemovePreTargetHandler( - this); - } + if (ash::Shell::HasInstance()) + ash::Shell::Get()->GetPrimaryRootWindow()->RemovePreTargetHandler(this); } void SelectToSpeakEventHandler::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc index adb9ea21..1fb05aac 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc
@@ -614,7 +614,7 @@ // Send an accessibility hover event on the system tray, which is // what we get when you tap it on a touch screen when ChromeVox is on. - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance());
diff --git a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc index 5b33159..cf5e0fb 100644 --- a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
@@ -51,7 +51,7 @@ } ash::SystemTray* GetSystemTray() { - return ash::Shell::GetInstance()->GetPrimarySystemTray(); + return ash::Shell::Get()->GetPrimarySystemTray(); } void SendKeyPress(ui::KeyboardCode key) { @@ -201,7 +201,7 @@ // Overlay should not be visible if sticky keys is not enabled. ash::StickyKeysController* controller = - ash::Shell::GetInstance()->sticky_keys_controller(); + ash::Shell::Get()->sticky_keys_controller(); EXPECT_FALSE(controller->GetOverlayForTest()); for (auto key_code : modifier_keys) { SendKeyPress(key_code);
diff --git a/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc b/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc index a6c4ce0..3f01698 100644 --- a/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc +++ b/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
@@ -16,12 +16,12 @@ SwitchAccessEventHandler::SwitchAccessEventHandler() { if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->AddPreTargetHandler(this); + ash::Shell::Get()->AddPreTargetHandler(this); } SwitchAccessEventHandler::~SwitchAccessEventHandler() { if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->RemovePreTargetHandler(this); + ash::Shell::Get()->RemovePreTargetHandler(this); } void SwitchAccessEventHandler::OnKeyEvent(ui::KeyEvent* event) {
diff --git a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc index 72265e4..9e45716 100644 --- a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
@@ -46,7 +46,7 @@ content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::WaitForResizeComplete(web_contents); - root_window_ = ash::Shell::GetInstance()->GetPrimaryRootWindow(); + root_window_ = ash::Shell::Get()->GetPrimaryRootWindow(); event_handler_.reset(new ui::test::TestEventHandler()); root_window_->AddPreTargetHandler(event_handler_.get()); } @@ -58,7 +58,7 @@ void SwitchTouchExplorationMode(bool on) { ash::AccessibilityDelegate* delegate = - ash::Shell::GetInstance()->accessibility_delegate(); + ash::Shell::Get()->accessibility_delegate(); if (on != delegate->IsSpokenFeedbackEnabled()) delegate->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE); }
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc index c9342ea..884e97d3 100644 --- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc +++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.cc
@@ -52,13 +52,13 @@ } // namespace ArcInstanceThrottle::ArcInstanceThrottle() { - ash::Shell::GetInstance()->activation_client()->AddObserver(this); + ash::Shell::Get()->activation_client()->AddObserver(this); ThrottleInstanceIfNeeded(ash::WmWindow::Get(ash::wm::GetActiveWindow())); } ArcInstanceThrottle::~ArcInstanceThrottle() { if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); + ash::Shell::Get()->activation_client()->RemoveObserver(this); } void ArcInstanceThrottle::OnWindowActivated(ActivationReason reason,
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc index 081b7ca7..99772a1 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc +++ b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
@@ -95,7 +95,7 @@ const CaptureFocusedWindowCallback& callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); aura::Window* window = - ash::Shell::GetInstance()->activation_client()->GetActiveWindow(); + ash::Shell::Get()->activation_client()->GetActiveWindow(); if (window == nullptr) { callback.Run(std::vector<uint8_t>{});
diff --git a/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc b/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc index b0ec1fa..88d427b8 100644 --- a/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc +++ b/chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.cc
@@ -58,7 +58,7 @@ ash::WallpaperController* GetWallpaperController() { if (!ash::Shell::HasInstance()) return nullptr; - return ash::Shell::GetInstance()->wallpaper_controller(); + return ash::Shell::Get()->wallpaper_controller(); } } // namespace @@ -218,8 +218,7 @@ void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - ash::WallpaperController* wc = - ash::Shell::GetInstance()->wallpaper_controller(); + ash::WallpaperController* wc = ash::Shell::Get()->wallpaper_controller(); gfx::ImageSkia wallpaper = wc->GetWallpaper(); base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 7864344..0d3b565 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -806,7 +806,7 @@ keyboard_event_rewriters_->AddEventRewriter( base::MakeUnique<ui::EventRewriterChromeOS>( event_rewriter_delegate_.get(), - ash::Shell::GetInstance()->sticky_keys_controller())); + ash::Shell::Get()->sticky_keys_controller())); keyboard_event_rewriters_->Init(); }
diff --git a/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc b/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc index 92da2c0a..f94b0e3 100644 --- a/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc +++ b/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc
@@ -250,7 +250,7 @@ WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( - ash::Shell::GetInstance()->wallpaper_controller()->GetWallpaper(), + ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); WallpaperImageFetcherFactory url_factory( @@ -268,7 +268,7 @@ observer.WaitForWallpaperAnimationFinished(); EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( - ash::Shell::GetInstance()->wallpaper_controller()->GetWallpaper(), + ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_manager_test_utils::kCustomWallpaperColor)); EXPECT_EQ(1U, url_factory.num_attempts()); } @@ -279,7 +279,7 @@ WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( - ash::Shell::GetInstance()->wallpaper_controller()->GetWallpaper(), + ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); WallpaperImageFetcherFactory url_factory( @@ -297,7 +297,7 @@ observer.WaitForWallpaperAnimationFinished(); EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( - ash::Shell::GetInstance()->wallpaper_controller()->GetWallpaper(), + ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_manager_test_utils::kCustomWallpaperColor)); EXPECT_EQ(2U, url_factory.num_attempts());
diff --git a/chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.cc b/chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.cc index 4b10e5e5..d1340371 100644 --- a/chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.cc +++ b/chrome/browser/chromeos/dbus/chrome_console_service_provider_delegate.cc
@@ -17,13 +17,12 @@ void ChromeConsoleServiceProviderDelegate::TakeDisplayOwnership( const UpdateOwnershipCallback& callback) { - ash::Shell::GetInstance()->display_configurator()->TakeControl(callback); + ash::Shell::Get()->display_configurator()->TakeControl(callback); } void ChromeConsoleServiceProviderDelegate::ReleaseDisplayOwnership( const UpdateOwnershipCallback& callback) { - ash::Shell::GetInstance()->display_configurator()->RelinquishControl( - callback); + ash::Shell::Get()->display_configurator()->RelinquishControl(callback); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/dbus/chrome_display_power_service_provider_delegate.cc b/chrome/browser/chromeos/dbus/chrome_display_power_service_provider_delegate.cc index 5ab6c10c..6f709eb 100644 --- a/chrome/browser/chromeos/dbus/chrome_display_power_service_provider_delegate.cc +++ b/chrome/browser/chromeos/dbus/chrome_display_power_service_provider_delegate.cc
@@ -29,7 +29,7 @@ // know so that it can ignore such events. ui::UserActivityDetector::Get()->OnDisplayPowerChanging(); - ash::Shell::GetInstance()->display_configurator()->SetDisplayPower( + ash::Shell::Get()->display_configurator()->SetDisplayPower( power_state, display::DisplayConfigurator::kSetDisplayPowerNoFlags, callback); }
diff --git a/chrome/browser/chromeos/display/display_configuration_observer.cc b/chrome/browser/chromeos/display/display_configuration_observer.cc index 5e36c434..e100174 100644 --- a/chrome/browser/chromeos/display/display_configuration_observer.cc +++ b/chrome/browser/chromeos/display/display_configuration_observer.cc
@@ -13,11 +13,11 @@ namespace chromeos { DisplayConfigurationObserver::DisplayConfigurationObserver() { - ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + ash::Shell::Get()->window_tree_host_manager()->AddObserver(this); } DisplayConfigurationObserver::~DisplayConfigurationObserver() { - ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); } void DisplayConfigurationObserver::OnDisplaysInitialized() {
diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc index 914b7ac..c617525 100644 --- a/chrome/browser/chromeos/display/display_preferences.cc +++ b/chrome/browser/chromeos/display/display_preferences.cc
@@ -183,7 +183,7 @@ } display::DisplayManager* GetDisplayManager() { - return ash::Shell::GetInstance()->display_manager(); + return ash::Shell::Get()->display_manager(); } // Returns true id the current user can write display preferences to @@ -410,13 +410,13 @@ void StoreCurrentDisplayPowerState() { StoreDisplayPowerState( - ash::Shell::GetInstance()->display_configurator()-> - requested_power_state()); + ash::Shell::Get()->display_configurator()->requested_power_state()); } void StoreCurrentDisplayRotationLockPrefs() { - bool rotation_lock = ash::Shell::GetInstance()->display_manager()-> - registered_internal_display_rotation_lock(); + bool rotation_lock = ash::Shell::Get() + ->display_manager() + ->registered_internal_display_rotation_lock(); StoreDisplayRotationPrefs(rotation_lock); } @@ -441,7 +441,7 @@ // Do not store prefs when the confirmation dialog is shown. if (!UserCanSaveDisplayPreference() || - !ash::Shell::GetInstance()->ShouldSaveDisplaySettings()) { + !ash::Shell::Get()->ShouldSaveDisplaySettings()) { return; } @@ -474,7 +474,7 @@ std::string value = local_state->GetString(prefs::kDisplayPowerState); chromeos::DisplayPowerState power_state; if (GetDisplayPowerStateFromString(value, &power_state)) { - ash::Shell::GetInstance()->display_configurator()->SetInitialDisplayPower( + ash::Shell::Get()->display_configurator()->SetInitialDisplayPower( power_state); } }
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc index 68dee38..e2cf68c 100644 --- a/chrome/browser/chromeos/display/display_preferences_unittest.cc +++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -59,9 +59,7 @@ const float kMeanGravity = -9.80665f; bool IsRotationLocked() { - return ash::Shell::GetInstance() - ->screen_orientation_controller() - ->rotation_locked(); + return ash::Shell::Get()->screen_orientation_controller()->rotation_locked(); } class DisplayPreferencesTest : public ash::test::AshTestBase { @@ -199,7 +197,7 @@ std::string GetRegisteredDisplayPlacementStr( const display::DisplayIdList& list) { - return ash::Shell::GetInstance() + return ash::Shell::Get() ->display_manager() ->layout_store() ->GetRegisteredDisplayLayout(list) @@ -234,7 +232,7 @@ StoreDisplayPowerStateForTest( chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); LoadDisplayPreferences(true); // DisplayPowerState should be ignored at boot. @@ -259,7 +257,7 @@ TEST_F(DisplayPreferencesTest, BasicStores) { ash::WindowTreeHostManager* window_tree_host_manager = - ash::Shell::GetInstance()->window_tree_host_manager(); + ash::Shell::Get()->window_tree_host_manager(); UpdateDisplay("200x200*2, 400x300#400x400|300x200*1.25"); int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); @@ -471,9 +469,9 @@ EXPECT_EQ(base::Int64ToString(id2), primary_id_str); display_manager()->SetLayoutForCurrentDisplays( - display::test::CreateDisplayLayout( - ash::Shell::GetInstance()->display_manager(), - display::DisplayPlacement::BOTTOM, 20)); + display::test::CreateDisplayLayout(ash::Shell::Get()->display_manager(), + display::DisplayPlacement::BOTTOM, + 20)); UpdateDisplay("1+0-200x200*2,1+0-200x200"); // Mirrored. @@ -570,7 +568,7 @@ int64_t id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); // Set display's resolution in single display. It creates the notification and // display preferences should not stored meanwhile. - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); scoped_refptr<display::ManagedDisplayMode> old_mode( new display::ManagedDisplayMode(gfx::Size(400, 300))); @@ -600,7 +598,7 @@ // Once the notification is removed, the specified resolution will be stored // by SetDisplayMode. - ash::Shell::GetInstance()->display_manager()->SetDisplayMode( + ash::Shell::Get()->display_manager()->SetDisplayMode( id, make_scoped_refptr(new display::ManagedDisplayMode( gfx::Size(300, 200), 60.0f, false, true))); UpdateDisplay("300x200#500x400|400x300|300x200"); @@ -700,8 +698,7 @@ profiles.push_back(display::COLOR_PROFILE_DYNAMIC); profiles.push_back(display::COLOR_PROFILE_MOVIE); profiles.push_back(display::COLOR_PROFILE_READING); - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .SetAvailableColorProfiles(id1, profiles); LoadDisplayPreferences(false); @@ -711,14 +708,14 @@ TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { ash::WindowTreeHostManager* window_tree_host_manager = - ash::Shell::GetInstance()->window_tree_host_manager(); + ash::Shell::Get()->window_tree_host_manager(); UpdateDisplay("200x200*2,200x200"); LoggedInAsGuest(); int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); display::test::ScopedSetInternalDisplayId set_internal( - ash::Shell::GetInstance()->display_manager(), id1); + ash::Shell::Get()->display_manager(), id1); int64_t id2 = display_manager()->GetSecondaryDisplay().id(); display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), @@ -789,12 +786,11 @@ chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); LoadDisplayPreferences(false); EXPECT_EQ(chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, - ash::Shell::GetInstance()->display_configurator()-> - requested_power_state()); + ash::Shell::Get()->display_configurator()->requested_power_state()); } TEST_F(DisplayPreferencesTest, DontSaveAndRestoreAllOff) { - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); StoreDisplayPowerStateForTest( chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON); LoadDisplayPreferences(false); @@ -819,7 +815,7 @@ // Tests that display configuration changes caused by MaximizeModeController // are not saved. TEST_F(DisplayPreferencesTest, DontSaveMaximizeModeControllerRotations) { - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); display::Display::SetInternalDisplayId( display::Screen::GetScreen()->GetPrimaryDisplay().id()); LoggedInAsUser(); @@ -1000,9 +996,7 @@ display::Screen::GetScreen()->GetPrimaryDisplay().id()); ASSERT_FALSE(local_state()->HasPrefPath(prefs::kDisplayRotationLock)); - ash::Shell::GetInstance() - ->screen_orientation_controller() - ->ToggleUserRotationLock(); + ash::Shell::Get()->screen_orientation_controller()->ToggleUserRotationLock(); EXPECT_TRUE(local_state()->HasPrefPath(prefs::kDisplayRotationLock));
diff --git a/chrome/browser/chromeos/display/output_protection_controller_ash.cc b/chrome/browser/chromeos/display/output_protection_controller_ash.cc index 9a7db15..8e4535d8 100644 --- a/chrome/browser/chromeos/display/output_protection_controller_ash.cc +++ b/chrome/browser/chromeos/display/output_protection_controller_ash.cc
@@ -9,7 +9,7 @@ namespace chromeos { OutputProtectionControllerAsh::OutputProtectionControllerAsh() - : client_id_(ash::Shell::GetInstance() + : client_id_(ash::Shell::Get() ->display_configurator() ->RegisterContentProtectionClient()) {} @@ -17,7 +17,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); if (client_id_ != display::DisplayConfigurator::INVALID_CLIENT_ID) { display::DisplayConfigurator* configurator = - ash::Shell::GetInstance()->display_configurator(); + ash::Shell::Get()->display_configurator(); configurator->UnregisterContentProtectionClient(client_id_); } } @@ -27,7 +27,7 @@ const OutputProtectionDelegate::QueryStatusCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); display::DisplayConfigurator* configurator = - ash::Shell::GetInstance()->display_configurator(); + ash::Shell::Get()->display_configurator(); configurator->QueryContentProtectionStatus(client_id_, display_id, callback); } @@ -37,7 +37,7 @@ const OutputProtectionDelegate::SetProtectionCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); display::DisplayConfigurator* configurator = - ash::Shell::GetInstance()->display_configurator(); + ash::Shell::Get()->display_configurator(); configurator->SetContentProtection(client_id_, display_id, desired_method_mask, callback); }
diff --git a/chrome/browser/chromeos/display/overscan_calibrator.cc b/chrome/browser/chromeos/display/overscan_calibrator.cc index 0cc03f7f..1b8ca62 100644 --- a/chrome/browser/chromeos/display/overscan_calibrator.cc +++ b/chrome/browser/chromeos/display/overscan_calibrator.cc
@@ -78,16 +78,15 @@ committed_(false) { // Undo the overscan calibration temporarily so that the user can see // dark boundary and current overscan region. - ash::Shell::GetInstance()->window_tree_host_manager()->SetOverscanInsets( + ash::Shell::Get()->window_tree_host_manager()->SetOverscanInsets( display_.id(), gfx::Insets()); display::ManagedDisplayInfo info = - ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( - display_.id()); + ash::Shell::Get()->display_manager()->GetDisplayInfo(display_.id()); - aura::Window* root = ash::Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_.id()); + aura::Window* root = + ash::Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_.id()); ui::Layer* parent_layer = ash::Shell::GetContainer(root, ash::kShellWindowId_OverlayContainer) ->layer(); @@ -103,13 +102,13 @@ // Overscan calibration has finished without commit, so the display has to // be the original offset. if (!committed_) { - ash::Shell::GetInstance()->window_tree_host_manager()->SetOverscanInsets( + ash::Shell::Get()->window_tree_host_manager()->SetOverscanInsets( display_.id(), initial_insets_); } } void OverscanCalibrator::Commit() { - ash::Shell::GetInstance()->window_tree_host_manager()->SetOverscanInsets( + ash::Shell::Get()->window_tree_host_manager()->SetOverscanInsets( display_.id(), insets_); committed_ = true; }
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc index f22da18..58e1f8c 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc
@@ -39,7 +39,7 @@ is_calibrating_ = true; callback_ = callback; - ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + ash::Shell::Get()->window_tree_host_manager()->AddObserver(this); target_display_ = target_display; // Clear all touch calibrator views used in any previous calibration. @@ -57,11 +57,10 @@ base::MakeUnique<TouchCalibratorView>(display, is_primary_view); } - ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( - true); + ash::Shell::Get()->touch_transformer_controller()->SetForCalibration(true); // Add self as an event handler target. - ash::Shell::GetInstance()->AddPreTargetHandler(this); + ash::Shell::Get()->AddPreTargetHandler(this); } void TouchCalibratorController::StopCalibration() { @@ -69,13 +68,12 @@ return; is_calibrating_ = false; - ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); - ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( - false); + ash::Shell::Get()->touch_transformer_controller()->SetForCalibration(false); // Remove self as the event handler. - ash::Shell::GetInstance()->RemovePreTargetHandler(this); + ash::Shell::Get()->RemovePreTargetHandler(this); // Transition all touch calibrator views to their final state for a graceful // exit. @@ -122,7 +120,7 @@ callback_.Reset(); } StopCalibration(); - ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( + ash::Shell::Get()->display_manager()->SetTouchCalibrationData( target_display_.id(), touch_point_quad_, target_screen_calibration_view->size()); return;
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc index 6e3b8417..aef05cc 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc
@@ -75,7 +75,7 @@ TouchCalibratorController touch_calibrator_controller; StartCalibrationChecks(&touch_calibrator_controller, touch_display); - ui::EventTargetTestApi test_api(ash::Shell::GetInstance()); + ui::EventTargetTestApi test_api(ash::Shell::Get()); const ui::EventHandlerList& handlers = test_api.pre_target_handlers(); ui::EventHandlerList::const_iterator event_target = std::find(handlers.begin(), handlers.end(), &touch_calibrator_controller);
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc index 8c52f1c..32ff477 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc
@@ -470,9 +470,9 @@ throbber_circle_(nullptr), hint_box_view_(nullptr), touch_point_view_(nullptr) { - aura::Window* root = ash::Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display_.id()); + aura::Window* root = + ash::Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display_.id()); widget_.reset(new views::Widget); widget_->Init(GetWidgetParams(root)); widget_->SetContentsView(this);
diff --git a/chrome/browser/chromeos/events/event_rewriter_unittest.cc b/chrome/browser/chromeos/events/event_rewriter_unittest.cc index 6feaba2b..da0c7f0 100644 --- a/chrome/browser/chromeos/events/event_rewriter_unittest.cc +++ b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
@@ -1952,8 +1952,7 @@ void SetUp() override { AshTestBase::SetUp(); - sticky_keys_controller_ = - ash::Shell::GetInstance()->sticky_keys_controller(); + sticky_keys_controller_ = ash::Shell::Get()->sticky_keys_controller(); delegate_ = base::MakeUnique<EventRewriterDelegateImpl>(); delegate_->set_pref_service_for_testing(prefs()); rewriter_ = base::MakeUnique<ui::EventRewriterChromeOS>(
diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc index 305449f7..372286b 100644 --- a/chrome/browser/chromeos/extensions/input_method_api.cc +++ b/chrome/browser/chromeos/extensions/input_method_api.cc
@@ -257,7 +257,7 @@ // Forcibly enables the a11y onscreen keyboard if there is on keyboard enabled // for now. And re-disables it after showing once. keyboard::SetAccessibilityKeyboardEnabled(true); - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); keyboard_controller = keyboard::KeyboardController::GetInstance(); if (!keyboard_controller) { keyboard::SetAccessibilityKeyboardEnabled(false);
diff --git a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc index 4026e98..df92a3c 100644 --- a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc +++ b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc
@@ -9,6 +9,7 @@ #include <utility> #include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/extensions/users_private/users_private_delegate.h" @@ -99,8 +100,12 @@ for (size_t i = 0; i < email_list->GetSize(); ++i) { api::users_private::User user; email_list->GetString(i, &user.email); - user.name = - user_manager->GetUserDisplayEmail(AccountId::FromUserEmail(user.email)); + AccountId account_id = AccountId::FromUserEmail(user.email); + user.name = base::UTF16ToUTF8(user_manager->GetUserDisplayName(account_id)); + if (user.name.empty()) { + // User is not associated with a gaia account. + user.name = user_manager->GetUserDisplayEmail(account_id); + } user.is_owner = chromeos::ProfileHelper::IsOwnerProfile(profile) && user.email == profile->GetProfileUserName(); user_list->Append(user.ToValue());
diff --git a/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc b/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc index 4a23cbff..a958beb 100644 --- a/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc +++ b/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc
@@ -135,8 +135,7 @@ content::RunAllPendingInMessageLoop(); EXPECT_EQ(controller(), (void*)NULL); // shell_helper() is destructed already, thats why we call Shell directly. - EXPECT_FALSE(ash::Shell::GetInstance()->GetPrimarySystemTray()-> - HasSystemBubble()); + EXPECT_FALSE(ash::Shell::Get()->GetPrimarySystemTray()->HasSystemBubble()); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/first_run/first_run_controller.cc b/chrome/browser/chromeos/first_run/first_run_controller.cc index bafa97e..09e8242 100644 --- a/chrome/browser/chromeos/first_run/first_run_controller.cc +++ b/chrome/browser/chromeos/first_run/first_run_controller.cc
@@ -77,7 +77,7 @@ user_profile_ = ProfileHelper::Get()->GetProfileByUserUnsafe( user_manager->GetActiveUser()); - shell_helper_.reset(ash::Shell::GetInstance()->CreateFirstRunHelper()); + shell_helper_.reset(ash::Shell::Get()->CreateFirstRunHelper()); shell_helper_->AddObserver(this); FirstRunView* view = new FirstRunView();
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index 5d95dd6..83e5e0a 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -2329,11 +2329,11 @@ LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest(); KioskTest::SetUpOnMainThread(); - ash::Shell::GetInstance()->wallpaper_controller()->AddObserver(this); + ash::Shell::Get()->wallpaper_controller()->AddObserver(this); } void TearDownOnMainThread() override { - ash::Shell::GetInstance()->wallpaper_controller()->RemoveObserver(this); + ash::Shell::Get()->wallpaper_controller()->RemoveObserver(this); KioskTest::TearDownOnMainThread(); }
diff --git a/chrome/browser/chromeos/login/lock/screen_locker.cc b/chrome/browser/chromeos/login/lock/screen_locker.cc index 0817358..e1ed221 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker.cc
@@ -158,12 +158,11 @@ manager->Initialize(SOUND_UNLOCK, bundle.GetRawDataResource(IDR_SOUND_UNLOCK_WAV)); - ash::Shell::GetInstance() - ->lock_state_controller() - ->SetLockScreenDisplayedCallback(base::Bind( - base::IgnoreResult(&AccessibilityManager::PlayEarcon), - base::Unretained(AccessibilityManager::Get()), chromeos::SOUND_LOCK, - PlaySoundOption::SPOKEN_FEEDBACK_ENABLED)); + ash::Shell::Get()->lock_state_controller()->SetLockScreenDisplayedCallback( + base::Bind(base::IgnoreResult(&AccessibilityManager::PlayEarcon), + base::Unretained(AccessibilityManager::Get()), + chromeos::SOUND_LOCK, + PlaySoundOption::SPOKEN_FEEDBACK_ENABLED)); } void ScreenLocker::Init() { @@ -413,7 +412,7 @@ if (g_screen_lock_observer->session_started() && user_manager::UserManager::Get()->CanCurrentUserLock()) { ScreenLocker::Show(); - ash::Shell::GetInstance()->lock_state_controller()->OnStartingLock(); + ash::Shell::Get()->lock_state_controller()->OnStartingLock(); } else { // If the current user's session cannot be locked or the user has not // completed all sign-in steps yet, log out instead. The latter is done to @@ -484,8 +483,7 @@ BrowserThread::UI, FROM_HERE, base::Bind([] { base::Callback<void(void)> callback = base::Bind(&ScreenLocker::ScheduleDeletion); - ash::Shell::GetInstance()->lock_state_controller()->OnLockScreenHide( - callback); + ash::Shell::Get()->lock_state_controller()->OnLockScreenHide(callback); })); } @@ -515,7 +513,7 @@ ClearErrors(); VLOG(1) << "Moving wallpaper to unlocked container"; - ash::Shell::GetInstance()->wallpaper_controller()->MoveToUnlockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer(); screen_locker_ = NULL; bool state = false; @@ -546,7 +544,7 @@ UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); VLOG(1) << "Moving wallpaper to locked container"; - ash::Shell::GetInstance()->wallpaper_controller()->MoveToLockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer(); bool state = true; VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state;
diff --git a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc index 0180503..9413fee 100644 --- a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc
@@ -126,7 +126,7 @@ weak_factory_(this) { set_should_emit_login_prompt_visible(false); ash::WmShell::Get()->AddLockStateObserver(this); - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); display::Screen::GetScreen()->AddObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); @@ -140,7 +140,7 @@ DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); ash::WmShell::Get()->RemoveLockStateObserver(this); - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. if (lock_window_) { lock_window_->RemoveObserver(this); @@ -271,7 +271,7 @@ void WebUIScreenLocker::OnHeaderBarVisible() { DCHECK(ash::Shell::HasInstance()); - ash::Shell::GetInstance()->power_event_observer()->OnLockAnimationsComplete(); + ash::Shell::Get()->power_event_observer()->OnLockAnimationsComplete(); } ////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index c98ee6b2..3d64428 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc
@@ -309,7 +309,7 @@ // Used to make sure that the system tray is visible and within the screen // bounds after login. void TestSystemTrayIsVisible(bool otr) { - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow(); ash::WmWindow* wm_primary_win = ash::WmWindow::Get(primary_win); ash::WmShelf* wm_shelf = ash::WmShelf::ForWindow(wm_primary_win); @@ -340,7 +340,7 @@ // Verifies the cursor is not hidden at startup when user is logged in. IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) { - EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_TRUE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); TestSystemTrayIsVisible(false); } @@ -357,7 +357,7 @@ // Verifies the cursor is not hidden at startup when running guest session. IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) { - EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_TRUE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); TestSystemTrayIsVisible(true); } @@ -368,11 +368,11 @@ ShowLoginWizard(OobeScreen::SCREEN_SPECIAL_LOGIN); // Cursor should be hidden at startup - EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_FALSE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); // Cursor should be shown after cursor is moved. EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point())); - EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); + EXPECT_TRUE(ash::Shell::Get()->cursor_manager()->IsCursorVisible()); base::ThreadTaskRunnerHandle::Get()->DeleteSoon( FROM_HERE, LoginDisplayHost::default_host());
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc index 40f554f..ea0e029 100644 --- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc +++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
@@ -365,7 +365,7 @@ DCHECK(controller_.get()); // For manager user, move wallpaper to locked container so that windows // created during the user image picker step are below it. - ash::Shell::GetInstance()->wallpaper_controller()->MoveToLockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer(); controller_->SetManagerProfile(manager_profile); if (view_)
diff --git a/chrome/browser/chromeos/login/ui/input_events_blocker.cc b/chrome/browser/chromeos/login/ui/input_events_blocker.cc index 43ad7da6..4959321 100644 --- a/chrome/browser/chromeos/login/ui/input_events_blocker.cc +++ b/chrome/browser/chromeos/login/ui/input_events_blocker.cc
@@ -15,7 +15,7 @@ // TODO(mash): Implement a mash version. This will probably need to talk to // the window server. if (!ash_util::IsRunningInMash()) { - ash::Shell::GetInstance()->PrependPreTargetHandler(this); + ash::Shell::Get()->PrependPreTargetHandler(this); VLOG(1) << "InputEventsBlocker " << this << " created."; } else { NOTIMPLEMENTED(); @@ -24,7 +24,7 @@ InputEventsBlocker::~InputEventsBlocker() { if (!ash_util::IsRunningInMash()) { - ash::Shell::GetInstance()->RemovePreTargetHandler(this); + ash::Shell::Get()->RemovePreTargetHandler(this); VLOG(1) << "InputEventsBlocker " << this << " destroyed."; } else { NOTIMPLEMENTED();
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index 5230a0d..e0fdaa03 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc
@@ -304,17 +304,17 @@ : public ui::EventHandler { public: KeyboardDrivenOobeKeyHandler() { - ash::Shell::GetInstance()->AddPreTargetHandler(this); + ash::Shell::Get()->AddPreTargetHandler(this); } ~KeyboardDrivenOobeKeyHandler() override { - ash::Shell::GetInstance()->RemovePreTargetHandler(this); + ash::Shell::Get()->RemovePreTargetHandler(this); } private: // ui::EventHandler void OnKeyEvent(ui::KeyEvent* event) override { if (event->key_code() == ui::VKEY_F6) { - ash::Shell::GetInstance()->GetPrimarySystemTray()->CloseSystemBubble(); + ash::Shell::Get()->GetPrimarySystemTray()->CloseSystemBubble(); event->StopPropagation(); } } @@ -379,7 +379,7 @@ } if (!ash_util::IsRunningInMash()) - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); else NOTIMPLEMENTED(); display::Screen::GetScreen()->AddObserver(this); @@ -498,7 +498,7 @@ } if (!ash_util::IsRunningInMash()) - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); else NOTIMPLEMENTED(); display::Screen::GetScreen()->RemoveObserver(this); @@ -561,9 +561,7 @@ // See crbug.com/541864. if (ash::WmShell::HasInstance() && finalize_animation_type_ != ANIMATION_ADD_USER) { - ash::Shell::GetInstance() - ->wallpaper_controller() - ->MoveToUnlockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer(); } switch (finalize_animation_type_) { @@ -687,7 +685,7 @@ ash::kShellWindowId_LockScreenContainersContainer); lock_container->layer()->SetOpacity(1.0); - ash::Shell::GetInstance()->wallpaper_controller()->MoveToLockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer(); } else { NOTIMPLEMENTED(); } @@ -950,9 +948,7 @@ if (!ash_util::IsRunningInMash()) { // For new user, move wallpaper to lock container so that windows created // during the user image picker step are below it. - ash::Shell::GetInstance() - ->wallpaper_controller() - ->MoveToLockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer(); } else { NOTIMPLEMENTED(); } @@ -1124,9 +1120,7 @@ if (ash::Shell::HasInstance() && finalize_animation_type_ == ANIMATION_ADD_USER) { if (!ash_util::IsRunningInMash()) { - ash::Shell::GetInstance() - ->wallpaper_controller() - ->MoveToUnlockedContainer(); + ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer(); } else { NOTIMPLEMENTED(); } @@ -1149,7 +1143,7 @@ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableLoginAnimations)) - ash::Shell::GetInstance()->DoInitialWorkspaceAnimation(); + ash::Shell::Get()->DoInitialWorkspaceAnimation(); } void LoginDisplayHostImpl::ScheduleFadeOutAnimation(int animation_speed_ms) {
diff --git a/chrome/browser/chromeos/login/ui/login_web_dialog_browsertest.cc b/chrome/browser/chromeos/login/ui/login_web_dialog_browsertest.cc index afaec93..2ae57ed 100644 --- a/chrome/browser/chromeos/login/ui/login_web_dialog_browsertest.cc +++ b/chrome/browser/chromeos/login/ui/login_web_dialog_browsertest.cc
@@ -25,7 +25,7 @@ aura::client::ActivationClient* activation_client = aura::client::GetActivationClient( - ash::Shell::GetInstance()->GetPrimaryRootWindow()); + ash::Shell::Get()->GetPrimaryRootWindow()); aura::Window* window = activation_client->GetActiveWindow(); ASSERT_TRUE(window); EXPECT_EQ(0, window->GetProperty(aura::client::kResizeBehaviorKey) &
diff --git a/chrome/browser/chromeos/login/ui/user_adding_screen.cc b/chrome/browser/chromeos/login/ui/user_adding_screen.cc index 92897ba8..11a5643 100644 --- a/chrome/browser/chromeos/login/ui/user_adding_screen.cc +++ b/chrome/browser/chromeos/login/ui/user_adding_screen.cc
@@ -64,7 +64,7 @@ CHECK(IsRunning()); // Make sure that system tray is enabled after this flow. - ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(true); + ash::Shell::Get()->GetPrimarySystemTray()->SetEnabled(true); display_host_->CancelUserAdding(); // Reset wallpaper if cancel adding user from multiple user sign in page.
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc index 7e964d5..594d1a8 100644 --- a/chrome/browser/chromeos/login/ui/webui_login_view.cc +++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
@@ -174,9 +174,8 @@ observer.OnHostDestroying(); if (!ash_util::IsRunningInMash() && - ash::Shell::GetInstance()->HasPrimaryStatusArea()) { - ash::Shell::GetInstance()->GetPrimarySystemTray()->SetNextFocusableView( - nullptr); + ash::Shell::Get()->HasPrimaryStatusArea()) { + ash::Shell::Get()->GetPrimarySystemTray()->SetNextFocusableView(nullptr); } else { NOTIMPLEMENTED(); } @@ -457,7 +456,7 @@ if (ash_util::IsRunningInMash()) return true; - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); if (tray && tray->GetWidget()->IsVisible()) { tray->SetNextFocusableView(this); ash::Shell::Get()->focus_cycler()->RotateFocus(
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc index 6ab667ec..960cc50 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -213,8 +213,7 @@ } else if (ash::Shell::HasInstance()) { // Note: Wallpaper setting is skipped in unit tests without shell instances. // In classic ash, interact with the WallpaperController class directly. - ash::Shell::GetInstance()->wallpaper_controller()->SetWallpaperImage( - image, layout); + ash::Shell::Get()->wallpaper_controller()->SetWallpaperImage(image, layout); } } @@ -473,7 +472,7 @@ // Zero delays is also set in autotests. if (WizardController::IsZeroDelayEnabled()) { // Ensure tests have some sort of wallpaper. - ash::Shell::GetInstance()->wallpaper_controller()->CreateEmptyWallpaper(); + ash::Shell::Get()->wallpaper_controller()->CreateEmptyWallpaper(); return; } @@ -1349,7 +1348,7 @@ default_large_wallpaper_file_ = default_large_wallpaper_file; ash::WallpaperController* controller = - ash::Shell::GetInstance()->wallpaper_controller(); + ash::Shell::Get()->wallpaper_controller(); // |need_update_screen| is true if the previous default wallpaper is visible // now, so we need to update wallpaper on the screen.
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc index f549c17..0fd97192 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc
@@ -72,7 +72,7 @@ ~WallpaperManagerBrowserTest() override {} void SetUpOnMainThread() override { - controller_ = ash::Shell::GetInstance()->wallpaper_controller(); + controller_ = ash::Shell::Get()->wallpaper_controller(); controller_->set_wallpaper_reload_delay_for_test(0); local_state_ = g_browser_process->local_state(); UpdateDisplay("800x600"); @@ -88,8 +88,7 @@ // Update the display configuration as given in |display_specs|. See // display::test::DisplayManagerTestApi::UpdateDisplay for more details. void UpdateDisplay(const std::string& display_specs) { - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay(display_specs); }
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc index 8cc1e308..f3af87ef 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_policy_browsertest.cc
@@ -123,7 +123,7 @@ // Obtain wallpaper image and return its average ARGB color. SkColor GetAverageWallpaperColor() { const gfx::ImageSkia image = - ash::Shell::GetInstance()->wallpaper_controller()->GetWallpaper(); + ash::Shell::Get()->wallpaper_controller()->GetWallpaper(); const gfx::ImageSkiaRep& representation = image.GetRepresentation(1.); if (representation.is_null()) { @@ -219,7 +219,7 @@ void SetUpOnMainThread() override { LoginManagerTest::SetUpOnMainThread(); - ash::Shell::GetInstance()->wallpaper_controller()->AddObserver(this); + ash::Shell::Get()->wallpaper_controller()->AddObserver(this); // Set up policy signing. user_policy_builders_[0] = GetUserPolicyBuilder(testUsers_[0]); @@ -227,7 +227,7 @@ } void TearDownOnMainThread() override { - ash::Shell::GetInstance()->wallpaper_controller()->RemoveObserver(this); + ash::Shell::Get()->wallpaper_controller()->RemoveObserver(this); LoginManagerTest::TearDownOnMainThread(); }
diff --git a/chrome/browser/chromeos/net/network_state_notifier_unittest.cc b/chrome/browser/chromeos/net/network_state_notifier_unittest.cc index c69dfb7..3b9bfb38 100644 --- a/chrome/browser/chromeos/net/network_state_notifier_unittest.cc +++ b/chrome/browser/chromeos/net/network_state_notifier_unittest.cc
@@ -8,7 +8,6 @@ #include "base/macros.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/shill_device_client.h" #include "chromeos/dbus/shill_service_client.h" @@ -113,7 +112,7 @@ } std::unique_ptr<NetworkConnectTestDelegate> network_connect_delegate_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; private: DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifierTest);
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc index b4912e2..39a9d04 100644 --- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc +++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
@@ -53,6 +53,10 @@ namespace { +using ReloadKeyCallback = + base::Callback<void(const scoped_refptr<PublicKey>& public_key, + const scoped_refptr<PrivateKey>& private_key)>; + bool IsOwnerInTests(const std::string& user_id) { if (user_id.empty() || !base::CommandLine::ForCurrentProcess()->HasSwitch( @@ -70,9 +74,7 @@ const scoped_refptr<OwnerKeyUtil>& owner_key_util, crypto::ScopedPK11Slot public_slot, crypto::ScopedPK11Slot private_slot, - const base::Callback<void(const scoped_refptr<PublicKey>& public_key, - const scoped_refptr<PrivateKey>& private_key)>& - callback) { + const ReloadKeyCallback& callback) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); std::vector<uint8_t> public_key_data; @@ -106,28 +108,39 @@ base::Bind(callback, public_key, private_key)); } -void LoadPrivateKeyOnIOThread( +void ContinueLoadPrivateKeyOnIOThread( const scoped_refptr<OwnerKeyUtil>& owner_key_util, const std::string username_hash, - const base::Callback<void(const scoped_refptr<PublicKey>& public_key, - const scoped_refptr<PrivateKey>& private_key)>& - callback) { + const ReloadKeyCallback& callback, + crypto::ScopedPK11Slot private_slot) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - crypto::EnsureNSSInit(); - crypto::ScopedPK11Slot public_slot = - crypto::GetPublicSlotForChromeOSUser(username_hash); - crypto::ScopedPK11Slot private_slot = crypto::GetPrivateSlotForChromeOSUser( - username_hash, base::Callback<void(crypto::ScopedPK11Slot)>()); - scoped_refptr<base::TaskRunner> task_runner = BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); task_runner->PostTask( FROM_HERE, - base::Bind(&LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util, - base::Passed(std::move(public_slot)), - base::Passed(std::move(private_slot)), callback)); + base::Bind( + &LoadPrivateKeyByPublicKeyOnWorkerThread, owner_key_util, + base::Passed(crypto::GetPublicSlotForChromeOSUser(username_hash)), + base::Passed(std::move(private_slot)), callback)); +} + +void LoadPrivateKeyOnIOThread(const scoped_refptr<OwnerKeyUtil>& owner_key_util, + const std::string username_hash, + const ReloadKeyCallback& callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + crypto::EnsureNSSInit(); + + auto continue_load_private_key_callback = + base::Bind(&ContinueLoadPrivateKeyOnIOThread, owner_key_util, + username_hash, callback); + + crypto::ScopedPK11Slot private_slot = crypto::GetPrivateSlotForChromeOSUser( + username_hash, continue_load_private_key_callback); + if (private_slot) + continue_load_private_key_callback.Run(std::move(private_slot)); } bool DoesPrivateKeyExistAsyncHelper(
diff --git a/chrome/browser/chromeos/policy/OWNERS b/chrome/browser/chromeos/policy/OWNERS index e327d8d..49269b3 100644 --- a/chrome/browser/chromeos/policy/OWNERS +++ b/chrome/browser/chromeos/policy/OWNERS
@@ -3,3 +3,5 @@ emaxx@chromium.org tnagel@chromium.org pastarmovj@chromium.org + +# COMPONENT: Enterprise
diff --git a/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc b/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc index 5815911..2b95c5d 100644 --- a/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_system_use_24hour_clock_browsertest.cc
@@ -76,7 +76,7 @@ static base::HourClockType TestGetPrimarySystemTrayTimeHourType() { const ash::TraySystemInfo* tray_system_info = - ash::Shell::GetInstance() + ash::Shell::Get() ->GetPrimarySystemTray() ->GetTraySystemInfoForTesting(); const ash::tray::TimeView* time_tray = @@ -87,7 +87,7 @@ static bool TestPrimarySystemTrayHasDateDefaultView() { const ash::TraySystemInfo* tray_system_info = - ash::Shell::GetInstance() + ash::Shell::Get() ->GetPrimarySystemTray() ->GetTraySystemInfoForTesting(); const ash::SystemInfoDefaultView* system_info_default_view = @@ -96,7 +96,7 @@ } static void TestPrimarySystemTrayCreateDefaultView() { - ash::TraySystemInfo* tray_system_info = ash::Shell::GetInstance() + ash::TraySystemInfo* tray_system_info = ash::Shell::Get() ->GetPrimarySystemTray() ->GetTraySystemInfoForTesting(); tray_system_info->CreateDefaultViewForTesting( @@ -105,7 +105,7 @@ static base::HourClockType TestGetPrimarySystemTrayDateHourType() { const ash::TraySystemInfo* tray_system_info = - ash::Shell::GetInstance() + ash::Shell::Get() ->GetPrimarySystemTray() ->GetTraySystemInfoForTesting(); const ash::SystemInfoDefaultView* system_info_default_view =
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler.cc index 44f55d7..a01c42a 100644 --- a/chrome/browser/chromeos/policy/display_rotation_default_handler.cc +++ b/chrome/browser/chromeos/policy/display_rotation_default_handler.cc
@@ -20,8 +20,8 @@ namespace policy { DisplayRotationDefaultHandler::DisplayRotationDefaultHandler() { - ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->window_tree_host_manager()->AddObserver(this); + ash::Shell::Get()->AddShellObserver(this); settings_observer_ = chromeos::CrosSettings::Get()->AddSettingsObserver( chromeos::kDisplayRotationDefault, base::Bind(&DisplayRotationDefaultHandler::OnCrosSettingsChanged, @@ -41,8 +41,8 @@ } void DisplayRotationDefaultHandler::OnWindowTreeHostManagerShutdown() { - ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); settings_observer_.reset(); base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); } @@ -64,7 +64,7 @@ rotation_in_progress_ = true; display::DisplayManager* const display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); const size_t num_displays = display_manager->GetNumDisplays(); for (size_t i = 0; i < num_displays; ++i) { const display::Display& display = display_manager->GetDisplayAt(i);
diff --git a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc index 204d364..140fdce9 100644 --- a/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc +++ b/chrome/browser/chromeos/policy/display_rotation_default_handler_browsertest.cc
@@ -41,7 +41,7 @@ namespace { display::DisplayManager* GetDisplayManager() { - return ash::Shell::GetInstance()->display_manager(); + return ash::Shell::Get()->display_manager(); } display::Display::Rotation GetRotationOfFirstDisplay() {
diff --git a/chrome/browser/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc b/chrome/browser/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc index 924ed4a..9b7538f 100644 --- a/chrome/browser/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc +++ b/chrome/browser/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc
@@ -41,8 +41,7 @@ ash::WindowPositioner::GetForceMaximizedWidthLimit() + 100; // Set resolution to 1466x300. const std::string resolution = base::IntToString(width) + "x300"; - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay(resolution); }
diff --git a/chrome/browser/chromeos/power/login_lock_state_notifier.cc b/chrome/browser/chromeos/power/login_lock_state_notifier.cc index b70ecc5e..f5a0022 100644 --- a/chrome/browser/chromeos/power/login_lock_state_notifier.cc +++ b/chrome/browser/chromeos/power/login_lock_state_notifier.cc
@@ -24,7 +24,7 @@ const ScreenLocker* locker = ScreenLocker::default_screen_locker(); bool locked = locker && locker->locked(); - ash::Shell::GetInstance()->OnLockStateChanged(locked); + ash::Shell::Get()->OnLockStateChanged(locked); } LoginLockStateNotifier::~LoginLockStateNotifier() {} @@ -35,11 +35,11 @@ const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_APP_TERMINATING: - ash::Shell::GetInstance()->OnAppTerminating(); + ash::Shell::Get()->OnAppTerminating(); break; case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { bool locked = *content::Details<bool>(details).ptr(); - ash::Shell::GetInstance()->OnLockStateChanged(locked); + ash::Shell::Get()->OnLockStateChanged(locked); break; } default:
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 58ff8f9..b8a4b6f3 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc
@@ -82,7 +82,7 @@ // Do not observe shell, if there is no shell instance; e.g., in some unit // tests. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); } Preferences::Preferences(input_method::InputMethodManager* input_method_manager) @@ -93,7 +93,7 @@ // Do not observe shell, if there is no shell instance; e.g., in some unit // tests. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); } Preferences::~Preferences() { @@ -102,7 +102,7 @@ // If shell instance is destoryed before this preferences instance, there is // no need to remove this shell observer. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); } // static @@ -552,8 +552,7 @@ // TODO: this needs to work in Config::MUS. http://crbug.com/705591. if (ash::Shell::HasInstance() && chromeos::GetAshConfig() == ash::Config::CLASSIC) { - ash::Shell::GetInstance()->display_manager() - ->SetUnifiedDesktopEnabled(enabled); + ash::Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(enabled); } } if (reason != REASON_PREF_CHANGED || pref_name == prefs::kNaturalScroll) { @@ -634,7 +633,7 @@ const bool enabled = touch_hud_projection_enabled_.GetValue(); // There may not be a shell, e.g., in some unit tests. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->SetTouchHudProjectionEnabled(enabled); + ash::Shell::Get()->SetTouchHudProjectionEnabled(enabled); } }
diff --git a/chrome/browser/chromeos/preferences_chromeos_browsertest.cc b/chrome/browser/chromeos/preferences_chromeos_browsertest.cc index 0233e32..fe2654d 100644 --- a/chrome/browser/chromeos/preferences_chromeos_browsertest.cc +++ b/chrome/browser/chromeos/preferences_chromeos_browsertest.cc
@@ -112,7 +112,7 @@ EXPECT_EQ(prefs->GetInteger(prefs::kTouchpadSensitivity), input_settings_->current_touchpad_settings().GetSensitivity()); EXPECT_EQ(prefs->GetBoolean(prefs::kTouchHudProjectionEnabled), - ash::Shell::GetInstance()->is_touch_hud_projection_enabled()); + ash::Shell::Get()->is_touch_hud_projection_enabled()); EXPECT_EQ(prefs->GetBoolean(prefs::kLanguageXkbAutoRepeatEnabled), keyboard_->auto_repeat_is_enabled_); input_method::AutoRepeatRate rate = keyboard_->last_auto_repeat_rate_;
diff --git a/chrome/browser/chromeos/shutdown_policy_browsertest.cc b/chrome/browser/chromeos/shutdown_policy_browsertest.cc index ee1b3e0f..306e2df 100644 --- a/chrome/browser/chromeos/shutdown_policy_browsertest.cc +++ b/chrome/browser/chromeos/shutdown_policy_browsertest.cc
@@ -145,18 +145,18 @@ // Opens the system tray menu. This creates the tray views. void OpenSystemTrayMenu() { - ash::Shell::GetInstance()->GetPrimarySystemTray()->ShowDefaultView( + ash::Shell::Get()->GetPrimarySystemTray()->ShowDefaultView( ash::BUBBLE_CREATE_NEW); } // Closes the system tray menu. This deletes the tray views. void CloseSystemTrayMenu() { - ash::Shell::GetInstance()->GetPrimarySystemTray()->CloseSystemBubble(); + ash::Shell::Get()->GetPrimarySystemTray()->CloseSystemBubble(); } // Gets the shutdown button view. const views::View* GetShutdownButton() { - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); return tray->GetTrayTilesForTesting() ->GetDefaultViewForTesting() ->GetShutdownButtonViewForTest();
diff --git a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc index 561a403..a00fd5fd 100644 --- a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc +++ b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
@@ -117,12 +117,13 @@ } ash::TrayAccessibility* tray() { - return ash::Shell::GetInstance()->GetPrimarySystemTray()-> - GetTrayAccessibilityForTest(); + return ash::Shell::Get() + ->GetPrimarySystemTray() + ->GetTrayAccessibilityForTest(); } const ash::TrayAccessibility* tray() const { - return ash::Shell::GetInstance() + return ash::Shell::Get() ->GetPrimarySystemTray() ->GetTrayAccessibilityForTest(); }
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller_unittest.cc b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller_unittest.cc index 49ab7119..5f35ecda 100644 --- a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller_unittest.cc +++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller_unittest.cc
@@ -135,8 +135,7 @@ TEST_F(AccessibilityFocusRingControllerTest, CursorWorksOnMultipleDisplays) { UpdateDisplay("400x400,500x500"); - aura::Window::Windows root_windows = - ash::Shell::GetInstance()->GetAllRootWindows(); + aura::Window::Windows root_windows = ash::Shell::Get()->GetAllRootWindows(); ASSERT_EQ(2u, root_windows.size()); AccessibilityHighlightManager highlight_manager;
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc b/chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc index 86963db4..c141ca4 100644 --- a/chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc +++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc
@@ -104,9 +104,9 @@ display::Display display = display::Screen::GetScreen()->GetDisplayMatching(bounds); - aura::Window* root_window = ash::Shell::GetInstance() - ->window_tree_host_manager() - ->GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = + ash::Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( + display.id()); CreateOrUpdateLayer(root_window, "AccessibilityFocusRing", bounds); }
diff --git a/chrome/browser/cryptauth/chrome_cryptauth_service.cc b/chrome/browser/cryptauth/chrome_cryptauth_service.cc index 6d45f25..3429a5e 100644 --- a/chrome/browser/cryptauth/chrome_cryptauth_service.cc +++ b/chrome/browser/cryptauth/chrome_cryptauth_service.cc
@@ -109,7 +109,7 @@ return device_info; display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); int64_t primary_display_id = display_manager->GetPrimaryDisplayCandidate().id(); display::ManagedDisplayInfo display_info =
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc index fb86a51..7633b2e 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -125,7 +125,7 @@ // keyboard gets the correct state of the hotrod keyboard through // chrome.virtualKeyboardPrivate.getKeyboardConfig. if (keyboard::IsKeyboardEnabled()) - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); } void ChromeVirtualKeyboardDelegate::SetKeyboardRestricted(bool restricted) { @@ -136,7 +136,7 @@ // Force virtual keyboard reload. if (keyboard::IsKeyboardEnabled()) - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); } bool ChromeVirtualKeyboardDelegate::LockKeyboard(bool state) { @@ -189,11 +189,10 @@ bool is_enabled = keyboard::IsKeyboardEnabled(); if (was_enabled == is_enabled) return true; - if (is_enabled) { - ash::Shell::GetInstance()->CreateKeyboard(); - } else { - ash::Shell::GetInstance()->DeactivateKeyboard(); - } + if (is_enabled) + ash::Shell::Get()->CreateKeyboard(); + else + ash::Shell::Get()->DeactivateKeyboard(); return true; }
diff --git a/chrome/browser/extensions/display_info_provider_chromeos.cc b/chrome/browser/extensions/display_info_provider_chromeos.cc index a5a37a74..a2de92c 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos.cc
@@ -40,8 +40,7 @@ int64_t display_id; if (!base::StringToInt64(display_id_str, &display_id)) return display::Display(); - return ash::Shell::GetInstance()->display_manager()->GetDisplayForId( - display_id); + return ash::Shell::Get()->display_manager()->GetDisplayForId(display_id); } // Checks if the given integer value is valid display rotation in degrees. @@ -223,9 +222,8 @@ layout->placement_list.push_back(placement); layout->primary_id = primary_display_id; - ash::Shell::GetInstance() - ->display_configuration_controller() - ->SetDisplayLayout(std::move(layout)); + ash::Shell::Get()->display_configuration_controller()->SetDisplayLayout( + std::move(layout)); } // Validates that parameters passed to the SetInfo function are valid for the @@ -350,7 +348,7 @@ if (!display::Display::IsInternalDisplayId(id)) { // For external displays, show a notification confirming the resolution // change. - ash::Shell::GetInstance() + ash::Shell::Get() ->resolution_notification_controller() ->PrepareNotification(id, current_mode, new_mode, base::Bind(&chromeos::StoreDisplayPrefs)); @@ -411,7 +409,7 @@ } bool IsMaximizeModeWindowManagerEnabled() { - return ash::Shell::GetInstance() + return ash::Shell::Get() ->maximize_mode_controller() ->IsMaximizeModeWindowManagerEnabled(); } @@ -460,9 +458,9 @@ return false; } display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); ash::DisplayConfigurationController* display_configuration_controller = - ash::Shell::GetInstance()->display_configuration_controller(); + ash::Shell::Get()->display_configuration_controller(); const display::Display target = GetDisplay(display_id_str); @@ -501,9 +499,8 @@ if (info.rotation) { if (IsMaximizeModeWindowManagerEnabled() && display_id == display::Display::InternalDisplayId()) { - ash::Shell::GetInstance() - ->screen_orientation_controller() - ->SetLockToRotation(DegreesToRotation(*info.rotation)); + ash::Shell::Get()->screen_orientation_controller()->SetLockToRotation( + DegreesToRotation(*info.rotation)); } else { display_configuration_controller->SetDisplayRotation( display_id, DegreesToRotation(*info.rotation), @@ -537,7 +534,7 @@ return false; } display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); display::DisplayLayoutBuilder builder( display_manager->GetCurrentResolvedDisplayLayout()); @@ -569,9 +566,8 @@ LOG(ERROR) << "Invalid layout: Validate failed."; return false; } - ash::Shell::GetInstance() - ->display_configuration_controller() - ->SetDisplayLayout(std::move(layout)); + ash::Shell::Get()->display_configuration_controller()->SetDisplayLayout( + std::move(layout)); return true; } @@ -584,7 +580,7 @@ return; } display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); unit->name = display_manager->GetDisplayNameForId(display.id()); if (display_manager->IsInMirrorMode()) { unit->mirroring_source_id = @@ -619,8 +615,7 @@ NOTIMPLEMENTED(); return; } - ash::Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled( - enable); + ash::Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(enable); } DisplayInfoProvider::DisplayUnitInfoList @@ -631,7 +626,7 @@ return DisplayInfoProvider::DisplayUnitInfoList(); } display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); if (!display_manager->IsInUnifiedMode()) return DisplayInfoProvider::GetAllDisplaysInfo(); @@ -659,7 +654,7 @@ return DisplayInfoProvider::DisplayLayoutList(); } display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); if (display_manager->num_connected_displays() < 2) return DisplayInfoProvider::DisplayLayoutList(); @@ -696,7 +691,7 @@ if (display.id() == display::kInvalidDisplayId) return false; auto insets = - ash::Shell::GetInstance()->window_tree_host_manager()->GetOverscanInsets( + ash::Shell::Get()->window_tree_host_manager()->GetOverscanInsets( display.id()); overscan_calibrators_[id].reset( new chromeos::OverscanCalibrator(display, insets)); @@ -782,8 +777,7 @@ custom_touch_calibration_active_ = true; // Enable un-transformed touch input. - ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( - true); + ash::Shell::Get()->touch_transformer_controller()->SetForCalibration(true); return true; } @@ -798,8 +792,7 @@ } VLOG(1) << "CompleteCustomTouchCalibration: " << touch_calibration_target_id_; - ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( - false); + ash::Shell::Get()->touch_transformer_controller()->SetForCalibration(false); const display::Display display = GetDisplay(touch_calibration_target_id_); touch_calibration_target_id_.clear(); @@ -847,7 +840,7 @@ } gfx::Size display_size(bounds.width, bounds.height); - ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( + ash::Shell::Get()->display_manager()->SetTouchCalibrationData( display.id(), calibration_points, display_size); return true; } @@ -867,8 +860,7 @@ return false; } - ash::Shell::GetInstance()->display_manager()->ClearTouchCalibrationData( - display.id()); + ash::Shell::Get()->display_manager()->ClearTouchCalibrationData(display.id()); return true; }
diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc index 38e9950a..e4f65f2 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
@@ -32,7 +32,7 @@ using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList; void EnableMaximizeMode(bool enable) { - ash::Shell::GetInstance() + ash::Shell::Get() ->maximize_mode_controller() ->EnableMaximizeModeWindowManager(enable); } @@ -67,7 +67,7 @@ } display::DisplayManager* GetDisplayManager() const { - return ash::Shell::GetInstance()->display_manager(); + return ash::Shell::Get()->display_manager(); } std::string SystemInfoDisplayInsetsToString( @@ -912,7 +912,7 @@ // upon exiting maximize mode, and that a rotation lock is not set. TEST_F(DisplayInfoProviderChromeosTest, SetRotationBeforeMaximizeMode) { ash::ScreenOrientationController* screen_orientation_controller = - ash::Shell::GetInstance()->screen_orientation_controller(); + ash::Shell::Get()->screen_orientation_controller(); api::system_display::DisplayProperties info; info.rotation.reset(new int(90)); @@ -950,10 +950,9 @@ // Entering maximize mode enables accelerometer screen rotations. EnableMaximizeMode(true); - ASSERT_FALSE(ash::Shell::GetInstance() - ->screen_orientation_controller() - ->rotation_locked()); - ASSERT_FALSE(ash::Shell::GetInstance() + ASSERT_FALSE( + ash::Shell::Get()->screen_orientation_controller()->rotation_locked()); + ASSERT_FALSE(ash::Shell::Get() ->screen_orientation_controller() ->user_rotation_locked()); @@ -968,10 +967,9 @@ ASSERT_TRUE(success); EXPECT_TRUE(error.empty()); - EXPECT_TRUE(ash::Shell::GetInstance() - ->screen_orientation_controller() - ->rotation_locked()); - EXPECT_TRUE(ash::Shell::GetInstance() + EXPECT_TRUE( + ash::Shell::Get()->screen_orientation_controller()->rotation_locked()); + EXPECT_TRUE(ash::Shell::Get() ->screen_orientation_controller() ->user_rotation_locked()); } @@ -1130,8 +1128,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanForInternal) { UpdateDisplay("1200x600,600x1000*2"); const int64_t internal_display_id = - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); api::system_display::DisplayProperties info; @@ -1208,8 +1205,7 @@ TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationInternal) { UpdateDisplay("1200x600,600x1000*2"); const int64_t internal_display_id = - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); std::string id = base::Int64ToString(internal_display_id); @@ -1246,8 +1242,7 @@ UpdateDisplay("1200x600,600x1000*2"); const int64_t internal_display_id = - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); display::DisplayIdList display_id_list = @@ -1258,8 +1253,7 @@ ? display_id_list[1] : display_id_list[0]; - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .SetTouchSupport(display_id, display::Display::TOUCH_SUPPORT_UNAVAILABLE); std::string id = base::Int64ToString(display_id);
diff --git a/chrome/browser/extensions/native_bindings_apitest.cc b/chrome/browser/extensions/native_bindings_apitest.cc index 285a811..51a44aa 100644 --- a/chrome/browser/extensions/native_bindings_apitest.cc +++ b/chrome/browser/extensions/native_bindings_apitest.cc
@@ -18,6 +18,7 @@ #include "extensions/browser/process_manager.h" #include "extensions/common/switches.h" #include "extensions/test/extension_test_message_listener.h" +#include "extensions/test/result_catcher.h" #include "net/dns/mock_host_resolver.h" namespace extensions { @@ -119,4 +120,29 @@ ASSERT_TRUE(RunPlatformAppTest("native_bindings/instance_of")) << message_; } +// Tests the webRequest API, which requires IO thread requests and custom +// events. +IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, WebRequest) { + host_resolver()->AddRule("*", "127.0.0.1"); + embedded_test_server()->ServeFilesFromDirectory(test_data_dir_); + ASSERT_TRUE(StartEmbeddedTestServer()); + // Load an extension and wait for it to be ready. + ResultCatcher catcher; + const Extension* extension = + LoadExtension(test_data_dir_.AppendASCII("native_bindings/web_request")); + ASSERT_TRUE(extension); + ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); + + ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL( + "example.com", "/native_bindings/simple.html")); + + GURL expected_url = embedded_test_server()->GetURL( + "example.com", "/native_bindings/simple2.html"); + EXPECT_EQ(expected_url, browser() + ->tab_strip_model() + ->GetActiveWebContents() + ->GetLastCommittedURL()); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index 75c6c40..2848f995 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -208,7 +208,6 @@ if (installed_extension) { std::string install_message; webstore_install::Result install_result = webstore_install::SUCCESS; - bool done = true; if (ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) { // Don't install a blacklisted extension. @@ -220,10 +219,8 @@ extension_service->EnableExtension(id_); } // else extension is installed and enabled; no work to be done. - if (done) { - CompleteInstall(install_result, install_message); - return; - } + CompleteInstall(install_result, install_message); + return; } scoped_refptr<WebstoreInstaller> installer =
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 6b3dd6e2..ce5c323 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2298,6 +2298,13 @@ "If enabled, the content suggestions (on the NTP) will get favicons from a " "new favicon server."; +const char kEnableContentSuggestionsSettingsName[] = + "Show content suggestions settings."; + +const char kEnableContentSuggestionsSettingsDescription[] = + "If enabled, the content suggestions settings will be available from the " + "main settings menu."; + const char kEnableNtpRemoteSuggestionsName[] = "Show server-side suggestions on the New Tab page";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index e88d32ee..03201119 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2500,6 +2500,13 @@ // on the New Tab Page. extern const char kEnableContentSuggestionsNewFaviconServerDescription[]; +// Name for the flag to enable the settings entry for content suggestions. +extern const char kEnableContentSuggestionsSettingsName[]; + +// Description for the flag to enable the settings entry for content +// suggestions. +extern const char kEnableContentSuggestionsSettingsDescription[]; + // Name for the flag to enable server-side suggestions on the New Tab Page. extern const char kEnableNtpRemoteSuggestionsName[];
diff --git a/chrome/browser/fullscreen_chromeos.cc b/chrome/browser/fullscreen_chromeos.cc index 3efdaff..8ceaecd4 100644 --- a/chrome/browser/fullscreen_chromeos.cc +++ b/chrome/browser/fullscreen_chromeos.cc
@@ -18,7 +18,7 @@ } for (ash::RootWindowController* controller : - ash::Shell::GetInstance()->GetAllRootWindowControllers()) { + ash::Shell::Get()->GetAllRootWindowControllers()) { if (display::Screen::GetScreen() ->GetDisplayNearestWindow(controller->GetRootWindow()) .id() == display_id) {
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc index 91939e0..d965613c 100644 --- a/chrome/browser/google/google_update_win.cc +++ b/chrome/browser/google/google_update_win.cc
@@ -531,7 +531,7 @@ hresult = dispatch.QueryInterface(app_bundle.Receive()); if (FAILED(hresult)) return hresult; - dispatch.Release(); + dispatch.Reset(); ConfigureProxyBlanket(app_bundle.get()); @@ -818,10 +818,10 @@ // Release the reference on the COM objects before bouncing back to the // caller's thread. - state.Release(); - app_.Release(); - app_bundle_.Release(); - google_update_.Release(); + state.Reset(); + app_.Reset(); + app_bundle_.Reset(); + google_update_.Reset(); result_runner_->DeleteSoon(FROM_HERE, this); }
diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index ed2202f..8907b98 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc
@@ -519,7 +519,7 @@ // Cleans up. url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0); url_history_stg2->DeleteUrl(kIECacheItemUrl, 0); - url_history_stg2.Release(); + url_history_stg2.Reset(); } IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest,
diff --git a/chrome/browser/local_discovery/local_domain_resolver_unittest.cc b/chrome/browser/local_discovery/local_domain_resolver_unittest.cc index d29a4e4..241c3a1 100644 --- a/chrome/browser/local_discovery/local_domain_resolver_unittest.cc +++ b/chrome/browser/local_discovery/local_domain_resolver_unittest.cc
@@ -7,7 +7,6 @@ #include "base/location.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" -#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/service_discovery_client_impl.h" #include "net/dns/mdns_client_impl.h" @@ -101,7 +100,7 @@ net::MockMDnsSocketFactory socket_factory_; net::MDnsClientImpl mdns_client_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; }; TEST_F(LocalDomainResolverTest, ResolveDomainA) {
diff --git a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc index 86f8318..4a38ec9 100644 --- a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc +++ b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc
@@ -314,7 +314,7 @@ #if defined(OS_CHROMEOS) screen_id = content::DesktopMediaID::RegisterAuraWindow( content::DesktopMediaID::TYPE_SCREEN, - ash::Shell::GetInstance()->GetPrimaryRootWindow()); + ash::Shell::Get()->GetPrimaryRootWindow()); #else // defined(OS_CHROMEOS) screen_id = content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN, webrtc::kFullDesktopScreenId);
diff --git a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc index da81ce50..2238ad1f 100644 --- a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc +++ b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc
@@ -373,9 +373,9 @@ if (IsOriginForCasting(security_origin) && IsVideoMediaType(stream_type)) { // Notify ash that casting state has changed. if (state == content::MEDIA_REQUEST_STATE_DONE) { - ash::Shell::GetInstance()->OnCastingSessionStartedOrStopped(true); + ash::Shell::Get()->OnCastingSessionStartedOrStopped(true); } else if (state == content::MEDIA_REQUEST_STATE_CLOSING) { - ash::Shell::GetInstance()->OnCastingSessionStartedOrStopped(false); + ash::Shell::Get()->OnCastingSessionStartedOrStopped(false); } } #endif
diff --git a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc index ba3ad736..a23308cb 100644 --- a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc
@@ -272,8 +272,7 @@ } #if defined(OS_LINUX) -// Disabled due to failure. http://crbug.com/648181. -#define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInteropTest +#define MAYBE_MANUAL_FirefoxApprtcInteropTest MANUAL_FirefoxApprtcInteropTest #else // Not implemented yet on Windows and Mac. #define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInteropTest
diff --git a/chrome/browser/media_galleries/win/snapshot_file_details.cc b/chrome/browser/media_galleries/win/snapshot_file_details.cc index d57df4a7..5ad3678 100644 --- a/chrome/browser/media_galleries/win/snapshot_file_details.cc +++ b/chrome/browser/media_galleries/win/snapshot_file_details.cc
@@ -45,7 +45,7 @@ default; SnapshotFileDetails::~SnapshotFileDetails() { - file_stream_.Release(); + file_stream_.Reset(); } void SnapshotFileDetails::set_file_info(const base::File::Info& file_info) {
diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos.cc index cfe8407..d831ecac 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos.cc
@@ -24,7 +24,7 @@ // when running as a mus client (ash::Shell is not initialized when that is // the case). if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); // LoginState may not exist in some tests. if (chromeos::LoginState::IsInitialized()) @@ -40,7 +40,7 @@ chromeos::LoginState::Get()->RemoveObserver(this); if (observing_) { if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); chromeos::UserAddingScreen::Get()->RemoveObserver(this); } } @@ -69,7 +69,7 @@ void LoginStateNotificationBlockerChromeOS::OnAppTerminating() { if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); chromeos::UserAddingScreen::Get()->RemoveObserver(this); observing_ = false; }
diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc index e28ed29..d4c0eed 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc
@@ -93,12 +93,12 @@ EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); // Lock. - ash::Shell::GetInstance()->OnLockStateChanged(true); + ash::Shell::Get()->OnLockStateChanged(true); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); // Unlock. - ash::Shell::GetInstance()->OnLockStateChanged(false); + ash::Shell::Get()->OnLockStateChanged(false); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); } @@ -127,12 +127,12 @@ EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); // Lock. - ash::Shell::GetInstance()->OnLockStateChanged(true); + ash::Shell::Get()->OnLockStateChanged(true); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); // Unlock. - ash::Shell::GetInstance()->OnLockStateChanged(false); + ash::Shell::Get()->OnLockStateChanged(false); EXPECT_EQ(1, GetStateChangedCountAndReset()); EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); }
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc index 9376d91c..1feebb4 100644 --- a/chrome/browser/notifications/message_center_notification_manager.cc +++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -291,7 +291,7 @@ #if defined(USE_ASH) if (ash::Shell::HasInstance()) { ash::WebNotificationTray* tray = - ash::Shell::GetInstance()->GetWebNotificationTray(); + ash::Shell::Get()->GetWebNotificationTray(); if (tray) tray->GetMessageCenterTray()->HideMessageCenterBubble(); }
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm index 3e81cd6..50a54b6 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -144,23 +144,16 @@ // TODO(miguelg) do not remove banners if possible. [notification_center_ removeAllDeliveredNotifications]; -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) [alert_dispatcher_ closeAllNotifications]; -#endif // BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) } // static NotificationPlatformBridge* NotificationPlatformBridge::Create() { -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) base::scoped_nsobject<AlertDispatcherImpl> alert_dispatcher( [[AlertDispatcherImpl alloc] init]); return new NotificationPlatformBridgeMac( [NSUserNotificationCenter defaultUserNotificationCenter], alert_dispatcher.get()); -#else - return new NotificationPlatformBridgeMac( - [NSUserNotificationCenter defaultUserNotificationCenter], nil); -#endif // ENABLE_XPC_NOTIFICATIONS } void NotificationPlatformBridgeMac::Display( @@ -232,7 +225,6 @@ [builder setIncognito:incognito]; [builder setNotificationType:[NSNumber numberWithInteger:notification_type]]; -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) // Send persistent notifications to the XPC service so they // can be displayed as alerts. Chrome itself can only display // banners. @@ -243,10 +235,6 @@ NSUserNotification* toast = [builder buildUserNotification]; [notification_center_ deliverNotification:toast]; } -#else - NSUserNotification* toast = [builder buildUserNotification]; - [notification_center_ deliverNotification:toast]; -#endif // ENABLE_XPC_NOTIFICATIONS } void NotificationPlatformBridgeMac::Close(const std::string& profile_id, @@ -270,49 +258,24 @@ break; } } -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) + // If no banner existed with that ID try to see if there is an alert // in the xpc server. if (!notification_removed) { [alert_dispatcher_ closeNotificationWithId:candidate_id withProfileId:current_profile_id]; } -#endif // ENABLE_XPC_NOTIFICATIONS } void NotificationPlatformBridgeMac::GetDisplayed( const std::string& profile_id, bool incognito, const GetDisplayedNotificationsCallback& callback) const { -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) [alert_dispatcher_ getDisplayedAlertsForProfileId:base::SysUTF8ToNSString(profile_id) incognito:incognito notificationCenter:notification_center_ callback:callback]; - -#else - - auto displayed_notifications = base::MakeUnique<std::set<std::string>>(); - NSString* current_profile_id = base::SysUTF8ToNSString(profile_id); - for (NSUserNotification* toast in - [notification_center_ deliveredNotifications]) { - NSString* toast_profile_id = [toast.userInfo - objectForKey:notification_constants::kNotificationProfileId]; - BOOL incognito_notification = [[toast.userInfo - objectForKey:notification_constants::kNotificationIncognito] boolValue]; - if ([toast_profile_id isEqualToString:current_profile_id] && - incognito == incognito_notification) { - displayed_notifications->insert(base::SysNSStringToUTF8([toast.userInfo - objectForKey:notification_constants::kNotificationId])); - } - } - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(callback, base::Passed(&displayed_notifications), - true /* supports_synchronization */)); - -#endif // ENABLE_XPC_NOTIFICATIONS } // static
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm index dda2975..e633c457 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
@@ -204,7 +204,8 @@ CreateBanner("Title", "Context", "https://gmail.com", nullptr, nullptr); std::unique_ptr<NotificationPlatformBridgeMac> bridge( - new NotificationPlatformBridgeMac(notification_center(), nil)); + new NotificationPlatformBridgeMac(notification_center(), + alert_dispatcher())); bridge->Display(NotificationCommon::PERSISTENT, "notification_id", "profile_id", false, *notification); NSArray* notifications = [notification_center() deliveredNotifications]; @@ -224,7 +225,8 @@ "Title", "Context", "https://gmail.com", "Button 1", nullptr); std::unique_ptr<NotificationPlatformBridgeMac> bridge( - new NotificationPlatformBridgeMac(notification_center(), nil)); + new NotificationPlatformBridgeMac(notification_center(), + alert_dispatcher())); bridge->Display(NotificationCommon::PERSISTENT, "notification_id", "profile_id", false, *notification); @@ -243,7 +245,8 @@ "Title", "Context", "https://gmail.com", "Button 1", nullptr); std::unique_ptr<NotificationPlatformBridgeMac> bridge( - new NotificationPlatformBridgeMac(notification_center(), nil)); + new NotificationPlatformBridgeMac(notification_center(), + alert_dispatcher())); EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); bridge->Display(NotificationCommon::PERSISTENT, "notification_id", "profile_id", false, *notification); @@ -258,7 +261,8 @@ "Title", "Context", "https://gmail.com", "Button 1", nullptr); std::unique_ptr<NotificationPlatformBridgeMac> bridge( - new NotificationPlatformBridgeMac(notification_center(), nil)); + new NotificationPlatformBridgeMac(notification_center(), + alert_dispatcher())); EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); bridge->Display(NotificationCommon::PERSISTENT, "notification_id", "profile_id", false, *notification); @@ -310,7 +314,8 @@ "Title", "Context", "https://gmail.com", "Button 1", nullptr); { std::unique_ptr<NotificationPlatformBridgeMac> bridge( - new NotificationPlatformBridgeMac(notification_center(), nil)); + new NotificationPlatformBridgeMac(notification_center(), + alert_dispatcher())); EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); bridge->Display(NotificationCommon::PERSISTENT, "notification_id", "profile_id", false, *notification); @@ -321,9 +326,6 @@ EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); } -// TODO(miguelg) There is some duplication between these tests and the ones -// Above. Once the flag is removed most tests can be merged. -#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS) TEST_F(NotificationPlatformBridgeMacTest, TestDisplayAlert) { std::unique_ptr<Notification> alert = CreateAlert("Title", "Context", "https://gmail.com", "Button 1", nullptr); @@ -390,5 +392,3 @@ EXPECT_EQ(0u, [[notification_center() deliveredNotifications] count]); EXPECT_EQ(0u, [[alert_dispatcher() alerts] count]); } - -#endif
diff --git a/chrome/browser/plugins/flash_permission_browsertest.cc b/chrome/browser/plugins/flash_permission_browsertest.cc index 921a877..e6dac6c 100644 --- a/chrome/browser/plugins/flash_permission_browsertest.cc +++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -102,7 +102,9 @@ CommonFailsIfDismissed(); } -IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, CommonFailsIfBlocked) { +// https://crbug.com/706780 +IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, + DISABLED_CommonFailsIfBlocked) { CommonFailsIfBlocked(); }
diff --git a/chrome/browser/policy/OWNERS b/chrome/browser/policy/OWNERS index 6b620f3..f7cdd195 100644 --- a/chrome/browser/policy/OWNERS +++ b/chrome/browser/policy/OWNERS
@@ -3,3 +3,5 @@ tnagel@chromium.org emaxx@chromium.org pastarmovj@chromium.org + +# COMPONENT: Enterprise
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 8a68669..2238c40 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -4145,7 +4145,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, UnifiedDesktopEnabledByDefault) { // Verify that Unified Desktop can be enabled by policy display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); // The policy description promises that Unified Desktop is not available // unless the policy is set (or a command line or an extension is used). If
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 981ebb4d..22e9b03 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -149,6 +149,9 @@ using prerender::test_utils::TestPrerenderContents; using task_manager::browsertest_util::WaitForTaskManagerRows; +// crbug.com/708158 +#if !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER) + // Prerender tests work as follows: // // A page with a prefetch link to the test page is loaded. Once prerendered, @@ -2038,52 +2041,28 @@ ASSERT_TRUE(IsEmptyPrerenderLinkManager()); } -// crbug.com/708158 -#if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) -#define MAYBE_PrerenderPageNavigateFragment \ - DISABLED_PrerenderPageNavigateFragment -#else -#define MAYBE_PrerenderPageNavigateFragment PrerenderPageNavigateFragment -#endif // Checks that we do not use a prerendered page when navigating from // the main page to a fragment. -IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, - MAYBE_PrerenderPageNavigateFragment) { +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageNavigateFragment) { PrerenderTestURL("/prerender/no_prerender_page.html", FINAL_STATUS_APP_TERMINATING, 1); NavigateToURLWithDisposition("/prerender/no_prerender_page.html#fragment", WindowOpenDisposition::CURRENT_TAB, false); } -// crbug.com/708158 -#if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) -#define MAYBE_PrerenderFragmentNavigatePage \ - DISABLED_PrerenderFragmentNavigatePage -#else -#define MAYBE_PrerenderFragmentNavigatePage PrerenderFragmentNavigatePage -#endif // Checks that we do not use a prerendered page when we prerender a fragment // but navigate to the main page. -IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, - MAYBE_PrerenderFragmentNavigatePage) { +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFragmentNavigatePage) { PrerenderTestURL("/prerender/no_prerender_page.html#fragment", FINAL_STATUS_APP_TERMINATING, 1); NavigateToURLWithDisposition("/prerender/no_prerender_page.html", WindowOpenDisposition::CURRENT_TAB, false); } -// crbug.com/708158 -#if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) -#define MAYBE_PrerenderFragmentNavigateFragment \ - DISABLED_PrerenderFragmentNavigateFragment -#else -#define MAYBE_PrerenderFragmentNavigateFragment \ - PrerenderFragmentNavigateFragment -#endif // Checks that we do not use a prerendered page when we prerender a fragment // but navigate to a different fragment on the same page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, - MAYBE_PrerenderFragmentNavigateFragment) { + PrerenderFragmentNavigateFragment) { PrerenderTestURL("/prerender/no_prerender_page.html#other_fragment", FINAL_STATUS_APP_TERMINATING, 1); NavigateToURLWithDisposition("/prerender/no_prerender_page.html#fragment", @@ -3104,15 +3083,8 @@ ui_test_utils::NavigateToURL(current_browser(), dest_url()); } -// crbug.com/708158 -#if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) -#define MAYBE_PrerenderExtraHeadersNoSwap DISABLED_PrerenderExtraHeadersNoSwap -#else -#define MAYBE_PrerenderExtraHeadersNoSwap PrerenderExtraHeadersNoSwap -#endif // Checks that prerenders are not swapped for navigations with extra headers. -IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, - MAYBE_PrerenderExtraHeadersNoSwap) { +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderExtraHeadersNoSwap) { PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_APP_TERMINATING, 1); @@ -3820,3 +3792,5 @@ #endif // !defined(DISABLE_NACL) } // namespace prerender + +#endif // !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER)
diff --git a/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc b/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc index 54d7ad0f..18249f8 100644 --- a/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc +++ b/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
@@ -7,7 +7,6 @@ #include <memory> #include "base/memory/ptr_util.h" -#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h" @@ -118,7 +117,7 @@ protected: StrictMock<MockPrivetNotificationsListenerDeleagate> mock_delegate_; std::unique_ptr<PrivetNotificationsListener> notification_listener_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; scoped_refptr<net::TestURLRequestContextGetter> request_context_; net::TestURLFetcherFactory fetcher_factory_; DeviceDescription description_;
diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc index 5166ee48..56808a8 100644 --- a/chrome/browser/process_singleton_posix_unittest.cc +++ b/chrome/browser/process_singleton_posix_unittest.cc
@@ -27,7 +27,6 @@ #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/synchronization/waitable_event.h" -#include "base/test/scoped_task_environment.h" #include "base/test/test_timeouts.h" #include "base/test/thread_test_helper.h" #include "base/threading/thread.h" @@ -258,7 +257,7 @@ kill_callbacks_++; } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; content::TestBrowserThread io_thread_; base::ScopedTempDir temp_dir_; base::WaitableEvent wait_event_;
diff --git a/chrome/browser/renderer_context_menu/open_with_menu_factory_ash.cc b/chrome/browser/renderer_context_menu/open_with_menu_factory_ash.cc index 6b81537..cf58f91 100644 --- a/chrome/browser/renderer_context_menu/open_with_menu_factory_ash.cc +++ b/chrome/browser/renderer_context_menu/open_with_menu_factory_ash.cc
@@ -52,7 +52,7 @@ if (!ash::Shell::HasInstance()) return; ash::LinkHandlerModelFactory* factory = - ash::Shell::GetInstance()->link_handler_model_factory(); + ash::Shell::Get()->link_handler_model_factory(); if (!factory) return;
diff --git a/chrome/browser/resources/settings/people_page/compiled_resources2.gyp b/chrome/browser/resources/settings/people_page/compiled_resources2.gyp index ddb39b3..7be4018 100644 --- a/chrome/browser/resources/settings/people_page/compiled_resources2.gyp +++ b/chrome/browser/resources/settings/people_page/compiled_resources2.gyp
@@ -212,6 +212,7 @@ 'target_name': 'user_list', 'dependencies': [ '../compiled_resources2.gyp:route', + '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior', '<(EXTERNS_GYP):settings_private', '<(EXTERNS_GYP):users_private', ],
diff --git a/chrome/browser/resources/settings/people_page/user_list.html b/chrome/browser/resources/settings/people_page/user_list.html index 560410b21..1b58e3f2 100644 --- a/chrome/browser/resources/settings/people_page/user_list.html +++ b/chrome/browser/resources/settings/people_page/user_list.html
@@ -1,4 +1,5 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> +<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> @@ -37,10 +38,7 @@ <div class="user layout horizontal center two-line"> <img class="user-icon" src="[[getProfilePictureUrl_(item.name)]]"> <div class="flex user-info"> - <div> - [[item.name]] - <span hidden="[[!item.isOwner]]">$i18n{deviceOwnerLabel}</span> - </div> + <div>[[getUserName_(item)]]</div> <div class="secondary">[[item.email]]</div> </div> <paper-icon-button icon="cr:clear" class="clear-icon"
diff --git a/chrome/browser/resources/settings/people_page/user_list.js b/chrome/browser/resources/settings/people_page/user_list.js index 21f3b530..9d3d3b9 100644 --- a/chrome/browser/resources/settings/people_page/user_list.js +++ b/chrome/browser/resources/settings/people_page/user_list.js
@@ -15,9 +15,7 @@ Polymer({ is: 'settings-user-list', - behaviors: [ - settings.RouteObserverBehavior, - ], + behaviors: [I18nBehavior, settings.RouteObserverBehavior], properties: { /** @@ -26,7 +24,9 @@ */ users_: { type: Array, - value: function() { return []; }, + value: function() { + return []; + }, notify: true }, @@ -37,7 +37,7 @@ */ disabled: { type: Boolean, - value: false + value: false, } }, @@ -64,6 +64,15 @@ }, /** + * @param {!chrome.usersPrivate.User} user + * @return {string} + * @private + */ + getUserName_: function(user) { + return user.isOwner ? this.i18n('deviceOwnerLabel', user.name) : user.name; + }, + + /** * Helper function that sorts and sets the given list of whitelisted users. * @param {!Array<!chrome.usersPrivate.User>} users List of whitelisted users. */
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.css b/chrome/browser/resources/vr_shell/vr_shell_ui.css index fd24f77..025a3bc3 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui.css +++ b/chrome/browser/resources/vr_shell/vr_shell_ui.css
@@ -134,6 +134,7 @@ #back-button, #forward-button, +#exit-present-button, #back-indicator, #forward-indicator { background-image: url(../../../../ui/webui/resources/images/vr_back.svg);
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.html b/chrome/browser/resources/vr_shell/vr_shell_ui.html index 53ece4c..8d65649 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui.html +++ b/chrome/browser/resources/vr_shell/vr_shell_ui.html
@@ -67,6 +67,7 @@ <div id="back-button" class="round-button ui-element"></div> <div id="reload-button" class="round-button ui-element"></div> <div id="forward-button" class="round-button ui-element"></div> + <div id="exit-present-button" class="round-button ui-element"></div> <div id="back-button-caption" class="button-caption ui-element"> $i18n{back} </div> @@ -76,6 +77,9 @@ <div id="forward-button-caption" class="button-caption ui-element"> $i18n{forward} </div> + <div id="exit-present-button-caption" class="button-caption ui-element"> + $i18n{exitPresent} + </div> <div id="reload-ui-button" class="ui-element">Reload UI</div> <div id="content-interceptor" class="ui-element"></div> <div id="tab-template" class="tab"></div>
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js index 4d552f8d..214da76 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui.js +++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -391,6 +391,7 @@ class Controls { constructor(contentQuadId) { this.enabled = false; + this.exitPresentButtonVisible = false; this.buttons = { backButton: null, @@ -399,23 +400,29 @@ }; let descriptors = [ [ - 'backButton', '#back-button', + 0, 'backButton', '#back-button', function() { api.doAction(api.Action.HISTORY_BACK, {}); } ], [ - 'reloadButton', '#reload-button', + 1, 'reloadButton', '#reload-button', function() { api.doAction(api.Action.RELOAD, {}); } ], [ - 'forwardButton', '#forward-button', + 2, 'forwardButton', '#forward-button', function() { api.doAction(api.Action.HISTORY_FORWARD, {}); } ], + [ + 0, 'exitPresentButton', '#exit-present-button', + function() { + api.doAction(api.Action.EXIT_PRESENT, {}); + } + ], ]; /** @const */ var BUTTON_Y = -0.53; @@ -428,14 +435,19 @@ controls.setTranslation(0, BUTTON_Y, BUTTON_Z); this.controlsId = ui.addElement(controls); - let startPosition = -BUTTON_SPACING * (descriptors.length / 2.0 - 0.5); + let slotCount = 0; + descriptors.forEach(function(descriptor) { + slotCount = Math.max(descriptor[0] + 1, slotCount); + }); + let startPosition = -BUTTON_SPACING * (slotCount / 2.0 - 0.5); for (let i = 0; i < descriptors.length; i++) { - let name = descriptors[i][0]; - let domId = descriptors[i][1]; - let callback = descriptors[i][2]; + let slot = descriptors[i][0]; + let name = descriptors[i][1]; + let domId = descriptors[i][2]; + let callback = descriptors[i][3]; let button = new Button(domId, callback, this.controlsId); - button.setTranslation(startPosition + i * BUTTON_SPACING, 0, 0); + button.setTranslation(startPosition + slot * BUTTON_SPACING, 0, 0); this.buttons[name] = button; } } @@ -449,6 +461,11 @@ for (let key in this.buttons) { this.buttons[key].setVisible(this.enabled); } + if (this.enabled) { + this.buttons['exitPresentButton'].setVisible( + this.exitPresentButtonVisible); + this.buttons['backButton'].setVisible(!this.exitPresentButtonVisible); + } } setBackButtonEnabled(enabled) { @@ -458,6 +475,12 @@ setForwardButtonEnabled(enabled) { this.buttons.forwardButton.setEnabled(enabled); } + + /** If true shows the exit present button instead of the back button. */ + setExitPresentButtonVisible(visible) { + this.exitPresentButtonVisible = visible; + this.configure(); + } }; /** @@ -1210,6 +1233,9 @@ // TODO(crbug/643815): Set aspect ratio on content quad when available. this.controls.setEnabled(menuMode); this.controls.setBackButtonEnabled(this.canGoBack || this.fullscreen); + // TODO(crbug/689139): Don't show exit present button if the page + // autopresented. + this.controls.setExitPresentButtonVisible(mode == api.Mode.WEB_VR); let enabledIndicators = {} enabledIndicators[api.Direction.LEFT] = this.canGoBack || this.fullscreen; this.gestureHandlers.setEnabled(enabledIndicators);
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js index 36634496..a21bedaf 100644 --- a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js +++ b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
@@ -73,6 +73,7 @@ 'SHOW_TAB': 9, 'OPEN_NEW_TAB': 10, 'KEY_EVENT': 11, + 'EXIT_PRESENT': 12 }; /**
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 0611ded..46853b8 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc
@@ -839,8 +839,8 @@ } } - persist_file.Release(); - shell_link.Release(); + persist_file.Reset(); + shell_link.Reset(); // Update the shortcut if some of its properties need to be updated. if (updated_properties.options &&
diff --git a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc index 0cc65d7..421737b 100644 --- a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -12,7 +12,6 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "components/os_crypt/os_crypt_mocker.h" @@ -152,7 +151,7 @@ } protected: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; net::FakeURLFetcherFactory factory_; std::unique_ptr<TestSigninClient> client_; std::unique_ptr<MutableProfileOAuth2TokenServiceDelegate>
diff --git a/chrome/browser/status_icons/OWNERS b/chrome/browser/status_icons/OWNERS index 3e63b462..b8894adf 100644 --- a/chrome/browser/status_icons/OWNERS +++ b/chrome/browser/status_icons/OWNERS
@@ -1 +1,3 @@ atwilson@chromium.org + +# COMPONENT: UI>Shell>StatusArea
diff --git a/chrome/browser/ui/android/content_settings/subresource_filter_infobar_delegate.cc b/chrome/browser/ui/android/content_settings/subresource_filter_infobar_delegate.cc index e94ef0e4..01d167ea 100644 --- a/chrome/browser/ui/android/content_settings/subresource_filter_infobar_delegate.cc +++ b/chrome/browser/ui/android/content_settings/subresource_filter_infobar_delegate.cc
@@ -71,7 +71,7 @@ return l10n_util::GetStringUTF16( using_experimental_infobar_ - ? IDS_FILTERED_DECEPTIVE_CONTENT_RELOAD_ACTION + ? IDS_APP_MENU_RELOAD : IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD); }
diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc index 80c7abd3..a35819b6 100644 --- a/chrome/browser/ui/ash/ash_init.cc +++ b/chrome/browser/ui/ash/ash_init.cc
@@ -104,7 +104,7 @@ else CreateClassicShell(); - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); ash::AcceleratorControllerDelegateAura* accelerator_controller_delegate = nullptr;
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 4aa1af7..210e48a 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -103,10 +103,10 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { public: AccessibilityDelegateImpl() { - ash::Shell::GetInstance()->AddShellObserver(AccessibilityManager::Get()); + ash::Shell::Get()->AddShellObserver(AccessibilityManager::Get()); } ~AccessibilityDelegateImpl() override { - ash::Shell::GetInstance()->RemoveShellObserver(AccessibilityManager::Get()); + ash::Shell::Get()->RemoveShellObserver(AccessibilityManager::Get()); } void ToggleHighContrast() override {
diff --git a/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc index 471c13d..c211d772 100644 --- a/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/app_window_launcher_controller.cc
@@ -13,9 +13,9 @@ ChromeLauncherController* owner) : owner_(owner) { if (ash::Shell::HasInstance()) { - if (ash::Shell::GetInstance()->GetPrimaryRootWindow()) { + if (ash::Shell::Get()->GetPrimaryRootWindow()) { activation_client_ = aura::client::GetActivationClient( - ash::Shell::GetInstance()->GetPrimaryRootWindow()); + ash::Shell::Get()->GetPrimaryRootWindow()); if (activation_client_) activation_client_->AddObserver(this); }
diff --git a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc index 0593341..d6e8f2e 100644 --- a/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc
@@ -261,7 +261,7 @@ if (observed_profile_) StopObserving(observed_profile_); if (observing_shell_) - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); } // static @@ -395,7 +395,7 @@ // the layout switch information. if (!observing_shell_) { observing_shell_ = true; - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); } // Check if we have controller for this task. @@ -614,7 +614,7 @@ void ArcAppWindowLauncherController::OnMaximizeModeEnded() { ash::ScreenOrientationController* orientation_controller = - ash::Shell::GetInstance()->screen_orientation_controller(); + ash::Shell::Get()->screen_orientation_controller(); // Don't unlock one by one because it'll switch to next rotation. orientation_controller->UnlockAll(); } @@ -724,7 +724,7 @@ ScreenOrientationController::LockCompletionBehavior::DisableSensor; } } - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); shell->screen_orientation_controller()->LockOrientationForWindow( window, BlinkOrientationLockFromMojom(orientation_lock), lock_completion_behavior);
diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index 1484c08..56d11171 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
@@ -82,11 +82,11 @@ : launcher_controller_(launcher_controller), browser_tab_strip_tracker_(this, this, this) { DCHECK(launcher_controller_); - ash::Shell::GetInstance()->activation_client()->AddObserver(this); + ash::Shell::Get()->activation_client()->AddObserver(this); } BrowserStatusMonitor::~BrowserStatusMonitor() { - ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); + ash::Shell::Get()->activation_client()->RemoveObserver(this); browser_tab_strip_tracker_.StopObservingAndSendOnBrowserRemoved(); }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc index 18335a31..e3036fa 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
@@ -261,7 +261,7 @@ // Right now ash::Shell isn't created for tests. // TODO(mukai): Allows it to observe display change and write tests. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + ash::Shell::Get()->window_tree_host_manager()->AddObserver(this); } ChromeLauncherControllerImpl::~ChromeLauncherControllerImpl() { @@ -273,7 +273,7 @@ model_->RemoveObserver(this); if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); for (const auto& pair : id_to_item_controller_map_) { int index = model_->ItemIndexByID(pair.first); // A "browser proxy" is not known to the model and this removal does @@ -571,7 +571,7 @@ ash::Shell::Get()->system_tray_delegate()->ActiveUserWasChanged(); // Force on-screen keyboard to reset. if (keyboard::IsKeyboardEnabled()) - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); } void ChromeLauncherControllerImpl::AdditionalUserAddedToSession( @@ -1166,9 +1166,9 @@ } const bool is_enabled = keyboard::IsKeyboardEnabled(); if (was_enabled && !is_enabled) - ash::Shell::GetInstance()->DeactivateKeyboard(); + ash::Shell::Get()->DeactivateKeyboard(); else if (is_enabled && !was_enabled) - ash::Shell::GetInstance()->CreateKeyboard(); + ash::Shell::Get()->CreateKeyboard(); } ash::ShelfItemStatus ChromeLauncherControllerImpl::GetAppState(
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc index 4673e68..f52c3f2 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
@@ -1898,8 +1898,7 @@ // the launcher in the secondary monitor. IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultiDisplayBasicDragAndDrop) { // Update the display configuration to add a secondary display. - display::test::DisplayManagerTestApi( - ash::Shell::GetInstance()->display_manager()) + display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay("800x800,801+0-800x800"); // Get a number of interfaces we need.
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc index c14c2e4..1984510f 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
@@ -3819,7 +3819,7 @@ AddArcAppAndShortcut(appinfo_current_); ash::ScreenOrientationController* controller = - ash::Shell::GetInstance()->screen_orientation_controller(); + ash::Shell::Get()->screen_orientation_controller(); // Creating a window with NONE orientation will not lock the screen. window_none_ = CreateArcWindow(window_app_id_none_); @@ -3908,7 +3908,7 @@ InitLauncherController(); ash::ScreenOrientationController* controller = - ash::Shell::GetInstance()->screen_orientation_controller(); + ash::Shell::Get()->screen_orientation_controller(); std::string app_id1("org.chromium.arc.1"); int task_id1 = 1; @@ -3959,7 +3959,7 @@ InitApps(); ash::ScreenOrientationController* controller = - ash::Shell::GetInstance()->screen_orientation_controller(); + ash::Shell::Get()->screen_orientation_controller(); // Activating a window with NON orientation unlocks the screen. window_none_->Activate();
diff --git a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc index 0946c87..5a2d032 100644 --- a/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/user_switch_animator_chromeos.cc
@@ -246,7 +246,7 @@ // Note: The animation duration override will be set before the old user gets // hidden and reset after the animations for the new user got kicked off. ash::Shell::RootWindowControllerList controller = - ash::Shell::GetInstance()->GetAllRootWindowControllers(); + ash::Shell::Get()->GetAllRootWindowControllers(); for (ash::Shell::RootWindowControllerList::iterator iter = controller.begin(); iter != controller.end(); ++iter) { (*iter)->GetShelfLayoutManager()->SetAnimationDurationOverride(
diff --git a/chrome/browser/ui/ash/multi_user/user_switch_util.cc b/chrome/browser/ui/ash/multi_user/user_switch_util.cc index 693d012..af1efe7 100644 --- a/chrome/browser/ui/ash/multi_user/user_switch_util.cc +++ b/chrome/browser/ui/ash/multi_user/user_switch_util.cc
@@ -27,8 +27,7 @@ // If neither screen sharing nor capturing is going on we can immediately // switch users. - ash::SystemTray* system_tray = - ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* system_tray = ash::Shell::Get()->GetPrimarySystemTray(); if (!system_tray->GetScreenShareItem()->is_started() && !system_tray->GetScreenCaptureItem()->is_started()) { on_switch.Run(); @@ -39,8 +38,7 @@ l10n_util::GetStringUTF16(IDS_DESKTOP_CASTING_ACTIVE_MESSAGE)) == chrome::MESSAGE_BOX_RESULT_YES) { // Stop screen sharing and capturing. - ash::SystemTray* system_tray = - ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* system_tray = ash::Shell::Get()->GetPrimarySystemTray(); if (system_tray->GetScreenShareItem()->is_started()) system_tray->GetScreenShareItem()->Stop(); if (system_tray->GetScreenCaptureItem()->is_started())
diff --git a/chrome/browser/ui/ash/palette_delegate_chromeos.cc b/chrome/browser/ui/ash/palette_delegate_chromeos.cc index d69e959..5d8c7713 100644 --- a/chrome/browser/ui/ash/palette_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/palette_delegate_chromeos.cc
@@ -140,8 +140,7 @@ } void PaletteDelegateChromeOS::TakePartialScreenshot(const base::Closure& done) { - auto* screenshot_controller = - ash::Shell::GetInstance()->screenshot_controller(); + auto* screenshot_controller = ash::Shell::Get()->screenshot_controller(); auto* screenshot_delegate = ash::WmShellAura::Get() ->accelerator_controller_delegate() ->screenshot_delegate(); @@ -155,7 +154,7 @@ } void PaletteDelegateChromeOS::CancelPartialScreenshot() { - ash::Shell::GetInstance()->screenshot_controller()->CancelScreenshotSession(); + ash::Shell::Get()->screenshot_controller()->CancelScreenshotSession(); } } // namespace chromeos
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc index 63719e5..69482974 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc
@@ -36,9 +36,7 @@ base::HourClockType GetHourType() { const ash::TraySystemInfo* tray_system_info = - ash::Shell::GetInstance() - ->GetPrimarySystemTray() - ->GetTraySystemInfoForTesting(); + ash::Shell::Get()->GetPrimarySystemTray()->GetTraySystemInfoForTesting(); const ash::SystemInfoDefaultView* system_info_default_view = tray_system_info->GetDefaultViewForTesting(); @@ -46,9 +44,8 @@ } void CreateDefaultView() { - ash::TraySystemInfo* tray_system_info = ash::Shell::GetInstance() - ->GetPrimarySystemTray() - ->GetTraySystemInfoForTesting(); + ash::TraySystemInfo* tray_system_info = + ash::Shell::Get()->GetPrimarySystemTray()->GetTraySystemInfoForTesting(); tray_system_info->CreateDefaultViewForTesting( ash::LoginStatus::NOT_LOGGED_IN); }
diff --git a/chrome/browser/ui/ash/system_tray_tray_cast_browsertest_media_router_chromeos.cc b/chrome/browser/ui/ash/system_tray_tray_cast_browsertest_media_router_chromeos.cc index eb20ef7..f3f5881 100644 --- a/chrome/browser/ui/ash/system_tray_tray_cast_browsertest_media_router_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_tray_cast_browsertest_media_router_chromeos.cc
@@ -41,7 +41,7 @@ // Returns the cast tray instance. ash::TrayCast* GetTrayCast() { - ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); // Make sure we actually popup the tray, otherwise the TrayCast instance will // not be created.
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index cc35f9e9..9983e5c2 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -1247,7 +1247,7 @@ void ContentSettingSubresourceFilterBubbleModel::SetManageText() { set_manage_text( l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); - set_show_manage_text_as_button(true); + set_show_manage_text_as_checkbox(true); } void ContentSettingSubresourceFilterBubbleModel::SetMessage() { @@ -1255,11 +1255,22 @@ IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION)); } -void ContentSettingSubresourceFilterBubbleModel::OnManageLinkClicked() { - subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory = - subresource_filter::ContentSubresourceFilterDriverFactory:: - FromWebContents(web_contents()); - driver_factory->OnReloadRequested(); +void ContentSettingSubresourceFilterBubbleModel::OnManageCheckboxChecked( + bool is_checked) { + if (is_checked) + set_done_button_text(l10n_util::GetStringUTF16(IDS_APP_MENU_RELOAD)); + else + set_done_button_text(base::string16()); + is_checked_ = is_checked; +} + +void ContentSettingSubresourceFilterBubbleModel::OnDoneClicked() { + if (is_checked_) { + subresource_filter::ContentSubresourceFilterDriverFactory* driver_factory = + subresource_filter::ContentSubresourceFilterDriverFactory:: + FromWebContents(web_contents()); + driver_factory->OnReloadRequested(); + } } ContentSettingSubresourceFilterBubbleModel* @@ -1554,10 +1565,7 @@ ContentSettingBubbleModel::MediaMenu::~MediaMenu() {} -ContentSettingBubbleModel::BubbleContent::BubbleContent() - : radio_group_enabled(false), - custom_link_enabled(false), - show_manage_text_as_button(false) {} +ContentSettingBubbleModel::BubbleContent::BubbleContent() {} ContentSettingBubbleModel::BubbleContent::~BubbleContent() {}
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.h b/chrome/browser/ui/content_settings/content_setting_bubble_model.h index d6c0f53f..f290390c 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.h +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.h
@@ -118,14 +118,15 @@ base::string16 message; ListItems list_items; RadioGroup radio_group; - bool radio_group_enabled; + bool radio_group_enabled = false; std::vector<DomainList> domain_lists; std::string custom_link; - bool custom_link_enabled; + bool custom_link_enabled = false; std::string manage_text; - bool show_manage_text_as_button; + bool show_manage_text_as_checkbox = false; MediaMenuMap media_menus; std::string learn_more_link; + base::string16 done_button_text; private: DISALLOW_COPY_AND_ASSIGN(BubbleContent); @@ -154,6 +155,7 @@ virtual void OnListItemClicked(int index) {} virtual void OnCustomLinkClicked() {} virtual void OnManageLinkClicked() {} + virtual void OnManageCheckboxChecked(bool is_checked) {} virtual void OnLearnMoreLinkClicked() {} virtual void OnMediaMenuClicked(content::MediaStreamType type, const std::string& selected_device_id) {} @@ -220,14 +222,11 @@ void set_custom_link_enabled(bool enabled) { bubble_content_.custom_link_enabled = enabled; } - void set_manage_text(const std::string& link) { - bubble_content_.manage_text = link; + void set_manage_text(const std::string& text) { + bubble_content_.manage_text = text; } - void set_show_manage_text_as_button(bool show_manage_text_as_button) { - bubble_content_.show_manage_text_as_button = show_manage_text_as_button; - } - void set_learn_more_link(const std::string& link) { - bubble_content_.learn_more_link = link; + void set_show_manage_text_as_checkbox(bool show_manage_text_as_checkbox) { + bubble_content_.show_manage_text_as_checkbox = show_manage_text_as_checkbox; } void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { bubble_content_.media_menus[type] = menu; @@ -235,6 +234,12 @@ void set_selected_device(const content::MediaStreamDevice& device) { bubble_content_.media_menus[device.type].selected_device = device; } + void set_learn_more_link(const std::string& link) { + bubble_content_.learn_more_link = link; + } + void set_done_button_text(const base::string16& done_button_text) { + bubble_content_.done_button_text = done_button_text; + } rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } private: @@ -318,9 +323,6 @@ ~ContentSettingSubresourceFilterBubbleModel() override; - void OnManageLinkClicked() override; - ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() - override; private: void SetMessage(); @@ -328,6 +330,12 @@ // ContentSettingBubbleModel: void SetTitle() override; void SetManageText() override; + void OnManageCheckboxChecked(bool is_checked) override; + ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() + override; + void OnDoneClicked() override; + + bool is_checked_ = false; DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); };
diff --git a/chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc b/chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc index bb5f8879..ffe3a88 100644 --- a/chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc +++ b/chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" #include "components/signin/core/browser/fake_signin_manager.h" @@ -146,7 +145,7 @@ } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; FakeProfileOAuth2TokenService token_service_; AccountTrackerService account_tracker_; TestSigninClient signin_client_;
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc index 8c0004a3..1215ac5f 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
@@ -344,7 +344,7 @@ AppWindow::FULLSCREEN_TYPE_OS); if (!ash_util::IsRunningInMash()) { DCHECK(ash::Shell::HasInstance()); - ash::Shell::GetInstance()->UpdateShelfVisibility(); + ash::Shell::Get()->UpdateShelfVisibility(); } } }
diff --git a/chrome/browser/ui/views/ash/tab_scrubber.cc b/chrome/browser/ui/views/ash/tab_scrubber.cc index 091949d..641250e 100644 --- a/chrome/browser/ui/views/ash/tab_scrubber.cc +++ b/chrome/browser/ui/views/ash/tab_scrubber.cc
@@ -76,7 +76,7 @@ activation_delay_(kActivationDelayMS), use_default_activation_delay_(true), weak_ptr_factory_(this) { - ash::Shell::GetInstance()->AddPreTargetHandler(this); + ash::Shell::Get()->AddPreTargetHandler(this); registrar_.Add( this, chrome::NOTIFICATION_BROWSER_CLOSED,
diff --git a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc index 012191c..8e484e30 100644 --- a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc +++ b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc
@@ -98,7 +98,7 @@ TabScrubber::GetInstance()->set_activation_delay(0); // Disable external monitor scaling of coordinates. - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); shell->event_transformation_handler()->set_transformation_mode( ash::EventTransformationHandler::TRANSFORM_NONE); }
diff --git a/chrome/browser/ui/views/chrome_views_delegate_chromeos.cc b/chrome/browser/ui/views/chrome_views_delegate_chromeos.cc index 8057319..523d8d85 100644 --- a/chrome/browser/ui/views/chrome_views_delegate_chromeos.cc +++ b/chrome/browser/ui/views/chrome_views_delegate_chromeos.cc
@@ -52,7 +52,7 @@ views::NonClientFrameView* ChromeViewsDelegate::CreateDefaultNonClientFrameView( views::Widget* widget) { - return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); + return ash::Shell::Get()->CreateDefaultNonClientFrameView(widget); } void ChromeViewsDelegate::AdjustSavedWindowPlacementChromeOS(
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index 6d0ade5f..2c0aeccb 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -34,7 +34,6 @@ #include "ui/gfx/font_list.h" #include "ui/gfx/text_utils.h" #include "ui/views/controls/button/label_button_border.h" -#include "ui/views/controls/button/md_text_button.h" #include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/button/radio_button.h" #include "ui/views/controls/combobox/combobox.h" @@ -47,6 +46,7 @@ #include "ui/views/layout/grid_layout.h" #include "ui/views/layout/layout_constants.h" #include "ui/views/native_cursor.h" +#include "ui/views/window/dialog_client_view.h" namespace { @@ -171,7 +171,7 @@ content_setting_bubble_model_(content_setting_bubble_model), custom_link_(nullptr), manage_link_(nullptr), - manage_button_(nullptr), + manage_checkbox_(nullptr), learn_more_link_(nullptr) { // Compensate for built-in vertical padding in the anchor view's image. set_anchor_view_insets(gfx::Insets( @@ -416,6 +416,15 @@ bubble_content_empty = false; } + if (bubble_content.show_manage_text_as_checkbox) { + manage_checkbox_ = + new views::Checkbox(base::UTF8ToUTF16(bubble_content.manage_text)); + manage_checkbox_->set_listener(this); + layout->AddPaddingRow(0, related_control_vertical_spacing); + layout->StartRow(0, indented_kSingleColumnSetId); + layout->AddView(manage_checkbox_); + } + if (!bubble_content_empty) { if (!layout_delegate->IsHarmonyMode()) { layout->AddPaddingRow(0, related_control_vertical_spacing); @@ -428,18 +437,15 @@ } views::View* ContentSettingBubbleContents::CreateExtraView() { - if (content_setting_bubble_model_->bubble_content() - .show_manage_text_as_button) { - manage_button_ = views::MdTextButton::CreateSecondaryUiButton( - this, base::UTF8ToUTF16( - content_setting_bubble_model_->bubble_content().manage_text)); - return manage_button_; - } else { - manage_link_ = new views::Link(base::UTF8ToUTF16( - content_setting_bubble_model_->bubble_content().manage_text)); - manage_link_->set_listener(this); - return manage_link_; - } + const ContentSettingBubbleModel::BubbleContent& bubble_content = + content_setting_bubble_model_->bubble_content(); + // Added as part of the primary view. + if (bubble_content.show_manage_text_as_checkbox) + return nullptr; + + manage_link_ = new views::Link(base::UTF8ToUTF16(bubble_content.manage_text)); + manage_link_->set_listener(this); + return manage_link_; } bool ContentSettingBubbleContents::Accept() { @@ -457,6 +463,10 @@ base::string16 ContentSettingBubbleContents::GetDialogButtonLabel( ui::DialogButton button) const { + const base::string16& done_text = + content_setting_bubble_model_->bubble_content().done_button_text; + if (!done_text.empty()) + return done_text; return l10n_util::GetStringUTF16(IDS_DONE); } @@ -472,9 +482,12 @@ void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, const ui::Event& event) { - if (manage_button_ == sender) { - GetWidget()->Close(); - content_setting_bubble_model_->OnManageLinkClicked(); + if (manage_checkbox_ == sender) { + content_setting_bubble_model_->OnManageCheckboxChecked( + manage_checkbox_->checked()); + + // Toggling the check state may change the dialog button text. + GetDialogClientView()->UpdateDialogButtons(); } else { RadioGroup::const_iterator i( std::find(radio_group_.begin(), radio_group_.end(), sender));
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.h b/chrome/browser/ui/views/content_setting_bubble_contents.h index 298eea5..830b8ce1 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.h +++ b/chrome/browser/ui/views/content_setting_bubble_contents.h
@@ -16,6 +16,7 @@ #include "ui/base/models/combobox_model.h" #include "ui/views/bubble/bubble_dialog_delegate.h" #include "ui/views/controls/button/button.h" +#include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/combobox/combobox_listener.h" #include "ui/views/controls/link_listener.h" @@ -116,6 +117,7 @@ views::Link* custom_link_; views::Link* manage_link_; views::LabelButton* manage_button_; + views::Checkbox* manage_checkbox_; views::Link* learn_more_link_; // Combobox models the bubble owns.
diff --git a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc index 99b46c8..47e050d 100644 --- a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc +++ b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc
@@ -28,6 +28,15 @@ int bubble_width = ManagePasswordsBubbleView::kDesiredBubbleWidth; views::GridLayout* layout = new views::GridLayout(this); layout->set_minimum_size(gfx::Size(bubble_width, 0)); + layout->SetInsets( + 0, + LayoutDelegate::Get()->GetMetric( + LayoutDelegate::Metric::PANEL_CONTENT_MARGIN) + + desktop_ios_promotion::GetPromoImage( + GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_TextfieldDefaultColor)) + .width(), + 0, 0); SetLayoutManager(layout); send_sms_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( this, l10n_util::GetStringUTF16(IDS_DESKTOP_TO_IOS_PROMO_SEND_TO_PHONE)); @@ -35,19 +44,8 @@ this, l10n_util::GetStringUTF16(IDS_DESKTOP_TO_IOS_PROMO_NO_THANKS)); constexpr int kLabelColumnSet = 1; views::ColumnSet* column_set = layout->AddColumnSet(kLabelColumnSet); - column_set->AddPaddingColumn( - 0, LayoutDelegate::Get()->GetMetric( - LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN) + - desktop_ios_promotion::GetPromoImage( - GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_TextfieldDefaultColor)) - .width() + - LayoutDelegate::Get()->GetMetric( - LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); - column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, views::GridLayout::FIXED, bubble_width, 0); - constexpr int kDoubleButtonColumnSet = 2; column_set = layout->AddColumnSet(kDoubleButtonColumnSet); column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc index c625c9f..1f6282e6 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -77,11 +77,11 @@ window_icon_(nullptr) { ash::WmWindow::Get(frame->GetNativeWindow()) ->InstallResizeHandleWindowTargeter(nullptr); - ash::Shell::GetInstance()->AddShellObserver(this); + ash::Shell::Get()->AddShellObserver(this); } BrowserNonClientFrameViewAsh::~BrowserNonClientFrameViewAsh() { - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); } void BrowserNonClientFrameViewAsh::Init() {
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc index 6525d653..a582e52d 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
@@ -344,7 +344,7 @@ IsWindowFullscreenForTabOrPending(); ash::wm::GetWindowState(native_window_) ->set_hide_shelf_when_fullscreen(in_tab_fullscreen); - ash::Shell::GetInstance()->UpdateShelfVisibility(); + ash::Shell::Get()->UpdateShelfVisibility(); } void ImmersiveModeControllerAsh::OnWindowPropertyChanged(aura::Window* window,
diff --git a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc b/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc index 8a4596ed..c17dafc 100644 --- a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc +++ b/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc
@@ -125,8 +125,7 @@ bool StatusTrayStateChangerWin::CreateTrayNotify() { DCHECK(CalledOnValidThread()); - tray_notify_.Release(); // Release so this method can be called more than - // once. + tray_notify_.Reset(); // Reset so this method can be called more than once. HRESULT hr = tray_notify_.CreateInstance(CLSID_TrayNotify); if (FAILED(hr))
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index e3401019..c2ee35ba 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -2161,7 +2161,7 @@ float GetCursorDeviceScaleFactor() const { ash::test::CursorManagerTestApi cursor_test_api( - ash::Shell::GetInstance()->cursor_manager()); + ash::Shell::Get()->cursor_manager()); return cursor_test_api.GetCurrentCursor().device_scale_factor(); } @@ -2292,7 +2292,7 @@ // Switching display mode should cancel the drag operation. display::DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); + ash::Shell::Get()->display_manager(); display_manager->AddRemoveDisplay(); }
diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc index e55d711..c578db1 100644 --- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc +++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
@@ -310,7 +310,7 @@ chromeos::switches::kHasChromeOSDiamondKey)); source->AddBoolean("keyboardOverlayTopRowKeysAreFunctionKeys", TopRowKeysAreFunctionKeys(profile)); - ash::Shell* shell = ash::Shell::GetInstance(); + ash::Shell* shell = ash::Shell::Get(); display::DisplayManager* display_manager = shell->display_manager(); source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", display_manager->IsDisplayUIScalingEnabled());
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 d8ae077..097c8742 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -1227,7 +1227,7 @@ } void SigninScreenHandler::HandleShutdownSystem() { - ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown(); + ash::Shell::Get()->lock_state_controller()->RequestShutdown(); } void SigninScreenHandler::HandleLoadWallpaper(const AccountId& account_id) {
diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc index 297d54326..f6348dd 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
@@ -43,11 +43,11 @@ namespace { display::DisplayManager* GetDisplayManager() { - return ash::Shell::GetInstance()->display_manager(); + return ash::Shell::Get()->display_manager(); } ash::DisplayConfigurationController* GetDisplayConfigurationController() { - return ash::Shell::GetInstance()->display_configuration_controller(); + return ash::Shell::Get()->display_configuration_controller(); } int64_t GetDisplayIdFromValue(const base::Value* arg) { @@ -196,13 +196,13 @@ DisplayOptionsHandler::DisplayOptionsHandler() { // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 if (!ash_util::IsRunningInMash()) - ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); + ash::Shell::Get()->window_tree_host_manager()->AddObserver(this); } DisplayOptionsHandler::~DisplayOptionsHandler() { // TODO(mash) Support Chrome display settings in Mash. crbug.com/548429 if (!ash_util::IsRunningInMash()) - ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); + ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); } void DisplayOptionsHandler::GetLocalizedValues( @@ -500,10 +500,8 @@ return; // For external displays, show a notification confirming the resolution // change. - ash::Shell::GetInstance() - ->resolution_notification_controller() - ->PrepareNotification(display_id, current_mode, mode, - base::Bind(&chromeos::StoreDisplayPrefs)); + ash::Shell::Get()->resolution_notification_controller()->PrepareNotification( + display_id, current_mode, mode, base::Bind(&chromeos::StoreDisplayPrefs)); } void DisplayOptionsHandler::HandleSetRotation(const base::ListValue* args) {
diff --git a/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc index f3f496c9..9616d7e 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc
@@ -118,13 +118,13 @@ } const display::Display& display = - ash::Shell::GetInstance()->display_manager()->GetDisplayForId(display_id); + ash::Shell::Get()->display_manager()->GetDisplayForId(display_id); DCHECK(display.is_valid()); if (!display.is_valid()) return; ash::WindowTreeHostManager* window_tree_host_manager = - ash::Shell::GetInstance()->window_tree_host_manager(); + ash::Shell::Get()->window_tree_host_manager(); overscan_calibrator_.reset(new OverscanCalibrator( display, window_tree_host_manager->GetOverscanInsets(display_id))); }
diff --git a/chrome/browser/ui/webui/voice_search_ui.cc b/chrome/browser/ui/webui/voice_search_ui.cc index ac31f71..5eba13c 100644 --- a/chrome/browser/ui/webui/voice_search_ui.cc +++ b/chrome/browser/ui/webui/voice_search_ui.cc
@@ -50,7 +50,6 @@ #include "extensions/common/extension.h" #include "extensions/features/features.h" #include "ui/base/l10n/l10n_util.h" -#include "v8/include/v8.h" #if defined(OS_WIN) #include "base/win/windows_version.h"
diff --git a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc index e6e3b29..08fc70fd 100644 --- a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc +++ b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
@@ -186,6 +186,8 @@ source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); + source->AddLocalizedString("exitPresent", + IDS_VR_SHELL_UI_EXIT_PRESENT_BUTTON); source->AddLocalizedString("newTab", IDS_VR_SHELL_NEW_TAB_BUTTON); source->AddLocalizedString("newIncognitoTab", IDS_VR_SHELL_NEW_INCOGNITO_TAB_BUTTON);
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash.cc b/chrome/browser/ui/window_sizer/window_sizer_ash.cc index 89c18ebe8..35c4a7d 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
@@ -46,8 +46,7 @@ // In case of a popup with an 'unspecified' location in ash, we are // looking for a good screen location. We are interpreting (0,0) as an // unspecified location. - *bounds = ash::Shell::GetInstance()->window_positioner()-> - GetPopupPosition(*bounds); + *bounds = ash::Shell::Get()->window_positioner()->GetPopupPosition(*bounds); determined = true; }
diff --git a/chrome/browser/win/settings_app_monitor.cc b/chrome/browser/win/settings_app_monitor.cc index 0ef2982..ed6faad 100644 --- a/chrome/browser/win/settings_app_monitor.cc +++ b/chrome/browser/win/settings_app_monitor.cc
@@ -669,7 +669,7 @@ DCHECK(task_runner_->BelongsToCurrentThread()); if (event_handler_) { - event_handler_.Release(); + event_handler_.Reset(); automation_->RemoveAllEventHandlers(); } }
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index cf4b5f1..b9be3b0 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -43,7 +43,6 @@ "ENABLE_SESSION_SERVICE=$enable_session_service", "ENABLE_SUPERVISED_USERS=$enable_supervised_users", "ENABLE_WAYLAND_SERVER=$enable_wayland_server", - "ENABLE_XPC_NOTIFICATIONS=$enable_xpc_notifications", "PGO_BUILD=$pgo_build", "USE_VULCANIZE=$use_vulcanize", ]
diff --git a/chrome/common/features.gni b/chrome/common/features.gni index 360f835..d585b94 100644 --- a/chrome/common/features.gni +++ b/chrome/common/features.gni
@@ -67,10 +67,6 @@ # Indicates if Wayland display server support is enabled. enable_wayland_server = is_chromeos - # Enable native notifications via XPC services (mac only). - # TODO(miguelg): remove this. - enable_xpc_notifications = true - # Indicates if the build is using PGO. pgo_build = chrome_pgo_phase > 0
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index 45e64ea7..9f5de5ca 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc
@@ -493,7 +493,7 @@ if (SUCCEEDED(ipl->LaunchCmdLine( chrome_command.GetCommandLineString().c_str()))) ret = true; - ipl.Release(); + ipl.Reset(); } else { // Couldn't get Omaha's process launcher, Omaha may not be installed at // system level. Try just running Chrome instead.
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 77fd3ca..273522e0 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -565,6 +565,14 @@ render_frame->IsMainFrame()) { new SearchBox(render_frame); } + +#if BUILDFLAG(ENABLE_SPELLCHECK) + // TODO(xiaochengh): Use a different SpellCheckProvider for each RenderFrame. + if (SpellCheckProvider* provider = + SpellCheckProvider::Get(render_frame->GetRenderView())) { + render_frame->GetWebFrame()->setTextCheckClient(provider); + } +#endif } void ChromeContentRendererClient::RenderViewCreated( @@ -573,7 +581,16 @@ ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); #endif #if BUILDFLAG(ENABLE_SPELLCHECK) - new SpellCheckProvider(render_view, spellcheck_.get()); + SpellCheckProvider* provider = + new SpellCheckProvider(render_view, spellcheck_.get()); + // For a main frame of a view, RenderFrameCreated is called earlier than + // RenderViewCreated. This workaround ensures that WebTextCheckClient is + // still set for any main frame. + // TODO(xiaochengh): Remove this workaround once SpellCheckProvider becomes + // a RenderFrameObserver. + if (content::RenderFrame* main_frame = render_view->GetMainRenderFrame()) + main_frame->GetWebFrame()->setTextCheckClient(provider); + new SpellCheckPanel(render_view); #endif new prerender::PrerendererClient(render_view);
diff --git a/chrome/renderer/resources/extensions/browser_action_custom_bindings.js b/chrome/renderer/resources/extensions/browser_action_custom_bindings.js index b63bdc6..4b6ce09a 100644 --- a/chrome/renderer/resources/extensions/browser_action_custom_bindings.js +++ b/chrome/renderer/resources/extensions/browser_action_custom_bindings.js
@@ -9,7 +9,7 @@ var setIcon = require('setIcon').setIcon; var getExtensionViews = requireNative('runtime').GetExtensionViews; var sendRequest = bindingUtil ? - bindingUtil.sendRequest.bind(bindingUtil) : + $Function.bind(bindingUtil.sendRequest, bindingUtil) : require('sendRequest').sendRequest; var lastError = require('lastError');
diff --git a/chrome/renderer/resources/extensions/file_system_custom_bindings.js b/chrome/renderer/resources/extensions/file_system_custom_bindings.js index e8ed00c..eb333de9 100644 --- a/chrome/renderer/resources/extensions/file_system_custom_bindings.js +++ b/chrome/renderer/resources/extensions/file_system_custom_bindings.js
@@ -6,7 +6,7 @@ var binding = apiBridge || require('binding').Binding.create('fileSystem'); var sendRequest = bindingUtil ? - bindingUtil.sendRequest.bind(bindingUtil) : + $Function.bind(bindingUtil.sendRequest, bindingUtil) : require('sendRequest').sendRequest; var getFileBindingsForApi = require('fileEntryBindingUtil').getFileBindingsForApi;
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index 335b678..7d803c3c 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc
@@ -393,7 +393,7 @@ ~PrintJobCanceler() { if (job_ptr_ && job_ptr_->get()) { (*job_ptr_)->Cancel(); - job_ptr_->Release(); + job_ptr_->Reset(); } }
diff --git a/chrome/test/data/extensions/api_test/native_bindings/web_request/background.js b/chrome/test/data/extensions/api_test/native_bindings/web_request/background.js new file mode 100644 index 0000000..e8bc53a --- /dev/null +++ b/chrome/test/data/extensions/api_test/native_bindings/web_request/background.js
@@ -0,0 +1,42 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Check invalid call: 'asyncBlocking' is not allowed for onBeforeRequest. +var caught = false; +try { + chrome.webRequest.onBeforeRequest.addListener( + function(details) {}, {urls: ['http://example.com/*/*']}, + ['asyncBlocking']); +} catch (e) { + caught = true; +} +chrome.test.assertTrue(caught); + +// Check invalid call: Some url filter has to be supplied. +caught = false; +try { + chrome.webRequest.onBeforeRequest.addListener( + function(details) {}, {}, ['blocking']); +} catch (e) { + caught = true; +} +chrome.test.assertTrue(caught); + +// Redirect calls from simple.html -> simple2.html. +chrome.webRequest.onBeforeRequest.addListener(function(details) { + var url = new URL(details.url); + // Ignore favicon requests, and don't redirect simple2.html. + if (url.pathname == '/native_bindings/simple2.html' || + url.pathname == '/favicon.ico') + return {}; + + chrome.test.assertEq('/native_bindings/simple.html', url.pathname); + chrome.test.assertTrue(url.port != ''); + chrome.test.assertEq('example.com:' + url.port, url.host); + var newUrl = url.origin + '/native_bindings/simple2.html'; + return {redirectUrl: newUrl}; +}, {urls: ['http://example.com:*/*']}, ['blocking']); + +// Note: redirection is tested on the C++ side. +chrome.test.succeed();
diff --git a/chrome/test/data/extensions/api_test/native_bindings/web_request/manifest.json b/chrome/test/data/extensions/api_test/native_bindings/web_request/manifest.json new file mode 100644 index 0000000..3f0d158 --- /dev/null +++ b/chrome/test/data/extensions/api_test/native_bindings/web_request/manifest.json
@@ -0,0 +1,11 @@ +{ + "name": "Web Request Extension", + "description": "web request extension", + "version": "1", + "manifest_version": 2, + "permissions": ["webRequest", "webRequestBlocking", + "http://*.example.com:*/*"], + "background": { + "scripts": ["background.js"] + } +}
diff --git a/chrome/utility/image_writer/image_writer_unittest.cc b/chrome/utility/image_writer/image_writer_unittest.cc index 738a246..d935c36 100644 --- a/chrome/utility/image_writer/image_writer_unittest.cc +++ b/chrome/utility/image_writer/image_writer_unittest.cc
@@ -10,7 +10,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" #include "chrome/utility/image_writer/error_messages.h" #include "chrome/utility/image_writer/image_writer.h" #include "chrome/utility/image_writer/image_writer_handler.h" @@ -54,7 +53,7 @@ base::FilePath device_path_; private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::MessageLoop message_loop_; base::ScopedTempDir temp_dir_; };
diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index 567762b..047fb1eb 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc
@@ -602,7 +602,7 @@ result = pstore->EnumItems(0, &AutocompleteGUID, &AutocompleteGUID, 0, item.Receive()); if (result != PST_E_OK) { - pstore.Release(); + pstore.Reset(); FreeLibrary(pstorec_dll); return; } @@ -636,8 +636,8 @@ CoTaskMemFree(item_name); } // Releases them before unload the dll. - item.Release(); - pstore.Release(); + item.Reset(); + pstore.Reset(); FreeLibrary(pstorec_dll); size_t i;
diff --git a/chromeos/dbus/dbus_clients_common.cc b/chromeos/dbus/dbus_clients_common.cc index 77b8f7c..f23aa2f 100644 --- a/chromeos/dbus/dbus_clients_common.cc +++ b/chromeos/dbus/dbus_clients_common.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "chromeos/chromeos_switches.h" +#include "chromeos/dbus/biod/biod_client.h" #include "chromeos/dbus/cras_audio_client.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_client_implementation_type.h" @@ -42,6 +43,12 @@ namespace chromeos { DBusClientsCommon::DBusClientsCommon(bool use_real_clients) { + const DBusClientImplementationType client_impl_type = + use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION + : FAKE_DBUS_CLIENT_IMPLEMENTATION; + + biod_client_.reset(BiodClient::Create(client_impl_type)); + if (use_real_clients) cras_audio_client_.reset(CrasAudioClient::Create()); else @@ -90,13 +97,9 @@ else permission_broker_client_.reset(new FakePermissionBrokerClient); - power_manager_client_.reset(PowerManagerClient::Create( - use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION - : FAKE_DBUS_CLIENT_IMPLEMENTATION)); + power_manager_client_.reset(PowerManagerClient::Create(client_impl_type)); - session_manager_client_.reset(SessionManagerClient::Create( - use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION - : FAKE_DBUS_CLIENT_IMPLEMENTATION)); + session_manager_client_.reset(SessionManagerClient::Create(client_impl_type)); if (use_real_clients) sms_client_.reset(SMSClient::Create()); @@ -108,9 +111,7 @@ else system_clock_client_.reset(new FakeSystemClockClient); - update_engine_client_.reset(UpdateEngineClient::Create( - use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION - : FAKE_DBUS_CLIENT_IMPLEMENTATION)); + update_engine_client_.reset(UpdateEngineClient::Create(client_impl_type)); } DBusClientsCommon::~DBusClientsCommon() {} @@ -118,6 +119,7 @@ void DBusClientsCommon::Initialize(dbus::Bus* system_bus) { DCHECK(DBusThreadManager::IsInitialized()); + biod_client_->Init(system_bus); cras_audio_client_->Init(system_bus); cryptohome_client_->Init(system_bus); gsm_sms_client_->Init(system_bus);
diff --git a/chromeos/dbus/dbus_clients_common.h b/chromeos/dbus/dbus_clients_common.h index a083faa..761c48f 100644 --- a/chromeos/dbus/dbus_clients_common.h +++ b/chromeos/dbus/dbus_clients_common.h
@@ -16,6 +16,7 @@ namespace chromeos { +class BiodClient; class CrasAudioClient; class CryptohomeClient; class GsmSMSClient; @@ -48,6 +49,7 @@ friend class DBusThreadManager; friend class DBusThreadManagerSetter; + std::unique_ptr<BiodClient> biod_client_; std::unique_ptr<CrasAudioClient> cras_audio_client_; std::unique_ptr<CryptohomeClient> cryptohome_client_; std::unique_ptr<GsmSMSClient> gsm_sms_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index f54dfe5..fcb59a0 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -13,6 +13,7 @@ #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/arc_obb_mounter_client.h" #include "chromeos/dbus/auth_policy_client.h" +#include "chromeos/dbus/biod/biod_client.h" #include "chromeos/dbus/cras_audio_client.h" #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/cryptohome_client.h" @@ -116,6 +117,10 @@ : nullptr; } +BiodClient* DBusThreadManager::GetBiodClient() { + return clients_common_->biod_client_.get(); +} + CrasAudioClient* DBusThreadManager::GetCrasAudioClient() { return clients_common_->cras_audio_client_.get(); } @@ -296,6 +301,11 @@ DBusThreadManagerSetter::~DBusThreadManagerSetter() {} +void DBusThreadManagerSetter::SetBiodClient( + std::unique_ptr<BiodClient> client) { + DBusThreadManager::Get()->clients_common_->biod_client_ = std::move(client); +} + void DBusThreadManagerSetter::SetCrasAudioClient( std::unique_ptr<CrasAudioClient> client) { DBusThreadManager::Get()->clients_common_->cras_audio_client_ =
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index e8b1287..51700684 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -26,6 +26,7 @@ // Style Note: Clients are sorted by names. class ArcObbMounterClient; class AuthPolicyClient; +class BiodClient; class CrasAudioClient; class CrosDisksClient; class CryptohomeClient; @@ -120,6 +121,7 @@ // http://crbug.com/647367 ArcObbMounterClient* GetArcObbMounterClient(); AuthPolicyClient* GetAuthPolicyClient(); + BiodClient* GetBiodClient(); CrasAudioClient* GetCrasAudioClient(); CrosDisksClient* GetCrosDisksClient(); CryptohomeClient* GetCryptohomeClient(); @@ -176,6 +178,7 @@ public: ~DBusThreadManagerSetter(); + void SetBiodClient(std::unique_ptr<BiodClient> client); void SetCrasAudioClient(std::unique_ptr<CrasAudioClient> client); void SetCrosDisksClient(std::unique_ptr<CrosDisksClient> client); void SetCryptohomeClient(std::unique_ptr<CryptohomeClient> client);
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc index 64bbc00..3d556d1a 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc
@@ -46,7 +46,7 @@ void ArcIntentHelperBridge::OnInstanceReady() { DCHECK(thread_checker_.CalledOnValidThread()); - ash::Shell::GetInstance()->set_link_handler_model_factory(this); + ash::Shell::Get()->set_link_handler_model_factory(this); auto* instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->intent_helper(), Init); DCHECK(instance); @@ -55,7 +55,7 @@ void ArcIntentHelperBridge::OnInstanceClosed() { DCHECK(thread_checker_.CalledOnValidThread()); - ash::Shell::GetInstance()->set_link_handler_model_factory(nullptr); + ash::Shell::Get()->set_link_handler_model_factory(nullptr); } void ArcIntentHelperBridge::OnIconInvalidated(const std::string& package_name) { @@ -79,7 +79,7 @@ void ArcIntentHelperBridge::OpenWallpaperPicker() { DCHECK(thread_checker_.CalledOnValidThread()); - ash::Shell::GetInstance()->wallpaper_controller()->OpenSetWallpaperPage(); + ash::Shell::Get()->wallpaper_controller()->OpenSetWallpaperPage(); } void ArcIntentHelperBridge::SetWallpaperDeprecated(
diff --git a/components/arc/power/arc_power_bridge.cc b/components/arc/power/arc_power_bridge.cc index a9a47f52..ec4906f 100644 --- a/components/arc/power/arc_power_bridge.cc +++ b/components/arc/power/arc_power_bridge.cc
@@ -31,13 +31,13 @@ ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service()->power(), Init); DCHECK(power_instance); power_instance->Init(binding_.CreateInterfacePtrAndBind()); - ash::Shell::GetInstance()->display_configurator()->AddObserver(this); + ash::Shell::Get()->display_configurator()->AddObserver(this); chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> AddObserver(this); } void ArcPowerBridge::OnInstanceClosed() { - ash::Shell::GetInstance()->display_configurator()->RemoveObserver(this); + ash::Shell::Get()->display_configurator()->RemoveObserver(this); chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> RemoveObserver(this); ReleaseAllDisplayWakeLocks(); @@ -122,8 +122,7 @@ } void ArcPowerBridge::IsDisplayOn(const IsDisplayOnCallback& callback) { - callback.Run( - ash::Shell::GetInstance()->display_configurator()->IsDisplayOn()); + callback.Run(ash::Shell::Get()->display_configurator()->IsDisplayOn()); } void ArcPowerBridge::ReleaseAllDisplayWakeLocks() {
diff --git a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc index df3820d..56c8d27 100644 --- a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc +++ b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc
@@ -10,6 +10,7 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/waitable_event.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "components/autofill/core/browser/autocomplete_history_manager.h" #include "components/autofill/core/browser/autofill_external_delegate.h" @@ -78,7 +79,7 @@ void TearDown() override { autocomplete_manager_.reset(); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<MockWebDataService> web_data_service_; std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_; std::unique_ptr<AutofillDriver> autofill_driver_;
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index bb2f21b..f8cc2e3 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -28,6 +28,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "build/build_config.h" @@ -1107,7 +1108,7 @@ } protected: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; MockAutofillClient autofill_client_; std::unique_ptr<MockAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillManager> autofill_manager_;
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index 306d2474..c9fd25a 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -18,6 +18,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" #include "base/test/user_action_tester.h" #include "base/time/time.h" #include "components/autofill/core/browser/autofill_experiments.h" @@ -333,7 +334,7 @@ void EnableWalletSync(); void EnableUkmLogging(); - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; TestAutofillClient autofill_client_; std::unique_ptr<AccountTrackerService> account_tracker_; std::unique_ptr<FakeSigninManagerBase> signin_manager_;
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc index a4334ea..bdb786d 100644 --- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc
@@ -16,6 +16,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/autofill/core/browser/webdata/autofill_entry.h" @@ -276,7 +277,7 @@ } ScopedTempDir temp_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; FakeAutofillBackend backend_; AutofillTable table_; WebDatabase db_;
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc index aaa5d88d..fc0d17f4 100644 --- a/components/browser_sync/profile_sync_service_unittest.cc +++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -15,6 +15,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" #include "base/test/sequenced_worker_pool_owner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" @@ -350,7 +351,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; ProfileSyncServiceBundle profile_sync_service_bundle_; std::unique_ptr<ProfileSyncService> service_;
diff --git a/components/captive_portal/captive_portal_detector_unittest.cc b/components/captive_portal/captive_portal_detector_unittest.cc index 28972bb..7eaa099f 100644 --- a/components/captive_portal/captive_portal_detector_unittest.cc +++ b/components/captive_portal/captive_portal_detector_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/captive_portal/captive_portal_testing_utils.h" @@ -113,7 +114,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<CaptivePortalDetector> detector_; };
diff --git a/components/chrome_cleaner/OWNERS b/components/chrome_cleaner/OWNERS index 51897aa..e54e7edd 100644 --- a/components/chrome_cleaner/OWNERS +++ b/components/chrome_cleaner/OWNERS
@@ -1,4 +1,5 @@ csharp@chromium.org +joenotcharles@chromium.org robertshield@chromium.org # COMPONENT: UI>Browser>Preferences>Protector
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc index 0a82cdb..036424c 100644 --- a/components/crash/content/app/breakpad_linux.cc +++ b/components/crash/content/app/breakpad_linux.cc
@@ -980,9 +980,7 @@ true, // Install handlers. -1); // Server file descriptor. -1 for in-process. - if (process_type != kWebViewSingleProcessType && - process_type != kBrowserProcessType && - !process_type.empty()) { + if (!is_browser_process) { g_signal_code_pipe_fd = GetCrashReporterClient()->GetAndroidCrashSignalFD(); if (g_signal_code_pipe_fd != -1)
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc index a98ba92..fbdf6768 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_server.h" @@ -60,7 +61,7 @@ } } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyConfigurator> config_; };
diff --git a/components/display_compositor/yuv_readback_unittest.cc b/components/display_compositor/yuv_readback_unittest.cc index fe595e3..bda6731 100644 --- a/components/display_compositor/yuv_readback_unittest.cc +++ b/components/display_compositor/yuv_readback_unittest.cc
@@ -7,6 +7,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/launcher/unit_test_launcher.h" +#include "base/test/scoped_task_environment.h" #include "base/test/test_suite.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" @@ -476,7 +477,7 @@ gpu::gles2::GLES2Interface* gl_; std::unique_ptr<display_compositor::GLHelper> helper_; gl::DisableNullDrawGLBindings enable_pixel_output_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(YUVReadbackTest, YUVReadbackOptTest) {
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc index 8b9d742..1225ab0 100644 --- a/components/exo/shell_surface_unittest.cc +++ b/components/exo/shell_surface_unittest.cc
@@ -966,7 +966,7 @@ EXPECT_FALSE(targeter->SubtreeShouldBeExploredForEvent(shell_window, ev_out)); // Enable spoken feedback. - ash::Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback( + ash::Shell::Get()->accessibility_delegate()->ToggleSpokenFeedback( ash::A11Y_NOTIFICATION_NONE); shell_surface.OnAccessibilityModeChanged(); @@ -1003,7 +1003,7 @@ EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); // Disable spoken feedback. Shadow underlay is restored. - ash::Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback( + ash::Shell::Get()->accessibility_delegate()->ToggleSpokenFeedback( ash::A11Y_NOTIFICATION_NONE); shell_surface.OnAccessibilityModeChanged(); shell_surface2.OnAccessibilityModeChanged();
diff --git a/components/exo/wm_helper_ash.cc b/components/exo/wm_helper_ash.cc index 60f8119..738a040 100644 --- a/components/exo/wm_helper_ash.cc +++ b/components/exo/wm_helper_ash.cc
@@ -21,9 +21,9 @@ // WMHelperAsh, public: WMHelperAsh::WMHelperAsh() { - ash::Shell::GetInstance()->AddShellObserver(this); - ash::Shell::GetInstance()->activation_client()->AddObserver(this); - ash::Shell::GetInstance()->cursor_manager()->AddObserver(this); + ash::Shell::Get()->AddShellObserver(this); + ash::Shell::Get()->activation_client()->AddObserver(this); + ash::Shell::Get()->cursor_manager()->AddObserver(this); ash::WmShell::Get()->AddDisplayObserver(this); aura::client::FocusClient* focus_client = aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); @@ -39,9 +39,9 @@ aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); focus_client->RemoveObserver(this); ash::WmShell::Get()->RemoveDisplayObserver(this); - ash::Shell::GetInstance()->cursor_manager()->RemoveObserver(this); - ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); - ash::Shell::GetInstance()->RemoveShellObserver(this); + ash::Shell::Get()->cursor_manager()->RemoveObserver(this); + ash::Shell::Get()->activation_client()->RemoveObserver(this); + ash::Shell::Get()->RemoveShellObserver(this); ui::DeviceDataManager::GetInstance()->RemoveObserver(this); ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); } @@ -51,8 +51,7 @@ const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( int64_t display_id) const { - return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( - display_id); + return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); } aura::Window* WMHelperAsh::GetContainer(int container_id) { @@ -61,7 +60,7 @@ } aura::Window* WMHelperAsh::GetActiveWindow() const { - return ash::Shell::GetInstance()->activation_client()->GetActiveWindow(); + return ash::Shell::Get()->activation_client()->GetActiveWindow(); } aura::Window* WMHelperAsh::GetFocusedWindow() const { @@ -71,27 +70,27 @@ } ui::CursorSetType WMHelperAsh::GetCursorSet() const { - return ash::Shell::GetInstance()->cursor_manager()->GetCursorSet(); + return ash::Shell::Get()->cursor_manager()->GetCursorSet(); } void WMHelperAsh::AddPreTargetHandler(ui::EventHandler* handler) { - ash::Shell::GetInstance()->AddPreTargetHandler(handler); + ash::Shell::Get()->AddPreTargetHandler(handler); } void WMHelperAsh::PrependPreTargetHandler(ui::EventHandler* handler) { - ash::Shell::GetInstance()->PrependPreTargetHandler(handler); + ash::Shell::Get()->PrependPreTargetHandler(handler); } void WMHelperAsh::RemovePreTargetHandler(ui::EventHandler* handler) { - ash::Shell::GetInstance()->RemovePreTargetHandler(handler); + ash::Shell::Get()->RemovePreTargetHandler(handler); } void WMHelperAsh::AddPostTargetHandler(ui::EventHandler* handler) { - ash::Shell::GetInstance()->AddPostTargetHandler(handler); + ash::Shell::Get()->AddPostTargetHandler(handler); } void WMHelperAsh::RemovePostTargetHandler(ui::EventHandler* handler) { - ash::Shell::GetInstance()->RemovePostTargetHandler(handler); + ash::Shell::Get()->RemovePostTargetHandler(handler); } bool WMHelperAsh::IsMaximizeModeWindowManagerEnabled() const { @@ -101,14 +100,11 @@ } bool WMHelperAsh::IsSpokenFeedbackEnabled() const { - return ash::Shell::GetInstance() - ->accessibility_delegate() - ->IsSpokenFeedbackEnabled(); + return ash::Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); } void WMHelperAsh::PlayEarcon(int sound_key) const { - return ash::Shell::GetInstance()->accessibility_delegate()->PlayEarcon( - sound_key); + return ash::Shell::Get()->accessibility_delegate()->PlayEarcon(sound_key); } void WMHelperAsh::OnWindowActivated(
diff --git a/components/google/core/browser/google_url_tracker_unittest.cc b/components/google/core/browser/google_url_tracker_unittest.cc index f6c325a..eed326c 100644 --- a/components/google/core/browser/google_url_tracker_unittest.cc +++ b/components/google/core/browser/google_url_tracker_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "components/google/core/browser/google_pref_names.h" #include "components/google/core/browser/google_url_tracker_client.h" @@ -132,7 +133,7 @@ void clear_listener_notified() { listener_.clear_notified(); } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; TestingPrefServiceSimple prefs_; // Creating this allows us to call
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 4c03989..4fba585 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -30,6 +30,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "components/favicon_base/favicon_usage_data.h" @@ -282,7 +283,7 @@ URLsModifiedList urls_modified_notifications_; URLsDeletedList urls_deleted_notifications_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; base::FilePath test_dir_; DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestBase);
diff --git a/components/history/core/browser/web_history_service_unittest.cc b/components/history/core/browser/web_history_service_unittest.cc index 6a62a10c..7d528f3 100644 --- a/components/history/core/browser/web_history_service_unittest.cc +++ b/components/history/core/browser/web_history_service_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" @@ -231,7 +232,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; FakeProfileOAuth2TokenService token_service_; AccountTrackerService account_tracker_; TestSigninClient signin_client_;
diff --git a/components/invalidation/impl/gcm_network_channel_unittest.cc b/components/invalidation/impl/gcm_network_channel_unittest.cc index 551bc3b..d78d4be 100644 --- a/components/invalidation/impl/gcm_network_channel_unittest.cc +++ b/components/invalidation/impl/gcm_network_channel_unittest.cc
@@ -11,6 +11,7 @@ #include "base/run_loop.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "google_apis/gaia/google_service_auth_error.h" @@ -213,7 +214,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; TestGCMNetworkChannelDelegate* delegate_; std::unique_ptr<GCMNetworkChannel> gcm_network_channel_; scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_;
diff --git a/components/invalidation/impl/invalidation_notifier_unittest.cc b/components/invalidation/impl/invalidation_notifier_unittest.cc index c2d4d1b..2fb3cf9 100644 --- a/components/invalidation/impl/invalidation_notifier_unittest.cc +++ b/components/invalidation/impl/invalidation_notifier_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "components/invalidation/impl/fake_invalidation_handler.h" #include "components/invalidation/impl/fake_invalidation_state_tracker.h" @@ -74,7 +75,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<InvalidationNotifier> invalidator_; };
diff --git a/components/nacl/loader/nacl_ipc_adapter_unittest.cc b/components/nacl/loader/nacl_ipc_adapter_unittest.cc index b89eb353..9eaa4b01 100644 --- a/components/nacl/loader/nacl_ipc_adapter_unittest.cc +++ b/components/nacl/loader/nacl_ipc_adapter_unittest.cc
@@ -11,6 +11,7 @@ #include <memory> #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/platform_thread.h" #include "base/threading/simple_thread.h" #include "base/threading/thread_task_runner_handle.h" @@ -58,7 +59,7 @@ return adapter_->Send(&msg); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<NaClIPCAdapter> adapter_;
diff --git a/components/ntp_tiles/icon_cacher_impl_unittest.cc b/components/ntp_tiles/icon_cacher_impl_unittest.cc index ac2843b..4a2ddc2 100644 --- a/components/ntp_tiles/icon_cacher_impl_unittest.cc +++ b/components/ntp_tiles/icon_cacher_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/run_loop.h" #include "base/test/mock_callback.h" +#include "base/test/scoped_task_environment.h" #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "components/favicon/core/favicon_client.h" @@ -177,7 +178,7 @@ void WaitForTasksToFinish() { task_runner_->RunUntilIdle(); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; PopularSites::Site site_; std::unique_ptr<MockImageFetcher> image_fetcher_; std::unique_ptr<MockImageDecoder> image_decoder_;
diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc index f15f305..f9138d49 100644 --- a/components/omnibox/browser/history_quick_provider_performance_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
@@ -11,6 +11,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "components/history/core/browser/history_backend.h" #include "components/history/core/browser/history_database.h" #include "components/history/core/browser/history_service.h" @@ -97,7 +98,7 @@ private: base::TimeDelta RunTest(const base::string16& text); - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<HistoryQuickProvider> provider_;
diff --git a/components/omnibox/browser/zero_suggest_provider_unittest.cc b/components/omnibox/browser/zero_suggest_provider_unittest.cc index e60556abd..8bb0e482 100644 --- a/components/omnibox/browser/zero_suggest_provider_unittest.cc +++ b/components/omnibox/browser/zero_suggest_provider_unittest.cc
@@ -8,6 +8,7 @@ #include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "components/history/core/browser/top_sites.h" #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/browser/autocomplete_provider_listener.h" @@ -165,7 +166,7 @@ void CreatePersonalizedFieldTrial(); void CreateMostVisitedFieldTrial(); - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; // Needed for OmniboxFieldTrial::ActivateStaticTrials(). std::unique_ptr<base::FieldTrialList> field_trial_list_;
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc index a2a4557..3dadcc7 100644 --- a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc +++ b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
@@ -6,6 +6,7 @@ #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/browser/stub_password_manager_client.h" #include "testing/gmock/include/gmock/gmock.h" @@ -48,7 +49,7 @@ protected: // It's needed for an initialisation of thread runners that are used in // MockPasswordStore. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; MockPasswordManagerClient client_; scoped_refptr<MockPasswordStore> store_;
diff --git a/components/policy/OWNERS b/components/policy/OWNERS index 6b620f3..f7cdd195 100644 --- a/components/policy/OWNERS +++ b/components/policy/OWNERS
@@ -3,3 +3,5 @@ tnagel@chromium.org emaxx@chromium.org pastarmovj@chromium.org + +# COMPONENT: Enterprise
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 6325cc3..4fe31eb 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -9347,14 +9347,13 @@ 'type': 'object', 'id': 'PpdResource', 'properties': { - 'effective_manufacturer': { 'type': 'string' }, 'effective_model': { 'type': 'string' } } } } } }, - 'supported_on': [ 'chrome_os:56-' ], + 'supported_on': [ 'chrome_os:57-' ], 'features': { 'dynamic_refresh': True, 'per_profile': True, @@ -9367,8 +9366,7 @@ "uri": "ipps://print-server.intranet.example.com:443/ipp/cl2k4", "uuid": "1c395fdb-5d93-4904-b246-b2c046e79d12", "ppd_resource": { - "effective_manufacturer": "MakesPrinters", - "effective_model": "ColorLaser2k4" + "effective_model": "Printer Manufacturer ColorLaser2k4" } }], 'id': 350, @@ -9383,14 +9381,20 @@ name="PRINTER_DESCRIPTION">description</ph> are free form strings that can be customized for ease of printer selection. <ph name="PRINTER_MANUFACTURER">manufacturer</ph> and <ph - name="PRINTER_MODEL">model</ph> should match one of the <ph - name="PRODUCT_NAME">$2<ex>Google Chrome OS</ex></ph> supported - printers. <ph name="PRINTER_URI">uri</ph> should be an address reachable + name="PRINTER_MODEL">model</ph> serve to ease printer identification by + end users. They represent the manufcaturer and model of the printer. <ph + name="PRINTER_URI">uri</ph> should be an address reachable from a client computer including the <ph name="URI_SCHEME">scheme</ph>, <ph name="URI_PORT">port</ph>, and <ph name="URI_QUEUE">queue</ph>. <ph name="PRINTER_UUID">uuid</ph> is optional. If provided, it is used to help deduplicate <ph name="ZEROCONF_DISCOVERY">zeroconf</ph> printers. + <ph name="PRINTER_EFFECTIVE_MODEL">effective_model</ph> must match one of + the strings which represent a <ph name="PRODUCT_NAME">$2<ex>Google Chrome + OS</ex></ph> supported printer. The string will be used to identify and + install the appropriate PPD for the printer. More information can be + found at https://support.google.com/chrome?p=noncloudprint. + Printer setup is completed upon the first use of a printer. PPDs are not downloaded until the printer is used. After that time, frequently used PPDs are cached.
diff --git a/components/prefs/pref_member_unittest.cc b/components/prefs/pref_member_unittest.cc index bc75bc8..df67710 100644 --- a/components/prefs/pref_member_unittest.cc +++ b/components/prefs/pref_member_unittest.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" @@ -104,7 +105,7 @@ } // anonymous namespace class PrefMemberTest : public testing::Test { - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(PrefMemberTest, BasicGetAndSet) {
diff --git a/components/spellcheck/renderer/spellcheck_provider.cc b/components/spellcheck/renderer/spellcheck_provider.cc index d41219a2..73d536f 100644 --- a/components/spellcheck/renderer/spellcheck_provider.cc +++ b/components/spellcheck/renderer/spellcheck_provider.cc
@@ -10,6 +10,7 @@ #include "components/spellcheck/renderer/spellcheck.h" #include "components/spellcheck/renderer/spellcheck_language.h" #include "components/spellcheck/spellcheck_build_features.h" +#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_view.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/web/WebDocument.h" @@ -41,7 +42,6 @@ spellcheck_(spellcheck) { DCHECK(spellcheck_); if (render_view) { // NULL in unit tests. - render_view->GetWebView()->setTextCheckClient(this); EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); } }
diff --git a/components/subresource_filter/content/common/BUILD.gn b/components/subresource_filter/content/common/BUILD.gn index 09ae099..05f9b61a 100644 --- a/components/subresource_filter/content/common/BUILD.gn +++ b/components/subresource_filter/content/common/BUILD.gn
@@ -10,13 +10,12 @@ "subresource_filter_message_generator.h", "subresource_filter_messages.h", ] - deps = [ + public_deps = [ + "//base", "//components/subresource_filter/core/common", "//content/public/common", - "//url", - ] - public_deps = [ "//ipc", + "//url", ] }
diff --git a/components/suggestions/image_manager_unittest.cc b/components/suggestions/image_manager_unittest.cc index e9c139e..0966a21 100644 --- a/components/suggestions/image_manager_unittest.cc +++ b/components/suggestions/image_manager_unittest.cc
@@ -10,6 +10,7 @@ #include "base/files/file_path.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "components/image_fetcher/core/image_fetcher.h" #include "components/image_fetcher/core/image_fetcher_delegate.h" @@ -139,7 +140,7 @@ int num_callback_null_called_; int num_callback_valid_called_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; // Under test. std::unique_ptr<ImageManager> image_manager_;
diff --git a/components/sync/base/weak_handle_unittest.cc b/components/sync/base/weak_handle_unittest.cc index 103c54ea..b128f1a 100644 --- a/components/sync/base/weak_handle_unittest.cc +++ b/components/sync/base/weak_handle_unittest.cc
@@ -5,6 +5,7 @@ #include "components/sync/base/weak_handle.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,7 +63,7 @@ h.Call(from_here, &Base::Test); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(WeakHandleTest, Uninitialized) {
diff --git a/components/sync/engine_impl/js_mutation_event_observer_unittest.cc b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc index a6dfe74..1a8da57 100644 --- a/components/sync/engine_impl/js_mutation_event_observer_unittest.cc +++ b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc
@@ -5,6 +5,7 @@ #include "components/sync/engine_impl/js_mutation_event_observer.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "components/sync/base/model_type.h" #include "components/sync/js/js_event_details.h" @@ -27,7 +28,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc index ff3f04e7..8ce7f06 100644 --- a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc +++ b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
@@ -6,6 +6,7 @@ #include "base/location.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "components/sync/base/cryptographer.h" #include "components/sync/base/fake_encryptor.h" @@ -33,7 +34,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/js_sync_manager_observer_unittest.cc b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc index 5279ab38..52774eeb 100644 --- a/components/sync/engine_impl/js_sync_manager_observer_unittest.cc +++ b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc
@@ -8,6 +8,7 @@ #include "base/location.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "components/sync/base/model_type.h" #include "components/sync/engine/connection_status.h" @@ -33,7 +34,7 @@ private: // This must be destroyed after the member variables below in order // for WeakHandles to be destroyed properly. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; protected: StrictMock<MockJsEventHandler> mock_js_event_handler_;
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc index 3abb3e1b..237bd20 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "base/json/json_string_value_serializer.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/tracked_objects.h" #include "components/sync/base/fake_encryptor.h" #include "components/sync/base/model_type_test_util.h" @@ -357,7 +358,7 @@ std::unique_ptr<SyncEncryptionHandlerImpl> encryption_handler_; StrictMock<SyncEncryptionHandlerObserverMock> observer_; TestIdFactory ids_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; // Verify that the encrypted types are being written to and read from the
diff --git a/components/sync/engine_impl/sync_manager_impl_unittest.cc b/components/sync/engine_impl/sync_manager_impl_unittest.cc index d7f0c79..96c6c1e 100644 --- a/components/sync/engine_impl/sync_manager_impl_unittest.cc +++ b/components/sync/engine_impl/sync_manager_impl_unittest.cc
@@ -18,6 +18,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" #include "base/test/values_test_util.h" #include "base/values.h" #include "components/sync/base/attachment_id_proto.h" @@ -255,7 +256,7 @@ PassphraseType GetPassphraseType(BaseTransaction* trans); private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; TestUserShare test_user_share_; }; @@ -1235,7 +1236,7 @@ private: // Needed by |sync_manager_|. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; // Needed by |sync_manager_|. base::ScopedTempDir temp_dir_; // Sync Id's for the roots of the enabled datatypes.
diff --git a/components/sync/js/sync_js_controller_unittest.cc b/components/sync/js/sync_js_controller_unittest.cc index 51622c0..a96c92d5 100644 --- a/components/sync/js/sync_js_controller_unittest.cc +++ b/components/sync/js/sync_js_controller_unittest.cc
@@ -5,6 +5,7 @@ #include "components/sync/js/sync_js_controller.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "components/sync/js/js_event_details.h" #include "components/sync/js/js_test_util.h" @@ -24,7 +25,7 @@ void PumpLoop() { base::RunLoop().RunUntilIdle(); } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(SyncJsControllerTest, Events) {
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index bdb23a8..680176b 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -1990,7 +1990,7 @@ EXPECT_EQ(0, row_index); EXPECT_EQ(0, column_index); name.Reset(); - accessible_cell.Release(); + accessible_cell.Reset(); // The first cell has a rowspan of 2, try navigating down and expect to get // at the end of the table. @@ -2017,7 +2017,7 @@ EXPECT_EQ(1, column_index); variant.Reset(); name.Reset(); - accessible_cell.Release(); + accessible_cell.Reset(); // Try navigating to the cell in the second row, 2nd column. base::win::ScopedComPtr<IAccessible2> cell3; @@ -2037,7 +2037,7 @@ EXPECT_EQ(1, column_index); variant.Reset(); name.Reset(); - accessible_cell.Release(); + accessible_cell.Reset(); } } // namespace content
diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc index 077173d..5d31b377 100644 --- a/content/browser/accessibility/browser_accessibility_win_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc
@@ -231,8 +231,8 @@ EXPECT_EQ(L"old text", base::string16(name)); name.Reset(); - text_dispatch.Release(); - text_accessible.Release(); + text_dispatch.Reset(); + text_accessible.Reset(); // Notify the BrowserAccessibilityManager that the text child has changed. AXContentNodeData text2; @@ -260,8 +260,8 @@ ASSERT_EQ(S_OK, hr); EXPECT_EQ(L"new text", base::string16(name)); - text_dispatch.Release(); - text_accessible.Release(); + text_dispatch.Reset(); + text_accessible.Reset(); // Delete the manager and test that all BrowserAccessibility instances are // deleted. @@ -671,8 +671,8 @@ hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); EXPECT_STREQ(combo_box_value.c_str(), text); text.Reset(); - hyperlink.Release(); - hypertext.Release(); + hyperlink.Reset(); + hypertext.Reset(); // Get the text of the check box. // It should be its name. @@ -682,8 +682,8 @@ hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); EXPECT_STREQ(check_box_name.c_str(), text); text.Reset(); - hyperlink.Release(); - hypertext.Release(); + hyperlink.Reset(); + hypertext.Reset(); // Get the text of the button. EXPECT_EQ(S_OK, root_obj->get_hyperlink(2, hyperlink.Receive())); @@ -692,8 +692,8 @@ hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); EXPECT_STREQ(button_text_name.c_str(), text); text.Reset(); - hyperlink.Release(); - hypertext.Release(); + hyperlink.Reset(); + hypertext.Reset(); // Get the text of the link. EXPECT_EQ(S_OK, root_obj->get_hyperlink(3, hyperlink.Receive())); @@ -701,8 +701,8 @@ EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); EXPECT_STREQ(link_text_name.c_str(), text); text.Reset(); - hyperlink.Release(); - hypertext.Release(); + hyperlink.Reset(); + hypertext.Reset(); long hyperlink_index; EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); @@ -1180,8 +1180,8 @@ offset = end; } - textarea_object.Release(); - text_field_object.Release(); + textarea_object.Reset(); + text_field_object.Reset(); manager.reset(); ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); @@ -1630,16 +1630,16 @@ // div_accessible and link_accessible are the only IA2 hyperlinks. EXPECT_HRESULT_FAILED(root_accessible->QueryInterface( IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); - hyperlink.Release(); + hyperlink.Reset(); EXPECT_HRESULT_SUCCEEDED(div_accessible->QueryInterface( IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); - hyperlink.Release(); + hyperlink.Reset(); EXPECT_HRESULT_FAILED(text_accessible->QueryInterface( IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); - hyperlink.Release(); + hyperlink.Reset(); EXPECT_HRESULT_SUCCEEDED(link_accessible->QueryInterface( IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); - hyperlink.Release(); + hyperlink.Reset(); EXPECT_HRESULT_SUCCEEDED(root_accessible->nActions(&n_actions)); EXPECT_EQ(0, n_actions); @@ -2414,17 +2414,17 @@ target.QueryInterface(ax_target.Receive()); EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); EXPECT_EQ(-ax_child1->unique_id(), unique_id); - ax_target.Release(); - target.Release(); + ax_target.Reset(); + target.Reset(); EXPECT_HRESULT_SUCCEEDED( describedby_relation->get_target(1, target.Receive())); target.QueryInterface(ax_target.Receive()); EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); EXPECT_EQ(-ax_child2->unique_id(), unique_id); - ax_target.Release(); - target.Release(); - describedby_relation.Release(); + ax_target.Reset(); + target.Reset(); + describedby_relation.Reset(); // Test the reverse relations. EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); @@ -2445,9 +2445,9 @@ target.QueryInterface(ax_target.Receive()); EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); EXPECT_EQ(-ax_root->unique_id(), unique_id); - ax_target.Release(); - target.Release(); - description_for_relation.Release(); + ax_target.Reset(); + target.Reset(); + description_for_relation.Reset(); EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); EXPECT_EQ(1, n_relations); @@ -2467,8 +2467,8 @@ target.QueryInterface(ax_target.Receive()); EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); EXPECT_EQ(-ax_root->unique_id(), unique_id); - ax_target.Release(); - target.Release(); + ax_target.Reset(); + target.Reset(); // Try adding one more relation. std::vector<int32_t> labelledby_ids = {3};
diff --git a/content/browser/android/url_request_content_job_unittest.cc b/content/browser/android/url_request_content_job_unittest.cc index 8dcef62e..2082aa9c 100644 --- a/content/browser/android/url_request_content_job_unittest.cc +++ b/content/browser/android/url_request_content_job_unittest.cc
@@ -12,6 +12,7 @@ #include "base/files/file_util.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_task_environment.h" #include "base/test/test_file_util.h" #include "base/threading/thread_task_runner_handle.h" #include "net/url_request/url_request.h" @@ -116,7 +117,7 @@ // retrieved. void RunRequest(const Range* range); - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; JobObserverImpl observer_; net::TestURLRequestContext context_; net::TestDelegate delegate_;
diff --git a/content/browser/appcache/appcache_quota_client_unittest.cc b/content/browser/appcache/appcache_quota_client_unittest.cc index a9e1be03..1ba3f2d 100644 --- a/content/browser/appcache/appcache_quota_client_unittest.cc +++ b/content/browser/appcache/appcache_quota_client_unittest.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "content/browser/appcache/appcache_quota_client.h" #include "content/browser/appcache/mock_appcache_service.h" #include "net/base/net_errors.h" @@ -144,7 +145,7 @@ delete_status_ = status; } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; int64_t usage_; std::set<GURL> origins_; storage::QuotaStatusCode delete_status_;
diff --git a/content/browser/appcache/appcache_service_unittest.cc b/content/browser/appcache/appcache_service_unittest.cc index ee3dfdd..0f1c7f02 100644 --- a/content/browser/appcache/appcache_service_unittest.cc +++ b/content/browser/appcache/appcache_service_unittest.cc
@@ -13,6 +13,7 @@ #include "base/pickle.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/browser/appcache/appcache_response.h" #include "content/browser/appcache/appcache_service_impl.h" @@ -188,7 +189,7 @@ net::CompletionCallback deletion_callback_; private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(AppCacheServiceImplTest, DeleteAppCachesForOrigin) {
diff --git a/content/browser/appcache/mock_appcache_storage_unittest.cc b/content/browser/appcache/mock_appcache_storage_unittest.cc index bee5ff03..55fb9149 100644 --- a/content/browser/appcache/mock_appcache_storage_unittest.cc +++ b/content/browser/appcache/mock_appcache_storage_unittest.cc
@@ -6,6 +6,7 @@ #include <stdint.h> #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_group.h" #include "content/browser/appcache/appcache_response.h" @@ -82,7 +83,7 @@ }; private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(MockAppCacheStorageTest, LoadCache_Miss) {
diff --git a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc index 5efd37ba..ce496b1 100644 --- a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc +++ b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/async_file_test_helper.h" #include "content/public/test/mock_special_storage_policy.h" @@ -179,7 +180,7 @@ std::string src_fsid_; std::string dest_fsid_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; FileSystemURL copy_src_;
diff --git a/content/browser/fileapi/file_system_context_unittest.cc b/content/browser/fileapi/file_system_context_unittest.cc index 57b0d52..749ea079 100644 --- a/content/browser/fileapi/file_system_context_unittest.cc +++ b/content/browser/fileapi/file_system_context_unittest.cc
@@ -9,6 +9,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "content/browser/quota/mock_quota_manager.h" @@ -96,7 +97,7 @@ private: base::ScopedTempDir data_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<storage::SpecialStoragePolicy> storage_policy_; scoped_refptr<MockQuotaManager> mock_quota_manager_; };
diff --git a/content/browser/fileapi/file_system_operation_runner_unittest.cc b/content/browser/fileapi/file_system_operation_runner_unittest.cc index 0e9a0c2c..7c2f174 100644 --- a/content/browser/fileapi/file_system_operation_runner_unittest.cc +++ b/content/browser/fileapi/file_system_operation_runner_unittest.cc
@@ -8,6 +8,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/browser/browser_thread.h" @@ -82,7 +83,7 @@ private: base::ScopedTempDir base_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<FileSystemContext> file_system_context_; DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunnerTest);
diff --git a/content/browser/fileapi/file_system_quota_client_unittest.cc b/content/browser/fileapi/file_system_quota_client_unittest.cc index 4cf1cf0..b2f8c4f 100644 --- a/content/browser/fileapi/file_system_quota_client_unittest.cc +++ b/content/browser/fileapi/file_system_quota_client_unittest.cc
@@ -11,6 +11,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "content/public/test/async_file_test_helper.h" #include "content/public/test/test_file_system_context.h" #include "storage/browser/fileapi/file_system_context.h" @@ -229,7 +230,7 @@ } base::ScopedTempDir data_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<storage::FileSystemContext> file_system_context_; int64_t usage_; int additional_callback_count_;
diff --git a/content/browser/fileapi/local_file_util_unittest.cc b/content/browser/fileapi/local_file_util_unittest.cc index 0196281..548b90c 100644 --- a/content/browser/fileapi/local_file_util_unittest.cc +++ b/content/browser/fileapi/local_file_util_unittest.cc
@@ -15,6 +15,7 @@ #include "base/run_loop.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "build/build_config.h" #include "content/public/test/async_file_test_helper.h" #include "content/public/test/test_file_system_context.h" @@ -121,7 +122,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<FileSystemContext> file_system_context_; base::ScopedTempDir data_dir_;
diff --git a/content/browser/fileapi/recursive_operation_delegate_unittest.cc b/content/browser/fileapi/recursive_operation_delegate_unittest.cc index fa73ff6..0bd38075 100644 --- a/content/browser/fileapi/recursive_operation_delegate_unittest.cc +++ b/content/browser/fileapi/recursive_operation_delegate_unittest.cc
@@ -15,6 +15,7 @@ #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/sandbox_file_system_test_helper.h" #include "storage/browser/fileapi/file_system_file_util.h" @@ -190,7 +191,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; // Common temp base for nondestructive uses. base::ScopedTempDir base_;
diff --git a/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc b/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc index 80de961..628805ba 100644 --- a/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc +++ b/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
@@ -8,6 +8,7 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/test_file_system_options.h" #include "storage/browser/fileapi/file_system_url.h" @@ -45,7 +46,7 @@ } base::ScopedTempDir data_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; };
diff --git a/content/browser/fileapi/sandbox_file_system_backend_unittest.cc b/content/browser/fileapi/sandbox_file_system_backend_unittest.cc index 8009e61..f83e735 100644 --- a/content/browser/fileapi/sandbox_file_system_backend_unittest.cc +++ b/content/browser/fileapi/sandbox_file_system_backend_unittest.cc
@@ -13,6 +13,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/test_file_system_options.h" #include "storage/browser/fileapi/file_system_backend.h" @@ -127,7 +128,7 @@ } base::ScopedTempDir data_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; std::unique_ptr<storage::SandboxFileSystemBackend> backend_; };
diff --git a/content/browser/fileapi/transient_file_util_unittest.cc b/content/browser/fileapi/transient_file_util_unittest.cc index 8b747e5..8104045 100644 --- a/content/browser/fileapi/transient_file_util_unittest.cc +++ b/content/browser/fileapi/transient_file_util_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "content/public/test/test_file_system_context.h" #include "storage/browser/blob/scoped_file.h" #include "storage/browser/fileapi/file_system_context.h" @@ -69,7 +70,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<storage::FileSystemContext> file_system_context_; std::unique_ptr<storage::TransientFileUtil> transient_file_util_;
diff --git a/content/browser/quota/mock_quota_manager_unittest.cc b/content/browser/quota/mock_quota_manager_unittest.cc index e71c3eed..115b5e3 100644 --- a/content/browser/quota/mock_quota_manager_unittest.cc +++ b/content/browser/quota/mock_quota_manager_unittest.cc
@@ -12,6 +12,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/mock_special_storage_policy.h" #include "content/public/test/mock_storage_client.h" @@ -101,7 +102,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<MockQuotaManager> manager_; scoped_refptr<MockSpecialStoragePolicy> policy_;
diff --git a/content/browser/quota/quota_manager_unittest.cc b/content/browser/quota/quota_manager_unittest.cc index 9c1d7aa..396dd0f 100644 --- a/content/browser/quota/quota_manager_unittest.cc +++ b/content/browser/quota/quota_manager_unittest.cc
@@ -22,6 +22,7 @@ #include "base/stl_util.h" #include "base/sys_info.h" #include "base/test/histogram_tester.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "content/public/test/mock_special_storage_policy.h" @@ -445,7 +446,7 @@ return base::Time::FromDoubleT(mock_time_counter_ * 10.0); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; base::ScopedTempDir data_dir_; scoped_refptr<QuotaManager> quota_manager_;
diff --git a/content/browser/quota/quota_temporary_storage_evictor_unittest.cc b/content/browser/quota/quota_temporary_storage_evictor_unittest.cc index b5e0992..54447c99 100644 --- a/content/browser/quota/quota_temporary_storage_evictor_unittest.cc +++ b/content/browser/quota/quota_temporary_storage_evictor_unittest.cc
@@ -14,6 +14,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "content/public/test/mock_storage_client.h" #include "storage/browser/quota/quota_manager.h" #include "storage/browser/quota/quota_temporary_storage_evictor.h" @@ -209,7 +210,7 @@ return num_get_usage_and_quota_for_eviction_; } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<MockQuotaEvictionHandler> quota_eviction_handler_; std::unique_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; int num_get_usage_and_quota_for_eviction_;
diff --git a/content/browser/quota/usage_tracker_unittest.cc b/content/browser/quota/usage_tracker_unittest.cc index 98c6831..476d298 100644 --- a/content/browser/quota/usage_tracker_unittest.cc +++ b/content/browser/quota/usage_tracker_unittest.cc
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/test/mock_special_storage_policy.h" #include "net/base/url_util.h" @@ -205,7 +206,7 @@ return client_list; } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<MockSpecialStoragePolicy> storage_policy_; MockQuotaClient quota_client_;
diff --git a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc index 7bed096..fe4448b 100644 --- a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc +++ b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
@@ -17,6 +17,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "storage/browser/fileapi/quota/quota_reservation.h" #include "testing/gtest/include/gtest/gtest.h" @@ -120,7 +121,7 @@ } private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; base::ScopedTempDir work_dir_; std::unique_ptr<storage::QuotaReservationManager> reservation_manager_;
diff --git a/content/child/indexed_db/webidbcursor_impl_unittest.cc b/content/child/indexed_db/webidbcursor_impl_unittest.cc index 2d88b29..9f5f9f7 100644 --- a/content/child/indexed_db/webidbcursor_impl_unittest.cc +++ b/content/child/indexed_db/webidbcursor_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "content/child/indexed_db/indexed_db_key_builders.h" @@ -128,7 +129,7 @@ } protected: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; WebIDBKey null_key_; std::unique_ptr<WebIDBCursorImpl> cursor_; std::unique_ptr<MockCursorImpl> mock_cursor_;
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc index 3b5126a..7d9d2c9 100644 --- a/content/child/web_url_loader_impl.cc +++ b/content/child/web_url_loader_impl.cc
@@ -13,6 +13,7 @@ #include <vector> #include "base/bind.h" +#include "base/debug/dump_without_crashing.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/memory/ptr_util.h" @@ -612,6 +613,16 @@ resource_request->resource_body_stream_url = stream_override_->stream_url; } + // PlzNavigate: Invalid renderer main resource requests are rejected by the + // browser. This should not happen. + // TODO(arthursonzogni): Remove this when the root cause for + // https://crbug.com/705508 is found. + if (IsBrowserSideNavigationEnabled() && + IsResourceTypeFrame(resource_request->resource_type) && + !resource_request->resource_body_stream_url.SchemeIs(url::kBlobScheme)) { + base::debug::DumpWithoutCrashing(); + } + const RequestExtraData empty_extra_data; const RequestExtraData* extra_data; if (request.getExtraData())
diff --git a/content/renderer/gpu/queue_message_swap_promise_unittest.cc b/content/renderer/gpu/queue_message_swap_promise_unittest.cc index d01497c..18d3b2c 100644 --- a/content/renderer/gpu/queue_message_swap_promise_unittest.cc +++ b/content/renderer/gpu/queue_message_swap_promise_unittest.cc
@@ -11,6 +11,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/test/scoped_task_environment.h" #include "cc/output/swap_promise.h" #include "content/renderer/gpu/frame_swap_message_queue.h" #include "content/renderer/gpu/render_widget_compositor.h" @@ -127,7 +128,7 @@ void VisualStateSwapPromiseDidNotSwap( cc::SwapPromise::DidNotSwapReason reason); - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; scoped_refptr<TestSyncMessageFilter> sync_message_filter_; std::vector<IPC::Message> messages_;
diff --git a/content/renderer/input/input_event_filter_unittest.cc b/content/renderer/input/input_event_filter_unittest.cc index c1876c60..b0c7e67 100644 --- a/content/renderer/input/input_event_filter_unittest.cc +++ b/content/renderer/input/input_event_filter_unittest.cc
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -193,7 +194,7 @@ } protected: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; scoped_refptr<base::TestSimpleTaskRunner> main_task_runner_; // Used to record IPCs sent by the filter to the RenderWidgetHost.
diff --git a/content/renderer/input/input_handler_wrapper.cc b/content/renderer/input/input_handler_wrapper.cc index 97a8b4d..4b1d2200 100644 --- a/content/renderer/input/input_handler_wrapper.cc +++ b/content/renderer/input/input_handler_wrapper.cc
@@ -24,13 +24,14 @@ bool enable_smooth_scrolling) : input_handler_manager_(input_handler_manager), routing_id_(routing_id), - input_handler_proxy_(input_handler.get(), this), + input_handler_proxy_(input_handler.get(), + this, + base::FeatureList::IsEnabled( + features::kTouchpadAndWheelScrollLatching)), main_task_runner_(main_task_runner), render_widget_(render_widget) { DCHECK(input_handler); input_handler_proxy_.set_smooth_scroll_enabled(enable_smooth_scrolling); - input_handler_proxy_.set_touchpad_and_wheel_scroll_latching_enabled( - base::FeatureList::IsEnabled(features::kTouchpadAndWheelScrollLatching)); } InputHandlerWrapper::~InputHandlerWrapper() {
diff --git a/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc b/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc index 173c2b8..195379db 100644 --- a/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc +++ b/content/renderer/media/android/stream_texture_wrapper_impl_unittest.cc
@@ -5,6 +5,7 @@ #include "content/renderer/media/android/stream_texture_wrapper_impl.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "testing/gtest/include/gtest/gtest.h" @@ -15,7 +16,7 @@ StreamTextureWrapperImplTest() {} // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; private: DISALLOW_COPY_AND_ASSIGN(StreamTextureWrapperImplTest);
diff --git a/content/renderer/media/media_stream_audio_source.h b/content/renderer/media/media_stream_audio_source.h index 392dac04..42ef81a 100644 --- a/content/renderer/media/media_stream_audio_source.h +++ b/content/renderer/media/media_stream_audio_source.h
@@ -82,7 +82,7 @@ // implementation of the content::MediaStreamAudioTrack interface, which // becomes associated with and owned by |track|. Returns true if the source // was successfully started. - bool ConnectToTrack(const blink::WebMediaStreamTrack& track); + virtual bool ConnectToTrack(const blink::WebMediaStreamTrack& track); // Returns the current format of the audio passing through this source to the // sinks. This can return invalid parameters if the source has not yet been
diff --git a/content/renderer/media/media_stream_audio_track.cc b/content/renderer/media/media_stream_audio_track.cc index cb64f8af..788854d 100644 --- a/content/renderer/media/media_stream_audio_track.cc +++ b/content/renderer/media/media_stream_audio_track.cc
@@ -118,6 +118,18 @@ } void MediaStreamAudioTrack::OnSetFormat(const media::AudioParameters& params) { + base::OnceCallback<void()> temp_callback; + // Call the callback if present, but don't hold a lock while doing so. + { + base::AutoLock guard(format_set_guard_); + format_is_set_ = true; + if (!format_set_callback_.is_null()) { + temp_callback = std::move(format_set_callback_); + } + } + if (!temp_callback.is_null()) { + std::move(temp_callback).Run(); + } deliverer_.OnSetFormat(params); } @@ -141,10 +153,14 @@ } } +bool MediaStreamAudioTrack::format_is_set() { + base::AutoLock guard(format_set_guard_); + return format_is_set_; +} + void MediaStreamAudioTrack::getSettings( blink::WebMediaStreamTrack::Settings& settings) { - // TODO(hta): Extract the real value. - settings.deviceId = blink::WebString("audio device ID"); + DCHECK(format_is_set()); } } // namespace content
diff --git a/content/renderer/media/media_stream_audio_track.h b/content/renderer/media/media_stream_audio_track.h index f5fa7547..8e049c1 100644 --- a/content/renderer/media/media_stream_audio_track.h +++ b/content/renderer/media/media_stream_audio_track.h
@@ -8,6 +8,7 @@ #include <memory> #include "base/atomicops.h" +#include "base/bind.h" #include "base/callback.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -72,6 +73,11 @@ // method to provide safe down-casting to their type. virtual void* GetClassIdentifier() const; + void SetFormatConfiguredCallback(base::OnceCallback<void()> callback) { + base::AutoLock guard(format_set_guard_); + format_set_callback_ = std::move(callback); + } + private: friend class MediaStreamAudioSource; friend class MediaStreamAudioDeliverer<MediaStreamAudioTrack>; @@ -95,6 +101,8 @@ void getSettings(blink::WebMediaStreamTrack::Settings& settings) override; private: + bool format_is_set(); + // In debug builds, check that all methods that could cause object graph // or data flow changes are being called on the main thread. base::ThreadChecker thread_checker_; @@ -111,6 +119,11 @@ // Buffer used to deliver silent audio data while this track is disabled. std::unique_ptr<media::AudioBus> silent_bus_; + // True if the track knows its configuration (OnSetFormat has been called). + bool format_is_set_ = false; + base::OnceCallback<void()> format_set_callback_; + base::Lock format_set_guard_; + // Provides weak pointers that are valid until Stop() is called. base::WeakPtrFactory<MediaStreamAudioTrack> weak_factory_;
diff --git a/content/renderer/media/media_stream_audio_unittest.cc b/content/renderer/media/media_stream_audio_unittest.cc index 7026025e..225e87b 100644 --- a/content/renderer/media/media_stream_audio_unittest.cc +++ b/content/renderer/media/media_stream_audio_unittest.cc
@@ -6,6 +6,7 @@ #include "base/atomicops.h" #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "base/test/test_timeouts.h" @@ -16,6 +17,7 @@ #include "content/renderer/media/media_stream_audio_track.h" #include "media/base/audio_bus.h" #include "media/base/audio_parameters.h" +#include "media/base/bind_to_current_loop.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/web/WebHeap.h" @@ -239,6 +241,9 @@ } // namespace class MediaStreamAudioTest : public ::testing::Test { + public: + void CallbackFunction() { callback_is_called_ = true; } + protected: void SetUp() override { blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"), @@ -268,6 +273,8 @@ blink::WebMediaStreamTrack blink_audio_track_; base::MessageLoop message_loop_; + + bool callback_is_called_ = false; }; // Tests that a simple source-->track-->sink connection and audio data flow @@ -453,4 +460,31 @@ track()->RemoveSink(&sink); } +// Tests that a callback is fired when initialization completes on a track. +TEST_F(MediaStreamAudioTest, CallbackOnTrackInitialization) { + // Create a source, connect it to track, and connect the track to a + // sink. + blink_audio_source_.setExtraData(new FakeMediaStreamAudioSource()); + ASSERT_TRUE(source()); + EXPECT_TRUE(source()->ConnectToTrack(blink_audio_track_)); + ASSERT_TRUE(track()); + FakeMediaStreamAudioSink sink; + ASSERT_TRUE(!sink.params().IsValid()); + track()->AddSink(&sink); + // The test callback is not thread-safe, so needs to be called on the + // current thread, not the thread from which it is triggered. + track()->SetFormatConfiguredCallback(media::BindToCurrentLoop(base::Bind( + &MediaStreamAudioTest::CallbackFunction, base::Unretained(this)))); + EXPECT_FALSE(callback_is_called_); + // Wait until valid parameters are propagated to the sink, and then confirm + // the parameters are correct at the track and the sink. + while (!sink.params().IsValid()) + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + // Since the callback is waiting to run on this thread, we have to run + // an event loop. + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(callback_is_called_); + track()->RemoveSink(&sink); +} + } // namespace content
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc index e65df9a..31aca8bc 100644 --- a/content/renderer/media/user_media_client_impl.cc +++ b/content/renderer/media/user_media_client_impl.cc
@@ -20,6 +20,7 @@ #include "content/public/renderer/render_frame.h" #include "content/renderer/media/local_media_stream_audio_source.h" #include "content/renderer/media/media_stream.h" +#include "content/renderer/media/media_stream_audio_track.h" #include "content/renderer/media/media_stream_constraints_util.h" #include "content/renderer/media/media_stream_constraints_util_video_content.h" #include "content/renderer/media/media_stream_constraints_util_video_device.h" @@ -31,6 +32,7 @@ #include "content/renderer/media/webrtc_logging.h" #include "content/renderer/media/webrtc_uma_histograms.h" #include "content/renderer/render_thread_impl.h" +#include "media/base/bind_to_current_loop.h" #include "media/capture/video_capture_types.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" @@ -722,8 +724,6 @@ if (result == MEDIA_DEVICE_OK) local_sources_.push_back((*it)); pending_local_sources_.erase(it); - - NotifyCurrentRequestInfoOfAudioSourceStarted(source, result, result_name); return; } NOTREACHED(); @@ -1311,10 +1311,18 @@ sources_.push_back(track.source()); bool connected = native_source->ConnectToTrack(track); - if (!is_pending) { - OnTrackStarted( - native_source, - connected ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE, ""); + if (!is_pending && !connected) { + // It's a failure, and it's final. + OnTrackStarted(native_source, MEDIA_DEVICE_TRACK_START_FAILURE, ""); + } else { + // The request may succeed later. + // The track will be marked as connected once the configuration has + // propagated. + MediaStreamAudioTrack::From(track)->SetFormatConfiguredCallback( + media::BindToCurrentLoop(base::Bind( + &UserMediaClientImpl::UserMediaRequestInfo::OnTrackStarted, + AsWeakPtr(), native_source, content::MEDIA_DEVICE_OK, + blink::WebString()))); } } @@ -1392,7 +1400,9 @@ // ignore the notification. auto found = std::find(sources_waiting_for_callback_.begin(), sources_waiting_for_callback_.end(), source); - if (found != sources_waiting_for_callback_.end()) + // If the start failed, inform the request here. + if (found != sources_waiting_for_callback_.end() && + result != content::MEDIA_DEVICE_OK) OnTrackStarted(source, result, result_name); }
diff --git a/content/renderer/media/user_media_client_impl_unittest.cc b/content/renderer/media/user_media_client_impl_unittest.cc index 475aa499..24e3cbf 100644 --- a/content/renderer/media/user_media_client_impl_unittest.cc +++ b/content/renderer/media/user_media_client_impl_unittest.cc
@@ -250,7 +250,6 @@ const StreamDeviceInfo& device, const blink::WebMediaConstraints& constraints, const MediaStreamSource::ConstraintsCallback& source_ready) override { - MediaStreamAudioSource* source; if (create_source_that_fails_) { class FailedAtLifeAudioSource : public MediaStreamAudioSource { public: @@ -261,21 +260,46 @@ return false; } }; - source = new FailedAtLifeAudioSource(); + FailedAtLifeAudioSource* source = new FailedAtLifeAudioSource(); + source->SetDeviceInfo(device); + return source; } else { - source = new MediaStreamAudioSource(true); - } - source->SetDeviceInfo(device); + class GeneratingAudioSource : public MediaStreamAudioSource { + public: + GeneratingAudioSource() : MediaStreamAudioSource(true) { + SetFormat( + media::AudioParameters(media::AudioParameters::AUDIO_PCM_LINEAR, + media::CHANNEL_LAYOUT_MONO, 8000, 8, 1)); + } + ~GeneratingAudioSource() override {} + void InjectAudio() { + std::unique_ptr<media::AudioBus> data = + media::AudioBus::Create(GetAudioParameters()); + DeliverDataToTracks(*data, base::TimeTicks()); + } + bool ConnectToTrack( + const blink::WebMediaStreamTrack& blink_track) override { + bool result = MediaStreamAudioSource::ConnectToTrack(blink_track); + // Queue a task to inject an audio sample after other stuff finishes. + // RunUntilIdle is required for this task to complete. + // We assume that "source" will survive long enough that it's safe + // to use base::Unretained. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&GeneratingAudioSource::InjectAudio, + base::Unretained(this))); + return result; + } + }; - if (!create_source_that_fails_) { - // RunUntilIdle is required for this task to complete. + GeneratingAudioSource* source = new GeneratingAudioSource(); + source->SetDeviceInfo(device); + // Queue a task to inform about the source being ready. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&UserMediaClientImplUnderTest::SignalSourceReady, source_ready, source)); + return source; } - - return source; } MediaStreamVideoSource* CreateVideoSource( @@ -362,7 +386,6 @@ user_media_client_impl_->RequestUserMediaForTest(); FakeMediaStreamDispatcherRequestUserMediaComplete(); StartMockedVideoSource(); - EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_SUCCEEDED, user_media_client_impl_->request_state());
diff --git a/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc b/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc index ce3a94d8a5..f5e9081 100644 --- a/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc +++ b/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc
@@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/renderer/media_capture_from_element/html_audio_element_capturer_source.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/renderer/media_stream_audio_sink.h" #include "content/renderer/media/media_stream_audio_track.h" -#include "content/renderer/media_capture_from_element/html_audio_element_capturer_source.h" #include "media/audio/null_audio_sink.h" #include "media/base/audio_parameters.h" #include "media/base/fake_audio_render_callback.h" @@ -111,7 +112,7 @@ } protected: - const base::MessageLoop message_loop_; + const base::test::ScopedTaskEnvironment scoped_task_environment_; blink::WebMediaStreamSource blink_audio_source_; blink::WebMediaStreamTrack blink_audio_track_;
diff --git a/content/renderer/media_recorder/audio_track_recorder_unittest.cc b/content/renderer/media_recorder/audio_track_recorder_unittest.cc index 6929364c..fe85b99 100644 --- a/content/renderer/media_recorder/audio_track_recorder_unittest.cc +++ b/content/renderer/media_recorder/audio_track_recorder_unittest.cc
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/stl_util.h" +#include "base/test/scoped_task_environment.h" #include "base/time/time.h" #include "content/renderer/media/media_stream_audio_source.h" #include "media/audio/simple_sources.h" @@ -191,7 +192,7 @@ DoOnEncodedAudio(params, *encoded_data, timestamp); } - const base::MessageLoop message_loop_; + const base::test::ScopedTaskEnvironment scoped_task_environment_; // ATR and WebMediaStreamTrack for fooling it. std::unique_ptr<AudioTrackRecorder> audio_track_recorder_;
diff --git a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc index 4d7acff..59518d0 100644 --- a/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc +++ b/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc
@@ -21,11 +21,14 @@ LayoutTestRenderFrameObserver::LayoutTestRenderFrameObserver( RenderFrame* render_frame) : RenderFrameObserver(render_frame), binding_(this) { - render_frame->GetWebFrame()->setContentSettingsClient( + test_runner::WebTestRunner* test_runner = LayoutTestRenderThreadObserver::GetInstance() ->test_interfaces() - ->TestRunner() - ->GetWebContentSettings()); + ->TestRunner(); + render_frame->GetWebFrame()->setContentSettingsClient( + test_runner->GetWebContentSettings()); + render_frame->GetWebFrame()->setTextCheckClient( + test_runner->GetWebTextCheckClient()); render_frame->GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( &LayoutTestRenderFrameObserver::BindRequest, base::Unretained(this))); }
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc index 5ae3f3c5..23b19b3 100644 --- a/content/shell/test_runner/test_runner.cc +++ b/content/shell/test_runner/test_runner.cc
@@ -1893,8 +1893,11 @@ return mock_content_settings_client_.get(); } +WebTextCheckClient* TestRunner::GetWebTextCheckClient() const { + return spellcheck_.get(); +} + void TestRunner::InitializeWebViewWithMocks(blink::WebView* web_view) { - web_view->setTextCheckClient(spellcheck_.get()); web_view->setCredentialManagerClient(credential_manager_client_.get()); }
diff --git a/content/shell/test_runner/test_runner.h b/content/shell/test_runner/test_runner.h index 0cdf5fb..62a7ea8 100644 --- a/content/shell/test_runner/test_runner.h +++ b/content/shell/test_runner/test_runner.h
@@ -100,6 +100,7 @@ bool HasCustomTextDump(std::string* custom_text_dump) const override; bool ShouldDumpBackForwardList() const override; blink::WebContentSettingsClient* GetWebContentSettings() const override; + blink::WebTextCheckClient* GetWebTextCheckClient() const override; void InitializeWebViewWithMocks(blink::WebView* web_view) override; void SetFocus(blink::WebView* web_view, bool focus) override;
diff --git a/content/shell/test_runner/web_test_runner.h b/content/shell/test_runner/web_test_runner.h index 3deb890..5dd449c4 100644 --- a/content/shell/test_runner/web_test_runner.h +++ b/content/shell/test_runner/web_test_runner.h
@@ -19,6 +19,7 @@ namespace blink { class WebContentSettingsClient; class WebLocalFrame; +class WebTextCheckClient; class WebView; } @@ -30,6 +31,10 @@ // embedder should use this for all WebViews it creates. virtual blink::WebContentSettingsClient* GetWebContentSettings() const = 0; + // Returns a mock WebTextCheckClient that is used for layout tests. An + // embedder should use this for all WebLocalFrames it creates. + virtual blink::WebTextCheckClient* GetWebTextCheckClient() const = 0; + // After WebTestDelegate::TestFinished was invoked, the following methods // can be used to determine what kind of dump the main WebViewTestProxy can // provide.
diff --git a/content/test/gpu/generate_buildbot_json.py b/content/test/gpu/generate_buildbot_json.py index c3aa401..978ad7b5 100755 --- a/content/test/gpu/generate_buildbot_json.py +++ b/content/test/gpu/generate_buildbot_json.py
@@ -652,6 +652,21 @@ 'swarming': False, 'os_type': 'android', }, + 'Android Release (NVIDIA Shield TV)': { + 'swarming_dimensions': [ + { + # There are no PCI IDs on Android. + # This is a hack to get the script working. + 'gpu': '0000:0000', + 'os': 'Android' + }, + ], + 'build_config': 'android-chromium', + # This bot is a one-off and doesn't have similar slaves in the + # swarming pool. + 'swarming': False, + 'os_type': 'android', + }, # The following "optional" testers don't actually exist on the # waterfall. They are present here merely to specify additional
diff --git a/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc b/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc index da2f96381..2913d65b 100644 --- a/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc +++ b/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
@@ -291,7 +291,7 @@ // longer interested in sensor events and ISensorEvents can be released. ON_CALL(*sensor_, SetEventSink(IsNull())) .WillByDefault(Invoke([this](ISensorEvents* events) { - sensor_events_.Release(); + sensor_events_.Reset(); if (this->run_loop_) { message_loop_.task_runner()->PostTask( FROM_HERE,
diff --git a/device/generic_sensor/platform_sensor_provider_win.cc b/device/generic_sensor/platform_sensor_provider_win.cc index c541130..12b4efdd 100644 --- a/device/generic_sensor/platform_sensor_provider_win.cc +++ b/device/generic_sensor/platform_sensor_provider_win.cc
@@ -71,7 +71,7 @@ void PlatformSensorProviderWin::StopSensorThread() { if (sensor_thread_ && sensor_thread_->IsRunning()) { - sensor_manager_.Release(); + sensor_manager_.Reset(); sensor_thread_->Stop(); } }
diff --git a/device/sensors/data_fetcher_shared_memory_win.cc b/device/sensors/data_fetcher_shared_memory_win.cc index 76aa7f5..f2fa6c852 100644 --- a/device/sensors/data_fetcher_shared_memory_win.cc +++ b/device/sensors/data_fetcher_shared_memory_win.cc
@@ -418,29 +418,29 @@ case CONSUMER_TYPE_ORIENTATION: if (sensor_inclinometer_.get()) { sensor_inclinometer_->SetEventSink(nullptr); - sensor_inclinometer_.Release(); + sensor_inclinometer_.Reset(); } break; case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: if (sensor_inclinometer_absolute_.get()) { sensor_inclinometer_absolute_->SetEventSink(nullptr); - sensor_inclinometer_absolute_.Release(); + sensor_inclinometer_absolute_.Reset(); } break; case CONSUMER_TYPE_MOTION: if (sensor_accelerometer_.get()) { sensor_accelerometer_->SetEventSink(nullptr); - sensor_accelerometer_.Release(); + sensor_accelerometer_.Reset(); } if (sensor_gyrometer_.get()) { sensor_gyrometer_->SetEventSink(nullptr); - sensor_gyrometer_.Release(); + sensor_gyrometer_.Reset(); } break; case CONSUMER_TYPE_LIGHT: if (sensor_light_.get()) { sensor_light_->SetEventSink(nullptr); - sensor_light_.Release(); + sensor_light_.Reset(); } break; default:
diff --git a/device/vr/android/gvr/gvr_delegate.h b/device/vr/android/gvr/gvr_delegate.h index 5e25c5b..9a21aba 100644 --- a/device/vr/android/gvr/gvr_delegate.h +++ b/device/vr/android/gvr/gvr_delegate.h
@@ -46,7 +46,11 @@ }; // GvrDelegate, which allows WebVR presentation. -class DEVICE_VR_EXPORT PresentingGvrDelegate : public GvrDelegate {}; +class DEVICE_VR_EXPORT PresentingGvrDelegate : public GvrDelegate { + public: + virtual void SetSubmitClient( + device::mojom::VRSubmitFrameClientPtr submit_client) = 0; +}; } // namespace device
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc index 68f9a1d7..2b402d5a 100644 --- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -9,10 +9,9 @@ #include <utility> #include "base/memory/ref_counted.h" -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "content/public/test/test_browser_context.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "device/bluetooth/bluetooth_common.h" #include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" @@ -41,8 +40,7 @@ class BluetoothEventRouterTest : public ExtensionsTest { public: BluetoothEventRouterTest() - : ui_thread_(content::BrowserThread::UI, &message_loop_), - mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()), + : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()), router_(new BluetoothEventRouter(browser_context())) { router_->SetAdapterForTest(mock_adapter_); } @@ -55,9 +53,7 @@ } protected: - base::MessageLoopForUI message_loop_; - // Note: |ui_thread_| must be declared before |router_|. - content::TestBrowserThread ui_thread_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; testing::StrictMock<device::MockBluetoothAdapter>* mock_adapter_; std::unique_ptr<BluetoothEventRouter> router_; };
diff --git a/extensions/browser/api/declarative/rules_registry_unittest.cc b/extensions/browser/api/declarative/rules_registry_unittest.cc index 4598a071..ce448621 100644 --- a/extensions/browser/api/declarative/rules_registry_unittest.cc +++ b/extensions/browser/api/declarative/rules_registry_unittest.cc
@@ -7,10 +7,9 @@ #include <algorithm> #include <utility> -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/values.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/api/declarative/rules_registry_service.h" #include "extensions/browser/api/declarative/test_rules_registry.h" #include "extensions/browser/api_test_utils.h" @@ -29,8 +28,7 @@ using api_test_utils::ParseDictionary; TEST(RulesRegistryTest, FillOptionalIdentifiers) { - base::MessageLoopForUI message_loop; - content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop); + content::TestBrowserThreadBundle test_browser_thread_bundle; std::string error; scoped_refptr<RulesRegistry> registry = @@ -148,8 +146,7 @@ } TEST(RulesRegistryTest, FillOptionalPriority) { - base::MessageLoopForUI message_loop; - content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop); + content::TestBrowserThreadBundle test_browser_thread_bundle; std::string error; scoped_refptr<RulesRegistry> registry = @@ -185,8 +182,7 @@ // Test verifies 2 rules defined in the manifest appear in the registry. TEST(RulesRegistryTest, TwoRulesInManifest) { - base::MessageLoopForUI message_loop; - content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop); + content::TestBrowserThreadBundle test_browser_thread_bundle; // Create extension std::unique_ptr<base::DictionaryValue> manifest = ParseDictionary( @@ -266,8 +262,7 @@ // Tests verifies that rules defined in the manifest cannot be deleted but // programmatically added rules still can be deleted. TEST(RulesRegistryTest, DeleteRuleInManifest) { - base::MessageLoopForUI message_loop; - content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop); + content::TestBrowserThreadBundle test_browser_thread_bundle; // Create extension std::unique_ptr<base::DictionaryValue> manifest = ParseDictionary(
diff --git a/extensions/browser/api/storage/storage_frontend_unittest.cc b/extensions/browser/api/storage/storage_frontend_unittest.cc index 91733d6b..4fe87c7 100644 --- a/extensions/browser/api/storage/storage_frontend_unittest.cc +++ b/extensions/browser/api/storage/storage_frontend_unittest.cc
@@ -9,12 +9,11 @@ #include "base/bind.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "content/public/browser/browser_context.h" #include "content/public/test/test_browser_context.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/api/extensions_api_client.h" #include "extensions/browser/api/storage/settings_namespace.h" #include "extensions/browser/api/storage/settings_test_util.h" @@ -23,8 +22,6 @@ #include "extensions/browser/value_store/value_store_factory_impl.h" #include "testing/gtest/include/gtest/gtest.h" -using content::BrowserThread; - namespace extensions { namespace settings = settings_namespace; @@ -42,9 +39,7 @@ // history, the test names are unchanged. class ExtensionSettingsFrontendTest : public ExtensionsTest { public: - ExtensionSettingsFrontendTest() - : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), - file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} + ExtensionSettingsFrontendTest() = default; void SetUp() override { ExtensionsTest::SetUp(); @@ -71,9 +66,7 @@ scoped_refptr<ValueStoreFactoryImpl> storage_factory_; private: - base::MessageLoop message_loop_; - content::TestBrowserThread ui_thread_; - content::TestBrowserThread file_thread_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; ExtensionsAPIClient extensions_api_client_; };
diff --git a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc index 683df17..6afc206 100644 --- a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc +++ b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
@@ -14,15 +14,13 @@ #include "base/strings/string_number_conversions.h" #include "components/prefs/mock_pref_change_callback.h" #include "content/public/test/test_browser_context.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extensions_test.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" -using content::BrowserThread; - namespace extensions { namespace { @@ -43,8 +41,7 @@ // Base class for tests. class AppWindowGeometryCacheTest : public ExtensionsTest { public: - AppWindowGeometryCacheTest() - : ui_thread_(BrowserThread::UI, &ui_message_loop_) {} + AppWindowGeometryCacheTest() = default; // testing::Test overrides: void SetUp() override; @@ -68,8 +65,7 @@ std::string AddExtensionWithPrefs(const std::string& name); protected: - base::MessageLoopForUI ui_message_loop_; - content::TestBrowserThread ui_thread_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; ExtensionPrefs* extension_prefs_; // Weak. std::unique_ptr<AppWindowGeometryCache> cache_; };
diff --git a/extensions/browser/info_map_unittest.cc b/extensions/browser/info_map_unittest.cc index 5dfe7de..3f4c412 100644 --- a/extensions/browser/info_map_unittest.cc +++ b/extensions/browser/info_map_unittest.cc
@@ -2,31 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/message_loop/message_loop.h" -#include "base/path_service.h" -#include "content/public/test/test_browser_thread.h" #include "extensions/browser/info_map.h" + +#include "base/path_service.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "extensions/common/extension.h" #include "extensions/common/extension_paths.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" -using content::BrowserThread; - namespace keys = extensions::manifest_keys; namespace extensions { class InfoMapTest : public testing::Test { public: - InfoMapTest() - : ui_thread_(BrowserThread::UI, &message_loop_), - io_thread_(BrowserThread::IO, &message_loop_) {} + InfoMapTest() = default; private: - base::MessageLoop message_loop_; - content::TestBrowserThread ui_thread_; - content::TestBrowserThread io_thread_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; }; // Returns a barebones test Extension object with the given name.
diff --git a/extensions/browser/quota_service_unittest.cc b/extensions/browser/quota_service_unittest.cc index ab71f02f9..2dcc4aec 100644 --- a/extensions/browser/quota_service_unittest.cc +++ b/extensions/browser/quota_service_unittest.cc
@@ -6,18 +6,16 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" -#include "base/message_loop/message_loop.h" #include "base/process/process.h" #include "base/run_loop.h" #include "base/strings/string_util.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/quota_service.h" #include "testing/gtest/include/gtest/gtest.h" using base::TimeDelta; using base::TimeTicks; -using content::BrowserThread; namespace extensions { @@ -102,11 +100,7 @@ class QuotaServiceTest : public testing::Test { public: QuotaServiceTest() - : extension_a_("a"), - extension_b_("b"), - extension_c_("c"), - loop_(), - ui_thread_(BrowserThread::UI, &loop_) {} + : extension_a_("a"), extension_b_("b"), extension_c_("c") {} void SetUp() override { service_.reset(new QuotaService()); } void TearDown() override { base::RunLoop().RunUntilIdle(); @@ -118,8 +112,7 @@ std::string extension_b_; std::string extension_c_; std::unique_ptr<QuotaService> service_; - base::MessageLoop loop_; - content::TestBrowserThread ui_thread_; + content::TestBrowserThreadBundle test_browser_thread_bundle_; }; class QuotaLimitHeuristicTest : public testing::Test {
diff --git a/extensions/renderer/BUILD.gn b/extensions/renderer/BUILD.gn index 9b8bbdf..fca1114 100644 --- a/extensions/renderer/BUILD.gn +++ b/extensions/renderer/BUILD.gn
@@ -23,6 +23,8 @@ "api_binding_bridge.h", "api_binding_hooks.cc", "api_binding_hooks.h", + "api_binding_hooks_delegate.cc", + "api_binding_hooks_delegate.h", "api_binding_js_util.cc", "api_binding_js_util.h", "api_binding_types.h", @@ -221,6 +223,8 @@ "v8_schema_registry.h", "wake_event_page.cc", "wake_event_page.h", + "web_request_hooks.cc", + "web_request_hooks.h", "web_ui_injection_host.cc", "web_ui_injection_host.h", "worker_script_context_set.cc",
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc index 933c87b..a039f8c 100644 --- a/extensions/renderer/api_binding.cc +++ b/extensions/renderer/api_binding.cc
@@ -306,8 +306,6 @@ } } - binding_hooks_->InitializeInContext(context); - return object; } @@ -430,7 +428,10 @@ auto* event_data = static_cast<EventData*>(info.Data().As<v8::External>()->Value()); v8::Local<v8::Value> retval; - if (event_data->supports_rules) { + if (event_data->binding->binding_hooks_->CreateCustomEvent( + context, event_data->full_name, &retval)) { + // A custom event was created; our work is done. + } else if (event_data->supports_rules) { gin::Handle<DeclarativeEvent> event = gin::CreateHandle( isolate, new DeclarativeEvent( event_data->full_name, event_data->binding->type_refs_,
diff --git a/extensions/renderer/api_binding_hooks.cc b/extensions/renderer/api_binding_hooks.cc index 260c59d..d5d608f 100644 --- a/extensions/renderer/api_binding_hooks.cc +++ b/extensions/renderer/api_binding_hooks.cc
@@ -7,6 +7,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/supports_user_data.h" +#include "extensions/renderer/api_binding_hooks_delegate.h" #include "extensions/renderer/api_signature.h" #include "gin/arguments.h" #include "gin/handle.h" @@ -212,12 +213,6 @@ request_hooks_[method_name] = hook; } -void APIBindingHooks::RegisterJsSource(v8::Global<v8::String> source, - v8::Global<v8::String> resource_name) { - js_hooks_source_ = std::move(source); - js_resource_name_ = std::move(resource_name); -} - APIBindingHooks::RequestResult APIBindingHooks::RunHooks( const std::string& method_name, v8::Local<v8::Context> context, @@ -321,26 +316,6 @@ return result; } -void APIBindingHooks::InitializeInContext(v8::Local<v8::Context> context) { - if (js_hooks_source_.IsEmpty()) - return; - - v8::Local<v8::String> source = js_hooks_source_.Get(context->GetIsolate()); - v8::Local<v8::String> resource_name = - js_resource_name_.Get(context->GetIsolate()); - v8::Local<v8::Script> script; - v8::ScriptOrigin origin(resource_name); - if (!v8::Script::Compile(context, source, &origin).ToLocal(&script)) - return; - v8::Local<v8::Value> func_as_value = script->Run(); - v8::Local<v8::Function> function; - if (!gin::ConvertFromV8(context->GetIsolate(), func_as_value, &function)) - return; - v8::Local<v8::Value> api_hooks = GetJSHookInterface(context); - v8::Local<v8::Value> args[] = {api_hooks}; - run_js_.Run(function, context, arraysize(args), args); -} - v8::Local<v8::Object> APIBindingHooks::GetJSHookInterface( v8::Local<v8::Context> context) { return GetJSHookInterfaceObject(api_name_, context, true); @@ -361,6 +336,18 @@ return hook_interface->GetCustomCallback(name, context->GetIsolate()); } +bool APIBindingHooks::CreateCustomEvent(v8::Local<v8::Context> context, + const std::string& event_name, + v8::Local<v8::Value>* event_out) { + return delegate_ && + delegate_->CreateCustomEvent(context, run_js_, event_name, event_out); +} + +void APIBindingHooks::SetDelegate( + std::unique_ptr<APIBindingHooksDelegate> delegate) { + delegate_ = std::move(delegate); +} + bool APIBindingHooks::UpdateArguments( v8::Local<v8::Function> function, v8::Local<v8::Context> context,
diff --git a/extensions/renderer/api_binding_hooks.h b/extensions/renderer/api_binding_hooks.h index a9a3d29..1c667e2a 100644 --- a/extensions/renderer/api_binding_hooks.h +++ b/extensions/renderer/api_binding_hooks.h
@@ -20,6 +20,7 @@ } namespace extensions { +class APIBindingHooksDelegate; class APISignature; // A class to register custom hooks for given API calls that need different @@ -69,17 +70,10 @@ ~APIBindingHooks(); // Register a custom binding to handle requests. + // TODO(devlin): Remove this in favor of a method on APIBindingHooksDelegate. void RegisterHandleRequest(const std::string& method_name, const HandleRequestHook& hook); - // Registers a JS script to be compiled and run in order to initialize any JS - // hooks within a v8 context. - void RegisterJsSource(v8::Global<v8::String> source, - v8::Global<v8::String> resource_name); - - // Initializes JS hooks within a context. - void InitializeInContext(v8::Local<v8::Context> context); - // Looks for any custom hooks associated with the given request, and, if any // are found, runs them. Returns the result of running the hooks, if any. RequestResult RunHooks(const std::string& method_name, @@ -95,6 +89,14 @@ v8::Local<v8::Function> GetCustomJSCallback(const std::string& method_name, v8::Local<v8::Context> context); + // Creates a new JS event for the given |event_name|, if a custom event is + // provided. Returns true if an event was created. + bool CreateCustomEvent(v8::Local<v8::Context> context, + const std::string& event_name, + v8::Local<v8::Value>* event_out); + + void SetDelegate(std::unique_ptr<APIBindingHooksDelegate> delegate); + private: // Updates the |arguments| by running |function| and settings arguments to the // returned result. @@ -108,13 +110,6 @@ // All registered request handlers. std::map<std::string, HandleRequestHook> request_hooks_; - // The script to run to initialize JS hooks, if any. - v8::Global<v8::String> js_hooks_source_; - - // The name of the JS resource for the hooks. Used to create a ScriptOrigin - // to make exception stack traces more readable. - v8::Global<v8::String> js_resource_name_; - // The name of the associated API. std::string api_name_; @@ -123,6 +118,8 @@ // script is disabled. binding::RunJSFunctionSync run_js_; + std::unique_ptr<APIBindingHooksDelegate> delegate_; + DISALLOW_COPY_AND_ASSIGN(APIBindingHooks); };
diff --git a/extensions/renderer/api_binding_hooks_delegate.cc b/extensions/renderer/api_binding_hooks_delegate.cc new file mode 100644 index 0000000..6516785 --- /dev/null +++ b/extensions/renderer/api_binding_hooks_delegate.cc
@@ -0,0 +1,19 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/renderer/api_binding_hooks_delegate.h" + +namespace extensions { + +APIBindingHooksDelegate::~APIBindingHooksDelegate() {} + +bool APIBindingHooksDelegate::CreateCustomEvent( + v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js_sync, + const std::string& event_name, + v8::Local<v8::Value>* event_out) { + return false; +} + +} // namespace extensions
diff --git a/extensions/renderer/api_binding_hooks_delegate.h b/extensions/renderer/api_binding_hooks_delegate.h new file mode 100644 index 0000000..2fa84b8f --- /dev/null +++ b/extensions/renderer/api_binding_hooks_delegate.h
@@ -0,0 +1,31 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_RENDERER_API_BINDING_HOOKS_DELEGATE_H_ +#define EXTENSIONS_RENDERER_API_BINDING_HOOKS_DELEGATE_H_ + +#include "extensions/renderer/api_binding_types.h" +#include "v8/include/v8.h" + +namespace extensions { + +// A per-API set of custom hooks to override the default behavior. +class APIBindingHooksDelegate { + public: + virtual ~APIBindingHooksDelegate(); + + // Allows custom implementations to return a different event object. + // Populates |event_out| and returns true if a custom implementation should + // be used, otherwise returns false. + virtual bool CreateCustomEvent(v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js_sync, + const std::string& event_name, + v8::Local<v8::Value>* event_out); + + // TODO(devlin): Add a virtual HandleRequest() method. +}; + +} // namespace extensions + +#endif // EXTENSIONS_RENDERER_API_BINDING_HOOKS_DELEGATE_H_
diff --git a/extensions/renderer/api_binding_unittest.cc b/extensions/renderer/api_binding_unittest.cc index d3d4675e..a2b36a2 100644 --- a/extensions/renderer/api_binding_unittest.cc +++ b/extensions/renderer/api_binding_unittest.cc
@@ -716,19 +716,19 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setHandleRequest('oneString', function() {\n" - " this.requestArguments = Array.from(arguments);\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setHandleRequest('oneString', function() {\n" + " this.requestArguments = Array.from(arguments);\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetFunctions(kFunctions); SetHooks(std::move(hooks)); @@ -777,13 +777,10 @@ " return this.requestArguments\n" " });\n" "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); SetHooks(std::move(hooks)); SetFunctions(kFunctions); @@ -829,19 +826,19 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setUpdateArgumentsPreValidate('oneString', function() {\n" - " throw new Error('Custom Hook Error');\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setUpdateArgumentsPreValidate('oneString', function() {\n" + " throw new Error('Custom Hook Error');\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetHooks(std::move(hooks)); SetFunctions(kFunctions); @@ -871,19 +868,19 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setHandleRequest('oneString', str => {\n" - " return str + ' pong';\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setHandleRequest('oneString', str => {\n" + " return str + ' pong';\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetHooks(std::move(hooks)); SetFunctions(kFunctions); @@ -932,19 +929,19 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setHandleRequest('oneString', str => {\n" - " throw new Error('Custom Hook Error');\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setHandleRequest('oneString', str => {\n" + " throw new Error('Custom Hook Error');\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetHooks(std::move(hooks)); SetFunctions(kFunctions); @@ -1038,20 +1035,20 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setUpdateArgumentsPostValidate('oneString', function() {\n" - " this.requestArguments = Array.from(arguments);\n" - " return ['pong'];\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = - gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource( - v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setUpdateArgumentsPostValidate('oneString', function() {\n" + " this.requestArguments = Array.from(arguments);\n" + " return ['pong'];\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetHooks(std::move(hooks)); SetFunctions(kFunctions); @@ -1087,17 +1084,19 @@ v8::HandleScope handle_scope(isolate()); v8::Local<v8::Context> context = MainContext(); - const char kRegisterHook[] = - "(function(hooks) {\n" - " hooks.setUpdateArgumentsPostValidate('oneString', function() {\n" - " return [{}];\n" - " });\n" - "})"; - v8::Local<v8::String> source_string = - gin::StringToV8(isolate(), kRegisterHook); - v8::Local<v8::String> source_name = gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource(v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); + { + const char kRegisterHook[] = + "(function(hooks) {\n" + " hooks.setUpdateArgumentsPostValidate('oneString', function() {\n" + " return [{}];\n" + " });\n" + "})"; + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = + FunctionFromString(context, kRegisterHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); + } SetHooks(std::move(hooks)); SetFunctions(kFunctions);
diff --git a/extensions/renderer/api_bindings_system_unittest.cc b/extensions/renderer/api_bindings_system_unittest.cc index 3933f1e..20e85319 100644 --- a/extensions/renderer/api_bindings_system_unittest.cc +++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -14,6 +14,7 @@ #include "extensions/common/extension_api.h" #include "extensions/renderer/api_binding.h" #include "extensions/renderer/api_binding_hooks.h" +#include "extensions/renderer/api_binding_hooks_delegate.h" #include "extensions/renderer/api_binding_test_util.h" #include "extensions/renderer/api_binding_types.h" #include "extensions/renderer/api_bindings_system_unittest.h" @@ -65,6 +66,8 @@ " }]," " 'events': [{" " 'name': 'alphaEvent'" + " }, {" + " 'name': 'alphaOtherEvent'" " }]" "}"; @@ -91,6 +94,50 @@ return true; } +class TestHooks : public APIBindingHooksDelegate { + public: + TestHooks() {} + ~TestHooks() override {} + + using CustomEventFactory = base::Callback<v8::Local<v8::Value>( + v8::Local<v8::Context>, + const binding::RunJSFunctionSync& run_js, + const std::string& event_name)>; + + bool CreateCustomEvent(v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js_sync, + const std::string& event_name, + v8::Local<v8::Value>* event_out) override { + if (!custom_event_.is_null()) { + *event_out = custom_event_.Run(context, run_js_sync, event_name); + return true; + } + return false; + } + + void RegisterHooks(APIBindingHooks* hooks) { + for (const auto& request_handler : request_handlers_) { + hooks->RegisterHandleRequest(request_handler.first, + request_handler.second); + } + } + + void AddHandler(base::StringPiece name, + const APIBindingHooks::HandleRequestHook& hook) { + request_handlers_[name.as_string()] = hook; + } + + void SetCustomEvent(const CustomEventFactory& custom_event) { + custom_event_ = custom_event; + } + + private: + std::map<std::string, APIBindingHooks::HandleRequestHook> request_handlers_; + CustomEventFactory custom_event_; + + DISALLOW_COPY_AND_ASSIGN(TestHooks); +}; + } // namespace APIBindingsSystemTest::APIBindingsSystemTest() {} @@ -322,11 +369,13 @@ return result; }; - APIBindingHooks* hooks = bindings_system()->GetHooksForAPI(kAlphaAPIName); - ASSERT_TRUE(hooks); - hooks->RegisterHandleRequest( - "alpha.functionWithCallback", - base::Bind(hook, &did_call)); + auto test_hooks = base::MakeUnique<TestHooks>(); + test_hooks->AddHandler("alpha.functionWithCallback", + base::Bind(hook, &did_call)); + APIBindingHooks* binding_hooks = + bindings_system()->GetHooksForAPI(kAlphaAPIName); + test_hooks->RegisterHooks(binding_hooks); + binding_hooks->SetDelegate(std::move(test_hooks)); v8::Local<v8::Object> alpha_api = bindings_system()->CreateAPIInstance( kAlphaAPIName, context, isolate(), base::Bind(&AllowAllAPIs), nullptr); @@ -365,16 +414,15 @@ " });\n" "})"; - APIBindingHooks* hooks = bindings_system()->GetHooksForAPI(kAlphaAPIName); - ASSERT_TRUE(hooks); - v8::Local<v8::String> source_string = gin::StringToV8(isolate(), kHook); - v8::Local<v8::String> source_name = gin::StringToV8(isolate(), "custom_hook"); - hooks->RegisterJsSource(v8::Global<v8::String>(isolate(), source_string), - v8::Global<v8::String>(isolate(), source_name)); - + APIBindingHooks* hooks = nullptr; v8::Local<v8::Object> alpha_api = bindings_system()->CreateAPIInstance( - kAlphaAPIName, context, isolate(), base::Bind(&AllowAllAPIs), nullptr); + kAlphaAPIName, context, isolate(), base::Bind(&AllowAllAPIs), &hooks); ASSERT_FALSE(alpha_api.IsEmpty()); + ASSERT_TRUE(hooks); + v8::Local<v8::Object> js_hooks = hooks->GetJSHookInterface(context); + v8::Local<v8::Function> function = FunctionFromString(context, kHook); + v8::Local<v8::Value> args[] = {js_hooks}; + RunFunctionOnGlobal(function, context, arraysize(args), args); { const char kTestCall[] = @@ -423,4 +471,47 @@ } } +TEST_F(APIBindingsSystemTest, TestCustomEvent) { + v8::HandleScope handle_scope(isolate()); + v8::Local<v8::Context> context = MainContext(); + + auto create_custom_event = [](v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js, + const std::string& event_name) { + v8::Isolate* isolate = context->GetIsolate(); + v8::Local<v8::Object> ret = v8::Object::New(isolate); + ret->Set(context, gin::StringToSymbol(isolate, "name"), + gin::StringToSymbol(isolate, event_name)) + .ToChecked(); + return ret.As<v8::Value>(); + }; + + auto test_hooks = base::MakeUnique<TestHooks>(); + test_hooks->SetCustomEvent(base::Bind(create_custom_event)); + APIBindingHooks* binding_hooks = + bindings_system()->GetHooksForAPI(kAlphaAPIName); + binding_hooks->SetDelegate(std::move(test_hooks)); + + v8::Local<v8::Object> api = bindings_system()->CreateAPIInstance( + kAlphaAPIName, context, isolate(), base::Bind(&AllowAllAPIs), nullptr); + + v8::Local<v8::Value> event = + GetPropertyFromObject(api, context, "alphaEvent"); + ASSERT_TRUE(event->IsObject()); + EXPECT_EQ( + "\"alpha.alphaEvent\"", + GetStringPropertyFromObject(event.As<v8::Object>(), context, "name")); + v8::Local<v8::Value> event2 = + GetPropertyFromObject(api, context, "alphaEvent"); + EXPECT_EQ(event, event2); + + v8::Local<v8::Value> other_event = + GetPropertyFromObject(api, context, "alphaOtherEvent"); + ASSERT_TRUE(other_event->IsObject()); + EXPECT_EQ("\"alpha.alphaOtherEvent\"", + GetStringPropertyFromObject(other_event.As<v8::Object>(), context, + "name")); + EXPECT_NE(event, other_event); +} + } // namespace extensions
diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc index bae1a7b..5fab5e6 100644 --- a/extensions/renderer/argument_spec.cc +++ b/extensions/renderer/argument_spec.cc
@@ -144,9 +144,20 @@ std::unique_ptr<base::Value>* out_value, std::string* error) const { if (type_ == ArgumentType::FUNCTION) { - // We can't serialize functions. We shouldn't be asked to. - DCHECK(!out_value); - return value->IsFunction(); + if (!value->IsFunction()) + return false; + // Certain APIs, like webRequest and contextMenus, have functions as + // parameters that aren't the callback. We need these included in the + // signature for validation purposes, but don't *really* need to serialize + // them. Unfortunately, if we don't, validation in the browser fails. For + // now, the expectation is that functions are serialized as dictionaries, + // to match the content::V8ValueConverter behavior. + // TODO(devlin): Change this somehow. We could, for instance, add a + // 'validation_only' property to the schema to indicate that a parameter + // or property shouldn't be serialized or included in the compiled types. + if (out_value) + *out_value = base::MakeUnique<base::DictionaryValue>(); + return true; } if (type_ == ArgumentType::REF) {
diff --git a/extensions/renderer/argument_spec_unittest.cc b/extensions/renderer/argument_spec_unittest.cc index 8f71f2ae..d3318a9 100644 --- a/extensions/renderer/argument_spec_unittest.cc +++ b/extensions/renderer/argument_spec_unittest.cc
@@ -268,6 +268,8 @@ { const char kFunctionSpec[] = "{ 'type': 'function' }"; ArgumentSpec spec(*ValueFromString(kFunctionSpec)); + // Functions are serialized as empty dictionaries. + ExpectSuccess(spec, "(function() {})", "{}"); ExpectSuccessWithNoConversion(spec, "(function() {})"); ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })");
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc index 89f722c..ea68652 100644 --- a/extensions/renderer/native_extension_bindings_system.cc +++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -20,6 +20,7 @@ #include "extensions/renderer/script_context.h" #include "extensions/renderer/script_context_set.h" #include "extensions/renderer/storage_area.h" +#include "extensions/renderer/web_request_hooks.h" #include "gin/converter.h" #include "gin/handle.h" #include "gin/per_context_data.h" @@ -340,6 +341,8 @@ base::Bind(&StorageArea::CreateStorageArea)); api_system_.RegisterCustomType("types.ChromeSetting", base::Bind(&ChromeSetting::Create)); + api_system_.GetHooksForAPI("webRequest") + ->SetDelegate(base::MakeUnique<WebRequestHooks>()); } NativeExtensionBindingsSystem::~NativeExtensionBindingsSystem() {}
diff --git a/extensions/renderer/resources/web_request_custom_bindings.js b/extensions/renderer/resources/web_request_custom_bindings.js index 7239c23..0befc670 100644 --- a/extensions/renderer/resources/web_request_custom_bindings.js +++ b/extensions/renderer/resources/web_request_custom_bindings.js
@@ -4,9 +4,10 @@ // Custom binding for the webRequest API. -var binding = require('binding').Binding.create('webRequest'); -var sendRequest = require('sendRequest').sendRequest; -var WebRequestEvent = require('webRequestEvent').WebRequestEvent; +var binding = apiBridge || require('binding').Binding.create('webRequest'); +var sendRequest = bindingUtil ? + $Function.bind(bindingUtil.sendRequest, bindingUtil) : + require('sendRequest').sendRequest; binding.registerCustomHook(function(api) { var apiFunctions = api.apiFunctions; @@ -18,6 +19,8 @@ }); }); -binding.registerCustomEvent(WebRequestEvent); - -exports.$set('binding', binding.generate()); +if (!apiBridge) { + var webRequestEvent = require('webRequestEvent').WebRequestEvent; + binding.registerCustomEvent(webRequestEvent); + exports.$set('binding', binding.generate()); +}
diff --git a/extensions/renderer/web_request_hooks.cc b/extensions/renderer/web_request_hooks.cc new file mode 100644 index 0000000..ad2c3fb --- /dev/null +++ b/extensions/renderer/web_request_hooks.cc
@@ -0,0 +1,79 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/renderer/web_request_hooks.h" + +#include "base/values.h" +#include "content/public/child/v8_value_converter.h" +#include "extensions/common/extension_api.h" +#include "extensions/renderer/api_binding_hooks.h" +#include "extensions/renderer/module_system.h" +#include "extensions/renderer/script_context.h" +#include "extensions/renderer/script_context_set.h" +#include "gin/converter.h" + +namespace extensions { + +WebRequestHooks::WebRequestHooks() {} +WebRequestHooks::~WebRequestHooks() = default; + +bool WebRequestHooks::CreateCustomEvent( + v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js_sync, + const std::string& event_name, + v8::Local<v8::Value>* event_out) { + v8::Isolate* isolate = context->GetIsolate(); + + ScriptContext* script_context = + ScriptContextSet::GetContextByV8Context(context); + v8::Local<v8::Object> internal_bindings; + { + ModuleSystem::NativesEnabledScope enable_natives( + script_context->module_system()); + if (!script_context->module_system() + ->Require("webRequestEvent") + .ToLocal(&internal_bindings)) { + return false; + } + } + + v8::Local<v8::Value> get_event_value; + { + v8::TryCatch try_catch(isolate); + if (!internal_bindings + ->Get(context, + gin::StringToSymbol(isolate, "createWebRequestEvent")) + .ToLocal(&get_event_value) || + !get_event_value->IsFunction()) { + NOTREACHED(); + return false; + } + } + + // The JS validates that the extra parameters passed to the web request event + // match the expected schema. We need to initialize the event with that + // schema. + const base::DictionaryValue* event_spec = + ExtensionAPI::GetSharedInstance()->GetSchema(event_name); + DCHECK(event_spec); + const base::ListValue* extra_params = nullptr; + CHECK(event_spec->GetList("extraParameters", &extra_params)); + std::unique_ptr<content::V8ValueConverter> converter( + content::V8ValueConverter::create()); + v8::Local<v8::Value> extra_parameters_spec = + converter->ToV8Value(extra_params, context); + + v8::Local<v8::Function> get_event = get_event_value.As<v8::Function>(); + v8::Local<v8::Value> args[] = { + gin::StringToSymbol(isolate, event_name), + v8::Undefined(isolate), // opt_argSchemas are ignored. + extra_parameters_spec, + // opt_eventOptions and opt_webViewInstanceId are ignored. + }; + *event_out = + run_js_sync.Run(get_event, context, arraysize(args), args).Get(isolate); + return true; +} + +} // namespace extensions
diff --git a/extensions/renderer/web_request_hooks.h b/extensions/renderer/web_request_hooks.h new file mode 100644 index 0000000..1ab17175 --- /dev/null +++ b/extensions/renderer/web_request_hooks.h
@@ -0,0 +1,40 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ +#define EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ + +#include <string> + +#include "base/macros.h" +#include "extensions/renderer/api_binding_hooks_delegate.h" +#include "extensions/renderer/api_binding_types.h" +#include "v8/include/v8.h" + +namespace extensions { + +// Custom hooks for the WebRequest API. +class WebRequestHooks : public APIBindingHooksDelegate { + public: + WebRequestHooks(); + ~WebRequestHooks() override; + + // APIBindingHooksDelegate: + // Creates a new WebRequest event. + // TODO(devlin): WebRequest events are a very unfortunate implementation + // detail, but refactoring means changing a few parts of the internal API. + // It's not impossible, but it's a bit involved. However, as we move more + // towards native bindings, it's definitely something we'll want to do. + bool CreateCustomEvent(v8::Local<v8::Context> context, + const binding::RunJSFunctionSync& run_js_sync, + const std::string& event_name, + v8::Local<v8::Value>* event_out) override; + + private: + DISALLOW_COPY_AND_ASSIGN(WebRequestHooks); +}; + +} // namespace extensions + +#endif // EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_
diff --git a/gpu/command_buffer/service/command_executor_unittest.cc b/gpu/command_buffer/service/command_executor_unittest.cc index c17703a..34610ed 100644 --- a/gpu/command_buffer/service/command_executor_unittest.cc +++ b/gpu/command_buffer/service/command_executor_unittest.cc
@@ -10,6 +10,7 @@ #include <memory> #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "gpu/command_buffer/common/command_buffer_mock.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" @@ -76,7 +77,7 @@ int32_t* buffer_; std::unique_ptr<gles2::MockGLES2Decoder> decoder_; std::unique_ptr<CommandExecutor> executor_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(CommandExecutorTest, ExecutorDoesNothingIfRingBufferIsEmpty) {
diff --git a/gpu/ipc/service/direct_composition_surface_win.cc b/gpu/ipc/service/direct_composition_surface_win.cc index 42b42a7f..b794e77 100644 --- a/gpu/ipc/service/direct_composition_surface_win.cc +++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -232,7 +232,7 @@ video_input_size_ = input_size; video_output_size_ = output_size; - video_processor_.Release(); + video_processor_.Reset(); video_processor_enumerator_.Receive(); D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc = {}; desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE; @@ -305,7 +305,7 @@ if (!swap_chain_ || swap_chain_size_ != swap_chain_size) { first_present = true; swap_chain_size_ = swap_chain_size; - swap_chain_.Release(); + swap_chain_.Reset(); ReallocateSwapChain(); } else if (last_gl_image_ == image_dxgi) { // The swap chain is presenting the same image as last swap, which means @@ -390,7 +390,7 @@ video_processor_ = surface_->video_processor(); // out_view_ depends on video_processor_enumerator_, so ensure it's // recreated if the enumerator is. - out_view_.Release(); + out_view_.Reset(); return true; } @@ -452,7 +452,7 @@ DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709); CHECK(SUCCEEDED(hr)); } - out_view_.Release(); + out_view_.Reset(); } void DCLayerTree::InitVisual(size_t i) { @@ -479,7 +479,7 @@ visual_info->content_visual; gfx::Rect bounds_rect = params.rect; - visual_info->surface.Release(); + visual_info->surface.Reset(); if (!visual_info->swap_chain_presenter) { visual_info->swap_chain_presenter = base::MakeUnique<SwapChainPresenter>(this, d3d11_device_); @@ -745,8 +745,8 @@ void DirectCompositionSurfaceWin::ReleaseCurrentSurface() { ReleaseDrawTexture(true); - dcomp_surface_.Release(); - swap_chain_.Release(); + dcomp_surface_.Reset(); + swap_chain_.Reset(); } void DirectCompositionSurfaceWin::InitializeSurface() { @@ -802,7 +802,7 @@ real_surface_ = nullptr; } if (draw_texture_) { - draw_texture_.Release(); + draw_texture_.Reset(); if (dcomp_surface_) { HRESULT hr = dcomp_surface_->EndDraw(); CHECK(SUCCEEDED(hr)); @@ -852,8 +852,8 @@ CHECK(SUCCEEDED(hr)); g_current_surface = nullptr; } - draw_texture_.Release(); - dcomp_surface_.Release(); + draw_texture_.Reset(); + dcomp_surface_.Reset(); } gfx::Size DirectCompositionSurfaceWin::GetSize() {
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper.mm b/ios/chrome/browser/crash_report/crash_restore_helper.mm index 03d54937..98d8754 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper.mm +++ b/ios/chrome/browser/crash_report/crash_restore_helper.mm
@@ -20,7 +20,7 @@ #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/crash_report/breakpad_helper.h" #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/tabs/tab.h" #import "ios/chrome/browser/tabs/tab_model.h" @@ -262,8 +262,7 @@ _sessionRestored = YES; _infoBarBridge.reset(); SessionWindowIOS* sessionWindow = [[SessionServiceIOS sharedService] - loadWindowFromPath:[self sessionBackupPath] - forBrowserState:[_tabModel browserState]]; + loadWindowFromPath:[self sessionBackupPath]]; if (sessionWindow) { breakpad_helper::WillStartCrashRestoration(); return [_tabModel restoreSessionWindow:sessionWindow]; @@ -285,8 +284,7 @@ _sessionRestored = YES; SessionWindowIOS* window = [[SessionServiceIOS sharedService] - loadWindowFromPath:[self sessionBackupPath] - forBrowserState:[_tabModel browserState]]; + loadWindowFromPath:[self sessionBackupPath]]; DCHECK(window); NSArray* sessions = window.sessions; if (!sessions.count)
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm b/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm index 688c97e..4eaf66f 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm +++ b/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm
@@ -11,7 +11,7 @@ #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/crash_report/crash_restore_helper.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ios/chrome/browser/sessions/BUILD.gn b/ios/chrome/browser/sessions/BUILD.gn index 028a8b2..6111b6e3 100644 --- a/ios/chrome/browser/sessions/BUILD.gn +++ b/ios/chrome/browser/sessions/BUILD.gn
@@ -11,6 +11,8 @@ "ios_chrome_tab_restore_service_client.mm", "ios_chrome_tab_restore_service_factory.cc", "ios_chrome_tab_restore_service_factory.h", + "session_service_ios.h", + "session_service_ios.mm", "session_window_ios.h", "session_window_ios.mm", ] @@ -36,8 +38,6 @@ sources = [ "NSCoder+Compatibility.h", "NSCoder+Compatibility.mm", - "session_service.h", - "session_service.mm", "session_util.h", "session_util.mm", "tab_restore_service_delegate_impl_ios.h", @@ -75,25 +75,10 @@ configs += [ "//build/config/compiler:enable_arc" ] testonly = true sources = [ + "session_service_ios_unittest.mm", "session_window_ios_unittest.mm", ] deps = [ - ":sessions", - ":unit_tests_non_arc", - "//base", - "//ios/web", - "//testing/gtest", - ] - libs = [ "Foundation.framework" ] -} - -source_set("unit_tests_non_arc") { - configs += [ "//build/config/compiler:enable_arc" ] - testonly = true - sources = [ - "session_service_unittest.mm", - ] - deps = [ ":resources_unit_tests", ":sessions", "//base", @@ -104,10 +89,11 @@ "//testing/gtest", "//third_party/ocmock", ] + libs = [ "Foundation.framework" ] } bundle_data("resources_unit_tests") { - visibility = [ ":unit_tests_non_arc" ] + visibility = [ ":unit_tests" ] testonly = true sources = [ "//ios/chrome/test/data/sessions/corrupted.plist",
diff --git a/ios/chrome/browser/sessions/session_service.mm b/ios/chrome/browser/sessions/session_service.mm deleted file mode 100644 index b1254ff..0000000 --- a/ios/chrome/browser/sessions/session_service.mm +++ /dev/null
@@ -1,279 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "ios/chrome/browser/sessions/session_service.h" - -#import <UIKit/UIKit.h> - -#include "base/files/file_path.h" -#include "base/location.h" -#include "base/logging.h" -#include "base/mac/bind_objc_block.h" -#include "base/mac/foundation_util.h" -#include "base/memory/ref_counted.h" -#include "base/sequenced_task_runner.h" -#include "base/strings/sys_string_conversions.h" -#include "base/synchronization/lock.h" -#include "base/threading/sequenced_worker_pool.h" -#include "base/threading/thread_restrictions.h" -#include "ios/chrome/browser/browser_state/chrome_browser_state.h" -#import "ios/chrome/browser/sessions/session_window_ios.h" -#import "ios/web/public/crw_navigation_item_storage.h" -#import "ios/web/public/crw_session_certificate_policy_cache_storage.h" -#import "ios/web/public/crw_session_storage.h" -#include "ios/web/public/web_thread.h" - -// When C++ exceptions are disabled, the C++ library defines |try| and -// |catch| so as to allow exception-expecting C++ code to build properly when -// language support for exceptions is not present. These macros interfere -// with the use of |@try| and |@catch| in Objective-C files such as this one. -// Undefine these macros here, after everything has been #included, since -// there will be no C++ uses and only Objective-C uses from this point on. -#undef try -#undef catch - -const NSTimeInterval kSaveDelay = 2.5; // Value taken from Desktop Chrome. - -@interface SessionWindowUnarchiver () - -// Register compatibility aliases to support loading serialised sessions -// informations when the serialised classes are renamed. -+ (void)registerCompatibilityAliases; - -@end - -@implementation SessionWindowUnarchiver - -@synthesize browserState = _browserState; - -- (instancetype)initForReadingWithData:(NSData*)data - browserState:(ios::ChromeBrowserState*)browserState { - if (self = [super initForReadingWithData:data]) { - _browserState = browserState; - } - return self; -} - -- (instancetype)initForReadingWithData:(NSData*)data { - return [self initForReadingWithData:data browserState:nullptr]; -} - -+ (void)initialize { - [super initialize]; - [self registerCompatibilityAliases]; -} - -// When adding a new compatibility alias here, create a new crbug to track its -// removal and mark it with a release at least one year after the introduction -// of the alias. -+ (void)registerCompatibilityAliases { - // TODO(crbug.com/661633): those aliases where introduced between M57 and - // M58, so remove them after M67 has shipped to stable. - [SessionWindowUnarchiver - setClass:[CRWSessionCertificatePolicyCacheStorage class] - forClassName:@"SessionCertificatePolicyManager"]; - [SessionWindowUnarchiver setClass:[CRWSessionStorage class] - forClassName:@"SessionController"]; - [SessionWindowUnarchiver setClass:[CRWSessionStorage class] - forClassName:@"CRWSessionController"]; - [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] - forClassName:@"SessionEntry"]; - [SessionWindowUnarchiver setClass:[CRWNavigationItemStorage class] - forClassName:@"CRWSessionEntry"]; - [SessionWindowUnarchiver setClass:[SessionWindowIOS class] - forClassName:@"SessionWindow"]; - - // TODO(crbug.com/661633): this alias was introduced between M58 and M59, so - // remove it after M68 has shipped to stable. - [SessionWindowUnarchiver setClass:[CRWSessionStorage class] - forClassName:@"CRWNavigationManagerStorage"]; - [SessionWindowUnarchiver - setClass:[CRWSessionCertificatePolicyCacheStorage class] - forClassName:@"CRWSessionCertificatePolicyManager"]; -} - -@end - -@interface SessionServiceIOS () { - // The SequencedTaskRunner on which File IO operations are performed. - scoped_refptr<base::SequencedTaskRunner> _taskRunner; - - // Maps save directories to the pending SessionWindow for the delayed - // save behavior. - base::scoped_nsobject<NSMutableDictionary> _pendingWindows; -} - -// Saves the session corresponding to |directory| on the background -// task runner |_taskRunner|. -- (void)performSaveToDirectoryInBackground:(NSString*)directory; -@end - -@implementation SessionServiceIOS - -+ (SessionServiceIOS*)sharedService { - static SessionServiceIOS* singleton = nil; - if (!singleton) { - singleton = [[[self class] alloc] init]; - } - return singleton; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _pendingWindows.reset([[NSMutableDictionary alloc] init]); - auto* pool = web::WebThread::GetBlockingPool(); - _taskRunner = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); - } - return self; -} - -// Returns the path of the session file. -- (NSString*)sessionFilePathForDirectory:(NSString*)directory { - return [directory stringByAppendingPathComponent:@"session.plist"]; -} - -// Do the work of saving on a background thread. Assumes |window| is threadsafe. -- (void)performSaveToDirectoryInBackground:(NSString*)directory { - DCHECK(directory); - DCHECK([_pendingWindows objectForKey:directory] != nil); - UIBackgroundTaskIdentifier identifier = [[UIApplication sharedApplication] - beginBackgroundTaskWithExpirationHandler:^{ - }]; - DCHECK(identifier != UIBackgroundTaskInvalid); - - // Put the window into a local var so it can be retained for the block, yet - // we can remove it from the dictionary to allow queuing another save. - SessionWindowIOS* localWindow = - [[_pendingWindows objectForKey:directory] retain]; - [_pendingWindows removeObjectForKey:directory]; - - _taskRunner->PostTask( - FROM_HERE, base::BindBlock(^{ - @try { - [self performSaveWindow:localWindow toDirectory:directory]; - } @catch (NSException* e) { - // Do nothing. - } - [localWindow release]; - [[UIApplication sharedApplication] endBackgroundTask:identifier]; - })); -} - -// Saves a SessionWindowIOS in a given directory. In case the directory doesn't -// exists it will be automatically created. -- (void)performSaveWindow:(SessionWindowIOS*)window - toDirectory:(NSString*)directory { - base::ThreadRestrictions::AssertIOAllowed(); - NSFileManager* fileManager = [NSFileManager defaultManager]; - BOOL isDir; - if (![fileManager fileExistsAtPath:directory isDirectory:&isDir]) { - NSError* error = nil; - BOOL result = [fileManager createDirectoryAtPath:directory - withIntermediateDirectories:YES - attributes:nil - error:&error]; - DCHECK(result); - if (!result) { - DLOG(ERROR) << "Error creating destination dir: " - << base::SysNSStringToUTF8([error description]); - return; - } - } else { - DCHECK(isDir); - if (!isDir) { - DLOG(ERROR) << "Destination Directory already exists and is a file"; - return; - } - } - - NSString* filename = [self sessionFilePathForDirectory:directory]; - if (filename) { - BOOL result = [NSKeyedArchiver archiveRootObject:window toFile:filename]; - DCHECK(result); - if (!result) - DLOG(ERROR) << "Error writing session file to " << filename; - // Encrypt the session file (mostly for Incognito, but can't hurt to - // always do it). - NSDictionary* attributeDict = - [NSDictionary dictionaryWithObject:NSFileProtectionComplete - forKey:NSFileProtectionKey]; - NSError* error = nil; - BOOL success = [[NSFileManager defaultManager] setAttributes:attributeDict - ofItemAtPath:filename - error:&error]; - if (!success) { - DLOG(ERROR) << "Error encrypting session file" - << base::SysNSStringToUTF8([error description]); - } - } -} - -- (void)saveWindow:(SessionWindowIOS*)window - forBrowserState:(ios::ChromeBrowserState*)browserState - immediately:(BOOL)immediately { - NSString* stashPath = - base::SysUTF8ToNSString(browserState->GetStatePath().value()); - // If there's an existing session window for |stashPath|, clear it before it's - // replaced. - SessionWindowIOS* pendingSession = base::mac::ObjCCast<SessionWindowIOS>( - [_pendingWindows objectForKey:stashPath]); - [pendingSession clearSessions]; - // Set |window| as the pending save for |stashPath|. - [_pendingWindows setObject:window forKey:stashPath]; - if (immediately) { - [NSObject cancelPreviousPerformRequestsWithTarget:self]; - [self performSaveToDirectoryInBackground:stashPath]; - } else if (!pendingSession) { - // If there wasn't previously a delayed save pending for |stashPath|, - // enqueue one now. - [self performSelector:@selector(performSaveToDirectoryInBackground:) - withObject:stashPath - afterDelay:kSaveDelay]; - } -} - -- (SessionWindowIOS*)loadWindowForBrowserState: - (ios::ChromeBrowserState*)browserState { - NSString* stashPath = - base::SysUTF8ToNSString(browserState->GetStatePath().value()); - SessionWindowIOS* window = - [self loadWindowFromPath:[self sessionFilePathForDirectory:stashPath] - forBrowserState:browserState]; - return window; -} - -- (SessionWindowIOS*)loadWindowFromPath:(NSString*)path - forBrowserState:(ios::ChromeBrowserState*)browserState { - SessionWindowIOS* window = nil; - @try { - NSData* data = [NSData dataWithContentsOfFile:path]; - if (data) { - base::scoped_nsobject<SessionWindowUnarchiver> unarchiver([ - [SessionWindowUnarchiver alloc] initForReadingWithData:data - browserState:browserState]); - window = [[[unarchiver decodeObjectForKey:@"root"] retain] autorelease]; - } - } @catch (NSException* exception) { - DLOG(ERROR) << "Error loading session file."; - } - return window; -} - -// Deletes the file containing the commands for the last session in the given -// browserState directory. -- (void)deleteLastSession:(NSString*)directory { - NSString* sessionFile = [self sessionFilePathForDirectory:directory]; - _taskRunner->PostTask( - FROM_HERE, base::BindBlock(^{ - base::ThreadRestrictions::AssertIOAllowed(); - NSFileManager* fileManager = [NSFileManager defaultManager]; - if (![fileManager fileExistsAtPath:sessionFile]) - return; - if (![fileManager removeItemAtPath:sessionFile error:nil]) - CHECK(false) << "Unable to delete session file."; - })); -} - -@end
diff --git a/ios/chrome/browser/sessions/session_service.h b/ios/chrome/browser/sessions/session_service_ios.h similarity index 70% rename from ios/chrome/browser/sessions/session_service.h rename to ios/chrome/browser/sessions/session_service_ios.h index 0676b2e..19739499 100644 --- a/ios/chrome/browser/sessions/session_service.h +++ b/ios/chrome/browser/sessions/session_service_ios.h
@@ -2,34 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ -#define IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ +#ifndef IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_ +#define IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_ #import <Foundation/Foundation.h> -#include "base/mac/scoped_nsobject.h" - namespace ios { class ChromeBrowserState; } @class SessionWindowIOS; -// Trivial NSKeyedUnarchiver subclass that can be configured with a -// ChromeBrowserState instance that decoding classes can use. -@interface SessionWindowUnarchiver : NSKeyedUnarchiver - -// The BrowserState set on the unarchiver at init; a weak pointer. -@property(nonatomic, readonly) ios::ChromeBrowserState* browserState; - -// Inits exactly as initForReadingWithData: does, additionally setting -// |browserState| on the receiver. -- (instancetype)initForReadingWithData:(NSData*)data - browserState:(ios::ChromeBrowserState*)browserState - NS_DESIGNATED_INITIALIZER; - -@end - // A singleton service for saving the current session. Can either save on a // delay or immediately. Saving is always performed on a separate thread. @interface SessionServiceIOS : NSObject @@ -58,8 +41,7 @@ // Loads the window from the given backup file on disk on the main thread. // Returns nil if unable to read the sessions. -- (SessionWindowIOS*)loadWindowFromPath:(NSString*)path - forBrowserState:(ios::ChromeBrowserState*)browserState; +- (SessionWindowIOS*)loadWindowFromPath:(NSString*)sessionPath; // Returns the path of the session file. - (NSString*)sessionFilePathForDirectory:(NSString*)directory; @@ -77,4 +59,4 @@ @end -#endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ +#endif // IOS_CHROME_BROWSER_SESSIONS_SESSION_SERVICE_IOS_H_
diff --git a/ios/chrome/browser/sessions/session_service_ios.mm b/ios/chrome/browser/sessions/session_service_ios.mm new file mode 100644 index 0000000..cf89278 --- /dev/null +++ b/ios/chrome/browser/sessions/session_service_ios.mm
@@ -0,0 +1,252 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/sessions/session_service_ios.h" + +#import <UIKit/UIKit.h> + +#include "base/critical_closure.h" +#include "base/files/file_path.h" +#include "base/location.h" +#include "base/logging.h" +#import "base/mac/bind_objc_block.h" +#include "base/memory/ref_counted.h" +#include "base/sequenced_task_runner.h" +#include "base/strings/sys_string_conversions.h" +#include "base/threading/sequenced_worker_pool.h" +#include "base/threading/thread_restrictions.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/sessions/session_window_ios.h" +#import "ios/web/public/crw_navigation_item_storage.h" +#import "ios/web/public/crw_session_certificate_policy_cache_storage.h" +#import "ios/web/public/crw_session_storage.h" +#include "ios/web/public/web_thread.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// When C++ exceptions are disabled, the C++ library defines |try| and +// |catch| so as to allow exception-expecting C++ code to build properly when +// language support for exceptions is not present. These macros interfere +// with the use of |@try| and |@catch| in Objective-C files such as this one. +// Undefine these macros here, after everything has been #included, since +// there will be no C++ uses and only Objective-C uses from this point on. +#undef try +#undef catch + +namespace { +const NSTimeInterval kSaveDelay = 2.5; // Value taken from Desktop Chrome. +NSString* const kRootObjectKey = @"root"; // Key for the root object. +} + +@implementation NSKeyedUnarchiver (CrLegacySessionCompatibility) + +// When adding a new compatibility alias here, create a new crbug to track its +// removal and mark it with a release at least one year after the introduction +// of the alias. +- (void)cr_registerCompatibilityAliases { + // TODO(crbug.com/661633): those aliases where introduced between M57 and + // M58, so remove them after M67 has shipped to stable. + [self setClass:[CRWSessionCertificatePolicyCacheStorage class] + forClassName:@"SessionCertificatePolicyManager"]; + [self setClass:[CRWSessionStorage class] forClassName:@"SessionController"]; + [self setClass:[CRWSessionStorage class] + forClassName:@"CRWSessionController"]; + [self setClass:[CRWNavigationItemStorage class] forClassName:@"SessionEntry"]; + [self setClass:[CRWNavigationItemStorage class] + forClassName:@"CRWSessionEntry"]; + [self setClass:[SessionWindowIOS class] forClassName:@"SessionWindow"]; + + // TODO(crbug.com/661633): this alias was introduced between M58 and M59, so + // remove it after M68 has shipped to stable. + [self setClass:[CRWSessionStorage class] + forClassName:@"CRWNavigationManagerStorage"]; + [self setClass:[CRWSessionCertificatePolicyCacheStorage class] + forClassName:@"CRWSessionCertificatePolicyManager"]; +} + +@end + +@interface SessionServiceIOS () { + // The SequencedTaskRunner on which File IO operations are performed. + scoped_refptr<base::SequencedTaskRunner> _taskRunner; + + // Maps save directories to the pending SessionWindow for the delayed + // save behavior. + NSMutableDictionary<NSString*, SessionWindowIOS*>* _pendingWindows; +} + +// Saves the session corresponding to |directory| on the background +// task runner |_taskRunner|. +- (void)performSaveToDirectoryInBackground:(NSString*)directory; +@end + +@implementation SessionServiceIOS + ++ (SessionServiceIOS*)sharedService { + static SessionServiceIOS* singleton = nil; + if (!singleton) { + singleton = [[[self class] alloc] init]; + } + return singleton; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _pendingWindows = [NSMutableDictionary dictionary]; + base::SequencedWorkerPool* pool = web::WebThread::GetBlockingPool(); + _taskRunner = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); + } + return self; +} + +// Returns the path of the session file. +- (NSString*)sessionFilePathForDirectory:(NSString*)directory { + return [directory stringByAppendingPathComponent:@"session.plist"]; +} + +// Do the work of saving on a background thread. Assumes |window| is threadsafe. +- (void)performSaveToDirectoryInBackground:(NSString*)directory { + DCHECK(directory); + DCHECK([_pendingWindows objectForKey:directory] != nil); + + // Put the window into a local var so it can be retained for the block, yet + // we can remove it from the dictionary to allow queuing another save. + SessionWindowIOS* localWindow = [_pendingWindows objectForKey:directory]; + [_pendingWindows removeObjectForKey:directory]; + + _taskRunner->PostTask( + FROM_HERE, base::MakeCriticalClosure(base::BindBlockArc(^{ + @try { + [self performSaveWindow:localWindow toDirectory:directory]; + } @catch (NSException* e) { + // Do nothing. + } + }))); +} + +// Saves a SessionWindowIOS in a given directory. In case the directory doesn't +// exists it will be automatically created. +- (void)performSaveWindow:(SessionWindowIOS*)window + toDirectory:(NSString*)directory { + base::ThreadRestrictions::AssertIOAllowed(); + NSFileManager* fileManager = [NSFileManager defaultManager]; + BOOL isDir; + if (![fileManager fileExistsAtPath:directory isDirectory:&isDir]) { + NSError* error = nil; + BOOL result = [fileManager createDirectoryAtPath:directory + withIntermediateDirectories:YES + attributes:nil + error:&error]; + DCHECK(result); + if (!result) { + DLOG(ERROR) << "Error creating destination directory: " + << base::SysNSStringToUTF8(directory) << ": " + << base::SysNSStringToUTF8([error description]); + return; + } + } else { + DCHECK(isDir); + if (!isDir) { + DLOG(ERROR) << "Error creating destination directory: " + << base::SysNSStringToUTF8(directory) << ": " + << "file exists and is not a directory."; + return; + } + } + + NSString* filename = [self sessionFilePathForDirectory:directory]; + if (filename) { + BOOL result = [NSKeyedArchiver archiveRootObject:window toFile:filename]; + DCHECK(result); + if (!result) { + DLOG(ERROR) << "Error writing session file to " << filename; + return; + } + + // Encrypt the session file (mostly for Incognito, but can't hurt to + // always do it). + NSError* error = nil; + BOOL success = [[NSFileManager defaultManager] + setAttributes:@{NSFileProtectionKey : NSFileProtectionComplete} + ofItemAtPath:filename + error:&error]; + if (!success) { + DLOG(ERROR) << "Error encrypting session file: " + << base::SysNSStringToUTF8(filename) << ": " + << base::SysNSStringToUTF8([error description]); + } + } +} + +- (void)saveWindow:(SessionWindowIOS*)window + forBrowserState:(ios::ChromeBrowserState*)browserState + immediately:(BOOL)immediately { + NSString* stashPath = + base::SysUTF8ToNSString(browserState->GetStatePath().value()); + BOOL hadPendingSession = [_pendingWindows objectForKey:stashPath] != nil; + [_pendingWindows setObject:window forKey:stashPath]; + if (immediately) { + [NSObject cancelPreviousPerformRequestsWithTarget:self]; + [self performSaveToDirectoryInBackground:stashPath]; + } else if (!hadPendingSession) { + // If there wasn't previously a delayed save pending for |stashPath|, + // enqueue one now. + [self performSelector:@selector(performSaveToDirectoryInBackground:) + withObject:stashPath + afterDelay:kSaveDelay]; + } +} + +- (SessionWindowIOS*)loadWindowForBrowserState: + (ios::ChromeBrowserState*)browserState { + NSString* stashPath = + base::SysUTF8ToNSString(browserState->GetStatePath().value()); + SessionWindowIOS* window = + [self loadWindowFromPath:[self sessionFilePathForDirectory:stashPath]]; + return window; +} + +- (SessionWindowIOS*)loadWindowFromPath:(NSString*)sessionPath { + @try { + NSData* data = [NSData dataWithContentsOfFile:sessionPath]; + if (!data) + return nil; + + NSKeyedUnarchiver* unarchiver = + [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; + + // Register compatibility aliases to support legacy saved sessions. + [unarchiver cr_registerCompatibilityAliases]; + return [unarchiver decodeObjectForKey:kRootObjectKey]; + } @catch (NSException* exception) { + DLOG(ERROR) << "Error loading session file: " + << base::SysNSStringToUTF8(sessionPath) << ": " + << base::SysNSStringToUTF8([exception reason]); + return nil; + } +} + +// Deletes the file containing the commands for the last session in the given +// browserState directory. +- (void)deleteLastSession:(NSString*)directory { + NSString* sessionPath = [self sessionFilePathForDirectory:directory]; + _taskRunner->PostTask( + FROM_HERE, base::BindBlockArc(^{ + base::ThreadRestrictions::AssertIOAllowed(); + NSFileManager* fileManager = [NSFileManager defaultManager]; + if (![fileManager fileExistsAtPath:sessionPath]) + return; + + NSError* error = nil; + if (![fileManager removeItemAtPath:sessionPath error:nil]) + CHECK(false) << "Unable to delete session file: " + << base::SysNSStringToUTF8(sessionPath) << ": " + << base::SysNSStringToUTF8([error description]); + })); +} + +@end
diff --git a/ios/chrome/browser/sessions/session_service_unittest.mm b/ios/chrome/browser/sessions/session_service_ios_unittest.mm similarity index 96% rename from ios/chrome/browser/sessions/session_service_unittest.mm rename to ios/chrome/browser/sessions/session_service_ios_unittest.mm index f6cbfcf5..41ec9cd 100644 --- a/ios/chrome/browser/sessions/session_service_unittest.mm +++ b/ios/chrome/browser/sessions/session_service_ios_unittest.mm
@@ -13,7 +13,7 @@ #include "base/strings/sys_string_conversions.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/chrome_paths.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #include "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" @@ -63,8 +63,7 @@ EXPECT_TRUE(base::PathExists(plist_path)); NSString* path = base::SysUTF8ToNSString(plist_path.value()); - return [service loadWindowFromPath:path - forBrowserState:chrome_browser_state_.get()]; + return [service loadWindowFromPath:path]; } ios::ChromeBrowserState* chrome_browser_state() {
diff --git a/ios/chrome/browser/sessions/session_util.mm b/ios/chrome/browser/sessions/session_util.mm index 18a3f5c..e7d5f264 100644 --- a/ios/chrome/browser/sessions/session_util.mm +++ b/ios/chrome/browser/sessions/session_util.mm
@@ -6,7 +6,7 @@ #include "base/files/file_path.h" #include "base/strings/sys_string_conversions.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #include "ios/web/public/browser_state.h" namespace session_util {
diff --git a/ios/chrome/browser/sessions/session_window_ios.h b/ios/chrome/browser/sessions/session_window_ios.h index 1e8efb3b..1b67058 100644 --- a/ios/chrome/browser/sessions/session_window_ios.h +++ b/ios/chrome/browser/sessions/session_window_ios.h
@@ -20,9 +20,6 @@ selectedIndex:(NSUInteger)selectedIndex NS_DESIGNATED_INITIALIZER; -// Clears all added sessions. -- (void)clearSessions; - // The serialized session objects. @property(nonatomic, readonly) NSArray<CRWSessionStorage*>* sessions;
diff --git a/ios/chrome/browser/sessions/session_window_ios.mm b/ios/chrome/browser/sessions/session_window_ios.mm index 99fb65b..ed04097 100644 --- a/ios/chrome/browser/sessions/session_window_ios.mm +++ b/ios/chrome/browser/sessions/session_window_ios.mm
@@ -49,11 +49,6 @@ return self; } -- (void)clearSessions { - _sessions = @[]; - _selectedIndex = NSNotFound; -} - #pragma mark - NSCoding - (instancetype)initWithCoder:(NSCoder*)aDecoder {
diff --git a/ios/chrome/browser/sessions/session_window_ios_unittest.mm b/ios/chrome/browser/sessions/session_window_ios_unittest.mm index cadd7ea..e8dcf66 100644 --- a/ios/chrome/browser/sessions/session_window_ios_unittest.mm +++ b/ios/chrome/browser/sessions/session_window_ios_unittest.mm
@@ -46,17 +46,6 @@ EXPECT_EQ(0u, session_window.selectedIndex); } -TEST_F(SessionWindowIOSTest, ClearSessions) { - SessionWindowIOS* session_window = CreateSessionWindowForTest(0u); - - ASSERT_EQ(2u, [session_window.sessions count]); - ASSERT_EQ(0u, session_window.selectedIndex); - - [session_window clearSessions]; - EXPECT_EQ(0u, [session_window.sessions count]); - EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), session_window.selectedIndex); -} - TEST_F(SessionWindowIOSTest, CodingEncoding) { SessionWindowIOS* original_session_window = CreateSessionWindowForTest(1u);
diff --git a/ios/chrome/browser/sessions/test_session_service.h b/ios/chrome/browser/sessions/test_session_service.h index 59f060b..9003956 100644 --- a/ios/chrome/browser/sessions/test_session_service.h +++ b/ios/chrome/browser/sessions/test_session_service.h
@@ -7,7 +7,7 @@ #import <Foundation/Foundation.h> -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" // Testing subclass of SessionService that immediately consumes and archives // to nowhere session windows passed into its
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm index a702cb3..81a36e2dd 100644 --- a/ios/chrome/browser/tabs/tab_model.mm +++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -26,7 +26,7 @@ #import "ios/chrome/browser/metrics/tab_usage_recorder.h" #import "ios/chrome/browser/metrics/tab_usage_recorder_web_state_list_observer.h" #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/snapshots/snapshot_cache.h" #import "ios/chrome/browser/snapshots/snapshot_cache_web_state_list_observer.h"
diff --git a/ios/chrome/browser/test/perf_test_with_bvc_ios.mm b/ios/chrome/browser/test/perf_test_with_bvc_ios.mm index 38fd48c..71faaabb 100644 --- a/ios/chrome/browser/test/perf_test_with_bvc_ios.mm +++ b/ios/chrome/browser/test/perf_test_with_bvc_ios.mm
@@ -14,7 +14,7 @@ #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/ui/browser_view_controller.h"
diff --git a/ios/chrome/browser/ui/main/browser_view_wrangler.mm b/ios/chrome/browser/ui/main/browser_view_wrangler.mm index 1303b754..c68d876c 100644 --- a/ios/chrome/browser/ui/main/browser_view_wrangler.mm +++ b/ios/chrome/browser/ui/main/browser_view_wrangler.mm
@@ -13,7 +13,7 @@ #include "ios/chrome/browser/crash_report/crash_report_helper.h" #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" #import "ios/chrome/browser/physical_web/start_physical_web_discovery.h" -#import "ios/chrome/browser/sessions/session_service.h" +#import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/tabs/tab.h" #import "ios/chrome/browser/tabs/tab_model.h"
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.h b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.h index df2c6ab..f0768d3 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.h +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.h
@@ -175,6 +175,10 @@ // popup, and then remove this hack. b/5877366. BOOL ignore_popup_updates_; + // iOS 10.3 fails to apply the strikethrough style unless an extra style is + // also applied. See https://crbug.com/699702 for discussion. + BOOL use_strikethrough_workaround_; + // Bridges delegate method calls from |field_| to C++ land. base::scoped_nsobject<AutocompleteTextFieldDelegate> field_delegate_;
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm index 9ff31ae..41e447d6 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm
@@ -10,6 +10,7 @@ #include "base/auto_reset.h" #include "base/command_line.h" #include "base/ios/device_util.h" +#include "base/ios/ios_util.h" #include "base/memory/ptr_util.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" @@ -188,6 +189,7 @@ [field_ addTarget:field_delegate_ action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; + use_strikethrough_workaround_ = base::ios::IsRunningOnOrLater(10, 3, 0); } OmniboxViewIOS::~OmniboxViewIOS() { @@ -672,6 +674,15 @@ DCHECK_NE(security_state::SECURE_WITH_POLICY_INSTALLED_CERT, security_level); if (security_level == security_state::DANGEROUS) { + if (use_strikethrough_workaround_) { + // Workaround: Add extra attribute to allow strikethough to apply on iOS + // 10.3+. See https://crbug.com/699702 for discussion. + [attributing_display_string_ + addAttribute:NSBaselineOffsetAttributeName + value:@0 + range:NSMakeRange(0, [attributing_display_string_ length])]; + } + // Add a strikethrough through the scheme. [attributing_display_string_ addAttribute:NSStrikethroughStyleAttributeName
diff --git a/ios/web_view/BUILD.gn b/ios/web_view/BUILD.gn index c7b3b68..c306254 100644 --- a/ios/web_view/BUILD.gn +++ b/ios/web_view/BUILD.gn
@@ -16,103 +16,134 @@ ] } +# These variables are used to share framework sources with both ChromeWebView +# and CrNetChromeWebView frameworks. +ios_web_view_public_headers = [ + "public/ChromeWebView.h", + "public/cwv.h", + "public/cwv_export.h", + "public/cwv_html_element.h", + "public/cwv_navigation_action.h", + "public/cwv_navigation_delegate.h", + "public/cwv_translate_delegate.h", + "public/cwv_translate_manager.h", + "public/cwv_ui_delegate.h", + "public/cwv_user_content_controller.h", + "public/cwv_user_script.h", + "public/cwv_web_view.h", + "public/cwv_web_view_configuration.h", +] + +ios_web_view_sources = [ + "internal/cwv.mm", + "internal/cwv_html_element.mm", + "internal/cwv_html_element_internal.h", + "internal/cwv_navigation_action.mm", + "internal/cwv_navigation_action_internal.h", + "internal/cwv_user_content_controller.mm", + "internal/cwv_user_content_controller_internal.h", + "internal/cwv_user_script.mm", + "internal/cwv_web_view.mm", + "internal/cwv_web_view_configuration.mm", + "internal/cwv_web_view_configuration_internal.h", + "internal/pref_names.cc", + "internal/pref_names.h", + "internal/translate/cwv_translate_manager_impl.h", + "internal/translate/cwv_translate_manager_impl.mm", + "internal/translate/web_view_translate_accept_languages_factory.cc", + "internal/translate/web_view_translate_accept_languages_factory.h", + "internal/translate/web_view_translate_client.h", + "internal/translate/web_view_translate_client.mm", + "internal/translate/web_view_translate_ranker_factory.cc", + "internal/translate/web_view_translate_ranker_factory.h", + "internal/web_view_browser_state.h", + "internal/web_view_browser_state.mm", + "internal/web_view_early_page_script_provider.h", + "internal/web_view_early_page_script_provider.mm", + "internal/web_view_java_script_dialog_presenter.h", + "internal/web_view_java_script_dialog_presenter.mm", + "internal/web_view_network_delegate.cc", + "internal/web_view_network_delegate.h", + "internal/web_view_url_request_context_getter.h", + "internal/web_view_url_request_context_getter.mm", + "internal/web_view_web_client.h", + "internal/web_view_web_client.mm", + "internal/web_view_web_main_delegate.h", + "internal/web_view_web_main_delegate.mm", + "internal/web_view_web_main_parts.h", + "internal/web_view_web_main_parts.mm", + "internal/web_view_web_state_policy_decider.h", + "internal/web_view_web_state_policy_decider.mm", +] +ios_web_view_sources += ios_web_view_public_headers + +ios_web_view_deps = [ + ":packed_resources", + "//base", + "//components/infobars/core", + "//components/infobars/core", + "//components/keyed_service/core", + "//components/keyed_service/ios", + "//components/pref_registry", + "//components/prefs", + "//components/translate/core/browser", + "//components/translate/core/common", + "//components/translate/ios/browser", + "//ios/net", + "//ios/net", + "//ios/web", + "//ios/web:reload_type", + "//ios/web:user_agent", + "//ios/web:user_agent", + "//ios/web/public/app", + "//net", + "//net:extras", + "//ui/base", + "//url", + "//url", +] + ios_framework_bundle("web_view") { output_name = "ChromeWebView" info_plist = "Info.plist" - public_headers = [ - "public/ChromeWebView.h", - "public/cwv.h", - "public/cwv_export.h", - "public/cwv_html_element.h", - "public/cwv_navigation_action.h", - "public/cwv_navigation_delegate.h", - "public/cwv_translate_delegate.h", - "public/cwv_translate_manager.h", - "public/cwv_ui_delegate.h", - "public/cwv_user_content_controller.h", - "public/cwv_user_script.h", - "public/cwv_web_view.h", - "public/cwv_web_view_configuration.h", - ] + public_headers = ios_web_view_public_headers public = [ "public/ChromeWebView.h", ] - sources = [ - "internal/cwv.mm", - "internal/cwv_html_element.mm", - "internal/cwv_html_element_internal.h", - "internal/cwv_navigation_action.mm", - "internal/cwv_navigation_action_internal.h", - "internal/cwv_user_content_controller.mm", - "internal/cwv_user_content_controller_internal.h", - "internal/cwv_user_script.mm", - "internal/cwv_web_view.mm", - "internal/cwv_web_view_configuration.mm", - "internal/cwv_web_view_configuration_internal.h", - "internal/pref_names.cc", - "internal/pref_names.h", - "internal/translate/cwv_translate_manager_impl.h", - "internal/translate/cwv_translate_manager_impl.mm", - "internal/translate/web_view_translate_accept_languages_factory.cc", - "internal/translate/web_view_translate_accept_languages_factory.h", - "internal/translate/web_view_translate_client.h", - "internal/translate/web_view_translate_client.mm", - "internal/translate/web_view_translate_ranker_factory.cc", - "internal/translate/web_view_translate_ranker_factory.h", - "internal/web_view_browser_state.h", - "internal/web_view_browser_state.mm", - "internal/web_view_early_page_script_provider.h", - "internal/web_view_early_page_script_provider.mm", - "internal/web_view_java_script_dialog_presenter.h", - "internal/web_view_java_script_dialog_presenter.mm", - "internal/web_view_network_delegate.cc", - "internal/web_view_network_delegate.h", - "internal/web_view_url_request_context_getter.h", - "internal/web_view_url_request_context_getter.mm", - "internal/web_view_web_client.h", - "internal/web_view_web_client.mm", - "internal/web_view_web_main_delegate.h", - "internal/web_view_web_main_delegate.mm", - "internal/web_view_web_main_parts.h", - "internal/web_view_web_main_parts.mm", - "internal/web_view_web_state_policy_decider.h", - "internal/web_view_web_state_policy_decider.mm", - ] + sources = ios_web_view_sources - sources += public_headers - - deps = [ - ":packed_resources", - "//base", - "//components/infobars/core", - "//components/infobars/core", - "//components/keyed_service/core", - "//components/keyed_service/ios", - "//components/pref_registry", - "//components/prefs", - "//components/translate/core/browser", - "//components/translate/core/common", - "//components/translate/ios/browser", - "//ios/net", - "//ios/net", - "//ios/web", - "//ios/web:reload_type", - "//ios/web:user_agent", - "//ios/web:user_agent", - "//ios/web/public/app", - "//net", - "//net:extras", - "//ui/base", - "//url", - "//url", - ] + deps = ios_web_view_deps configs += [ - "//build/config/compiler:enable_arc", ":config", + "//build/config/compiler:enable_arc", + ] +} + +# Same framework as ChromeWebView above, but also exposes CrNet. +ios_framework_bundle("crnet_web_view_combined") { + output_name = "CrNetChromeWebView" + info_plist = "Info.plist" + + public_headers = ios_web_view_public_headers + public_headers += [ "../crnet/CrNet.h" ] + + public = [ + "public/ChromeWebView.h", + ] + + sources = ios_web_view_sources + sources += [ "../crnet/CrNet.h" ] + + deps = ios_web_view_deps + deps += [ "//ios/crnet:crnet_sources" ] + + configs += [ + ":config", + "//build/config/compiler:enable_arc", ] }
diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index 846bd27..a26841b 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc
@@ -305,7 +305,7 @@ // adapter that connects to the endpoint device is present and enabled. if (!IsDeviceActive(endpoint_device.get())) { DVLOG(1) << "Selected endpoint device is not active"; - endpoint_device.Release(); + endpoint_device.Reset(); } return endpoint_device; } @@ -341,7 +341,7 @@ // adapter that connects to the endpoint device is present and enabled. if (!IsDeviceActive(endpoint_device.get())) { DVLOG(1) << "Selected endpoint device is not active"; - endpoint_device.Release(); + endpoint_device.Reset(); } return endpoint_device; }
diff --git a/media/base/audio_renderer_mixer_input_unittest.cc b/media/base/audio_renderer_mixer_input_unittest.cc index cec6312..8f6a239 100644 --- a/media/base/audio_renderer_mixer_input_unittest.cc +++ b/media/base/audio_renderer_mixer_input_unittest.cc
@@ -9,6 +9,7 @@ #include "base/bind_helpers.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "media/base/audio_latency.h" #include "media/base/audio_renderer_mixer.h" #include "media/base/audio_renderer_mixer_input.h" @@ -124,7 +125,7 @@ protected: virtual ~AudioRendererMixerInputTest() {} - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; AudioParameters audio_parameters_; scoped_refptr<MockAudioRendererSink> sinks_[2]; std::unique_ptr<AudioRendererMixer> mixers_[2];
diff --git a/media/base/media_url_demuxer_unittest.cc b/media/base/media_url_demuxer_unittest.cc index 4717e7d4..23fa6da 100644 --- a/media/base/media_url_demuxer_unittest.cc +++ b/media/base/media_url_demuxer_unittest.cc
@@ -8,6 +8,7 @@ #include "base/bind_helpers.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -38,7 +39,7 @@ std::unique_ptr<Demuxer> demuxer_; // Necessary, or else base::ThreadTaskRunnerHandle::Get() fails. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; private: DISALLOW_COPY_AND_ASSIGN(MediaUrlDemuxerTest);
diff --git a/media/capture/video/win/pin_base_win.cc b/media/capture/video/win/pin_base_win.cc index 3f521948..349ce26 100644 --- a/media/capture/video/win/pin_base_win.cc +++ b/media/capture/video/win/pin_base_win.cc
@@ -147,7 +147,7 @@ if (!connected_pin_.get()) return S_FALSE; - connected_pin_.Release(); + connected_pin_.Reset(); return S_OK; }
diff --git a/media/capture/video/win/video_capture_device_factory_win.cc b/media/capture/video/win/video_capture_device_factory_win.cc index beba3be..60f0aa3 100644 --- a/media/capture/video/win/video_capture_device_factory_win.cc +++ b/media/capture/video/win/video_capture_device_factory_win.cc
@@ -168,7 +168,7 @@ // Enumerate all video capture devices. for (ScopedComPtr<IMoniker> moniker; enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK; - moniker.Release()) { + moniker.Reset()) { ScopedComPtr<IPropertyBag> prop_bag; hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid()); if (FAILED(hr)) @@ -380,7 +380,7 @@ } VideoCaptureDeviceMFWin::FormatFromGuid(type_guid, &capture_format.pixel_format); - type.Release(); + type.Reset(); ++stream_index; if (capture_format.pixel_format == PIXEL_FORMAT_UNKNOWN) continue;
diff --git a/media/capture/video/win/video_capture_device_mf_win.cc b/media/capture/video/win/video_capture_device_mf_win.cc index 1644148..3489f33 100644 --- a/media/capture/video/win/video_capture_device_mf_win.cc +++ b/media/capture/video/win/video_capture_device_mf_win.cc
@@ -67,7 +67,7 @@ VideoCaptureFormat format; if (FillFormat(type.get(), &format)) capabilities->emplace_back(stream_index, format); - type.Release(); + type.Reset(); ++stream_index; }
diff --git a/media/capture/video/win/video_capture_device_win.cc b/media/capture/video/win/video_capture_device_win.cc index ce617ae2..cc27b25b 100644 --- a/media/capture/video/win/video_capture_device_win.cc +++ b/media/capture/video/win/video_capture_device_win.cc
@@ -84,7 +84,7 @@ ScopedComPtr<IBaseFilter> capture_filter; for (ScopedComPtr<IMoniker> moniker; enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK; - moniker.Release()) { + moniker.Reset()) { ScopedComPtr<IPropertyBag> prop_bag; hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid()); if (FAILED(hr)) @@ -147,7 +147,7 @@ return pin; } } - pin.Release(); + pin.Reset(); } DCHECK(!pin.get()); @@ -248,7 +248,7 @@ } if (capture_graph_builder_.get()) - capture_graph_builder_.Release(); + capture_graph_builder_.Reset(); } bool VideoCaptureDeviceWin::Init() {
diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index e576190..5e80c79a 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc
@@ -14,6 +14,7 @@ #include "base/json/json_reader.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "media/base/cdm_callback_promise.h" #include "media/base/cdm_config.h" @@ -465,7 +466,7 @@ // Helper class to load/unload External Clear Key Library, if necessary. std::unique_ptr<ExternalClearKeyTestHelper> helper_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; // Constants for testing. const std::vector<uint8_t> original_data_;
diff --git a/media/cdm/cdm_adapter_unittest.cc b/media/cdm/cdm_adapter_unittest.cc index 0585ff0..0e983fd 100644 --- a/media/cdm/cdm_adapter_unittest.cc +++ b/media/cdm/cdm_adapter_unittest.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "media/base/cdm_callback_promise.h" #include "media/base/cdm_key_information.h" #include "media/base/content_decryption_module.h" @@ -243,7 +244,7 @@ // |session_id_| is the latest result of calling CreateSession(). std::string session_id_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; DISALLOW_COPY_AND_ASSIGN(CdmAdapterTest); };
diff --git a/media/gpu/android/media_codec_video_decoder_unittest.cc b/media/gpu/android/media_codec_video_decoder_unittest.cc index 7ce5e5d..826386f 100644 --- a/media/gpu/android/media_codec_video_decoder_unittest.cc +++ b/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "media/gpu/android/media_codec_video_decoder.h" #include "base/bind.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "media/base/android/media_codec_util.h" #include "media/base/test_helpers.h" -#include "media/gpu/android/media_codec_video_decoder.h" #include "testing/gtest/include/gtest/gtest.h" #define SKIP_IF_MEDIA_CODEC_IS_BLACKLISTED() \ @@ -42,7 +43,7 @@ private: MediaCodecVideoDecoder mcvd_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(MediaCodecVideoDecoderTest, DestructWithoutInit) {
diff --git a/media/gpu/dxva_picture_buffer_win.cc b/media/gpu/dxva_picture_buffer_win.cc index bcaa177..4e36b913 100644 --- a/media/gpu/dxva_picture_buffer_win.cc +++ b/media/gpu/dxva_picture_buffer_win.cc
@@ -311,8 +311,8 @@ // The same picture buffer can be reused for a different frame. Release the // target surface and the decoder references here. - target_surface_.Release(); - decoder_surface_.Release(); + target_surface_.Reset(); + decoder_surface_.Reset(); // Grab a reference on the decoder surface and the target surface. These // references will be released when we receive a notification that the @@ -349,11 +349,11 @@ if (src_surface && dest_surface) { DCHECK_EQ(src_surface, decoder_surface_.get()); DCHECK_EQ(dest_surface, target_surface_.get()); - decoder_surface_.Release(); - target_surface_.Release(); + decoder_surface_.Reset(); + target_surface_.Reset(); } else { DCHECK(decoder_dx11_texture_.get()); - decoder_dx11_texture_.Release(); + decoder_dx11_texture_.Reset(); } if (egl_keyed_mutex_) { keyed_mutex_value_++; @@ -391,9 +391,9 @@ EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); eglReleaseTexImage(egl_display, decoding_surface_, EGL_BACK_BUFFER); - decoder_surface_.Release(); - target_surface_.Release(); - decoder_dx11_texture_.Release(); + decoder_surface_.Reset(); + target_surface_.Reset(); + decoder_dx11_texture_.Reset(); state_ = UNUSED; if (egl_keyed_mutex_) { HRESULT hr = egl_keyed_mutex_->ReleaseSync(++keyed_mutex_value_); @@ -465,8 +465,8 @@ RETURN_ON_FAILURE(result, "Could not release stream", false); } if (current_d3d_sample_) { - dx11_decoding_texture_.Release(); - current_d3d_sample_.Release(); + dx11_decoding_texture_.Reset(); + current_d3d_sample_.Reset(); } state_ = UNUSED; return true; @@ -635,7 +635,7 @@ DCHECK_EQ(COPYING, state_); state_ = IN_CLIENT; - dx11_decoding_texture_.Release(); + dx11_decoding_texture_.Reset(); HRESULT hr = egl_keyed_mutex_->AcquireSync(keyed_mutex_value_, kAcquireSyncWaitMs);
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc index e7ae23b2..6fe936a 100644 --- a/media/gpu/dxva_video_decode_accelerator_win.cc +++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -1978,7 +1978,7 @@ weak_this_factory_.InvalidateWeakPtrs(); weak_ptr_ = weak_this_factory_.GetWeakPtr(); pending_output_samples_.clear(); - decoder_.Release(); + decoder_.Reset(); config_change_detector_.reset(); // If we are processing a config change, then leave the d3d9/d3d11 objects @@ -1994,21 +1994,21 @@ pending_input_buffers_.clear(); pictures_requested_ = false; if (use_dx11_) { - d3d11_processor_.Release(); - enumerator_.Release(); - video_context_.Release(); - video_device_.Release(); - d3d11_device_context_.Release(); - d3d11_device_.Release(); - d3d11_device_manager_.Release(); - d3d11_query_.Release(); - multi_threaded_.Release(); + d3d11_processor_.Reset(); + enumerator_.Reset(); + video_context_.Reset(); + video_device_.Reset(); + d3d11_device_context_.Reset(); + d3d11_device_.Reset(); + d3d11_device_manager_.Reset(); + d3d11_query_.Reset(); + multi_threaded_.Reset(); processor_width_ = processor_height_ = 0; } else { - d3d9_.Release(); - d3d9_device_ex_.Release(); - device_manager_.Release(); - query_.Release(); + d3d9_.Reset(); + d3d9_device_ex_.Reset(); + device_manager_.Reset(); + query_.Reset(); } } sent_drain_message_ = false; @@ -2781,8 +2781,8 @@ int height, const gfx::ColorSpace& color_space) { if (width < processor_width_ || height != processor_height_) { - d3d11_processor_.Release(); - enumerator_.Release(); + d3d11_processor_.Reset(); + enumerator_.Reset(); processor_width_ = 0; processor_height_ = 0; @@ -2950,7 +2950,7 @@ RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); return true; } - media_type.Release(); + media_type.Reset(); } return false; }
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_unittest.cc b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_unittest.cc index 82dd28f..a4c8f7ab 100644 --- a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_unittest.cc +++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_unittest.cc
@@ -5,6 +5,7 @@ #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" #include "base/bind.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/threading/thread.h" #include "gpu/ipc/service/gpu_channel.h" #include "media/gpu/ipc/common/media_messages.h" @@ -80,7 +81,7 @@ private: // This is required to allow base::ThreadTaskRunnerHandle::Get() from the // test execution thread. - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; // Tests that the communication for decoding a frame between the caller of
diff --git a/media/gpu/media_foundation_video_encode_accelerator_win.cc b/media/gpu/media_foundation_video_encode_accelerator_win.cc index 08772c0..6723aa7 100644 --- a/media/gpu/media_foundation_video_encode_accelerator_win.cc +++ b/media/gpu/media_foundation_video_encode_accelerator_win.cc
@@ -694,12 +694,12 @@ } void MediaFoundationVideoEncodeAccelerator::ReleaseEncoderResources() { - encoder_.Release(); - codec_api_.Release(); - imf_input_media_type_.Release(); - imf_output_media_type_.Release(); - input_sample_.Release(); - output_sample_.Release(); + encoder_.Reset(); + codec_api_.Reset(); + imf_input_media_type_.Reset(); + imf_output_media_type_.Reset(); + input_sample_.Reset(); + output_sample_.Reset(); } } // namespace content
diff --git a/media/remoting/courier_renderer_unittest.cc b/media/remoting/courier_renderer_unittest.cc index 524d7be..1e56062 100644 --- a/media/remoting/courier_renderer_unittest.cc +++ b/media/remoting/courier_renderer_unittest.cc
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/test/simple_test_tick_clock.h" #include "base/threading/thread_task_runner_handle.h" #include "media/base/pipeline_status.h" @@ -328,7 +329,7 @@ RunPendingTasks(); } - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<RendererController> controller_; std::unique_ptr<RendererClientImpl> render_client_; std::unique_ptr<FakeMediaResource> media_resource_;
diff --git a/remoting/host/audio_capturer_win.cc b/remoting/host/audio_capturer_win.cc index d316ccb9..8e238db 100644 --- a/remoting/host/audio_capturer_win.cc +++ b/remoting/host/audio_capturer_win.cc
@@ -138,11 +138,11 @@ void AudioCapturerWin::Deinitialize() { DCHECK(thread_checker_.CalledOnValidThread()); wave_format_ex_.Reset(nullptr); - mm_device_enumerator_.Release(); - audio_capture_client_.Release(); - audio_client_.Release(); - mm_device_.Release(); - audio_volume_.Release(); + mm_device_enumerator_.Reset(); + audio_capture_client_.Reset(); + audio_client_.Reset(); + mm_device_.Reset(); + audio_volume_.Reset(); } bool AudioCapturerWin::Initialize() {
diff --git a/remoting/host/gcd_rest_client_unittest.cc b/remoting/host/gcd_rest_client_unittest.cc index e874894..5c5ddf1 100644 --- a/remoting/host/gcd_rest_client_unittest.cc +++ b/remoting/host/gcd_rest_client_unittest.cc
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "base/test/simple_test_clock.h" #include "base/values.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -50,7 +51,7 @@ GcdRestClient::Result last_result_ = GcdRestClient::OTHER_ERROR; private: - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(GcdRestClientTest, NetworkErrorGettingToken) {
diff --git a/remoting/host/setup/win/auth_code_getter.cc b/remoting/host/setup/win/auth_code_getter.cc index 2bab5203..3cf6c8c 100644 --- a/remoting/host/setup/win/auth_code_getter.cc +++ b/remoting/host/setup/win/auth_code_getter.cc
@@ -88,7 +88,7 @@ void AuthCodeGetter::KillBrowser() { if (browser_.get()) { browser_->Quit(); - browser_.Release(); + browser_.Reset(); } }
diff --git a/remoting/host/win/rdp_client_window.cc b/remoting/host/win/rdp_client_window.cc index 5bcd61d..fc49e96b 100644 --- a/remoting/host/win/rdp_client_window.cc +++ b/remoting/host/win/rdp_client_window.cc
@@ -401,9 +401,9 @@ } void RdpClientWindow::OnDestroy() { - client_.Release(); - client_9_.Release(); - client_settings_.Release(); + client_.Reset(); + client_9_.Reset(); + client_settings_.Reset(); apply_resolution_timer_.Stop(); } @@ -503,9 +503,9 @@ int RdpClientWindow::LogOnCreateError(HRESULT error) { LOG(ERROR) << "RDP: failed to initiate a connection to " << server_endpoint_.ToString() << ": error=" << std::hex << error; - client_.Release(); - client_9_.Release(); - client_settings_.Release(); + client_.Reset(); + client_9_.Reset(); + client_settings_.Reset(); return -1; }
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index ebe87448..6315690 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -1,6 +1,390 @@ { "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, "AAAAA2 See generate_buildbot_json.py to make changes": {}, + "Android Release (NVIDIA Shield TV)": { + "gtest_tests": [ + { + "override_isolate_target": "angle_end2end_tests", + "swarming": { + "can_use_on_swarming_builders": false, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "angle_end2end_tests", + "use_xvfb": false + }, + { + "override_isolate_target": "angle_unittests", + "swarming": { + "can_use_on_swarming_builders": false, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "angle_unittests", + "use_xvfb": false + }, + { + "override_isolate_target": "gl_tests", + "swarming": { + "can_use_on_swarming_builders": false, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gl_tests", + "use_xvfb": false + }, + { + "override_isolate_target": "gl_unittests", + "swarming": { + "can_use_on_swarming_builders": false, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gl_unittests", + "use_xvfb": false + } + ], + "isolated_scripts": [ + { + "args": [ + "context_lost", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "context_lost_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "depth_capture", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "depth_capture_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "gpu_process", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "gpu_process_launch_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "hardware_accelerated_feature", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "hardware_accelerated_feature_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "info_collection", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--expected-vendor-id", + "0000", + "--expected-device-id", + "0000" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "info_collection_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "maps", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--os-type", + "android", + "--build-revision", + "${got_revision}", + "--test-machine-name", + "${buildername}" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "maps_pixel_test", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "pixel", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--refimg-cloud-storage-bucket", + "chromium-gpu-archive/reference-images", + "--os-type", + "android", + "--build-revision", + "${got_revision}", + "--test-machine-name", + "${buildername}" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "pixel_test", + "non_precommit_args": [ + "--upload-refimg-to-cloud-storage" + ], + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "precommit_args": [ + "--download-refimg-from-cloud-storage" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "screenshot_sync", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "screenshot_sync_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "trace_test", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "trace_test", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=android-chromium", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test_run" + ], + "swarming": { + "can_use_on_swarming_builders": false, + "dimension_sets": [ + { + "gpu": "0000:0000", + "os": "Android" + } + ] + } + } + ] + }, "Android Release (Nexus 5)": { "gtest_tests": [ {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index b82fe47b..3a92224c 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2847,6 +2847,15 @@ "enable_features": [ "TranslateUI2016Q2" ] + }, + { + "name": "DoNotDefaultAlways", + "params": { + "always_translate_offer_threshold": "0" + }, + "enable_features": [ + "TranslateUI2016Q2" + ] } ] }
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests index c5ea71d..5bd3bfd 100644 --- a/third_party/WebKit/LayoutTests/SlowTests +++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -367,6 +367,9 @@ crbug.com/647192 [ Win Debug ] virtual/stable/webexposed/global-interface-listing.html [ Slow ] crbug.com/647192 [ Win Debug ] webexposed/global-interface-listing.html [ Slow ] +# Slow because it tests every SVG interface +crbug.com/709030 external/wpt/svg/interfaces.html [ Slow ] + # These tests are slow with our MESA backend. They may be less slow when we have # bots running tests on real hardware or maybe when using SwiftShader. crbug.com/646528 compositing/lots-of-img-layers.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html index 7751813..5164d490 100644 --- a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html +++ b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html
@@ -26,4 +26,26 @@ return videoTrack.applyConstraints(); }, 'MediaStreamTrack.applyConstraints()'); + +// This test verifies that applyConstraints() rejects the returned Promise if +// passed a non-supported constraint. +// TODO(mcasas): remove entirely after https://crbug.com/338503. +promise_test(function(t) { + var canvas = document.getElementById('canvas'); + var context = canvas.getContext("2d"); + context.fillStyle = "red"; + context.fillRect(0, 0, 10, 10); + + var stream = canvas.captureStream(); + var videoTrack = stream.getVideoTracks()[0]; + + var expectedException = new DOMException( + 'Only Image-Capture constraints supported (https://crbug.com/338503)', + 'NotSupportedError'); + + return promise_rejects( + t, expectedException, + videoTrack.applyConstraints({advanced : [ {width : 640} ]})); +}, 'MediaStreamTrack.applyConstraints() with non Image-Capture constraint'); + </script>
diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html index c2b604a..bc31ed0 100644 --- a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html +++ b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html
@@ -48,6 +48,13 @@ t.done(); }); + // Clear constraints by sending an empty constraint set. + videoTrack.applyConstraints({}) + .then(() => { + const constraintsOut = videoTrack.getConstraints(); + assert_object_equals(constraintsOut, {}, "constraints"); + t.done(); + }); }); };
diff --git a/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-svg-text-width-height.html b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-svg-text-width-height.html new file mode 100644 index 0000000..fb03369 --- /dev/null +++ b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-svg-text-width-height.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>Width/height properties in getComputedStyle of svg text</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<svg width="100" height="100"> + <text id="text1">Text1</text> + <text id="text2" style="width: 20px; height: 30%">Text2</text> +</svg> +<script> +test(function() { + assert_equals(getComputedStyle(text1).width, 'auto'); + assert_equals(getComputedStyle(text1).height, 'auto'); + assert_equals(getComputedStyle(text2).width, 'auto'); + assert_equals(getComputedStyle(text2).height, 'auto'); +}); +</script>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-suspend-resume.html b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-suspend-resume.html index bbf470f..d2e70a4 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-suspend-resume.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-suspend-resume.html
@@ -117,6 +117,26 @@ }); }); + audit.define({ + label: 'resume-running-context', + description: 'Test resuming a running context' + }, (task, should) => { + let context; + should(() => context = new AudioContext(), + 'Create online context') + .notThrow(); + + should(context.state, 'context.state') + .beEqualTo('running'); + should(context.resume(), 'context.resume') + .beResolved() + .then(() => { + should(context.state, 'context.state after resume') + .beEqualTo('running'); + }) + .then(() => task.done()); + }); + audit.run(); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping-expected.txt b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping-expected.txt index 648c31d..add54227 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping-expected.txt +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping-expected.txt
@@ -1,8 +1,11 @@ CONSOLE WARNING: line 48: BiquadFilter.frequency.linearRampToValueAtTime value -1000 outside nominal range [0, 24000]; value will be clamped. This is a testharness.js-based test. -PASS Clamped signal in frame range [5618, 18382] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...] with an element-wise tolerance of 0. -PASS Actual Clamp start (5618) is less than or equal to 5618. -PASS Actual Clamp end (18383) is greater than or equal to 18382. -PASS Clamping of BiquadFilter.frequency automation performed correctly. +PASS # AUDIT TASK RUNNER STARTED. +PASS > [clamp] +PASS Clamped signal in frame range [5618, 18382] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. +PASS Actual Clamp start is less than or equal to 5618. +PASS Actual Clamp end is greater than or equal to 18382. +PASS < [clamp] All assertions passed. (total 3 assertions) +PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping.html index 822cda7..d49172e 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-automation-clamping.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <title>Test Clamping of Automations</title> </head> @@ -20,7 +20,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("clamp", function (done) { + audit.define("clamp", (task, should) => { // Test clamping of automations. Most AudioParam limits are essentially // unbounded, so clamping doesn't happen. For most other AudioParams, // the behavior is sufficiently complicated with complicated outputs @@ -55,7 +55,6 @@ context.startRendering().then(function (buffer) { var result = buffer.getChannelData(0); - var success = true; // When the cutoff frequency of a lowpass filter is 0, nothing gets // through. Hence the output of the filter between the clamping @@ -76,11 +75,10 @@ expectedSignal.fill(0); // Output should be zero. - success = Should("Clamped signal in frame range [" + clampStartFrame + ", " + - clampEndFrame + "]", - clampedSignal, { - verbose: true, - }).beCloseToArray(expectedSignal, 0); + should(clampedSignal, + "Clamped signal in frame range [" + clampStartFrame + ", " + + clampEndFrame + "]") + .beCloseToArray(expectedSignal, 0); // Find the actual clamp range based on the output values. var actualClampStart = result.findIndex(x => x === 0); @@ -88,23 +86,15 @@ x => x != 0); // Verify that the expected clamping range is a subset of the actual range. - success = Should("Actual Clamp start", - actualClampStart).beLessThanOrEqualTo(clampStartFrame) && success; - success == Should("Actual Clamp end", - actualClampEnd).beGreaterThanOrEqualTo(clampEndFrame) && success; + should(actualClampStart, "Actual Clamp start") + .beLessThanOrEqualTo(clampStartFrame); + should(actualClampEnd, "Actual Clamp end") + .beGreaterThanOrEqualTo(clampEndFrame); - Should("Clamping of BiquadFilter.frequency automation performed", - success) - .summarize("correctly", "incorrectly"); - }).then(done); + }).then(() => task.done()); }); - // All done! - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); function solveLinearRamp(v, v0, t0, v1, t1) { // Solve the linear ramp equation for the time t at which the ramp
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-clamp-time-to-current-time.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-clamp-time-to-current-time.html index 7ba1db3..287a1b8d 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-clamp-time-to-current-time.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-clamp-time-to-current-time.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> </head> <body> @@ -16,7 +16,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("setValue", function (taskDone) { + audit.define("setValue", (task, should) => { var suspendFrame = 128; createGraph({ suspendFrame: suspendFrame, @@ -28,25 +28,19 @@ // Just verify that the cosine wave actually started at // suspendFrame. var result = resultBuffer.getChannelData(0); - var success = true; - success = Should("setValue: Output[0-" + (suspendFrame - 1) + "]", - result.slice(0, suspendFrame)) - .beConstantValueOf(0) && success; - success = Should("setValue: Output[" + suspendFrame + "-" + ( - renderFrames - 1) + "]", - result.slice(suspendFrame)) - .beConstantValueOf(1) && success; - - Should("*** setValueAtTime in the past", success) - .summarize( - "correctly clamped to current time", - "was not correctly clamped to current time"); + should(result.slice(0, suspendFrame), + "setValue: Output[0-" + (suspendFrame - 1) + "]") + .beConstantValueOf(0); + should(result.slice(suspendFrame), + "setValue: Output[" + suspendFrame + "-" + (renderFrames - 1) + + "]") + .beConstantValueOf(1); }) - .then(taskDone); + .then(() => task.done()); }); - audit.defineTask("linear", function (taskDone) { + audit.define("linear", (task, should) => { var suspendFrame = 128; createGraph({ suspendFrame: suspendFrame, @@ -58,25 +52,19 @@ // Just verify that the cosine wave actually started at // suspendFrame. var result = resultBuffer.getChannelData(0); - var success = true; - success = Should("linear: Output[0-" + (suspendFrame - 1) + "]", - result.slice(0, suspendFrame)) - .beConstantValueOf(1) && success; - success = Should("linear: Output[" + suspendFrame + "-" + ( - renderFrames - 1) + "]", - result.slice(suspendFrame)) - .beConstantValueOf(0.5) && success; + should(result.slice(0, suspendFrame), + "linear: Output[0-" + (suspendFrame - 1) + "]") + .beConstantValueOf(1); + should(result.slice(suspendFrame), + "linear: Output[" + suspendFrame + "-" + (renderFrames - 1) + "]") + .beConstantValueOf(0.5); - Should("*** linearRampToValueAtTime in the past", success) - .summarize( - "correctly clamped to current time", - "was not correctly clamped to current time"); }) - .then(taskDone); + .then(() => task.done()); }); - audit.defineTask("exponential", function (taskDone) { + audit.define("exponential", (task, should) => { var suspendFrame = 128; createGraph({ suspendFrame: suspendFrame, @@ -88,26 +76,19 @@ // Just verify that the cosine wave actually started at // suspendFrame. var result = resultBuffer.getChannelData(0); - var success = true; - success = Should("exponential: Output[0-" + (suspendFrame - 1) + "]", - result.slice(0, suspendFrame)) - .beConstantValueOf(1) && success; - success = Should("exponential: Output[" + suspendFrame + "-" + ( - renderFrames - 1) + "]", - result.slice(suspendFrame)) - .beConstantValueOf(0.5) && success; - - Should("*** exponentialRampToValueAtTime in the past", - success) - .summarize( - "correctly clamped to current time", - "was not correctly clamped to current time"); + should(result.slice(0, suspendFrame), + "exponential: Output[0-" + (suspendFrame - 1) + "]") + .beConstantValueOf(1); + should(result.slice(suspendFrame), + "exponential: Output[" + suspendFrame + "-" + (renderFrames - 1) + + "]") + .beConstantValueOf(0.5); }) - .then(taskDone); + .then(() => task.done()); }); - audit.defineTask("setTarget", function (taskDone) { + audit.define("setTarget", (task, should) => { var suspendFrame = 128; createGraph({ suspendFrame: suspendFrame, @@ -120,32 +101,26 @@ // Just verify that the cosine wave actually started at // suspendFrame. var result = resultBuffer.getChannelData(0); - var success = true; - success = Should("setTarget: Output[0-" + (suspendFrame - 1) + "]", - result.slice(0, suspendFrame)) - .beConstantValueOf(1) && success; + should(result.slice(0, suspendFrame), + "setTarget: Output[0-" + (suspendFrame - 1) + "]") + .beConstantValueOf(1); // For the samples past the suspend time, we only care that first // value is 1 and that the rest are not zero. - success = Should("setTarget: Output[" + suspendFrame + "]", - result[suspendFrame]).beEqualTo(1) && success; + should(result[suspendFrame], + "setTarget: Output[" + suspendFrame + "]") + .beEqualTo(1); var positive = result.slice(suspendFrame + 1).every(x => x > 0); - success = Should("Output[" + (suspendFrame + 1) + "-" + - (renderFrames - 1) + "] contains only positive values", - positive) - .beEqualTo(true) && success; - - Should("*** setTargetAtTime in the past", success) - .summarize( - "correctly clamped to current time", - "was not correctly clamped to current time"); + should(positive, "Output[" + (suspendFrame + 1) + "-" + + (renderFrames - 1) + "] contains only positive values") + .beEqualTo(true); }) - .then(taskDone); + .then(() => task.done()); }); - audit.defineTask("setValueCurve", function (taskDone) { + audit.define("setValueCurve", (task, should) => { var suspendFrame = 128; createGraph({ suspendFrame: suspendFrame, @@ -158,27 +133,21 @@ // Just verify that the cosine wave actually started at // suspendFrame. var result = resultBuffer.getChannelData(0); - var success = true; - success = Should("setValueCurve: Output[0-" + (suspendFrame - 1) + "]", - result.slice(0, suspendFrame)) - .beConstantValueOf(1) && success; + should(result.slice(0, suspendFrame), + "setValueCurve: Output[0-" + (suspendFrame - 1) + "]") + .beConstantValueOf(1); // The selected curve contains values greater than or equal to 2. // Just verify that all values are greater than or equal to 2. var biggerThan2 = result.slice(suspendFrame).every(x => x >= 2); - success = Should("setValueCurve: Output[" + suspendFrame + "-" + ( - renderFrames - 1) + "]", - biggerThan2) - .beEqualTo(true) && success; - - Should("*** setValueCurveAtTime in the past", success) - .summarize( - "correctly clamped to current time", - "was not correctly clamped to current time"); + should(biggerThan2, + "setValueCurve: Output[" + suspendFrame + "-" + + (renderFrames - 1) + "]") + .beEqualTo(true); }) - .then(taskDone); + .then(() => task.done()); }); @@ -232,7 +201,7 @@ return context.startRendering(); } - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html index c6399fd6..33943d0 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-initial-event.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> <title>AudioParam Initial Events </title> </head> @@ -25,76 +25,72 @@ // The following tests start a ramp automation without an initial event. This should cause an // initial event to be added implicitly to give a starting point. - audit.defineTask("linear-ramp", function (done) { - runTest("Linear ramp", { + audit.define("linear-ramp", (task, should) => { + runTest("Linear ramp", should, { automationFunction: function (node, value, time) { node.gain.linearRampToValueAtTime(value, time); }, referenceFunction: linearRamp, // Experimentally determined threshold - threshold: 6.0003e-8, + threshold: { absoluteThreshold: 6.0003e-8 }, // The starting value of the gain node v0: 0.5, // The target value of the automation v1: 0, }) - .then(done); + .then(() => task.done()); }); - audit.defineTask("exponential-ramp", function (done) { - runTest("Exponential ramp", { + audit.define("exponential-ramp", (task, should) => { + runTest("Exponential ramp", should, { automationFunction: function (node, value, time) { node.gain.exponentialRampToValueAtTime(value, time); }, referenceFunction: exponentialRamp, - threshold: 2.3842e-6, + threshold: { absoluteThreshold: 2.3842e-6 }, v0: 0.5, v1: 2, }) - .then(done); + .then(() => task.done()); }); // Same tests as above, but we delay the call to the automation function. This is to verify that // the we still do the right thing after the context has started. - audit.defineTask("delayed-linear-ramp", function (done) { - runTest("Delayed linear ramp", { + audit.define("delayed-linear-ramp", (task, should) => { + runTest("Delayed linear ramp", should, { automationFunction: function (node, value, time) { node.gain.linearRampToValueAtTime(value, time); }, referenceFunction: linearRamp, // Experimentally determined threshold - threshold: 9.87968e-8, + threshold: { absoluteThreshold: 9.87968e-8 }, // The starting value of the gain node v0: 0.5, // The target value of the automation v1: 0, delay: quantumFrames / sampleRate }) - .then(done); + .then(() => task.done()); }); - audit.defineTask("delayed-exponential-ramp", function (done) { - runTest("Delayed exponential ramp", { + audit.define("delayed-exponential-ramp", (task, should) => { + runTest("Delayed exponential ramp", should, { automationFunction: function (node, value, time) { node.gain.exponentialRampToValueAtTime(value, time); }, referenceFunction: exponentialRamp, // Experimentally determined threshold - threshold: 1.3948e-5, + threshold: { absoluteThreshold: 1.3948e-5 }, // The starting value of the gain node v0: 0.5, // The target value of the automation v1: 2, delay: quantumFrames / sampleRate }) - .then(done); + .then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); // Generate the expected waveform for a linear ramp starting from the value |v0|, ramping to // |v1| at time |endTime|. The time of |v0| is assumed to be 0. |nFrames| is how many frames @@ -126,7 +122,7 @@ // threshold - comparison threshold // v0 - starting value // v1 - end value for automation - function runTest(message, options) { + function runTest(message, should, options) { var automationFunction = options.automationFunction; var referenceFunction = options.referenceFunction; var threshold = options.threshold; @@ -164,7 +160,7 @@ .then(function (resultBuffer) { var result = resultBuffer.getChannelData(0); var expected = referenceFunction(v0, v1, delay ? delay : 0, automationEndTime, renderFrames); - Should(message, result).beCloseToArray(expected, threshold); + should(result, message).beCloseToArray(expected, threshold); }); } </script>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-large-endtime.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-large-endtime.html index 0951d34..0c9753c 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-large-endtime.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-large-endtime.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <title>AudioParam with Huge End Time</title> </head> @@ -22,36 +22,32 @@ // automation is run. We don't care about the actual results, just that it runs. // Test linear ramp with huge end time - audit.defineTask("linearRamp", function (done) { + audit.define("linearRamp", (task, should) => { var graph = createGraph(); graph.gain.gain.linearRampToValueAtTime(0.1, largeTime); graph.source.start(); graph.context.startRendering().then(function (buffer) { - Should("linearRampToValue(0.1, " + largeTime + ")", true) - .summarize("successfully rendered", - "unsuccessfully rendered"); - }).then(done); + should(true, "linearRampToValue(0.1, " + largeTime + ")") + .message("successfully rendered", + "unsuccessfully rendered"); + }).then(() => task.done()); }); // Test exponential ramp with huge end time - audit.defineTask("exponentialRamp", function (done) { + audit.define("exponentialRamp", (task, should) => { var graph = createGraph(); graph.gain.gain.exponentialRampToValueAtTime(.1, largeTime); graph.source.start(); graph.context.startRendering().then(function (buffer) { - Should("exponentialRampToValue(0.1, " + largeTime + ")", true) - .summarize("successfully rendered", - "unsuccessfully rendered"); - }).then(done); + should(true, "exponentialRampToValue(0.1, " + largeTime + ")") + .message("successfully rendered", + "unsuccessfully rendered"); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); // Create the graph and return the context, the source, and the gain node. function createGraph() {
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html index 8e58e690..0cead29f 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-linearRamp-value-attribute.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> </head> <body> @@ -23,7 +23,7 @@ // Test that linearRampToValue properly sets the AudioParam .value attribute when the // linearRamp automation is running. - audit.defineTask("propagate", function (done) { + audit.define("propagate", (task, should) => { var context = new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate); // Create a constant source. @@ -61,25 +61,22 @@ } var frame = context.currentTime * sampleRate - 1; - success = Should("gain.gain.value at frame " + frame, gain.gain.value) - .beEqualTo(expected) && success; + success = should(gain.gain.value, + "gain.gain.value at frame " + frame) + .beEqualTo(expected); }).then(context.resume.bind(context)); } // Rock and roll! source.start(); context.startRendering().then(function (result) { - Should("linearRampToValue", success) - .summarize("properly set the AudioParam value", - "did not properly set the AudioParam value"); - }).then(done); + should(success, "linearRampToValue") + .message("properly set the AudioParam value", + "did not properly set the AudioParam value"); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-method-chaining.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-method-chaining.html index e869269..b0a172a 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-method-chaining.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-method-chaining.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> </head> @@ -27,32 +27,26 @@ { name: 'cancelScheduledValues', args: [6.0] } ]; - function verifyReturnedParam(config) { - Should('The return value of ' + config.desc + ' matches the source AudioParam', - config.source === config.returned) - .beEqualTo(true); - } - var audit = Audit.createTaskRunner(); // Task: testing entries from the dictionary. - audit.defineTask('from-dictionary', function (done) { + audit.define('from-dictionary', (task, should) => { var context = new AudioContext(); methodDictionary.forEach(function (method) { var sourceParam = context.createGain().gain; - verifyReturnedParam({ - source: sourceParam, - returned: sourceParam[method.name](...method.args), - desc: sourceParam.constructor.name + '.' + method.name + '()' - }); + should(sourceParam === sourceParam[method.name](...method.args), + 'The return value of ' + sourceParam.constructor.name + '.' + + method.name + '()' + ' matches the source AudioParam') + .beEqualTo(true); + }); - done(); + task.done(); }); // Task: test method chaining with invalid operation. - audit.defineTask('invalid-operation', function (done) { + audit.define('invalid-operation', (task, should) => { var context = new OfflineAudioContext(1, sampleRate, sampleRate); var osc = context.createOscillator(); var amp1 = context.createGain(); @@ -66,33 +60,37 @@ // The first operation fails with an exception, thus the second one // should not have effect on the parameter value. Instead, it should // maintain the default value of 1.0. - Should('Calling setValueAtTime() with a negative end time', function () { - amp1.gain - .setValueAtTime(0.25, -1.0) - .linearRampToValueAtTime(2.0, 1.0); - }).throw('InvalidAccessError'); + should(function () { + amp1.gain + .setValueAtTime(0.25, -1.0) + .linearRampToValueAtTime(2.0, 1.0); + }, + 'Calling setValueAtTime() with a negative end time') + .throw('InvalidAccessError'); // The first operation succeeds but the second fails due to zero target // value for the exponential ramp. Thus only the first should have effect // on the parameter value, setting the value to 0.5. - Should('Calling exponentialRampToValueAtTime() with a zero target value', function () { - amp2.gain - .setValueAtTime(0.5, 0.0) - .exponentialRampToValueAtTime(0.0, 1.0); - }).throw('InvalidAccessError'); + should(function () { + amp2.gain + .setValueAtTime(0.5, 0.0) + .exponentialRampToValueAtTime(0.0, 1.0); + }, + 'Calling exponentialRampToValueAtTime() with a zero target value') + .throw('InvalidAccessError'); osc.start(); osc.stop(1.0); context.startRendering().then(function (buffer) { - Should('The gain value of the first gain node', amp1.gain.value).beEqualTo(1.0); - Should('The gain value of the second gain node', amp2.gain.value).beEqualTo(0.5); - }).then(done); + should(amp1.gain.value, 'The gain value of the first gain node').beEqualTo(1.0); + should(amp2.gain.value, 'The gain value of the second gain node').beEqualTo(0.5); + }).then(() => task.done()); }); // Task: verify if the method chaining actually works. Create an arbitrary // envelope and compare the result with the expected one created by JS code. - audit.defineTask('verification', function (done) { + audit.define('verification', (task, should) => { var context = new OfflineAudioContext(1, sampleRate * 4, sampleRate); var constantBuffer = createConstantBuffer(context, 1, 1.0); @@ -122,19 +120,12 @@ // envelope and the internal implementation. (i.e. double/float and // rounding up) The error threshold is adjusted empirically through // the local testing. - Should('The rendered envelope', buffer.getChannelData(0), { - numberOfArrayLog: 5 - }).beCloseToArray(expectedEnvelope, 4.0532e-6); - }).then(done); + should(buffer.getChannelData(0), 'The rendered envelope') + .beCloseToArray(expectedEnvelope, {absoluteThreshold: 4.0532e-6}); + }).then(() => task.done()); }); - audit.defineTask('finish', function (done) { - done(); - }); - - audit.runTasks(); - - successfullyParsed = true; + audit.run(); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-negative-exponentialRamp.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-negative-exponentialRamp.html index fa889485..22fb528 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-negative-exponentialRamp.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-negative-exponentialRamp.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <title>Test Negative AudioParam.exponentialRampToValueAtTime</title> </head> @@ -15,7 +15,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("both negative values", function (done) { + audit.define("both negative values", (task, should) => { var renderDuration = 0.125; // Create context with two channels. Channel 0 contains the positive-valued exponential and @@ -52,12 +52,12 @@ var actual = resultBuffer.getChannelData(1); var inverted = expected.map(sample => -sample); - Should("Negative exponential ramp from -1 to -2", actual) + should(actual, "Negative exponential ramp from -1 to -2") .beEqualToArray(inverted); - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("negative-end", function (done) { + audit.define("negative-end", (task, should) => { // Positive start value and negative end value should just do nothing. var renderDuration = 0.125; var context = new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate); @@ -80,12 +80,12 @@ context.startRendering().then(function (resultBuffer) { var actual = resultBuffer.getChannelData(0); - Should("Exponential ramp from 2 to -1", actual) + should(actual, "Exponential ramp from 2 to -1") .beConstantValueOf(2); - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("positive-end", function (done) { + audit.define("positive-end", (task, should) => { // Positive start value and negative end value should just do nothing. var renderDuration = 0.125; var context = new OfflineAudioContext(1, renderDuration * sampleRate, sampleRate); @@ -105,12 +105,12 @@ context.startRendering().then(function (resultBuffer) { var actual = resultBuffer.getChannelData(0); - Should("Exponential ramp from -1 to 1", actual) + should(actual, "Exponential ramp from -1 to 1") .beConstantValueOf(-1); - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("propagate", function (done) { + audit.define("propagate", (task, should) => { // Test propagation of ramp if the exponential ramp start and end values have opposite sign. var renderDuration = 0.125; var linearRampEnd = renderDuration / 4; @@ -137,18 +137,14 @@ // Since the start value of the exponential ramp is -1 and the end value is 1, the ramp // should just propagate -1 from the end of the linear ramp "forever". var endFrame = Math.ceil(linearRampEnd * sampleRate); - Should("Exponential ramp from -1 to 1 after the end of the linear ramp", - actual.slice(endFrame)) + should(actual.slice(endFrame), + "Exponential ramp from -1 to 1 after the end of the linear ramp") .beConstantValueOf(-1); - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range-expected.txt b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range-expected.txt index d147f772..6ca1f44 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range-expected.txt +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range-expected.txt
@@ -1,266 +1,318 @@ -CONSOLE WARNING: line 394: Delay.delayTime.value -1 outside nominal range [0, 1.5]; value will be clamped. -CONSOLE WARNING: line 403: Delay.delayTime.value 4 outside nominal range [0, 1.5]; value will be clamped. -CONSOLE WARNING: line 394: StereoPanner.pan.value -3 outside nominal range [-1, 1]; value will be clamped. -CONSOLE WARNING: line 403: StereoPanner.pan.value 3 outside nominal range [-1, 1]; value will be clamped. -CONSOLE WARNING: line 394: DynamicsCompressor.threshold.value -201 outside nominal range [-100, 0]; value will be clamped. -CONSOLE WARNING: line 403: DynamicsCompressor.threshold.value 1 outside nominal range [-100, 0]; value will be clamped. -CONSOLE WARNING: line 394: DynamicsCompressor.knee.value -1 outside nominal range [0, 40]; value will be clamped. -CONSOLE WARNING: line 403: DynamicsCompressor.knee.value 81 outside nominal range [0, 40]; value will be clamped. -CONSOLE WARNING: line 403: DynamicsCompressor.ratio.value 41 outside nominal range [1, 20]; value will be clamped. -CONSOLE WARNING: line 394: DynamicsCompressor.attack.value -1 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 403: DynamicsCompressor.attack.value 3 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 394: DynamicsCompressor.release.value -1 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 403: DynamicsCompressor.release.value 3 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 394: BiquadFilter.frequency.value -1 outside nominal range [0, 24000]; value will be clamped. -CONSOLE WARNING: line 403: BiquadFilter.frequency.value 48001 outside nominal range [0, 24000]; value will be clamped. -CONSOLE WARNING: line 394: Oscillator.frequency.value -48001 outside nominal range [-24000, 24000]; value will be clamped. -CONSOLE WARNING: line 403: Oscillator.frequency.value 48001 outside nominal range [-24000, 24000]; value will be clamped. -CONSOLE WARNING: line 325: Delay.delayTime.setValueAtTime value -1 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 326: Delay.delayTime.linearRampToValueAtTime value 2 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 327: Delay.delayTime.exponentialRampToValue value 3 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 328: Delay.delayTime.setTargetAtTime value -1 outside nominal range [0, 1]; value will be clamped. -CONSOLE WARNING: line 329: Delay.delayTime.setValueCurveAtTime value 1.5 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 396: Delay.delayTime.value -1 outside nominal range [0, 1.5]; value will be clamped. +CONSOLE WARNING: line 406: Delay.delayTime.value 4 outside nominal range [0, 1.5]; value will be clamped. +CONSOLE WARNING: line 396: StereoPanner.pan.value -3 outside nominal range [-1, 1]; value will be clamped. +CONSOLE WARNING: line 406: StereoPanner.pan.value 3 outside nominal range [-1, 1]; value will be clamped. +CONSOLE WARNING: line 396: DynamicsCompressor.threshold.value -201 outside nominal range [-100, 0]; value will be clamped. +CONSOLE WARNING: line 406: DynamicsCompressor.threshold.value 1 outside nominal range [-100, 0]; value will be clamped. +CONSOLE WARNING: line 396: DynamicsCompressor.knee.value -1 outside nominal range [0, 40]; value will be clamped. +CONSOLE WARNING: line 406: DynamicsCompressor.knee.value 81 outside nominal range [0, 40]; value will be clamped. +CONSOLE WARNING: line 406: DynamicsCompressor.ratio.value 41 outside nominal range [1, 20]; value will be clamped. +CONSOLE WARNING: line 396: DynamicsCompressor.attack.value -1 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 406: DynamicsCompressor.attack.value 3 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 396: DynamicsCompressor.release.value -1 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 406: DynamicsCompressor.release.value 3 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 396: BiquadFilter.frequency.value -1 outside nominal range [0, 24000]; value will be clamped. +CONSOLE WARNING: line 406: BiquadFilter.frequency.value 48001 outside nominal range [0, 24000]; value will be clamped. +CONSOLE WARNING: line 396: Oscillator.frequency.value -48001 outside nominal range [-24000, 24000]; value will be clamped. +CONSOLE WARNING: line 406: Oscillator.frequency.value 48001 outside nominal range [-24000, 24000]; value will be clamped. +CONSOLE WARNING: line 329: Delay.delayTime.setValueAtTime value -1 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 330: Delay.delayTime.linearRampToValueAtTime value 2 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 331: Delay.delayTime.exponentialRampToValue value 3 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 332: Delay.delayTime.setTargetAtTime value -1 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 333: Delay.delayTime.setValueCurveAtTime value 1.5 outside nominal range [0, 1]; value will be clamped. This is a testharness.js-based test. -PASS GainNode.gain.minValue is equal to -3.4028234663852886e+38. -PASS GainNode.gain.maxValue is equal to 3.4028234663852886e+38. -PASS GainNode.gain.minValue = Math.PI is not equal to 3.141592653589793. -PASS GainNode.gain.minValue is read-only is equal to true. -PASS GainNode.gain.maxValue = Math.PI is not equal to 3.141592653589793. -PASS GainNode.gain.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of GainNode are correct. -PASS DelayNode.delayTime.minValue is equal to 0. -PASS DelayNode.delayTime.maxValue is equal to 1.5. -PASS DelayNode.delayTime.minValue = Math.PI is not equal to 3.141592653589793. -PASS DelayNode.delayTime.minValue is read-only is equal to true. -PASS DelayNode.delayTime.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DelayNode.delayTime.maxValue is read-only is equal to true. -PASS Set DelayNode.delayTime.value = -1 is equal to 0. -PASS Set DelayNode.delayTime.value = 4 is equal to 1.5. -PASS DelayNode.delayTimewas clipped to lie within the nominal range is equal to true. -PASS Nominal ranges for AudioParam(s) of DelayNode are correct. -PASS AudioBufferSourceNode.playbackRate.minValue is equal to -3.4028234663852886e+38. -PASS AudioBufferSourceNode.playbackRate.maxValue is equal to 3.4028234663852886e+38. -PASS AudioBufferSourceNode.playbackRate.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioBufferSourceNode.playbackRate.minValue is read-only is equal to true. -PASS AudioBufferSourceNode.playbackRate.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioBufferSourceNode.playbackRate.maxValue is read-only is equal to true. -PASS AudioBufferSourceNode.detune.minValue is equal to -3.4028234663852886e+38. -PASS AudioBufferSourceNode.detune.maxValue is equal to 3.4028234663852886e+38. -PASS AudioBufferSourceNode.detune.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioBufferSourceNode.detune.minValue is read-only is equal to true. -PASS AudioBufferSourceNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioBufferSourceNode.detune.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of AudioBufferSourceNode are correct. -PASS StereoPannerNode.pan.minValue is equal to -1. -PASS StereoPannerNode.pan.maxValue is equal to 1. -PASS StereoPannerNode.pan.minValue = Math.PI is not equal to 3.141592653589793. -PASS StereoPannerNode.pan.minValue is read-only is equal to true. -PASS StereoPannerNode.pan.maxValue = Math.PI is not equal to 3.141592653589793. -PASS StereoPannerNode.pan.maxValue is read-only is equal to true. -PASS Set StereoPannerNode.pan.value = -3 is equal to -1. -PASS Set StereoPannerNode.pan.value = 3 is equal to 1. -PASS StereoPannerNode.panwas clipped to lie within the nominal range is equal to true. -PASS Nominal ranges for AudioParam(s) of StereoPannerNode are correct. -PASS DynamicsCompressorNode.threshold.minValue is equal to -100. -PASS DynamicsCompressorNode.threshold.maxValue is equal to 0. -PASS DynamicsCompressorNode.threshold.minValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.threshold.minValue is read-only is equal to true. -PASS DynamicsCompressorNode.threshold.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.threshold.maxValue is read-only is equal to true. -PASS Set DynamicsCompressorNode.threshold.value = -201 is equal to -100. -PASS Set DynamicsCompressorNode.threshold.value = 1 is equal to 0. -PASS DynamicsCompressorNode.thresholdwas clipped to lie within the nominal range is equal to true. -PASS DynamicsCompressorNode.knee.minValue is equal to 0. -PASS DynamicsCompressorNode.knee.maxValue is equal to 40. -PASS DynamicsCompressorNode.knee.minValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.knee.minValue is read-only is equal to true. -PASS DynamicsCompressorNode.knee.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.knee.maxValue is read-only is equal to true. -PASS Set DynamicsCompressorNode.knee.value = -1 is equal to 0. -PASS Set DynamicsCompressorNode.knee.value = 81 is equal to 40. -PASS DynamicsCompressorNode.kneewas clipped to lie within the nominal range is equal to true. -PASS DynamicsCompressorNode.ratio.minValue is equal to 1. -PASS DynamicsCompressorNode.ratio.maxValue is equal to 20. -PASS DynamicsCompressorNode.ratio.minValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.ratio.minValue is read-only is equal to true. -PASS DynamicsCompressorNode.ratio.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.ratio.maxValue is read-only is equal to true. -PASS Set DynamicsCompressorNode.ratio.value = 1 is equal to 1. -PASS Set DynamicsCompressorNode.ratio.value = 41 is equal to 20. -PASS DynamicsCompressorNode.ratiowas clipped to lie within the nominal range is equal to true. -PASS DynamicsCompressorNode.attack.minValue is equal to 0. -PASS DynamicsCompressorNode.attack.maxValue is equal to 1. -PASS DynamicsCompressorNode.attack.minValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.attack.minValue is read-only is equal to true. -PASS DynamicsCompressorNode.attack.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.attack.maxValue is read-only is equal to true. -PASS Set DynamicsCompressorNode.attack.value = -1 is equal to 0. -PASS Set DynamicsCompressorNode.attack.value = 3 is equal to 1. -PASS DynamicsCompressorNode.attackwas clipped to lie within the nominal range is equal to true. -PASS DynamicsCompressorNode.release.minValue is equal to 0. -PASS DynamicsCompressorNode.release.maxValue is equal to 1. -PASS DynamicsCompressorNode.release.minValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.release.minValue is read-only is equal to true. -PASS DynamicsCompressorNode.release.maxValue = Math.PI is not equal to 3.141592653589793. -PASS DynamicsCompressorNode.release.maxValue is read-only is equal to true. -PASS Set DynamicsCompressorNode.release.value = -1 is equal to 0. -PASS Set DynamicsCompressorNode.release.value = 3 is equal to 1. -PASS DynamicsCompressorNode.releasewas clipped to lie within the nominal range is equal to true. -PASS Nominal ranges for AudioParam(s) of DynamicsCompressorNode are correct. -PASS BiquadFilterNode.frequency.minValue is equal to 0. -PASS BiquadFilterNode.frequency.maxValue is equal to 24000. -PASS BiquadFilterNode.frequency.minValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.frequency.minValue is read-only is equal to true. -PASS BiquadFilterNode.frequency.maxValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.frequency.maxValue is read-only is equal to true. -PASS Set BiquadFilterNode.frequency.value = -1 is equal to 0. -PASS Set BiquadFilterNode.frequency.value = 48001 is equal to 24000. -PASS BiquadFilterNode.frequencywas clipped to lie within the nominal range is equal to true. -PASS BiquadFilterNode.detune.minValue is equal to -3.4028234663852886e+38. -PASS BiquadFilterNode.detune.maxValue is equal to 3.4028234663852886e+38. -PASS BiquadFilterNode.detune.minValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.detune.minValue is read-only is equal to true. -PASS BiquadFilterNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.detune.maxValue is read-only is equal to true. -PASS BiquadFilterNode.Q.minValue is equal to -3.4028234663852886e+38. -PASS BiquadFilterNode.Q.maxValue is equal to 3.4028234663852886e+38. -PASS BiquadFilterNode.Q.minValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.Q.minValue is read-only is equal to true. -PASS BiquadFilterNode.Q.maxValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.Q.maxValue is read-only is equal to true. -PASS BiquadFilterNode.gain.minValue is equal to -3.4028234663852886e+38. -PASS BiquadFilterNode.gain.maxValue is equal to 3.4028234663852886e+38. -PASS BiquadFilterNode.gain.minValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.gain.minValue is read-only is equal to true. -PASS BiquadFilterNode.gain.maxValue = Math.PI is not equal to 3.141592653589793. -PASS BiquadFilterNode.gain.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of BiquadFilterNode are correct. -PASS OscillatorNode.frequency.minValue is equal to -24000. -PASS OscillatorNode.frequency.maxValue is equal to 24000. -PASS OscillatorNode.frequency.minValue = Math.PI is not equal to 3.141592653589793. -PASS OscillatorNode.frequency.minValue is read-only is equal to true. -PASS OscillatorNode.frequency.maxValue = Math.PI is not equal to 3.141592653589793. -PASS OscillatorNode.frequency.maxValue is read-only is equal to true. -PASS Set OscillatorNode.frequency.value = -48001 is equal to -24000. -PASS Set OscillatorNode.frequency.value = 48001 is equal to 24000. -PASS OscillatorNode.frequencywas clipped to lie within the nominal range is equal to true. -PASS OscillatorNode.detune.minValue is equal to -3.4028234663852886e+38. -PASS OscillatorNode.detune.maxValue is equal to 3.4028234663852886e+38. -PASS OscillatorNode.detune.minValue = Math.PI is not equal to 3.141592653589793. -PASS OscillatorNode.detune.minValue is read-only is equal to true. -PASS OscillatorNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. -PASS OscillatorNode.detune.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of OscillatorNode are correct. -PASS PannerNode.positionX.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.positionX.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.positionX.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionX.minValue is read-only is equal to true. -PASS PannerNode.positionX.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionX.maxValue is read-only is equal to true. -PASS PannerNode.positionY.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.positionY.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.positionY.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionY.minValue is read-only is equal to true. -PASS PannerNode.positionY.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionY.maxValue is read-only is equal to true. -PASS PannerNode.positionZ.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.positionZ.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.positionZ.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionZ.minValue is read-only is equal to true. -PASS PannerNode.positionZ.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.positionZ.maxValue is read-only is equal to true. -PASS PannerNode.orientationX.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.orientationX.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.orientationX.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationX.minValue is read-only is equal to true. -PASS PannerNode.orientationX.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationX.maxValue is read-only is equal to true. -PASS PannerNode.orientationY.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.orientationY.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.orientationY.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationY.minValue is read-only is equal to true. -PASS PannerNode.orientationY.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationY.maxValue is read-only is equal to true. -PASS PannerNode.orientationZ.minValue is equal to -3.4028234663852886e+38. -PASS PannerNode.orientationZ.maxValue is equal to 3.4028234663852886e+38. -PASS PannerNode.orientationZ.minValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationZ.minValue is read-only is equal to true. -PASS PannerNode.orientationZ.maxValue = Math.PI is not equal to 3.141592653589793. -PASS PannerNode.orientationZ.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of PannerNode are correct. -PASS ConstantSourceNode.offset.minValue is equal to -3.4028234663852886e+38. -PASS ConstantSourceNode.offset.maxValue is equal to 3.4028234663852886e+38. -PASS ConstantSourceNode.offset.minValue = Math.PI is not equal to 3.141592653589793. -PASS ConstantSourceNode.offset.minValue is read-only is equal to true. -PASS ConstantSourceNode.offset.maxValue = Math.PI is not equal to 3.141592653589793. -PASS ConstantSourceNode.offset.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of ConstantSourceNode are correct. -PASS AudioBuffer has no AudioParams as expected. -PASS IIRFilterNode has no AudioParams as expected. -PASS WaveShaperNode has no AudioParams as expected. -PASS ConvolverNode has no AudioParams as expected. -PASS AnalyserNode has no AudioParams as expected. -PASS ScriptProcessorNode has no AudioParams as expected. -PASS PeriodicWave has no AudioParams as expected. -PASS ChannelSplitterNode has no AudioParams as expected. -PASS ChannelMergerNode has no AudioParams as expected. -PASS MediaElementAudioSourceNode has no AudioParams as expected. -PASS MediaStreamAudioDestinationNode has no AudioParams as expected. -PASS AudioListener.positionX.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.positionX.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.positionX.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionX.minValue is read-only is equal to true. -PASS AudioListener.positionX.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionX.maxValue is read-only is equal to true. -PASS AudioListener.positionY.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.positionY.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.positionY.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionY.minValue is read-only is equal to true. -PASS AudioListener.positionY.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionY.maxValue is read-only is equal to true. -PASS AudioListener.positionZ.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.positionZ.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.positionZ.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionZ.minValue is read-only is equal to true. -PASS AudioListener.positionZ.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.positionZ.maxValue is read-only is equal to true. -PASS AudioListener.forwardX.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.forwardX.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.forwardX.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardX.minValue is read-only is equal to true. -PASS AudioListener.forwardX.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardX.maxValue is read-only is equal to true. -PASS AudioListener.forwardY.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.forwardY.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.forwardY.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardY.minValue is read-only is equal to true. -PASS AudioListener.forwardY.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardY.maxValue is read-only is equal to true. -PASS AudioListener.forwardZ.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.forwardZ.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.forwardZ.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardZ.minValue is read-only is equal to true. -PASS AudioListener.forwardZ.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.forwardZ.maxValue is read-only is equal to true. -PASS AudioListener.upX.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.upX.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.upX.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upX.minValue is read-only is equal to true. -PASS AudioListener.upX.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upX.maxValue is read-only is equal to true. -PASS AudioListener.upY.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.upY.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.upY.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upY.minValue is read-only is equal to true. -PASS AudioListener.upY.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upY.maxValue is read-only is equal to true. -PASS AudioListener.upZ.minValue is equal to -3.4028234663852886e+38. -PASS AudioListener.upZ.maxValue is equal to 3.4028234663852886e+38. -PASS AudioListener.upZ.minValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upZ.minValue is read-only is equal to true. -PASS AudioListener.upZ.maxValue = Math.PI is not equal to 3.141592653589793. -PASS AudioListener.upZ.maxValue is read-only is equal to true. -PASS Nominal ranges for AudioParam(s) of AudioListener are correct. -PASS Number of nodes not tested : 0. +PASS # AUDIT TASK RUNNER STARTED. +PASS > [initialize] +PASS Create context for tests did not throw an exception. +PASS < [initialize] All assertions passed. (total 1 assertions) +PASS > [createGain] +PASS GainNode.gain.minValue is equal to -3.4028234663852886e+38. +PASS GainNode.gain.maxValue is equal to 3.4028234663852886e+38. +PASS GainNode.gain.minValue = Math.PI is not equal to 3.141592653589793. +PASS GainNode.gain.minValue is read-only is equal to true. +PASS GainNode.gain.maxValue = Math.PI is not equal to 3.141592653589793. +PASS GainNode.gain.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of GainNode are correct +PASS < [createGain] All assertions passed. (total 7 assertions) +PASS > [createDelay] +PASS DelayNode.delayTime.minValue is equal to 0. +PASS DelayNode.delayTime.maxValue is equal to 1.5. +PASS DelayNode.delayTime.minValue = Math.PI is not equal to 3.141592653589793. +PASS DelayNode.delayTime.minValue is read-only is equal to true. +PASS DelayNode.delayTime.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DelayNode.delayTime.maxValue is read-only is equal to true. +PASS Set DelayNode.delayTime.value = -1 is equal to 0. +PASS Set DelayNode.delayTime.value = 4 is equal to 1.5. +PASS DelayNode.delayTimewas clipped to lie within the nominal range is equal to true. +PASS Nominal ranges for AudioParam(s) of DelayNode are correct +PASS < [createDelay] All assertions passed. (total 10 assertions) +PASS > [createBufferSource] +PASS AudioBufferSourceNode.playbackRate.minValue is equal to -3.4028234663852886e+38. +PASS AudioBufferSourceNode.playbackRate.maxValue is equal to 3.4028234663852886e+38. +PASS AudioBufferSourceNode.playbackRate.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioBufferSourceNode.playbackRate.minValue is read-only is equal to true. +PASS AudioBufferSourceNode.playbackRate.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioBufferSourceNode.playbackRate.maxValue is read-only is equal to true. +PASS AudioBufferSourceNode.detune.minValue is equal to -3.4028234663852886e+38. +PASS AudioBufferSourceNode.detune.maxValue is equal to 3.4028234663852886e+38. +PASS AudioBufferSourceNode.detune.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioBufferSourceNode.detune.minValue is read-only is equal to true. +PASS AudioBufferSourceNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioBufferSourceNode.detune.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of AudioBufferSourceNode are correct +PASS < [createBufferSource] All assertions passed. (total 13 assertions) +PASS > [createStereoPanner] +PASS StereoPannerNode.pan.minValue is equal to -1. +PASS StereoPannerNode.pan.maxValue is equal to 1. +PASS StereoPannerNode.pan.minValue = Math.PI is not equal to 3.141592653589793. +PASS StereoPannerNode.pan.minValue is read-only is equal to true. +PASS StereoPannerNode.pan.maxValue = Math.PI is not equal to 3.141592653589793. +PASS StereoPannerNode.pan.maxValue is read-only is equal to true. +PASS Set StereoPannerNode.pan.value = -3 is equal to -1. +PASS Set StereoPannerNode.pan.value = 3 is equal to 1. +PASS StereoPannerNode.panwas clipped to lie within the nominal range is equal to true. +PASS Nominal ranges for AudioParam(s) of StereoPannerNode are correct +PASS < [createStereoPanner] All assertions passed. (total 10 assertions) +PASS > [createDynamicsCompressor] +PASS DynamicsCompressorNode.threshold.minValue is equal to -100. +PASS DynamicsCompressorNode.threshold.maxValue is equal to 0. +PASS DynamicsCompressorNode.threshold.minValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.threshold.minValue is read-only is equal to true. +PASS DynamicsCompressorNode.threshold.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.threshold.maxValue is read-only is equal to true. +PASS Set DynamicsCompressorNode.threshold.value = -201 is equal to -100. +PASS Set DynamicsCompressorNode.threshold.value = 1 is equal to 0. +PASS DynamicsCompressorNode.thresholdwas clipped to lie within the nominal range is equal to true. +PASS DynamicsCompressorNode.knee.minValue is equal to 0. +PASS DynamicsCompressorNode.knee.maxValue is equal to 40. +PASS DynamicsCompressorNode.knee.minValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.knee.minValue is read-only is equal to true. +PASS DynamicsCompressorNode.knee.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.knee.maxValue is read-only is equal to true. +PASS Set DynamicsCompressorNode.knee.value = -1 is equal to 0. +PASS Set DynamicsCompressorNode.knee.value = 81 is equal to 40. +PASS DynamicsCompressorNode.kneewas clipped to lie within the nominal range is equal to true. +PASS DynamicsCompressorNode.ratio.minValue is equal to 1. +PASS DynamicsCompressorNode.ratio.maxValue is equal to 20. +PASS DynamicsCompressorNode.ratio.minValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.ratio.minValue is read-only is equal to true. +PASS DynamicsCompressorNode.ratio.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.ratio.maxValue is read-only is equal to true. +PASS Set DynamicsCompressorNode.ratio.value = 1 is equal to 1. +PASS Set DynamicsCompressorNode.ratio.value = 41 is equal to 20. +PASS DynamicsCompressorNode.ratiowas clipped to lie within the nominal range is equal to true. +PASS DynamicsCompressorNode.attack.minValue is equal to 0. +PASS DynamicsCompressorNode.attack.maxValue is equal to 1. +PASS DynamicsCompressorNode.attack.minValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.attack.minValue is read-only is equal to true. +PASS DynamicsCompressorNode.attack.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.attack.maxValue is read-only is equal to true. +PASS Set DynamicsCompressorNode.attack.value = -1 is equal to 0. +PASS Set DynamicsCompressorNode.attack.value = 3 is equal to 1. +PASS DynamicsCompressorNode.attackwas clipped to lie within the nominal range is equal to true. +PASS DynamicsCompressorNode.release.minValue is equal to 0. +PASS DynamicsCompressorNode.release.maxValue is equal to 1. +PASS DynamicsCompressorNode.release.minValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.release.minValue is read-only is equal to true. +PASS DynamicsCompressorNode.release.maxValue = Math.PI is not equal to 3.141592653589793. +PASS DynamicsCompressorNode.release.maxValue is read-only is equal to true. +PASS Set DynamicsCompressorNode.release.value = -1 is equal to 0. +PASS Set DynamicsCompressorNode.release.value = 3 is equal to 1. +PASS DynamicsCompressorNode.releasewas clipped to lie within the nominal range is equal to true. +PASS Nominal ranges for AudioParam(s) of DynamicsCompressorNode are correct +PASS < [createDynamicsCompressor] All assertions passed. (total 46 assertions) +PASS > [createBiquadFilter] +PASS BiquadFilterNode.frequency.minValue is equal to 0. +PASS BiquadFilterNode.frequency.maxValue is equal to 24000. +PASS BiquadFilterNode.frequency.minValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.frequency.minValue is read-only is equal to true. +PASS BiquadFilterNode.frequency.maxValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.frequency.maxValue is read-only is equal to true. +PASS Set BiquadFilterNode.frequency.value = -1 is equal to 0. +PASS Set BiquadFilterNode.frequency.value = 48001 is equal to 24000. +PASS BiquadFilterNode.frequencywas clipped to lie within the nominal range is equal to true. +PASS BiquadFilterNode.detune.minValue is equal to -3.4028234663852886e+38. +PASS BiquadFilterNode.detune.maxValue is equal to 3.4028234663852886e+38. +PASS BiquadFilterNode.detune.minValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.detune.minValue is read-only is equal to true. +PASS BiquadFilterNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.detune.maxValue is read-only is equal to true. +PASS BiquadFilterNode.Q.minValue is equal to -3.4028234663852886e+38. +PASS BiquadFilterNode.Q.maxValue is equal to 3.4028234663852886e+38. +PASS BiquadFilterNode.Q.minValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.Q.minValue is read-only is equal to true. +PASS BiquadFilterNode.Q.maxValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.Q.maxValue is read-only is equal to true. +PASS BiquadFilterNode.gain.minValue is equal to -3.4028234663852886e+38. +PASS BiquadFilterNode.gain.maxValue is equal to 3.4028234663852886e+38. +PASS BiquadFilterNode.gain.minValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.gain.minValue is read-only is equal to true. +PASS BiquadFilterNode.gain.maxValue = Math.PI is not equal to 3.141592653589793. +PASS BiquadFilterNode.gain.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of BiquadFilterNode are correct +PASS < [createBiquadFilter] All assertions passed. (total 28 assertions) +PASS > [createOscillator] +PASS OscillatorNode.frequency.minValue is equal to -24000. +PASS OscillatorNode.frequency.maxValue is equal to 24000. +PASS OscillatorNode.frequency.minValue = Math.PI is not equal to 3.141592653589793. +PASS OscillatorNode.frequency.minValue is read-only is equal to true. +PASS OscillatorNode.frequency.maxValue = Math.PI is not equal to 3.141592653589793. +PASS OscillatorNode.frequency.maxValue is read-only is equal to true. +PASS Set OscillatorNode.frequency.value = -48001 is equal to -24000. +PASS Set OscillatorNode.frequency.value = 48001 is equal to 24000. +PASS OscillatorNode.frequencywas clipped to lie within the nominal range is equal to true. +PASS OscillatorNode.detune.minValue is equal to -3.4028234663852886e+38. +PASS OscillatorNode.detune.maxValue is equal to 3.4028234663852886e+38. +PASS OscillatorNode.detune.minValue = Math.PI is not equal to 3.141592653589793. +PASS OscillatorNode.detune.minValue is read-only is equal to true. +PASS OscillatorNode.detune.maxValue = Math.PI is not equal to 3.141592653589793. +PASS OscillatorNode.detune.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of OscillatorNode are correct +PASS < [createOscillator] All assertions passed. (total 16 assertions) +PASS > [createPanner] +PASS PannerNode.positionX.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.positionX.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.positionX.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionX.minValue is read-only is equal to true. +PASS PannerNode.positionX.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionX.maxValue is read-only is equal to true. +PASS PannerNode.positionY.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.positionY.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.positionY.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionY.minValue is read-only is equal to true. +PASS PannerNode.positionY.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionY.maxValue is read-only is equal to true. +PASS PannerNode.positionZ.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.positionZ.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.positionZ.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionZ.minValue is read-only is equal to true. +PASS PannerNode.positionZ.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.positionZ.maxValue is read-only is equal to true. +PASS PannerNode.orientationX.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.orientationX.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.orientationX.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationX.minValue is read-only is equal to true. +PASS PannerNode.orientationX.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationX.maxValue is read-only is equal to true. +PASS PannerNode.orientationY.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.orientationY.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.orientationY.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationY.minValue is read-only is equal to true. +PASS PannerNode.orientationY.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationY.maxValue is read-only is equal to true. +PASS PannerNode.orientationZ.minValue is equal to -3.4028234663852886e+38. +PASS PannerNode.orientationZ.maxValue is equal to 3.4028234663852886e+38. +PASS PannerNode.orientationZ.minValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationZ.minValue is read-only is equal to true. +PASS PannerNode.orientationZ.maxValue = Math.PI is not equal to 3.141592653589793. +PASS PannerNode.orientationZ.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of PannerNode are correct +PASS < [createPanner] All assertions passed. (total 37 assertions) +PASS > [createConstantSource] +PASS ConstantSourceNode.offset.minValue is equal to -3.4028234663852886e+38. +PASS ConstantSourceNode.offset.maxValue is equal to 3.4028234663852886e+38. +PASS ConstantSourceNode.offset.minValue = Math.PI is not equal to 3.141592653589793. +PASS ConstantSourceNode.offset.minValue is read-only is equal to true. +PASS ConstantSourceNode.offset.maxValue = Math.PI is not equal to 3.141592653589793. +PASS ConstantSourceNode.offset.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of ConstantSourceNode are correct +PASS < [createConstantSource] All assertions passed. (total 7 assertions) +PASS > [createBuffer] +PASS AudioBuffer has no AudioParams as expected +PASS < [createBuffer] All assertions passed. (total 1 assertions) +PASS > [createIIRFilter] +PASS IIRFilterNode has no AudioParams as expected +PASS < [createIIRFilter] All assertions passed. (total 1 assertions) +PASS > [createWaveShaper] +PASS WaveShaperNode has no AudioParams as expected +PASS < [createWaveShaper] All assertions passed. (total 1 assertions) +PASS > [createConvolver] +PASS ConvolverNode has no AudioParams as expected +PASS < [createConvolver] All assertions passed. (total 1 assertions) +PASS > [createAnalyser] +PASS AnalyserNode has no AudioParams as expected +PASS < [createAnalyser] All assertions passed. (total 1 assertions) +PASS > [createScriptProcessor] +PASS ScriptProcessorNode has no AudioParams as expected +PASS < [createScriptProcessor] All assertions passed. (total 1 assertions) +PASS > [createPeriodicWave] +PASS PeriodicWave has no AudioParams as expected +PASS < [createPeriodicWave] All assertions passed. (total 1 assertions) +PASS > [createChannelSplitter] +PASS ChannelSplitterNode has no AudioParams as expected +PASS < [createChannelSplitter] All assertions passed. (total 1 assertions) +PASS > [createChannelMerger] +PASS ChannelMergerNode has no AudioParams as expected +PASS < [createChannelMerger] All assertions passed. (total 1 assertions) +PASS > [createMediaElementSource] +PASS MediaElementAudioSourceNode has no AudioParams as expected +PASS < [createMediaElementSource] All assertions passed. (total 1 assertions) +PASS > [createMediaStreamDestination] +PASS MediaStreamAudioDestinationNode has no AudioParams as expected +PASS < [createMediaStreamDestination] All assertions passed. (total 1 assertions) +PASS > [AudioListener] +PASS AudioListener.positionX.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.positionX.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.positionX.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionX.minValue is read-only is equal to true. +PASS AudioListener.positionX.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionX.maxValue is read-only is equal to true. +PASS AudioListener.positionY.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.positionY.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.positionY.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionY.minValue is read-only is equal to true. +PASS AudioListener.positionY.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionY.maxValue is read-only is equal to true. +PASS AudioListener.positionZ.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.positionZ.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.positionZ.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionZ.minValue is read-only is equal to true. +PASS AudioListener.positionZ.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.positionZ.maxValue is read-only is equal to true. +PASS AudioListener.forwardX.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.forwardX.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.forwardX.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardX.minValue is read-only is equal to true. +PASS AudioListener.forwardX.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardX.maxValue is read-only is equal to true. +PASS AudioListener.forwardY.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.forwardY.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.forwardY.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardY.minValue is read-only is equal to true. +PASS AudioListener.forwardY.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardY.maxValue is read-only is equal to true. +PASS AudioListener.forwardZ.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.forwardZ.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.forwardZ.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardZ.minValue is read-only is equal to true. +PASS AudioListener.forwardZ.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.forwardZ.maxValue is read-only is equal to true. +PASS AudioListener.upX.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.upX.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.upX.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upX.minValue is read-only is equal to true. +PASS AudioListener.upX.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upX.maxValue is read-only is equal to true. +PASS AudioListener.upY.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.upY.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.upY.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upY.minValue is read-only is equal to true. +PASS AudioListener.upY.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upY.maxValue is read-only is equal to true. +PASS AudioListener.upZ.minValue is equal to -3.4028234663852886e+38. +PASS AudioListener.upZ.maxValue is equal to 3.4028234663852886e+38. +PASS AudioListener.upZ.minValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upZ.minValue is read-only is equal to true. +PASS AudioListener.upZ.maxValue = Math.PI is not equal to 3.141592653589793. +PASS AudioListener.upZ.maxValue is read-only is equal to true. +PASS Nominal ranges for AudioParam(s) of AudioListener are correct +PASS < [AudioListener] All assertions passed. (total 55 assertions) +PASS > [verifyTests] +PASS Number of nodes not tested : 0 +PASS < [verifyTests] All assertions passed. (total 1 assertions) +PASS > [automation] +PASS Test automations (check console logs) did not throw an exception. +PASS < [automation] All assertions passed. (total 1 assertions) +PASS # AUDIT TASK RUNNER FINISHED: 24 tasks ran successfully. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range.html index 672b1ded..47dc585b 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-nominal-range.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <title>Test AudioParam Nominal Range Values</title> </head> @@ -223,27 +223,30 @@ ]; // Create the context so we can use it in the following test. - audit.defineTask("initialize", function (done) { + audit.define("initialize", (task, should) => { // Just any context so that we can create the nodes. - context = new OfflineAudioContext(1, 1, sampleRate); - done(); + should(() => { + context = new OfflineAudioContext(1, 1, sampleRate); + }, "Create context for tests") + .notThrow(); + task.done(); }); // Create a task for each entry in testConfigs for (let test in testConfigs) { var config = testConfigs[test] - audit.defineTask(config.creator, (function (c) { - return function (done) { + audit.define(config.creator, (function (c) { + return (task, should) => { var node = context[c.creator](...c.args); - testLimits(c.creator, node, c.limits); - done(); + testLimits(should, c.creator, node, c.limits); + task.done(); }; })(config)); } // Test the AudioListener params that were added for the automated Panner - audit.defineTask("AudioListener", function (done) { - testLimits("", context.listener, { + audit.define("AudioListener", (task, should) => { + testLimits(should, "", context.listener, { positionX: { minValue: -mostPositiveFloat, maxValue: mostPositiveFloat, @@ -281,11 +284,11 @@ maxValue: mostPositiveFloat, } }); - done(); + task.done(); }); // Verify that we have tested all the create methods available on the context. - audit.defineTask("verifyTests", function (done) { + audit.define("verifyTests", (task, should) => { var allNodes = new Set(); // Create the set of all "create" methods from the context. for (var method in context) { @@ -309,16 +312,17 @@ output.push(" " + item.substring(6)); } - Should("Number of nodes not tested", output.length === 0) - .summarize(": 0", - ": " + output); + should(output.length === 0, "Number of nodes not tested") + .message(": 0", + ": " + output); - done(); + task.done(); }); // Simple test of a few automation methods to verify we get warnings. - audit.defineTask("automation", function (done) { + audit.define("automation", (task, should) => { // Just use a DelayNode for testing because the audio param has finite limits. + should(() => { var d = context.createDelay(); // The console output should have the warnings that we're interested in. @@ -327,15 +331,12 @@ d.delayTime.exponentialRampToValueAtTime(3, 2); d.delayTime.setTargetAtTime(-1, 3, .1); d.delayTime.setValueCurveAtTime(Float32Array.from([.1, .2, 1.5, -1]), 4, .1); - done(); + }, "Test automations (check console logs)") + .notThrow(); + task.done(); }); - // All done! - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); // Is |object| an AudioParam? We determine this by checking the constructor name. function isAudioParam(object) { @@ -351,7 +352,7 @@ // Check the min and max values for the AudioParam attribute named |paramName| for the |node|. // The expected limits is given by the dictionary |limits|. If some test fails, add the name // of the failed - function validateAudioParamLimits(node, paramName, limits) { + function validateAudioParamLimits(should, node, paramName, limits) { var nodeName = node.constructor.name; var parameter = node[paramName]; var prefix = nodeName + "." + paramName; @@ -359,26 +360,27 @@ var success = true; if (hasValidLimits(limits[paramName])) { // Verify that the min and max values for the parameter are correct. - var isCorrect = Should(prefix + ".minValue", parameter.minValue) + var isCorrect = should(parameter.minValue, prefix + ".minValue") .beEqualTo(limits[paramName].minValue); - isCorrect = Should(prefix + ".maxValue", parameter.maxValue) + isCorrect = should(parameter.maxValue, prefix + ".maxValue") .beEqualTo(limits[paramName].maxValue) && isCorrect; // Verify that the min and max attributes are read-only parameter.minValue = Math.PI; var isReadOnly; - isReadOnly = Should(prefix + ".minValue = Math.PI", parameter.minValue) + isReadOnly = should(parameter.minValue, prefix + ".minValue = Math.PI") .notBeEqualTo(Math.PI); - Should(prefix + ".minValue is read-only", isReadOnly) + should(isReadOnly, prefix + ".minValue is read-only") .beEqualTo(true); isCorrect = isReadOnly && isCorrect; parameter.maxValue = Math.PI; - isReadOnly = Should(prefix + ".maxValue = Math.PI", parameter.maxValue) + isReadOnly = should(parameter.maxValue, + prefix + ".maxValue = Math.PI") .notBeEqualTo(Math.PI); - Should(prefix + ".maxValue is read-only", isReadOnly) + should(isReadOnly, prefix + ".maxValue is read-only") .beEqualTo(true); isCorrect = isReadOnly && isCorrect; @@ -393,7 +395,8 @@ if (newValue >= -mostPositiveFloat) { parameter.value = newValue; clippingTested = true; - isClipped = Should("Set " + prefix + ".value = " + newValue, parameter.value) + isClipped = should(parameter.value, + "Set " + prefix + ".value = " + newValue) .beEqualTo(parameter.minValue) && isClipped; } @@ -402,13 +405,14 @@ if (newValue <= mostPositiveFloat) { parameter.value = newValue; clippingTested = true; - isClipped = Should("Set " + prefix + ".value = " + newValue, parameter.value) + isClipped = should(parameter.value, + "Set " + prefix + ".value = " + newValue) .beEqualTo(parameter.maxValue) && isClipped; - } if (clippingTested) { - Should(prefix + "was clipped to lie within the nominal range", isClipped) + should(isClipped, + prefix + "was clipped to lie within the nominal range") .beEqualTo(true); } @@ -417,8 +421,9 @@ success = isCorrect && success; } else { // Test config didn't specify valid limits. Fail this test! -// testFailed("Limits for " + nodeName + "." + paramName + " were not correctly defined."); - Should("Limits for " + nodeName + "." + paramName + " were correctly defined", clippingTested) + should(clippingTested, + "Limits for " + nodeName + "." + paramName + + " were correctly defined") .beEqualTo(false); success = false; @@ -430,7 +435,7 @@ // Test all of the AudioParams for |node| using the expected values in |limits|. // |creatorName| is the name of the method to create the node, and is used to keep trakc of // which tests we've run. - function testLimits(creatorName, node, limits) { + function testLimits(should, creatorName, node, limits) { var nodeName = node.constructor.name; testedMethods.add(creatorName); @@ -446,7 +451,8 @@ Object.keys(node.__proto__).forEach(function (paramName) { if (isAudioParam(node[paramName])) { audioParams.push(paramName); - var isValid = validateAudioParamLimits(node, paramName, limits, incorrectParams); + var isValid = validateAudioParamLimits(should, node, paramName, + limits, incorrectParams); if (!isValid) incorrectParams.push(paramName); @@ -457,14 +463,14 @@ // Print an appropriate message depending on whether there were AudioParams defined or not. if (audioParams.length) { var message = "Nominal ranges for AudioParam(s) of " + node.constructor.name; - Should(message, success) - .summarize("are correct", - "are incorrect for: " + + incorrectParams); + should(success, message) + .message("are correct", + "are incorrect for: " + + incorrectParams); return success; } else { - Should(nodeName, !limits) - .summarize("has no AudioParams as expected", - "has no AudioParams but test expected " + limits); + should(!limits, nodeName) + .message("has no AudioParams as expected", + "has no AudioParams but test expected " + limits); } } </script>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html index f6eb35c7..4b3fb70d 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-processing.html
@@ -4,7 +4,7 @@ <title>Test Processing Of AudioParams of Disconnected AudioNodes</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> </head> <body> @@ -26,189 +26,189 @@ // Source nodes are not included in this because the AudioParams for the // source nodes only process when the node has been started. - audit.defineTask("BiquadFilterNode", function (taskDone) { + audit.define("BiquadFilterNode", (task, should) => { var nodeName = "BiquadFilterNode" Promise.all([ - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "Q", initialValue: 2, rampFinalValue: 5 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "detune", initialValue: 1, rampFinalValue: 0.5 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "frequency", initialValue: 1000, rampFinalValue: 100 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "gain", initialValue: -3, rampFinalValue: 3 }), - ]).then(taskDone); + ]).then(() => task.done()); }); - audit.defineTask("DelayNode", function (taskDone) { - testParamAutomation({ + audit.define("DelayNode", (task, should) => { + testParamAutomation(should, { nodeName: "DelayNode", paramName: "delayTime", initialValue: 0.25, rampFinalValue: 0.5 - }).then(taskDone); + }).then(() => task.done()); }); - audit.defineTask("DynamicsCompressorNode", function (taskDone) { + audit.define("DynamicsCompressorNode", (task, should) => { var nodeName = "DynamicsCompressorNode"; Promise.all([ - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "attack", initialValue: 0.1, rampFinalValue: 0.5 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "knee", initialValue: 0, rampFinalValue: 25 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "ratio", initialValue: 1, rampFinalValue: 15 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "release", initialValue: 0, rampFinalValue: 0.75 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "threshold", initialValue: -50, rampFinalValue: -10 }) - ]).then(taskDone); + ]).then(() => task.done()); }); - audit.defineTask("GainNode", function (taskDone) { - testParamAutomation({ + audit.define("GainNode", (task, should) => { + testParamAutomation(should, { nodeName: "GainNode", paramName: "gain", initialValue: 1, rampFinalValue: 0.5 - }).then(taskDone); + }).then(() => task.done()); }); - audit.defineTask("PannerNode", function (taskDone) { + audit.define("PannerNode", (task, should) => { var nodeName = "PannerNode"; Promise.all([ - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "positionX", initialValue: 0.1, rampFinalValue: 0.5 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "positionY", initialValue: 2, rampFinalValue: 30 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "positionZ", initialValue: 1, rampFinalValue: 15 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "orientationX", initialValue: 0.1, rampFinalValue: 0.5 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "orientationY", initialValue: 2, rampFinalValue: 30 }), - testParamAutomation({ + testParamAutomation(should, { nodeName: nodeName, paramName: "orientationZ", initialValue: 1, rampFinalValue: 15 }), - ]).then(taskDone); + ]).then(() => task.done()); }); - audit.defineTask("StereoPannerNode", function (taskDone) { - testParamAutomation({ + audit.define("StereoPannerNode", (task, should) => { + testParamAutomation(should, { nodeName: "StereoPannerNode", paramName: "pan", initialValue: 1, rampFinalValue: 0.5 - }).then(taskDone); + }).then(() => task.done()); }); - audit.defineTask("AudioListener", function (taskDone) { + audit.define("AudioListener", (task, should) => { Promise.all([ - testAudioListener({ + testAudioListener(should, { paramName: "positionX", initialValue: 1, rampFinalValue: 100 }), - testAudioListener({ + testAudioListener(should, { paramName: "positionY", initialValue: 1, rampFinalValue: 200 }), - testAudioListener({ + testAudioListener(should, { paramName: "positionZ", initialValue: 1, rampFinalValue: 300 }), - testAudioListener({ + testAudioListener(should, { paramName: "forwardX", initialValue: 1, rampFinalValue: -100 }), - testAudioListener({ + testAudioListener(should, { paramName: "forwardY", initialValue: 1, rampFinalValue: -200 }), - testAudioListener({ + testAudioListener(should, { paramName: "forwardZ", initialValue: 1, rampFinalValue: -300 }), - testAudioListener({ + testAudioListener(should, { paramName: "upX", initialValue: 1, rampFinalValue: 99 }), - testAudioListener({ + testAudioListener(should, { paramName: "upY", initialValue: 1, rampFinalValue: 42 }), - testAudioListener({ + testAudioListener(should, { paramName: "upZ", initialValue: 1, rampFinalValue: 137 }), - ]).then(taskDone); + ]).then(() => task.done()); }); // Run test of automation processing. |options| is a dictionary that @@ -230,7 +230,7 @@ // Processing is started and after some number of frames, the |.value| of // the AudioParam is obtained and compared against the final value. These // should match exactly. - function testParamAutomation(options) { + function testParamAutomation(should, options) { var context = new OfflineAudioContext(1, renderFrames, sampleRate); // Create the node to be tested @@ -250,19 +250,18 @@ // Sanity check: the given ramp final value must not be the default // value, otherwise we can't easily tell if the automation was // actually run. - Should(options.nodeName + "." + options.paramName + " ramp final value", - options.rampFinalValue) + should(options.rampFinalValue, + options.nodeName + "." + options.paramName + " ramp final value") .notBeEqualTo(node[options.paramName].defaultValue); // The actual AudioParam value should be the rampe final value. - Should(options.nodeName + "." + options.paramName + - ".value", - node[options.paramName].value) + should(node[options.paramName].value, + options.nodeName + "." + options.paramName + ".value") .beEqualTo(options.rampFinalValue); }); } - function testAudioListener(options) { + function testAudioListener(should, options) { var context = new OfflineAudioContext(1, renderFrames, sampleRate); // Create the node to be tested @@ -282,19 +281,18 @@ // Sanity check: the given ramp final value must not be the default // value, otherwise we can't easily tell if the automation was // actually run. - Should("AudioListener." + options.paramName + " ramp final value", - options.rampFinalValue) + should(options.rampFinalValue, + "AudioListener." + options.paramName + " ramp final value") .notBeEqualTo(context.listener[options.paramName].defaultValue); // The actual AudioParam value should be the rampe final value. - Should("AudioListener." + options.paramName + - ".value", - context.listener[options.paramName].value) + should(context.listener[options.paramName].value, + "AudioListener." + options.paramName + ".value") .beEqualTo(options.rampFinalValue); }); } - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-sampling.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-sampling.html index eab5cd2..930e2c96 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-sampling.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-sampling.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> <title>Test Sampling of LinearRampToValueAtTime</title> </head> @@ -17,7 +17,7 @@ var audit = Audit.createTaskRunner(); - function runTest(config) { + function runTest(should, config) { // Create a short context with a constant signal source connected to a gain node that will // be automated. context = new OfflineAudioContext(1, 256, sampleRate); @@ -55,17 +55,10 @@ var expectedStart = config.expectedFunction(startFrame / sampleRate); var expectedEnd = config.expectedFunction(endFrame / sampleRate); - var success = Should(config.desc + ": Sample " + startFrame, - resultData[startFrame], { - precision: 7 - }).beCloseTo(expectedStart, config.startValueThreshold); - success = Should(config.desc + ": Sample " + endFrame, - resultData[endFrame], { - precision: 7 - }).beCloseTo(expectedEnd, config.endValueThreshold) && success; - - Should(config.desc, success) - .summarize("passed", "failed"); + should(resultData[startFrame], config.desc + ": Sample " + startFrame) + .beCloseTo(expectedStart, {threshold: config.startValueThreshold}); + should(resultData[endFrame], config.desc + ": Sample " + endFrame) + .beCloseTo(expectedEnd, {threshold: config.endValueThreshold}); }); } @@ -155,8 +148,8 @@ ]; function createTaskFunction(config) { - return function (done) { - runTest(config).then(done); + return (task, should) => { + runTest(should, config).then(() => task.done()); }; } @@ -164,15 +157,10 @@ for (var k = 0; k < testConfigs.length; ++k) { var config = testConfigs[k]; var taskName = config.desc + ":task" + k; - audit.defineTask(taskName, createTaskFunction(config)); + audit.define(taskName, createTaskFunction(config)); } - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); - successfullyParsed = true; + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTarget-timeConstant-0.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTarget-timeConstant-0.html index 9445843..03b08f0 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTarget-timeConstant-0.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTarget-timeConstant-0.html
@@ -4,7 +4,7 @@ <title>Test setTargetAtTime with timeConstant=0</title> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> </head> <body> @@ -31,7 +31,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("timeconstant-0", function (taskDone) { + audit.define("timeconstant-0", (task, should) => { var context = new OfflineAudioContext(1, renderFrames, sampleRate); // Simple constant source for testing. @@ -67,22 +67,16 @@ Math.ceil(targetValueInfo[k + 1].frame) : renderFrames; var value = targetValueInfo[k].value; - success = Should( + should(result.slice(startFrame, endFrame), "Output for frame [" + startFrame + ", " + endFrame + - ")", - result.slice(startFrame, endFrame)) - .beConstantValueOf(value) && success; + ")") + .beConstantValueOf(value); } - Should("setTargetAtTime with timeConstant=0", success) - .summarize( - "handled correctly", - "handled incorrectly"); - - }).then(taskDone); + }).then(() => task.done()); }); - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-continuous.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-continuous.html index 4db7725..104909f 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-continuous.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-continuous.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> <title>SetTarget Followed by Linear or Exponential Ramp Is Continuous</title> </head> @@ -27,10 +27,10 @@ // handle various cases where a linear or exponential ramp is scheduled at or after // SetTargetAtTime starts. - audit.defineTask("linear ramp replace", function (done) { + audit.define("linear ramp replace", (task, should) => { // Schedule a linear ramp to start at the same time as SetTargetAtTime. This effectively // replaces the SetTargetAtTime as if it never existed. - runTest("Linear ramp", { + runTest(should, "Linear ramp", { automationFunction: function (audioparam, endValue, endTime) { audioparam.linearRampToValueAtTime(endValue, endTime); }, @@ -38,14 +38,14 @@ automationTime: renderQuantum / sampleRate, thresholdSetTarget: 0, thresholdRamp: 1.26765e-6 - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("delayed linear ramp", function (done) { + audit.define("delayed linear ramp", (task, should) => { // Schedule a linear ramp to start after the SetTargetAtTime has already started rendering. // This is the main test to verify that the linear ramp is continuous with the // SetTargetAtTime curve. - runTest("Delayed linear ramp", { + runTest(should, "Delayed linear ramp", { automationFunction: function (audioparam, endValue, endTime) { audioparam.linearRampToValueAtTime(endValue, endTime); }, @@ -53,12 +53,12 @@ automationTime: 4 * renderQuantum / sampleRate, thresholdSetTarget: 3.43632e-7, thresholdRamp: 1.07972e-6 - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("expo ramp replace", function (done) { + audit.define("expo ramp replace", (task, should) => { // Like "linear ramp replace", but with an exponential ramp instead. - runTest("Exponential ramp", { + runTest(should, "Exponential ramp", { automationFunction: function (audioparam, endValue, endTime) { audioparam.exponentialRampToValueAtTime(endValue, endTime); }, @@ -66,12 +66,12 @@ automationTime: renderQuantum / sampleRate, thresholdSetTarget: 0, thresholdRamp: 1.14441e-5 - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("delayed expo ramp", function (done) { + audit.define("delayed expo ramp", (task, should) => { // Like "delayed linear ramp", but with an exponential ramp instead. - runTest("Delayed exponential ramp", { + runTest(should, "Delayed exponential ramp", { automationFunction: function (audioparam, endValue, endTime) { audioparam.exponentialRampToValueAtTime(endValue, endTime); }, @@ -79,14 +79,10 @@ automationTime: 4 * renderQuantum / sampleRate, thresholdSetTarget: 3.43632e-7, thresholdRamp: 4.29154e-6 - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); function computeExpectedResult(automationTime, timeConstant, endValue, endTime, rampFunction) { // The result is a constant value of 1 for one rendering quantum, then a SetTarget event @@ -150,7 +146,7 @@ // the correct values. // |options.thresholdRamp| // Threshold to use for verifying that the ramp portion had the correct values. - function runTest(prefix, options) { + function runTest(should, prefix, options) { var automationFunction = options.automationFunction; var referenceFunction = options.referenceFunction; var automationTime = options.automationTime; @@ -196,36 +192,37 @@ var length = expected.initialPart.length; // Verify that the initial part of the curve is constant. - success = Should(prefix + ": Initial part", result.slice(0, length)) - .beCloseToArray(expected.initialPart, 0) && success; + should(result.slice(0, length), prefix + ": Initial part") + .beCloseToArray(expected.initialPart); // Verify the SetTarget part of the curve, if the SetTarget did actually run. startIndex += length; length = expected.setTargetPart.length; if (length) { - success = Should(prefix + ": SetTarget part", result.slice(startIndex, startIndex + - length)) - .beCloseToArray(expected.setTargetPart, thresholdSetTarget) && success; + should(result.slice(startIndex, startIndex + length), + prefix + ": SetTarget part") + .beCloseToArray(expected.setTargetPart, { + absoluteThreshold: thresholdSetTarget + }); } else { - Should(prefix + ": SetTarget part", !length) - .summarize("was correctly replaced by the ramp", - "was incorrectly replaced by the ramp"); + should(!length, prefix + ": SetTarget part") + .message("was correctly replaced by the ramp", + "was incorrectly replaced by the ramp"); } // Verify the ramp part of the curve startIndex += length; length = expected.rampPart.length; - success = Should(prefix, result.slice(startIndex, startIndex + length)) - .beCloseToArray(expected.rampPart, thresholdRamp) && success; + should(result.slice(startIndex, startIndex + length), prefix) + .beCloseToArray(expected.rampPart, { + absoluteThreshold: thresholdRamp + }); // Verify that the end of the curve after the ramp (if any) is a constant. startIndex += length; - success = Should(prefix + ": Tail part", result.slice(startIndex)) - .beCloseToArray(expected.tailPart, 0) && success; + should(result.slice(startIndex), prefix + ": Tail part") + .beCloseToArray(expected.tailPart); - Should(prefix, success) - .summarize("preceded by SetTarget is continuous", - "preceded by SetTarget was not continuous"); }); } </script>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html index 58a59e9..2106a7f 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-limit.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> </head> @@ -14,7 +14,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("approach 1", function(done) { + audit.define("approach 1", (task, should) => { var sampleRate = 48000; // A really short time constant so that setTargetAtTime approaches the limiting value well @@ -27,7 +27,7 @@ // (which uses a filter and not the formula.) var limitThreshold = 1e-7; - runTest({ + runTest(should, { sampleRate: sampleRate, v0: 0, v1: 1, @@ -35,10 +35,10 @@ eps: limitThreshold, // Experimentally determined threshold: 2.4e-5 - }).then(done); + }).then(() => task.done()); }) - audit.defineTask("approach 0", function(done) { + audit.define("approach 0", (task, should) => { // Use the equation for setTargetAtTime to figure out when we are close to 0: // // v(t) = exp(-t/tau) @@ -59,7 +59,7 @@ // (which uses a filter and not the formula.) var limitThreshold = 1e-21; - runTest({ + runTest(should, { sampleRate: sampleRate, v0: 1, v1: 0, @@ -67,7 +67,7 @@ eps: limitThreshold, // Experimentally determined threshold: 1.3e-7 - }).then(done); + }).then(() => task.done()); }); function findLimitTime(v0, v1, timeConstant, eps) { @@ -99,7 +99,7 @@ return timeConstant * Math.log(v0/eps); } - function runTest(options) { + function runTest(should, options) { var renderLength = 1; var context = new OfflineAudioContext(1, renderLength * sampleRate, options.sampleRate); @@ -131,26 +131,18 @@ var tailTime = findLimitTime(options.v0, options.v1, options.timeConstant, options.eps); var tailFrame = Math.ceil(tailTime * options.sampleRate); - var success = true; - success = Should("Initial output of " + tailFrame + " samples for " + message, - actual.slice(0, tailFrame), { numberOfArrayLog: 8 }) - .beCloseToArray(expected.slice(0, tailFrame), options.threshold) && success; + should(actual.slice(0, tailFrame), + "Initial output of " + tailFrame + " samples for " + message) + .beCloseToArray(expected.slice(0, tailFrame), { + absoluteThreshold: options.threshold + }); - success = Should("Tail output for " + message, - actual.slice(tailFrame)) - .containValues([options.v1]) && success; - - Should(message, success) - .summarize("had the expected values", - "did not have the expected values"); + should(actual.slice(tailFrame), "Tail output for " + message) + .containValues([options.v1]); }); } - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html index e47052ef..50e000a 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setTargetAtTime-sampling.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> <title>Test Sampling for SetTargetAtTime</title> </head> @@ -26,7 +26,7 @@ // Test sampling of setTargetAtTime that starts at |startFrame|. A gain node is used for // testing. |initializeGainFunction| initializes the gain value. - function doTest(message, startFrame, threshold, initializeGainFunction) { + function doTest(should, message, startFrame, threshold, initializeGainFunction) { var context = new OfflineAudioContext(1, 256, sampleRate); var source = context.createBufferSource(); var b = context.createBuffer(1, 1, sampleRate); @@ -52,7 +52,10 @@ // rendered result is within |threshold| of the expected value. var frame = Math.ceil(startFrame); var v = 10000 * Math.exp(-(frame / sampleRate - startFrame / sampleRate) / timeConstant); - Should(message + ": Target value at frame " + frame, resultData[frame]).beCloseTo(v, threshold); + should(resultData[frame], message + ": Target value at frame " + + frame).beCloseTo(v, { + threshold: threshold + }); }); } @@ -64,37 +67,42 @@ g.gain.setValueAtTime(initialGain, 0); } - audit.defineTask("setValue;128.1", function (done) { - doTest("Initialize by setValueAtTime", 128.1, 3.6029e-8, initializeGainBySetValue).then(done); + audit.define("setValue;128.1", (task, should) => { + doTest(should, "Initialize by setValueAtTime", 128.1, 3.6029e-8, + initializeGainBySetValue) + .then(() => task.done()); }); - audit.defineTask("setValue;0.1", function (done) { - doTest("Initialize by setValueAtTime", 0.1, 3.6029e-8, initializeGainBySetValue).then(done); + audit.define("setValue;0.1", (task, should) => { + doTest(should, "Initialize by setValueAtTime", 0.1, 3.6029e-8, + initializeGainBySetValue) + .then(() => task.done()); }); - audit.defineTask("setValue;0.0", function (done) { - doTest("Initialize by setValueAtTime", 0, 3.6029e-8, initializeGainBySetValue).then(done); + audit.define("setValue;0.0", (task, should) => { + doTest(should, "Initialize by setValueAtTime", 0, 3.6029e-8, + initializeGainBySetValue) + .then(() => task.done()); }); - audit.defineTask("setter;128.1", function (done) { - doTest("Initialize by setter", 128.1, 3.6029e-8, initializeGainBySetter).then(done); + audit.define("setter;128.1", (task, should) => { + doTest(should, "Initialize by setter", 128.1, 3.6029e-8, + initializeGainBySetter) + .then(() => task.done()); }); - audit.defineTask("setter;0.1", function (done) { - doTest("Initialize by setter", 0.1, 3.6029e-8, initializeGainBySetter).then(done); + audit.define("setter;0.1", (task, should) => { + doTest(should, "Initialize by setter", 0.1, 3.6029e-8, + initializeGainBySetter) + .then(() => task.done()); }); - audit.defineTask("setter;0.0", function (done) { - doTest("Initialize by setter", 0, 0, initializeGainBySetter).then(done); + audit.define("setter;0.0", (task, should) => { + doTest(should, "Initialize by setter", 0, 0, initializeGainBySetter) + .then(() => task.done()); }); - - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); - successfullyParsed = true; + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html index 8d148efa..a470df9 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-copy.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/panner-formulas.js"></script> <title>Test setValueCurveAtTime Copies the Curve Data</title> </head> @@ -20,7 +20,7 @@ // Test that changing the curve array to setValueCurveAtTime doesn't // change the automation output. - audit.defineTask("test-copy", function (done) { + audit.define("test-copy", (task, should) => { // Two-channel context; channel 0 is the test result, and channel 1 is // the expected result. var context = new OfflineAudioContext(2, renderFrames, sampleRate); @@ -76,18 +76,11 @@ // The test result and the reference should be identical since // changing the curve data should not affect the automation. - var success = Should("setValueCurve output", testData).beEqualToArray(refData); - - Should("Changing the curve data", success) - .summarize("did not change the result", "unexpectedly changed the result"); - }).then(done); + should(testData, "setValueCurve output").beEqualToArray(refData); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-duration.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-duration.html index 0368e13..83bd567 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-duration.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-duration.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audioparam-testing.js"></script> <title>Test setValueCurveAtTime with Huge Duration</title> </head> @@ -17,7 +17,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("long duration", function (done) { + audit.define("long duration", (task, should) => { // We only need to generate a small number of frames for this test. var context = new OfflineAudioContext(1, renderFrames, sampleRate); var src = context.createBufferSource(); @@ -50,21 +50,12 @@ var message = "setValueCurve([" + curve + "], 0, " + duration + ")"; - success = Should("Max amplitude of " + message, max, { - brief: true - }).beLessThanOrEqualTo(expectedMax); - - Should(message, success) - .summarize("correctly rounded", - "incorrectly rendered with a peak value of " + max); - }).then(done); + should(max, "Max amplitude of " + message) + .beLessThanOrEqualTo(expectedMax); + }).then(() => task.done()); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-end.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-end.html index e1a9684..d36e897 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-end.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-end.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audio-param.js"></script> </head> @@ -63,20 +63,16 @@ // Define tests from the configs for (k in testConfigs) { - audit.defineTask(k + ": " + testConfigs[k].automation, (function (config) { - return function (done) { - runTest(config).then(done); + audit.define(k + ": " + testConfigs[k].automation, (function (config) { + return (task, should) => { + runTest(should, config).then(() => task.done()); }; })(testConfigs[k])); } - audit.defineTask("finish", function (done) { - done(); - }); + audit.run(); - audit.runTasks(); - - function runTest(options) { + function runTest(should, options) { // For the test, use a gain node with a constant input to test the // automations. var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); @@ -136,8 +132,11 @@ message += ", 0.01"; message += ")"; - Should(message + ": value at time " + curveEndFrame / sampleRate, result[curveEndFrame]) - .beCloseTo(expectedResult, options.threshold || 0); + should(result[curveEndFrame], + message + ": value at time " + curveEndFrame / sampleRate) + .beCloseTo(expectedResult, { + threshold: options.threshold || 0 + }); }); }
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions-expected.txt b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions-expected.txt index a8136142..29ee2682 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions-expected.txt +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions-expected.txt
@@ -1,41 +1,48 @@ -CONSOLE WARNING: line 119: Delay.delayTime.setValueCurveAtTime value 5 outside nominal range [0, 1]; value will be clamped. +CONSOLE WARNING: line 129: Delay.delayTime.setValueCurveAtTime value 5 outside nominal range [0, 1]; value will be clamped. This is a testharness.js-based test. -PASS setValueCurveAtTime(curve, 0.0125, 0.0125) did not throw an exception. -PASS setValueAtTime(1, 0.018750000000000003) threw NotSupportedError: Failed to execute 'setValueAtTime' on 'AudioParam': setValueAtTime(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125). -PASS linearRampToValueAtTime(1, 0.018750000000000003) threw NotSupportedError: Failed to execute 'linearRampToValueAtTime' on 'AudioParam': linearRampToValueAtTime(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125). -PASS exponentialRampToValueAtTime(1, 0.018750000000000003) threw NotSupportedError: Failed to execute 'exponentialRampToValueAtTime' on 'AudioParam': exponentialRampToValue(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125). -PASS setTargetAtTime(1, 0.018750000000000003, 1) threw NotSupportedError: Failed to execute 'setTargetAtTime' on 'AudioParam': setTargetAtTime(1, 0.01875, 1) overlaps setValueCurveAtTime(..., 0.0125, 0.0125). -PASS setValueAtTime(1, 0.026250000000000002) did not throw an exception. -PASS Automation functions overlapping an existing setValueCurveAtTime correctly signaled errors. -PASS linearRampToValueAtTime(1, 0.0125) did not throw an exception. -PASS exponentialRampToValueAtTime(1, 0.025) did not throw an exception. -PASS setTargetAtTime(1, 0.037500000000000006, 0.1) did not throw an exception. -PASS setValueCurveAtTime(curve, 0.05, 0.1) did not throw an exception. -PASS setValueCurveAtTime(curve, 0.00625, 0.01) threw NotSupportedError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.00625, 0.01) overlaps linearRampToValueAtTime(1, 0.0125). -PASS setValueCurveAtTime(curve, 0.018750000000000003, 0.01) threw NotSupportedError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.01875, 0.01) overlaps exponentialRampToValue(1, 0.025). -PASS setValueCurveAtTime(curve, 0.03125, 0.01) threw NotSupportedError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.03125, 0.01) overlaps setTargetAtTime(1, 0.03750000000000001, 0.1). -PASS setValueCurveAtTime(curve, 0.043750000000000004, 0.01) threw NotSupportedError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueAtTime(0, 0.05375000000000001) overlaps setValueCurveAtTime(..., 0.05, 0.1). -PASS setValueCurveAtTime([NaN, NaN], 0.043750000000000004, 0.01) threw TypeError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 0 is non-finite: NaN. -PASS setValueCurveAtTime([1, Infinity], 0.043750000000000004, 0.01) threw TypeError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 1 is non-finite: Infinity. -PASS delayTime.setValueCurveAtTime([1, 5], 0.043750000000000004, 0.01) did not throw an exception. -PASS delayTime.setValueCurveAtTime([1, 5, Infinity], 0.043750000000000004, 0.01) threw TypeError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 2 is non-finite: Infinity. -PASS setValueCurveAtTime(curve, 0.031415926535897934, 0.01) threw NotSupportedError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.03141592653589793, 0.01) overlaps setTargetAtTime(1, 0.03750000000000001, 0.1). -PASS setValueCurve overlapping existing automation functions correctly signaled errors. -PASS Handled setValueCurve exception so output contains only the constant 1. -PASS setValueCurveAtTime correctly not inserted into timeline. -PASS setValueAtTime(1, 0) did not throw an exception. -PASS linearRampToValueAtTime(0, 0.0025) did not throw an exception. -PASS setValueCurveAtTime(..., 0.0025, 0.0025) did not throw an exception. -PASS exponentialRampToValueAtTime(1, 0.0075) did not throw an exception. -PASS setValueCurveAtTime(..., 0.0075, 0.0025) did not throw an exception. -PASS setValueCurveAtTime(..., 0.01, 0.0025) did not throw an exception. -PASS setValueAtTime(0, 0.0125) did not throw an exception. -PASS setValueCurveAtTime(..., 0.0125, 0.0025) did not throw an exception. -PASS setTargetAtTime(1, 0.015000000000000001, 1) did not throw an exception. -PASS setValueCurve with adjoining automation functions allowed as expected. -PASS setValueCurveAtTime([], 0, 0.01) threw InvalidStateError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': The curve length provided (0) is less than the minimum bound (2).. -PASS setValueCurveAtTime([1], 0, 0.01) threw InvalidStateError: Failed to execute 'setValueCurveAtTime' on 'AudioParam': The curve length provided (1) is less than the minimum bound (2).. -PASS setValueCurveAtTime([1,2], 0, 0.01) did not throw an exception. -PASS Exceptions for curve length correctly handled. +PASS # AUDIT TASK RUNNER STARTED. +PASS > [setValueCurve] +PASS setValueCurveAtTime(curve, 0.0125, 0.0125) did not throw an exception. +PASS setValueAtTime(1, 0.018750000000000003) threw NotSupportedError: "Failed to execute 'setValueAtTime' on 'AudioParam': setValueAtTime(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125)". +PASS linearRampToValueAtTime(1, 0.018750000000000003) threw NotSupportedError: "Failed to execute 'linearRampToValueAtTime' on 'AudioParam': linearRampToValueAtTime(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125)". +PASS exponentialRampToValueAtTime(1, 0.018750000000000003) threw NotSupportedError: "Failed to execute 'exponentialRampToValueAtTime' on 'AudioParam': exponentialRampToValue(1, 0.01875) overlaps setValueCurveAtTime(..., 0.0125, 0.0125)". +PASS setTargetAtTime(1, 0.018750000000000003, 1) threw NotSupportedError: "Failed to execute 'setTargetAtTime' on 'AudioParam': setTargetAtTime(1, 0.01875, 1) overlaps setValueCurveAtTime(..., 0.0125, 0.0125)". +PASS setValueAtTime(1, 0.026250000000000002) did not throw an exception. +PASS < [setValueCurve] All assertions passed. (total 6 assertions) +PASS > [automations] +PASS linearRampToValueAtTime(1, 0.0125) did not throw an exception. +PASS exponentialRampToValueAtTime(1, 0.025) did not throw an exception. +PASS setTargetAtTime(1, 0.037500000000000006, 0.1) did not throw an exception. +PASS setValueCurveAtTime(curve, 0.05, 0.1) did not throw an exception. +PASS setValueCurveAtTime(curve, 0.00625, 0.01) threw NotSupportedError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.00625, 0.01) overlaps linearRampToValueAtTime(1, 0.0125)". +PASS setValueCurveAtTime(curve, 0.018750000000000003, 0.01) threw NotSupportedError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.01875, 0.01) overlaps exponentialRampToValue(1, 0.025)". +PASS setValueCurveAtTime(curve, 0.03125, 0.01) threw NotSupportedError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.03125, 0.01) overlaps setTargetAtTime(1, 0.03750000000000001, 0.1)". +PASS setValueCurveAtTime(curve, 0.043750000000000004, 0.01) threw NotSupportedError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueAtTime(0, 0.05375000000000001) overlaps setValueCurveAtTime(..., 0.05, 0.1)". +PASS setValueCurveAtTime([NaN, NaN], 0.043750000000000004, 0.01) threw TypeError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 0 is non-finite: NaN". +PASS setValueCurveAtTime([1, Infinity], 0.043750000000000004, 0.01) threw TypeError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 1 is non-finite: Infinity". +PASS delayTime.setValueCurveAtTime([1, 5], 0.043750000000000004, 0.01) did not throw an exception. +PASS delayTime.setValueCurveAtTime([1, 5, Infinity], 0.043750000000000004, 0.01) threw TypeError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': The provided float value for the curve at element 2 is non-finite: Infinity". +PASS setValueCurveAtTime(curve, 0.031415926535897934, 0.01) threw NotSupportedError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': setValueCurveAtTime(..., 0.03141592653589793, 0.01) overlaps setTargetAtTime(1, 0.03750000000000001, 0.1)". +PASS < [automations] All assertions passed. (total 13 assertions) +PASS > [catch-exception] +PASS Handled setValueCurve exception so output contains only the constant 1. +PASS < [catch-exception] All assertions passed. (total 1 assertions) +PASS > [start-end] +PASS setValueAtTime(1, 0) did not throw an exception. +PASS linearRampToValueAtTime(0, 0.0025) did not throw an exception. +PASS setValueCurveAtTime(..., 0.0025, 0.0025) did not throw an exception. +PASS exponentialRampToValueAtTime(1, 0.0075) did not throw an exception. +PASS setValueCurveAtTime(..., 0.0075, 0.0025) did not throw an exception. +PASS setValueCurveAtTime(..., 0.01, 0.0025) did not throw an exception. +PASS setValueAtTime(0, 0.0125) did not throw an exception. +PASS setValueCurveAtTime(..., 0.0125, 0.0025) did not throw an exception. +PASS setTargetAtTime(1, 0.015000000000000001, 1) did not throw an exception. +PASS < [start-end] All assertions passed. (total 9 assertions) +PASS > [curve lengths] +PASS setValueCurveAtTime([], 0, 0.01) threw InvalidStateError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': The curve length provided (0) is less than the minimum bound (2).". +PASS setValueCurveAtTime([1], 0, 0.01) threw InvalidStateError: "Failed to execute 'setValueCurveAtTime' on 'AudioParam': The curve length provided (1) is less than the minimum bound (2).". +PASS setValueCurveAtTime([1,2], 0, 0.01) did not throw an exception. +PASS < [curve lengths] All assertions passed. (total 3 assertions) +PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully. Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions.html index de7aa0cd..e9c8b10 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurve-exceptions.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> </head> <body> @@ -18,7 +18,7 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("setValueCurve", function(done) { + audit.define("setValueCurve", (task, should) => { var success = true; var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); var g = context.createGain(); @@ -31,40 +31,42 @@ // Some time that is known to during the setValueCurveTime interval. var automationTime = curveStartTime + duration / 2; - success = Should("setValueCurveAtTime(curve, " + curveStartTime + ", " + duration + ")", function() { - g.gain.setValueCurveAtTime(curve, curveStartTime, duration); - }).notThrow() && success; + should(() => { + g.gain.setValueCurveAtTime(curve, curveStartTime, duration); + }, + "setValueCurveAtTime(curve, " + curveStartTime + ", " + duration + + ")") + .notThrow(); - success = Should("setValueAtTime(1, " + automationTime + ")", function() { + should(function() { g.gain.setValueAtTime(1, automationTime); - }).throw("NotSupportedError") && success; + }, "setValueAtTime(1, " + automationTime + ")") + .throw("NotSupportedError"); - success = Should("linearRampToValueAtTime(1, " + automationTime + ")", function() { + should(function() { g.gain.linearRampToValueAtTime(1, automationTime); - }).throw("NotSupportedError") && success; + }, "linearRampToValueAtTime(1, " + automationTime + ")") + .throw("NotSupportedError"); - success = Should("exponentialRampToValueAtTime(1, " + automationTime + ")", function() { + should(function() { g.gain.exponentialRampToValueAtTime(1, automationTime); - }).throw("NotSupportedError") && success; + }, "exponentialRampToValueAtTime(1, " + automationTime + ")") + .throw("NotSupportedError"); - success = Should("setTargetAtTime(1, " + automationTime + ", 1)", function() { + should(function() { g.gain.setTargetAtTime(1, automationTime, 1); - }).throw("NotSupportedError") && success; + }, "setTargetAtTime(1, " + automationTime + ", 1)") + .throw("NotSupportedError"); - success = Should("setValueAtTime(1, " + (curveStartTime + 1.1 * duration) + ")", function() { + should(function() { g.gain.setValueAtTime(1, curveStartTime + 1.1 * duration); - }).notThrow() && success; + }, "setValueAtTime(1, " + (curveStartTime + 1.1 * duration) + ")") + .notThrow(); - var prefix = "Automation functions overlapping an existing setValueCurveAtTime"; - Should(prefix, success) - .summarize(" correctly signaled errors", - " failed to signal errors"); - - done(); + task.done(); }); - audit.defineTask("automations", function (done) { - var success = true; + audit.define("automations", (task, should) => { var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); var g = context.createGain(); @@ -74,71 +76,80 @@ var timeInterval = testDurationSec / 10; startTime += timeInterval; - success = Should("linearRampToValueAtTime(1, " + startTime + ")", function () { + should(() => { g.gain.linearRampToValueAtTime(1, startTime); - }).notThrow() && success; + }, "linearRampToValueAtTime(1, " + startTime + ")").notThrow(); startTime += timeInterval; - success = Should("exponentialRampToValueAtTime(1, " + startTime + ")", function () { + should(() => { g.gain.exponentialRampToValueAtTime(1, startTime); - }).notThrow() && success; + }, "exponentialRampToValueAtTime(1, " + startTime + ")").notThrow(); startTime += timeInterval; - success = Should("setTargetAtTime(1, " + startTime + ", 0.1)", function () { + should(() => { g.gain.setTargetAtTime(1, startTime, 0.1); - }).notThrow() && success; + }, "setTargetAtTime(1, " + startTime + ", 0.1)").notThrow(); startTime += timeInterval; - success = Should("setValueCurveAtTime(curve, " + startTime + ", 0.1)", function () { + should(() => { g.gain.setValueCurveAtTime(curve, startTime, 0.1); - }).notThrow() && success; + }, "setValueCurveAtTime(curve, " + startTime + ", 0.1)").notThrow(); // Now try to setValueCurve that overlaps each of the above automations startTime = timeInterval / 2; for (var k = 0; k < 4; ++k) { var time = startTime + timeInterval * k; - success = Should("setValueCurveAtTime(curve, " + time + ", 0.01)", function () { - g.gain.setValueCurveAtTime(curve, time, 0.01); - }).throw("NotSupportedError") && success; + should(() => { + g.gain.setValueCurveAtTime(curve, time, 0.01); + }, + "setValueCurveAtTime(curve, " + time + ", 0.01)") + .throw("NotSupportedError"); } // Elements of setValueCurve should be finite. - success = Should("setValueCurveAtTime([NaN, NaN], " + time + ", 0.01)", function () { - g.gain.setValueCurveAtTime(Float32Array.from([NaN, NaN]), time, 0.01); - }).throw("TypeError") && success; + should(() => { + g.gain.setValueCurveAtTime(Float32Array.from([NaN, NaN]), time, + 0.01); + }, + "setValueCurveAtTime([NaN, NaN], " + time + ", 0.01)") + .throw("TypeError"); - success = Should("setValueCurveAtTime([1, Infinity], " + time + ", 0.01)", function () { - g.gain.setValueCurveAtTime(Float32Array.from([1, Infinity]), time, 0.01); - }).throw("TypeError") && success; + should(() => { + g.gain.setValueCurveAtTime(Float32Array.from([1, Infinity]), time, + 0.01); + }, + "setValueCurveAtTime([1, Infinity], " + time + ", 0.01)") + .throw("TypeError"); var d = context.createDelay(); // Check that we get warnings for out-of-range values and also throw for // non-finite values. - success = Should("delayTime.setValueCurveAtTime([1, 5], " + time + ", 0.01)", function() { - d.delayTime.setValueCurveAtTime(Float32Array.from([1, 5]), time, 0.01); - }).notThrow() && success; + should(() => { + d.delayTime.setValueCurveAtTime(Float32Array.from([1, 5]), time, + 0.01); + }, + "delayTime.setValueCurveAtTime([1, 5], " + time + ", 0.01)") + .notThrow(); - success = Should("delayTime.setValueCurveAtTime([1, 5, Infinity], " + time + ", 0.01)", - function() { - d.delayTime.setValueCurveAtTime(Float32Array.from([1, 5, Infinity]), time, 0.01); - }).throw("TypeError") && success; + should(() => { + d.delayTime.setValueCurveAtTime(Float32Array.from([1, 5, Infinity]), + time, 0.01); + }, + "delayTime.setValueCurveAtTime([1, 5, Infinity], " + time + + ", 0.01)") + .throw("TypeError"); // One last test that prints out lots of digits for the time. var time = Math.PI / 100; - success = Should("setValueCurveAtTime(curve, " + time + ", 0.01)", function () { + should(() => { g.gain.setValueCurveAtTime(curve, time, 0.01); - }).throw("NotSupportedError") && success; + }, "setValueCurveAtTime(curve, " + time + ", 0.01)").throw("NotSupportedError"); - var prefix = "setValueCurve overlapping existing automation functions"; - Should(prefix, success) - .summarize(" correctly signaled errors", - " failed to signal errors"); - - done(); + task.done(); }); - audit.defineTask("catch-exception", function (done) { + audit.define("catch-exception", (task, should) => { // Verify that the curve isn't inserted into the time line even if we catch the exception. var success = true; var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); @@ -164,17 +175,14 @@ context.startRendering().then(function (resultBuffer) { // Since the setValueCurve wasn't inserted, the output should be exactly 1 for the entire // duration. - var success = Should("Handled setValueCurve exception so output", resultBuffer.getChannelData(0)) + should(resultBuffer.getChannelData(0), + "Handled setValueCurve exception so output") .beConstantValueOf(1); - Should("setValueCurveAtTime", success) - .summarize("correctly not inserted into timeline", - "incorrectly still inserted into timeline"); - }).then(done); + }).then(() => task.done()); }); - audit.defineTask("start-end", function (done) { - var success = true; + audit.define("start-end", (task, should) => { var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); var g = context.createGain(); var curve = new Float32Array(2); @@ -182,94 +190,91 @@ // Verify that a setValueCurve can start at the end of an automation. var time = 0; var timeInterval = testDurationSec / 50; - success = Should("setValueAtTime(1, " + time + ")", function () { + should(() => { g.gain.setValueAtTime(1, time); - }).notThrow(); + }, "setValueAtTime(1, " + time + ")").notThrow(); time += timeInterval; - success = Should("linearRampToValueAtTime(0, " + time + ")", function () { + should(() => { g.gain.linearRampToValueAtTime(0, time); - }).notThrow() && success; + }, "linearRampToValueAtTime(0, " + time + ")").notThrow(); // setValueCurve starts at the end of the linear ramp. This should be fine. - success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterval + ")", function () { - g.gain.setValueCurveAtTime(curve, time, timeInterval); - }).notThrow() && success; + should(() => { + g.gain.setValueCurveAtTime(curve, time, timeInterval); + }, + "setValueCurveAtTime(..., " + time + ", " + timeInterval + ")") + .notThrow(); // exponentialRamp ending one interval past the setValueCurve should be fine. time += 2*timeInterval; - success = Should("exponentialRampToValueAtTime(1, " + time + ")", function () { + should(() => { g.gain.exponentialRampToValueAtTime(1, time); - }).notThrow() && success; + }, "exponentialRampToValueAtTime(1, " + time + ")").notThrow(); // setValueCurve starts at the end of the exponential ramp. This should be fine. - success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterval + ")", function () { - g.gain.setValueCurveAtTime(curve, time, timeInterval); - }).notThrow() && success; + should(() => { + g.gain.setValueCurveAtTime(curve, time, timeInterval); + }, + "setValueCurveAtTime(..., " + time + ", " + timeInterval + ")") + .notThrow(); // setValueCurve at the end of the setValueCurve should be fine. time += timeInterval; - success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterval + ")", function () { - g.gain.setValueCurveAtTime(curve, time, timeInterval); - }).notThrow() && success; + should(() => { + g.gain.setValueCurveAtTime(curve, time, timeInterval); + }, + "setValueCurveAtTime(..., " + time + ", " + timeInterval + ")") + .notThrow(); // setValueAtTime at the end of setValueCurve should be fine. time += timeInterval; - success = Should("setValueAtTime(0, " + time + ")", function () { + should(() => { g.gain.setValueAtTime(0, time); - }).notThrow() && success; + }, "setValueAtTime(0, " + time + ")").notThrow(); // setValueCurve at the end of setValueAtTime should be fine. - success = Should("setValueCurveAtTime(..., " + time + ", " + timeInterval + ")", function () { - g.gain.setValueCurveAtTime(curve, time, timeInterval); - }).notThrow() && success; + should(() => { + g.gain.setValueCurveAtTime(curve, time, timeInterval); + }, + "setValueCurveAtTime(..., " + time + ", " + timeInterval + ")") + .notThrow(); // setTarget starting at the end of setValueCurve should be fine. time += timeInterval; - success = Should("setTargetAtTime(1, " + time + ", 1)", function () { + should(() => { g.gain.setTargetAtTime(1, time, 1); - }).notThrow() && success; + }, "setTargetAtTime(1, " + time + ", 1)").notThrow(); - var prefix = "setValueCurve with adjoining automation functions"; - Should(prefix, success) - .summarize("allowed as expected", - "unexpectedly signaled errors"); - - done(); + task.done(); }); - audit.defineTask("curve lengths", function (done) { - var success = true; + audit.define("curve lengths", (task, should) => { var context = new OfflineAudioContext(1, testDurationFrames, sampleRate); var g = context.createGain(); var time = 0; // Check for invalid curve lengths - success = Should("setValueCurveAtTime([], " + time + ", 0.01)", function () { - g.gain.setValueCurveAtTime(Float32Array.from([]), time, 0.01); - }).throw("InvalidStateError") && success; + should(() => { + g.gain.setValueCurveAtTime(Float32Array.from([]), time, 0.01); + }, + "setValueCurveAtTime([], " + time + ", 0.01)") + .throw("InvalidStateError"); - success = Should("setValueCurveAtTime([1], " + time + ", 0.01)", function () { - g.gain.setValueCurveAtTime(Float32Array.from([1]), time, 0.01); - }).throw("InvalidStateError") && success; + should(() => { + g.gain.setValueCurveAtTime(Float32Array.from([1]), time, 0.01); + }, + "setValueCurveAtTime([1], " + time + ", 0.01)") + .throw("InvalidStateError"); - success = Should("setValueCurveAtTime([1,2], " + time + ", 0.01)", function () { + should(() => { g.gain.setValueCurveAtTime(Float32Array.from([1,2]), time, 0.01); - }).notThrow() && success; + }, "setValueCurveAtTime([1,2], " + time + ", 0.01)").notThrow(); - Should("Exceptions for curve length", success) - .summarize("correctly handled", - "not correctly handled"); - - done(); + task.done(); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); - successfullyParsed = true; + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurveAtTime-interpolation.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurveAtTime-interpolation.html index a86a096b4..7b80a388 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurveAtTime-interpolation.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-setValueCurveAtTime-interpolation.html
@@ -5,7 +5,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <title>Test Interpolation for AudioParam.setValueCurveAtTime</title> </head> @@ -112,8 +112,8 @@ // Creates a function based on the test config that is suitable for use by defineTask(). function createTaskFunction(config) { - return function (done) { - runTest(config).then(done); + return function (task, should) { + runTest(should, config).then(() => task.done()); }; } @@ -121,12 +121,12 @@ for (var k = 0; k < testConfigs.length; ++k) { var config = testConfigs[k]; var name = k + ":curve=" + config.curveLength + ",duration=" + (config.curveDuration * sampleRate); - audit.defineTask(name, createTaskFunction(config)); + audit.define(name, createTaskFunction(config)); } // Simple test from crbug.com/441471. Makes sure the end points and the middle point are // interpolated correctly. - audit.defineTask("crbug-441471", function (done) { + audit.define("crbug-441471", (task, should) => { // Any sample rate should work; we pick something small such that the time end points are on // a sampling point. var context = new OfflineAudioContext(1, 5000, 5000) @@ -157,27 +157,22 @@ var data = renderedBuffer.getChannelData(0); var endTime = startTime + duration; var midPoint = (startTime + endTime) / 2; - var success = true; - success = Should("Curve value at time " + startTime, - data[timeToSampleFrame(startTime, context.sampleRate)]).beEqualTo(c[0]) && success; + should(data[timeToSampleFrame(startTime, context.sampleRate)], + "Curve value at time " + startTime) + .beEqualTo(c[0]); // Due to round-off, the value at the midpoint is not exactly zero on arm64. See // crbug.com/558563. The current value is experimentally determined. - success = Should("Curve value at time " + midPoint, - data[timeToSampleFrame(midPoint, context.sampleRate)]).beCloseTo(0, Math.pow(2, -51)) && success; - success = Should("Curve value at time " + endTime, - data[timeToSampleFrame(endTime, context.sampleRate)]).beEqualTo(c[2]) && success; - Should("Test: crbug.com/44471", success) - .summarize("passed", "failed"); - }).then(done); + should(data[timeToSampleFrame(midPoint, context.sampleRate)], + "Curve value at time " + midPoint) + .beCloseTo(0, {threshold: Math.pow(2, -51)}); + should(data[timeToSampleFrame(endTime, context.sampleRate)], + "Curve value at time " + endTime) + .beEqualTo(c[2]); + }).then(() => task.done()); }); - // Must be the last defined task. - audit.defineTask("end", function (done) { - done(); - }); - - function runTest(config) { + function runTest(should, config) { context = new OfflineAudioContext(1, testDurationFrames, sampleRate); // A constant audio source of value 1. @@ -206,23 +201,21 @@ // Some consistency checks on the test parameters let prefix = "Length " + config.curveLength + ", duration " + config.curveDuration; - Should(prefix + ": Check: Curve end time", config.curveStartTime + config.curveDuration, { - brief: true - }) + should(config.curveStartTime + config.curveDuration, + prefix + ": Check: Curve end time") .beLessThanOrEqualTo(testDurationSec); - Should(prefix + ": Check: Full gain start time", config.fullGainTime, { - brief: true - }).beLessThanOrEqualTo(testDurationSec); - Should(prefix + ": Check: Full gain start time", config.fullGainTime, { - brief: true - }).beGreaterThanOrEqualTo(config.curveStartTime + config.curveDuration); + should(config.fullGainTime, prefix + ": Check: Full gain start time") + .beLessThanOrEqualTo(testDurationSec); + should(config.fullGainTime, + prefix + ": Check: Full gain start time") + .beGreaterThanOrEqualTo(config.curveStartTime + config.curveDuration); // Rock and roll! - return context.startRendering().then(checkResult(config)); + return context.startRendering().then(checkResult(should, config)); } // Return a function to check that the rendered result matches the expected result. - function checkResult(config) { + function checkResult(should, config) { return function (renderedBuffer) { var success = true; @@ -243,19 +236,11 @@ } let prefix = "Curve length " + config.curveLength + ", duration " + config.curveDuration; - success = success && Should(prefix + ": SNR", SNR, { - brief: true - }).beGreaterThanOrEqualTo(config.snrThreshold); + should(SNR, prefix + ": SNR") + .beGreaterThanOrEqualTo(config.snrThreshold); - success = Should(prefix + ": Max difference", maxDiff) - .beLessThanOrEqualTo(config.maxErrorThreshold) && success; - - var message = "Test: curve length = " + config.curveLength + - "; duration frames = " + - config.curveDuration * sampleRate; - - Should(message, success) - .summarize("passed", "failed"); + should(maxDiff, prefix + ": Max difference") + .beLessThanOrEqualTo(config.maxErrorThreshold); } } @@ -294,9 +279,7 @@ return expected; } - audit.runTasks(); - - successfullyParsed = true; + audit.run(); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-update-value-attribute.html b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-update-value-attribute.html index d5289bb..e5d83d4 100644 --- a/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-update-value-attribute.html +++ b/third_party/WebKit/LayoutTests/webaudio/AudioParam/audioparam-update-value-attribute.html
@@ -4,7 +4,7 @@ <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="../resources/audit-util.js"></script> - <script src="../resources/audio-testing.js"></script> + <script src="../resources/audit.js"></script> <script src="../resources/audio-param.js"></script> <title>Updating of Value Attribute from Timeline</title> </head> @@ -22,9 +22,9 @@ var audit = Audit.createTaskRunner(); - audit.defineTask("linear", function (done) { + audit.define("linear", (task, should) => { // Test the value attribute from a linearRamp event - runTest(function (g, v0, t0, v1, t1) { + runTest(should, function (g, v0, t0, v1, t1) { g.gain.linearRampToValueAtTime(v1, t1); return { expectedValue: function (testTime) { @@ -36,9 +36,9 @@ }).then(done); }); - audit.defineTask("exponential", function (done) { + audit.define("exponential", (task, should) => { // Test the value attribute from an exponentialRamp event - runTest(function (g, v0, t0, v1, t1) { + runTest(should, function (g, v0, t0, v1, t1) { g.gain.exponentialRampToValueAtTime(v1, t1); return { expectedValue: function (testTime) { @@ -50,9 +50,9 @@ }).then(done); }); - audit.defineTask("setTarget", function (done) { + audit.define("setTarget", (task, should) => { // Test the value attribute from a setTargetAtTime event - runTest(function (g, v0, t0, v1, t1) { + runTest(should, function (g, v0, t0, v1, t1) { var timeConstant = 0.1; var vFinal = 0; g.gain.setTargetAtTime(vFinal, t0, timeConstant); @@ -66,9 +66,9 @@ }).then(done); }); - audit.defineTask("setValueCurve", function (done) { + audit.define("setValueCurve", (task, should) => { // Test the value attribute from a setValueCurve event - runTest(function (g, v0, t0, v1, t1) { + runTest(should, function (g, v0, t0, v1, t1) { var curve = [1, 1.5, 4]; var duration = t1 - t0; g.gain.setValueCurveAtTime(Float32Array.from(curve), t0, duration); @@ -82,15 +82,11 @@ }).then(done); }); - audit.defineTask("finish", function (done) { - done(); - }); - - audit.runTasks(); + audit.run(); // Test that the .value getter has the correct value when a timeline is running. // The |testFunction| is the underlying test to be run. - function runTest(testFunction) { + function runTest(should, testFunction) { // Create a simple graph consisting of a constant source and a gain node where the // automations are run. A setValueAtTime event starts things off. var context = new OfflineAudioContext(1, renderFrames, sampleRate); @@ -123,9 +119,9 @@ // Print an informative message about the test being run. //testPassed("Initialize " + test.message + " with setValueAtTime(" + v0 + ", " + t0 + ")."); - Should("Initialize", true) - .summarize(test.message + " with setValueAtTime(" + v0 + ", " + t0 + ")", - ""); + should(true, "Initialize") + .message(test.message + " with setValueAtTime(" + v0 + ", " + t0 + ")", + ""); var success = true; @@ -148,11 +144,8 @@ var relError = Math.abs(expected - gain.gain.value) / Math.abs(expected); maxError = Math.max(relError, maxError); - success = Should(test.message + " at frame " + (sampleRate * sampleTime), - gain.gain.value, { - precision: 7 - }) - .beCloseTo(expected, test.errorThreshold || 0) && success; + success = should(gain.gain.value, test.message + " at frame " + (sampleRate * sampleTime)) + .beCloseTo(expected, {threshold: test.errorThreshold || 0}); }).then(context.resume.bind(context)); } @@ -160,9 +153,9 @@ return context.startRendering().then(function (resultBuffer) { // Just print a final pass (or fail) message. - Should("Gain .value attribute for " + test.message, success) - .summarize("correctly updated during automation", - "not correctly updated during automation; max error = " + maxError); + should(success, "Gain .value attribute for " + test.message) + .message("correctly updated during automation", + "not correctly updated during automation; max error = " + maxError); }); } </script>
diff --git a/third_party/WebKit/Source/build/scripts/make_instrumenting_probes.py b/third_party/WebKit/Source/build/scripts/make_instrumenting_probes.py index ce1a23f..0b7105a 100644 --- a/third_party/WebKit/Source/build/scripts/make_instrumenting_probes.py +++ b/third_party/WebKit/Source/build/scripts/make_instrumenting_probes.py
@@ -124,20 +124,14 @@ sys.stderr.write("Cannot parse %s\n" % source) sys.exit(1) - self.return_type = match.group(1) or "" self.name = match.group(2) - self.is_scoped = self.return_type == "" + self.is_scoped = not match.group(1) + if not self.is_scoped and match.group(1) != "void": + raise Exception("Instant probe must return void: %s" % self.name) # Splitting parameters by a comma, assuming that attribute lists contain no more than one attribute. self.params = map(Parameter, map(str.strip, match.group(3).split(","))) - self.returns_value = self.return_type != "" and self.return_type != "void" - if self.return_type == "bool": - self.default_return_value = "false" - elif self.returns_value: - sys.stderr.write("Can only return bool: %s\n" % self.name) - sys.exit(1) - class Parameter(object): def __init__(self, source): @@ -213,8 +207,6 @@ for f in files: for probe in f.declarations: probe.agents = observers_by_probe[probe.name] - if probe.returns_value and len(probe.agents) > 1: - raise Exception("Can only return value from a single observer: %s\n" % probe.name) return all_observers
diff --git a/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl index d6f15e9f..4db548ba 100644 --- a/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl
@@ -53,23 +53,19 @@ {% set agent_probe_name = common_name or probe.name %} {{sink_class}}* sink = to{{sink_class}}({{probe.params[0].name}}); if (!sink) - return {{probe.default_return_value}}; + return; {% for param in probe.params %} {% if param.is_prp %} RefPtr<{{param.inner_type}}> {{param.value}} = {{param.name}}; {% endif %} {% endfor %} -{% set maybe_return = "return " if probe.returns_value else "" %} {% for agent in probe.agents %} {% set class_name = agent | agent_name_to_class %} if (sink->has{{class_name}}s()) { for ({{class_name}}* agent : sink->{{ class_name | to_lower_case }}s()) - {{maybe_return}}agent->{{agent_probe_name}}({{caller()}}); + agent->{{agent_probe_name}}({{caller()}}); } {% endfor %} -{% if probe.default_return_value %} - return {{probe.default_return_value}}; -{% endif %} {% endmacro -%} {% for file in files %} @@ -90,7 +86,7 @@ {% else -%} -CORE_EXPORT {{probe.return_type}} {{probe.name}}({{ params_list(probe) }}) { +CORE_EXPORT void {{probe.name}}({{ params_list(probe) }}) { {% call probe_body(probe, "") %} {%- for param in probe.params %} {%- if not loop.first or "Keep" in param.options -%}
diff --git a/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesInl.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesInl.h.tmpl index f66470c..a66e7f5a 100644 --- a/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesInl.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesInl.h.tmpl
@@ -46,7 +46,7 @@ }; {%- else %} -{{export_symbol}} {{probe.return_type}} {{probe.name}}({{ params_decl(probe) }}); +{{export_symbol}} void {{probe.name}}({{ params_decl(probe) }}); {%- endif %} {%- endfor %}
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index c0da4e0f..056a31d 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -2031,6 +2031,19 @@ return nullptr; } +static bool widthOrHeightPropertyAppliesToObject(const LayoutObject& object) { + // According to + // http://www.w3.org/TR/CSS2/visudet.html#the-width-property and + // http://www.w3.org/TR/CSS2/visudet.html#the-height-property, the "width" or + // "height" property does not apply to non-atomic inline elements. + if (!object.isAtomicInlineLevel() && object.isInline()) + return false; + + // Non-root SVG should be treated as non-atomic inline no matter how we + // implement it internally (e.g. LayoutSVGBlock is based on LayoutBlockFlow). + return !object.isSVGChild(); +} + const CSSValue* ComputedStyleCSSValueMapping::get( CSSPropertyID propertyID, const ComputedStyle& style, @@ -2526,10 +2539,7 @@ case CSSPropertyHeight: if (layoutObject) { - // According to - // http://www.w3.org/TR/CSS2/visudet.html#the-height-property, the - // "height" property does not apply for non-atomic inline elements. - if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) + if (!widthOrHeightPropertyAppliesToObject(*layoutObject)) return CSSIdentifierValue::create(CSSValueAuto); return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), style); } @@ -2887,10 +2897,7 @@ CSSPrimitiveValue::UnitType::Number); case CSSPropertyWidth: if (layoutObject) { - // According to - // http://www.w3.org/TR/CSS2/visudet.html#the-width-property, - // the "width" property does not apply for non-atomic inline elements. - if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) + if (!widthOrHeightPropertyAppliesToObject(*layoutObject)) return CSSIdentifierValue::create(CSSValueAuto); return zoomAdjustedPixelValue(sizingBox(layoutObject).width(), style); }
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp index 4483a8e..5f493e74 100644 --- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp +++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -727,6 +727,7 @@ MatchResult& result) const { Element& element = *context.element; const CSSSelector& selector = *context.selector; + bool forcePseudoState = false; if (context.hasScrollbarPseudo) { // CSS scrollbars match a specific subset of pseudo classes, and they have @@ -921,7 +922,9 @@ } if (!shouldMatchHoverOrActive(context)) return false; - if (probe::forcePseudoState(&element, CSSSelector::PseudoHover)) + probe::forcePseudoState(&element, CSSSelector::PseudoHover, + &forcePseudoState); + if (forcePseudoState) return true; return element.isHovered(); case CSSSelector::PseudoActive: @@ -937,7 +940,9 @@ } if (!shouldMatchHoverOrActive(context)) return false; - if (probe::forcePseudoState(&element, CSSSelector::PseudoActive)) + probe::forcePseudoState(&element, CSSSelector::PseudoActive, + &forcePseudoState); + if (forcePseudoState) return true; return element.isActive(); case CSSSelector::PseudoEnabled: @@ -1319,8 +1324,10 @@ } bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { - if (probe::forcePseudoState(const_cast<Element*>(&element), - CSSSelector::PseudoFocus)) + bool forcePseudoState = false; + probe::forcePseudoState(const_cast<Element*>(&element), + CSSSelector::PseudoFocus, &forcePseudoState); + if (forcePseudoState) return true; return element.isFocused() && isFrameFocused(element); }
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index 8367155..8f72767 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -707,8 +707,9 @@ state.style()->setIsLink(); EInsideLink linkState = state.elementLinkState(); if (linkState != EInsideLink::kNotInsideLink) { - bool forceVisited = - probe::forcePseudoState(element, CSSSelector::PseudoVisited); + bool forceVisited = false; + probe::forcePseudoState(element, CSSSelector::PseudoVisited, + &forceVisited); if (forceVisited) linkState = EInsideLink::kInsideVisitedLink; }
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.h b/third_party/WebKit/Source/core/dom/ContainerNode.h index a0868296..bf10ddd5d 100644 --- a/third_party/WebKit/Source/core/dom/ContainerNode.h +++ b/third_party/WebKit/Source/core/dom/ContainerNode.h
@@ -101,7 +101,7 @@ Element* querySelector(const AtomicString& selectors, ExceptionState& = ASSERT_NO_EXCEPTION); StaticElementList* querySelectorAll(const AtomicString& selectors, - ExceptionState&); + ExceptionState& = ASSERT_NO_EXCEPTION); Node* insertBefore(Node* newChild, Node* refChild,
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp index 9576ad6c..d0c4c067 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
@@ -45,6 +45,27 @@ using namespace HTMLNames; +#if DCHECK_IS_ON() +static SelectorQuery::QueryStats& currentQueryStats() { + DEFINE_STATIC_LOCAL(SelectorQuery::QueryStats, stats, ()); + return stats; +} + +SelectorQuery::QueryStats SelectorQuery::lastQueryStats() { + return currentQueryStats(); +} + +#define QUERY_STATS_INCREMENT(name) \ + (void)(currentQueryStats().totalCount++, currentQueryStats().name++); +#define QUERY_STATS_RESET() (void)(currentQueryStats() = {}); + +#else + +#define QUERY_STATS_INCREMENT(name) +#define QUERY_STATS_RESET() + +#endif + struct SingleElementSelectorQueryTrait { typedef Element* OutputType; static const bool shouldOnlyMatchFirstElement = true; @@ -84,12 +105,14 @@ } bool SelectorQuery::matches(Element& targetElement) const { + QUERY_STATS_RESET(); if (m_needsUpdatedDistribution) targetElement.updateDistribution(); return selectorListMatches(targetElement, targetElement); } Element* SelectorQuery::closest(Element& targetElement) const { + QUERY_STATS_RESET(); if (m_selectors.isEmpty()) return nullptr; if (m_needsUpdatedDistribution) @@ -104,6 +127,7 @@ } StaticElementList* SelectorQuery::queryAll(ContainerNode& rootNode) const { + QUERY_STATS_RESET(); NthIndexCache nthIndexCache(rootNode.document()); HeapVector<Member<Element>> result; execute<AllElementsSelectorQueryTrait>(rootNode, result); @@ -111,6 +135,7 @@ } Element* SelectorQuery::queryFirst(ContainerNode& rootNode) const { + QUERY_STATS_RESET(); NthIndexCache nthIndexCache(rootNode.document()); Element* matchedElement = nullptr; execute<SingleElementSelectorQueryTrait>(rootNode, matchedElement); @@ -124,6 +149,7 @@ const CSSSelector* selector, typename SelectorQueryTrait::OutputType& output) { for (Element& element : ElementTraversal::descendantsOf(rootNode)) { + QUERY_STATS_INCREMENT(fastClass); if (!hasClassName(element, className)) continue; if (selector && !selectorMatches(*selector, element, rootNode)) @@ -156,6 +182,7 @@ typename SelectorQueryTrait::OutputType& output) { DCHECK_EQ(tagName.namespaceURI(), starAtom); for (Element& element : ElementTraversal::descendantsOf(rootNode)) { + QUERY_STATS_INCREMENT(fastTagName); if (matchesTagName(tagName, element)) { SelectorQueryTrait::appendElement(output, element); if (SelectorQueryTrait::shouldOnlyMatchFirstElement) @@ -276,6 +303,7 @@ const CSSSelector& selector = *m_selectors[0]; for (Element& element : ElementTraversal::descendantsOf(traverseRoot)) { + QUERY_STATS_INCREMENT(fastScan); if (selectorMatches(selector, element, rootNode)) { SelectorQueryTrait::appendElement(output, element); if (SelectorQueryTrait::shouldOnlyMatchFirstElement) @@ -298,6 +326,7 @@ ContainerNode& rootNode, typename SelectorQueryTrait::OutputType& output) const { for (Element& element : ElementTraversal::descendantsOf(rootNode)) { + QUERY_STATS_INCREMENT(slowScan); if (!selectorListMatches(rootNode, element)) continue; SelectorQueryTrait::appendElement(output, element); @@ -358,6 +387,7 @@ node; node = nextTraversingShadowTree(*node, &rootNode)) { if (!node->isElementNode()) continue; + QUERY_STATS_INCREMENT(slowTraversingShadowTreeScan); Element* element = toElement(node); if (!selectorListMatches(rootNode, *element)) continue; @@ -419,6 +449,7 @@ for (const auto& element : elements) { if (!element->isDescendantOf(&rootNode)) continue; + QUERY_STATS_INCREMENT(fastId); if (selectorMatches(selector, *element, rootNode)) { SelectorQueryTrait::appendElement(output, *element); if (SelectorQueryTrait::shouldOnlyMatchFirstElement) @@ -432,6 +463,7 @@ return; if (!element->isDescendantOf(&rootNode)) return; + QUERY_STATS_INCREMENT(fastId); if (selectorMatches(selector, *element, rootNode)) SelectorQueryTrait::appendElement(output, *element); return;
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.h b/third_party/WebKit/Source/core/dom/SelectorQuery.h index 15906d8..5cdd315 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.h +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.h
@@ -64,6 +64,20 @@ // https://dom.spec.whatwg.org/#dom-parentnode-queryselector Element* queryFirst(ContainerNode& rootNode) const; + struct QueryStats { + unsigned totalCount; + unsigned fastId; + unsigned fastClass; + unsigned fastTagName; + unsigned fastScan; + unsigned slowScan; + unsigned slowTraversingShadowTreeScan; + }; + // Used by unit tests to get information about what paths were taken during + // the last query. Always reset between queries. This system is disabled in + // non DCHECK builds to avoid the overhead on the query process. + static QueryStats lastQueryStats(); + private: explicit SelectorQuery(CSSSelectorList);
diff --git a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp index 3b28cdf..2b8981a 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
@@ -4,16 +4,56 @@ #include "core/dom/SelectorQuery.h" +#include <memory> #include "core/css/parser/CSSParser.h" #include "core/css/parser/CSSParserContext.h" #include "core/dom/Document.h" +#include "core/dom/StaticNodeList.h" #include "core/html/HTMLDocument.h" #include "core/html/HTMLHtmlElement.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { +namespace { +struct QueryTest { + const char* selector; + bool queryAll; + unsigned matches; + // {totalCount, fastId, fastClass, fastTagName, fastScan, slowScan, + // slowTraversingShadowTreeScan} + SelectorQuery::QueryStats stats; +}; + +template <unsigned length> +void runTests(Document& document, const QueryTest (&testCases)[length]) { + for (const auto& testCase : testCases) { + const char* selector = testCase.selector; + SCOPED_TRACE(testing::Message() << (testCase.queryAll ? "querySelectorAll('" + : "querySelector('") + << selector << "')"); + if (testCase.queryAll) { + StaticElementList* matchAll = document.querySelectorAll(selector); + EXPECT_EQ(testCase.matches, matchAll->length()); + } else { + Element* match = document.querySelector(selector); + EXPECT_EQ(testCase.matches, match ? 1u : 0u); + } +#if DCHECK_IS_ON() + SelectorQuery::QueryStats stats = SelectorQuery::lastQueryStats(); + EXPECT_EQ(testCase.stats.totalCount, stats.totalCount); + EXPECT_EQ(testCase.stats.fastId, stats.fastId); + EXPECT_EQ(testCase.stats.fastClass, stats.fastClass); + EXPECT_EQ(testCase.stats.fastTagName, stats.fastTagName); + EXPECT_EQ(testCase.stats.fastScan, stats.fastScan); + EXPECT_EQ(testCase.stats.slowScan, stats.slowScan); + EXPECT_EQ(testCase.stats.slowTraversingShadowTreeScan, + stats.slowTraversingShadowTreeScan); +#endif + } +} +}; + TEST(SelectorQueryTest, NotMatchingPseudoElement) { Document* document = Document::create(); HTMLHtmlElement* html = HTMLHtmlElement::create(*document); @@ -59,4 +99,114 @@ EXPECT_EQ("last", elm->idForStyleResolution()); } +TEST(SelectorQueryTest, StandardsModeFastPaths) { + Document* document = HTMLDocument::create(); + document->write( + "<!DOCTYPE html>" + "<html>" + " <head></head>" + " <body>" + " <span id=first class=A>" + " <span id=a class=one></span>" + " <span id=b class=two></span>" + " <span id=c class=one></span>" + " <div id=multiple class=two></div>" + " </span>" + " <div>" + " <span id=second class=B>" + " <span id=A class=one></span>" + " <span id=B class=two></span>" + " <span id=C class=one></span>" + " <span id=multiple class=two></span>" + " </span>" + " </div>" + " </body>" + "</html>"); + static const struct QueryTest kTestCases[] = { + // Id in right most selector fast path. + {"#A", false, 1, {1, 1, 0, 0, 0, 0, 0}}, + {"#multiple", false, 1, {1, 1, 0, 0, 0, 0, 0}}, + {"#multiple.two", false, 1, {1, 1, 0, 0, 0, 0, 0}}, + {"#multiple", true, 2, {2, 2, 0, 0, 0, 0, 0}}, + {"span#multiple", true, 1, {2, 2, 0, 0, 0, 0, 0}}, + {"#multiple.two", true, 2, {2, 2, 0, 0, 0, 0, 0}}, + {"body #multiple", false, 1, {1, 1, 0, 0, 0, 0, 0}}, + {"body span#multiple", false, 1, {2, 2, 0, 0, 0, 0, 0}}, + {"body #multiple", true, 2, {2, 2, 0, 0, 0, 0, 0}}, + + // Single selector tag fast path. + {"span", false, 1, {4, 0, 0, 4, 0, 0, 0}}, + {"span", true, 9, {14, 0, 0, 14, 0, 0, 0}}, + + // Single selector class fast path. + {".two", false, 1, {6, 0, 6, 0, 0, 0, 0}}, + {".two", true, 4, {14, 0, 14, 0, 0, 0, 0}}, + + // Class in the right most selector fast path. + {"body .two", false, 1, {6, 0, 0, 0, 6, 0, 0}}, + {"div .two", false, 1, {12, 0, 0, 0, 12, 0, 0}}, + + // Classes in the right most selector for querySelectorAll use a fast + // path. + {"body .two", true, 4, {14, 0, 14, 0, 0, 0, 0}}, + {"div .two", true, 2, {14, 0, 14, 0, 0, 0, 0}}, + + // TODO: querySelector disables the class fast path to favor the id, but + // this means some selectors always end up doing fastScan. + {"#second .two", false, 1, {2, 0, 0, 0, 2, 0, 0}}, + + // TODO(esprehn): This should have used getElementById instead of doing + // a fastClass scan. It could have looked at 4 elements instead. + {"#second .two", true, 2, {14, 0, 14, 0, 0, 0, 0}}, + + // Selectors with no classes or ids use the fast scan. + {":scope", false, 1, {1, 0, 0, 0, 1, 0, 0}}, + {":scope", true, 1, {14, 0, 0, 0, 14, 0, 0}}, + {"foo bar", false, 0, {14, 0, 0, 0, 14, 0, 0}}, + + // Multiple selectors always uses the slow path. + // TODO(esprehn): We could make this fast if we sorted the output, not + // sure it's worth it unless we're dealing with ids. + {"#a, #b", false, 1, {5, 0, 0, 0, 0, 5, 0}}, + {"#a, #b", true, 2, {14, 0, 0, 0, 0, 14, 0}}, + + // Anything that crosses shadow boundaries is slow path. + {"#foo /deep/ .a", false, 0, {14, 0, 0, 0, 0, 0, 14}}, + {"#foo::shadow .a", false, 0, {14, 0, 0, 0, 0, 0, 14}}, + {"::content .a", false, 0, {14, 0, 0, 0, 0, 14, 0}}, + {"#foo /deep/ .a", true, 0, {14, 0, 0, 0, 0, 0, 14}}, + {"#foo::shadow .a", true, 0, {14, 0, 0, 0, 0, 0, 14}}, + {"::content .a", true, 0, {14, 0, 0, 0, 0, 14, 0}}, + }; + runTests(*document, kTestCases); +} + +TEST(SelectorQueryTest, QuirksModeSlowPath) { + Document* document = HTMLDocument::create(); + document->write( + "<html>" + " <head></head>" + " <body>" + " <span id=first>" + " <span id=One class=Two></span>" + " <span id=one class=tWo></span>" + " </span>" + " </body>" + "</html>"); + static const struct QueryTest kTestCases[] = { + // Quirks mode always uses the slow path. + {"#one", false, 1, {5, 0, 0, 0, 0, 5, 0}}, + {"#One", false, 1, {5, 0, 0, 0, 0, 5, 0}}, + {"#ONE", false, 1, {5, 0, 0, 0, 0, 5, 0}}, + {"#ONE", true, 2, {6, 0, 0, 0, 0, 6, 0}}, + {"span", false, 1, {4, 0, 0, 0, 0, 4, 0}}, + {"span", true, 3, {6, 0, 0, 0, 0, 6, 0}}, + {".two", false, 1, {5, 0, 0, 0, 0, 5, 0}}, + {".two", true, 2, {6, 0, 0, 0, 0, 6, 0}}, + {"body #first", false, 1, {4, 0, 0, 0, 0, 4, 0}}, + {"body #one", true, 2, {6, 0, 0, 0, 0, 6, 0}}, + }; + runTests(*document, kTestCases); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp index eb2b5e8..605c0079 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -835,33 +835,41 @@ setActiveStyleSheets(document, HeapVector<Member<CSSStyleSheet>>()); } -bool InspectorCSSAgent::forcePseudoState(Element* element, - CSSSelector::PseudoType pseudoType) { +void InspectorCSSAgent::forcePseudoState(Element* element, + CSSSelector::PseudoType pseudoType, + bool* result) { if (m_nodeIdToForcedPseudoState.isEmpty()) - return false; + return; int nodeId = m_domAgent->boundNodeId(element); if (!nodeId) - return false; + return; NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(nodeId); if (it == m_nodeIdToForcedPseudoState.end()) - return false; + return; + bool force = false; unsigned forcedPseudoState = it->value; switch (pseudoType) { case CSSSelector::PseudoActive: - return forcedPseudoState & PseudoActive; + force = forcedPseudoState & PseudoActive; + break; case CSSSelector::PseudoFocus: - return forcedPseudoState & PseudoFocus; + force = forcedPseudoState & PseudoFocus; + break; case CSSSelector::PseudoHover: - return forcedPseudoState & PseudoHover; + force = forcedPseudoState & PseudoHover; + break; case CSSSelector::PseudoVisited: - return forcedPseudoState & PseudoVisited; + force = forcedPseudoState & PseudoVisited; + break; default: - return false; + break; } + if (force) + *result = true; } Response InspectorCSSAgent::getMediaQueries(
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h index a1e4890..307e9dd 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
@@ -110,7 +110,7 @@ ~InspectorCSSAgent() override; DECLARE_VIRTUAL_TRACE(); - bool forcePseudoState(Element*, CSSSelector::PseudoType); + void forcePseudoState(Element*, CSSSelector::PseudoType, bool* result); void didCommitLoadForLocalFrame(LocalFrame*) override; void restore() override; void flushPendingProtocolNotifications() override;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 1474b155..8a530c1 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -555,19 +555,22 @@ InspectorBaseAgent::trace(visitor); } -bool InspectorNetworkAgent::shouldBlockRequest(const ResourceRequest& request) { +void InspectorNetworkAgent::shouldBlockRequest(const ResourceRequest& request, + bool* result) { protocol::DictionaryValue* blockedURLs = m_state->getObject(NetworkAgentState::blockedURLs); if (!blockedURLs) - return false; + return; String url = request.url().getString(); for (size_t i = 0; i < blockedURLs->size(); ++i) { auto entry = blockedURLs->at(i); - if (matches(url, entry.first)) - return true; + if (matches(url, entry.first)) { + *result = true; + return; + } } - return false; + return; } void InspectorNetworkAgent::didBlockRequest( @@ -1549,8 +1552,9 @@ this, &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} -bool InspectorNetworkAgent::shouldForceCORSPreflight() { - return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); +void InspectorNetworkAgent::shouldForceCORSPreflight(bool* result) { + if (m_state->booleanProperty(NetworkAgentState::cacheDisabled, false)) + *result = true; } } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h index d7861d1..a8672589 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
@@ -73,7 +73,7 @@ ~InspectorNetworkAgent() override; DECLARE_VIRTUAL_TRACE(); - // Called from instrumentation. + // Probes. void didBlockRequest(LocalFrame*, const ResourceRequest&, DocumentLoader*, @@ -114,8 +114,8 @@ void didCommitLoad(LocalFrame*, DocumentLoader*); void scriptImported(unsigned long identifier, const String& sourceString); void didReceiveScriptResponse(unsigned long identifier); - bool shouldForceCORSPreflight(); - bool shouldBlockRequest(const ResourceRequest&); + void shouldForceCORSPreflight(bool* result); + void shouldBlockRequest(const ResourceRequest&, bool* result); void documentThreadableLoaderStartedLoadingForClient(unsigned long identifier, ThreadableLoaderClient*);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp index ec4dc34..d2fedb2 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -112,10 +112,10 @@ idProxy.value->writeTimelineStartedEvent(sessionId); } -bool InspectorWorkerAgent::shouldWaitForDebuggerOnWorkerStart() { - return autoAttachEnabled() && - m_state->booleanProperty(WorkerAgentState::waitForDebuggerOnStart, - false); +void InspectorWorkerAgent::shouldWaitForDebuggerOnWorkerStart(bool* result) { + if (autoAttachEnabled() && + m_state->booleanProperty(WorkerAgentState::waitForDebuggerOnStart, false)) + *result = true; } void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* proxy,
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h index 9666fbe..92d81e2d 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.h
@@ -56,8 +56,8 @@ void restore() override; void didCommitLoadForLocalFrame(LocalFrame*) override; - // Called from InspectorInstrumentation - bool shouldWaitForDebuggerOnWorkerStart(); + // Probes + void shouldWaitForDebuggerOnWorkerStart(bool* result); void didStartWorker(WorkerInspectorProxy*, bool waitingForDebugger); void workerTerminated(WorkerInspectorProxy*);
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index 747c7f38..07ae3e37 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -37,6 +37,7 @@ #include "core/frame/FrameConsole.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" +#include "core/inspector/InspectorNetworkAgent.h" #include "core/inspector/InspectorTraceEvents.h" #include "core/loader/DocumentThreadableLoaderClient.h" #include "core/loader/FrameLoader.h" @@ -386,8 +387,9 @@ crossOriginRequest.setServiceWorkerMode( WebURLRequest::ServiceWorkerMode::None); - bool shouldForcePreflight = request.isExternalRequest() || - probe::shouldForceCORSPreflight(document()); + bool shouldForcePreflight = request.isExternalRequest(); + if (!shouldForcePreflight) + probe::shouldForceCORSPreflight(document(), &shouldForcePreflight); bool canSkipPreflight = CrossOriginPreflightResultCache::shared().canSkipPreflight( getSecurityOrigin()->toString(), crossOriginRequest.url(),
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index c128935..15a360b 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -48,7 +48,6 @@ #include "core/html/imports/HTMLImportsController.h" #include "core/inspector/ConsoleMessage.h" #include "core/inspector/IdentifiersFactory.h" -#include "core/inspector/InspectorNetworkAgent.h" #include "core/inspector/InspectorTraceEvents.h" #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoader.h" @@ -724,7 +723,9 @@ SecurityViolationReportingPolicy reportingPolicy, FetchRequest::OriginRestriction originRestriction, ResourceRequest::RedirectStatus redirectStatus) const { - if (probe::shouldBlockRequest(frame(), resourceRequest)) + bool shouldBlockRequest = false; + probe::shouldBlockRequest(frame(), resourceRequest, &shouldBlockRequest); + if (shouldBlockRequest) return ResourceRequestBlockedReason::Inspector; SecurityOrigin* securityOrigin = options.securityOrigin.get();
diff --git a/third_party/WebKit/Source/core/probe/BUILD.gn b/third_party/WebKit/Source/core/probe/BUILD.gn index 05eb767..a717b49 100644 --- a/third_party/WebKit/Source/core/probe/BUILD.gn +++ b/third_party/WebKit/Source/core/probe/BUILD.gn
@@ -24,7 +24,6 @@ outputs = [ "$blink_core_output_dir/CoreProbesInl.h", - "$blink_core_output_dir/InspectorOverridesInl.h", "$blink_core_output_dir/CoreProbesImpl.cpp", "$blink_core_output_dir/CoreProbeSink.h", ]
diff --git a/third_party/WebKit/Source/core/probe/CoreProbes.h b/third_party/WebKit/Source/core/probe/CoreProbes.h index a540fcd..114050fb 100644 --- a/third_party/WebKit/Source/core/probe/CoreProbes.h +++ b/third_party/WebKit/Source/core/probe/CoreProbes.h
@@ -126,6 +126,5 @@ } // namespace blink #include "core/CoreProbesInl.h" -#include "core/InspectorOverridesInl.h" #endif // !defined(CoreProbes_h)
diff --git a/third_party/WebKit/Source/core/probe/CoreProbes.pidl b/third_party/WebKit/Source/core/probe/CoreProbes.pidl index 810ff7ac..0f91d11e 100644 --- a/third_party/WebKit/Source/core/probe/CoreProbes.pidl +++ b/third_party/WebKit/Source/core/probe/CoreProbes.pidl
@@ -42,7 +42,7 @@ * paramAttr - optional attribute controlling the parameters handling (one attribute per parameter max). * Keep - pass first parameter (used to access the CoreProbeSink instance) to agents. * - * returnValue: C++ return value. Only "void" and "bool" are supported. + * returnValue: "void" for instant probes. * Omitted for the scoped probes. * * methodName: C++ name for the public instrumentation method and agents methods. @@ -156,11 +156,8 @@ CallFunction([Keep] ExecutionContext* context, v8::Local<v8::Function> function, int depth = 0); UserCallback([Keep] ExecutionContext* context, const char* name, const AtomicString& atomicName, bool recurring, EventTarget* eventTarget = nullptr); ParseHTML(Document* document, HTMLDocumentParser* parser); -} - -interface InspectorOverrides { - bool forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState); - bool shouldWaitForDebuggerOnWorkerStart(ExecutionContext* context); - bool shouldForceCORSPreflight(Document*); - bool shouldBlockRequest(LocalFrame*, const ResourceRequest&); + void forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState, bool* result); + void shouldWaitForDebuggerOnWorkerStart(ExecutionContext* context, bool* result); + void shouldForceCORSPreflight(Document*, bool* result); + void shouldBlockRequest(LocalFrame*, const ResourceRequest&, bool* result); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp b/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp index 346c38d..534db8f 100644 --- a/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerInspectorProxy.cpp
@@ -7,6 +7,7 @@ #include "core/frame/FrameConsole.h" #include "core/inspector/IdentifiersFactory.h" #include "core/inspector/InspectorTraceEvents.h" +#include "core/inspector/InspectorWorkerAgent.h" #include "core/inspector/WorkerInspectorController.h" #include "core/probe/CoreProbes.h" #include "core/workers/WorkerGlobalScope.h" @@ -51,9 +52,10 @@ WorkerThreadStartMode WorkerInspectorProxy::workerStartMode( Document* document) { - if (probe::shouldWaitForDebuggerOnWorkerStart(document)) - return PauseWorkerGlobalScopeOnStart; - return DontPauseWorkerGlobalScopeOnStart; + bool result = false; + probe::shouldWaitForDebuggerOnWorkerStart(document, &result); + return result ? PauseWorkerGlobalScopeOnStart + : DontPauseWorkerGlobalScopeOnStart; } void WorkerInspectorProxy::workerThreadCreated(Document* document, @@ -65,7 +67,8 @@ inspectorProxies().insert(this); // We expect everyone starting worker thread to synchronously ask for // workerStartMode right before. - bool waitingForDebugger = probe::shouldWaitForDebuggerOnWorkerStart(document); + bool waitingForDebugger = false; + probe::shouldWaitForDebuggerOnWorkerStart(document, &waitingForDebugger); probe::didStartWorker(document, this, waitingForDebugger); }
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp index a460a3a..e0d50dc 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -16,6 +16,7 @@ #include "modules/imagecapture/PhotoSettings.h" #include "modules/mediastream/MediaStreamTrack.h" #include "modules/mediastream/MediaTrackCapabilities.h" +#include "modules/mediastream/MediaTrackConstraints.h" #include "platform/WaitableEvent.h" #include "platform/mojo/MojoHelper.h" #include "public/platform/InterfaceProvider.h" @@ -246,17 +247,20 @@ return m_capabilities; } -// TODO(mcasas): make the implementation fully Spec compliant, see inside the -// method, https://crbug.com/700607. +// TODO(mcasas): make the implementation fully Spec compliant, see the TODOs +// inside the method, https://crbug.com/708723. void ImageCapture::setMediaTrackConstraints( ScriptPromiseResolver* resolver, - const MediaTrackConstraintSet& constraints) { + const HeapVector<MediaTrackConstraintSet>& constraintsVector) { if (!m_service) { resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); return; } m_serviceRequests.insert(resolver); + // TODO(mcasas): add support more than one single advanced constraint. + const auto constraints = constraintsVector[0]; + auto settings = media::mojom::blink::PhotoSettings::New(); // TODO(mcasas): support other Mode types beyond simple string i.e. the @@ -369,6 +373,15 @@ return m_currentConstraints; } +void ImageCapture::clearMediaTrackConstraints(ScriptPromiseResolver* resolver) { + m_currentConstraints = MediaTrackConstraintSet(); + resolver->resolve(); + + // TODO(mcasas): Clear also any PhotoSettings that the device might have got + // configured, for that we need to know a "default" state of the device; take + // a snapshot upon first opening. https://crbug.com/700607. +} + void ImageCapture::getMediaTrackSettings(MediaTrackSettings& settings) const { // Merge any present |m_settings| members into |settings|. @@ -404,6 +417,29 @@ settings.setTorch(m_settings.torch()); } +bool ImageCapture::hasNonImageCaptureConstraints( + const MediaTrackConstraints& constraints) const { + if (!constraints.hasAdvanced()) + return false; + + const auto& advancedConstraints = constraints.advanced(); + for (const auto& constraint : advancedConstraints) { + if (constraint.hasWidth() || constraint.hasHeight() || + constraint.hasAspectRatio() || constraint.hasFrameRate() || + constraint.hasFacingMode() || constraint.hasVolume() || + constraint.hasSampleRate() || constraint.hasSampleSize() || + constraint.hasEchoCancellation() || constraint.hasLatency() || + constraint.hasChannelCount() || constraint.hasDeviceId() || + constraint.hasGroupId() || constraint.hasVideoKind() || + constraint.hasDepthNear() || constraint.hasDepthFar() || + constraint.hasFocalLengthX() || constraint.hasFocalLengthY() || + constraint.hasMandatory() || constraint.hasOptional()) { + return true; + } + } + return false; +} + ImageCapture::ImageCapture(ExecutionContext* context, MediaStreamTrack* track) : ContextLifecycleObserver(context), m_streamTrack(track) { DCHECK(m_streamTrack);
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h index 6a59e2b..9596bbf 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h
@@ -22,6 +22,7 @@ class ExceptionState; class MediaStreamTrack; +class MediaTrackConstraints; class PhotoSettings; class ScriptPromiseResolver; class WebImageCaptureFrameGrabber; @@ -63,10 +64,14 @@ MediaTrackCapabilities& getMediaTrackCapabilities(); void setMediaTrackConstraints(ScriptPromiseResolver*, - const MediaTrackConstraintSet&); + const HeapVector<MediaTrackConstraintSet>&); const MediaTrackConstraintSet& getMediaTrackConstraints() const; + void clearMediaTrackConstraints(ScriptPromiseResolver*); void getMediaTrackSettings(MediaTrackSettings&) const; + // TODO(mcasas): Remove this service method, https://crbug.com/338503. + bool hasNonImageCaptureConstraints(const MediaTrackConstraints&) const; + DECLARE_VIRTUAL_TRACE(); private:
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index ae6f9d1e..eb59e6f 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -306,22 +306,22 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); - // |constraints| is an optional argument, which is strange. - // TODO(mcasas): remove this provision if |constraints| is not optional: - // https://github.com/w3c/mediacapture-main/issues/438 - if (!constraints.hasAdvanced()) { - resolver->resolve(); - return promise; - } - - if (!m_imageCapture) { + // TODO(mcasas): Until https://crbug.com/338503 is landed, we only support + // ImageCapture-related constraints. + if (!m_imageCapture || + m_imageCapture->hasNonImageCaptureConstraints(constraints)) { resolver->reject(DOMException::create( - NotSupportedError, "Track type not currently supported")); + NotSupportedError, + "Only Image-Capture constraints supported (https://crbug.com/338503)")); return promise; } - // TODO(mcasas): support more advanced constraints, https://crbug.com/700607. - m_imageCapture->setMediaTrackConstraints(resolver, constraints.advanced()[0]); + // |constraints| empty means "remove/clear all current constraints". + if (!constraints.hasAdvanced()) + m_imageCapture->clearMediaTrackConstraints(resolver); + else + m_imageCapture->setMediaTrackConstraints(resolver, constraints.advanced()); + return promise; }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp index 4813a82..2db5946 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
@@ -155,6 +155,12 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); + // If we're already running, just resolve; nothing else needs to be + // done. + if (contextState() == Running) { + resolver->resolve(); + return promise; + } // Restart the destination node to pull on the audio graph. if (destination()) { maybeUnlockUserGesture();
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp b/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp index 374b3a93..54dd43a 100644 --- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp +++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp
@@ -34,6 +34,37 @@ namespace blink { +// WebScrollbarThemeMac uses GraphicsContextCanvas which doesn't quite support +// device clip rects not at the origin. This class translates the recording +// canvas to the origin and then adjusts it back during playback. +class ScopedScrollbarPainter { + public: + ScopedScrollbarPainter(WebScrollbarThemePainter* painter, + WebCanvas* canvas, + const WebRect& rect) + : m_intRect(IntRect(IntPoint(), IntSize(rect.width, rect.height))), + m_builder(m_intRect), + m_canvas(canvas), + m_rect(rect) { + m_builder.context().setDeviceScaleFactor(painter->deviceScaleFactor()); + } + GraphicsContext& context() { return m_builder.context(); } + const IntRect& rect() const { return m_intRect; } + + ~ScopedScrollbarPainter() { + m_canvas->save(); + m_canvas->translate(m_rect.x, m_rect.y); + m_canvas->PlaybackPaintRecord(m_builder.endRecording()); + m_canvas->restore(); + } + + protected: + IntRect m_intRect; + PaintRecordBuilder m_builder; + WebCanvas* m_canvas; + const WebRect& m_rect; +}; + void WebScrollbarThemePainter::assign(const WebScrollbarThemePainter& painter) { // This is a pointer to a static object, so no ownership transferral. m_theme = painter.m_theme; @@ -50,100 +81,71 @@ SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height); canvas->clipRect(clip); - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintScrollbarBackground(builder.context(), *m_scrollbar); - canvas->PlaybackPaintRecord(builder.endRecording()); + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintScrollbarBackground(painter.context(), *m_scrollbar); } void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintTrackBackground(builder.context(), *m_scrollbar, intRect); - canvas->PlaybackPaintRecord(builder.endRecording()); + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintTrackBackground(painter.context(), *m_scrollbar, + painter.rect()); if (!m_theme->shouldRepaintAllPartsOnInvalidation()) m_scrollbar->clearTrackNeedsRepaint(); } void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintTrackPiece(painter.context(), *m_scrollbar, painter.rect(), BackTrackPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintTrackPiece(painter.context(), *m_scrollbar, painter.rect(), ForwardTrackPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintButton(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintButton(painter.context(), *m_scrollbar, painter.rect(), BackButtonStartPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintButton(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintButton(painter.context(), *m_scrollbar, painter.rect(), BackButtonEndPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintButton(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintButton(painter.context(), *m_scrollbar, painter.rect(), ForwardButtonStartPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintButton(builder.context(), *m_scrollbar, intRect, + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintButton(painter.context(), *m_scrollbar, painter.rect(), ForwardButtonEndPart); - canvas->PlaybackPaintRecord(builder.endRecording()); } void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintTickmarks(builder.context(), *m_scrollbar, intRect); - canvas->PlaybackPaintRecord(builder.endRecording()); + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintTickmarks(painter.context(), *m_scrollbar, painter.rect()); } void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect) { - IntRect intRect(rect); - PaintRecordBuilder builder(intRect); - builder.context().setDeviceScaleFactor(m_deviceScaleFactor); - m_theme->paintThumb(builder.context(), *m_scrollbar, intRect); - canvas->PlaybackPaintRecord(builder.endRecording()); + ScopedScrollbarPainter painter(this, canvas, rect); + m_theme->paintThumb(painter.context(), *m_scrollbar, painter.rect()); if (!m_theme->shouldRepaintAllPartsOnInvalidation()) m_scrollbar->clearThumbNeedsRepaint(); }
diff --git a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp index a174450c..032fe49 100644 --- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp +++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
@@ -157,6 +157,8 @@ r.setToShadowHostIfInRestrictedShadowRoot(); LocalFrame* selectedFrame = r.innerNodeFrame(); + WebLocalFrameImpl* selectedWebFrame = + WebLocalFrameImpl::fromFrame(selectedFrame); WebContextMenuData data; data.mousePosition = selectedFrame->view()->contentsToViewport( @@ -326,9 +328,9 @@ Vector<String> suggestions; description.split('\n', suggestions); data.dictionarySuggestions = suggestions; - } else if (m_webView->textCheckClient()) { + } else if (selectedWebFrame->textCheckClient()) { int misspelledOffset, misspelledLength; - m_webView->textCheckClient()->checkSpelling( + selectedWebFrame->textCheckClient()->checkSpelling( data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); } @@ -388,8 +390,6 @@ if (fromTouch && !shouldShowContextMenuFromTouch(data)) return false; - WebLocalFrameImpl* selectedWebFrame = - WebLocalFrameImpl::fromFrame(selectedFrame); selectedWebFrame->setContextMenuNode(r.innerNodeOrImageMapImage()); if (!selectedWebFrame->client()) return false;
diff --git a/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp b/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp index 7005a3d..00f7602d 100644 --- a/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp +++ b/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp
@@ -19,8 +19,7 @@ } WebTextCheckClient* TextCheckerClientImpl::webTextCheckClient() const { - // TODO(xiaochengh): Move WebTextCheckClient to WebLocalFrame. - return m_webLocalFrame->viewImpl()->textCheckClient(); + return m_webLocalFrame->textCheckClient(); } void TextCheckerClientImpl::checkSpellingOfString(const String& text,
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp index be51197..b04cd1c09 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -2526,4 +2526,9 @@ return *m_textCheckerClient; } +void WebLocalFrameImpl::setTextCheckClient( + WebTextCheckClient* textCheckClient) { + m_textCheckClient = textCheckClient; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index 0616712..4ac184f 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -180,6 +180,7 @@ bool executeCommand(const WebString&) override; bool executeCommand(const WebString&, const WebString& value) override; bool isCommandEnabled(const WebString&) const override; + void setTextCheckClient(WebTextCheckClient*) override; void enableSpellChecking(bool) override; bool isSpellCheckingEnabled() const override; void replaceMisspelledRange(const WebString&) override; @@ -405,6 +406,7 @@ static void selectWordAroundPosition(LocalFrame*, VisiblePosition); TextCheckerClient& textCheckerClient() const; + WebTextCheckClient* textCheckClient() const { return m_textCheckClient; } TextFinder* textFinder() const; // Returns the text finder object if it already exists. @@ -426,7 +428,6 @@ void setContextMenuNode(Node* node) { m_contextMenuNode = node; } void clearContextMenuNode() { m_contextMenuNode.clear(); } - DECLARE_TRACE(); private: @@ -503,8 +504,9 @@ std::unique_ptr<WebInputMethodControllerImpl> m_inputMethodController; - // Stores the TextCheckerClient which communicates with SpellCheckProvider. + // Stores the TextCheckerClient to bridge SpellChecker and WebTextCheckClient. Member<TextCheckerClientImpl> m_textCheckerClient; + WebTextCheckClient* m_textCheckClient; // Oilpan: WebLocalFrameImpl must remain alive until close() is called. // Accomplish that by keeping a self-referential Persistent<>. It is
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index f6586700..3e218af 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -329,10 +329,6 @@ m_spellCheckClient = spellCheckClient; } -void WebViewImpl::setTextCheckClient(WebTextCheckClient* textCheckClient) { - m_textCheckClient = textCheckClient; -} - // static HashSet<WebViewImpl*>& WebViewImpl::allInstances() { DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); @@ -343,7 +339,6 @@ WebPageVisibilityState visibilityState) : m_client(client), m_spellCheckClient(nullptr), - m_textCheckClient(nullptr), m_chromeClientImpl(ChromeClientImpl::create(this)), m_contextMenuClientImpl(this), m_editorClientImpl(this),
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 8ca3298..46f8d69 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -175,7 +175,6 @@ void setCredentialManagerClient(WebCredentialManagerClient*) override; void setPrerendererClient(WebPrerendererClient*) override; void setSpellCheckClient(WebSpellCheckClient*) override; - void setTextCheckClient(WebTextCheckClient*) override; WebSettings* settings() override; WebString pageEncoding() const override; bool tabsToLinks() const override; @@ -315,8 +314,6 @@ WebSpellCheckClient* spellCheckClient() { return m_spellCheckClient; } - WebTextCheckClient* textCheckClient() { return m_textCheckClient; } - // Returns the page object associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. Page* page() const { return m_page.get(); } @@ -616,9 +613,6 @@ WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) WebSpellCheckClient* m_spellCheckClient; - // TODO(xiaochengh): Move this pointer to WebLocalFrameImpl. - WebTextCheckClient* m_textCheckClient; - Persistent<ChromeClientImpl> m_chromeClientImpl; ContextMenuClientImpl m_contextMenuClientImpl; EditorClientImpl m_editorClientImpl;
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index d9b19a7c1..bb6db0126 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -6290,10 +6290,11 @@ registerMockedHttpURLLoad("spell.html"); FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - TextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + TextCheckClient textcheck; + frame->setTextCheckClient(&textcheck); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -6337,10 +6338,11 @@ registerMockedHttpURLLoad("spell.html"); FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - TextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + TextCheckClient textcheck; + frame->setTextCheckClient(&textcheck); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -6379,10 +6381,12 @@ registerMockedHttpURLLoad("spell.html"); FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - TextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); - LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); + WebLocalFrameImpl* webFrame = webViewHelper.webView()->mainFrameImpl(); + TextCheckClient textcheck; + webFrame->setTextCheckClient(&textcheck); + + LocalFrame* frame = webFrame->frame(); Document* document = frame->document(); Element* element = document->getElementById("data"); @@ -6456,10 +6460,10 @@ FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - StubbornTextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); - WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + StubbornTextCheckClient textcheck; + frame->setTextCheckClient(&textcheck); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -6497,9 +6501,10 @@ registerMockedHttpURLLoad("spell.html"); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); - webViewHelper.webView()->setTextCheckClient(0); WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + frame->setTextCheckClient(0); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -6517,10 +6522,10 @@ FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - StubbornTextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); - WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + StubbornTextCheckClient textcheck; + frame->setTextCheckClient(&textcheck); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data"); @@ -6557,10 +6562,10 @@ FrameTestHelpers::WebViewHelper webViewHelper; initializeTextSelectionWebView(m_baseURL + "spell.html", &webViewHelper); - StubbornTextCheckClient textcheck; - webViewHelper.webView()->setTextCheckClient(&textcheck); - WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); + StubbornTextCheckClient textcheck; + frame->setTextCheckClient(&textcheck); + Document* document = frame->frame()->document(); Element* element = document->getElementById("data");
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py index 4b44072..59f14fc 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
@@ -236,7 +236,7 @@ value to create one test expectations line per key. Args: - merged_results: A merged_results with the format: + merged_results: A dictionary with the format: { 'test_name': { 'platform': { @@ -253,17 +253,27 @@ """ line_list = [] for test_name, port_results in sorted(merged_results.iteritems()): - for port_names in sorted(port_results): - if test_name.startswith('external'): - line_parts = [port_results[port_names]['bug']] - specifier_part = self.specifier_part(self.to_list(port_names), test_name) - if specifier_part: - line_parts.append(specifier_part) - line_parts.append(test_name) - line_parts.append('[ %s ]' % ' '.join(self.get_expectations(port_results[port_names]))) - line_list.append(' '.join(line_parts)) + if not test_name.startswith('external'): + continue + for port_names, results in sorted(port_results.iteritems()): + line_list.append(self._create_line(test_name, port_names, results)) return line_list + def _create_line(self, test_name, port_names, results): + """Constructs one test expectations line string.""" + line_parts = [results['bug']] + specifier_part = self.specifier_part(self.to_list(port_names), test_name) + if specifier_part: + line_parts.append(specifier_part) + line_parts.append(test_name) + + # Skip new manual tests; see crbug.com/708241 for context. + if '-manual.' in test_name and results['actual'] in ('MISSING', 'TIMEOUT'): + line_parts.append('[ Skip ]') + else: + line_parts.append('[ %s ]' % ' '.join(self.get_expectations(results))) + return ' '.join(line_parts) + def specifier_part(self, port_names, test_name): """Returns the specifier part for a new test expectations line.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py index f40df9e..9e036d21 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
@@ -466,3 +466,27 @@ updater.get_latest_try_jobs = lambda: [] self.assertEqual(1, updater.run(args=[])) self.assertLog(['ERROR: No try job information was collected.\n']) + + def test_new_manual_tests_get_skip_expectation(self): + host = self.mock_host() + host.filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/external/wpt/x-manual.html', '<html>') + updater = WPTExpectationsUpdater(host) + results = { + 'external/wpt/x-manual.html': { + ( + 'test-linux-precise', + 'test-linux-trusty', + 'test-mac-mac10.10', + 'test-mac-mac10.11', + 'test-win-win7', + 'test-win-win10', + ): {'expected': 'PASS', 'actual': 'MISSING', 'bug': 'crbug.com/test'} + } + } + results_copy = copy.deepcopy(results) + self.assertEqual( + updater.get_tests_to_rebaseline(results), + ([], results_copy)) + self.assertEqual( + updater.create_line_list(results), + ['crbug.com/test external/wpt/x-manual.html [ Skip ]'])
diff --git a/third_party/WebKit/public/platform/WebScrollbarThemePainter.h b/third_party/WebKit/public/platform/WebScrollbarThemePainter.h index b46df87a..8f4bda2 100644 --- a/third_party/WebKit/public/platform/WebScrollbarThemePainter.h +++ b/third_party/WebKit/public/platform/WebScrollbarThemePainter.h
@@ -80,6 +80,10 @@ float deviceScaleFactor); #endif + BLINK_PLATFORM_EXPORT float deviceScaleFactor() const { + return m_deviceScaleFactor; + } + private: // The theme is not owned by this class. It is assumed that the theme is a // static pointer and its lifetime is essentially infinite. The functions
diff --git a/third_party/WebKit/public/web/WebLocalFrame.h b/third_party/WebKit/public/web/WebLocalFrame.h index 3635e31..034385e8 100644 --- a/third_party/WebKit/public/web/WebLocalFrame.h +++ b/third_party/WebKit/public/web/WebLocalFrame.h
@@ -33,6 +33,7 @@ class WebInputMethodController; class WebRange; class WebScriptExecutionCallback; +class WebTextCheckClient; enum class WebCachePolicy; enum class WebSandboxFlags; enum class WebTreeScopeType; @@ -373,6 +374,7 @@ WebString& clipHtml) = 0; // Spell-checking support ------------------------------------------------- + virtual void setTextCheckClient(WebTextCheckClient*) = 0; virtual void replaceMisspelledRange(const WebString&) = 0; virtual void enableSpellChecking(bool) = 0; virtual bool isSpellCheckingEnabled() const = 0;
diff --git a/third_party/WebKit/public/web/WebView.h b/third_party/WebKit/public/web/WebView.h index 7202a5f2..b4b742e0 100644 --- a/third_party/WebKit/public/web/WebView.h +++ b/third_party/WebKit/public/web/WebView.h
@@ -58,7 +58,6 @@ class WebSettings; class WebSpellCheckClient; class WebString; -class WebTextCheckClient; class WebViewClient; class WebViewScheduler; struct WebActiveWheelFlingParameters; @@ -136,9 +135,6 @@ virtual void setPrerendererClient(WebPrerendererClient*) = 0; virtual void setSpellCheckClient(WebSpellCheckClient*) = 0; - // TODO(xiaochengh): Move reference of WebTextCheckClient to WebLocalFrame. - virtual void setTextCheckClient(WebTextCheckClient*) = 0; - // Options ------------------------------------------------------------- // The returned pointer is valid for the lifetime of the WebView.
diff --git a/third_party/gvr-android-sdk/test-apks/daydream_home/apk_version_history.txt b/third_party/gvr-android-sdk/test-apks/daydream_home/apk_version_history.txt index 243c4db..00c3e370 100644 --- a/third_party/gvr-android-sdk/test-apks/daydream_home/apk_version_history.txt +++ b/third_party/gvr-android-sdk/test-apks/daydream_home/apk_version_history.txt
@@ -3,3 +3,4 @@ v1.1 12e7c98d6db3ab31a6f9c7e6f07351a9e4b85565 v1.2 5400db0e25a24e0df9635ab268ef1058a60dfec2 v1.3 db5eaf6e83a10e809b96375212d5c9dbbe517624 +v1.4 9afe32eb4676d4bcceae81605a3be6aa0e5be3d5
diff --git a/third_party/gvr-android-sdk/test-apks/daydream_home/daydream_home_current.apk.sha1 b/third_party/gvr-android-sdk/test-apks/daydream_home/daydream_home_current.apk.sha1 index 0eacbb3..dede8dc 100644 --- a/third_party/gvr-android-sdk/test-apks/daydream_home/daydream_home_current.apk.sha1 +++ b/third_party/gvr-android-sdk/test-apks/daydream_home/daydream_home_current.apk.sha1
@@ -1 +1 @@ -db5eaf6e83a10e809b96375212d5c9dbbe517624 \ No newline at end of file +9afe32eb4676d4bcceae81605a3be6aa0e5be3d5 \ No newline at end of file
diff --git a/third_party/gvr-android-sdk/test-apks/vr_services/apk_version_history.txt b/third_party/gvr-android-sdk/test-apks/vr_services/apk_version_history.txt index 25cb6ee..039ede1e 100644 --- a/third_party/gvr-android-sdk/test-apks/vr_services/apk_version_history.txt +++ b/third_party/gvr-android-sdk/test-apks/vr_services/apk_version_history.txt
@@ -3,3 +3,4 @@ v1.1 524b48921472c133183d68a78a8dc675ea4cad35 v1.2 982709c5cc24922c381413fa32b9cb8e9f004165 v1.3 8233707ffc519460e1d21f8e1a5364a6336227f2 +v1.4 3024ad78653f11b53d9f15191eab9f11f70610e2
diff --git a/third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk.sha1 b/third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk.sha1 index de56928..6a8c160 100644 --- a/third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk.sha1 +++ b/third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk.sha1
@@ -1 +1 @@ -8233707ffc519460e1d21f8e1a5364a6336227f2 \ No newline at end of file +3024ad78653f11b53d9f15191eab9f11f70610e2 \ No newline at end of file
diff --git a/third_party/zlib/google/zip_reader_unittest.cc b/third_party/zlib/google/zip_reader_unittest.cc index 4e023dc..3056aba8 100644 --- a/third_party/zlib/google/zip_reader_unittest.cc +++ b/third_party/zlib/google/zip_reader_unittest.cc
@@ -22,6 +22,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "base/time/time.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -188,7 +189,7 @@ base::ScopedTempDir temp_dir_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST_F(ZipReaderTest, Open_ValidZipFile) {
diff --git a/tools/binary_size/describe.py b/tools/binary_size/describe.py index 49ab045..d8a83a4 100644 --- a/tools/binary_size/describe.py +++ b/tools/binary_size/describe.py
@@ -39,14 +39,15 @@ if k in relevant_names or k.startswith('.data')) total_bytes = sum(v for k, v in section_sizes.iteritems() if k in section_names and k != '.bss') + yield '' yield 'Section Sizes (Total={:,} bytes):'.format(total_bytes) for name in section_names: size = section_sizes[name] if name == '.bss': - yield '{}: {:,} bytes (not included in totals)'.format(name, size) + yield ' {}: {:,} bytes (not included in totals)'.format(name, size) else: percent = float(size) / total_bytes if total_bytes else 0 - yield '{}: {:,} bytes ({:.1%})'.format(name, size, percent) + yield ' {}: {:,} bytes ({:.1%})'.format(name, size, percent) if self.verbose: yield '' @@ -54,7 +55,7 @@ section_names = sorted(k for k in section_sizes.iterkeys() if k not in section_names) for name in section_names: - yield '{}: {:,} bytes'.format(name, section_sizes[name]) + yield ' {}: {:,} bytes'.format(name, section_sizes[name]) def _DescribeSymbol(self, sym): # SymbolGroups are passed here when we don't want to expand them. @@ -138,22 +139,43 @@ group_desc = self._DescribeSymbolGroup(diff, prefix_func=prefix_func) return itertools.chain((header_str,), group_desc) - def GenerateLines(self, obj): - if isinstance(obj, models.SizeInfo): - metadata_desc = 'Metadata: %s' % DescribeSizeInfoMetadata(obj) - section_desc = self._DescribeSectionSizes(obj.section_sizes) - group_desc = self.GenerateLines(obj.symbols) - return itertools.chain((metadata_desc,), section_desc, ('',), group_desc) + def _DescribeSizeInfoDiff(self, diff): + common_metadata = {k: v for k, v in diff.old_metadata.iteritems() + if diff.new_metadata[k] == v} + old_metadata = {k: v for k, v in diff.old_metadata.iteritems() + if k not in common_metadata} + new_metadata = {k: v for k, v in diff.new_metadata.iteritems() + if k not in common_metadata} + metadata_desc = itertools.chain( + ('Common Metadata:',), + (' %s' % line for line in DescribeMetadata(common_metadata)), + ('Old Metadata:',), + (' %s' % line for line in DescribeMetadata(old_metadata)), + ('New Metadata:',), + (' %s' % line for line in DescribeMetadata(new_metadata))) + section_desc = self._DescribeSectionSizes(diff.section_sizes) + group_desc = self.GenerateLines(diff.symbols) + return itertools.chain(metadata_desc, section_desc, ('',), group_desc) + def _DescribeSizeInfo(self, size_info): + metadata_desc = itertools.chain( + ('Metadata:',), + (' %s' % line for line in DescribeMetadata(size_info.metadata))) + section_desc = self._DescribeSectionSizes(size_info.section_sizes) + group_desc = self.GenerateLines(size_info.symbols) + return itertools.chain(metadata_desc, section_desc, ('',), group_desc) + + def GenerateLines(self, obj): + if isinstance(obj, models.SizeInfoDiff): + return self._DescribeSizeInfoDiff(obj) + if isinstance(obj, models.SizeInfo): + return self._DescribeSizeInfo(obj) if isinstance(obj, models.SymbolDiff): return self._DescribeSymbolDiff(obj) - if isinstance(obj, models.SymbolGroup): return self._DescribeSymbolGroup(obj) - if isinstance(obj, models.Symbol): return self._DescribeSymbol(obj) - return (repr(obj),) @@ -199,14 +221,17 @@ return utc + offset -def DescribeSizeInfoMetadata(size_info): - display_dict = size_info.metadata.copy() +def DescribeMetadata(metadata): + display_dict = metadata.copy() timestamp = display_dict.get(models.METADATA_ELF_MTIME) if timestamp: timestamp_obj = datetime.datetime.utcfromtimestamp(timestamp) display_dict[models.METADATA_ELF_MTIME] = ( _UtcToLocal(timestamp_obj).strftime('%Y-%m-%d %H:%M:%S')) - return ' '.join(sorted('%s=%s' % t for t in display_dict.iteritems())) + gn_args = display_dict.get(models.METADATA_GN_ARGS) + if gn_args: + display_dict[models.METADATA_GN_ARGS] = '; '.join(gn_args) + return sorted('%s=%s' % t for t in display_dict.iteritems()) def GenerateLines(obj, verbose=False):
diff --git a/tools/binary_size/integration_test.py b/tools/binary_size/integration_test.py index 32ac776..052242e 100755 --- a/tools/binary_size/integration_test.py +++ b/tools/binary_size/integration_test.py
@@ -87,6 +87,8 @@ def test_ActualDiff(self): map1 = self._CloneSizeInfo() map2 = self._CloneSizeInfo() + map1.metadata = {"foo": 1, "bar": [1,2,3], "baz": "yes"} + map2.metadata = {"foo": 1, "bar": [1,3], "baz": "yes"} map1.symbols -= map1.symbols[0] map2.symbols -= map2.symbols[-1] map1.symbols[1].size -= 10
diff --git a/tools/binary_size/map2size.py b/tools/binary_size/map2size.py index 7ed0f92..205baffd 100755 --- a/tools/binary_size/map2size.py +++ b/tools/binary_size/map2size.py
@@ -288,6 +288,19 @@ return section_sizes +def _ParseGnArgs(args_path): + """Returns a list of normalized "key=value" strings.""" + args = {} + with open(args_path) as f: + for l in f: + # Strips #s even if within string literal. Not a problem in practice. + parts = l.split('#')[0].split('=') + if len(parts) != 2: + continue + args[parts[0].strip()] = parts[1].strip() + return ["%s=%s" % x for x in sorted(args.iteritems())] + + def main(argv): parser = argparse.ArgumentParser(argv) parser.add_argument('elf_file', help='Path to input ELF file.') @@ -322,6 +335,7 @@ timestamp_obj = datetime.datetime.utcfromtimestamp(os.path.getmtime( args.elf_file)) timestamp = calendar.timegm(timestamp_obj.timetuple()) + gn_args = _ParseGnArgs(os.path.join(lazy_paths.output_directory, 'args.gn')) def relative_to_out(path): return os.path.relpath(path, lazy_paths.VerifyOutputDirectory()) @@ -332,6 +346,7 @@ models.METADATA_ELF_FILENAME: relative_to_out(args.elf_file), models.METADATA_ELF_MTIME: timestamp, models.METADATA_ELF_BUILD_ID: build_id, + models.METADATA_GN_ARGS: gn_args, } size_info = Analyze(map_file_path, lazy_paths) @@ -346,8 +361,8 @@ size_info.metadata = metadata - logging.info('Recording metadata: %s', - describe.DescribeSizeInfoMetadata(size_info)) + logging.info('Recording metadata: \n %s', + '\n '.join(describe.DescribeMetadata(size_info.metadata))) logging.info('Saving result to %s', args.output_file) file_format.SaveSizeInfo(size_info, args.output_file) logging.info('Done')
diff --git a/tools/binary_size/models.py b/tools/binary_size/models.py index 4461492..9a422e96 100644 --- a/tools/binary_size/models.py +++ b/tools/binary_size/models.py
@@ -31,10 +31,12 @@ METADATA_GIT_REVISION = 'git_revision' -METADATA_MAP_FILENAME = 'map_file_name' -METADATA_ELF_FILENAME = 'elf_file_name' +METADATA_MAP_FILENAME = 'map_file_name' # Path relative to output_directory. +METADATA_ELF_FILENAME = 'elf_file_name' # Path relative to output_directory. METADATA_ELF_MTIME = 'elf_mtime' # int timestamp in utc. METADATA_ELF_BUILD_ID = 'elf_build_id' +METADATA_GN_ARGS = 'gn_args' + SECTION_TO_SECTION_NAME = { 'b': '.bss', @@ -49,7 +51,7 @@ Fields: section_sizes: A dict of section_name -> size. - symbols: A SymbolGroup (or SymbolDiff) with all symbols in it. + symbols: A SymbolGroup with all symbols in it. metadata: A dict. """ __slots__ = ( @@ -65,6 +67,29 @@ self.metadata = metadata or {} +class SizeInfoDiff(object): + """What you get when you Diff() two SizeInfo objects. + + Fields: + section_sizes: A dict of section_name -> size delta. + symbols: A SymbolDiff with all symbols in it. + old_metadata: metadata of the "old" SizeInfo. + new_metadata: metadata of the "new" SizeInfo. + """ + __slots__ = ( + 'section_sizes', + 'symbols', + 'old_metadata', + 'new_metadata', + ) + + def __init__(self, section_sizes, symbols, old_metadata, new_metadata): + self.section_sizes = section_sizes + self.symbols = symbols + self.old_metadata = old_metadata + self.new_metadata = new_metadata + + class BaseSymbol(object): """Base class for Symbol and SymbolGroup. @@ -547,9 +572,7 @@ def Diff(new, old): """Diffs two SizeInfo or SymbolGroup objects. - When diffing SizeInfos, ret.section_sizes are the result of |new| - |old|, and - ret.symbols will be a SymbolDiff. - + When diffing SizeInfos, a SizeInfoDiff is returned. When diffing SymbolGroups, a SymbolDiff is returned. Returns: @@ -561,7 +584,7 @@ section_sizes = { k:new.section_sizes[k] - v for k, v in old.section_sizes.iteritems()} symbol_diff = Diff(new.symbols, old.symbols) - return SizeInfo(section_sizes, symbol_diff) + return SizeInfoDiff(section_sizes, symbol_diff, old.metadata, new.metadata) assert isinstance(new, SymbolGroup) and isinstance(old, SymbolGroup) symbols_by_key = collections.defaultdict(list)
diff --git a/tools/binary_size/testdata/ActualDiff.golden b/tools/binary_size/testdata/ActualDiff.golden index d46c125..d7fe08ad 100644 --- a/tools/binary_size/testdata/ActualDiff.golden +++ b/tools/binary_size/testdata/ActualDiff.golden
@@ -1,46 +1,53 @@ -Metadata: +Common Metadata: + baz=yes + foo=1 +Old Metadata: + bar=[1, 3] +New Metadata: + bar=[1, 2, 3] + Section Sizes (Total=0 bytes): -.bss: 0 bytes (not included in totals) -.data: 0 bytes (0.0%) -.data.rel.ro: 0 bytes (0.0%) -.data.rel.ro.local: 0 bytes (0.0%) -.rodata: 0 bytes (0.0%) -.text: 0 bytes (0.0%) + .bss: 0 bytes (not included in totals) + .data: 0 bytes (0.0%) + .data.rel.ro: 0 bytes (0.0%) + .data.rel.ro.local: 0 bytes (0.0%) + .rodata: 0 bytes (0.0%) + .text: 0 bytes (0.0%) Other section sizes: -.ARM.attributes: 0 bytes -.ARM.exidx: 0 bytes -.ARM.extab: 0 bytes -.comment: 0 bytes -.debug_abbrev: 0 bytes -.debug_aranges: 0 bytes -.debug_frame: 0 bytes -.debug_info: 0 bytes -.debug_line: 0 bytes -.debug_loc: 0 bytes -.debug_pubnames: 0 bytes -.debug_pubtypes: 0 bytes -.debug_ranges: 0 bytes -.debug_str: 0 bytes -.dynamic: 0 bytes -.dynstr: 0 bytes -.dynsym: 0 bytes -.fini_array: 0 bytes -.gnu.version: 0 bytes -.gnu.version_d: 0 bytes -.gnu.version_r: 0 bytes -.got: 0 bytes -.hash: 0 bytes -.init_array: 0 bytes -.interp: 0 bytes -.note.gnu.build-id: 0 bytes -.note.gnu.gold-version: 0 bytes -.plt: 0 bytes -.rel.dyn: 0 bytes -.rel.plt: 0 bytes -.shstrtab: 0 bytes -.strtab: 0 bytes -.symtab: 0 bytes + .ARM.attributes: 0 bytes + .ARM.exidx: 0 bytes + .ARM.extab: 0 bytes + .comment: 0 bytes + .debug_abbrev: 0 bytes + .debug_aranges: 0 bytes + .debug_frame: 0 bytes + .debug_info: 0 bytes + .debug_line: 0 bytes + .debug_loc: 0 bytes + .debug_pubnames: 0 bytes + .debug_pubtypes: 0 bytes + .debug_ranges: 0 bytes + .debug_str: 0 bytes + .dynamic: 0 bytes + .dynstr: 0 bytes + .dynsym: 0 bytes + .fini_array: 0 bytes + .gnu.version: 0 bytes + .gnu.version_d: 0 bytes + .gnu.version_r: 0 bytes + .got: 0 bytes + .hash: 0 bytes + .init_array: 0 bytes + .interp: 0 bytes + .note.gnu.build-id: 0 bytes + .note.gnu.gold-version: 0 bytes + .plt: 0 bytes + .rel.dyn: 0 bytes + .rel.plt: 0 bytes + .shstrtab: 0 bytes + .strtab: 0 bytes + .symtab: 0 bytes 1 symbols added (+), 1 changed (~), 1 removed (-), 42 unchanged (=) Showing 45 symbols with total size: 0 bytes
diff --git a/tools/binary_size/testdata/ConsoleNullDiff.golden b/tools/binary_size/testdata/ConsoleNullDiff.golden index 0602726..263f9c4 100644 --- a/tools/binary_size/testdata/ConsoleNullDiff.golden +++ b/tools/binary_size/testdata/ConsoleNullDiff.golden
@@ -1,11 +1,14 @@ -Metadata: +Common Metadata: +Old Metadata: +New Metadata: + Section Sizes (Total=0 bytes): -.bss: 0 bytes (not included in totals) -.data: 0 bytes (0.0%) -.data.rel.ro: 0 bytes (0.0%) -.data.rel.ro.local: 0 bytes (0.0%) -.rodata: 0 bytes (0.0%) -.text: 0 bytes (0.0%) + .bss: 0 bytes (not included in totals) + .data: 0 bytes (0.0%) + .data.rel.ro: 0 bytes (0.0%) + .data.rel.ro.local: 0 bytes (0.0%) + .rodata: 0 bytes (0.0%) + .text: 0 bytes (0.0%) 0 symbols added (+), 0 changed (~), 0 removed (-), 45 unchanged (not shown) Showing 0 symbols with total size: 0 bytes
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 6f3715b..9cd079e 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -237,6 +237,7 @@ 'Android Release (Nexus 6P)': 'android_release_trybot_arm64', 'Android Release (Nexus 9)': 'android_release_trybot_arm64', 'Android Release (Pixel C)': 'android_release_trybot_arm64', + 'Android Release (NVIDIA Shield TV)': 'android_release_trybot_arm64', 'GPU Linux Builder (dbg)': 'gpu_fyi_tests_debug_trybot', 'GPU Linux Builder': 'gpu_fyi_tests_release_trybot', 'GPU Mac Builder': 'gpu_fyi_tests_release_trybot',
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 86275e44..790748cf 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -44883,6 +44883,8 @@ <histogram name="Omnibox.SuggestionUsed.Search.Experimental.ForegroundToFirstMeaningfulPaint.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from the page first appearing in the foreground to its first meaningful paint. Only recorded on navigations that use a prerender @@ -44893,6 +44895,8 @@ <histogram name="Omnibox.SuggestionUsed.Search.Experimental.NavigationToFirstMeaningfulPaint" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from navigation start to first meaningful paint. Only recorded for a search query suggestion selected from the omnibox. @@ -44902,6 +44906,8 @@ <histogram name="Omnibox.SuggestionUsed.Search.ForegroundToFirstContentfulPaint.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from the page first appearing in the foreground to its first contentful paint. Only recorded on navigations that use a prerender @@ -44912,6 +44918,8 @@ <histogram name="Omnibox.SuggestionUsed.Search.NavigationToFirstContentfulPaint" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from navigation start to first contentful paint. Only recorded for a search query suggestion selected from the omnibox. @@ -44921,6 +44929,8 @@ <histogram name="Omnibox.SuggestionUsed.Search.NavigationToFirstForeground.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from a page being navigated to in prerender to it first showing up in foreground. Only recorded on navigations that used a prerender @@ -44941,6 +44951,8 @@ <histogram name="Omnibox.SuggestionUsed.URL.Experimental.ForegroundToFirstMeaningfulPaint.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from the page first appearing in the foreground to its first meaningful paint. Only recorded on navigations that use a prerender @@ -44951,6 +44963,8 @@ <histogram name="Omnibox.SuggestionUsed.URL.Experimental.NavigationToFirstMeaningfulPaint" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from navigation start to first meaningful paint. Only recorded for a URL suggestion selected from the omnibox. @@ -44960,6 +44974,8 @@ <histogram name="Omnibox.SuggestionUsed.URL.ForegroundToFirstContentfulPaint.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from the page first appearing in the foreground to its first contentful paint. Only recorded on navigations that use a prerender @@ -44969,6 +44985,8 @@ <histogram name="Omnibox.SuggestionUsed.URL.NavigationToFirstContentfulPaint" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from navigation start to first contentful paint. Only recorded for a URL suggestion selected from the omnibox. @@ -44978,6 +44996,8 @@ <histogram name="Omnibox.SuggestionUsed.URL.NavigationToFirstForeground.Prerender" units="ms"> + <owner>lpy@chromium.org</owner> + <owner>mpearson@chromium.org</owner> <summary> Measures the time from a page being navigated to in prerender to it first showing up in foreground. Only recorded on navigations that used a prerender @@ -101355,6 +101375,7 @@ <int value="938191241" label="VrShell:enabled"/> <int value="939554480" label="enable-credit-card-scan"/> <int value="939603162" label="BackgroundLoadingForDownloads:disabled"/> + <int value="941036016" label="ContentSuggestionsSettings:disabled"/> <int value="943319566" label="enable-intent-picker"/> <int value="952558794" label="enable-remote-assistance"/> <int value="980396200" label="enable-new-korean-ime"/> @@ -101525,6 +101546,7 @@ <int value="1579461102" label="MemoryCoordinator:disabled"/> <int value="1586022426" label="AutofillCreditCardAssist:enabled"/> <int value="1589341623" label="disable-easy-unlock"/> + <int value="1594247626" label="ContentSuggestionsSettings:enabled"/> <int value="1605611615" label="enable-webrtc-srtp-aes-gcm"/> <int value="1612446645" label="enable-weak-memorycache"/> <int value="1612871297" label="WebPayments:disabled"/>
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py index 8d5ac93..38a58b7 100644 --- a/tools/perf/page_sets/system_health/browsing_stories.py +++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -131,10 +131,6 @@ ITEM_SCROLL_REPEAT = 4 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY - @classmethod - def ShouldDisable(cls, possible_browser): - return possible_browser.platform.IsSvelte() # crbug.com/668097 - class FlipboardDesktopStory(_NewsBrowsingStory): NAME = 'browse:news:flipboard'
diff --git a/ui/android/java/src/org/chromium/ui/interpolators/BakedBezierInterpolator.java b/ui/android/java/src/org/chromium/ui/interpolators/BakedBezierInterpolator.java index bffcb48..68becd05 100644 --- a/ui/android/java/src/org/chromium/ui/interpolators/BakedBezierInterpolator.java +++ b/ui/android/java/src/org/chromium/ui/interpolators/BakedBezierInterpolator.java
@@ -159,5 +159,4 @@ return mValues[position] + weight * (mValues[position + 1] - mValues[position]); } - -} \ No newline at end of file +}
diff --git a/ui/arc/notification/arc_notification_manager.cc b/ui/arc/notification/arc_notification_manager.cc index 5d421c3..f25d8f7d 100644 --- a/ui/arc/notification/arc_notification_manager.cc +++ b/ui/arc/notification/arc_notification_manager.cc
@@ -273,12 +273,12 @@ base::UTF8ToUTF16(data->text.has_value() ? *data->text : std::string())); const base::string16 dismiss_text16(base::UTF8ToUTF16( data->dismiss_text.has_value() ? *data->dismiss_text : std::string())); - ash::Shell::GetInstance()->toast_manager()->Show( + ash::Shell::Get()->toast_manager()->Show( ash::ToastData(data->id, text16, data->duration, dismiss_text16)); } void ArcNotificationManager::OnToastCancelled(mojom::ArcToastDataPtr data) { - ash::Shell::GetInstance()->toast_manager()->Cancel(data->id); + ash::Shell::Get()->toast_manager()->Cancel(data->id); } } // namespace arc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index 865504a..bc3639c 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -2202,9 +2202,15 @@ DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter); }; +// https://crbug.com/709080 +#if defined(OS_WIN) +#define MAYBE_ReportMetrics DISABLED_ReportMetrics +#else +#define MAYBE_ReportMetrics ReportMetrics +#endif // Starts an animation and tests that incrementing compositor frame count can // be used to report animation smoothness metrics. -TEST_F(LayerWithRealCompositorTest, ReportMetrics) { +TEST_F(LayerWithRealCompositorTest, MAYBE_ReportMetrics) { std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR)); GetCompositor()->SetRootLayer(root.get()); LayerAnimator* animator = root->GetAnimator();
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc index 321497f..ca73fa6 100644 --- a/ui/events/blink/input_handler_proxy.cc +++ b/ui/events/blink/input_handler_proxy.cc
@@ -244,8 +244,10 @@ namespace ui { -InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, - InputHandlerProxyClient* client) +InputHandlerProxy::InputHandlerProxy( + cc::InputHandler* input_handler, + InputHandlerProxyClient* client, + bool touchpad_and_wheel_scroll_latching_enabled) : client_(client), input_handler_(input_handler), deferred_fling_cancel_time_seconds_(0), @@ -262,14 +264,16 @@ has_fling_animation_started_(false), smooth_scroll_enabled_(false), uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), - touchpad_and_wheel_scroll_latching_enabled_(false), + touchpad_and_wheel_scroll_latching_enabled_( + touchpad_and_wheel_scroll_latching_enabled), touch_start_result_(kEventDispositionUndefined), mouse_wheel_result_(kEventDispositionUndefined), current_overscroll_params_(nullptr), has_ongoing_compositor_scroll_fling_pinch_(false), tick_clock_(base::MakeUnique<base::DefaultTickClock>()) { DCHECK(client); - input_handler_->BindToClient(this); + input_handler_->BindToClient(this, + touchpad_and_wheel_scroll_latching_enabled_); cc::ScrollElasticityHelper* scroll_elasticity_helper = input_handler_->CreateScrollElasticityHelper(); if (scroll_elasticity_helper) { @@ -1498,6 +1502,7 @@ input_handler_->GetEventListenerProperties( cc::EventListenerClass::kMouseWheel); switch (properties) { + case cc::EventListenerProperties::kBlockingAndPassive: case cc::EventListenerProperties::kBlocking: disposition = DID_NOT_HANDLE; break;
diff --git a/ui/events/blink/input_handler_proxy.h b/ui/events/blink/input_handler_proxy.h index 0825d273..268c3d7 100644 --- a/ui/events/blink/input_handler_proxy.h +++ b/ui/events/blink/input_handler_proxy.h
@@ -52,9 +52,9 @@ public SynchronousInputHandlerProxy, public NON_EXPORTED_BASE(blink::WebGestureCurveTarget) { public: - InputHandlerProxy(cc::InputHandler* input_handler, - InputHandlerProxyClient* client); + InputHandlerProxyClient* client, + bool touchpad_and_wheel_scroll_latching_enabled); ~InputHandlerProxy() override; InputScrollElasticityController* scroll_elasticity_controller() { @@ -62,9 +62,6 @@ } void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; } - void set_touchpad_and_wheel_scroll_latching_enabled(bool value) { - touchpad_and_wheel_scroll_latching_enabled_ = value; - } enum EventDisposition { DID_HANDLE, @@ -240,7 +237,7 @@ bool smooth_scroll_enabled_; bool uma_latency_reporting_enabled_; - bool touchpad_and_wheel_scroll_latching_enabled_; + const bool touchpad_and_wheel_scroll_latching_enabled_; // The merged result of the last touch start with previous touch starts. // This value will get returned for subsequent TouchMove events to allow
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc index 0df72e0..c3515978 100644 --- a/ui/events/blink/input_handler_proxy_unittest.cc +++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -200,7 +200,8 @@ bool ScrollingShouldSwitchtoMainThread() override { return false; } - void BindToClient(cc::InputHandlerClient* client) override {} + void BindToClient(cc::InputHandlerClient* client, + bool touchpad_and_wheel_scroll_latching_enabled) override {} void MouseDown() override {} void MouseUp() override {} @@ -353,8 +354,11 @@ class TestInputHandlerProxy : public InputHandlerProxy { public: TestInputHandlerProxy(cc::InputHandler* input_handler, - InputHandlerProxyClient* client) - : InputHandlerProxy(input_handler, client) {} + InputHandlerProxyClient* client, + bool touchpad_and_wheel_scroll_latching_enabled) + : InputHandlerProxy(input_handler, + client, + touchpad_and_wheel_scroll_latching_enabled) {} void RecordMainThreadScrollingReasonsForTest(blink::WebGestureDevice device, uint32_t reasons) { RecordMainThreadScrollingReasons(device, reasons); @@ -374,8 +378,7 @@ GetParam() == CHILD_SCROLL_SYNCHRONOUS_HANDLER), expected_disposition_(InputHandlerProxy::DID_HANDLE) { input_handler_.reset( - new TestInputHandlerProxy( - &mock_input_handler_, &mock_client_)); + new TestInputHandlerProxy(&mock_input_handler_, &mock_client_, false)); scroll_result_did_scroll_.did_scroll = true; scroll_result_did_not_scroll_.did_scroll = false; @@ -473,10 +476,6 @@ input_handler_->smooth_scroll_enabled_ = value; } - void SetTouchpadAndWheelScrollLatchingEnabled(bool value) { - input_handler_->touchpad_and_wheel_scroll_latching_enabled_ = value; - } - base::HistogramTester& histogram_tester() { return histogram_tester_; } @@ -507,7 +506,7 @@ void SetUp() override { event_disposition_recorder_.clear(); input_handler_proxy_ = base::MakeUnique<TestInputHandlerProxy>( - &mock_input_handler_, &mock_client_); + &mock_input_handler_, &mock_client_, false); if (input_handler_proxy_->compositor_event_queue_) input_handler_proxy_->compositor_event_queue_ = base::MakeUnique<CompositorThreadEventQueue>(); @@ -615,6 +614,19 @@ VERIFY_AND_RESET_MOCKS(); } +TEST_P(InputHandlerProxyTest, MouseWheelBlockingAndPassiveListener) { + expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; + EXPECT_CALL(mock_input_handler_, + GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) + .WillOnce( + testing::Return(cc::EventListenerProperties::kBlockingAndPassive)); + + WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey, + WebInputEvent::TimeStampForTesting); + EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel)); + VERIFY_AND_RESET_MOCKS(); +} + TEST_P(InputHandlerProxyTest, GestureScrollStarted) { // We shouldn't send any events to the widget for this gesture. expected_disposition_ = InputHandlerProxy::DID_HANDLE; @@ -969,7 +981,16 @@ } TEST_P(InputHandlerProxyTest, GestureFlingTouchpadScrollLatchingEnabled) { - SetTouchpadAndWheelScrollLatchingEnabled(true); + // Reset the input_handler_ with wheel scroll latching enabled. + input_handler_.reset( + new TestInputHandlerProxy(&mock_input_handler_, &mock_client_, true)); + if (install_synchronous_handler_) { + EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler()) + .Times(1); + input_handler_->SetOnlySynchronouslyAnimateRootFlings( + &mock_synchronous_input_handler_); + } + // We shouldn't send any events to the widget for this gesture. expected_disposition_ = InputHandlerProxy::DID_HANDLE; VERIFY_AND_RESET_MOCKS(); @@ -2927,8 +2948,7 @@ testing::StrictMock<MockInputHandlerProxyClientWithDidAnimateForInput> mock_client; input_handler_.reset( - new TestInputHandlerProxy( - &mock_input_handler_, &mock_client)); + new TestInputHandlerProxy(&mock_input_handler_, &mock_client, false)); if (install_synchronous_handler_) { EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler()) .Times(1); @@ -2962,7 +2982,7 @@ testing::StrictMock<MockInputHandlerProxyClient> mock_client; testing::StrictMock<MockSynchronousInputHandler> mock_synchronous_input_handler; - ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client); + ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client, false); // When adding a SynchronousInputHandler, immediately request an // UpdateRootLayerStateForSynchronousInputHandler() call. @@ -2988,7 +3008,7 @@ testing::StrictMock<MockInputHandlerProxyClient> mock_client; testing::StrictMock<MockSynchronousInputHandler> mock_synchronous_input_handler; - ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client); + ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client, false); proxy.SetOnlySynchronouslyAnimateRootFlings(&mock_synchronous_input_handler); @@ -3013,7 +3033,7 @@ testing::StrictMock<MockInputHandlerProxyClient> mock_client; testing::StrictMock<MockSynchronousInputHandler> mock_synchronous_input_handler; - ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client); + ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client, false); proxy.SetOnlySynchronouslyAnimateRootFlings(&mock_synchronous_input_handler);