diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-25 00:41:50 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-25 00:41:50 +0000 |
commit | 42713f747e45ec2d4d754f449ba8a0edf5deffe6 (patch) | |
tree | a278abbd3cf1496c36793168ab27a0d43eb6cd55 /ash | |
parent | 07f1c36a10e6a5dffb01ea324bc8ca8d11b9653f (diff) | |
download | chromium_src-42713f747e45ec2d4d754f449ba8a0edf5deffe6.zip chromium_src-42713f747e45ec2d4d754f449ba8a0edf5deffe6.tar.gz chromium_src-42713f747e45ec2d4d754f449ba8a0edf5deffe6.tar.bz2 |
Rename GetRootWindow() -> GetPrimaryRootWindow()
BUG=123160
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10442017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
47 files changed, 205 insertions, 193 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 2ee47e7..df8ce13 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -122,12 +122,12 @@ bool HandleRotateScreen() { case 13: delta = 180; break; } i = (i + 1) % 14; - ash::Shell::GetRootWindow()->layer()->GetAnimator()-> + ash::Shell::GetPrimaryRootWindow()->layer()->GetAnimator()-> set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); scoped_ptr<ui::LayerAnimationSequence> screen_rotation( new ui::LayerAnimationSequence(new ui::ScreenRotation(delta))); - screen_rotation->AddObserver(ash::Shell::GetRootWindow()); - ash::Shell::GetRootWindow()->layer()->GetAnimator()->StartAnimation( + screen_rotation->AddObserver(ash::Shell::GetPrimaryRootWindow()); + ash::Shell::GetPrimaryRootWindow()->layer()->GetAnimator()->StartAnimation( screen_rotation.release()); return true; } @@ -144,12 +144,12 @@ bool HandleToggleDesktopBackgroundMode() { } bool HandleToggleRootWindowFullScreen() { - ash::Shell::GetRootWindow()->ToggleFullScreen(); + ash::Shell::GetPrimaryRootWindow()->ToggleFullScreen(); return true; } bool HandlePrintLayerHierarchy() { - aura::RootWindow* root_window = ash::Shell::GetRootWindow(); + aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); ui::PrintLayerHierarchy(root_window->layer(), root_window->last_mouse_location()); return true; @@ -319,7 +319,7 @@ bool AcceleratorController::AcceleratorPressed( return HandleNewWindow(false /* is_incognito */); case TAKE_SCREENSHOT: if (screenshot_delegate_.get()) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); screenshot_delegate_->HandleTakeScreenshot(root_window); } // Return true to prevent propagation of the key event. diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 54b6f82..67921c3 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -383,15 +383,15 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { #if defined(OS_WIN) MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; aura::TranslatedKeyEvent key_event1(msg1, false); - EXPECT_TRUE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event1)); + EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1)); MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; aura::TranslatedKeyEvent key_event2(msg2, true); - EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event2)); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2)); MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; aura::TranslatedKeyEvent key_event3(msg3, false); - EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event3)); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3)); #elif defined(USE_X11) XEvent key_event; ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, @@ -399,17 +399,17 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { 0, &key_event); aura::TranslatedKeyEvent key_event1(&key_event, false); - EXPECT_TRUE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event1)); + EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1)); aura::TranslatedKeyEvent key_event2(&key_event, true); - EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event2)); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2)); ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, ui::VKEY_A, 0, &key_event); aura::TranslatedKeyEvent key_event3(&key_event, false); - EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event3)); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3)); #endif EXPECT_EQ(1, target.accelerator_pressed_count()); } diff --git a/ash/accelerators/accelerator_filter.cc b/ash/accelerators/accelerator_filter.cc index bcecdfe2..21f8a41 100644 --- a/ash/accelerators/accelerator_filter.cc +++ b/ash/accelerators/accelerator_filter.cc @@ -21,7 +21,7 @@ const int kModifierFlagMask = (ui::EF_SHIFT_DOWN | bool ShouldProcessAcceleratorsNow(aura::Window* target) { if (!target) return true; - if (target == ash::Shell::GetInstance()->GetRootWindow()) + if (target == ash::Shell::GetPrimaryRootWindow()) return true; // Unless |target| is the root window, return false to let the custom focus // manager (see ash/shell.cc) handle Ash accelerators. diff --git a/ash/accelerators/accelerator_filter_unittest.cc b/ash/accelerators/accelerator_filter_unittest.cc index 7f3e44b..86a50fa 100644 --- a/ash/accelerators/accelerator_filter_unittest.cc +++ b/ash/accelerators/accelerator_filter_unittest.cc @@ -66,7 +66,7 @@ TEST_F(AcceleratorFilterTest, TestFilterWithoutFocus) { scoped_ptr<ScreenshotDelegate>(delegate).Pass()); EXPECT_EQ(0, delegate->handle_take_screenshot_count()); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); // AcceleratorController calls ScreenshotDelegate::HandleTakeScreenshot() when // VKEY_PRINT is pressed. See kAcceleratorData[] in accelerator_controller.cc. generator.PressKey(ui::VKEY_PRINT, 0); @@ -94,7 +94,7 @@ TEST_F(AcceleratorFilterTest, TestFilterWithFocus) { // AcceleratorFilter should ignore the key events since the root window is // not focused. - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.PressKey(ui::VKEY_PRINT, 0); EXPECT_EQ(0, delegate->handle_take_screenshot_count()); generator.ReleaseKey(ui::VKEY_PRINT, 0); @@ -111,7 +111,7 @@ TEST_F(AcceleratorFilterTest, TestCapsLockMask) { scoped_ptr<ScreenshotDelegate>(delegate).Pass()); EXPECT_EQ(0, delegate->handle_take_screenshot_count()); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.PressKey(ui::VKEY_PRINT, 0); EXPECT_EQ(1, delegate->handle_take_screenshot_count()); generator.ReleaseKey(ui::VKEY_PRINT, 0); diff --git a/ash/accelerators/nested_dispatcher_controller.cc b/ash/accelerators/nested_dispatcher_controller.cc index c08d7f4..085932f 100644 --- a/ash/accelerators/nested_dispatcher_controller.cc +++ b/ash/accelerators/nested_dispatcher_controller.cc @@ -10,7 +10,7 @@ namespace ash { NestedDispatcherController::NestedDispatcherController() { - aura::client::SetDispatcherClient(Shell::GetRootWindow(), this); + aura::client::SetDispatcherClient(Shell::GetPrimaryRootWindow(), this); } NestedDispatcherController::~NestedDispatcherController() { diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc index a9d5453..800a27d 100644 --- a/ash/accelerators/nested_dispatcher_controller_unittest.cc +++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc @@ -78,25 +78,25 @@ void DispatchKeyReleaseA() { // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details. #if defined(OS_WIN) MSG native_event_down = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; - ash::Shell::GetRootWindow()->PostNativeEvent(native_event_down); + ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(native_event_down); MSG native_event_up = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; - ash::Shell::GetRootWindow()->PostNativeEvent(native_event_up); + ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(native_event_up); #elif defined(USE_X11) XEvent native_event; ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, &native_event); - ash::Shell::GetRootWindow()->PostNativeEvent(&native_event); + ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(&native_event); ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, ui::VKEY_A, 0, &native_event); - ash::Shell::GetRootWindow()->PostNativeEvent(&native_event); + ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(&native_event); #endif // Send noop event to signal dispatcher to exit. - ash::Shell::GetRootWindow()->PostNativeEvent(ui::CreateNoopEvent()); + ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent()); } } // namespace @@ -113,7 +113,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) { Shell::GetInstance()->delegate()->LockScreen(); DispatchKeyReleaseA(); - aura::RootWindow* root_window = ash::Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( &inner_dispatcher, associated_window.get(), @@ -137,7 +137,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { mock_lock_container.get())); DispatchKeyReleaseA(); - aura::RootWindow* root_window = ash::Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( &inner_dispatcher, associated_window.get(), @@ -148,7 +148,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { // Test that the nested dispatcher handles accelerators. TEST_F(NestedDispatcherTest, AcceleratorsHandled) { MockDispatcher inner_dispatcher; - aura::RootWindow* root_window = ash::Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); accelerator.set_type(ui::ET_KEY_RELEASED); diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index e900fde..2c465cfb 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -38,7 +38,7 @@ typedef ash::test::AshTestBase DIPTest; TEST_F(DIPTest, MAYBE_WorkArea) { ChangeMonitorConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); - aura::RootWindow* root = Shell::GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); const gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(root); EXPECT_EQ("0,0 1000x900", monitor.bounds().ToString()); diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 46d1a55..3e4c270 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -42,7 +42,7 @@ DragDropController::DragDropController() drag_drop_in_progress_(false), should_block_during_drag_drop_(true) { Shell::GetInstance()->AddRootWindowEventFilter(this); - aura::client::SetDragDropClient(Shell::GetRootWindow(), this); + aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), this); } DragDropController::~DragDropController() { @@ -56,9 +56,10 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, const gfx::Point& root_location, int operation) { DCHECK(!drag_drop_in_progress_); - aura::Window* capture_window = Shell::GetRootWindow()->capture_window(); + aura::Window* capture_window = + Shell::GetPrimaryRootWindow()->capture_window(); if (capture_window) - Shell::GetRootWindow()->ReleaseCapture(capture_window); + Shell::GetPrimaryRootWindow()->ReleaseCapture(capture_window); drag_drop_in_progress_ = true; drag_data_ = &data; @@ -117,7 +118,7 @@ void DragDropController::DragUpdate(aura::Window* target, int op = delegate->OnDragUpdated(e); gfx::NativeCursor cursor = (op == ui::DragDropTypes::DRAG_NONE)? ui::kCursorNoDrop : ui::kCursorCopy; - Shell::GetRootWindow()->SetCursor(cursor); + Shell::GetPrimaryRootWindow()->SetCursor(cursor); } } @@ -130,7 +131,7 @@ void DragDropController::DragUpdate(aura::Window* target, void DragDropController::Drop(aura::Window* target, const aura::LocatedEvent& event) { - Shell::GetRootWindow()->SetCursor(ui::kCursorPointer); + Shell::GetPrimaryRootWindow()->SetCursor(ui::kCursorPointer); aura::client::DragDropDelegate* delegate = NULL; // We must guarantee that a target gets a OnDragEntered before Drop. WebKit @@ -159,7 +160,7 @@ void DragDropController::Drop(aura::Window* target, } void DragDropController::DragCancel() { - Shell::GetRootWindow()->SetCursor(ui::kCursorPointer); + Shell::GetPrimaryRootWindow()->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 9a6fdf6..33283db 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -182,7 +182,7 @@ views::Widget* CreateNewWidget() { params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; params.accept_events = true; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; - params.parent = Shell::GetRootWindow(); + params.parent = Shell::GetPrimaryRootWindow(); params.child = true; params.native_widget = new TestNativeWidgetAura(widget); widget->Init(params); @@ -216,13 +216,13 @@ class DragDropControllerTest : public AshTestBase { AshTestBase::SetUp(); drag_drop_controller_.reset(new TestDragDropController); drag_drop_controller_->set_should_block_during_drag_drop(false); - aura::client::SetDragDropClient(Shell::GetRootWindow(), + aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), drag_drop_controller_.get()); views_delegate_.reset(new views::TestViewsDelegate); } void TearDown() OVERRIDE { - aura::client::SetDragDropClient(Shell::GetRootWindow(), NULL); + aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), NULL); drag_drop_controller_.reset(); AshTestBase::TearDown(); } @@ -249,7 +249,7 @@ TEST_F(DragDropControllerTest, DragDropInSingleViewTest) { AddViewToWidgetAndResize(widget.get(), drag_view); ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget->GetNativeView()); generator.PressLeftButton(); @@ -295,7 +295,7 @@ TEST_F(DragDropControllerTest, DragDropWithZeroDragUpdates) { AddViewToWidgetAndResize(widget.get(), drag_view); ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget->GetNativeView()); generator.PressLeftButton(); @@ -337,7 +337,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) { ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseRelativeTo(widget->GetNativeView(), drag_view1->bounds().CenterPoint()); generator.PressLeftButton(); @@ -397,7 +397,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsMultipleWidgetsTest) { ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget1->GetNativeView()); generator.PressLeftButton(); @@ -449,7 +449,7 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) { ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseToCenterOf(widget->GetNativeView()); generator.PressLeftButton(); @@ -510,7 +510,7 @@ TEST_F(DragDropControllerTest, DragLeavesClipboardAloneTest) { DragTestView* drag_view = new DragTestView; AddViewToWidgetAndResize(widget.get(), drag_view); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget->GetNativeView()); ui::OSExchangeData data; std::string data_str("I am being dragged"); @@ -538,7 +538,7 @@ TEST_F(DragDropControllerTest, WindowDestroyedDuringDragDrop) { ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget->GetNativeView()); generator.PressLeftButton(); @@ -582,7 +582,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { AddViewToWidgetAndResize(widget.get(), drag_view); ui::OSExchangeData data; data.SetString(UTF8ToUTF16("I am being dragged")); - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), widget->GetNativeView()); generator.PressLeftButton(); @@ -602,7 +602,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, mouse_move_location, 0); - Shell::GetRootWindow()->DispatchMouseEvent(&mouse_move); + Shell::GetPrimaryRootWindow()->DispatchMouseEvent(&mouse_move); } generator.ReleaseLeftButton(); diff --git a/ash/high_contrast/high_contrast_controller.cc b/ash/high_contrast/high_contrast_controller.cc index b501fc9..debb81c 100644 --- a/ash/high_contrast/high_contrast_controller.cc +++ b/ash/high_contrast/high_contrast_controller.cc @@ -12,7 +12,7 @@ namespace ash { HighContrastController::HighContrastController() : enabled_(false) { - root_window_ = ash::Shell::GetRootWindow(); + root_window_ = ash::Shell::GetPrimaryRootWindow(); } void HighContrastController::SetEnabled(bool enabled) { diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index af07eae..bd79c5e 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -25,7 +25,7 @@ namespace internal { MagnificationController::MagnificationController() : scale_(1.0f), x_(0), y_(0) { - root_window_ = ash::Shell::GetRootWindow(); + root_window_ = ash::Shell::GetPrimaryRootWindow(); } void MagnificationController::SetScale(float scale) { diff --git a/ash/monitor/monitor_controller.cc b/ash/monitor/monitor_controller.cc index 486fde2..59c6b41 100644 --- a/ash/monitor/monitor_controller.cc +++ b/ash/monitor/monitor_controller.cc @@ -46,7 +46,7 @@ MonitorController::MonitorController() { MonitorController::~MonitorController() { aura::Env::GetInstance()->monitor_manager()->RemoveObserver(this); // Remove the root first. - int monitor_id = Shell::GetRootWindow()->GetProperty(kMonitorIdKey); + int monitor_id = Shell::GetPrimaryRootWindow()->GetProperty(kMonitorIdKey); DCHECK(monitor_id >= 0); root_windows_.erase(monitor_id); STLDeleteContainerPairSecondPointers( @@ -59,8 +59,8 @@ void MonitorController::OnMonitorBoundsChanged(const gfx::Monitor& monitor) { void MonitorController::OnMonitorAdded(const gfx::Monitor& monitor) { if (root_windows_.empty()) { - root_windows_[monitor.id()] = Shell::GetRootWindow(); - Shell::GetRootWindow()->SetHostBounds(monitor.bounds_in_pixel()); + root_windows_[monitor.id()] = Shell::GetPrimaryRootWindow(); + Shell::GetPrimaryRootWindow()->SetHostBounds(monitor.bounds_in_pixel()); return; } aura::RootWindow* root = aura::Env::GetInstance()->monitor_manager()-> @@ -73,10 +73,10 @@ void MonitorController::OnMonitorRemoved(const gfx::Monitor& monitor) { aura::RootWindow* root = root_windows_[monitor.id()]; DCHECK(root); // Primary monitor should never be removed by MonitorManager. - DCHECK(root != Shell::GetRootWindow()); + DCHECK(root != Shell::GetPrimaryRootWindow()); // Monitor for root window will be deleted when the Primary RootWindow // is deleted by the Shell. - if (root != Shell::GetRootWindow()) { + if (root != Shell::GetPrimaryRootWindow()) { root_windows_.erase(monitor.id()); delete root; } @@ -89,8 +89,8 @@ void MonitorController::Init() { const gfx::Monitor& monitor = monitor_manager->GetMonitorAt(i); if (i == 0) { // Primary monitor - root_windows_[monitor.id()] = Shell::GetRootWindow(); - Shell::GetRootWindow()->SetHostBounds(monitor.bounds_in_pixel()); + root_windows_[monitor.id()] = Shell::GetPrimaryRootWindow(); + Shell::GetPrimaryRootWindow()->SetHostBounds(monitor.bounds_in_pixel()); } else { aura::RootWindow* root = monitor_manager->CreateRootWindowForMonitor(monitor); diff --git a/ash/monitor/multi_monitor_manager_unittest.cc b/ash/monitor/multi_monitor_manager_unittest.cc index 60ea1ac..5ba3ebd 100644 --- a/ash/monitor/multi_monitor_manager_unittest.cc +++ b/ash/monitor/multi_monitor_manager_unittest.cc @@ -51,10 +51,10 @@ class MultiMonitorManagerTest : public test::AshTestBase, virtual void SetUp() OVERRIDE { AshTestBase::SetUp(); monitor_manager()->AddObserver(this); - Shell::GetRootWindow()->AddObserver(this); + Shell::GetPrimaryRootWindow()->AddObserver(this); } virtual void TearDown() OVERRIDE { - Shell::GetRootWindow()->RemoveObserver(this); + Shell::GetPrimaryRootWindow()->RemoveObserver(this); monitor_manager()->RemoveObserver(this); AshTestBase::TearDown(); } @@ -94,7 +94,7 @@ class MultiMonitorManagerTest : public test::AshTestBase, // aura::WindowObserver overrides: virtual void OnWindowDestroying(aura::Window* window) { - ASSERT_EQ(Shell::GetRootWindow(), window); + ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); root_window_destroyed_ = true; } diff --git a/ash/screensaver/screensaver_view.cc b/ash/screensaver/screensaver_view.cc index 858ae9c..f8a3bd3 100644 --- a/ash/screensaver/screensaver_view.cc +++ b/ash/screensaver/screensaver_view.cc @@ -113,7 +113,7 @@ void ScreensaverView::LoadScreensaver() { } void ScreensaverView::ShowWindow() { - aura::RootWindow* root_window = ash::Shell::GetRootWindow(); + aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); gfx::Rect screen_rect = gfx::Screen::GetMonitorNearestWindow(root_window).bounds(); diff --git a/ash/shell.cc b/ash/shell.cc index 9e10445..1655c79 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -572,7 +572,7 @@ Shell::~Shell() { // TooltipController is deleted with the Shell so removing its references. RemoveRootWindowEventFilter(tooltip_controller_.get()); - aura::client::SetTooltipClient(GetRootWindow(), NULL); + aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL); // Make sure we delete WorkspaceController before launcher is // deleted as it has a reference to launcher model. @@ -587,7 +587,7 @@ Shell::~Shell() { // Delete containers now so that child windows does not access // observers when they are destructed. - aura::RootWindow* root_window = GetRootWindow(); + aura::RootWindow* root_window = GetPrimaryRootWindow(); while (!root_window->children().empty()) { aura::Window* child = root_window->children()[0]; delete child; @@ -647,7 +647,7 @@ void Shell::DeleteInstance() { } // static -aura::RootWindow* Shell::GetRootWindow() { +aura::RootWindow* Shell::GetPrimaryRootWindow() { return GetInstance()->root_window_.get(); } @@ -656,7 +656,7 @@ void Shell::Init() { // Launcher, and WallPaper could be created by the factory. views::FocusManagerFactory::Install(new AshFocusManagerFactory); - aura::RootWindow* root_window = GetRootWindow(); + aura::RootWindow* root_window = GetPrimaryRootWindow(); root_filter_ = new aura::shared::RootWindowEventFilter(root_window); #if !defined(OS_MACOSX) nested_dispatcher_controller_.reset(new NestedDispatcherController); @@ -664,7 +664,7 @@ void Shell::Init() { #endif shell_context_menu_.reset(new internal::ShellContextMenu); // Pass ownership of the filter to the root window. - GetRootWindow()->SetEventFilter(root_filter_); + GetPrimaryRootWindow()->SetEventFilter(root_filter_); // KeyRewriterEventFilter must be the first one. DCHECK(!GetRootWindowEventFilterCount()); @@ -774,22 +774,22 @@ aura::Window* Shell::GetContainer(int container_id) { } const aura::Window* Shell::GetContainer(int container_id) const { - return GetRootWindow()->GetChildById(container_id); + return GetPrimaryRootWindow()->GetChildById(container_id); } void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { static_cast<aura::shared::RootWindowEventFilter*>( - GetRootWindow()->event_filter())->AddFilter(filter); + GetPrimaryRootWindow()->event_filter())->AddFilter(filter); } void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) { static_cast<aura::shared::RootWindowEventFilter*>( - GetRootWindow()->event_filter())->RemoveFilter(filter); + GetPrimaryRootWindow()->event_filter())->RemoveFilter(filter); } size_t Shell::GetRootWindowEventFilterCount() const { return static_cast<aura::shared::RootWindowEventFilter*>( - GetRootWindow()->event_filter())->GetFilterCount(); + GetPrimaryRootWindow()->event_filter())->GetFilterCount(); } void Shell::ShowBackgroundMenu(views::Widget* widget, diff --git a/ash/shell.h b/ash/shell.h index fa8c50d..12e7c15 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -133,8 +133,9 @@ class ASH_EXPORT Shell { static void DeleteInstance(); - // Gets the singleton RootWindow used by the Shell. - static aura::RootWindow* GetRootWindow(); + // Gets the primary RootWindow. The primary RootWindow is the root window + // that has a launcher. + static aura::RootWindow* GetPrimaryRootWindow(); internal::RootWindowLayoutManager* root_window_layout() const { return root_window_layout_; diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index 2ce1d23..c562f22 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -92,7 +92,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { ash::shell::InitWindowTypeLauncher(); - ash::Shell::GetRootWindow()->ShowRootWindow(); + ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); } void ShellBrowserMainParts::PostMainMessageLoopRun() { diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc index a604e89..3c90679 100644 --- a/ash/shell/lock_view.cc +++ b/ash/shell/lock_view.cc @@ -86,7 +86,7 @@ void CreateLockScreen() { views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); gfx::Size ps = lock_view->GetPreferredSize(); - gfx::Size root_window_size = Shell::GetRootWindow()->bounds().size(); + gfx::Size root_window_size = Shell::GetPrimaryRootWindow()->bounds().size(); params.bounds = gfx::Rect((root_window_size.width() - ps.width()) / 2, (root_window_size.height() - ps.height()) / 2, ps.width(), ps.height()); diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 88e8fd9..59d17c7 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -270,7 +270,7 @@ TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) { EXPECT_TRUE(launcher_widget->IsVisible()); // Launcher is at bottom-left of screen. EXPECT_EQ(0, launcher_widget->GetWindowScreenBounds().x()); - EXPECT_EQ(Shell::GetRootWindow()->GetHostSize().height(), + EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(), launcher_widget->GetWindowScreenBounds().bottom()); // We have a desktop background but not a bare layer. EXPECT_TRUE(test_api.root_window_layout()->background_widget()); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 46291f9..b4b39b4 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -30,7 +30,7 @@ void AshTestBase::SetUp() { ash::Shell::CreateInstance(delegate); helper_.SetUp(); - helper_.InitRootWindow(Shell::GetRootWindow()); + helper_.InitRootWindow(Shell::GetPrimaryRootWindow()); // Disable animations during tests. ui::LayerAnimator::set_disable_animations_for_test(true); @@ -57,7 +57,7 @@ void AshTestBase::ChangeMonitorConfig(float scale, } void AshTestBase::RunAllPendingInMessageLoop() { - helper_.RunAllPendingInMessageLoop(Shell::GetRootWindow()); + helper_.RunAllPendingInMessageLoop(Shell::GetPrimaryRootWindow()); } } // namespace test diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc index cd1edca..1036234 100644 --- a/ash/tooltips/tooltip_controller.cc +++ b/ash/tooltips/tooltip_controller.cc @@ -186,7 +186,7 @@ TooltipController::TooltipController() tooltip_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs), this, &TooltipController::TooltipTimerFired); - aura::client::SetTooltipClient(Shell::GetRootWindow(), this); + aura::client::SetTooltipClient(Shell::GetPrimaryRootWindow(), this); } TooltipController::~TooltipController() { @@ -373,7 +373,7 @@ void TooltipController::TooltipTimerFired() { void TooltipController::UpdateIfRequired() { if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || - !Shell::GetRootWindow()->cursor_shown()) { + !Shell::GetPrimaryRootWindow()->cursor_shown()) { tooltip_->Hide(); return; } @@ -419,7 +419,7 @@ bool TooltipController::IsTooltipVisible() { bool TooltipController::IsDragDropInProgress() { aura::client::DragDropClient* client = aura::client::GetDragDropClient( - Shell::GetRootWindow()); + Shell::GetPrimaryRootWindow()); if (client) return client->IsDragDropInProgress(); return false; diff --git a/ash/tooltips/tooltip_controller_unittest.cc b/ash/tooltips/tooltip_controller_unittest.cc index fb5333d..5cb972d5 100644 --- a/ash/tooltips/tooltip_controller_unittest.cc +++ b/ash/tooltips/tooltip_controller_unittest.cc @@ -47,7 +47,7 @@ views::Widget* CreateNewWidget() { params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; params.accept_events = true; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; - params.parent = Shell::GetRootWindow(); + params.parent = Shell::GetPrimaryRootWindow(); params.child = true; widget->Init(params); widget->Show(); @@ -71,7 +71,7 @@ void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) { ash::internal::TooltipController* GetController() { return static_cast<ash::internal::TooltipController*>( - aura::client::GetTooltipClient(Shell::GetRootWindow())); + aura::client::GetTooltipClient(Shell::GetPrimaryRootWindow())); } gfx::Font GetDefaultFont() { @@ -116,7 +116,8 @@ class TooltipControllerTest : public AshTestBase { }; TEST_F(TooltipControllerTest, NonNullTooltipClient) { - EXPECT_TRUE(aura::client::GetTooltipClient(Shell::GetRootWindow()) != NULL); + EXPECT_TRUE(aura::client::GetTooltipClient(Shell::GetPrimaryRootWindow()) + != NULL); EXPECT_EQ(string16(), GetTooltipText()); EXPECT_EQ(NULL, GetTooltipWindow()); EXPECT_FALSE(IsTooltipVisible()); @@ -129,11 +130,11 @@ TEST_F(TooltipControllerTest, ViewTooltip) { view->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); EXPECT_EQ(string16(), GetTooltipText()); EXPECT_EQ(NULL, GetTooltipWindow()); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseToCenterOf(widget->GetNativeView()); aura::Window* window = widget->GetNativeView(); - EXPECT_EQ(window, Shell::GetRootWindow()->GetEventHandlerForPoint( + EXPECT_EQ(window, Shell::GetPrimaryRootWindow()->GetEventHandlerForPoint( generator.current_location())); string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); @@ -166,7 +167,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { aura::Window* window = widget->GetNativeView(); // Fire tooltip timer so tooltip becomes visible. - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseRelativeTo(window, view1->bounds().CenterPoint()); FireTooltipTimer(); @@ -175,7 +176,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { generator.MoveMouseBy(1, 0); EXPECT_TRUE(IsTooltipVisible()); EXPECT_EQ(window, - Shell::GetRootWindow()->GetEventHandlerForPoint( + Shell::GetPrimaryRootWindow()->GetEventHandlerForPoint( generator.current_location())); string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); @@ -186,7 +187,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { generator.MoveMouseBy(1, 0); EXPECT_FALSE(IsTooltipVisible()); EXPECT_EQ(window, - Shell::GetRootWindow()->GetEventHandlerForPoint( + Shell::GetPrimaryRootWindow()->GetEventHandlerForPoint( generator.current_location())); string16 expected_tooltip; // = "" EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); @@ -203,7 +204,7 @@ TEST_F(TooltipControllerTest, EnableOrDisableTooltips) { EXPECT_EQ(string16(), GetTooltipText()); EXPECT_EQ(NULL, GetTooltipWindow()); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseRelativeTo(widget->GetNativeView(), view->bounds().CenterPoint()); string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); @@ -233,7 +234,7 @@ TEST_F(TooltipControllerTest, HideTooltipWhenCursorHidden) { EXPECT_EQ(string16(), GetTooltipText()); EXPECT_EQ(NULL, GetTooltipWindow()); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseRelativeTo(widget->GetNativeView(), view->bounds().CenterPoint()); string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); @@ -243,12 +244,12 @@ TEST_F(TooltipControllerTest, HideTooltipWhenCursorHidden) { EXPECT_TRUE(IsTooltipVisible()); // Hide the cursor and check again. - Shell::GetRootWindow()->ShowCursor(false); + Shell::GetPrimaryRootWindow()->ShowCursor(false); FireTooltipTimer(); EXPECT_FALSE(IsTooltipVisible()); // Show the cursor and re-check. - Shell::GetRootWindow()->ShowCursor(true); + Shell::GetPrimaryRootWindow()->ShowCursor(true); FireTooltipTimer(); EXPECT_TRUE(IsTooltipVisible()); } diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc index e2cefe6..8507508 100644 --- a/ash/wm/activation_controller.cc +++ b/ash/wm/activation_controller.cc @@ -118,13 +118,13 @@ void StackTransientParentsBelowModalWindow(aura::Window* window) { ActivationController::ActivationController() : updating_activation_(false), ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)) { - aura::client::SetActivationClient(Shell::GetRootWindow(), this); + aura::client::SetActivationClient(Shell::GetPrimaryRootWindow(), this); aura::Env::GetInstance()->AddObserver(this); - Shell::GetRootWindow()->AddRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); } ActivationController::~ActivationController() { - Shell::GetRootWindow()->RemoveRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); aura::Env::GetInstance()->RemoveObserver(this); } @@ -165,7 +165,7 @@ void ActivationController::DeactivateWindow(aura::Window* window) { } aura::Window* ActivationController::GetActiveWindow() { - return Shell::GetRootWindow()->GetProperty( + return Shell::GetPrimaryRootWindow()->GetProperty( aura::client::kRootWindowActiveWindowKey); } @@ -196,7 +196,7 @@ void ActivationController::OnWindowDestroying(aura::Window* window) { // Clear the property before activating something else, since // ActivateWindow() will attempt to notify the window stored in this value // otherwise. - Shell::GetRootWindow()->ClearProperty( + Shell::GetPrimaryRootWindow()->ClearProperty( aura::client::kRootWindowActiveWindowKey); ActivateWindow(GetTopmostWindowToActivate(window)); } @@ -258,8 +258,8 @@ void ActivationController::ActivateWindowWithEvent(aura::Window* window, !window->Contains(window->GetFocusManager()->GetFocusedWindow())) { window->GetFocusManager()->SetFocusedWindow(window, event); } - Shell::GetRootWindow()->SetProperty(aura::client::kRootWindowActiveWindowKey, - window); + Shell::GetPrimaryRootWindow()->SetProperty( + aura::client::kRootWindowActiveWindowKey, window); // Invoke OnLostActive after we've changed the active window. That way if the // delegate queries for active state it doesn't think the window is still // active. diff --git a/ash/wm/activation_controller_unittest.cc b/ash/wm/activation_controller_unittest.cc index ad99e02..9a1e6f1 100644 --- a/ash/wm/activation_controller_unittest.cc +++ b/ash/wm/activation_controller_unittest.cc @@ -196,7 +196,7 @@ TEST_F(ActivationControllerTest, ClickOnMenu) { EXPECT_EQ(NULL, wm::GetActiveWindow()); // Clicking on an activatable window activtes the window. - aura::test::EventGenerator generator(Shell::GetRootWindow(), w1.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); generator.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); @@ -321,7 +321,7 @@ TEST_F(ActivationControllerTest, PreventFocusToNonActivatableWindow) { &wd, -1, gfx::Rect(50, 50), NULL)); // The RootWindow is a non-activatable parent. scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate( - &wd, -2, gfx::Rect(50, 50), Shell::GetRootWindow())); + &wd, -2, gfx::Rect(50, 50), Shell::GetPrimaryRootWindow())); scoped_ptr<aura::Window> w21(aura::test::CreateTestWindowWithDelegate( &wd, -21, gfx::Rect(50, 50), w2.get())); @@ -362,7 +362,7 @@ TEST_F(ActivationControllerTest, CanActivateWindowIteselfTest) // The RootWindow is a non-activatable parent. scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate( - &wd, -2, gfx::Rect(50, 50), Shell::GetRootWindow())); + &wd, -2, gfx::Rect(50, 50), Shell::GetPrimaryRootWindow())); scoped_ptr<aura::Window> w21(aura::test::CreateTestWindowWithDelegate( &wd, -21, gfx::Rect(50, 50), w2.get())); EXPECT_FALSE(wm::CanActivateWindow(w2.get())); diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index 831939a..2309491 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -30,13 +30,13 @@ class BaseLayoutManagerTest : public test::AshTestBase { virtual void SetUp() OVERRIDE { test::AshTestBase::SetUp(); Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetRootWindow(), + Shell::GetPrimaryRootWindow(), gfx::Insets(1, 2, 3, 4)); - Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); aura::Window* default_container = Shell::GetInstance()->GetContainer( internal::kShellWindowId_DefaultContainer); default_container->SetLayoutManager(new internal::BaseLayoutManager( - Shell::GetRootWindow())); + Shell::GetPrimaryRootWindow())); } aura::Window* CreateTestWindow(const gfx::Rect& bounds) { @@ -80,7 +80,7 @@ TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { ScreenAsh::GetMaximizedWindowBounds(window.get()); EXPECT_EQ(initial_work_area_bounds.ToString(), window->bounds().ToString()); // Enlarge the root window. We should still match the work area size. - Shell::GetRootWindow()->SetHostSize(gfx::Size(900, 700)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(900, 700)); EXPECT_EQ(ScreenAsh::GetMaximizedWindowBounds(window.get()).ToString(), window->bounds().ToString()); EXPECT_NE(initial_work_area_bounds.ToString(), @@ -110,7 +110,7 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) { gfx::Screen::GetMonitorNearestWindow(window.get()).bounds().ToString(), window->bounds().ToString()); // Enlarge the root window. We should still match the monitor size. - Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); EXPECT_EQ( gfx::Screen::GetMonitorNearestWindow(window.get()).bounds().ToString(), window->bounds().ToString()); @@ -135,20 +135,20 @@ TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) { EXPECT_LE(window->bounds().height(), work_area.height()); // Make the root window narrower than our window. - Shell::GetRootWindow()->SetHostSize(gfx::Size(300, 400)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 400)); work_area = gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); // Make the root window shorter than our window. - Shell::GetRootWindow()->SetHostSize(gfx::Size(300, 200)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 200)); work_area = gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); // Enlarging the root window does not change the window bounds. gfx::Rect old_bounds = window->bounds(); - Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); + Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); EXPECT_EQ(old_bounds.width(), window->bounds().width()); EXPECT_EQ(old_bounds.height(), window->bounds().height()); } diff --git a/ash/wm/panel_layout_manager.cc b/ash/wm/panel_layout_manager.cc index a1d1154..396d0b5 100644 --- a/ash/wm/panel_layout_manager.cc +++ b/ash/wm/panel_layout_manager.cc @@ -91,13 +91,13 @@ PanelLayoutManager::PanelLayoutManager(aura::Window* panel_container) views::View* content_view = new views::View; content_view->set_background(new CalloutWidgetBackground); callout_widget_->SetContentsView(content_view); - Shell::GetRootWindow()->AddObserver(this); + Shell::GetPrimaryRootWindow()->AddObserver(this); } PanelLayoutManager::~PanelLayoutManager() { if (launcher_) launcher_->RemoveIconObserver(this); - Shell::GetRootWindow()->RemoveObserver(this); + Shell::GetPrimaryRootWindow()->RemoveObserver(this); } void PanelLayoutManager::StartDragging(aura::Window* panel) { diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc index ce5a68f..3e492e2 100644 --- a/ash/wm/partial_screenshot_view.cc +++ b/ash/wm/partial_screenshot_view.cc @@ -53,7 +53,7 @@ void PartialScreenshotView::StartPartialScreenshot( widget->Init(params); widget->SetContentsView(view); - widget->SetBounds(Shell::GetRootWindow()->bounds()); + widget->SetBounds(Shell::GetPrimaryRootWindow()->bounds()); widget->GetNativeView()->SetName("PartialScreenshotView"); widget->StackAtTop(); widget->Show(); @@ -117,7 +117,7 @@ void PartialScreenshotView::OnMouseReleased(const views::MouseEvent& event) { is_dragging_ = false; if (screenshot_delegate_) { - aura::RootWindow *root_window = Shell::GetRootWindow(); + aura::RootWindow *root_window = Shell::GetPrimaryRootWindow(); screenshot_delegate_->HandleTakePartialScreenshot( root_window, root_window->bounds().Intersect(GetScreenshotRect())); } diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc index 1905219..a3f1493 100644 --- a/ash/wm/power_button_controller.cc +++ b/ash/wm/power_button_controller.cc @@ -72,7 +72,7 @@ const float kSlowCloseSizeRatio = 0.95f; // Returns the transform that should be applied to containers for the slow-close // animation. ui::Transform GetSlowCloseTransform() { - gfx::Size root_size = Shell::GetRootWindow()->bounds().size(); + gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size(); ui::Transform transform; transform.SetScale(kSlowCloseSizeRatio, kSlowCloseSizeRatio); transform.ConcatTranslate( @@ -84,7 +84,7 @@ ui::Transform GetSlowCloseTransform() { // Returns the transform that should be applied to containers for the fast-close // animation. ui::Transform GetFastCloseTransform() { - gfx::Size root_size = Shell::GetRootWindow()->bounds().size(); + gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size(); ui::Transform transform; transform.SetScale(0.0, 0.0); transform.ConcatTranslate(floor(0.5 * root_size.width() + 0.5), @@ -290,11 +290,11 @@ PowerButtonController::PowerButtonController() has_legacy_power_button_( CommandLine::ForCurrentProcess()->HasSwitch( switches::kAuraLegacyPowerButton)) { - Shell::GetInstance()->GetRootWindow()->AddRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); } PowerButtonController::~PowerButtonController() { - Shell::GetInstance()->GetRootWindow()->RemoveRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); } void PowerButtonController::OnLoginStateChanged(user::LoginStatus status) { @@ -309,7 +309,7 @@ void PowerButtonController::OnAppTerminating() { shutting_down_ = true; ash::Shell::GetInstance()->root_filter()-> set_update_cursor_visibility(false); - Shell::GetRootWindow()->ShowCursor(false); + Shell::GetPrimaryRootWindow()->ShowCursor(false); ShowBackgroundLayer(); StartAnimation(ALL_CONTAINERS, ANIMATION_HIDE); } @@ -533,7 +533,7 @@ void PowerButtonController::StartShutdownAnimationAndRequestShutdown() { shutting_down_ = true; ash::Shell::GetInstance()->root_filter()->set_update_cursor_visibility(false); - Shell::GetRootWindow()->ShowCursor(false); + Shell::GetPrimaryRootWindow()->ShowCursor(false); ShowBackgroundLayer(); if (login_status_ != user::LOGGED_IN_NONE) { @@ -562,7 +562,7 @@ void PowerButtonController::ShowBackgroundLayer() { background_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); background_layer_->SetColor(SK_ColorBLACK); - ui::Layer* root_layer = Shell::GetRootWindow()->layer(); + ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); background_layer_->SetBounds(root_layer->bounds()); root_layer->Add(background_layer_.get()); root_layer->StackAtBottom(background_layer_.get()); diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc index 3a326fa..e908d30 100644 --- a/ash/wm/power_button_controller_unittest.cc +++ b/ash/wm/power_button_controller_unittest.cc @@ -114,7 +114,7 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { test_api_->ContainerGroupIsAnimated( PowerButtonController::ALL_CONTAINERS, PowerButtonController::ANIMATION_FAST_CLOSE)); - EXPECT_FALSE(Shell::GetRootWindow()->cursor_shown()); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->cursor_shown()); EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); test_api_->trigger_real_shutdown_timeout(); EXPECT_EQ(1, delegate_->num_shutdown_requests()); @@ -481,7 +481,7 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) { PowerButtonController::ALL_CONTAINERS, PowerButtonController::ANIMATION_HIDE)); EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); - EXPECT_FALSE(Shell::GetRootWindow()->cursor_shown()); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->cursor_shown()); } // Test that we display the fast-close animation and shut down when we get an @@ -498,7 +498,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) { PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, PowerButtonController::ANIMATION_FAST_CLOSE)); EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); - EXPECT_FALSE(Shell::GetRootWindow()->cursor_shown()); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->cursor_shown()); EXPECT_EQ(0, delegate_->num_shutdown_requests()); EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); @@ -519,7 +519,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) { PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, PowerButtonController::ANIMATION_FAST_CLOSE)); EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); - EXPECT_FALSE(Shell::GetRootWindow()->cursor_shown()); + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->cursor_shown()); EXPECT_EQ(0, delegate_->num_shutdown_requests()); EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); @@ -530,11 +530,11 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) { // Test that the background layer is resized in response to root window resizes. TEST_F(PowerButtonControllerTest, ResizeBackgroundLayer) { controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); - EXPECT_EQ(Shell::GetRootWindow()->bounds().ToString(), + EXPECT_EQ(Shell::GetPrimaryRootWindow()->bounds().ToString(), test_api_->GetBackgroundLayerBounds().ToString()); const gfx::Size kNewSize(400, 300); - Shell::GetRootWindow()->SetHostSize(kNewSize); + Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize); EXPECT_EQ(gfx::Rect(kNewSize).ToString(), test_api_->GetBackgroundLayerBounds().ToString()); } diff --git a/ash/wm/root_window_event_filter_unittest.cc b/ash/wm/root_window_event_filter_unittest.cc index 3f39ab1..5f61056 100644 --- a/ash/wm/root_window_event_filter_unittest.cc +++ b/ash/wm/root_window_event_filter_unittest.cc @@ -76,7 +76,7 @@ TEST_F(RootWindowEventFilterTest, Focus) { Shell::GetInstance()->RemoveRootWindowEventFilter( shell_test.input_method_event_filter()); - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); root_window->SetBounds(gfx::Rect(0, 0, 510, 510)); // Supplied ids are negative so as not to collide with shell ids. @@ -108,7 +108,8 @@ TEST_F(RootWindowEventFilterTest, Focus) { SK_ColorGRAY, -13, gfx::Rect(5, 470, 50, 50), w1.get())); // Click on a sub-window (w121) to focus it. - aura::test::EventGenerator generator(Shell::GetRootWindow(), w121.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + w121.get()); generator.ClickLeftButton(); aura::internal::FocusManager* focus_manager = w121->GetFocusManager(); @@ -178,7 +179,7 @@ TEST_F(RootWindowEventFilterTest, Focus) { // Various assertion testing for activating windows. TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); test::TestActivationDelegate d1; aura::test::TestWindowDelegate wd; @@ -205,7 +206,8 @@ TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { { // Click on window2. - aura::test::EventGenerator generator(Shell::GetRootWindow(), w2.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + w2.get()); generator.ClickLeftButton(); // Window2 should have become active. @@ -221,7 +223,8 @@ TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { { // Click back on window1, but set it up so w1 doesn't activate on click. - aura::test::EventGenerator generator(Shell::GetRootWindow(), w1.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + w1.get()); d1.set_activate(false); generator.ClickLeftButton(); @@ -251,7 +254,8 @@ TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { { scoped_ptr<aura::Window> w11(CreateTestWindowWithDelegate( &wd, -1, gfx::Rect(10, 10, 10, 10), w1.get())); - aura::test::EventGenerator generator(Shell::GetRootWindow(), w11.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + w11.get()); // First set the focus to the child |w11|. generator.ClickLeftButton(); EXPECT_EQ(w11.get(), focus_manager->GetFocusedWindow()); @@ -276,7 +280,8 @@ TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { // Move focus to |w2| first. scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate( &wd, -1, gfx::Rect(70, 70, 50, 50), NULL)); - aura::test::EventGenerator generator(Shell::GetRootWindow(), w2.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + w2.get()); generator.ClickLeftButton(); EXPECT_EQ(w2.get(), focus_manager->GetFocusedWindow()); EXPECT_FALSE(w11->CanFocus()); @@ -290,7 +295,7 @@ TEST_F(RootWindowEventFilterTest, ActivateOnMouse) { // Essentially the same as ActivateOnMouse, but for touch events. TEST_F(RootWindowEventFilterTest, ActivateOnTouch) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); test::TestActivationDelegate d1; aura::test::TestWindowDelegate wd; @@ -360,7 +365,7 @@ TEST_F(RootWindowEventFilterTest, ActivateOnTouch) { } TEST_F(RootWindowEventFilterTest, MouseEventCursors) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); // Disable ash grid so that test can place a window at // specific location. ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); @@ -440,7 +445,7 @@ TEST_F(RootWindowEventFilterTest, MAYBE_TransformActivate) { // specific location. ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); gfx::Size size = root_window->bounds().size(); EXPECT_EQ( gfx::Rect(size).ToString(), @@ -491,7 +496,7 @@ TEST_F(RootWindowEventFilterTest, AdditionalFilters) { Shell::GetInstance()->RemoveRootWindowEventFilter( shell_test.input_method_event_filter()); - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); // Creates a window and make it active scoped_ptr<aura::Window> w1(aura::test::CreateTestWindow( @@ -563,7 +568,7 @@ TEST_F(RootWindowEventFilterTest, AdditionalFilters) { // We should show and hide the cursor in response to mouse and touch events as // requested. TEST_F(RootWindowEventFilterTest, UpdateCursorVisibility) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); root_window->SetBounds(gfx::Rect(0, 0, 500, 500)); scoped_ptr<aura::Window> window(aura::test::CreateTestWindow( SK_ColorWHITE, -1, gfx::Rect(0, 0, 500, 500), NULL)); diff --git a/ash/wm/screen_dimmer.cc b/ash/wm/screen_dimmer.cc index a40a9bc..05c8099 100644 --- a/ash/wm/screen_dimmer.cc +++ b/ash/wm/screen_dimmer.cc @@ -26,11 +26,11 @@ const int kDimmingTransitionMs = 200; } // namespace ScreenDimmer::ScreenDimmer() : currently_dimming_(false) { - Shell::GetInstance()->GetRootWindow()->AddRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); } ScreenDimmer::~ScreenDimmer() { - Shell::GetInstance()->GetRootWindow()->RemoveRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); } void ScreenDimmer::SetDimming(bool should_dim) { @@ -41,7 +41,7 @@ void ScreenDimmer::SetDimming(bool should_dim) { dimming_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); dimming_layer_->SetColor(SK_ColorBLACK); dimming_layer_->SetOpacity(0.0f); - ui::Layer* root_layer = Shell::GetRootWindow()->layer(); + ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); dimming_layer_->SetBounds(root_layer->bounds()); root_layer->Add(dimming_layer_.get()); root_layer->StackAtTop(dimming_layer_.get()); diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index 8b7b58f..ecc6cd5 100644 --- a/ash/wm/screen_dimmer_unittest.cc +++ b/ash/wm/screen_dimmer_unittest.cc @@ -44,7 +44,7 @@ TEST_F(ScreenDimmerTest, DimAndUndim) { // of the root's children. dimmer_->SetDimming(true); ASSERT_TRUE(test_api_->layer() != NULL); - ui::Layer* root_layer = Shell::GetInstance()->GetRootWindow()->layer(); + ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); ASSERT_TRUE(!root_layer->children().empty()); EXPECT_EQ(test_api_->layer(), root_layer->children().back()); EXPECT_TRUE(test_api_->layer()->visible()); @@ -63,14 +63,14 @@ TEST_F(ScreenDimmerTest, ResizeLayer) { dimmer_->SetDimming(true); ui::Layer* dimming_layer = test_api_->layer(); ASSERT_TRUE(dimming_layer != NULL); - ui::Layer* root_layer = Shell::GetInstance()->GetRootWindow()->layer(); + ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); EXPECT_EQ(gfx::Rect(root_layer->bounds().size()).ToString(), dimming_layer->bounds().ToString()); // When we resize the root window, the dimming layer should be resized to // match. gfx::Size kNewSize(400, 300); - Shell::GetInstance()->GetRootWindow()->SetHostSize(kNewSize); + Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize); EXPECT_EQ(kNewSize.ToString(), dimming_layer->bounds().size().ToString()); } diff --git a/ash/wm/shadow_controller.cc b/ash/wm/shadow_controller.cc index bbf5550..718ef15 100644 --- a/ash/wm/shadow_controller.cc +++ b/ash/wm/shadow_controller.cc @@ -72,11 +72,11 @@ ShadowController::ShadowController() : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)) { aura::Env::GetInstance()->AddObserver(this); // Watch for window activation changes. - Shell::GetRootWindow()->AddObserver(this); + Shell::GetPrimaryRootWindow()->AddObserver(this); } ShadowController::~ShadowController() { - Shell::GetRootWindow()->RemoveObserver(this); + Shell::GetPrimaryRootWindow()->RemoveObserver(this); aura::Env::GetInstance()->RemoveObserver(this); } diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index 55bf5a2..30b000a 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -119,7 +119,7 @@ ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( // ShelfLayoutManager, public: ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) - : root_window_(Shell::GetInstance()->GetRootWindow()), + : root_window_(Shell::GetPrimaryRootWindow()), in_layout_(false), auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT), alignment_(SHELF_ALIGNMENT_BOTTOM), @@ -233,7 +233,7 @@ void ShelfLayoutManager::LayoutShelf() { GetLayer(status_)->SetOpacity(target_bounds.opacity); status_->SetBounds(target_bounds.status_bounds); Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetRootWindow(), + Shell::GetPrimaryRootWindow(), target_bounds.work_area_insets); UpdateHitTestBounds(); } @@ -380,7 +380,7 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) { GetLayer(status_)->SetBounds(target_bounds.status_bounds); GetLayer(status_)->SetOpacity(target_bounds.opacity); Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetRootWindow(), + Shell::GetPrimaryRootWindow(), target_bounds.work_area_insets); UpdateHitTestBounds(); UpdateShelfBackground(change_type); diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc index 2853e98..011951d 100644 --- a/ash/wm/shelf_layout_manager_unittest.cc +++ b/ash/wm/shelf_layout_manager_unittest.cc @@ -93,7 +93,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); const gfx::Monitor& monitor = - manager->GetMonitorNearestWindow(Shell::GetRootWindow()); + manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, monitor.id()); // Bottom inset should be the max of widget heights. EXPECT_EQ(shelf_height, @@ -145,7 +145,7 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); const gfx::Monitor& monitor = - manager->GetMonitorNearestWindow(Shell::GetRootWindow()); + manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); // Hide the shelf. SetState(shelf, ShelfLayoutManager::HIDDEN); @@ -198,7 +198,7 @@ TEST_F(ShelfLayoutManagerTest, DontReferenceLauncherAfterDeletion) { // Various assertions around auto-hide. TEST_F(ShelfLayoutManagerTest, AutoHide) { - aura::RootWindow* root = Shell::GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); aura::test::EventGenerator generator(root, root); generator.MoveMouseTo(0, 0); @@ -262,7 +262,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { // Since ShelfLayoutManager queries for mouse location, move the mouse so // it isn't over the shelf. aura::test::EventGenerator generator( - Shell::GetInstance()->GetRootWindow(), gfx::Point()); + Shell::GetPrimaryRootWindow(), gfx::Point()); generator.MoveMouseTo(0, 0); ShelfLayoutManager* shelf = GetShelfLayoutManager(); @@ -276,7 +276,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); - aura::RootWindow* root = Shell::GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); // LayoutShelf() forces the animation to completion, at which point the // launcher should go off the screen. shelf->LayoutShelf(); @@ -312,7 +312,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { // Since ShelfLayoutManager queries for mouse location, move the mouse so // it isn't over the shelf. aura::test::EventGenerator generator( - Shell::GetInstance()->GetRootWindow(), gfx::Point()); + Shell::GetPrimaryRootWindow(), gfx::Point()); generator.MoveMouseTo(0, 0); ShelfLayoutManager* shelf = GetShelfLayoutManager(); @@ -365,7 +365,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { // Since ShelfLayoutManager queries for mouse location, move the mouse so // it isn't over the shelf. aura::test::EventGenerator generator( - Shell::GetInstance()->GetRootWindow(), gfx::Point()); + Shell::GetPrimaryRootWindow(), gfx::Point()); generator.MoveMouseTo(0, 0); ShelfLayoutManager* shelf = GetShelfLayoutManager(); @@ -501,7 +501,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); gfx::Monitor monitor = - manager->GetMonitorNearestWindow(Shell::GetRootWindow()); + manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, monitor.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), monitor.GetWorkAreaInsets().left()); @@ -524,7 +524,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); - monitor = manager->GetMonitorNearestWindow(Shell::GetRootWindow()); + monitor = manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, monitor.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), monitor.GetWorkAreaInsets().right()); diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index 3582894..639a216 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -47,7 +47,7 @@ ui::GestureStatus SystemGestureEventFilter::PreHandleGestureEvent( // TODO(tdresser) handle system level gesture events if (event->type() == ui::ET_GESTURE_THREE_FINGER_SWIPE) return ui::GESTURE_STATUS_CONSUMED; - if (!target || target == Shell::GetRootWindow()) { + if (!target || target == Shell::GetPrimaryRootWindow()) { switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: { gfx::Rect screen = diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 6ef332d..ed2fcb8 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -100,7 +100,7 @@ typedef test::AshTestBase SystemGestureEventFilterTest; // Ensure that events targeted at the root window are consumed by the // system event handler. TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); Shell::TestApi shell_test(Shell::GetInstance()); @@ -132,7 +132,7 @@ TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { // Ensure that a three fingered swipe is consumed by the system event handler. TEST_F(SystemGestureEventFilterTest, ThreeFingerSwipe) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); const int kTouchId = 5; @@ -159,7 +159,7 @@ TEST_F(SystemGestureEventFilterTest, ThreeFingerSwipe) { // Ensure that the device control operation gets properly handled. TEST_F(SystemGestureEventFilterTest, DeviceControl) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); gfx::Rect screen = gfx::Screen::GetPrimaryMonitor().bounds(); int ypos_half = screen.height() / 2; @@ -269,7 +269,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { // Ensure that the application control operations gets properly handled. TEST_F(SystemGestureEventFilterTest, ApplicationControl) { - aura::RootWindow* root_window = Shell::GetRootWindow(); + aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); gfx::Rect screen = gfx::Screen::GetPrimaryMonitor().bounds(); int ypos_half = screen.height() / 2; diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc index cc27bff..6e5ac4a 100644 --- a/ash/wm/system_modal_container_layout_manager_unittest.cc +++ b/ash/wm/system_modal_container_layout_manager_unittest.cc @@ -144,7 +144,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) { EXPECT_TRUE(wm::IsActiveWindow(t1)); // Attempting to click the parent should result in no activation change. - aura::test::EventGenerator e1(Shell::GetRootWindow(), parent.get()); + aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), parent.get()); e1.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(t1)); @@ -159,7 +159,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) { EXPECT_EQ(GetModalContainer(), t2->parent()); // t2 should still be active, even after clicking on t1. - aura::test::EventGenerator e2(Shell::GetRootWindow(), t1); + aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), t1); e2.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(t2)); @@ -192,7 +192,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, EXPECT_TRUE(wm::IsActiveWindow(transient.get())); // Attempting to click the parent should result in no activation change. - aura::test::EventGenerator e1(Shell::GetRootWindow(), parent.get()); + aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), parent.get()); e1.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(transient.get())); @@ -205,7 +205,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, EXPECT_TRUE(wm::IsActiveWindow(parent.get())); // Attempting to click unrelated should activate it. - aura::test::EventGenerator e2(Shell::GetRootWindow(), unrelated.get()); + aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), unrelated.get()); e2.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(unrelated.get())); } @@ -215,7 +215,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, EventFocusContainers) { EventTestWindow* main_delegate = new EventTestWindow(false); scoped_ptr<aura::Window> main(main_delegate->OpenTestWindow(NULL)); EXPECT_TRUE(wm::IsActiveWindow(main.get())); - aura::test::EventGenerator e1(Shell::GetRootWindow(), main.get()); + aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), main.get()); e1.ClickLeftButton(); EXPECT_EQ(1, main_delegate->mouse_presses()); @@ -281,7 +281,7 @@ TEST_F(SystemModalContainerLayoutManagerTest, ChangeCapture) { gfx::Point center(view->width() / 2, view->height() / 2); views::View::ConvertPointToScreen(view, ¢er); - aura::test::EventGenerator generator(Shell::GetRootWindow(), center); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), center); generator.PressLeftButton(); EXPECT_TRUE(view->got_press()); scoped_ptr<aura::Window> modal_window( diff --git a/ash/wm/toplevel_window_event_filter_unittest.cc b/ash/wm/toplevel_window_event_filter_unittest.cc index 1a52a22..3e709df 100644 --- a/ash/wm/toplevel_window_event_filter_unittest.cc +++ b/ash/wm/toplevel_window_event_filter_unittest.cc @@ -73,8 +73,8 @@ class ToplevelWindowEventFilterTest : public AshTestBase { parent_ = new aura::Window(NULL); parent_->Init(ui::LAYER_NOT_DRAWN); parent_->Show(); - Shell::GetRootWindow()->AddChild(parent_); - parent_->SetBounds(Shell::GetRootWindow()->bounds()); + Shell::GetPrimaryRootWindow()->AddChild(parent_); + parent_->SetBounds(Shell::GetPrimaryRootWindow()->bounds()); filter_ = new ToplevelWindowEventFilter(parent_); parent_->SetEventFilter(filter_); SetGridSize(0); @@ -99,12 +99,12 @@ class ToplevelWindowEventFilterTest : public AshTestBase { } void DragFromCenterBy(aura::Window* window, int dx, int dy) { - aura::test::EventGenerator generator(Shell::GetRootWindow(), window); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); generator.DragMouseBy(dx, dy); } void TouchDragFromCenterBy(aura::Window* window, int dx, int dy) { - aura::test::EventGenerator generator(Shell::GetRootWindow(), window); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); generator.PressMoveAndReleaseTouchBy(dx, dy); } @@ -157,7 +157,7 @@ TEST_F(ToplevelWindowEventFilterTest, GrowBox) { window_delegate->set_min_size(gfx::Size(40, 40)); gfx::Point position = w1->bounds().origin(); - aura::test::EventGenerator generator(Shell::GetRootWindow()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseToCenterOf(w1.get()); generator.DragMouseBy(100, 100); // Position should not have changed. @@ -337,7 +337,7 @@ TEST_F(ToplevelWindowEventFilterTest, DoubleClickCaptionTogglesMaximize) { scoped_ptr<aura::Window> w1(CreateWindow(HTCAPTION)); EXPECT_FALSE(wm::IsWindowMaximized(w1.get())); - aura::test::EventGenerator generator(Shell::GetRootWindow(), w1.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); generator.DoubleClickLeftButton(); EXPECT_TRUE(wm::IsWindowMaximized(w1.get())); @@ -392,7 +392,8 @@ TEST_F(ToplevelWindowEventFilterTest, BottomWorkArea) { // Verifies we don't let windows drag to a -y location. TEST_F(ToplevelWindowEventFilterTest, DontDragToNegativeY) { scoped_ptr<aura::Window> target(CreateWindow(HTTOP)); - aura::test::EventGenerator generator(Shell::GetRootWindow(), target.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + target.get()); generator.MoveMouseTo(0, 5); generator.DragMouseBy(0, -5); // The y location and height should not have changed. @@ -430,7 +431,8 @@ TEST_F(ToplevelWindowEventFilterTest, ResizeSnaps) { TEST_F(ToplevelWindowEventFilterTest, DragSnaps) { SetGridSize(8); scoped_ptr<aura::Window> target(CreateWindow(HTCAPTION)); - aura::test::EventGenerator generator(Shell::GetRootWindow(), target.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + target.get()); generator.PressLeftButton(); generator.MoveMouseTo(generator.current_location().Add(gfx::Point(11, 21))); @@ -452,13 +454,14 @@ TEST_F(ToplevelWindowEventFilterTest, DragSnaps) { #define MAYBE_EscapeReverts EscapeReverts #endif TEST_F(ToplevelWindowEventFilterTest, MAYBE_EscapeReverts) { - aura::RootWindow* root = Shell::GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); aura::client::ActivationClient* original_client = aura::client::GetActivationClient(root); aura::test::TestActivationClient activation_client(root); scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); target->Focus(); - aura::test::EventGenerator generator(Shell::GetRootWindow(), target.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + target.get()); generator.PressLeftButton(); generator.MoveMouseTo(generator.current_location().Add(gfx::Point(10, 11))); diff --git a/ash/wm/video_detector.cc b/ash/wm/video_detector.cc index e24a5958..5afc6b3 100644 --- a/ash/wm/video_detector.cc +++ b/ash/wm/video_detector.cc @@ -99,7 +99,7 @@ void VideoDetector::MaybeNotifyObservers(aura::Window* window, if (!window->IsVisible()) return; - gfx::Rect root_bounds = Shell::GetRootWindow()->bounds(); + gfx::Rect root_bounds = Shell::GetPrimaryRootWindow()->bounds(); if (!window->GetBoundsInRootWindow().Intersects(root_bounds)) return; diff --git a/ash/wm/video_detector_unittest.cc b/ash/wm/video_detector_unittest.cc index e1861c7..44c4e27 100644 --- a/ash/wm/video_detector_unittest.cc +++ b/ash/wm/video_detector_unittest.cc @@ -119,7 +119,7 @@ TEST_F(VideoDetectorTest, WindowNotVisible) { // Reparent the window to the root to make sure that visibility changes aren't // animated. - Shell::GetRootWindow()->AddChild(window.get()); + Shell::GetPrimaryRootWindow()->AddChild(window.get()); // We shouldn't report video that's played in a hidden window. window->Hide(); @@ -143,7 +143,7 @@ TEST_F(VideoDetectorTest, WindowNotVisible) { observer_->reset_stats(); AdvanceTime(base::TimeDelta::FromSeconds(2)); gfx::Rect offscreen_bounds( - gfx::Point(Shell::GetRootWindow()->bounds().width(), 0), + gfx::Point(Shell::GetPrimaryRootWindow()->bounds().width(), 0), window_bounds.size()); window->SetBounds(offscreen_bounds); ASSERT_EQ(offscreen_bounds, window->bounds()); diff --git a/ash/wm/visibility_controller.cc b/ash/wm/visibility_controller.cc index 3ed4bfc..b933282 100644 --- a/ash/wm/visibility_controller.cc +++ b/ash/wm/visibility_controller.cc @@ -23,7 +23,7 @@ bool GetChildWindowVisibilityChangesAnimated(aura::Window* window) { namespace internal { VisibilityController::VisibilityController() { - aura::client::SetVisibilityClient(Shell::GetRootWindow(), this); + aura::client::SetVisibilityClient(Shell::GetPrimaryRootWindow(), this); } VisibilityController::~VisibilityController() { diff --git a/ash/wm/window_modality_controller_unittest.cc b/ash/wm/window_modality_controller_unittest.cc index 9f6d271..fdbbb03 100644 --- a/ash/wm/window_modality_controller_unittest.cc +++ b/ash/wm/window_modality_controller_unittest.cc @@ -187,7 +187,7 @@ TEST_F(WindowModalityControllerTest, Events) { { // Clicking a point within w1 should activate that window. - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), gfx::Point(10, 10)); generator.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); @@ -197,7 +197,7 @@ TEST_F(WindowModalityControllerTest, Events) { { // Clicking a point within w1 should activate w11. - aura::test::EventGenerator generator(Shell::GetRootWindow(), + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), gfx::Point(10, 10)); generator.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(w11.get())); @@ -249,7 +249,7 @@ TEST_F(WindowModalityControllerTest, ChangeCapture) { gfx::Point center(view->width() / 2, view->height() / 2); views::View::ConvertPointToScreen(view, ¢er); - aura::test::EventGenerator generator(Shell::GetRootWindow(), center); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), center); generator.PressLeftButton(); EXPECT_TRUE(view->got_press()); diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index c71cf192..9b0da78 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -42,7 +42,7 @@ bool IsActiveWindow(aura::Window* window) { } aura::Window* GetActiveWindow() { - return aura::client::GetActivationClient(Shell::GetRootWindow())-> + return aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> GetActiveWindow(); } diff --git a/ash/wm/workspace/workspace_event_filter_unittest.cc b/ash/wm/workspace/workspace_event_filter_unittest.cc index 14705a8d..65c69b4 100644 --- a/ash/wm/workspace/workspace_event_filter_unittest.cc +++ b/ash/wm/workspace/workspace_event_filter_unittest.cc @@ -54,7 +54,8 @@ TEST_F(WorkspaceEventFilterTest, DoubleClickSingleAxisResizeEdge) { gfx::Rect work_area = gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); - aura::test::EventGenerator generator(Shell::GetRootWindow(), window.get()); + aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), + window.get()); // Double-click the top resize edge. wd.set_window_component(HTTOP); diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc index 34aceef..0409a76 100644 --- a/ash/wm/workspace/workspace_manager_unittest.cc +++ b/ash/wm/workspace/workspace_manager_unittest.cc @@ -451,7 +451,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { // Since ShelfLayoutManager queries for mouse location, move the mouse so // it isn't over the shelf. aura::test::EventGenerator generator( - Shell::GetInstance()->GetRootWindow(), gfx::Point()); + Shell::GetPrimaryRootWindow(), gfx::Point()); generator.MoveMouseTo(0, 0); // Two windows, w1 normal, w2 maximized. diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index 1b3caad..d3654c0 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -50,7 +50,7 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { virtual void SetUp() OVERRIDE { AshTestBase::SetUp(); - aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); root->SetHostSize(gfx::Size(800, kRootHeight)); gfx::Rect root_bounds(root->bounds()); @@ -85,7 +85,7 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { std::string WindowOrderAsString() const { std::string result; const aura::Window::Windows& windows = - Shell::GetInstance()->GetRootWindow()->children(); + Shell::GetPrimaryRootWindow()->children(); for (aura::Window::Windows::const_reverse_iterator i = windows.rbegin(); i != windows.rend(); ++i) { if (*i == window_.get() || *i == window2_.get() || *i == window3_.get()) { @@ -349,7 +349,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_2) { // TODO(oshima): Host window doesn't get a resize event after // SetHostSize on Windows trybot, which gives wrong work/monitor area. TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { - aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); root->SetHostSize(gfx::Size(600, 800)); LOG(ERROR) << "=== Calling OnHostResized, 600x800"; @@ -497,7 +497,7 @@ TEST_F(WorkspaceWindowResizerTest, RestackAttached) { // Makes sure we don't allow dragging below the work area. TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetInstance()->GetRootWindow(), gfx::Insets(0, 0, 10, 0)); + Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); window_->SetBounds(gfx::Rect(100, 200, 300, 400)); SetGridSize(0); @@ -514,7 +514,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { // Makes sure we don't allow dragging off the top of the work area. TEST_F(WorkspaceWindowResizerTest, DontDragOffTop) { Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetInstance()->GetRootWindow(), gfx::Insets(10, 0, 0, 0)); + Shell::GetPrimaryRootWindow(), gfx::Insets(10, 0, 0, 0)); window_->SetBounds(gfx::Rect(100, 200, 300, 400)); SetGridSize(0); @@ -527,7 +527,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffTop) { TEST_F(WorkspaceWindowResizerTest, ResizeBottomOutsideWorkArea) { Shell::GetInstance()->SetMonitorWorkAreaInsets( - Shell::GetInstance()->GetRootWindow(), gfx::Insets(0, 0, 50, 0)); + Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 50, 0)); window_->SetBounds(gfx::Rect(100, 200, 300, 380)); SetGridSize(10); @@ -594,7 +594,7 @@ TEST_F(WorkspaceWindowResizerTest, SnapToEdge) { // Verifies a window taller than work area height doesn't snap above the top of // the work area. TEST_F(WorkspaceWindowResizerTest, TallWindow) { - aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); + aura::RootWindow* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetMonitorWorkAreaInsets( root, gfx::Insets(0, 0, 50, 0)); window_->SetBounds(gfx::Rect(0, 0, 320, 560)); |