Makes gfx::Screen an instance, rather than a collection of static methods.
This is in support of supporting separate Screen implementations on Aura for desktop and metro on Windows. Some callsites are not yet correct, and noted with a reference to the http://crbug.com/133312. As-is those sites will behave the same as before this patch, but may not be correct once desktop/metro can run simultaneously. BUG=133312 Review URL: https://chromiumcodereview.appspot.com/11030017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161644 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
ash
accelerators
dip_unittest.ccdisplay
display_controller.ccdisplay_controller_unittest.ccmouse_cursor_event_filter.ccmouse_cursor_event_filter_unittest.ccmulti_display_manager.ccscreen_position_controller.ccscreen_position_controller_unittest.ccshared_display_edge_indicator.cc
extended_desktop_unittest.cckeyboard_overlay
keyboard_overlay_delegate.cckeyboard_overlay_delegate.hkeyboard_overlay_view.cckeyboard_overlay_view.h
launcher
screen_ash.ccscreen_ash.hscreensaver
shell.ccshell.hsystem
test
tooltips
touch
ui_controls_ash.ccwm
base_layout_manager_unittest.cccoordinate_conversion.ccframe_painter.ccframe_painter_unittest.cc
gestures
maximize_bubble_controller.ccshelf_layout_manager.ccshelf_layout_manager_unittest.ccsystem_gesture_event_filter_unittest.ccsystem_modal_container_layout_manager.cctoplevel_window_event_handler_unittest.ccwindow_animations.ccwindow_manager_unittest.ccwindow_resizer.ccwindow_util.ccworkspace
chrome/browser
chromeos
display
extensions
input_method
login
media
download
metrics
notifications
speech
thumbnails
ui
ash
aura
gtk
panels
display_settings_provider.ccpanel_and_desktop_notification_browsertest.ccpanel_mouse_watcher_timer.cc
pdf
startup
views
app_list
ash
bookmarks
chrome_views_delegate.ccextensions
frame
fullscreen_exit_bubble_views.ccnotifications
panels
status_bubble_views.ccstatus_icons
tabs
webui
options
chromeos
window_sizer
content
browser
android
renderer_host
render_widget_host_view_aura.ccrender_widget_host_view_base.ccrender_widget_host_view_base.hrender_widget_host_view_gtk.ccrender_widget_host_view_mac.mmrender_widget_host_view_win.cc
web_contents
shell
ui
aura
base
gfx
screen.ccscreen.hscreen_android.ccscreen_aura.ccscreen_gtk.ccscreen_impl.hscreen_ios.mmscreen_mac.mmscreen_type_delegate.hscreen_unittest.ccscreen_win.cc
ui.gypviews
bubble
controls
drag_utils.ccexamples
content_client
touchui
widget
@ -125,7 +125,7 @@ void HandleCycleDisplayMode() {
|
||||
}
|
||||
|
||||
void HandleSwapPrimaryDisplay() {
|
||||
if (gfx::Screen::GetNumDisplays() > 1) {
|
||||
if (Shell::GetScreen()->GetNumDisplays() > 1) {
|
||||
Shell::GetInstance()->display_controller()->SetPrimaryDisplay(
|
||||
ScreenAsh::GetSecondaryDisplay());
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ TEST_F(DIPTest, MAYBE_WorkArea) {
|
||||
ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900));
|
||||
|
||||
aura::RootWindow* root = Shell::GetPrimaryRootWindow();
|
||||
const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root);
|
||||
const gfx::Display display =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(root);
|
||||
|
||||
EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
|
||||
gfx::Rect work_area = display.work_area();
|
||||
@ -48,7 +49,8 @@ TEST_F(DIPTest, MAYBE_WorkArea) {
|
||||
|
||||
ChangeDisplayConfig(2.0f, gfx::Rect(0, 0, 2000, 1800));
|
||||
|
||||
const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root);
|
||||
const gfx::Display display_2x =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(root);
|
||||
|
||||
// The |bounds_in_pixel()| should report bounds in pixel coordinate.
|
||||
EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString());
|
||||
|
@ -491,10 +491,10 @@ aura::RootWindow* DisplayController::AddRootWindowForDisplay(
|
||||
}
|
||||
|
||||
void DisplayController::UpdateDisplayBoundsForLayout() {
|
||||
if (gfx::Screen::GetNumDisplays() <= 1)
|
||||
if (Shell::GetScreen()->GetNumDisplays() <= 1)
|
||||
return;
|
||||
|
||||
DCHECK_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
DCHECK_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
const gfx::Rect& primary_bounds = GetPrimaryDisplay().bounds();
|
||||
|
||||
gfx::Display* secondary_display = GetSecondaryDisplay();
|
||||
|
@ -47,12 +47,12 @@ class TestObserver : public DisplayController::Observer {
|
||||
};
|
||||
|
||||
gfx::Display GetPrimaryDisplay() {
|
||||
return gfx::Screen::GetDisplayNearestWindow(
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
Shell::GetAllRootWindows()[0]);
|
||||
}
|
||||
|
||||
gfx::Display GetSecondaryDisplay() {
|
||||
return gfx::Screen::GetDisplayNearestWindow(
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
Shell::GetAllRootWindows()[1]);
|
||||
}
|
||||
|
||||
@ -146,11 +146,11 @@ TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) {
|
||||
UpdateDisplay("400x400");
|
||||
EXPECT_EQ(1, observer.CountAndReset());
|
||||
EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString());
|
||||
EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
|
||||
EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
|
||||
|
||||
UpdateDisplay("500x500,700x700");
|
||||
EXPECT_EQ(2, observer.CountAndReset());
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString());
|
||||
EXPECT_EQ("0,500 700x700", GetSecondaryDisplay().bounds().ToString());
|
||||
}
|
||||
@ -190,7 +190,7 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
|
||||
Shell::GetInstance()->display_controller();
|
||||
|
||||
UpdateDisplay("200x200,300x300");
|
||||
gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay();
|
||||
gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay();
|
||||
gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay();
|
||||
|
||||
std::string secondary_name = aura::Env::GetInstance()->
|
||||
@ -209,18 +209,21 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
|
||||
EXPECT_TRUE(primary_root->Contains(launcher_window));
|
||||
EXPECT_FALSE(secondary_root->Contains(launcher_window));
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(-100, -100)).id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestWindow(NULL).id());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
|
||||
|
||||
// Switch primary and secondary
|
||||
display_controller->SetPrimaryDisplay(secondary_display);
|
||||
EXPECT_EQ(secondary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(secondary_display.id(),
|
||||
Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(primary_display.id(), ScreenAsh::GetSecondaryDisplay().id());
|
||||
EXPECT_EQ(secondary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(-100, -100)).id());
|
||||
EXPECT_EQ(secondary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestWindow(NULL).id());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
|
||||
|
||||
EXPECT_EQ(
|
||||
primary_root,
|
||||
@ -243,12 +246,13 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
|
||||
// Deleting 2nd display should move the primary to original primary display.
|
||||
UpdateDisplay("200x200");
|
||||
RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
|
||||
EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(-100, -100)).id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestWindow(NULL).id());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
|
||||
EXPECT_TRUE(tracker.Contains(primary_root));
|
||||
EXPECT_FALSE(tracker.Contains(secondary_root));
|
||||
EXPECT_TRUE(primary_root->Contains(launcher_window));
|
||||
@ -259,7 +263,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
Shell::GetInstance()->display_controller();
|
||||
|
||||
UpdateDisplay("200x200,300x300");
|
||||
gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay();
|
||||
gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay();
|
||||
gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay();
|
||||
|
||||
std::string secondary_name = aura::Env::GetInstance()->
|
||||
@ -278,14 +282,16 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
EXPECT_FALSE(secondary_root->Contains(launcher_window));
|
||||
EXPECT_NE(primary_root, secondary_root);
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(-100, -100)).id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestWindow(NULL).id());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
|
||||
|
||||
// Switch primary and secondary by display ID.
|
||||
TestObserver observer;
|
||||
display_controller->SetPrimaryDisplayId(secondary_display.id());
|
||||
EXPECT_EQ(secondary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(secondary_display.id(),
|
||||
Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(primary_display.id(), ScreenAsh::GetSecondaryDisplay().id());
|
||||
EXPECT_LT(0, observer.CountAndReset());
|
||||
|
||||
@ -314,12 +320,13 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
// Deleting 2nd display should move the primary to original primary display.
|
||||
UpdateDisplay("200x200");
|
||||
RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
|
||||
EXPECT_EQ(1, gfx::Screen::GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(-100, -100)).id());
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(-100, -100)).id());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
gfx::Screen::GetDisplayNearestWindow(NULL).id());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
|
||||
EXPECT_TRUE(tracker.Contains(primary_root));
|
||||
EXPECT_FALSE(tracker.Contains(secondary_root));
|
||||
EXPECT_TRUE(primary_root->Contains(launcher_window));
|
||||
@ -333,8 +340,9 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
aura::Env::GetInstance()->display_manager();
|
||||
display_manager->OnNativeDisplaysChanged(displays);
|
||||
|
||||
EXPECT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
EXPECT_EQ(secondary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ(secondary_display.id(),
|
||||
Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(primary_display.id(), ScreenAsh::GetSecondaryDisplay().id());
|
||||
EXPECT_EQ(
|
||||
primary_root,
|
||||
@ -354,8 +362,9 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
displays2.push_back(primary_display);
|
||||
displays2.push_back(third_display);
|
||||
display_manager->OnNativeDisplaysChanged(displays2);
|
||||
EXPECT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(), gfx::Screen::GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ(primary_display.id(),
|
||||
Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
EXPECT_EQ(third_display.id(), ScreenAsh::GetSecondaryDisplay().id());
|
||||
EXPECT_EQ(
|
||||
primary_root,
|
||||
@ -368,7 +377,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
|
||||
|
||||
TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) {
|
||||
UpdateDisplay("100x200,300x400");
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
Shell::RootWindowList root_windows =
|
||||
Shell::GetInstance()->GetAllRootWindows();
|
||||
ASSERT_EQ(2U, root_windows.size());
|
||||
@ -379,21 +388,21 @@ TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) {
|
||||
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
|
||||
|
||||
UpdateDisplay("100x200,200+300-300x400");
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString());
|
||||
EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
|
||||
EXPECT_EQ("200,300", root_windows[1]->GetHostOrigin().ToString());
|
||||
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
|
||||
|
||||
UpdateDisplay("400+500-200x300,300x400");
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ("400,500", root_windows[0]->GetHostOrigin().ToString());
|
||||
EXPECT_EQ("200x300", root_windows[0]->GetHostSize().ToString());
|
||||
EXPECT_EQ("0,0", root_windows[1]->GetHostOrigin().ToString());
|
||||
EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString());
|
||||
|
||||
UpdateDisplay("100+200-100x200,300+500-200x300");
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString());
|
||||
EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
|
||||
EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString());
|
||||
|
@ -48,7 +48,7 @@ MouseCursorEventFilter::~MouseCursorEventFilter() {
|
||||
void MouseCursorEventFilter::ShowSharedEdgeIndicator(
|
||||
const aura::RootWindow* from) {
|
||||
HideSharedEdgeIndicator();
|
||||
if (gfx::Screen::GetNumDisplays() <= 1 || from == NULL) {
|
||||
if (Shell::GetScreen()->GetNumDisplays() <= 1 || from == NULL) {
|
||||
src_indicator_bounds_.SetRect(0, 0, 0, 0);
|
||||
dst_indicator_bounds_.SetRect(0, 0, 0, 0);
|
||||
drag_source_root_ = NULL;
|
||||
@ -107,7 +107,8 @@ ui::EventResult MouseCursorEventFilter::PreHandleGestureEvent(
|
||||
bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(
|
||||
aura::RootWindow* target_root,
|
||||
const gfx::Point& point_in_screen) {
|
||||
if (gfx::Screen::GetNumDisplays() <= 1 || mouse_warp_mode_ == WARP_NONE)
|
||||
if (Shell::GetScreen()->GetNumDisplays() <= 1 ||
|
||||
mouse_warp_mode_ == WARP_NONE)
|
||||
return false;
|
||||
const float scale = ui::GetDeviceScaleFactor(target_root->layer());
|
||||
|
||||
@ -147,7 +148,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(
|
||||
if (dst_root->bounds().Contains(point_in_dst_screen)) {
|
||||
DCHECK_NE(dst_root, root_at_point);
|
||||
dst_root->MoveCursorTo(point_in_dst_screen);
|
||||
ash::Shell::GetInstance()->cursor_manager()->SetDeviceScaleFactor(
|
||||
Shell::GetInstance()->cursor_manager()->SetDeviceScaleFactor(
|
||||
dst_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor());
|
||||
return true;
|
||||
}
|
||||
@ -157,7 +158,8 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(
|
||||
void MouseCursorEventFilter::UpdateHorizontalIndicatorWindowBounds() {
|
||||
bool from_primary = Shell::GetPrimaryRootWindow() == drag_source_root_;
|
||||
|
||||
const gfx::Rect& primary_bounds = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
const gfx::Rect& primary_bounds =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
const gfx::Rect& secondary_bounds = ScreenAsh::GetSecondaryDisplay().bounds();
|
||||
DisplayLayout::Position position = Shell::GetInstance()->
|
||||
display_controller()->GetCurrentDisplayLayout().position;
|
||||
@ -184,7 +186,8 @@ void MouseCursorEventFilter::UpdateHorizontalIndicatorWindowBounds() {
|
||||
void MouseCursorEventFilter::UpdateVerticalIndicatorWindowBounds() {
|
||||
bool in_primary = Shell::GetPrimaryRootWindow() == drag_source_root_;
|
||||
|
||||
const gfx::Rect& primary_bounds = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
const gfx::Rect& primary_bounds =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
const gfx::Rect& secondary_bounds = ScreenAsh::GetSecondaryDisplay().bounds();
|
||||
DisplayLayout::Position position = Shell::GetInstance()->
|
||||
display_controller()->GetCurrentDisplayLayout().position;
|
||||
|
@ -17,12 +17,12 @@ namespace internal {
|
||||
namespace {
|
||||
|
||||
gfx::Display GetPrimaryDisplay() {
|
||||
return gfx::Screen::GetDisplayNearestWindow(
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
Shell::GetAllRootWindows()[0]);
|
||||
}
|
||||
|
||||
gfx::Display GetSecondaryDisplay() {
|
||||
return gfx::Screen::GetDisplayNearestWindow(
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
Shell::GetAllRootWindows()[1]);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ TEST_F(MouseCursorEventFilterTest, WarpMouse) {
|
||||
|
||||
// Touch the right edge of the primary root window. Pointer should warp.
|
||||
is_warped = event_filter->WarpMouseCursorIfNecessary(root_windows[0],
|
||||
gfx::Point(499, 11));
|
||||
gfx::Point(499, 11));
|
||||
EXPECT_TRUE(is_warped);
|
||||
EXPECT_EQ("501,11", // by 2px.
|
||||
aura::Env::GetInstance()->last_mouse_location().ToString());
|
||||
|
@ -211,7 +211,7 @@ void MultiDisplayManager::OnNativeDisplaysChanged(
|
||||
std::vector<size_t> added_display_indices;
|
||||
gfx::Display current_primary;
|
||||
if (Shell::HasInstance())
|
||||
current_primary = gfx::Screen::GetPrimaryDisplay();
|
||||
current_primary = Shell::GetScreen()->GetPrimaryDisplay();
|
||||
|
||||
for (DisplayList::iterator curr_iter = displays_.begin(),
|
||||
new_iter = new_displays.begin();
|
||||
|
@ -61,9 +61,8 @@ void ScreenPositionController::ConvertPointToScreen(
|
||||
gfx::Point* point) {
|
||||
const aura::RootWindow* root = window->GetRootWindow();
|
||||
aura::Window::ConvertPointToTarget(window, root, point);
|
||||
const gfx::Point display_origin =
|
||||
gfx::Screen::GetDisplayNearestWindow(
|
||||
const_cast<aura::RootWindow*>(root)).bounds().origin();
|
||||
const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
const_cast<aura::RootWindow*>(root)).bounds().origin();
|
||||
point->Offset(display_origin.x(), display_origin.y());
|
||||
}
|
||||
|
||||
@ -71,9 +70,8 @@ void ScreenPositionController::ConvertPointFromScreen(
|
||||
const aura::Window* window,
|
||||
gfx::Point* point) {
|
||||
const aura::RootWindow* root = window->GetRootWindow();
|
||||
const gfx::Point display_origin =
|
||||
gfx::Screen::GetDisplayNearestWindow(
|
||||
const_cast<aura::RootWindow*>(root)).bounds().origin();
|
||||
const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
const_cast<aura::RootWindow*>(root)).bounds().origin();
|
||||
point->Offset(-display_origin.x(), -display_origin.y());
|
||||
aura::Window::ConvertPointToTarget(root, window, point);
|
||||
}
|
||||
@ -150,8 +148,8 @@ void ScreenPositionController::SetBounds(aura::Window* window,
|
||||
}
|
||||
|
||||
gfx::Point origin(bounds.origin());
|
||||
const gfx::Point display_origin =
|
||||
gfx::Screen::GetDisplayNearestWindow(window).bounds().origin();
|
||||
const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window).bounds().origin();
|
||||
origin.Offset(-display_origin.x(), -display_origin.y());
|
||||
window->SetBounds(gfx::Rect(origin, bounds.size()));
|
||||
}
|
||||
|
@ -89,8 +89,9 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertNativePointToScreen) {
|
||||
EXPECT_EQ("200x200", root_windows[1]->GetHostSize().ToString());
|
||||
|
||||
const gfx::Point window_pos(100, 100);
|
||||
window_->SetBoundsInScreen(gfx::Rect(window_pos, gfx::Size(100, 100)),
|
||||
gfx::Screen::GetDisplayNearestPoint(window_pos));
|
||||
window_->SetBoundsInScreen(
|
||||
gfx::Rect(window_pos, gfx::Size(100, 100)),
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(window_pos));
|
||||
SetSecondaryDisplayLayout(DisplayLayout::RIGHT);
|
||||
// The point is on the primary root window.
|
||||
EXPECT_EQ("150,150", ConvertNativePointToScreen(50, 50));
|
||||
@ -126,8 +127,9 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertNativePointToScreen) {
|
||||
|
||||
SetSecondaryDisplayLayout(DisplayLayout::RIGHT);
|
||||
const gfx::Point window_pos2(300, 100);
|
||||
window_->SetBoundsInScreen(gfx::Rect(window_pos2, gfx::Size(100, 100)),
|
||||
gfx::Screen::GetDisplayNearestPoint(window_pos2));
|
||||
window_->SetBoundsInScreen(
|
||||
gfx::Rect(window_pos2, gfx::Size(100, 100)),
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(window_pos2));
|
||||
// The point is on the secondary display.
|
||||
EXPECT_EQ("350,150", ConvertNativePointToScreen(50, 50));
|
||||
// The point is out of the all root windows.
|
||||
@ -171,7 +173,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertNativePointToScreenHiDPI) {
|
||||
EXPECT_EQ("200x200", root_windows[1]->GetHostSize().ToString());
|
||||
|
||||
ash::DisplayController* display_controller =
|
||||
ash::Shell::GetInstance()->display_controller();
|
||||
Shell::GetInstance()->display_controller();
|
||||
// Put |window_| to the primary 2x display.
|
||||
window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50),
|
||||
display_controller->GetPrimaryDisplay());
|
||||
|
@ -56,7 +56,7 @@ views::Widget* CreateWidget(const gfx::Rect& bounds,
|
||||
widget->SetVisibilityChangedAnimationsEnabled(false);
|
||||
widget->GetNativeWindow()->SetName("SharedEdgeIndicator");
|
||||
widget->SetContentsView(contents_view);
|
||||
gfx::Display display = gfx::Screen::GetDisplayMatching(bounds);
|
||||
gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds);
|
||||
aura::Window* window = widget->GetNativeWindow();
|
||||
aura::client::ScreenPositionClient* screen_position_client =
|
||||
aura::client::GetScreenPositionClient(window->GetRootWindow());
|
||||
|
@ -187,15 +187,15 @@ TEST_F(ExtendedDesktopTest, TestCursorLocation) {
|
||||
aura::Window::TestApi root_window1_test_api(root_windows[1]);
|
||||
|
||||
root_windows[0]->MoveCursorTo(gfx::Point(10, 10));
|
||||
EXPECT_EQ("10,10", gfx::Screen::GetCursorScreenPoint().ToString());
|
||||
EXPECT_EQ("10,10", Shell::GetScreen()->GetCursorScreenPoint().ToString());
|
||||
EXPECT_TRUE(root_window0_test_api.ContainsMouse());
|
||||
EXPECT_FALSE(root_window1_test_api.ContainsMouse());
|
||||
root_windows[1]->MoveCursorTo(gfx::Point(10, 20));
|
||||
EXPECT_EQ("1010,20", gfx::Screen::GetCursorScreenPoint().ToString());
|
||||
EXPECT_EQ("1010,20", Shell::GetScreen()->GetCursorScreenPoint().ToString());
|
||||
EXPECT_FALSE(root_window0_test_api.ContainsMouse());
|
||||
EXPECT_TRUE(root_window1_test_api.ContainsMouse());
|
||||
root_windows[0]->MoveCursorTo(gfx::Point(20, 10));
|
||||
EXPECT_EQ("20,10", gfx::Screen::GetCursorScreenPoint().ToString());
|
||||
EXPECT_EQ("20,10", Shell::GetScreen()->GetCursorScreenPoint().ToString());
|
||||
EXPECT_TRUE(root_window0_test_api.ContainsMouse());
|
||||
EXPECT_FALSE(root_window1_test_api.ContainsMouse());
|
||||
}
|
||||
@ -405,10 +405,10 @@ TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) {
|
||||
UpdateDisplay("1000x1000,1000x1000");
|
||||
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
|
||||
|
||||
gfx::Display display0 =
|
||||
gfx::Screen::GetDisplayMatching(root_windows[0]->GetBoundsInScreen());
|
||||
gfx::Display display1 =
|
||||
gfx::Screen::GetDisplayMatching(root_windows[1]->GetBoundsInScreen());
|
||||
gfx::Display display0 = Shell::GetScreen()->GetDisplayMatching(
|
||||
root_windows[0]->GetBoundsInScreen());
|
||||
gfx::Display display1 = Shell::GetScreen()->GetDisplayMatching(
|
||||
root_windows[1]->GetBoundsInScreen());
|
||||
EXPECT_NE(display0.id(), display1.id());
|
||||
|
||||
views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100));
|
||||
@ -602,7 +602,7 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
|
||||
|
||||
// Create normal windows on both displays.
|
||||
views::Widget* widget1 = CreateTestWidget(
|
||||
gfx::Screen::GetPrimaryDisplay().bounds());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds());
|
||||
widget1->Show();
|
||||
EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow());
|
||||
views::Widget* widget2 = CreateTestWidget(
|
||||
@ -612,7 +612,7 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
|
||||
|
||||
// Create a LockScreen window.
|
||||
views::Widget* lock_widget = CreateTestWidget(
|
||||
gfx::Screen::GetPrimaryDisplay().bounds());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds());
|
||||
views::Textfield* textfield = new views::Textfield;
|
||||
lock_widget->SetContentsView(textfield);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
@ -58,6 +59,8 @@ void PaintMessageHandler::DidPaint(const ListValue* args) {
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ash {
|
||||
|
||||
KeyboardOverlayDelegate::KeyboardOverlayDelegate(const string16& title,
|
||||
const GURL& url)
|
||||
: title_(title),
|
||||
@ -80,7 +83,7 @@ void KeyboardOverlayDelegate::Show(views::WebDialogView* view) {
|
||||
// Show the widget at the bottom of the work area.
|
||||
gfx::Size size;
|
||||
GetDialogSize(&size);
|
||||
const gfx::Rect& rect = gfx::Screen::GetDisplayNearestWindow(
|
||||
const gfx::Rect& rect = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
widget->GetNativeView()).work_area();
|
||||
gfx::Rect bounds((rect.width() - size.width()) / 2,
|
||||
rect.height() - size.height(),
|
||||
@ -112,7 +115,7 @@ void KeyboardOverlayDelegate::GetDialogSize(
|
||||
gfx::Size* size) const {
|
||||
using std::min;
|
||||
DCHECK(view_);
|
||||
gfx::Rect rect = gfx::Screen::GetDisplayNearestWindow(
|
||||
gfx::Rect rect = ash::Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
view_->GetWidget()->GetNativeView()).bounds();
|
||||
const int width = min(kBaseWidth, rect.width() - kHorizontalMargin);
|
||||
const int height = width * kBaseHeight / kBaseWidth;
|
||||
@ -141,3 +144,5 @@ bool KeyboardOverlayDelegate::HandleContextMenu(
|
||||
const content::ContextMenuParams& params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -14,6 +14,8 @@ namespace views {
|
||||
class WebDialogView;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class KeyboardOverlayDelegate : public ui::WebDialogDelegate {
|
||||
public:
|
||||
KeyboardOverlayDelegate(const string16& title, const GURL& url);
|
||||
@ -53,4 +55,6 @@ class KeyboardOverlayDelegate : public ui::WebDialogDelegate {
|
||||
DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate);
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_
|
||||
|
@ -31,6 +31,8 @@ const struct KeyEventData {
|
||||
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
KeyboardOverlayView::KeyboardOverlayView(
|
||||
content::BrowserContext* context,
|
||||
WebDialogDelegate* delegate,
|
||||
@ -42,7 +44,7 @@ KeyboardOverlayView::~KeyboardOverlayView() {
|
||||
}
|
||||
|
||||
void KeyboardOverlayView::Cancel() {
|
||||
ash::Shell::GetInstance()->overlay_filter()->Deactivate();
|
||||
Shell::GetInstance()->overlay_filter()->Deactivate();
|
||||
views::Widget* widget = GetWidget();
|
||||
if (widget)
|
||||
widget->Close();
|
||||
@ -75,9 +77,11 @@ void KeyboardOverlayView::ShowDialog(
|
||||
new KeyboardOverlayView(context, delegate, handler);
|
||||
delegate->Show(view);
|
||||
|
||||
ash::Shell::GetInstance()->overlay_filter()->Activate(view);
|
||||
Shell::GetInstance()->overlay_filter()->Activate(view);
|
||||
}
|
||||
|
||||
void KeyboardOverlayView::WindowClosing() {
|
||||
Cancel();
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -20,6 +20,8 @@ namespace ui {
|
||||
class WebDialogDelegate;
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
// A customized dialog view for the keyboard overlay.
|
||||
class ASH_EXPORT KeyboardOverlayView
|
||||
: public views::WebDialogView,
|
||||
@ -47,4 +49,6 @@ class ASH_EXPORT KeyboardOverlayView
|
||||
DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayView);
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "ash/launcher/launcher_types.h"
|
||||
#include "ash/launcher/launcher_view.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ui/gfx/insets.h"
|
||||
#include "ui/gfx/screen.h"
|
||||
#include "ui/views/bubble/bubble_delegate.h"
|
||||
@ -145,7 +146,7 @@ void OverflowBubbleView::ScrollByYOffset(int y_offset) {
|
||||
gfx::Size OverflowBubbleView::GetPreferredSize() {
|
||||
gfx::Size preferred_size = GetContentsSize();
|
||||
|
||||
const gfx::Rect monitor_rect = gfx::Screen::GetDisplayNearestPoint(
|
||||
const gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
GetAnchorRect().CenterPoint()).work_area();
|
||||
if (!monitor_rect.IsEmpty()) {
|
||||
if (is_horizontal_alignment()) {
|
||||
@ -215,7 +216,7 @@ gfx::Rect OverflowBubbleView::GetBubbleBounds() {
|
||||
content_size,
|
||||
false);
|
||||
|
||||
gfx::Rect monitor_rect = gfx::Screen::GetDisplayNearestPoint(
|
||||
gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
anchor_rect.CenterPoint()).work_area();
|
||||
|
||||
int offset = 0;
|
||||
|
@ -58,14 +58,14 @@ gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(
|
||||
gfx::Rect ScreenAsh::GetDisplayBoundsInParent(aura::Window* window) {
|
||||
return ConvertRectFromScreen(
|
||||
window->parent(),
|
||||
gfx::Screen::GetDisplayNearestWindow(window).bounds());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window).bounds());
|
||||
}
|
||||
|
||||
// static
|
||||
gfx::Rect ScreenAsh::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
|
||||
return ConvertRectFromScreen(
|
||||
window->parent(),
|
||||
gfx::Screen::GetDisplayNearestWindow(window).work_area());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window).work_area());
|
||||
}
|
||||
|
||||
// static
|
||||
@ -91,12 +91,16 @@ const gfx::Display& ScreenAsh::GetSecondaryDisplay() {
|
||||
return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay());
|
||||
}
|
||||
|
||||
bool ScreenAsh::IsDIPEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
gfx::Point ScreenAsh::GetCursorScreenPoint() {
|
||||
return aura::Env::GetInstance()->last_mouse_location();
|
||||
}
|
||||
|
||||
gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
|
||||
const gfx::Point point = gfx::Screen::GetCursorScreenPoint();
|
||||
const gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
|
||||
return wm::GetRootWindowAt(point)->GetTopWindowContainingPoint(point);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "ui/gfx/screen_impl.h"
|
||||
#include "ui/gfx/screen.h"
|
||||
|
||||
namespace gfx {
|
||||
class Rect;
|
||||
@ -17,7 +17,7 @@ namespace ash {
|
||||
|
||||
// Aura implementation of gfx::Screen. Implemented here to avoid circular
|
||||
// dependencies.
|
||||
class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl {
|
||||
class ASH_EXPORT ScreenAsh : public gfx::Screen {
|
||||
public:
|
||||
ScreenAsh();
|
||||
virtual ~ScreenAsh();
|
||||
@ -56,6 +56,9 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl {
|
||||
static const gfx::Display& GetSecondaryDisplay();
|
||||
|
||||
protected:
|
||||
|
||||
// Implementation of gfx::Screen:
|
||||
virtual bool IsDIPEnabled() OVERRIDE;
|
||||
virtual gfx::Point GetCursorScreenPoint() OVERRIDE;
|
||||
virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE;
|
||||
|
||||
|
@ -129,7 +129,7 @@ void ScreensaverView::LoadScreensaver() {
|
||||
void ScreensaverView::ShowWindow() {
|
||||
aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
|
||||
gfx::Rect screen_rect =
|
||||
gfx::Screen::GetDisplayNearestWindow(root_window).bounds();
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(root_window).bounds();
|
||||
|
||||
// We want to be the fullscreen topmost child of the root window.
|
||||
// There should be nothing ever really that should show up on top of us.
|
||||
|
@ -185,7 +185,8 @@ Shell::Shell(ShellDelegate* delegate)
|
||||
new internal::OutputConfiguratorAnimation()),
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
browser_context_(NULL) {
|
||||
gfx::Screen::SetInstance(screen_);
|
||||
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_);
|
||||
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_);
|
||||
ui_controls::InstallUIControlsAura(internal::CreateUIControls());
|
||||
#if defined(OS_CHROMEOS)
|
||||
output_configurator_->AddObserver(output_configurator_animation_.get());
|
||||
@ -312,6 +313,11 @@ aura::RootWindow* Shell::GetActiveRootWindow() {
|
||||
return GetInstance()->active_root_window_;
|
||||
}
|
||||
|
||||
// static
|
||||
gfx::Screen* Shell::GetScreen() {
|
||||
return gfx::Screen::GetScreenFor(GetPrimaryRootWindow());
|
||||
}
|
||||
|
||||
// static
|
||||
Shell::RootWindowList Shell::GetAllRootWindows() {
|
||||
return Shell::GetInstance()->display_controller()->
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "ui/gfx/insets.h"
|
||||
#include "ui/gfx/screen.h"
|
||||
#include "ui/gfx/size.h"
|
||||
|
||||
class CommandLine;
|
||||
@ -167,6 +168,9 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
|
||||
// until the another window who has a different root window becomes active.
|
||||
static aura::RootWindow* GetActiveRootWindow();
|
||||
|
||||
// Returns the global Screen object that's always active in ash.
|
||||
static gfx::Screen* GetScreen();
|
||||
|
||||
// Returns all root windows.
|
||||
static RootWindowList GetAllRootWindows();
|
||||
|
||||
|
@ -248,7 +248,7 @@ bool SystemTray::IsMouseInNotificationBubble() const {
|
||||
if (!notification_bubble_.get())
|
||||
return false;
|
||||
return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains(
|
||||
gfx::Screen::GetCursorScreenPoint());
|
||||
Shell::GetScreen()->GetCursorScreenPoint());
|
||||
}
|
||||
|
||||
bool SystemTray::CloseBubbleForTest() const {
|
||||
|
@ -99,6 +99,9 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView,
|
||||
StatusAreaWidget* status_area_widget() {
|
||||
return status_area_widget_;
|
||||
}
|
||||
const StatusAreaWidget* status_area_widget() const {
|
||||
return status_area_widget_;
|
||||
}
|
||||
TrayContainer* tray_container() const { return tray_container_; }
|
||||
ShelfAlignment shelf_alignment() const { return shelf_alignment_; }
|
||||
|
||||
|
@ -345,7 +345,7 @@ gfx::Rect TrayBubbleView::GetAnchorRect() {
|
||||
|
||||
// TODO(jennyz): May need to add left/right alignment in the following code.
|
||||
if (rect.IsEmpty()) {
|
||||
rect = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
rect = Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
rect = gfx::Rect(
|
||||
base::i18n::IsRTL() ? kPaddingFromRightEdgeOfScreenBottomAlignment :
|
||||
rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment,
|
||||
|
@ -202,7 +202,7 @@ bool WebNotificationTray::IsMouseInNotificationBubble() const {
|
||||
if (!popup_bubble())
|
||||
return false;
|
||||
return popup_bubble_->bubble_view()->GetBoundsInScreen().Contains(
|
||||
gfx::Screen::GetCursorScreenPoint());
|
||||
Shell::GetScreen()->GetCursorScreenPoint());
|
||||
}
|
||||
|
||||
void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) {
|
||||
|
@ -80,7 +80,8 @@ void AshTestBase::TearDown() {
|
||||
|
||||
void AshTestBase::ChangeDisplayConfig(float scale,
|
||||
const gfx::Rect& bounds_in_pixel) {
|
||||
gfx::Display display = gfx::Display(gfx::Screen::GetPrimaryDisplay().id());
|
||||
gfx::Display display =
|
||||
gfx::Display(Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
display.SetScaleAndBounds(scale, bounds_in_pixel);
|
||||
std::vector<gfx::Display> displays;
|
||||
displays.push_back(display);
|
||||
|
@ -68,8 +68,8 @@ gfx::Font GetDefaultFont() {
|
||||
int GetMaxWidth(int x, int y) {
|
||||
// TODO(varunjain): implementation duplicated in tooltip_manager_aura. Figure
|
||||
// out a way to merge.
|
||||
gfx::Rect display_bounds =
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point(x, y)).bounds();
|
||||
gfx::Rect display_bounds = ash::Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point(x, y)).bounds();
|
||||
return (display_bounds.width() + 1) / 2;
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ class TooltipController::Tooltip : public views::WidgetObserver {
|
||||
tooltip_height);
|
||||
|
||||
tooltip_rect.Offset(kCursorOffsetX, kCursorOffsetY);
|
||||
gfx::Rect display_bounds =
|
||||
gfx::Screen::GetDisplayNearestPoint(tooltip_rect.origin()).bounds();
|
||||
gfx::Rect display_bounds = Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
tooltip_rect.origin()).bounds();
|
||||
|
||||
// If tooltip is out of bounds on the x axis, we simply shift it
|
||||
// horizontally by the offset.
|
||||
|
@ -42,7 +42,7 @@ class TouchHudCanvas : public views::View {
|
||||
: owner_(owner),
|
||||
path_index_(0),
|
||||
color_index_(0) {
|
||||
gfx::Display display = gfx::Screen::GetPrimaryDisplay();
|
||||
gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay();
|
||||
gfx::Rect bounds = display.bounds();
|
||||
size_.set_width(bounds.width() / kScale);
|
||||
size_.set_height(bounds.height() / kScale);
|
||||
|
@ -107,7 +107,7 @@ class UIControlsAsh : public ui_controls::UIControlsAura {
|
||||
|
||||
virtual bool SendMouseEvents(ui_controls::MouseButton type,
|
||||
int state) OVERRIDE {
|
||||
gfx::Point p(gfx::Screen::GetCursorScreenPoint());
|
||||
gfx::Point p(Shell::GetScreen()->GetCursorScreenPoint());
|
||||
ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
|
||||
return ui_controls && ui_controls->SendMouseEvents(type, state);
|
||||
}
|
||||
@ -116,14 +116,14 @@ class UIControlsAsh : public ui_controls::UIControlsAura {
|
||||
ui_controls::MouseButton type,
|
||||
int state,
|
||||
const base::Closure& closure) OVERRIDE {
|
||||
gfx::Point p(gfx::Screen::GetCursorScreenPoint());
|
||||
gfx::Point p(Shell::GetScreen()->GetCursorScreenPoint());
|
||||
ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
|
||||
return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone(
|
||||
type, state, closure);
|
||||
}
|
||||
|
||||
virtual bool SendMouseClick(ui_controls::MouseButton type) OVERRIDE {
|
||||
gfx::Point p(gfx::Screen::GetCursorScreenPoint());
|
||||
gfx::Point p(Shell::GetScreen()->GetCursorScreenPoint());
|
||||
ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p);
|
||||
return ui_controls && ui_controls->SendMouseClick(type);
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ TEST_F(BaseLayoutManagerTest, Fullscreen) {
|
||||
scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
|
||||
// Fullscreen window fills the whole display.
|
||||
EXPECT_EQ(
|
||||
gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(bounds.ToString(), window->bounds().ToString());
|
||||
}
|
||||
@ -113,14 +113,14 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) {
|
||||
scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
|
||||
// Fullscreen window fills the whole display.
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
|
||||
EXPECT_EQ(
|
||||
gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
// Enlarge the root window. We should still match the display size.
|
||||
Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600));
|
||||
EXPECT_EQ(
|
||||
gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).bounds().ToString(),
|
||||
window->bounds().ToString());
|
||||
}
|
||||
|
||||
// Fails on Mac only. Need to be implemented. http://crbug.com/111279.
|
||||
@ -135,21 +135,23 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) {
|
||||
TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) {
|
||||
scoped_ptr<aura::Window> window(
|
||||
CreateTestWindow(gfx::Rect(10, 20, 500, 400)));
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(window.get()).work_area();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).work_area();
|
||||
// Invariant: Window is smaller than work area.
|
||||
EXPECT_LE(window->bounds().width(), work_area.width());
|
||||
EXPECT_LE(window->bounds().height(), work_area.height());
|
||||
|
||||
// Make the root window narrower than our window.
|
||||
Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 400));
|
||||
work_area = gfx::Screen::GetDisplayNearestWindow(window.get()).work_area();
|
||||
work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
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::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 200));
|
||||
work_area = gfx::Screen::GetDisplayNearestWindow(window.get()).work_area();
|
||||
work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).work_area();
|
||||
EXPECT_LE(window->bounds().width(), work_area.width());
|
||||
EXPECT_LE(window->bounds().height(), work_area.height());
|
||||
|
||||
@ -164,7 +166,7 @@ TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) {
|
||||
// to smaller than the full work area.
|
||||
TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) {
|
||||
// Create a window with bounds that fill the screen.
|
||||
gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
gfx::Rect bounds = Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
|
||||
// Maximize it, which writes the old bounds to restore bounds.
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
|
||||
|
@ -18,7 +18,8 @@ namespace ash {
|
||||
namespace wm {
|
||||
|
||||
aura::RootWindow* GetRootWindowAt(const gfx::Point& point) {
|
||||
const gfx::Display& display = gfx::Screen::GetDisplayNearestPoint(point);
|
||||
const gfx::Display& display =
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(point);
|
||||
// TODO(yusukes): Move coordinate_conversion.cc and .h to ui/aura/ once
|
||||
// GetRootWindowForDisplayId() is moved to aura::Env.
|
||||
return Shell::GetInstance()->display_controller()->
|
||||
@ -26,7 +27,7 @@ aura::RootWindow* GetRootWindowAt(const gfx::Point& point) {
|
||||
}
|
||||
|
||||
aura::RootWindow* GetRootWindowMatching(const gfx::Rect& rect) {
|
||||
const gfx::Display& display = gfx::Screen::GetDisplayMatching(rect);
|
||||
const gfx::Display& display = Shell::GetScreen()->GetDisplayMatching(rect);
|
||||
return Shell::GetInstance()->display_controller()->
|
||||
GetRootWindowForDisplayId(display.id());
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) {
|
||||
// be active.
|
||||
const gfx::Rect& bounds = frame_->GetWindowBoundsInScreen();
|
||||
const gfx::Rect& screen =
|
||||
gfx::Screen::GetDisplayMatching(bounds).work_area();
|
||||
Shell::GetScreen()->GetDisplayMatching(bounds).work_area();
|
||||
if (bounds.y() == screen.y() && bounds.bottom() == screen.bottom()) {
|
||||
// The window is probably either left or right maximized.
|
||||
if (bounds.x() == screen.x()) {
|
||||
|
@ -336,7 +336,8 @@ TEST_F(FramePainterTest, HitTestSpecialMaximizedModes) {
|
||||
views::NonClientFrameView* frame = w1->non_client_view()->frame_view();
|
||||
w1->Show();
|
||||
gfx::Rect any_rect = gfx::Rect(0, 0, 100, 100);
|
||||
gfx::Rect screen = gfx::Screen::GetDisplayMatching(any_rect).work_area();
|
||||
gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(
|
||||
any_rect).work_area();
|
||||
w1->SetBounds(any_rect);
|
||||
EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
|
||||
w1->SetBounds(gfx::Rect(
|
||||
|
@ -160,7 +160,8 @@ bool BezelGestureHandler::HandleApplicationControl(
|
||||
void BezelGestureHandler::HandleBezelGestureStart(
|
||||
aura::Window* target,
|
||||
const ui::GestureEvent& event) {
|
||||
gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds();
|
||||
gfx::Rect screen =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(target).bounds();
|
||||
int overlap_area = screen.width() * overlap_percent_ / 100;
|
||||
orientation_ = SCROLL_ORIENTATION_UNSET;
|
||||
|
||||
@ -214,7 +215,8 @@ void BezelGestureHandler::HandleBezelGestureUpdate(
|
||||
start_location_ = BEZEL_START_UNSET;
|
||||
return;
|
||||
}
|
||||
gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds();
|
||||
gfx::Rect screen =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(target).bounds();
|
||||
// Limit the user gesture "mostly" to the off screen area and check for
|
||||
// noise invocation.
|
||||
if (!GestureInBezelArea(screen, event) ||
|
||||
|
@ -261,7 +261,8 @@ void LongPressAffordanceHandler::ProcessEvent(aura::Window* target,
|
||||
tap_down_location_ = event->root_location();
|
||||
tap_down_touch_id_ = touch_id;
|
||||
current_animation_type_ = GROW_ANIMATION;
|
||||
tap_down_display_id_ = gfx::Screen::GetDisplayNearestWindow(target).id();
|
||||
tap_down_display_id_ =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(target).id();
|
||||
timer_.Start(FROM_HERE,
|
||||
base::TimeDelta::FromMilliseconds(timer_start_time_ms),
|
||||
this,
|
||||
|
@ -490,7 +490,7 @@ void MaximizeBubbleController::Bubble::MouseMovedOutOfHost() {
|
||||
// When we leave the bubble, we might be still be in gesture mode or over
|
||||
// the maximize button. So only close if none of the other cases apply.
|
||||
if (!owner_->frame_maximize_button()->is_snap_enabled()) {
|
||||
gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point screen_location = Shell::GetScreen()->GetCursorScreenPoint();
|
||||
if (!owner_->frame_maximize_button()->GetBoundsInScreen().Contains(
|
||||
screen_location)) {
|
||||
owner_->RequestDestructionThroughOwner();
|
||||
|
@ -880,7 +880,7 @@ ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState(
|
||||
-kNotificationBubbleGapHeight : 0,
|
||||
0);
|
||||
}
|
||||
return shelf_region.Contains(gfx::Screen::GetCursorScreenPoint()) ?
|
||||
return shelf_region.Contains(Shell::GetScreen()->GetCursorScreenPoint()) ?
|
||||
AUTO_HIDE_SHOWN : AUTO_HIDE_HIDDEN;
|
||||
}
|
||||
|
||||
|
@ -218,9 +218,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
|
||||
|
||||
// Make sure the bounds of the two widgets changed.
|
||||
EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
|
||||
gfx::Screen::GetPrimaryDisplay().bounds().bottom());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
|
||||
EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
|
||||
gfx::Screen::GetPrimaryDisplay().bounds().bottom());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
|
||||
|
||||
// And show it again.
|
||||
SetState(shelf, ShelfLayoutManager::VISIBLE);
|
||||
@ -233,8 +233,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
|
||||
|
||||
// Make sure the bounds of the two widgets changed.
|
||||
launcher_bounds = shelf->launcher_widget()->GetNativeView()->bounds();
|
||||
int bottom = gfx::Screen::GetPrimaryDisplay().bounds().bottom() -
|
||||
shelf_height;
|
||||
int bottom =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom() - shelf_height;
|
||||
EXPECT_EQ(launcher_bounds.y(),
|
||||
bottom + (shelf->GetIdealBounds().height() -
|
||||
launcher_bounds.height()) / 2);
|
||||
@ -263,9 +263,9 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
|
||||
|
||||
// Make sure the bounds of the two widgets changed.
|
||||
EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
|
||||
gfx::Screen::GetPrimaryDisplay().bounds().bottom());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
|
||||
EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
|
||||
gfx::Screen::GetPrimaryDisplay().bounds().bottom());
|
||||
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
|
||||
}
|
||||
|
||||
// Makes sure the launcher is initially sized correctly.
|
||||
@ -328,7 +328,8 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) {
|
||||
EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
shelf->launcher_widget()->GetWindowBoundsInScreen().y());
|
||||
EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
root).work_area().bottom());
|
||||
|
||||
// Move the mouse to the bottom of the screen.
|
||||
generator.MoveMouseTo(0, root->bounds().bottom() - 1);
|
||||
@ -340,7 +341,8 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) {
|
||||
EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(),
|
||||
shelf->launcher_widget()->GetWindowBoundsInScreen().y());
|
||||
EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
root).work_area().bottom());
|
||||
|
||||
// Move mouse back up.
|
||||
generator.MoveMouseTo(0, 0);
|
||||
@ -435,7 +437,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
|
||||
widget->Show();
|
||||
aura::Window* window = widget->GetNativeWindow();
|
||||
gfx::Rect display_bounds(
|
||||
gfx::Screen::GetDisplayNearestWindow(window).bounds());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window).bounds());
|
||||
|
||||
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
@ -449,17 +451,20 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
|
||||
|
||||
widget->Maximize();
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(),
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window).work_area().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(),
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window).work_area().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(),
|
||||
EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window).work_area().bottom(),
|
||||
widget->GetWorkAreaBoundsInScreen().bottom());
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ void MoveToDeviceControlBezelStartPosition(
|
||||
TEST_F(SystemGestureEventFilterTest, DeviceControl) {
|
||||
aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
|
||||
|
||||
gfx::Rect screen = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
gfx::Rect screen = Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
int ypos_half = screen.height() / 2;
|
||||
|
||||
ash::AcceleratorController* accelerator =
|
||||
@ -376,7 +376,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) {
|
||||
TEST_F(SystemGestureEventFilterTest, ApplicationControl) {
|
||||
aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
|
||||
|
||||
gfx::Rect screen = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
gfx::Rect screen = Shell::GetScreen()->GetPrimaryDisplay().bounds();
|
||||
int ypos_half = screen.height() / 2;
|
||||
|
||||
aura::test::TestWindowDelegate delegate;
|
||||
|
@ -74,7 +74,7 @@ void SystemModalContainerLayoutManager::OnWindowResized() {
|
||||
if (modal_background_) {
|
||||
// Note: we have to set the entire bounds with the screen offset.
|
||||
modal_background_->SetBounds(
|
||||
gfx::Screen::GetDisplayNearestWindow(container_).bounds());
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(container_).bounds());
|
||||
}
|
||||
if (!modal_windows_.empty()) {
|
||||
aura::Window::Windows::iterator it = modal_windows_.begin();
|
||||
@ -166,7 +166,8 @@ void SystemModalContainerLayoutManager::CreateModalBackground() {
|
||||
modal_background_ = new views::Widget;
|
||||
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
|
||||
params.parent = container_;
|
||||
params.bounds = gfx::Screen::GetDisplayNearestWindow(container_).bounds();
|
||||
params.bounds = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
container_).bounds();
|
||||
modal_background_->Init(params);
|
||||
modal_background_->GetNativeView()->SetName(
|
||||
"SystemModalContainerLayoutManager.ModalBackground");
|
||||
|
@ -330,8 +330,8 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomRightPastMinimum) {
|
||||
|
||||
TEST_F(ToplevelWindowEventHandlerTest, BottomRightWorkArea) {
|
||||
scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT));
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(target.get()).work_area();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
target.get()).work_area();
|
||||
gfx::Point position = target->bounds().origin();
|
||||
// Drag further than work_area bottom.
|
||||
DragFromCenterBy(target.get(), 100, work_area.height());
|
||||
@ -344,8 +344,8 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomRightWorkArea) {
|
||||
|
||||
TEST_F(ToplevelWindowEventHandlerTest, BottomLeftWorkArea) {
|
||||
scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMLEFT));
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(target.get()).work_area();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
target.get()).work_area();
|
||||
gfx::Point position = target->bounds().origin();
|
||||
// Drag further than work_area bottom.
|
||||
DragFromCenterBy(target.get(), -30, work_area.height());
|
||||
@ -359,8 +359,8 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomLeftWorkArea) {
|
||||
|
||||
TEST_F(ToplevelWindowEventHandlerTest, BottomWorkArea) {
|
||||
scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOM));
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(target.get()).work_area();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
target.get()).work_area();
|
||||
gfx::Point position = target->bounds().origin();
|
||||
// Drag further than work_area bottom.
|
||||
DragFromCenterBy(target.get(), 0, work_area.height());
|
||||
@ -386,8 +386,8 @@ TEST_F(ToplevelWindowEventHandlerTest, DontDragToNegativeY) {
|
||||
// Verifies we don't let windows go bigger than the display width.
|
||||
TEST_F(ToplevelWindowEventHandlerTest, DontGotWiderThanScreen) {
|
||||
scoped_ptr<aura::Window> target(CreateWindow(HTRIGHT));
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(target.get()).bounds();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
target.get()).bounds();
|
||||
DragFromCenterBy(target.get(), work_area.width() * 2, 0);
|
||||
// The y location and height should not have changed.
|
||||
EXPECT_EQ(work_area.width(), target->bounds().width());
|
||||
|
@ -402,7 +402,7 @@ gfx::Rect GetMinimizeRectForWindow(aura::Window* window) {
|
||||
// Assume the launcher is overflowed, zoom off to the bottom right of the
|
||||
// work area.
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(window).work_area();
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
|
||||
target_bounds.SetRect(work_area.right(), work_area.bottom(), 0, 0);
|
||||
}
|
||||
target_bounds =
|
||||
|
@ -464,9 +464,9 @@ TEST_F(WindowManagerTest, MouseEventCursors) {
|
||||
TEST_F(WindowManagerTest, MAYBE_TransformActivate) {
|
||||
aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
|
||||
gfx::Size size = root_window->bounds().size();
|
||||
EXPECT_EQ(
|
||||
gfx::Rect(size).ToString(),
|
||||
gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds().ToString());
|
||||
EXPECT_EQ(gfx::Rect(size).ToString(),
|
||||
Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
gfx::Point()).bounds().ToString());
|
||||
|
||||
// Rotate it clock-wise 90 degrees.
|
||||
ui::Transform transform;
|
||||
|
@ -271,8 +271,8 @@ int WindowResizer::GetWidthForDrag(const Details& details,
|
||||
}
|
||||
|
||||
// And don't let the window go bigger than the display.
|
||||
int max_width =
|
||||
gfx::Screen::GetDisplayNearestWindow(details.window).bounds().width();
|
||||
int max_width = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
details.window).bounds().width();
|
||||
if (width > max_width) {
|
||||
width = max_width;
|
||||
*delta_x = -x_multiplier * (details.initial_bounds.width() - max_width);
|
||||
@ -299,8 +299,8 @@ int WindowResizer::GetHeightForDrag(const Details& details,
|
||||
}
|
||||
|
||||
// And don't let the window go bigger than the display.
|
||||
int max_height =
|
||||
gfx::Screen::GetDisplayNearestWindow(details.window).bounds().height();
|
||||
int max_height = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
details.window).bounds().height();
|
||||
if (height > max_height) {
|
||||
height = max_height;
|
||||
*delta_y = -y_multiplier * (details.initial_bounds.height() - max_height);
|
||||
|
@ -108,7 +108,8 @@ void ToggleMaximizedWindow(aura::Window* window) {
|
||||
}
|
||||
|
||||
void CenterWindow(aura::Window* window) {
|
||||
const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window);
|
||||
const gfx::Display display =
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window);
|
||||
gfx::Rect center = display.work_area().Center(window->bounds().size());
|
||||
window->SetBounds(center);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ void FrameMaximizeButton::OnMouseExited(const ui::MouseEvent& event) {
|
||||
// within the bubble.
|
||||
if (!is_snap_enabled_ && maximizer_.get()) {
|
||||
if (maximizer_->GetBubbleWindow()) {
|
||||
gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point screen_location = Shell::GetScreen()->GetCursorScreenPoint();
|
||||
if (!maximizer_->GetBubbleWindow()->GetBoundsInScreen().Contains(
|
||||
screen_location)) {
|
||||
maximizer_.reset();
|
||||
@ -561,7 +561,7 @@ MaximizeBubbleFrameState
|
||||
return FRAME_STATE_FULL;
|
||||
// For Left/right maximize we need to check the dimensions.
|
||||
gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen();
|
||||
gfx::Rect screen = gfx::Screen::GetDisplayMatching(bounds).work_area();
|
||||
gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(bounds).work_area();
|
||||
if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100)
|
||||
return FRAME_STATE_NONE;
|
||||
// We might still have a horizontally filled window at this point which we
|
||||
|
@ -430,7 +430,7 @@ void MultiWindowResizeController::CompleteResize(int event_flags) {
|
||||
window_resizer_.reset();
|
||||
|
||||
// Mouse may still be over resizer, if not hide.
|
||||
gfx::Point screen_loc = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point screen_loc = Shell::GetScreen()->GetCursorScreenPoint();
|
||||
if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) {
|
||||
Hide();
|
||||
} else {
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ash/wm/workspace/workspace_event_handler.h"
|
||||
|
||||
#include "ash/screen_ash.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/wm/property_util.h"
|
||||
#include "ash/wm/window_util.h"
|
||||
#include "ash/wm/workspace/workspace_window_resizer.h"
|
||||
@ -141,7 +142,7 @@ void WorkspaceEventHandler::HandleVerticalResizeDoubleClick(
|
||||
int component =
|
||||
target->delegate()->GetNonClientComponent(event->location());
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(target).work_area();
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(target).work_area();
|
||||
const gfx::Rect* restore_bounds =
|
||||
target->GetProperty(aura::client::kRestoreBoundsKey);
|
||||
if (component == HTBOTTOM || component == HTTOP) {
|
||||
|
@ -50,8 +50,8 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisResizeEdge) {
|
||||
|
||||
wm::ActivateWindow(window.get());
|
||||
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(window.get()).work_area();
|
||||
gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
window.get()).work_area();
|
||||
|
||||
aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
|
||||
window.get());
|
||||
|
@ -74,7 +74,7 @@ class WorkspaceManager2Test : public test::AshTestBase {
|
||||
}
|
||||
|
||||
gfx::Rect GetFullscreenBounds(aura::Window* window) {
|
||||
return gfx::Screen::GetDisplayNearestWindow(window).bounds();
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds();
|
||||
}
|
||||
|
||||
Workspace2* active_workspace() {
|
||||
|
@ -71,7 +71,7 @@ class WorkspaceManagerTest : public test::AshTestBase {
|
||||
}
|
||||
|
||||
gfx::Rect GetFullscreenBounds(aura::Window* window) {
|
||||
return gfx::Screen::GetDisplayNearestWindow(window).bounds();
|
||||
return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds();
|
||||
}
|
||||
|
||||
Workspace* active_workspace() {
|
||||
|
@ -193,11 +193,12 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
|
||||
// Check if the destination is another display.
|
||||
gfx::Point last_mouse_location_in_screen = last_mouse_location_;
|
||||
wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen);
|
||||
gfx::Screen* screen = Shell::GetScreen();
|
||||
const gfx::Display dst_display =
|
||||
gfx::Screen::GetDisplayNearestPoint(last_mouse_location_in_screen);
|
||||
screen->GetDisplayNearestPoint(last_mouse_location_in_screen);
|
||||
|
||||
if (dst_display.id() !=
|
||||
gfx::Screen::GetDisplayNearestWindow(window()->GetRootWindow()).id()) {
|
||||
screen->GetDisplayNearestWindow(window()->GetRootWindow()).id()) {
|
||||
// Don't animate when moving to another display.
|
||||
const gfx::Rect dst_bounds =
|
||||
ScreenAsh::ConvertRectToScreen(window()->parent(), bounds);
|
||||
@ -426,8 +427,8 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
|
||||
|
||||
gfx::Point last_mouse_location_in_screen = last_mouse_location_;
|
||||
wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen);
|
||||
gfx::Display display =
|
||||
gfx::Screen::GetDisplayNearestPoint(last_mouse_location_in_screen);
|
||||
gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(
|
||||
last_mouse_location_in_screen);
|
||||
gfx::Rect work_area =
|
||||
ScreenAsh::ConvertRectFromScreen(window()->parent(), display.work_area());
|
||||
if (details_.window_component == HTCAPTION) {
|
||||
@ -544,7 +545,8 @@ void WorkspaceWindowResizer::UpdateDragPhantomWindow(const gfx::Rect& bounds,
|
||||
PhantomWindowController::STYLE_DRAGGING);
|
||||
// Always show the drag phantom on the |another_root| window.
|
||||
drag_phantom_window_controller_->SetDestinationDisplay(
|
||||
gfx::Screen::GetDisplayMatching(another_root->GetBoundsInScreen()));
|
||||
Shell::GetScreen()->GetDisplayMatching(
|
||||
another_root->GetBoundsInScreen()));
|
||||
if (!layer_)
|
||||
RecreateWindowLayers();
|
||||
drag_phantom_window_controller_->Show(bounds_in_screen, layer_);
|
||||
|
@ -485,7 +485,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
|
||||
ASSERT_EQ(2U, root_windows.size());
|
||||
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
{
|
||||
// Grab (0, 0) of the window.
|
||||
@ -503,7 +503,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
|
||||
}
|
||||
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
{
|
||||
// Grab (0, 0) of the window and move the pointer to (790, 10).
|
||||
@ -519,7 +519,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
|
||||
}
|
||||
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
{
|
||||
// Grab the top-right edge of the window and move the pointer to (0, 10)
|
||||
@ -547,7 +547,7 @@ TEST_F(WorkspaceWindowResizerTest,
|
||||
|
||||
window_->SetBoundsInScreen(
|
||||
gfx::Rect(800, 00, 50, 60),
|
||||
gfx::Screen::GetDisplayNearestWindow(root_windows[1]));
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1]));
|
||||
EXPECT_EQ(root_windows[1], window_->GetRootWindow());
|
||||
{
|
||||
// Grab (0, 0) of the window.
|
||||
@ -569,7 +569,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) {
|
||||
ASSERT_EQ(2U, root_windows.size());
|
||||
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
|
||||
{
|
||||
@ -620,7 +620,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) {
|
||||
|
||||
// Do the same test with RevertDrag().
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
|
||||
{
|
||||
@ -644,7 +644,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_CancelSnapPhantom) {
|
||||
ASSERT_EQ(2U, root_windows.size());
|
||||
|
||||
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
|
||||
gfx::Screen::GetPrimaryDisplay());
|
||||
Shell::GetScreen()->GetPrimaryDisplay());
|
||||
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
|
||||
EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
|
||||
{
|
||||
@ -768,7 +768,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) {
|
||||
Shell::GetInstance()->SetDisplayWorkAreaInsets(
|
||||
Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0));
|
||||
|
||||
ASSERT_EQ(1, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(1, Shell::GetScreen()->GetNumDisplays());
|
||||
|
||||
window_->SetBounds(gfx::Rect(100, 200, 300, 400));
|
||||
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
|
||||
@ -784,7 +784,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) {
|
||||
// Makes sure we don't allow dragging on the work area with multidisplay.
|
||||
TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) {
|
||||
UpdateDisplay("800x600,800x600");
|
||||
ASSERT_EQ(2, gfx::Screen::GetNumDisplays());
|
||||
ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
|
||||
|
||||
Shell::GetInstance()->SetDisplayWorkAreaInsets(
|
||||
Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0));
|
||||
|
@ -16,7 +16,7 @@ namespace chromeos {
|
||||
|
||||
void PrimaryDisplaySwitchObserver::OnRootWindowMoved(
|
||||
const aura::RootWindow* root_window, const gfx::Point& new_origin) {
|
||||
StorePrimaryDisplayIDPref(gfx::Screen::GetPrimaryDisplay().id());
|
||||
StorePrimaryDisplayIDPref(ash::Shell::GetScreen()->GetPrimaryDisplay().id());
|
||||
}
|
||||
|
||||
PrimaryDisplaySwitchObserver::PrimaryDisplaySwitchObserver()
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
#include "chrome/browser/chromeos/extensions/file_manager_util.h"
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/json/json_reader.h"
|
||||
@ -521,7 +522,7 @@ void OpenActionChoiceDialog(const FilePath& path) {
|
||||
url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), false);
|
||||
GURL dialog_url(url);
|
||||
|
||||
const gfx::Size screen = gfx::Screen::GetPrimaryDisplay().size();
|
||||
const gfx::Size screen = ash::Shell::GetScreen()->GetPrimaryDisplay().size();
|
||||
const gfx::Rect bounds((screen.width() - kDialogWidth) / 2,
|
||||
(screen.height() - kDialogHeight) / 2,
|
||||
kDialogWidth,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h"
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/browser/extensions/extension_service.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@ -62,7 +63,9 @@ void OpenWallpaperManager() {
|
||||
GURL wallpaper_picker_url(url);
|
||||
int width = extension->launch_width();
|
||||
int height = extension->launch_height();
|
||||
const gfx::Size screen = gfx::Screen::GetPrimaryDisplay().size();
|
||||
// TODO(oshima|bshe): Open WallpaperManager in the display is is requested.
|
||||
const gfx::Size screen =
|
||||
ash::Shell::GetScreen()->GetPrimaryDisplay().size();
|
||||
const gfx::Rect bounds((screen.width() - width) / 2,
|
||||
(screen.height() - height) / 2,
|
||||
width,
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/message_loop.h"
|
||||
@ -1216,8 +1217,8 @@ void CandidateWindowView::ResizeAndMoveParentFrame() {
|
||||
const int horizontal_offset = GetHorizontalOffset();
|
||||
|
||||
gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen();
|
||||
gfx::Rect screen_bounds =
|
||||
gfx::Screen::GetDisplayMatching(cursor_location_).work_area();
|
||||
gfx::Rect screen_bounds = ash::Shell::GetScreen()->GetDisplayMatching(
|
||||
cursor_location_).work_area();
|
||||
// The size.
|
||||
gfx::Rect frame_bounds = old_bounds;
|
||||
frame_bounds.set_size(GetPreferredSize());
|
||||
@ -1511,7 +1512,7 @@ void InfolistWindowView::UpdateCandidates(
|
||||
void InfolistWindowView::ResizeAndMoveParentFrame() {
|
||||
int x, y;
|
||||
gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen();
|
||||
gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow(
|
||||
gfx::Rect screen_bounds = ash::Shell::GetScreen()->GetDisplayNearestWindow(
|
||||
parent_frame_->GetNativeView()).work_area();
|
||||
// The size.
|
||||
gfx::Rect frame_bounds = old_bounds;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/browser/chromeos/login/helper.h"
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
@ -57,7 +58,7 @@ views::Throbber* CreateDefaultThrobber() {
|
||||
}
|
||||
|
||||
gfx::Rect CalculateScreenBounds(const gfx::Size& size) {
|
||||
gfx::Rect bounds(gfx::Screen::GetPrimaryDisplay().bounds());
|
||||
gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds());
|
||||
if (!size.IsEmpty()) {
|
||||
int horizontal_diff = bounds.width() - size.width();
|
||||
int vertical_diff = bounds.height() - size.height();
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/browser/chromeos/login/webui_screen_locker.h"
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
@ -45,7 +46,7 @@ WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker)
|
||||
}
|
||||
|
||||
void WebUIScreenLocker::LockScreen(bool unlock_on_input) {
|
||||
gfx::Rect bounds(gfx::Screen::GetPrimaryDisplay().bounds());
|
||||
gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds());
|
||||
|
||||
lock_time_ = base::TimeTicks::Now();
|
||||
LockWindow* lock_window = LockWindow::Create();
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "base/bind.h"
|
||||
#include "chrome/browser/chromeos/extensions/file_manager_util.h"
|
||||
#include "chrome/browser/chromeos/extensions/media_player_event_router.h"
|
||||
@ -119,7 +120,8 @@ void MediaPlayer::PopupMediaPlayer() {
|
||||
|
||||
Browser* browser = GetBrowser();
|
||||
if (!browser) {
|
||||
const gfx::Size screen = gfx::Screen::GetPrimaryDisplay().size();
|
||||
const gfx::Size screen =
|
||||
ash::Shell::GetScreen()->GetPrimaryDisplay().size();
|
||||
const gfx::Rect bounds(screen.width() - kPopupRight - kPopupWidth,
|
||||
screen.height() - kPopupBottom - kPopupHeight,
|
||||
kPopupWidth,
|
||||
|
@ -392,7 +392,7 @@ void DragDownload(const DownloadItem* download,
|
||||
if (!root_window || !aura::client::GetDragDropClient(root_window))
|
||||
return;
|
||||
|
||||
gfx::Point location = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint();
|
||||
aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
|
||||
data,
|
||||
root_window,
|
||||
|
@ -348,15 +348,17 @@ PrefService* MetricsLog::GetPrefService() {
|
||||
}
|
||||
|
||||
gfx::Size MetricsLog::GetScreenSize() const {
|
||||
return gfx::Screen::GetPrimaryDisplay().GetSizeInPixel();
|
||||
return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel();
|
||||
}
|
||||
|
||||
float MetricsLog::GetScreenDeviceScaleFactor() const {
|
||||
return gfx::Screen::GetPrimaryDisplay().device_scale_factor();
|
||||
return gfx::Screen::GetNativeScreen()->
|
||||
GetPrimaryDisplay().device_scale_factor();
|
||||
}
|
||||
|
||||
int MetricsLog::GetScreenCount() const {
|
||||
return gfx::Screen::GetNumDisplays();
|
||||
// TODO(scottmg): NativeScreen maybe wrong. http://crbug.com/133312
|
||||
return gfx::Screen::GetNativeScreen()->GetNumDisplays();
|
||||
}
|
||||
|
||||
void MetricsLog::GetFieldTrialIds(
|
||||
|
@ -464,7 +464,9 @@ bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() {
|
||||
#if defined(OS_MACOSX)
|
||||
gfx::Rect new_work_area = GetMacWorkArea();
|
||||
#else
|
||||
gfx::Rect new_work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
gfx::Rect new_work_area =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
|
||||
#endif
|
||||
if (work_area_ != new_work_area) {
|
||||
work_area_.SetRect(new_work_area.x(), new_work_area.y(),
|
||||
|
@ -130,8 +130,9 @@ SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase(
|
||||
display_mode_(DISPLAY_MODE_RECORDING),
|
||||
web_contents_(web_contents),
|
||||
scale_factor_(ui::SCALE_FACTOR_NONE) {
|
||||
gfx::Display display = gfx::Screen::GetDisplayNearestWindow(
|
||||
web_contents_ ? web_contents_->GetNativeView() : NULL);
|
||||
gfx::NativeView view = web_contents_ ? web_contents_->GetNativeView() : NULL;
|
||||
gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
|
||||
gfx::Display display = screen->GetDisplayNearestWindow(view);
|
||||
scale_factor_ = ui::GetScaleFactorFromScale(
|
||||
display.device_scale_factor());
|
||||
|
||||
|
@ -108,7 +108,8 @@ gfx::Size GetThumbnailSizeInPixel() {
|
||||
gfx::Size thumbnail_size(kThumbnailWidth, kThumbnailHeight);
|
||||
// Determine the resolution of the thumbnail based on the primary monitor.
|
||||
// TODO(oshima): Use device's default scale factor.
|
||||
gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay();
|
||||
gfx::Display primary_display =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
|
||||
return gfx::ToFlooredSize(
|
||||
thumbnail_size.Scale(primary_display.device_scale_factor()));
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ bool IsNativeWindowInAsh(gfx::NativeWindow native_window) {
|
||||
}
|
||||
|
||||
void ToggleAshDesktop() {
|
||||
// TODO(scottmg): Probably need to force Ash here. http://crbug.com/133312
|
||||
if (!ash::Shell::HasInstance())
|
||||
OpenAsh();
|
||||
else
|
||||
|
@ -283,9 +283,9 @@ void ChromeShellDelegate::ShowKeyboardOverlay() {
|
||||
// TODO(mazda): Move the show logic to ash (http://crbug.com/124222).
|
||||
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
|
||||
std::string url(chrome::kChromeUIKeyboardOverlayURL);
|
||||
KeyboardOverlayView::ShowDialog(profile,
|
||||
new ChromeWebContentsHandler,
|
||||
GURL(url));
|
||||
ash::KeyboardOverlayView::ShowDialog(profile,
|
||||
new ChromeWebContentsHandler,
|
||||
GURL(url));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ gfx::Rect WindowPositioner::GetPopupPosition(const gfx::Rect& old_pos) {
|
||||
// work area.
|
||||
aura::Window* window = ash::wm::GetActiveWindow();
|
||||
const gfx::Rect work_area = window && window->IsVisible() ?
|
||||
gfx::Screen::GetDisplayNearestWindow(window).work_area() :
|
||||
gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
Shell::GetScreen()->GetDisplayNearestWindow(window).work_area() :
|
||||
Shell::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
// Only try to reposition the popup when it is not spanning the entire
|
||||
// screen.
|
||||
if ((old_pos.width() + popup_position_offset_from_screen_corner_x >=
|
||||
|
@ -180,7 +180,8 @@ int AlignToGridRoundDown(int location, int grid_size) {
|
||||
}
|
||||
|
||||
TEST_F(WindowPositionerTest, cascading) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
const gfx::Rect work_area =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
|
||||
// First see that the window will cascade down when there is no space.
|
||||
window()->SetBounds(work_area);
|
||||
@ -240,7 +241,8 @@ TEST_F(WindowPositionerTest, cascading) {
|
||||
}
|
||||
|
||||
TEST_F(WindowPositionerTest, filling) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
const gfx::Rect work_area =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
gfx::Rect popup_position(0, 0, 256, 128);
|
||||
// Leave space on the left and the right and see if we fill top to bottom.
|
||||
window()->SetBounds(gfx::Rect(work_area.x() + popup_position.width(),
|
||||
@ -294,7 +296,8 @@ TEST_F(WindowPositionerTest, filling) {
|
||||
}
|
||||
|
||||
TEST_F(WindowPositionerTest, blockedByPanel) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
const gfx::Rect work_area =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
|
||||
gfx::Rect pop_position(0, 0, 200, 200);
|
||||
// Let the panel cover everything.
|
||||
@ -309,7 +312,8 @@ TEST_F(WindowPositionerTest, blockedByPanel) {
|
||||
}
|
||||
|
||||
TEST_F(WindowPositionerTest, biggerThenBorder) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
const gfx::Rect work_area =
|
||||
Shell::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
|
||||
gfx::Rect pop_position(0, 0, work_area.width(), work_area.height());
|
||||
|
||||
|
@ -29,7 +29,8 @@ ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() {
|
||||
|
||||
void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
|
||||
#if !defined(USE_ASH)
|
||||
gfx::Screen::SetInstance(aura::CreateDesktopScreen());
|
||||
gfx::Screen::SetScreenInstance(
|
||||
gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen());
|
||||
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);
|
||||
stacking_client_.reset(new aura::DesktopStackingClient);
|
||||
#endif // !USE_ASH
|
||||
|
@ -2015,8 +2015,8 @@ void BrowserWindowGtk::SaveWindowPosition() {
|
||||
window_preferences->SetInteger("bottom", restored_bounds_.bottom());
|
||||
window_preferences->SetBoolean("maximized", IsMaximized());
|
||||
|
||||
gfx::Rect work_area(
|
||||
gfx::Screen::GetDisplayMatching(restored_bounds_).work_area());
|
||||
gfx::Rect work_area(gfx::Screen::GetNativeScreen()->GetDisplayMatching(
|
||||
restored_bounds_).work_area());
|
||||
window_preferences->SetInteger("work_area_left", work_area.x());
|
||||
window_preferences->SetInteger("work_area_top", work_area.y());
|
||||
window_preferences->SetInteger("work_area_right", work_area.right());
|
||||
|
@ -85,7 +85,7 @@ DraggedTabControllerGtk::~DraggedTabControllerGtk() {
|
||||
}
|
||||
|
||||
void DraggedTabControllerGtk::CaptureDragInfo(const gfx::Point& mouse_offset) {
|
||||
start_screen_point_ = gfx::Screen::GetCursorScreenPoint();
|
||||
start_screen_point_ = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
mouse_offset_ = mouse_offset;
|
||||
}
|
||||
|
||||
@ -248,7 +248,8 @@ void DraggedTabControllerGtk::Observe(
|
||||
}
|
||||
|
||||
gfx::Point DraggedTabControllerGtk::GetWindowCreatePoint() const {
|
||||
gfx::Point creation_point = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point creation_point =
|
||||
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
gfx::Point distance_from_origin =
|
||||
dragged_view_->GetDistanceFromTabStripOriginToMousePointer();
|
||||
// TODO(dpapad): offset also because of tabstrip origin being different than
|
||||
@ -261,7 +262,8 @@ void DraggedTabControllerGtk::ContinueDragging() {
|
||||
// TODO(jhawkins): We don't handle the situation where the last tab is dragged
|
||||
// out of a window, so we'll just go with the way Windows handles dragging for
|
||||
// now.
|
||||
gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point screen_point =
|
||||
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
|
||||
// Determine whether or not we have dragged over a compatible TabStrip in
|
||||
// another browser window. If we have, we should attach to it and start
|
||||
@ -877,7 +879,8 @@ void DraggedTabControllerGtk::BringWindowUnderMouseToFront() {
|
||||
gfx::NativeView dragged_tab = dragged_view_->widget();
|
||||
dock_windows_.insert(dragged_tab);
|
||||
window = DockInfo::GetLocalProcessWindowAtPoint(
|
||||
gfx::Screen::GetCursorScreenPoint(), dock_windows_);
|
||||
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(),
|
||||
dock_windows_);
|
||||
dock_windows_.erase(dragged_tab);
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,10 @@ gfx::Rect DisplaySettingsProvider::GetDisplayArea() {
|
||||
return adjusted_work_area_;
|
||||
}
|
||||
|
||||
// TODO(scottmg): This should be moved to ui/.
|
||||
gfx::Rect DisplaySettingsProvider::GetPrimaryScreenArea() const {
|
||||
return gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds();
|
||||
}
|
||||
|
||||
gfx::Rect DisplaySettingsProvider::GetWorkArea() const {
|
||||
@ -78,7 +80,8 @@ gfx::Rect DisplaySettingsProvider::GetWorkArea() const {
|
||||
// screen (and overlap Dock). And we also want to exclude the system menu
|
||||
// area. Note that the rect returned from gfx::Screen util functions is in
|
||||
// platform-independent screen coordinates with (0, 0) as the top-left corner.
|
||||
gfx::Display display = gfx::Screen::GetPrimaryDisplay();
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
|
||||
gfx::Rect display_area = display.bounds();
|
||||
gfx::Rect work_area = display.work_area();
|
||||
int system_menu_height = work_area.y() - display_area.y();
|
||||
@ -88,9 +91,11 @@ gfx::Rect DisplaySettingsProvider::GetWorkArea() const {
|
||||
}
|
||||
return display_area;
|
||||
#else
|
||||
gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
#endif
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
|
||||
return work_area;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DisplaySettingsProvider::OnDisplaySettingsChanged() {
|
||||
|
@ -83,7 +83,8 @@ class PanelAndDesktopNotificationTest : public BasePanelBrowserTest {
|
||||
// The position returned by the notification balloon is based on Mac's
|
||||
// vertically inverted orientation. We need to flip it so that it can
|
||||
// be compared against the position returned by the panel.
|
||||
gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size();
|
||||
gfx::Size screen_size =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size();
|
||||
return screen_size.height() - balloon->GetPosition().y();
|
||||
#else
|
||||
return balloon->GetPosition().y() + balloon->GetViewSize().height();
|
||||
|
@ -65,7 +65,8 @@ bool PanelMouseWatcherTimer::IsActive() const {
|
||||
}
|
||||
|
||||
gfx::Point PanelMouseWatcherTimer::GetMousePosition() const {
|
||||
return gfx::Screen::GetCursorScreenPoint();
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
return gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
}
|
||||
|
||||
void PanelMouseWatcherTimer::DoWork() {
|
||||
|
@ -69,7 +69,8 @@ class PDFBrowserTest : public InProcessBrowserTest,
|
||||
// to a smaller window and then expanding leads to slight anti-aliasing
|
||||
// differences of the text and the pixel comparison fails.
|
||||
gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight));
|
||||
gfx::Rect screen_bounds = gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
gfx::Rect screen_bounds =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds();
|
||||
ASSERT_GT(screen_bounds.width(), kBrowserWidth);
|
||||
ASSERT_GT(screen_bounds.height(), kBrowserHeight);
|
||||
browser()->window()->SetBounds(bounds);
|
||||
|
@ -441,7 +441,9 @@ void StartupBrowserCreatorImpl::ExtractOptionalAppWindowSize(
|
||||
std::string switch_value =
|
||||
command_line_.GetSwitchValueASCII(switches::kAppWindowSize);
|
||||
if (ParseCommaSeparatedIntegers(switch_value, &width, &height)) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
// TODO(scottmg): NativeScreen might be wrong. http://crbug.com/133312
|
||||
const gfx::Rect work_area =
|
||||
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
|
||||
width = std::min(width, work_area.width());
|
||||
height = std::min(height, work_area.height());
|
||||
bounds->set_size(gfx::Size(width, height));
|
||||
|
@ -172,7 +172,7 @@ void AppListController::ShowAppList() {
|
||||
// owned by the app list view. The app list view manages it's own lifetime.
|
||||
current_view_ = new app_list::AppListView(
|
||||
new AppListViewDelegate(new AppListControllerDelegateWin()));
|
||||
gfx::Point cursor = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
current_view_->InitAsBubble(GetDesktopWindow(),
|
||||
&pagination_model_,
|
||||
NULL,
|
||||
@ -265,7 +265,8 @@ void AppListController::UpdateArrowPositionAndAnchorPoint(
|
||||
int min_space_y = preferred.height() + kAnchorOffset + kPadding + kArrowSize;
|
||||
|
||||
gfx::Point anchor = view->anchor_point();
|
||||
gfx::Display display = gfx::Screen::GetDisplayNearestPoint(anchor);
|
||||
gfx::Display display = gfx::Screen::GetScreenFor(
|
||||
view->GetWidget()->GetNativeView())->GetDisplayNearestPoint(anchor);
|
||||
const gfx::Rect& display_rect = display.work_area();
|
||||
views::BubbleBorder::ArrowLocation arrow;
|
||||
GetArrowLocationAndUpdateAnchor(display.work_area(),
|
||||
|
@ -7,17 +7,34 @@
|
||||
#include "chrome/browser/chrome_browser_main.h"
|
||||
#include "chrome/browser/toolkit_extra_parts.h"
|
||||
#include "chrome/browser/ui/ash/ash_init.h"
|
||||
#include "chrome/browser/ui/ash/ash_util.h"
|
||||
#include "ui/aura/desktop/desktop_screen.h"
|
||||
#include "ui/aura/desktop/desktop_stacking_client.h"
|
||||
#include "ui/aura/env.h"
|
||||
#include "ui/aura/single_display_manager.h"
|
||||
#include "ui/gfx/screen.h"
|
||||
#include "ui/gfx/screen_type_delegate.h"
|
||||
|
||||
#if defined(FILE_MANAGER_EXTENSION)
|
||||
#include "chrome/browser/ui/views/select_file_dialog_extension.h"
|
||||
#include "chrome/browser/ui/views/select_file_dialog_extension_factory.h"
|
||||
#endif
|
||||
|
||||
#if !defined(OS_CHROMEOS)
|
||||
class ScreenTypeDelegateWin : public gfx::ScreenTypeDelegate {
|
||||
public:
|
||||
ScreenTypeDelegateWin() {}
|
||||
virtual gfx::ScreenType GetScreenTypeForNativeView(
|
||||
gfx::NativeView view) OVERRIDE {
|
||||
return chrome::IsNativeViewInAsh(view) ?
|
||||
gfx::SCREEN_TYPE_ALTERNATE :
|
||||
gfx::SCREEN_TYPE_NATIVE;
|
||||
}
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateWin);
|
||||
};
|
||||
#endif
|
||||
|
||||
ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {
|
||||
}
|
||||
|
||||
@ -30,7 +47,11 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
|
||||
} else {
|
||||
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);
|
||||
stacking_client_.reset(new aura::DesktopStackingClient);
|
||||
gfx::Screen::SetInstance(aura::CreateDesktopScreen());
|
||||
gfx::Screen::SetScreenInstance(
|
||||
gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen());
|
||||
#if !defined(OS_CHROMEOS)
|
||||
gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FILE_MANAGER_EXTENSION)
|
||||
|
@ -164,8 +164,8 @@ class BookmarkButton : public views::TextButton {
|
||||
string16* tooltip) const OVERRIDE {
|
||||
gfx::Point location(p);
|
||||
ConvertPointToScreen(this, &location);
|
||||
*tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_,
|
||||
text(), profile_);
|
||||
*tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(
|
||||
location, url_, text(), profile_, GetWidget()->GetNativeView());
|
||||
return !tooltip->empty();
|
||||
}
|
||||
|
||||
@ -537,9 +537,11 @@ string16 BookmarkBarView::CreateToolTipForURLAndTitle(
|
||||
const gfx::Point& screen_loc,
|
||||
const GURL& url,
|
||||
const string16& title,
|
||||
Profile* profile) {
|
||||
Profile* profile,
|
||||
gfx::NativeView context) {
|
||||
int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(),
|
||||
screen_loc.y());
|
||||
screen_loc.y(),
|
||||
context);
|
||||
gfx::Font tt_font = views::TooltipManager::GetDefaultFont();
|
||||
string16 result;
|
||||
|
||||
|
@ -142,14 +142,16 @@ class BookmarkBarView : public DetachableToolbarView,
|
||||
void StopThrobbing(bool immediate);
|
||||
|
||||
// Returns the tooltip text for the specified url and title. The returned
|
||||
// text is clipped to fit within the bounds of the monitor.
|
||||
// text is clipped to fit within the bounds of the monitor. |context| is
|
||||
// used to determine which gfx::Screen is used to retrieve bounds.
|
||||
//
|
||||
// Note that we adjust the direction of both the URL and the title based on
|
||||
// the locale so that pure LTR strings are displayed properly in RTL locales.
|
||||
static string16 CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
|
||||
const GURL& url,
|
||||
const string16& title,
|
||||
Profile* profile);
|
||||
Profile* profile,
|
||||
gfx::NativeView context);
|
||||
|
||||
// DetachableToolbarView methods:
|
||||
virtual bool IsDetached() const OVERRIDE;
|
||||
|
@ -110,7 +110,8 @@ string16 BookmarkMenuDelegate::GetTooltipText(
|
||||
const BookmarkNode* node = i->second;
|
||||
if (node->is_url()) {
|
||||
return BookmarkBarView::CreateToolTipForURLAndTitle(
|
||||
screen_loc, node->url(), node->GetTitle(), profile_);
|
||||
screen_loc, node->url(), node->GetTitle(), profile_,
|
||||
parent()->GetNativeView());
|
||||
}
|
||||
return string16();
|
||||
}
|
||||
|
@ -85,6 +85,8 @@ class BookmarkMenuDelegate : public BaseBookmarkModelObserver,
|
||||
Profile* profile() { return profile_; }
|
||||
|
||||
views::Widget* parent() { return parent_; }
|
||||
const views::Widget* parent() const { return parent_; }
|
||||
|
||||
|
||||
// Returns true if we're in the process of mutating the model. This happens
|
||||
// when the user deletes menu items using the context menu.
|
||||
|
@ -79,8 +79,8 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
|
||||
window_preferences->SetInteger("bottom", bounds.bottom());
|
||||
window_preferences->SetBoolean("maximized",
|
||||
show_state == ui::SHOW_STATE_MAXIMIZED);
|
||||
gfx::Rect work_area(
|
||||
gfx::Screen::GetDisplayMatching(bounds).work_area());
|
||||
gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())->
|
||||
GetDisplayMatching(bounds).work_area());
|
||||
window_preferences->SetInteger("work_area_left", work_area.x());
|
||||
window_preferences->SetInteger("work_area_top", work_area.y());
|
||||
window_preferences->SetInteger("work_area_right", work_area.right());
|
||||
|
@ -129,7 +129,7 @@ extensions::ExtensionHost* ExtensionDialog::CreateExtensionHost(
|
||||
void ExtensionDialog::InitWindowFullscreen() {
|
||||
aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
|
||||
gfx::Rect screen_rect =
|
||||
gfx::Screen::GetDisplayNearestWindow(root_window).bounds();
|
||||
ash::Shell::GetScreen()->GetDisplayNearestWindow(root_window).bounds();
|
||||
|
||||
// We want to be the fullscreen topmost child of the root window.
|
||||
window_ = new views::Widget;
|
||||
@ -164,7 +164,8 @@ void ExtensionDialog::InitWindow(BaseWindow* base_window,
|
||||
int y = center.y() - height / 2;
|
||||
// Ensure the top left and top right of the window are on screen, with
|
||||
// priority given to the top left.
|
||||
gfx::Rect screen_rect = gfx::Screen::GetDisplayNearestPoint(center).bounds();
|
||||
gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)->
|
||||
GetDisplayNearestPoint(center).bounds();
|
||||
gfx::Rect bounds_rect = gfx::Rect(x, y, width, height);
|
||||
bounds_rect = bounds_rect.AdjustToFit(screen_rect);
|
||||
window_->SetBounds(bounds_rect);
|
||||
|
@ -146,11 +146,11 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, SnapLeftClosesControls) {
|
||||
|
||||
// Ensure that the controls are at the proper locations.
|
||||
IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, ControlsAtRightSide) {
|
||||
const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
|
||||
aura::RootWindow* root_window = GetRootWindow();
|
||||
aura::test::EventGenerator eg(root_window);
|
||||
aura::Window* native_window = app_browser()->window()->GetNativeWindow();
|
||||
const gfx::Rect work_area =
|
||||
gfx::Screen::GetScreenFor(native_window)->GetPrimaryDisplay().work_area();
|
||||
|
||||
// Control window exists.
|
||||
aura::Window* window = GetChildWindowNamed(
|
||||
|
@ -340,7 +340,9 @@ gfx::Rect FullscreenExitBubbleViews::GetPopupRect(
|
||||
gfx::Size size(view_->GetPreferredSize());
|
||||
// NOTE: don't use the bounds of the root_view_. On linux changing window
|
||||
// size is async. Instead we use the size of the screen.
|
||||
gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow(
|
||||
gfx::Screen* screen =
|
||||
gfx::Screen::GetScreenFor(root_view_->GetWidget()->GetNativeView());
|
||||
gfx::Rect screen_bounds = screen->GetDisplayNearestWindow(
|
||||
root_view_->GetWidget()->GetNativeView()).bounds();
|
||||
gfx::Point origin(screen_bounds.x() +
|
||||
(screen_bounds.width() - size.width()) / 2,
|
||||
@ -357,7 +359,8 @@ gfx::Rect FullscreenExitBubbleViews::GetPopupRect(
|
||||
}
|
||||
|
||||
gfx::Point FullscreenExitBubbleViews::GetCursorScreenPoint() {
|
||||
gfx::Point cursor_pos = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point cursor_pos = gfx::Screen::GetScreenFor(
|
||||
root_view_->GetWidget()->GetNativeView())->GetCursorScreenPoint();
|
||||
views::View::ConvertPointToTarget(NULL, root_view_, &cursor_pos);
|
||||
return cursor_pos;
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ bool BalloonCollectionImpl::IsCursorInBalloonCollection() const {
|
||||
#else
|
||||
// TODO(saintlou): Not sure if this is correct because on Windows at least
|
||||
// the following call is GetCursorPos() not GetMessagePos().
|
||||
gfx::Point cursor(gfx::Screen::GetCursorScreenPoint());
|
||||
// TODO(scottmg): NativeScreen might be wrong. http://crbug.com/133312
|
||||
gfx::Point cursor(gfx::Screen::GetNativeScreen()->GetCursorScreenPoint());
|
||||
#endif
|
||||
return GetBalloonsBoundingBox().Contains(cursor);
|
||||
}
|
||||
|
@ -686,8 +686,8 @@ void PanelView::OnWidgetActivationChanged(views::Widget* widget, bool active) {
|
||||
// When the user clicks on the minimized panel, the panel expansion will be
|
||||
// done when we process the mouse button pressed message.
|
||||
if (focused_ && panel_->IsMinimized() &&
|
||||
gfx::Screen::GetWindowAtCursorScreenPoint() !=
|
||||
widget->GetNativeWindow()) {
|
||||
gfx::Screen::GetScreenFor(widget->GetNativeWindow())->
|
||||
GetWindowAtCursorScreenPoint() != widget->GetNativeWindow()) {
|
||||
panel_->Restore();
|
||||
}
|
||||
|
||||
|
@ -766,9 +766,9 @@ void StatusBubbleViews::AvoidMouse(const gfx::Point& location) {
|
||||
|
||||
// Check if the bubble sticks out from the monitor or will obscure
|
||||
// download shelf.
|
||||
gfx::NativeView widget = base_view_->GetWidget()->GetNativeView();
|
||||
gfx::Rect monitor_rect =
|
||||
gfx::Screen::GetDisplayNearestWindow(widget).work_area();
|
||||
gfx::NativeView window = base_view_->GetWidget()->GetNativeView();
|
||||
gfx::Rect monitor_rect = gfx::Screen::GetScreenFor(window)->
|
||||
GetDisplayNearestWindow(window).work_area();
|
||||
const int bubble_bottom_y = top_left.y() + position_.y() + size_.height();
|
||||
|
||||
if (bubble_bottom_y + offset > monitor_rect.height() ||
|
||||
|
@ -78,7 +78,8 @@ LRESULT CALLBACK StatusTrayWin::WndProc(HWND hwnd,
|
||||
i != status_icons().end(); ++i) {
|
||||
StatusIconWin* win_icon = static_cast<StatusIconWin*>(*i);
|
||||
if (win_icon->icon_id() == wparam) {
|
||||
gfx::Point cursor_pos(gfx::Screen::GetCursorScreenPoint());
|
||||
gfx::Point cursor_pos(
|
||||
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint());
|
||||
win_icon->HandleClickEvent(cursor_pos, lparam == WM_LBUTTONDOWN);
|
||||
break;
|
||||
}
|
||||
|
@ -242,8 +242,8 @@ class DockToWindowFinder : public BaseWindowFinder {
|
||||
const std::set<HWND>& ignore)
|
||||
: BaseWindowFinder(ignore),
|
||||
screen_loc_(screen_loc) {
|
||||
gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(
|
||||
screen_loc).bounds();
|
||||
gfx::Rect work_area = gfx::Screen::GetNativeScreen()->
|
||||
GetDisplayNearestPoint(screen_loc).bounds();
|
||||
if (!work_area.IsEmpty()) {
|
||||
result_.set_monitor_bounds(work_area);
|
||||
EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam());
|
||||
|
@ -404,6 +404,8 @@ void TabDragController::Init(
|
||||
DCHECK(!tabs.empty());
|
||||
DCHECK(std::find(tabs.begin(), tabs.end(), source_tab) != tabs.end());
|
||||
source_tabstrip_ = source_tabstrip;
|
||||
screen_ = gfx::Screen::GetScreenFor(
|
||||
source_tabstrip->GetWidget()->GetNativeView());
|
||||
source_tab_offset_ = source_tab_offset;
|
||||
start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y());
|
||||
views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_);
|
||||
@ -674,7 +676,7 @@ gfx::Point TabDragController::GetWindowCreatePoint(
|
||||
|
||||
// If the cursor is outside the monitor area, move it inside. For example,
|
||||
// dropping a tab onto the task bar on Windows produces this situation.
|
||||
gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(origin).work_area();
|
||||
gfx::Rect work_area = screen_->GetDisplayNearestPoint(origin).work_area();
|
||||
gfx::Point create_point(origin);
|
||||
if (!work_area.IsEmpty()) {
|
||||
if (create_point.x() < work_area.x())
|
||||
@ -1989,7 +1991,7 @@ gfx::Point TabDragController::GetCursorScreenPoint() {
|
||||
return touch_point;
|
||||
}
|
||||
#endif
|
||||
return gfx::Screen::GetCursorScreenPoint();
|
||||
return screen_->GetCursorScreenPoint();
|
||||
}
|
||||
|
||||
gfx::Point TabDragController::GetWindowOffset(
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "ui/gfx/rect.h"
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
namespace gfx {
|
||||
class Screen;
|
||||
}
|
||||
namespace views {
|
||||
class View;
|
||||
}
|
||||
@ -471,6 +474,10 @@ class TabDragController : public content::WebContentsDelegate,
|
||||
// dragged Tab is detached.
|
||||
TabStrip* attached_tabstrip_;
|
||||
|
||||
// The screen that this drag is associated with. Cached, because other UI
|
||||
// elements are NULLd at various points during the lifetime of this object.
|
||||
gfx::Screen* screen_;
|
||||
|
||||
// The visual representation of the dragged Tab.
|
||||
scoped_ptr<DraggedTabView> view_;
|
||||
|
||||
|
@ -157,7 +157,7 @@ Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
|
||||
ResetIDs(browser2->tab_strip_model(), 100);
|
||||
|
||||
// Resize the two windows so they're right next to each other.
|
||||
gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow(
|
||||
gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
|
||||
browser()->window()->GetNativeWindow()).work_area();
|
||||
gfx::Size half_size =
|
||||
gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
|
||||
@ -1085,7 +1085,7 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
|
||||
std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows());
|
||||
ASSERT_EQ(2u, roots.size());
|
||||
aura::RootWindow* second_root = roots[1];
|
||||
gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow(
|
||||
gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
|
||||
second_root).work_area();
|
||||
browser2->window()->SetBounds(work_area);
|
||||
EXPECT_EQ(second_root,
|
||||
@ -1197,7 +1197,8 @@ IN_PROC_BROWSER_TEST_F(
|
||||
std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows());
|
||||
ASSERT_EQ(2u, roots.size());
|
||||
gfx::Point final_destination =
|
||||
gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area().CenterPoint();
|
||||
gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
|
||||
roots[1]).work_area().CenterPoint();
|
||||
|
||||
// Move to the first tab and drag it enough so that it detaches, but not
|
||||
// enough to move to another display.
|
||||
@ -1233,14 +1234,15 @@ IN_PROC_BROWSER_TEST_F(
|
||||
EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
|
||||
EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
|
||||
|
||||
gfx::Rect work_area =
|
||||
gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area();
|
||||
gfx::Rect work_area = gfx::Screen::GetNativeScreen()->
|
||||
GetDisplayNearestWindow(roots[1]).work_area();
|
||||
browser()->window()->SetBounds(work_area);
|
||||
EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow());
|
||||
|
||||
// Move the second browser to the display.
|
||||
gfx::Point final_destination =
|
||||
gfx::Screen::GetDisplayNearestWindow(roots[0]).work_area().CenterPoint();
|
||||
gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
|
||||
roots[0]).work_area().CenterPoint();
|
||||
|
||||
// Move to the first tab and drag it enough so that it detaches, but not
|
||||
// enough to move to another display.
|
||||
|
@ -566,7 +566,8 @@ void TabStrip::RemoveTabDelegate::HighlightCloseButton() {
|
||||
return;
|
||||
|
||||
widget->ResetLastMouseMoveFlag();
|
||||
gfx::Point position = gfx::Screen::GetCursorScreenPoint();
|
||||
gfx::Point position = gfx::Screen::GetScreenFor(
|
||||
widget->GetNativeView())->GetCursorScreenPoint();
|
||||
views::View* root_view = widget->GetRootView();
|
||||
views::View::ConvertPointFromScreen(root_view, &position);
|
||||
ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED,
|
||||
|
@ -117,7 +117,7 @@ void DisplayOptionsHandler::SendDisplayInfo() {
|
||||
base::FundamentalValue mirroring(
|
||||
output_configurator->output_state() == chromeos::STATE_DUAL_MIRROR);
|
||||
|
||||
int64 primary_id = gfx::Screen::GetPrimaryDisplay().id();
|
||||
int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
|
||||
base::ListValue displays;
|
||||
for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
|
||||
const gfx::Display* display = display_manager->GetDisplayAt(i);
|
||||
|
@ -25,17 +25,22 @@ const int kMinVisibleWidth = 30;
|
||||
|
||||
class DefaultMonitorInfoProvider : public MonitorInfoProvider {
|
||||
public:
|
||||
explicit DefaultMonitorInfoProvider(const gfx::Screen* screen)
|
||||
: screen_(screen) {}
|
||||
// Overridden from MonitorInfoProvider:
|
||||
virtual gfx::Rect GetPrimaryDisplayWorkArea() const OVERRIDE {
|
||||
return gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
return screen_->GetPrimaryDisplay().work_area();
|
||||
}
|
||||
virtual gfx::Rect GetPrimaryDisplayBounds() const OVERRIDE {
|
||||
return gfx::Screen::GetPrimaryDisplay().bounds();
|
||||
return screen_->GetPrimaryDisplay().bounds();
|
||||
}
|
||||
virtual gfx::Rect GetMonitorWorkAreaMatching(
|
||||
const gfx::Rect& match_rect) const OVERRIDE {
|
||||
return gfx::Screen::GetDisplayMatching(match_rect).work_area();
|
||||
return screen_->GetDisplayMatching(match_rect).work_area();
|
||||
}
|
||||
private:
|
||||
const gfx::Screen* screen_;
|
||||
DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -150,7 +155,9 @@ const int WindowSizer::kMaximumWindowWidth = 1100;
|
||||
|
||||
WindowSizer::WindowSizer(StateProvider* state_provider, const Browser* browser)
|
||||
: state_provider_(state_provider),
|
||||
monitor_info_provider_(new DefaultMonitorInfoProvider),
|
||||
monitor_info_provider_(new DefaultMonitorInfoProvider(
|
||||
// TODO(scottmg): NativeScreen is wrong. http://crbug.com/133312
|
||||
gfx::Screen::GetNativeScreen())),
|
||||
browser_(browser) {
|
||||
}
|
||||
|
||||
|
@ -163,9 +163,8 @@ bool WindowSizer::GetBoundsOverrideAsh(const gfx::Rect& specified_bounds,
|
||||
// In case we have only one window, we move the other window fully to the
|
||||
// "other side" - making room for this new window.
|
||||
if (count == 1) {
|
||||
gfx::Display display =
|
||||
gfx::Screen::GetDisplayMatching(
|
||||
top_window->GetRootWindow()->GetBoundsInScreen());
|
||||
gfx::Display display = ash::Shell::GetScreen()->GetDisplayMatching(
|
||||
top_window->GetRootWindow()->GetBoundsInScreen());
|
||||
if (MoveRect(work_area, other_bounds_in_screen, !move_right))
|
||||
top_window->SetBoundsInScreen(other_bounds_in_screen, display);
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ const int WindowSizer::kWindowTilePixels = 10;
|
||||
// static
|
||||
gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size,
|
||||
chrome::HostDesktopType type) {
|
||||
gfx::Rect monitor_bounds = gfx::Screen::GetPrimaryDisplay().work_area();
|
||||
gfx::Rect monitor_bounds = gfx::Screen::GetNativeScreen()->
|
||||
GetPrimaryDisplay().work_area();
|
||||
gfx::Point corner(monitor_bounds.x(), monitor_bounds.y());
|
||||
|
||||
if (Browser* browser = browser::FindLastActiveWithHostDesktopType(type)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user