diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 19:17:04 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 19:17:04 +0000 |
commit | e2f64d101a1e624bf300f598fea6c336db64f4a2 (patch) | |
tree | 9cd0c6a963f1152e2a1ec0667df1242a38fb627b /ash | |
parent | 7f1a51c32f9c8c5a44118483c1255328d7983fce (diff) | |
download | chromium_src-e2f64d101a1e624bf300f598fea6c336db64f4a2.zip chromium_src-e2f64d101a1e624bf300f598fea6c336db64f4a2.tar.gz chromium_src-e2f64d101a1e624bf300f598fea6c336db64f4a2.tar.bz2 |
Rename bounds accessors to be intuitive and consistent
GetClientAreaScreenBounds -> GetClientAreaBoundsInScreen
Get/Set ParentBounds -> Get/Set BoundsInParent
GetWorkAreaScreenBounds -> GetWorkAreaBoundsInScreen
GetClientAreaScreenBounds -> GetClientAreaBoundsInScreen
GetWindowScreenBounds -> GetWindowBoundsInScreen
GetScreenBounds -> GetBoundsInScreen
GetRootWindowBounds -> GetBoundsInRootWindow
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10795013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
39 files changed, 157 insertions, 147 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 5fdfa0e..34028ae 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -73,7 +73,7 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, drag_image_.reset(new DragImageView); drag_image_->SetImage(provider.drag_image()); drag_image_offset_ = provider.drag_image_offset(); - drag_image_->SetScreenBounds(gfx::Rect( + drag_image_->SetBoundsInScreen(gfx::Rect( root_location.Subtract(drag_image_offset_), drag_image_->GetPreferredSize())); drag_image_->SetWidgetVisible(true); diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 31c1b97..c4a7d9d 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -395,8 +395,8 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsMultipleWidgetsTest) { scoped_ptr<views::Widget> widget2(CreateNewWidget()); DragTestView* drag_view2 = new DragTestView; AddViewToWidgetAndResize(widget2.get(), drag_view2); - gfx::Rect widget1_bounds = widget1->GetClientAreaScreenBounds(); - gfx::Rect widget2_bounds = widget2->GetClientAreaScreenBounds(); + gfx::Rect widget1_bounds = widget1->GetClientAreaBoundsInScreen(); + gfx::Rect widget2_bounds = widget2->GetClientAreaBoundsInScreen(); widget2->SetBounds(gfx::Rect(widget1_bounds.width(), 0, widget2_bounds.width(), widget2_bounds.height())); diff --git a/ash/drag_drop/drag_image_view.cc b/ash/drag_drop/drag_image_view.cc index cdde40a..7a138f3 100644 --- a/ash/drag_drop/drag_image_view.cc +++ b/ash/drag_drop/drag_image_view.cc @@ -41,7 +41,7 @@ DragImageView::~DragImageView() { widget_->Hide(); } -void DragImageView::SetScreenBounds(const gfx::Rect& bounds) { +void DragImageView::SetBoundsInScreen(const gfx::Rect& bounds) { widget_->SetBounds(bounds); } diff --git a/ash/drag_drop/drag_image_view.h b/ash/drag_drop/drag_image_view.h index 0471c5e..63f718c 100644 --- a/ash/drag_drop/drag_image_view.h +++ b/ash/drag_drop/drag_image_view.h @@ -19,8 +19,11 @@ class DragImageView : public views::ImageView { DragImageView(); virtual ~DragImageView(); - // Sets the bounds of the native widget. - void SetScreenBounds(const gfx::Rect& bounds); + // Sets the bounds of the native widget in screen + // coordinates. + // TODO(oshima): Looks like this is root window's + // coordinate. Change this to screen's coordinate. + void SetBoundsInScreen(const gfx::Rect& bounds); // Sets the position of the native widget. void SetScreenPosition(const gfx::Point& position); diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc index 2a0c1eb..15d237c 100644 --- a/ash/launcher/launcher_unittest.cc +++ b/ash/launcher/launcher_unittest.cc @@ -25,7 +25,8 @@ TEST_F(LauncherTest, SetStatusSize) { Launcher* launcher = Shell::GetInstance()->launcher(); LauncherView* launcher_view = launcher->GetLauncherViewForTest(); - gfx::Size launcher_size = launcher->widget()->GetWindowScreenBounds().size(); + gfx::Size launcher_size = + launcher->widget()->GetWindowBoundsInScreen().size(); int total_width = launcher_size.width(); ASSERT_GT(total_width, 0); launcher->SetStatusSize(gfx::Size(total_width / 2, launcher_size.height())); diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc index d58bb2d..020f0d1 100644 --- a/ash/launcher/launcher_view_unittest.cc +++ b/ash/launcher/launcher_view_unittest.cc @@ -122,7 +122,8 @@ TEST_F(LauncherViewIconObserverTest, AddRemove) { TEST_F(LauncherViewIconObserverTest, BoundsChanged) { Launcher* launcher = Shell::GetInstance()->launcher(); - gfx::Size launcher_size = launcher->widget()->GetWindowScreenBounds().size(); + gfx::Size launcher_size = + launcher->widget()->GetWindowBoundsInScreen().size(); int total_width = launcher_size.width() / 2; ASSERT_GT(total_width, 0); launcher->SetStatusSize(gfx::Size(total_width, launcher_size.height())); diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 7524b29..d31e30b 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -88,25 +88,25 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) { views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); - EXPECT_EQ("650,10 100x100", normal->GetWindowScreenBounds().ToString()); + EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("50,10 100x100", - normal->GetNativeView()->GetRootWindowBounds().ToString()); + normal->GetNativeView()->GetBoundsInRootWindow().ToString()); views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); maximized->Maximize(); EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); #if !defined(OS_WIN) // TODO(oshima): Window reports smaller screen size. Investigate why. - EXPECT_EQ("600,0 500x500", maximized->GetWindowScreenBounds().ToString()); + EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 500x500", - maximized->GetNativeView()->GetRootWindowBounds().ToString()); + maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); #endif views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); minimized->Minimize(); EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); EXPECT_EQ("800,10 100x100", - minimized->GetWindowScreenBounds().ToString()); + minimized->GetWindowBoundsInScreen().ToString()); views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); fullscreen->SetFullscreen(true); @@ -114,48 +114,48 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) { #if !defined(OS_WIN) // TODO(oshima): Window reports smaller screen size. Investigate why. EXPECT_EQ("600,0 500x500", - fullscreen->GetWindowScreenBounds().ToString()); + fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 500x500", - fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); + fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); #endif UpdateDisplay("0+0-600x600"); EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); - EXPECT_EQ("50,10 100x100", normal->GetWindowScreenBounds().ToString()); + EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("50,10 100x100", - normal->GetNativeView()->GetRootWindowBounds().ToString()); + normal->GetNativeView()->GetBoundsInRootWindow().ToString()); // Maximized area on primary display has 2px (given as // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); EXPECT_EQ("0,0 600x598", - maximized->GetWindowScreenBounds().ToString()); + maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 600x598", - maximized->GetNativeView()->GetRootWindowBounds().ToString()); + maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); EXPECT_EQ("200,10 100x100", - minimized->GetWindowScreenBounds().ToString()); + minimized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); EXPECT_TRUE(fullscreen->IsFullscreen()); EXPECT_EQ("0,0 600x600", - fullscreen->GetWindowScreenBounds().ToString()); + fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 600x600", - fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); + fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); // Test if the restore bounds are correctly updated. wm::RestoreWindow(maximized->GetNativeView()); - EXPECT_EQ("100,10 100x100", maximized->GetWindowScreenBounds().ToString()); + EXPECT_EQ("100,10 100x100", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("100,10 100x100", - maximized->GetNativeView()->GetRootWindowBounds().ToString()); + maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); fullscreen->SetFullscreen(false); EXPECT_EQ("300,10 100x100", - fullscreen->GetWindowScreenBounds().ToString()); + fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("300,10 100x100", - fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); + fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); } TEST_F(RootWindowControllerTest, MoveWindows_Modal) { diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index a7adb30..6c39ced 100644 --- a/ash/screen_ash.cc +++ b/ash/screen_ash.cc @@ -29,30 +29,31 @@ ScreenAsh::~ScreenAsh() { } // static -gfx::Rect ScreenAsh::GetMaximizedWindowParentBounds(aura::Window* window) { +gfx::Rect ScreenAsh::GetMaximizedWindowBoundsInParent(aura::Window* window) { if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); else - return GetDisplayParentBounds(window); + return GetDisplayBoundsInParent(window); } // static -gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaParentBounds(aura::Window* window) { +gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( + aura::Window* window) { if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); else - return GetDisplayWorkAreaParentBounds(window); + return GetDisplayWorkAreaBoundsInParent(window); } // static -gfx::Rect ScreenAsh::GetDisplayParentBounds(aura::Window* window) { +gfx::Rect ScreenAsh::GetDisplayBoundsInParent(aura::Window* window) { return ConvertRectFromScreen( window->parent(), gfx::Screen::GetDisplayNearestWindow(window).bounds()); } // static -gfx::Rect ScreenAsh::GetDisplayWorkAreaParentBounds(aura::Window* window) { +gfx::Rect ScreenAsh::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { return ConvertRectFromScreen( window->parent(), gfx::Screen::GetDisplayNearestWindow(window).work_area()); diff --git a/ash/screen_ash.h b/ash/screen_ash.h index 94fb54b..d150d4b 100644 --- a/ash/screen_ash.h +++ b/ash/screen_ash.h @@ -22,17 +22,17 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { // Returns the bounds for maximized windows in parent coordinates. // Maximized windows trigger auto-hiding the shelf. - static gfx::Rect GetMaximizedWindowParentBounds(aura::Window* window); + static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); // Returns work area when a maximized window is not present in // parent coordinates. - static gfx::Rect GetUnmaximizedWorkAreaParentBounds(aura::Window* window); + static gfx::Rect GetUnmaximizedWorkAreaBoundsInParent(aura::Window* window); // Returns the display bounds in parent coordinates. - static gfx::Rect GetDisplayParentBounds(aura::Window* window); + static gfx::Rect GetDisplayBoundsInParent(aura::Window* window); // Returns the display's work area bounds in parent coordinates. - static gfx::Rect GetDisplayWorkAreaParentBounds(aura::Window* window); + static gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window); // Converts |rect| from |window|'s coordinates to the virtual screen // coordinates. diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc index 96727c8..5197e38 100644 --- a/ash/screen_ash_unittest.cc +++ b/ash/screen_ash_unittest.cc @@ -50,34 +50,34 @@ TEST_F(ScreenAshTest, Bounds) { // Maximized bounds EXPECT_EQ("0,0 600x598", - ScreenAsh::GetMaximizedWindowParentBounds( + ScreenAsh::GetMaximizedWindowBoundsInParent( primary->GetNativeView()).ToString()); EXPECT_EQ("0,0 500x500", - ScreenAsh::GetMaximizedWindowParentBounds( + ScreenAsh::GetMaximizedWindowBoundsInParent( secondary->GetNativeView()).ToString()); // Unmaximized work area bounds EXPECT_EQ("0,0 600x552", - ScreenAsh::GetUnmaximizedWorkAreaParentBounds( + ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( primary->GetNativeView()).ToString()); EXPECT_EQ("0,0 500x500", - ScreenAsh::GetUnmaximizedWorkAreaParentBounds( + ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( secondary->GetNativeView()).ToString()); // Display bounds EXPECT_EQ("0,0 600x600", - ScreenAsh::GetDisplayParentBounds( + ScreenAsh::GetDisplayBoundsInParent( primary->GetNativeView()).ToString()); EXPECT_EQ("0,0 500x500", - ScreenAsh::GetDisplayParentBounds( + ScreenAsh::GetDisplayBoundsInParent( secondary->GetNativeView()).ToString()); // Work area bounds EXPECT_EQ("0,0 600x552", - ScreenAsh::GetDisplayWorkAreaParentBounds( + ScreenAsh::GetDisplayWorkAreaBoundsInParent( primary->GetNativeView()).ToString()); EXPECT_EQ("0,0 500x500", - ScreenAsh::GetDisplayWorkAreaParentBounds( + ScreenAsh::GetDisplayWorkAreaBoundsInParent( secondary->GetNativeView()).ToString()); } #endif diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 247a122..3bf6cf3 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -267,9 +267,9 @@ TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) { views::Widget* launcher_widget = shell->launcher()->widget(); EXPECT_TRUE(launcher_widget->IsVisible()); // Launcher is at bottom-left of screen. - EXPECT_EQ(0, launcher_widget->GetWindowScreenBounds().x()); + EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(), - launcher_widget->GetWindowScreenBounds().bottom()); + launcher_widget->GetWindowBoundsInScreen().bottom()); // We have a desktop background but not a bare layer. EXPECT_TRUE(test_api.root_window_layout()->background_widget()); EXPECT_FALSE(test_api.root_window_layout()->background_layer()); diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 736e6e6..3fd3dbd 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -350,7 +350,7 @@ void SystemTray::RemoveBubble(SystemTrayBubble* bubble) { // No need to show the launcher if the mouse isn't over the status area // anymore. aura::RootWindow* root = GetWidget()->GetNativeView()->GetRootWindow(); - should_show_launcher_ = GetWidget()->GetWindowScreenBounds().Contains( + should_show_launcher_ = GetWidget()->GetWindowBoundsInScreen().Contains( root->last_mouse_location()); if (!should_show_launcher_) Shell::GetInstance()->shelf()->UpdateAutoHideState(); diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc index 4e383f6..c45f608 100644 --- a/ash/system/tray/system_tray_bubble.cc +++ b/ash/system/tray/system_tray_bubble.cc @@ -351,7 +351,7 @@ gfx::Rect SystemTrayBubble::GetAnchorRect() const { gfx::Rect rect; views::Widget* widget = bubble_view()->anchor_widget(); if (widget->IsVisible()) { - rect = widget->GetWindowScreenBounds(); + rect = widget->GetWindowBoundsInScreen(); if (anchor_type_ == ANCHOR_TYPE_TRAY) { if (tray_->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { rect.Inset( @@ -373,7 +373,7 @@ gfx::Rect SystemTrayBubble::GetAnchorRect() const { // the anchor can include arrow on left or right, which should // be deducted out from the anchor rect. views::View* anchor_view = bubble_view()->anchor_view(); - rect = anchor_view->GetScreenBounds(); + rect = anchor_view->GetBoundsInScreen(); gfx::Insets insets = anchor_view->GetInsets(); rect.Inset(insets); } diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index 1c50a43..6577a78 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc @@ -138,12 +138,12 @@ TEST_F(SystemTrayTest, TrayWidgetAutoResizes) { SystemTray* tray = GetSystemTray(); ASSERT_TRUE(tray->GetWidget()); - gfx::Size widget_size = tray->GetWidget()->GetWindowScreenBounds().size(); + gfx::Size widget_size = tray->GetWidget()->GetWindowBoundsInScreen().size(); TestItem* test_item = new TestItem; tray->AddTrayItem(test_item); - gfx::Size new_size = tray->GetWidget()->GetWindowScreenBounds().size(); + gfx::Size new_size = tray->GetWidget()->GetWindowBoundsInScreen().size(); // Adding the new item should change the size of the tray. EXPECT_NE(widget_size.ToString(), new_size.ToString()); @@ -152,11 +152,11 @@ TEST_F(SystemTrayTest, TrayWidgetAutoResizes) { // tray. test_item->tray_view()->SetVisible(false); EXPECT_EQ(widget_size.ToString(), - tray->GetWidget()->GetWindowScreenBounds().size().ToString()); + tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); test_item->tray_view()->SetVisible(true); EXPECT_EQ(new_size.ToString(), - tray->GetWidget()->GetWindowScreenBounds().size().ToString()); + tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); } TEST_F(SystemTrayTest, SystemTrayNotifications) { @@ -209,7 +209,7 @@ TEST_F(SystemTrayTest, BubbleCreationTypesTest) { RunAllPendingInMessageLoop(); views::Widget* widget = test_item->default_view()->GetWidget(); - gfx::Rect bubble_bounds = widget->GetWindowScreenBounds(); + gfx::Rect bubble_bounds = widget->GetWindowBoundsInScreen(); tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); @@ -217,14 +217,14 @@ TEST_F(SystemTrayTest, BubbleCreationTypesTest) { EXPECT_FALSE(test_item->default_view()); EXPECT_EQ(bubble_bounds.ToString(), test_item->detailed_view()->GetWidget()-> - GetWindowScreenBounds().ToString()); + GetWindowBoundsInScreen().ToString()); EXPECT_EQ(widget, test_item->detailed_view()->GetWidget()); tray->ShowDefaultView(BUBBLE_USE_EXISTING); RunAllPendingInMessageLoop(); EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> - GetWindowScreenBounds().ToString()); + GetWindowBoundsInScreen().ToString()); EXPECT_EQ(widget, test_item->default_view()->GetWidget()); } diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 4b0fb1a..1b934d4 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -376,7 +376,7 @@ void TrayBubbleView::Host::ProcessLocatedEvent( const aura::LocatedEvent& event) { if (!widget_) return; - gfx::Rect bounds = widget_->GetNativeWindow()->GetRootWindowBounds(); + gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); if (bounds.Contains(event.root_location())) return; if (tray_view_) { diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 8455de7..ac0afdc 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -634,7 +634,7 @@ class WebNotificationTray::Bubble : public internal::TrayBubbleView::Host, } virtual gfx::Rect GetAnchorRect() const OVERRIDE { - gfx::Rect anchor_rect = tray_->tray_container()->GetScreenBounds(); + gfx::Rect anchor_rect = tray_->tray_container()->GetBoundsInScreen(); return anchor_rect; } diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc index 5db968e..a37c03d 100644 --- a/ash/tooltips/tooltip_controller.cc +++ b/ash/tooltips/tooltip_controller.cc @@ -409,7 +409,7 @@ void TooltipController::UpdateIfRequired() { string16 tooltip_text(tooltip_text_); gfx::Point widget_loc = curr_mouse_loc_; widget_loc = widget_loc.Add( - tooltip_window_->GetScreenBounds().origin()); + tooltip_window_->GetBoundsInScreen().origin()); tooltip_->SetText(tooltip_text, widget_loc); tooltip_->Show(); } diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 53290de..1fa0ac5 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -202,7 +202,7 @@ void AppListController::ScheduleAnimation() { void AppListController::ProcessLocatedEvent(const aura::LocatedEvent& event) { if (view_ && is_visible_) { views::Widget* widget = view_->GetWidget(); - if (!widget->GetNativeView()->GetRootWindowBounds().Contains( + if (!widget->GetNativeView()->GetBoundsInRootWindow().Contains( event.root_location())) { SetVisible(false); } diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index bb08389..33f984b 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -34,7 +34,7 @@ gfx::Rect BoundsWithScreenEdgeVisible(aura::Window* window, // window would be when maximized, inset it. int grid_size = ash::Shell::GetInstance()->GetGridSize(); gfx::Rect max_bounds = - ash::ScreenAsh::GetMaximizedWindowParentBounds(window); + ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window); max_bounds.Inset(grid_size, grid_size); if (restore_bounds.Contains(max_bounds)) return max_bounds; @@ -104,9 +104,9 @@ void BaseLayoutManager::SetChildBounds(aura::Window* child, gfx::Rect child_bounds(requested_bounds); // Some windows rely on this to set their initial bounds. if (wm::IsWindowMaximized(child)) - child_bounds = ScreenAsh::GetMaximizedWindowParentBounds(child); + child_bounds = ScreenAsh::GetMaximizedWindowBoundsInParent(child); else if (wm::IsWindowFullscreen(child)) - child_bounds = ScreenAsh::GetDisplayParentBounds(child); + child_bounds = ScreenAsh::GetDisplayBoundsInParent(child); SetChildBoundsDirect(child, child_bounds); } @@ -194,7 +194,7 @@ void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window, SetRestoreBoundsIfNotSet(window); MaybeAnimateToBounds(window, animate, - ScreenAsh::GetMaximizedWindowParentBounds(window)); + ScreenAsh::GetMaximizedWindowBoundsInParent(window)); break; case ui::SHOW_STATE_FULLSCREEN: @@ -202,7 +202,7 @@ void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window, // Don't animate the full-screen window transition. // TODO(jamescook): Use animation here. Be sure the lock screen works. SetChildBoundsDirect( - window, ScreenAsh::GetDisplayParentBounds(window)); + window, ScreenAsh::GetDisplayBoundsInParent(window)); break; default: @@ -237,14 +237,14 @@ void BaseLayoutManager::AdjustWindowSizesForScreenChange() { aura::Window* window = *it; if (wm::IsWindowMaximized(window)) { SetChildBoundsDirect( - window, ScreenAsh::GetMaximizedWindowParentBounds(window)); + window, ScreenAsh::GetMaximizedWindowBoundsInParent(window)); } else if (wm::IsWindowFullscreen(window)) { SetChildBoundsDirect( - window, ScreenAsh::GetDisplayParentBounds(window)); + window, ScreenAsh::GetDisplayBoundsInParent(window)); } else { // The work area may be smaller than the full screen. gfx::Rect display_rect = - ScreenAsh::GetDisplayWorkAreaParentBounds(window); + ScreenAsh::GetDisplayWorkAreaBoundsInParent(window); // Put as much of the window as possible within the display area. window->SetBounds(window->bounds().AdjustToFit(display_rect)); } diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index 5d48392..47f1306 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -55,7 +55,7 @@ TEST_F(BaseLayoutManagerTest, Maximize) { window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); // Maximized window fills the work area, not the whole display. EXPECT_EQ( - ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString(), + ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString(), window->bounds().ToString()); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); @@ -79,15 +79,16 @@ TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); gfx::Rect initial_work_area_bounds = - ScreenAsh::GetMaximizedWindowParentBounds(window.get()); + ScreenAsh::GetMaximizedWindowBoundsInParent(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::GetPrimaryRootWindow()->SetHostSize(gfx::Size(900, 700)); EXPECT_EQ( - ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString(), + ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString(), window->bounds().ToString()); - EXPECT_NE(initial_work_area_bounds.ToString(), - ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString()); + EXPECT_NE( + initial_work_area_bounds.ToString(), + ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString()); } // Tests normal->fullscreen->normal. @@ -169,7 +170,7 @@ TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { // It should have the default maximized window bounds, inset by the grid size. int grid_size = ash::Shell::GetInstance()->GetGridSize(); gfx::Rect max_bounds = - ash::ScreenAsh::GetMaximizedWindowParentBounds(window.get()); + ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()); max_bounds.Inset(grid_size, grid_size); EXPECT_EQ(max_bounds.ToString(), window->bounds().ToString()); } diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc index f29c3fe..ebdc946 100644 --- a/ash/wm/custom_frame_view_ash_unittest.cc +++ b/ash/wm/custom_frame_view_ash_unittest.cc @@ -112,7 +112,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonToggleMaximize) { CustomFrameViewAsh* frame = custom_frame_view_ash(widget); CustomFrameViewAsh::TestApi test(frame); views::View* view = test.maximize_button(); - gfx::Point center = view->GetScreenBounds().CenterPoint(); + gfx::Point center = view->GetBoundsInScreen().CenterPoint(); aura::test::EventGenerator generator(window->GetRootWindow(), center); @@ -122,22 +122,22 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonToggleMaximize) { RunAllPendingInMessageLoop(); EXPECT_TRUE(ash::wm::IsWindowMaximized(window)); - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); generator.MoveMouseTo(center); generator.ClickLeftButton(); RunAllPendingInMessageLoop(); EXPECT_FALSE(ash::wm::IsWindowMaximized(window)); - generator.GestureTapAt(view->GetScreenBounds().CenterPoint()); + generator.GestureTapAt(view->GetBoundsInScreen().CenterPoint()); EXPECT_TRUE(ash::wm::IsWindowMaximized(window)); - generator.GestureTapAt(view->GetScreenBounds().CenterPoint()); + generator.GestureTapAt(view->GetBoundsInScreen().CenterPoint()); EXPECT_FALSE(ash::wm::IsWindowMaximized(window)); - generator.GestureTapDownAndUp(view->GetScreenBounds().CenterPoint()); + generator.GestureTapDownAndUp(view->GetBoundsInScreen().CenterPoint()); EXPECT_TRUE(ash::wm::IsWindowMaximized(window)); - generator.GestureTapDownAndUp(view->GetScreenBounds().CenterPoint()); + generator.GestureTapDownAndUp(view->GetBoundsInScreen().CenterPoint()); EXPECT_FALSE(ash::wm::IsWindowMaximized(window)); widget->Close(); @@ -150,7 +150,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { CustomFrameViewAsh* frame = custom_frame_view_ash(widget); CustomFrameViewAsh::TestApi test(frame); views::View* view = test.maximize_button(); - gfx::Point center = view->GetScreenBounds().CenterPoint(); + gfx::Point center = view->GetBoundsInScreen().CenterPoint(); const int kGridSize = ash::Shell::GetInstance()->GetGridSize(); aura::test::EventGenerator generator(window->GetRootWindow(), center); @@ -173,7 +173,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { // Snap left. { - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); generator.MoveMouseTo(center); generator.PressLeftButton(); generator.MoveMouseBy(-10, 0); @@ -189,7 +189,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { // Minimize. { - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); generator.MoveMouseTo(center); generator.PressLeftButton(); generator.MoveMouseBy(0, 10); @@ -205,7 +205,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { // Snap right. { - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); gfx::Point end = center; end.Offset(40, 0); generator.GestureScrollSequence(center, end, @@ -222,7 +222,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { // Snap left. { - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); gfx::Point end = center; end.Offset(-40, 0); generator.GestureScrollSequence(center, end, @@ -239,7 +239,7 @@ TEST_F(CustomFrameViewAshTest, ResizeButtonDrag) { // Minimize. { - center = view->GetScreenBounds().CenterPoint(); + center = view->GetBoundsInScreen().CenterPoint(); gfx::Point end = center; end.Offset(0, 40); generator.GestureScrollSequence(center, end, diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 7565a3e..4224408 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -369,7 +369,7 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view, // of the screen. // TODO(oshima): This will not work under multi-display, need to add method // like GetWindowBoundsInDisplay(). - if (frame_->GetWindowScreenBounds().y() == 0) + if (frame_->GetWindowBoundsInScreen().y() == 0) return; // Draw the top corners and edge. diff --git a/ash/wm/panel_layout_manager.cc b/ash/wm/panel_layout_manager.cc index 84dfdc6..52599f3 100644 --- a/ash/wm/panel_layout_manager.cc +++ b/ash/wm/panel_layout_manager.cc @@ -250,7 +250,7 @@ void PanelLayoutManager::Relayout() { return; AutoReset<bool> auto_reset_in_layout(&in_layout_, true); - int launcher_top = launcher_->widget()->GetWindowScreenBounds().y(); + int launcher_top = launcher_->widget()->GetWindowBoundsInScreen().y(); aura::Window* active_panel = NULL; for (PanelList::iterator iter = panel_windows_.begin(); iter != panel_windows_.end(); ++iter) { @@ -353,8 +353,8 @@ void PanelLayoutManager::UpdateCallout(aura::Window* active_panel) { void PanelLayoutManager::ShowCalloutHelper(aura::Window* active_panel) { DCHECK(active_panel); - gfx::Rect bounds = active_panel->GetRootWindowBounds(); - gfx::Rect callout_bounds = callout_widget_->GetWindowScreenBounds(); + gfx::Rect bounds = active_panel->GetBoundsInRootWindow(); + gfx::Rect callout_bounds = callout_widget_->GetWindowBoundsInScreen(); callout_bounds.set_x( bounds.x() + (bounds.width() - callout_bounds.width()) / 2); callout_bounds.set_y(bounds.bottom()); diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc index 7835575..1e1c7a0 100644 --- a/ash/wm/panel_layout_manager_unittest.cc +++ b/ash/wm/panel_layout_manager_unittest.cc @@ -80,7 +80,7 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase { gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); ASSERT_FALSE(icon_bounds.IsEmpty()); - gfx::Rect window_bounds = panel->GetRootWindowBounds(); + gfx::Rect window_bounds = panel->GetBoundsInRootWindow(); // 1-pixel tolerance--since we center panels over their icons, panels with // odd pixel widths won't be perfectly lined up with even pixel width @@ -88,7 +88,7 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase { EXPECT_NEAR(icon_bounds.CenterPoint().x(), window_bounds.CenterPoint().x(), 1); - EXPECT_EQ(launcher->widget()->GetWindowScreenBounds().y(), + EXPECT_EQ(launcher->widget()->GetWindowBoundsInScreen().y(), window_bounds.bottom()); } @@ -98,10 +98,10 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase { views::Widget* widget = NULL; GetCalloutWidget(&widget); EXPECT_TRUE(widget->IsVisible()); - EXPECT_EQ(panel->GetRootWindowBounds().bottom(), - widget->GetWindowScreenBounds().y()); - EXPECT_NEAR(panel->GetRootWindowBounds().CenterPoint().x(), - widget->GetWindowScreenBounds().CenterPoint().x(), + EXPECT_EQ(panel->GetBoundsInRootWindow().bottom(), + widget->GetWindowBoundsInScreen().y()); + EXPECT_NEAR(panel->GetBoundsInRootWindow().CenterPoint().x(), + widget->GetWindowBoundsInScreen().CenterPoint().x(), 1); } diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index 79be3d7..156ea79 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -184,7 +184,7 @@ bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) { gfx::Rect ShelfLayoutManager::GetIdealBounds() { // TODO(oshima): this is wrong. Figure out what display shelf is on // and everything should be based on it. - gfx::Rect bounds(ScreenAsh::GetDisplayParentBounds( + gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent( status_->GetNativeView())); int width = 0, height = 0; GetShelfSize(&width, &height); @@ -325,7 +325,7 @@ void ShelfLayoutManager::OnWindowActivated(aura::Window* active, gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( aura::Window* window) { - gfx::Rect bounds(ScreenAsh::GetDisplayParentBounds(window)); + gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT || auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds); @@ -337,7 +337,7 @@ gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( aura::Window* window) { - gfx::Rect bounds(ScreenAsh::GetDisplayParentBounds(window)); + gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); int size; if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { size = kAutoHideSize; @@ -417,7 +417,7 @@ void ShelfLayoutManager::StopAnimating() { void ShelfLayoutManager::GetShelfSize(int* width, int* height) { *width = *height = 0; - gfx::Rect status_bounds(status_->GetWindowScreenBounds()); + gfx::Rect status_bounds(status_->GetWindowBoundsInScreen()); gfx::Size launcher_size = launcher_ ? launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size(); if (alignment_ == SHELF_ALIGNMENT_BOTTOM) @@ -446,7 +446,7 @@ void ShelfLayoutManager::CalculateTargetBounds( TargetBounds* target_bounds) { const gfx::Rect& available_bounds( status_->GetNativeView()->GetRootWindow()->bounds()); - gfx::Rect status_bounds(status_->GetWindowScreenBounds()); + gfx::Rect status_bounds(status_->GetWindowBoundsInScreen()); gfx::Size launcher_size = launcher_ ? launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size(); int shelf_size = 0; @@ -554,7 +554,7 @@ ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState( aura::RootWindow* root = launcher_widget()->GetNativeView()->GetRootWindow(); bool mouse_over_launcher = - launcher_widget()->GetWindowScreenBounds().Contains( + launcher_widget()->GetWindowBoundsInScreen().Contains( root->last_mouse_location()); return mouse_over_launcher ? AUTO_HIDE_SHOWN : AUTO_HIDE_HIDDEN; } diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc index 31b7e69..8717628 100644 --- a/ash/wm/shelf_layout_manager_unittest.cc +++ b/ash/wm/shelf_layout_manager_unittest.cc @@ -88,8 +88,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { shelf->LayoutShelf(); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); - gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds()); - gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds()); + gfx::Rect status_bounds(shelf->status()->GetWindowBoundsInScreen()); + gfx::Rect launcher_bounds( + shelf->launcher_widget()->GetWindowBoundsInScreen()); int shelf_height = shelf->GetIdealBounds().height(); const aura::DisplayManager* manager = @@ -170,7 +171,7 @@ TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { ASSERT_TRUE(shelf_layout_manager); ASSERT_TRUE(shelf_layout_manager->status()); int status_width = - shelf_layout_manager->status()->GetWindowScreenBounds().width(); + shelf_layout_manager->status()->GetWindowBoundsInScreen().width(); // Test only makes sense if the status is > 0, which is better be. EXPECT_GT(status_width, 0); EXPECT_EQ(status_width, launcher->status_size().width()); @@ -219,7 +220,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) { // launcher should go off the screen. shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - shelf->launcher_widget()->GetWindowScreenBounds().y()); + shelf->launcher_widget()->GetWindowBoundsInScreen().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom()); @@ -231,7 +232,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) { EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(), - shelf->launcher_widget()->GetWindowScreenBounds().y()); + shelf->launcher_widget()->GetWindowBoundsInScreen().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom()); @@ -241,7 +242,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) { EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - shelf->launcher_widget()->GetWindowScreenBounds().y()); + shelf->launcher_widget()->GetWindowBoundsInScreen().y()); // Drag mouse to bottom of screen. generator.PressLeftButton(); @@ -283,7 +284,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { // launcher should go off the screen. shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - shelf->launcher_widget()->GetWindowScreenBounds().y()); + shelf->launcher_widget()->GetWindowBoundsInScreen().y()); aura::Window* lock_container = Shell::GetContainer( Shell::GetPrimaryRootWindow(), @@ -350,17 +351,17 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { widget->Maximize(); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), - widget->GetWorkAreaScreenBounds().bottom()); + widget->GetWorkAreaBoundsInScreen().bottom()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), - widget->GetWorkAreaScreenBounds().bottom()); + widget->GetWorkAreaBoundsInScreen().bottom()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), - widget->GetWorkAreaScreenBounds().bottom()); + widget->GetWorkAreaBoundsInScreen().bottom()); } // Verifies the shelf is visible when status/launcher is focused. @@ -497,7 +498,8 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); - gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds()); + gfx::Rect launcher_bounds( + shelf->launcher_widget()->GetWindowBoundsInScreen()); const aura::DisplayManager* manager = aura::Env::GetInstance()->display_manager(); gfx::Display display = @@ -510,7 +512,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(SHELF_ALIGNMENT_LEFT, Shell::GetInstance()->system_tray()->shelf_alignment()); - gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds()); + gfx::Rect status_bounds(shelf->status()->GetWindowBoundsInScreen()); EXPECT_GE(status_bounds.width(), shelf->status()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(shelf->GetIdealBounds().width(), @@ -523,7 +525,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); - launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); + launcher_bounds = shelf->launcher_widget()->GetWindowBoundsInScreen(); display = manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), @@ -533,7 +535,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, Shell::GetInstance()->system_tray()->shelf_alignment()); - status_bounds = gfx::Rect(shelf->status()->GetWindowScreenBounds()); + status_bounds = gfx::Rect(shelf->status()->GetWindowBoundsInScreen()); EXPECT_GE(status_bounds.width(), shelf->status()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(shelf->GetIdealBounds().width(), diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index 8358d77..14941cf 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -449,7 +449,7 @@ class SystemPinchHandler { phantom_state_ = PHANTOM_WINDOW_MAXIMIZED; return ScreenAsh::ConvertRectToScreen( target_->parent(), - ScreenAsh::GetMaximizedWindowParentBounds(target_)); + ScreenAsh::GetMaximizedWindowBoundsInParent(target_)); } if (pinch_factor_ < kPinchThresholdForMinimize) { @@ -465,7 +465,7 @@ class SystemPinchHandler { Launcher* launcher = Shell::GetInstance()->launcher(); gfx::Rect rect = launcher->GetScreenBoundsOfItemIconForWindow(target_); if (rect.IsEmpty()) - rect = launcher->widget()->GetWindowScreenBounds(); + rect = launcher->widget()->GetWindowBoundsInScreen(); else rect.Inset(-8, -8); phantom_state_ = PHANTOM_WINDOW_MINIMIZED; diff --git a/ash/wm/toplevel_window_event_filter_unittest.cc b/ash/wm/toplevel_window_event_filter_unittest.cc index 7683b3a..ca9aeeb 100644 --- a/ash/wm/toplevel_window_event_filter_unittest.cc +++ b/ash/wm/toplevel_window_event_filter_unittest.cc @@ -477,7 +477,7 @@ TEST_F(ToplevelWindowEventFilterTest, GestureDrag) { old_bounds = target->bounds(); // Snap left. - end = location = target->GetRootWindowBounds().CenterPoint(); + end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(-100, 0); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), @@ -493,7 +493,7 @@ TEST_F(ToplevelWindowEventFilterTest, GestureDrag) { old_bounds = target->bounds(); // Maximize. - end = location = target->GetRootWindowBounds().CenterPoint(); + end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(0, -100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), @@ -506,7 +506,7 @@ TEST_F(ToplevelWindowEventFilterTest, GestureDrag) { target->SetBounds(old_bounds); // Minimize. - end = location = target->GetRootWindowBounds().CenterPoint(); + end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(0, 100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), diff --git a/ash/wm/video_detector.cc b/ash/wm/video_detector.cc index 52a3ded..5b32a53 100644 --- a/ash/wm/video_detector.cc +++ b/ash/wm/video_detector.cc @@ -100,7 +100,7 @@ void VideoDetector::MaybeNotifyObservers(aura::Window* window, return; gfx::Rect root_bounds = window->GetRootWindow()->bounds(); - if (!window->GetRootWindowBounds().Intersects(root_bounds)) + if (!window->GetBoundsInRootWindow().Intersects(root_bounds)) return; FOR_EACH_OBSERVER(VideoDetectorObserver, observers_, OnVideoDetected()); diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index 7cea2e1..9875106 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -204,7 +204,7 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag( details.window_component == HTBOTTOMRIGHT || details.window_component == HTBOTTOMLEFT) { gfx::Rect work_area = - ScreenAsh::GetDisplayWorkAreaParentBounds(details.window); + ScreenAsh::GetDisplayWorkAreaBoundsInParent(details.window); if (new_bounds.bottom() > work_area.bottom()) new_bounds.Inset(0, 0, 0, new_bounds.bottom() - work_area.bottom()); diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index 770195f..386a2ac 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -363,7 +363,7 @@ gfx::Rect FrameMaximizeButton::ScreenBoundsForType(SnapType type) const { case SNAP_MAXIMIZE: return ScreenAsh::ConvertRectToScreen( window->parent(), - ScreenAsh::GetMaximizedWindowParentBounds(window)); + ScreenAsh::GetMaximizedWindowBoundsInParent(window)); case SNAP_MINIMIZE: { Launcher* launcher = Shell::GetInstance()->launcher(); gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow(window)); @@ -373,11 +373,12 @@ gfx::Rect FrameMaximizeButton::ScreenBoundsForType(SnapType type) const { item_rect.Inset(-8, -8); return item_rect; } - return launcher->widget()->GetWindowScreenBounds(); + return launcher->widget()->GetWindowBoundsInScreen(); } case SNAP_RESTORE: { const gfx::Rect* restore = GetRestoreBoundsInScreen(window); - return restore ? *restore : frame_->GetWidget()->GetWindowScreenBounds(); + return restore ? + *restore : frame_->GetWidget()->GetWindowBoundsInScreen(); } case SNAP_NONE: NOTREACHED(); diff --git a/ash/wm/workspace/maximized_workspace.cc b/ash/wm/workspace/maximized_workspace.cc index 6182b09..d741e8e 100644 --- a/ash/wm/workspace/maximized_workspace.cc +++ b/ash/wm/workspace/maximized_workspace.cc @@ -41,10 +41,10 @@ void MaximizedWorkspace::OnWindowRemoved(aura::Window* window) { void MaximizedWorkspace::ResetWindowBounds(aura::Window* window) { if (wm::IsWindowFullscreen(window)) { SetWindowBounds(window, - ScreenAsh::GetDisplayParentBounds(window)); + ScreenAsh::GetDisplayBoundsInParent(window)); } else { SetWindowBounds(window, - ScreenAsh::GetMaximizedWindowParentBounds(window)); + ScreenAsh::GetMaximizedWindowBoundsInParent(window)); } } diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index 61d140d..a94da55 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -427,7 +427,7 @@ void MultiWindowResizeController::CompleteResize(int event_flags) { // Mouse may still be over resizer, if not hide. gfx::Point screen_loc = gfx::Screen::GetCursorScreenPoint(); - if (!resize_widget_->GetWindowScreenBounds().Contains(screen_loc)) + if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) Hide(); } @@ -466,7 +466,7 @@ bool MultiWindowResizeController::IsOverWindows( if (window_resizer_.get()) return true; // Ignore hides while actively resizing. - if (resize_widget_->GetWindowScreenBounds().Contains(screen_location)) + if (resize_widget_->GetWindowBoundsInScreen().Contains(screen_location)) return true; int hit1, hit2; diff --git a/ash/wm/workspace/multi_window_resize_controller_unittest.cc b/ash/wm/workspace/multi_window_resize_controller_unittest.cc index 4dbf4f2..12dc0c92 100644 --- a/ash/wm/workspace/multi_window_resize_controller_unittest.cc +++ b/ash/wm/workspace/multi_window_resize_controller_unittest.cc @@ -150,7 +150,7 @@ TEST_F(MultiWindowResizeControllerTest, DeleteWindow) { // Move the mouse over the resize widget. ASSERT_TRUE(resize_widget()); - gfx::Rect bounds(resize_widget()->GetWindowScreenBounds()); + gfx::Rect bounds(resize_widget()->GetWindowBoundsInScreen()); generator.MoveMouseTo(bounds.x() + 1, bounds.y() + 1); EXPECT_FALSE(HasPendingShow()); EXPECT_TRUE(IsShowing()); @@ -193,7 +193,7 @@ TEST_F(MultiWindowResizeControllerTest, Drag) { // Move the mouse over the resize widget. ASSERT_TRUE(resize_widget()); - gfx::Rect bounds(resize_widget()->GetWindowScreenBounds()); + gfx::Rect bounds(resize_widget()->GetWindowBoundsInScreen()); generator.MoveMouseTo(bounds.x() + 1, bounds.y() + 1); EXPECT_FALSE(HasPendingShow()); EXPECT_TRUE(IsShowing()); @@ -240,7 +240,7 @@ TEST_F(MultiWindowResizeControllerTest, Three) { EXPECT_FALSE(HasPendingHide()); // w3 should be picked up when resize is started. - gfx::Rect bounds(resize_widget()->GetWindowScreenBounds()); + gfx::Rect bounds(resize_widget()->GetWindowBoundsInScreen()); generator.MoveMouseTo(bounds.x() + 1, bounds.y() + 1); generator.PressLeftButton(); generator.MoveMouseTo(bounds.x() + 11, bounds.y() + 10); diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc index 45d6140..99861fd 100644 --- a/ash/wm/workspace/phantom_window_controller.cc +++ b/ash/wm/workspace/phantom_window_controller.cc @@ -86,10 +86,10 @@ void PhantomWindowController::Show(const gfx::Rect& bounds) { if (!phantom_widget_.get()) { // Show the phantom at the bounds of the window. We'll animate to the target // bounds. - start_bounds_ = window_->GetScreenBounds(); + start_bounds_ = window_->GetBoundsInScreen(); CreatePhantomWidget(start_bounds_); } else { - start_bounds_ = phantom_widget_->GetWindowScreenBounds(); + start_bounds_ = phantom_widget_->GetWindowBoundsInScreen(); } animation_.reset(new ui::SlideAnimation(this)); animation_->Show(); diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc index 997b719..ca0ccb65 100644 --- a/ash/wm/workspace/snap_sizer.cc +++ b/ash/wm/workspace/snap_sizer.cc @@ -110,7 +110,7 @@ gfx::Rect SnapSizer::GetTargetBounds() const { } gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { - gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaParentBounds(window_)); + gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(window_)); int y = WindowResizer::AlignToGridRoundUp(work_area.y(), grid_size_); // We don't align to the bottom of the grid as the launcher may not // necessarily align to the grid (happens when auto-hidden). @@ -129,7 +129,7 @@ gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { } bool SnapSizer::AlongEdge(int x) const { - gfx::Rect area(ScreenAsh::GetDisplayParentBounds(window_)); + gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window_)); return (x <= area.x()) || (x >= area.right() - 1); } diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc index 6b182ca..c01128c 100644 --- a/ash/wm/workspace/workspace_manager_unittest.cc +++ b/ash/wm/workspace/workspace_manager_unittest.cc @@ -143,9 +143,9 @@ TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) { EXPECT_EQ(Workspace::TYPE_MAXIMIZED, workspaces()[1]->type()); ASSERT_EQ(1u, workspaces()[1]->windows().size()); EXPECT_EQ(w1.get(), workspaces()[1]->windows()[0]); - EXPECT_EQ(ScreenAsh::GetMaximizedWindowParentBounds(w1.get()).width(), + EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).width(), w1->bounds().width()); - EXPECT_EQ(ScreenAsh::GetMaximizedWindowParentBounds(w1.get()).height(), + EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).height(), w1->bounds().height()); // Restore the window. @@ -204,7 +204,7 @@ TEST_F(WorkspaceManagerTest, AddMaximizedWindowWhenEmpty) { ASSERT_TRUE(w1->layer() != NULL); EXPECT_TRUE(w1->layer()->visible()); gfx::Rect work_area( - ScreenAsh::GetMaximizedWindowParentBounds(w1.get())); + ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); EXPECT_EQ(work_area.width(), w1->bounds().width()); EXPECT_EQ(work_area.height(), w1->bounds().height()); @@ -242,7 +242,7 @@ TEST_F(WorkspaceManagerTest, MaximizeWithNormalWindow) { ASSERT_TRUE(w2->layer() != NULL); EXPECT_TRUE(w2->layer()->visible()); - gfx::Rect work_area(ScreenAsh::GetMaximizedWindowParentBounds(w1.get())); + gfx::Rect work_area(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get())); EXPECT_EQ(work_area.width(), w2->bounds().width()); EXPECT_EQ(work_area.height(), w2->bounds().height()); @@ -512,7 +512,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { w1->Show(); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); - EXPECT_EQ(ScreenAsh::GetMaximizedWindowParentBounds(w2.get()).ToString(), + EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(), w2->bounds().ToString()); // Switch to w2. @@ -520,7 +520,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) { EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ("0,1 101x102", w1->bounds().ToString()); - EXPECT_EQ(ScreenAsh::GetMaximizedWindowParentBounds(w2.get()).ToString(), + EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(), w2->bounds().ToString()); } diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 455afdd..0c998cb 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -281,7 +281,7 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow( gfx::Rect* bounds, int grid_size) const { // Always keep kMinOnscreenHeight on the bottom. gfx::Rect work_area( - ScreenAsh::GetDisplayWorkAreaParentBounds(details_.window)); + ScreenAsh::GetDisplayWorkAreaBoundsInParent(details_.window)); int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, grid_size); if (bounds->y() > max_y) @@ -335,7 +335,7 @@ void WorkspaceWindowResizer::SnapToWorkAreaEdges( bool WorkspaceWindowResizer::TouchesBottomOfScreen() const { gfx::Rect work_area( - ScreenAsh::GetDisplayWorkAreaParentBounds(details_.window)); + ScreenAsh::GetDisplayWorkAreaBoundsInParent(details_.window)); return (attached_windows_.empty() && details_.window->bounds().bottom() == work_area.bottom()) || (!attached_windows_.empty() && @@ -423,7 +423,7 @@ WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( const gfx::Point& location) const { // TODO: this likely only wants total display area, not the area of a single // display. - gfx::Rect area(ScreenAsh::GetDisplayParentBounds(details_.window)); + gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(details_.window)); if (location.x() <= area.x()) return SNAP_LEFT_EDGE; if (location.x() >= area.right() - 1) diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index 930ba49..1a237fd 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -431,7 +431,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3_Compress) { // Assertions around dragging to the left/right edge of the screen. TEST_F(WorkspaceWindowResizerTest, Edge) { int bottom = - ScreenAsh::GetUnmaximizedWorkAreaParentBounds(window_.get()).bottom(); + ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(window_.get()).bottom(); window_->SetBounds(gfx::Rect(20, 30, 50, 60)); { SetGridSize(0); |