diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 23:09:32 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 23:09:32 +0000 |
commit | d8e6018fb0b2d37104326a5c87b8d50e5ef8fa0e (patch) | |
tree | b0310cc9c6304810256c781dd89a617cc26a5f9f | |
parent | 2f6f4a6eb6c982ff297f8c468465a64c7716593c (diff) | |
download | chromium_src-d8e6018fb0b2d37104326a5c87b8d50e5ef8fa0e.zip chromium_src-d8e6018fb0b2d37104326a5c87b8d50e5ef8fa0e.tar.gz chromium_src-d8e6018fb0b2d37104326a5c87b8d50e5ef8fa0e.tar.bz2 |
Revert 93724
"Move screen.h to ui/gfx because Screen doesn't depend on views, and they're useful outside views."
This reverts commit 4b6b4b0a2a3d46f25ffe37d612742aba14c39462.
TBR=jcivelli@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7495019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93733 0039d316-1c4b-4281-b951-d872f2087c98
30 files changed, 72 insertions, 68 deletions
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index ec1f5b9..cee5b18 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -36,11 +36,11 @@ #include "ui/base/models/simple_menu_model.h" #include "ui/base/theme_provider.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/screen.h" #include "views/controls/button/button.h" #include "views/controls/button/image_button.h" #include "views/controls/menu/menu_delegate.h" #include "views/controls/menu/menu_item_view.h" +#include "views/screen.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" #include "views/window/hit_test.h" @@ -454,7 +454,7 @@ bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { // non-full screen size, layout/paint at that size, then the window manager // will snap us to full screen size. This results in an ugly // resize/paint. To avoid this we always request a full screen size. - *bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow( + *bounds = views::Screen::GetMonitorWorkAreaNearestWindow( GTK_WIDGET(GetWidget()->GetNativeWindow())); return true; } diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc index 46ee983..1a3636a 100644 --- a/chrome/browser/chromeos/input_method/candidate_window.cc +++ b/chrome/browser/chromeos/input_method/candidate_window.cc @@ -17,12 +17,12 @@ #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" -#include "ui/gfx/screen.h" #include "views/controls/label.h" #include "views/controls/textfield/textfield.h" #include "views/events/event.h" #include "views/layout/fill_layout.h" #include "views/layout/grid_layout.h" +#include "views/screen.h" #include "views/widget/widget.h" #include "views/window/non_client_view.h" @@ -1163,7 +1163,7 @@ void CandidateWindowView::ResizeAndMoveParentFrame() { const int horizontal_offset = GetHorizontalOffset(); gfx::Rect old_bounds = parent_frame_->GetClientAreaScreenBounds(); - gfx::Rect screen_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow( + gfx::Rect screen_bounds = views::Screen::GetMonitorWorkAreaNearestWindow( parent_frame_->GetNativeView()); // The size. gfx::Rect frame_bounds = old_bounds; diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index ca7975b..a8f7244 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -40,6 +40,7 @@ #include "ui/gfx/gtk_util.h" #include "views/controls/button/text_button.h" #include "views/controls/label.h" +#include "views/screen.h" #include "views/widget/widget.h" using views::Widget; diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc index f561899..afc563a 100644 --- a/chrome/browser/chromeos/login/helper.cc +++ b/chrome/browser/chromeos/login/helper.cc @@ -14,12 +14,12 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/screen.h" #include "views/controls/button/menu_button.h" #include "views/controls/label.h" #include "views/controls/textfield/textfield.h" #include "views/controls/throbber.h" #include "views/painter.h" +#include "views/screen.h" #include "views/widget/widget.h" namespace chromeos { @@ -155,7 +155,7 @@ views::Painter* CreateBackgroundPainter() { } gfx::Rect CalculateScreenBounds(const gfx::Size& size) { - gfx::Rect bounds(gfx::Screen::GetMonitorWorkAreaNearestWindow(NULL)); + gfx::Rect bounds(views::Screen::GetMonitorWorkAreaNearestWindow(NULL)); if (!size.IsEmpty()) { int horizontal_diff = bounds.width() - size.width(); int vertical_diff = bounds.height() - size.height(); diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 121b100..f79310a 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -53,7 +53,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/x/x11_util.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" #include "views/widget/native_widget_gtk.h" namespace { @@ -730,7 +730,7 @@ void ScreenLocker::Init() { authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); gfx::Point left_top(1, 1); - gfx::Rect init_bounds(gfx::Screen::GetMonitorAreaNearestPoint(left_top)); + gfx::Rect init_bounds(views::Screen::GetMonitorAreaNearestPoint(left_top)); LockWindow* lock_window = new LockWindow(); lock_window_ = lock_window->GetWidget(); diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc index 8af98bf..9d7cc9b 100644 --- a/chrome/browser/chromeos/setting_level_bubble.cc +++ b/chrome/browser/chromeos/setting_level_bubble.cc @@ -15,7 +15,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/bubble/bubble.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" #include "views/widget/root_view.h" namespace { @@ -112,7 +112,7 @@ void SettingLevelBubble::ShowBubble(int percent) { // "point" at (since we use BubbleBorder::FLOAT, this position actually // specifies the center of the bubble). const gfx::Rect monitor_area = - gfx::Screen::GetMonitorAreaNearestWindow( + views::Screen::GetMonitorAreaNearestWindow( GTK_WIDGET(parent_widget->GetNativeWindow())); const gfx::Size view_size = view_->GetPreferredSize(); const gfx::Rect position_relative_to( diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index 0041557..cf904ed 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -22,11 +22,11 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/screen.h" #include "views/controls/button/image_button.h" #include "views/controls/button/menu_button.h" #include "views/controls/label.h" #include "views/painter.h" +#include "views/screen.h" #include "views/widget/widget_delegate.h" #include "views/window/window_shape.h" @@ -159,7 +159,7 @@ PanelBrowserFrameView::MouseWatcher::~MouseWatcher() { } bool PanelBrowserFrameView::MouseWatcher::IsCursorInViewBounds() const { - gfx::Point cursor_point = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_point = views::Screen::GetCursorScreenPoint(); return view_->browser_view_->GetBounds().Contains(cursor_point.x(), cursor_point.y()); } diff --git a/chrome/browser/ui/tabs/dock_info_win.cc b/chrome/browser/ui/tabs/dock_info_win.cc index 776a772..67ca6e4 100644 --- a/chrome/browser/ui/tabs/dock_info_win.cc +++ b/chrome/browser/ui/tabs/dock_info_win.cc @@ -9,7 +9,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" namespace { @@ -231,7 +231,7 @@ class DockToWindowFinder : public BaseWindowFinder { const std::set<HWND>& ignore) : BaseWindowFinder(ignore), screen_loc_(screen_loc) { - gfx::Rect work_area = gfx::Screen::GetMonitorWorkAreaNearestPoint( + gfx::Rect work_area = views::Screen::GetMonitorWorkAreaNearestPoint( screen_loc); if (!work_area.IsEmpty()) { result_.set_monitor_bounds(work_area); diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 8d170a4..f50c249 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -16,6 +16,7 @@ #include "grit/theme_resources.h" #include "ui/base/theme_provider.h" #include "ui/gfx/font.h" +#include "views/screen.h" #include "views/views_delegate.h" #include "views/widget/native_widget_win.h" #include "views/widget/widget.h" diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc index 43bbe78..3009674 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc @@ -13,8 +13,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/screen.h" #include "views/controls/link.h" +#include "views/screen.h" #include "views/widget/widget.h" #if defined(OS_WIN) @@ -144,7 +144,7 @@ FullscreenExitBubble::FullscreenExitBubble( // Start the initial delay timer and begin watching the mouse. initial_delay_.Start(base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, &FullscreenExitBubble::CheckMousePosition); - gfx::Point cursor_pos = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); last_mouse_pos_ = cursor_pos; views::View::ConvertPointToView(NULL, root_view_, &last_mouse_pos_); mouse_position_checker_.Start( @@ -206,7 +206,7 @@ void FullscreenExitBubble::CheckMousePosition() { // either the popup is hidden or the mouse is not idle, so we don't want to // change anything's state. - gfx::Point cursor_pos = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_pos = views::Screen::GetCursorScreenPoint(); gfx::Point transformed_pos(cursor_pos); views::View::ConvertPointToView(NULL, root_view_, &transformed_pos); @@ -252,7 +252,7 @@ gfx::Rect FullscreenExitBubble::GetPopupRect( } // 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::GetMonitorAreaNearestWindow( + gfx::Rect screen_bounds = views::Screen::GetMonitorAreaNearestWindow( root_view_->GetWidget()->GetNativeView()); gfx::Point origin(screen_bounds.x() + (screen_bounds.width() - size.width()) / 2, diff --git a/chrome/browser/ui/views/keyboard_overlay_delegate.cc b/chrome/browser/ui/views/keyboard_overlay_delegate.cc index 0fbc554..c1448a94 100644 --- a/chrome/browser/ui/views/keyboard_overlay_delegate.cc +++ b/chrome/browser/ui/views/keyboard_overlay_delegate.cc @@ -13,7 +13,7 @@ #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" static const int kBaseWidth = 1252; @@ -50,7 +50,7 @@ void KeyboardOverlayDelegate::GetDialogSize( gfx::Size* size) const { using std::min; DCHECK(view_); - gfx::Rect rect = gfx::Screen::GetMonitorAreaNearestWindow( + gfx::Rect rect = views::Screen::GetMonitorAreaNearestWindow( view_->native_view()); const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); const int height = width * kBaseHeight / kBaseWidth; diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc index d57e1d5..a99449e 100644 --- a/chrome/browser/ui/views/status_bubble_views.cc +++ b/chrome/browser/ui/views/status_bubble_views.cc @@ -24,9 +24,9 @@ #include "ui/base/text/text_elider.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/point.h" -#include "ui/gfx/screen.h" #include "views/controls/label.h" #include "views/controls/scrollbar/native_scroll_bar.h" +#include "views/screen.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -755,7 +755,7 @@ void StatusBubbleViews::AvoidMouse(const gfx::Point& location) { // download shelf. gfx::NativeView widget = base_view_->GetWidget()->GetNativeView(); gfx::Rect monitor_rect = - gfx::Screen::GetMonitorWorkAreaNearestWindow(widget); + views::Screen::GetMonitorWorkAreaNearestWindow(widget); const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); if (bubble_bottom_y + offset > monitor_rect.height() || diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc index 73ead11..0cb5bb0 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.cc @@ -22,6 +22,7 @@ #include "views/focus/focus_manager.h" #include "views/focus/view_storage.h" #include "views/layout/fill_layout.h" +#include "views/screen.h" #include "views/widget/widget.h" using WebKit::WebDragOperation; diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc index b607ed1..ab70af9 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc @@ -17,9 +17,9 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" -#include "ui/gfx/screen.h" #include "views/focus/focus_manager.h" #include "views/focus/view_storage.h" +#include "views/screen.h" #include "views/widget/native_widget.h" #include "views/widget/widget.h" @@ -386,7 +386,7 @@ void TabContentsViewViews::OnNativeTabContentsViewMouseMove(bool motion) { // bubble state). if (tab_contents_->delegate()) { tab_contents_->delegate()->ContentsMouseEvent( - tab_contents_, gfx::Screen::GetCursorScreenPoint(), motion); + tab_contents_, views::Screen::GetCursorScreenPoint(), motion); } } @@ -421,3 +421,4 @@ views::FocusManager* TabContentsViewViews::GetFocusManager() { // DCHECK(focus_manager_); return focus_manager_; } + diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index 35e5ad3..d68988f 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -34,8 +34,8 @@ #include "ui/base/animation/slide_animation.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/screen.h" #include "views/events/event.h" +#include "views/screen.h" #include "views/widget/widget.h" #if defined(TOOLKIT_USES_GTK) @@ -551,7 +551,7 @@ gfx::Point DraggedTabController::GetWindowCreatePoint() const { } // 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::GetMonitorWorkAreaNearestPoint( + gfx::Rect work_area = views::Screen::GetMonitorWorkAreaNearestPoint( cursor_point); if (!work_area.IsEmpty()) { if (cursor_point.x() < work_area.x()) @@ -249,9 +249,6 @@ 'gfx/point.h', 'gfx/rect.cc', 'gfx/rect.h', - 'gfx/screen.h', - 'gfx/screen_gtk.cc', - 'gfx/screen_win.cc', 'gfx/scoped_cg_context_save_gstate_mac.h', 'gfx/scoped_ns_graphics_context_save_gstate_mac.h', 'gfx/scoped_ns_graphics_context_save_gstate_mac.mm', diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index abeedf3..8e6e09c 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -7,7 +7,7 @@ #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/keycodes/keyboard_codes.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" #include "views/widget/widget.h" namespace views { @@ -69,7 +69,7 @@ bool CustomButton::IsMouseHovered() const { if (!GetWidget()) return false; - gfx::Point cursor_pos(gfx::Screen::GetCursorScreenPoint()); + gfx::Point cursor_pos(Screen::GetCursorScreenPoint()); ConvertPointToView(NULL, this, &cursor_pos); return HitTest(cursor_pos); } diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 64f4795..7701d59 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -12,10 +12,10 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/screen.h" #include "views/controls/button/button.h" #include "views/controls/menu/view_menu_delegate.h" #include "views/events/event.h" +#include "views/screen.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -259,8 +259,7 @@ int MenuButton::GetMaximumScreenXCoordinate() { } gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorWorkAreaNearestWindow( - GetWidget()->GetTopLevelWidget()->GetNativeView()); + Screen::GetMonitorWorkAreaNearestWindow(GetWidget()->GetNativeView()); return monitor_bounds.right() - 1; } diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index dace82f..06e6b4c 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -12,7 +12,7 @@ #include "ui/gfx/platform_font_win.h" #elif defined(OS_LINUX) #include <gdk/gdkkeysyms.h> -#include "ui/gfx/screen.h" +#include "views/screen.h" #endif @@ -114,7 +114,7 @@ void NativeButton::ButtonPressed() { POINTS points = MAKEPOINTS(pos); gfx::Point cursor_point(points.x, points.y); #elif defined(OS_LINUX) - gfx::Point cursor_point = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_point = Screen::GetCursorScreenPoint(); #endif views::MouseEvent event(ui::ET_MOUSE_RELEASED, @@ -192,7 +192,7 @@ bool NativeButton::AcceleratorPressed(const Accelerator& accelerator) { POINTS points = MAKEPOINTS(pos); gfx::Point cursor_point(points.x, points.y); #elif defined(OS_LINUX) - gfx::Point cursor_point = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_point = Screen::GetCursorScreenPoint(); #endif views::MouseEvent event(ui::ET_MOUSE_RELEASED, cursor_point.x(), cursor_point.y(), diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 3fae8bc..b2038da 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -12,11 +12,11 @@ #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/screen.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_scroll_view_container.h" #include "views/controls/menu/submenu_view.h" #include "views/drag_utils.h" +#include "views/screen.h" #include "views/view_constants.h" #include "views/views_delegate.h" #include "views/widget/root_view.h" @@ -1036,7 +1036,7 @@ void MenuController::UpdateInitialLocation( // Calculate the bounds of the monitor we'll show menus on. Do this once to // avoid repeated system queries for the info. - pending_state_.monitor_bounds = gfx::Screen::GetMonitorWorkAreaNearestPoint( + pending_state_.monitor_bounds = Screen::GetMonitorWorkAreaNearestPoint( bounds.origin()); } @@ -1064,8 +1064,7 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source, return false; } - gfx::NativeWindow window_under_mouse = - gfx::Screen::GetWindowAtCursorScreenPoint(); + gfx::NativeWindow window_under_mouse = Screen::GetWindowAtCursorScreenPoint(); if (window_under_mouse != owner_) return false; diff --git a/views/mouse_watcher.cc b/views/mouse_watcher.cc index 810db69..09aaa8a 100644 --- a/views/mouse_watcher.cc +++ b/views/mouse_watcher.cc @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/task.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" #include "views/view.h" #include "views/widget/widget.h" @@ -89,7 +89,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { bounds.width() + mouse_watcher_->hot_zone_insets_.width(), bounds.height() + mouse_watcher_->hot_zone_insets_.height()); - gfx::Point cursor_point = gfx::Screen::GetCursorScreenPoint(); + gfx::Point cursor_point = Screen::GetCursorScreenPoint(); return bounds.Contains(cursor_point.x(), cursor_point.y()); } @@ -100,7 +100,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer { if (!widget) return false; - return gfx::Screen::GetWindowAtCursorScreenPoint() == + return Screen::GetWindowAtCursorScreenPoint() == widget->GetNativeWindow(); } diff --git a/ui/gfx/screen.h b/views/screen.h index 60b9b7d..3e65b77 100644 --- a/ui/gfx/screen.h +++ b/views/screen.h @@ -1,16 +1,16 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_SCREEN_H_ -#define UI_GFX_SCREEN_H_ +#ifndef VIEWS_SCREEN_H_ +#define VIEWS_SCREEN_H_ #pragma once #include "ui/gfx/native_widget_types.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" -namespace gfx { +namespace views { // A utility class for getting various info about screen size, monitors, // cursor position, etc. @@ -36,6 +36,6 @@ class Screen { static gfx::NativeWindow GetWindowAtCursorScreenPoint(); }; -} // namespace gfx +} // namespace views #endif // VIEWS_SCREEN_H_ diff --git a/ui/gfx/screen_gtk.cc b/views/screen_gtk.cc index bb71da5..0a01c6c 100644 --- a/ui/gfx/screen_gtk.cc +++ b/views/screen_gtk.cc @@ -1,15 +1,15 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/screen.h" +#include "views/screen.h" #include <gdk/gdkx.h> #include <gtk/gtk.h> #include "base/logging.h" -namespace gfx { +namespace views { // static gfx::Point Screen::GetCursorScreenPoint() { @@ -104,4 +104,5 @@ gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { return GTK_IS_WINDOW(widget) ? GTK_WINDOW(widget) : NULL; } -} // namespace gfx +} // namespace + diff --git a/ui/gfx/screen_win.cc b/views/screen_win.cc index 530cebe..b24a55c 100644 --- a/ui/gfx/screen_win.cc +++ b/views/screen_win.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/screen.h" +#include "views/screen.h" #include <windows.h> -namespace gfx { +namespace views { // static gfx::Point Screen::GetCursorScreenPoint() { @@ -59,4 +59,5 @@ gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { return GetCursorPos(&location) ? WindowFromPoint(location) : NULL; } -} // namespace gfx +} // namespace + diff --git a/views/views.gyp b/views/views.gyp index 39593fc..613f50f 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -295,6 +295,9 @@ 'painter.h', 'repeat_controller.cc', 'repeat_controller.h', + 'screen.h', + 'screen_gtk.cc', + 'screen_win.cc', 'touchui/gesture_manager.cc', 'touchui/gesture_manager.h', 'touchui/touch_factory.cc', diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc index 8399107..82ac4b33 100644 --- a/views/widget/native_widget_gtk.cc +++ b/views/widget/native_widget_gtk.cc @@ -28,10 +28,10 @@ #include "ui/gfx/compositor/compositor.h" #include "ui/gfx/gtk_util.h" #include "ui/gfx/path.h" -#include "ui/gfx/screen.h" #include "views/controls/textfield/native_textfield_views.h" #include "views/focus/view_storage.h" #include "views/ime/input_method_gtk.h" +#include "views/screen.h" #include "views/views_delegate.h" #include "views/widget/drop_target_gtk.h" #include "views/widget/gtk_views_fixed.h" @@ -1005,7 +1005,7 @@ void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { center_rect = gfx::Rect(parent_x, parent_y, parent_w, parent_h); } else { // We have no parent window, center over the screen. - center_rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); + center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); } gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, center_rect.y() + (center_rect.height() - size.height()) / 2, diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc index c327330..41d38fd 100644 --- a/views/widget/native_widget_win.cc +++ b/views/widget/native_widget_win.cc @@ -27,7 +27,6 @@ #include "ui/gfx/icon_util.h" #include "ui/gfx/native_theme_win.h" #include "ui/gfx/path.h" -#include "ui/gfx/screen.h" #include "views/accessibility/native_view_accessibility_win.h" #include "views/controls/native_control_win.h" #include "views/controls/textfield/native_textfield_views.h" @@ -35,6 +34,7 @@ #include "views/focus/focus_util_win.h" #include "views/focus/view_storage.h" #include "views/ime/input_method_win.h" +#include "views/screen.h" #include "views/views_delegate.h" #include "views/widget/aero_tooltip_manager.h" #include "views/widget/child_window_message_processor.h" @@ -191,7 +191,7 @@ void SetChildBounds(HWND child_window, window = insert_after_window; gfx::Rect work_area = - gfx::Screen::GetMonitorWorkAreaNearestPoint(bounds.origin()); + views::Screen::GetMonitorWorkAreaNearestPoint(bounds.origin()); if (!work_area.IsEmpty()) parent_rect = work_area.ToRECT(); } diff --git a/views/widget/tooltip_manager_gtk.cc b/views/widget/tooltip_manager_gtk.cc index 27ef1a2..d88f345 100644 --- a/views/widget/tooltip_manager_gtk.cc +++ b/views/widget/tooltip_manager_gtk.cc @@ -7,8 +7,8 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "ui/gfx/font.h" -#include "ui/gfx/screen.h" #include "views/focus/focus_manager.h" +#include "views/screen.h" #include "views/view.h" #include "views/widget/native_widget_gtk.h" @@ -64,7 +64,7 @@ const std::wstring& TooltipManager::GetLineSeparator() { // static int TooltipManager::GetMaxWidth(int x, int y) { gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); + Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); // GtkLabel (gtk_label_ensure_layout) forces wrapping at this size. We mirror // the size here otherwise tooltips wider than the size used by gtklabel end // up with extraneous empty lines. diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc index 4c0a728..98f38dc 100644 --- a/views/widget/tooltip_manager_views.cc +++ b/views/widget/tooltip_manager_views.cc @@ -13,10 +13,10 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/font.h" -#include "ui/gfx/screen.h" #include "views/background.h" #include "views/border.h" #include "views/focus/focus_manager.h" +#include "views/screen.h" #include "views/view.h" #include "views/widget/native_widget.h" #include "views/widget/root_view.h" @@ -57,7 +57,7 @@ int TooltipManager::GetMaxWidth(int x, int y) { // We always display the tooltip inside the root view. So the max width is // the width of the view. gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); + Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); // GtkLabel (gtk_label_ensure_layout) forces wrapping at this size. We mirror // the size here otherwise tooltips wider than the size used by gtklabel end // up with extraneous empty lines. @@ -179,7 +179,7 @@ void TooltipManagerViews::SetTooltipBounds(gfx::Point mouse_pos, tooltip_rect.Offset(kCursorOffsetX, kCursorOffsetY); gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorAreaNearestPoint(tooltip_rect.origin()); + Screen::GetMonitorAreaNearestPoint(tooltip_rect.origin()); tooltip_widget_->SetBounds(tooltip_rect.AdjustToFit(monitor_bounds)); } diff --git a/views/widget/tooltip_manager_win.cc b/views/widget/tooltip_manager_win.cc index 9e50087..68714b9 100644 --- a/views/widget/tooltip_manager_win.cc +++ b/views/widget/tooltip_manager_win.cc @@ -13,7 +13,7 @@ #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/win/hwnd_util.h" #include "ui/gfx/font.h" -#include "ui/gfx/screen.h" +#include "views/screen.h" #include "views/view.h" #include "views/widget/monitor_win.h" #include "views/widget/widget.h" @@ -63,7 +63,7 @@ const std::wstring& TooltipManager::GetLineSeparator() { // static int TooltipManager::GetMaxWidth(int x, int y) { gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); + Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); // Allow the tooltip to be almost as wide as the screen. // Otherwise, we would truncate important text, since we're not word-wrapping // the text onto multiple lines. |