summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 15:40:45 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 15:40:45 +0000
commit10946079e34f1a627e9afa232049469a6655cc17 (patch)
tree6de5c4fa11f7fb6ede9601de1acc86e4a53aa1b2
parent334bef925113a03dac5dc92184ab7ce51e06a386 (diff)
downloadchromium_src-10946079e34f1a627e9afa232049469a6655cc17.zip
chromium_src-10946079e34f1a627e9afa232049469a6655cc17.tar.gz
chromium_src-10946079e34f1a627e9afa232049469a6655cc17.tar.bz2
Move RootView to the internal namespace.
Most people should not be using the RootView type. The few cases that do should static_cast for now, until I can find a way to expose the functionality they need on Widget. BUG=72040 TEST=none TBR=sky Review URL: http://codereview.chromium.org/7040018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86084 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/accessibility/browser_views_accessibility_browsertest.cc4
-rw-r--r--chrome/browser/automation/testing_automation_provider_views.cc1
-rw-r--r--chrome/browser/automation/ui_controls_linux.cc1
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window.cc8
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc1
-rw-r--r--chrome/browser/chromeos/notifications/balloon_view.cc1
-rw-r--r--chrome/browser/chromeos/notifications/notification_panel.cc1
-rw-r--r--chrome/browser/external_tab_container_win.cc1
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.cc3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_views.cc3
-rw-r--r--chrome/browser/ui/views/about_ipc_dialog.cc5
-rw-r--r--chrome/browser/ui/views/browser_bubble.cc1
-rw-r--r--chrome/browser/ui/views/bubble/bubble.cc1
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.cc3
-rw-r--r--chrome/browser/ui/views/dom_view_browsertest.cc1
-rw-r--r--chrome/browser/ui/views/download/download_item_view.cc3
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.cc2
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.h2
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.cc1
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.h2
-rw-r--r--chrome/browser/ui/views/frame/contents_container.cc1
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.cc1
-rw-r--r--chrome/browser/ui/views/generic_info_view_unittest.cc3
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.cc1
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc1
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.cc3
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc1
-rw-r--r--views/controls/button/menu_button.cc3
-rw-r--r--views/controls/button/radio_button.cc6
-rw-r--r--views/controls/combobox/native_combobox_views.cc2
-rw-r--r--views/controls/menu/menu_host.cc2
-rw-r--r--views/controls/menu/menu_host.h2
-rw-r--r--views/controls/menu/menu_host_root_view.cc2
-rw-r--r--views/controls/menu/menu_host_root_view.h2
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_gtk.cc11
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc8
-rw-r--r--views/controls/textfield/native_textfield_views.cc4
-rw-r--r--views/events/event.cc4
-rw-r--r--views/events/event.h19
-rw-r--r--views/examples/examples_main.cc4
-rw-r--r--views/focus/accelerator_handler_touch.cc3
-rw-r--r--views/focus/focus_manager_unittest.cc12
-rw-r--r--views/view.cc10
-rw-r--r--views/view.h16
-rw-r--r--views/view_unittest.cc46
-rw-r--r--views/widget/drop_helper.cc6
-rw-r--r--views/widget/drop_helper.h6
-rw-r--r--views/widget/drop_target_gtk.cc2
-rw-r--r--views/widget/drop_target_gtk.h6
-rw-r--r--views/widget/drop_target_win.cc2
-rw-r--r--views/widget/drop_target_win.h6
-rw-r--r--views/widget/native_widget_gtk.cc8
-rw-r--r--views/widget/native_widget_win.cc3
-rw-r--r--views/widget/root_view.cc16
-rw-r--r--views/widget/root_view.h15
-rw-r--r--views/widget/tooltip_manager_gtk.cc4
-rw-r--r--views/widget/tooltip_manager_win.cc5
-rw-r--r--views/widget/widget.cc24
-rw-r--r--views/widget/widget.h18
-rw-r--r--views/window/native_window_gtk.cc1
-rw-r--r--views/window/native_window_win.cc2
63 files changed, 163 insertions, 181 deletions
diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
index 8bf304e..3c46998 100644
--- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
+++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
@@ -20,7 +20,6 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/accessibility/native_view_accessibility_win.h"
-#include "views/widget/root_view.h"
#include "views/window/window.h"
namespace {
@@ -154,8 +153,7 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestNonClientViewAccObj) {
// accessibility info.
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
TestBrowserRootViewAccObj) {
- views::View* browser_root_view =
- GetBrowserView()->frame()->GetFrameView()->GetRootView();
+ views::View* browser_root_view = GetBrowserView()->frame()->GetRootView();
TestViewAccessibilityObject(
browser_root_view,
diff --git a/chrome/browser/automation/testing_automation_provider_views.cc b/chrome/browser/automation/testing_automation_provider_views.cc
index b695960..ca5c06a 100644
--- a/chrome/browser/automation/testing_automation_provider_views.cc
+++ b/chrome/browser/automation/testing_automation_provider_views.cc
@@ -14,7 +14,6 @@
#include "views/controls/menu/menu_wrapper.h"
#include "views/view.h"
#include "views/widget/native_widget.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc
index 1c5a631..90b69ea 100644
--- a/chrome/browser/automation/ui_controls_linux.cc
+++ b/chrome/browser/automation/ui_controls_linux.cc
@@ -17,7 +17,6 @@
#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#endif
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index fb00eea..bfea614 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -199,7 +199,7 @@
#endif
#if defined(TOUCH_UI) || defined(TOOLKIT_VIEWS)
-#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
#endif
// BrowserMainParts ------------------------------------------------------------
@@ -1758,7 +1758,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
#endif
#if defined(TOOLKIT_VIEWS)
- views::RootView::SetPureViews(
+ views::Widget::SetPureViews(
CommandLine::ForCurrentProcess()->HasSwitch(switches::kUsePureViews));
#endif
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc
index 96afc5c..36ccef8 100644
--- a/chrome/browser/chromeos/input_method/candidate_window.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window.cc
@@ -23,7 +23,6 @@
#include "views/layout/fill_layout.h"
#include "views/layout/grid_layout.h"
#include "views/screen.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
#include "views/window/window.h"
@@ -1291,12 +1290,7 @@ void CandidateWindowController::Impl::CreateView() {
candidate_window_->Init();
candidate_window_->AddObserver(this);
- // Put the candidate window view on the frame. The frame is resized
- // later when the candidate window is shown.
- views::RootView* root_view = frame_->GetRootView();
- // |root_view| owns the |candidate_window_|, thus |frame_| effectively
- // owns |candidate_window_|.
- root_view->SetContentsView(candidate_window_);
+ frame_->SetContentsView(candidate_window_);
}
CandidateWindowController::Impl::Impl()
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index 27648df..dd6fc73 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -53,7 +53,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/x/x11_util.h"
#include "views/screen.h"
-#include "views/widget/root_view.h"
#include "views/widget/native_widget_gtk.h"
namespace {
diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc
index 57d99d6..432d686 100644
--- a/chrome/browser/chromeos/notifications/balloon_view.cc
+++ b/chrome/browser/chromeos/notifications/balloon_view.cc
@@ -33,7 +33,6 @@
#include "views/controls/label.h"
#include "views/controls/menu/menu_2.h"
#include "views/controls/menu/view_menu_delegate.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc
index b2e9c2b..81d55b0 100644
--- a/chrome/browser/chromeos/notifications/notification_panel.cc
+++ b/chrome/browser/chromeos/notifications/notification_panel.cc
@@ -20,7 +20,6 @@
#include "views/background.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/scroll_view.h"
-#include "views/widget/root_view.h"
#include "views/widget/native_widget_gtk.h"
#define SET_STATE(state) SetState(state, __PRETTY_FUNCTION__)
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 7c9d7b3..faf7a8e 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -50,7 +50,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/view_prop.h"
#include "views/layout/grid_layout.h"
-#include "views/widget/root_view.h"
#include "views/window/window.h"
using ui::ViewProp;
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc
index 8172907..4f61b78 100644
--- a/chrome/browser/first_run/try_chrome_dialog_view.cc
+++ b/chrome/browser/first_run/try_chrome_dialog_view.cc
@@ -24,7 +24,6 @@
#include "views/controls/link.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace {
@@ -78,7 +77,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal(
params.bounds = gfx::Rect(310, 160);
popup_->Init(params);
- views::RootView* root_view = popup_->GetRootView();
+ views::View* root_view = popup_->GetRootView();
// The window color is a tiny bit off-white.
root_view->set_background(
views::Background::CreateSolidBackground(0xfc, 0xfc, 0xfc));
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
index 45182ae..996c8f4 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -30,7 +30,6 @@
#include "ui/gfx/gtk_native_view_id_manager.h"
#include "views/events/event.h"
#include "views/ime/input_method.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/widget/native_widget_gtk.h"
@@ -170,7 +169,7 @@ void RenderWidgetHostViewViews::InitAsPopup(
// to tell the parent it's showing a popup so that it doesn't respond to
// blurs.
parent->is_showing_popup_menu_ = true;
- views::RootView* root_view = GetWidget()->GetRootView();
+ views::View* root_view = GetWidget()->GetRootView();
// TODO(fsamuel): WebKit is computing the screen coordinates incorrectly.
// Fixing this is a long and involved process, because WebKit needs to know
// how to direct an IPC at a particular View. For now, we simply convert
diff --git a/chrome/browser/ui/views/about_ipc_dialog.cc b/chrome/browser/ui/views/about_ipc_dialog.cc
index fb1fdc4..9b7cf3a 100644
--- a/chrome/browser/ui/views/about_ipc_dialog.cc
+++ b/chrome/browser/ui/views/about_ipc_dialog.cc
@@ -34,7 +34,6 @@
#include "views/controls/native/native_view_host.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
@@ -275,7 +274,7 @@ std::wstring AboutIPCDialog::GetWindowTitle() const {
void AboutIPCDialog::Layout() {
if (!message_list_.m_hWnd) {
- HWND parent_window = GetRootView()->GetWidget()->GetNativeView();
+ HWND parent_window = GetWidget()->GetNativeView();
RECT rect = {0, 0, 10, 10};
HWND list_hwnd = message_list_.Create(parent_window,
@@ -365,7 +364,7 @@ void AboutIPCDialog::ButtonPressed(
} else if (button == clear_button_) {
message_list_.DeleteAllItems();
} else if (button == filter_button_) {
- RunSettingsDialog(GetRootView()->GetWidget()->GetNativeView());
+ RunSettingsDialog(GetWidget()->GetNativeView());
}
}
diff --git a/chrome/browser/ui/views/browser_bubble.cc b/chrome/browser/ui/views/browser_bubble.cc
index d87180d..c960bdd 100644
--- a/chrome/browser/ui/views/browser_bubble.cc
+++ b/chrome/browser/ui/views/browser_bubble.cc
@@ -8,7 +8,6 @@
#if defined(OS_WIN)
#include "chrome/browser/external_tab_container_win.h"
#endif
-#include "views/widget/root_view.h"
#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc
index b8fc390..df1a022 100644
--- a/chrome/browser/ui/views/bubble/bubble.cc
+++ b/chrome/browser/ui/views/bubble/bubble.cc
@@ -12,7 +12,6 @@
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/gfx/color_utils.h"
#include "views/layout/fill_layout.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/client_view.h"
#include "views/window/window.h"
diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index 9c9b79c..1b23611c 100644
--- a/chrome/browser/ui/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
@@ -27,7 +27,6 @@
#include "views/layout/box_layout.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/widget/root_view.h"
#include "views/window/window.h"
namespace browser {
@@ -484,7 +483,7 @@ void CollectedCookiesWin::AddContentException(views::TreeView* tree_view,
// translation here until http://crbug.com/52851 is fixed.
POINT topleft = {bounds.x(), bounds.y()};
MapWindowPoints(HWND_DESKTOP, tab_contents_->GetNativeView(), &topleft, 1);
- gfx::Size size = GetRootView()->GetPreferredSize();
+ gfx::Size size = GetWidget()->GetRootView()->GetPreferredSize();
bounds.SetRect(topleft.x, topleft.y, size.width(), size.height());
GetWidget()->SetBounds(bounds);
status_changed_ = true;
diff --git a/chrome/browser/ui/views/dom_view_browsertest.cc b/chrome/browser/ui/views/dom_view_browsertest.cc
index 00bf748..a61c804 100644
--- a/chrome/browser/ui/views/dom_view_browsertest.cc
+++ b/chrome/browser/ui/views/dom_view_browsertest.cc
@@ -6,7 +6,6 @@
#include "chrome/browser/ui/views/dom_view.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
using views::Widget;
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 87ad63e..a4b85c0 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -642,7 +642,8 @@ void DownloadItemView::ShowContextMenu(const gfx::Point& p,
// matter where the user pressed. To force RootView to recalculate the
// mouse target during the mouse press we explicitly set the mouse handler
// to NULL.
- GetRootView()->SetMouseHandler(NULL);
+ static_cast<views::internal::RootView*>(GetWidget()->GetRootView())->
+ SetMouseHandler(NULL);
// If |is_mouse_gesture| is false, |p| is ignored. The menu is shown aligned
// to drop down arrow button.
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 5e6ad1d..a682c89 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -95,7 +95,7 @@ bool BrowserFrame::IsMaximized() const {
return Window::IsMaximized();
}
-views::RootView* BrowserFrame::CreateRootView() {
+views::internal::RootView* BrowserFrame::CreateRootView() {
root_view_ = new BrowserRootView(browser_view_, this);
return root_view_;
}
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h
index 8747bed..d8af0cd 100644
--- a/chrome/browser/ui/views/frame/browser_frame.h
+++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -70,7 +70,7 @@ class BrowserFrame : public views::Window {
// Overridden from views::Window:
virtual bool IsMaximized() const OVERRIDE;
- virtual views::RootView* CreateRootView() OVERRIDE;
+ virtual views::internal::RootView* CreateRootView() OVERRIDE;
virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
virtual bool GetAccelerator(int command_id,
ui::Accelerator* accelerator) OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
index 0583a01..f996f2c 100644
--- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/ui/status_bubble.h"
#include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
-#include "chrome/browser/ui/views/frame/browser_root_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "ui/gfx/font.h"
#include "views/widget/root_view.h"
diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc
index 6a7ddf3..323cd35 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -21,7 +21,7 @@
BrowserRootView::BrowserRootView(BrowserView* browser_view,
views::Widget* widget)
- : views::RootView(widget),
+ : views::internal::RootView(widget),
browser_view_(browser_view),
forwarding_to_tab_strip_(false) { }
@@ -110,7 +110,7 @@ int BrowserRootView::OnPerformDrop(const views::DropTargetEvent& event) {
}
void BrowserRootView::GetAccessibleState(ui::AccessibleViewState* state) {
- RootView::GetAccessibleState(state);
+ views::internal::RootView::GetAccessibleState(state);
state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
}
diff --git a/chrome/browser/ui/views/frame/browser_root_view.h b/chrome/browser/ui/views/frame/browser_root_view.h
index 48b4d28..6f93861 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.h
+++ b/chrome/browser/ui/views/frame/browser_root_view.h
@@ -20,7 +20,7 @@ class OSExchangeData;
// actually it doesn't. The tabstrip is only as high as a tab. To enable
// dropping above the tabstrip BrowserRootView forwards drop events to the
// TabStrip.
-class BrowserRootView : public views::RootView {
+class BrowserRootView : public views::internal::RootView {
public:
// You must call set_tabstrip before this class will accept drops.
BrowserRootView(BrowserView* browser_view, views::Widget* widget);
diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index 2f5bd45..f39ab6b 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -8,7 +8,6 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/animation/slide_animation.h"
#include "views/background.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
// Min/max opacity of the overlay.
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
index 62143d0..f1d2dae 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
@@ -15,7 +15,6 @@
#include "ui/gfx/canvas_skia.h"
#include "views/controls/link.h"
#include "views/screen.h"
-#include "views/widget/root_view.h"
#include "views/window/window.h"
#if defined(OS_WIN)
diff --git a/chrome/browser/ui/views/generic_info_view_unittest.cc b/chrome/browser/ui/views/generic_info_view_unittest.cc
index dd74bfe..153d96d8 100644
--- a/chrome/browser/ui/views/generic_info_view_unittest.cc
+++ b/chrome/browser/ui/views/generic_info_view_unittest.cc
@@ -11,7 +11,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
-#include "views/widget/root_view.h"
#include "views/window/window.h"
// This class is only used on windows for now.
@@ -30,7 +29,7 @@ TEST_F(GenericInfoViewTest, GenericInfoView) {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
- views::RootView* root_view = widget->GetRootView();
+ views::View* root_view = widget->GetRootView();
GenericInfoView* view1 = new GenericInfoView(1);
root_view->AddChildView(view1);
diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc
index bbef9e6..6ba1a74 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view.cc
@@ -35,7 +35,6 @@
#include "views/controls/menu/menu_2.h"
#include "views/controls/native/native_view_host.h"
#include "views/painter.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
using views::Widget;
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 3d88f73..b023d45 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
@@ -21,7 +21,6 @@
#include "views/focus/view_storage.h"
#include "views/screen.h"
#include "views/widget/native_widget.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#if defined(OS_WIN)
diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc
index 5140323..89baf3d 100644
--- a/chrome/browser/ui/views/tabs/base_tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc
@@ -355,7 +355,8 @@ void BaseTabStrip::ContinueDrag(const views::MouseEvent& event) {
if (drag_controller_->started_drag() && !started_drag) {
// The drag just started. Redirect mouse events to us to that the tab that
// originated the drag can be safely deleted.
- GetRootView()->SetMouseHandler(this);
+ static_cast<views::internal::RootView*>(GetWidget()->GetRootView())->
+ SetMouseHandler(this);
}
}
}
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index 9f9cf5e..2ffa620 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
@@ -35,7 +35,6 @@
#include "ui/gfx/canvas_skia.h"
#include "views/events/event.h"
#include "views/screen.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index 353205d..0e5d702 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -100,7 +100,8 @@ bool MenuButton::Activate() {
// matter where the user pressed. To force RootView to recalculate the
// mouse target during the mouse press we explicitly set the mouse handler
// to NULL.
- GetRootView()->SetMouseHandler(NULL);
+ static_cast<internal::RootView*>(GetWidget()->GetRootView())->
+ SetMouseHandler(NULL);
menu_visible_ = true;
diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc
index a5292eb..249cba2 100644
--- a/views/controls/button/radio_button.cc
+++ b/views/controls/button/radio_button.cc
@@ -6,7 +6,7 @@
#include "base/logging.h"
#include "ui/base/accessibility/accessible_view_state.h"
-#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
namespace views {
@@ -71,7 +71,7 @@ void RadioButton::GetAccessibleState(ui::AccessibleViewState* state) {
View* RadioButton::GetSelectedViewForGroup(int group_id) {
std::vector<View*> views;
- GetRootView()->GetViewsWithGroup(group_id, &views);
+ GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views);
if (views.empty())
return NULL;
@@ -170,7 +170,7 @@ void RadioButtonNt::GetAccessibleState(ui::AccessibleViewState* state) {
View* RadioButtonNt::GetSelectedViewForGroup(int group_id) {
std::vector<View*> views;
- GetRootView()->GetViewsWithGroup(group_id, &views);
+ GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views);
if (views.empty())
return NULL;
diff --git a/views/controls/combobox/native_combobox_views.cc b/views/controls/combobox/native_combobox_views.cc
index 624947b..10e197f 100644
--- a/views/controls/combobox/native_combobox_views.cc
+++ b/views/controls/combobox/native_combobox_views.cc
@@ -271,7 +271,7 @@ bool NativeComboboxViews::IsComboboxViewsEnabled() {
#if defined(TOUCH_UI)
return true;
#else
- return combobox_view_enabled || RootView::IsPureViews();
+ return combobox_view_enabled || Widget::IsPureViews();
#endif
}
diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc
index 70ea88c..82fd186 100644
--- a/views/controls/menu/menu_host.cc
+++ b/views/controls/menu/menu_host.cc
@@ -79,7 +79,7 @@ void MenuHost::ReleaseMenuHostCapture() {
////////////////////////////////////////////////////////////////////////////////
// MenuHost, Widget overrides:
-RootView* MenuHost::CreateRootView() {
+internal::RootView* MenuHost::CreateRootView() {
return new MenuHostRootView(this, submenu_);
}
diff --git a/views/controls/menu/menu_host.h b/views/controls/menu/menu_host.h
index 1849de4..a33f445 100644
--- a/views/controls/menu/menu_host.h
+++ b/views/controls/menu/menu_host.h
@@ -65,7 +65,7 @@ class MenuHost : public Widget,
private:
// Overridden from Widget:
- virtual RootView* CreateRootView() OVERRIDE;
+ virtual internal::RootView* CreateRootView() OVERRIDE;
virtual bool ShouldReleaseCaptureOnMouseReleased() const OVERRIDE;
// Overridden from NativeMenuHostDelegate:
diff --git a/views/controls/menu/menu_host_root_view.cc b/views/controls/menu/menu_host_root_view.cc
index e1c119f..b3676fa0 100644
--- a/views/controls/menu/menu_host_root_view.cc
+++ b/views/controls/menu/menu_host_root_view.cc
@@ -11,7 +11,7 @@ namespace views {
MenuHostRootView::MenuHostRootView(Widget* widget,
SubmenuView* submenu)
- : RootView(widget),
+ : internal::RootView(widget),
submenu_(submenu),
forward_drag_to_menu_controller_(true) {
}
diff --git a/views/controls/menu/menu_host_root_view.h b/views/controls/menu/menu_host_root_view.h
index 32200c5..11c674c 100644
--- a/views/controls/menu/menu_host_root_view.h
+++ b/views/controls/menu/menu_host_root_view.h
@@ -19,7 +19,7 @@ class SubmenuView;
//
// As all the menu items are owned by the root menu item, care must be taken
// such that when MenuHostRootView is deleted it doesn't delete the menu items.
-class MenuHostRootView : public RootView {
+class MenuHostRootView : public internal::RootView {
public:
MenuHostRootView(Widget* widget, SubmenuView* submenu);
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
index c35e862..872a7e3 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc
@@ -17,7 +17,6 @@
#include "views/controls/tabbed_pane/tabbed_pane_listener.h"
#include "views/layout/fill_layout.h"
#include "views/widget/native_widget.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace views {
@@ -90,9 +89,8 @@ View* NativeTabbedPaneGtk::RemoveTabAtIndex(int index) {
gtk_notebook_remove_page(GTK_NOTEBOOK(native_view()), index);
// Removing a tab might change the size of the tabbed pane.
- RootView* root_view = GetRootView();
- if (root_view)
- GetRootView()->Layout();
+ if (GetWidget())
+ GetWidget()->GetRootView()->Layout();
return removed_tab;
}
@@ -191,9 +189,8 @@ void NativeTabbedPaneGtk::DoAddTabAtIndex(int index,
gtk_notebook_set_current_page(GTK_NOTEBOOK(native_view()), 0);
// Relayout the hierarchy, since the added tab might require more space.
- RootView* root_view = GetRootView();
- if (root_view)
- GetRootView()->Layout();
+ if (GetWidget())
+ GetWidget()->GetRootView()->Layout();
}
Widget* NativeTabbedPaneGtk::GetWidgetAt(int index) {
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index 1a025cb..4933538 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -155,7 +155,7 @@ void NativeTabbedPaneWin::AddTabAtIndex(int index, const std::wstring& title,
// The newly added tab may have made the contents window smaller.
ResizeContents();
- RootView* content_root = content_window_->GetRootView();
+ View* content_root = content_window_->GetRootView();
content_root->AddChildView(contents);
// Switch to the newly added tab if requested;
if (tab_views_.size() == 1 && select_if_first_tab)
@@ -303,7 +303,7 @@ void NativeTabbedPaneWin::CreateNativeControl() {
if (base::i18n::IsRTL())
l10n_util::HWNDSetRTLLayout(tab_control);
- RootView* root_view = content_window_->GetRootView();
+ View* root_view = content_window_->GetRootView();
tab_layout_manager_ = new TabLayout();
root_view->SetLayoutManager(tab_layout_manager_);
DWORD sys_color = ::GetSysColor(COLOR_3DHILIGHT);
@@ -371,7 +371,7 @@ void NativeTabbedPaneWin::InitializeTabs() {
for (size_t i = 0; i < tab_titles_.size(); ++i)
AddNativeTab(i, tab_titles_[i]);
- RootView* content_root = content_window_->GetRootView();
+ View* content_root = content_window_->GetRootView();
for (std::vector<View*>::iterator tab(tab_views_.begin());
tab != tab_views_.end(); ++tab)
content_root->AddChildView(*tab);
@@ -380,7 +380,7 @@ void NativeTabbedPaneWin::InitializeTabs() {
void NativeTabbedPaneWin::DoSelectTabAt(int index, boolean invoke_listener) {
selected_index_ = index;
if (content_window_) {
- RootView* content_root = content_window_->GetRootView();
+ View* content_root = content_window_->GetRootView();
tab_layout_manager_->SwitchToPage(content_root, tab_views_.at(index));
}
if (invoke_listener && tabbed_pane_->listener())
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index ad3497b..0eeb291 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -28,7 +28,7 @@
#include "views/ime/input_method.h"
#include "views/metrics.h"
#include "views/views_delegate.h"
-#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
#if defined(OS_LINUX)
#include "ui/gfx/gtk_util.h"
@@ -530,7 +530,7 @@ bool NativeTextfieldViews::IsTextfieldViewsEnabled() {
#if defined(TOUCH_UI)
return true;
#else
- return textfield_view_enabled || RootView::IsPureViews();
+ return textfield_view_enabled || Widget::IsPureViews();
#endif
}
diff --git a/views/events/event.cc b/views/events/event.cc
index b729967..86166b7 100644
--- a/views/events/event.cc
+++ b/views/events/event.cc
@@ -53,7 +53,7 @@ LocatedEvent::LocatedEvent(const LocatedEvent& model, View* source,
View::ConvertPointToView(source, target, &location_);
}
-LocatedEvent::LocatedEvent(const LocatedEvent& model, RootView* root)
+LocatedEvent::LocatedEvent(const LocatedEvent& model, View* root)
: Event(model),
location_(model.location_) {
View::ConvertPointFromWidget(root, &location_);
@@ -206,7 +206,7 @@ TouchEvent::TouchEvent(const TouchEvent& model, View* source, View* target)
////////////////////////////////////////////////////////////////////////////////
// TouchEvent, private:
-TouchEvent::TouchEvent(const TouchEvent& model, RootView* root)
+TouchEvent::TouchEvent(const TouchEvent& model, View* root)
: LocatedEvent(model, root),
touch_id_(model.touch_id_),
radius_(model.radius_),
diff --git a/views/events/event.h b/views/events/event.h
index 924a350..2c23104 100644
--- a/views/events/event.h
+++ b/views/events/event.h
@@ -24,9 +24,12 @@ using ui::OSExchangeData;
namespace views {
-class RootView;
class View;
+namespace internal {
+class RootView;
+}
+
#if defined(OS_WIN)
bool IsClientMouseEvent(const views::NativeEvent& native_event);
bool IsNonClientMouseEvent(const views::NativeEvent& native_event);
@@ -156,7 +159,7 @@ class LocatedEvent : public Event {
// This constructor is to allow converting the location of an event from the
// widget's coordinate system to the RootView's coordinate system.
- LocatedEvent(const LocatedEvent& model, RootView* root);
+ LocatedEvent(const LocatedEvent& model, View* root);
gfx::Point location_;
};
@@ -226,12 +229,12 @@ class MouseEvent : public LocatedEvent {
}
protected:
- MouseEvent(const MouseEvent& model, RootView* root)
+ MouseEvent(const MouseEvent& model, View* root)
: LocatedEvent(model, root) {
}
private:
- friend class RootView;
+ friend class internal::RootView;
DISALLOW_COPY_AND_ASSIGN(MouseEvent);
};
@@ -272,9 +275,9 @@ class TouchEvent : public LocatedEvent {
float ratio() const { return ratio_; }
private:
- friend class RootView;
+ friend class internal::RootView;
- TouchEvent(const TouchEvent& model, RootView* root);
+ TouchEvent(const TouchEvent& model, View* root);
// The identity (typically finger) of the touch starting at 0 and incrementing
// for each separable additional touch that the hardware can detect.
@@ -373,9 +376,9 @@ class MouseWheelEvent : public MouseEvent {
int offset() const { return offset_; }
private:
- friend class RootView;
+ friend class internal::RootView;
- MouseWheelEvent(const MouseWheelEvent& model, RootView* root)
+ MouseWheelEvent(const MouseWheelEvent& model, View* root)
: MouseEvent(model, root),
offset_(model.offset_) {
}
diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc
index d46fb72..1c28b42 100644
--- a/views/examples/examples_main.cc
+++ b/views/examples/examples_main.cc
@@ -31,7 +31,7 @@
#include "views/examples/widget_example.h"
#include "views/focus/accelerator_handler.h"
#include "views/layout/grid_layout.h"
-#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
#include "views/window/window.h"
#include "views/test/test_views_delegate.h"
@@ -190,7 +190,7 @@ int main(int argc, char** argv) {
// We do not this header: chrome/common/chrome_switches.h
// because that would create a dependency back on Chrome
- views::RootView::SetPureViews(
+ views::Widget::SetPureViews(
CommandLine::ForCurrentProcess()->HasSwitch("use-pure-views"));
examples::ExamplesMain main;
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index 3ac8e4a..91e981a 100644
--- a/views/focus/accelerator_handler_touch.cc
+++ b/views/focus/accelerator_handler_touch.cc
@@ -18,7 +18,6 @@
#include "views/ime/input_method.h"
#include "views/touchui/touch_factory.h"
#include "views/widget/native_widget.h"
-#include "views/widget/root_view.h"
namespace views {
@@ -80,7 +79,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) {
// If the TouchEvent is processed by |root|, then return. Otherwise let
// it fall through so it can be used as a MouseEvent, if desired.
TouchEvent touch(xev, from_native);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
if (root->OnTouchEvent(touch) != views::View::TOUCH_STATUS_UNKNOWN)
return true;
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index d8122c2..b891cae 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -267,12 +267,12 @@ class BorderView : public NativeViewHost {
virtual ~BorderView() {}
- virtual RootView* GetContentsRootView() {
- return widget_->GetRootView();
+ virtual internal::RootView* GetContentsRootView() {
+ return static_cast<internal::RootView*>(widget_->GetRootView());
}
virtual FocusTraversable* GetFocusTraversable() {
- return widget_->GetRootView();
+ return static_cast<internal::RootView*>(widget_->GetRootView());
}
virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child) {
@@ -283,7 +283,7 @@ class BorderView : public NativeViewHost {
widget_ = new Widget;
Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
#if defined(OS_WIN)
- params.parent = parent->GetRootView()->GetWidget()->GetNativeView();
+ params.parent = parent->GetWidget()->GetNativeView();
#elif defined(TOOLKIT_USES_GTK)
params.parent = native_view();
#endif
@@ -295,8 +295,8 @@ class BorderView : public NativeViewHost {
// We have been added to a view hierarchy, attach the native view.
Attach(widget_->GetNativeView());
// Also update the FocusTraversable parent so the focus traversal works.
- widget_->GetRootView()->SetFocusTraversableParent(
- GetWidget()->GetFocusTraversable());
+ static_cast<internal::RootView*>(widget_->GetRootView())->
+ SetFocusTraversableParent(GetWidget()->GetFocusTraversable());
}
}
diff --git a/views/view.cc b/views/view.cc
index 72c7f98..392ca08 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -232,12 +232,6 @@ bool View::ContainsNativeView(gfx::NativeView native_view) const {
return false;
}
-// TODO(beng): remove
-RootView* View::GetRootView() {
- Widget* widget = GetWidget();
- return widget ? widget->GetRootView() : NULL;
-}
-
// Size and disposition --------------------------------------------------------
void View::SetBounds(int x, int y, int width, int height) {
@@ -1087,7 +1081,7 @@ void View::VisibilityChanged(View* starting_from, bool is_visible) {
void View::NativeViewHierarchyChanged(bool attached,
gfx::NativeView native_view,
- RootView* root_view) {
+ internal::RootView* root_view) {
FocusManager* focus_manager = GetFocusManager();
if (!accelerator_registration_delayed_ &&
accelerator_focus_manager_ &&
@@ -1361,7 +1355,7 @@ void View::PropagateAddNotifications(View* parent, View* child) {
void View::PropagateNativeViewHierarchyChanged(bool attached,
gfx::NativeView native_view,
- RootView* root_view) {
+ internal::RootView* root_view) {
for (int i = 0, count = child_count(); i < count; ++i)
GetChildViewAt(i)->PropagateNativeViewHierarchyChanged(attached,
native_view,
diff --git a/views/view.h b/views/view.h
index ee979d6..984f50b 100644
--- a/views/view.h
+++ b/views/view.h
@@ -54,12 +54,15 @@ class FocusManager;
class FocusTraversable;
class InputMethod;
class LayoutManager;
-class RootView;
class ScrollView;
class TextInputClient;
class Widget;
class Window;
+namespace internal {
+class RootView;
+}
+
// ContextMenuController is responsible for showing the context menu for a
// View. To use a ContextMenuController invoke SetContextMenuController on a
// View. When the appropriate user gesture occurs ShowContextMenu is invoked
@@ -242,10 +245,6 @@ class View : public AcceleratorTarget {
// hierarchy beneath this view.
virtual bool ContainsNativeView(gfx::NativeView native_view) const;
- // TODO(beng): REMOVE (RootView->internal API)
- // Get the containing RootView
- virtual RootView* GetRootView();
-
// Size and disposition ------------------------------------------------------
// Methods for obtaining and modifying the position and size of the view.
// Position is in the coordinate system of the view's parent.
@@ -997,7 +996,7 @@ class View : public AcceleratorTarget {
// it - like registering accelerators, for example.
virtual void NativeViewHierarchyChanged(bool attached,
gfx::NativeView native_view,
- RootView* root_view);
+ internal::RootView* root_view);
// Painting ------------------------------------------------------------------
@@ -1130,9 +1129,10 @@ class View : public AcceleratorTarget {
static int GetVerticalDragThreshold();
private:
- friend class RootView;
+ friend class internal::RootView;
friend class FocusManager;
friend class ViewStorage;
+ friend class Widget;
// Used to track a drag. RootView passes this into
// ProcessMousePressed/Dragged.
@@ -1179,7 +1179,7 @@ class View : public AcceleratorTarget {
// children.
void PropagateNativeViewHierarchyChanged(bool attached,
gfx::NativeView native_view,
- RootView* root_view);
+ internal::RootView* root_view);
// Takes care of registering/unregistering accelerators if
// |register_accelerators| true and calls ViewHierarchyChanged().
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 50e944c..3d12188 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -298,7 +298,7 @@ TEST_F(ViewTest, MouseEvent) {
params.delete_on_destroy = false;
params.bounds = gfx::Rect(50, 50, 650, 650);
widget->Init(params);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(v1);
v1->AddChildView(v2);
@@ -407,10 +407,10 @@ TEST_F(ViewTest, TouchEvent) {
params.delete_on_destroy = false;
params.bounds = gfx::Rect(50, 50, 650, 650);
widget->Init(params);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(v1);
- root->SetGestureManager(gm);
+ static_cast<internal::RootView*>(root)->SetGestureManager(gm);
v1->AddChildView(v2);
v2->AddChildView(v3);
@@ -537,7 +537,7 @@ TEST_F(ViewTest, DISABLED_Painting) {
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL);
- RootView* root = window.GetRootView();
+ View* root = window.GetRootView();
TestView* v1 = new TestView();
v1->SetBounds(0, 0, 650, 650);
@@ -604,7 +604,7 @@ TEST_F(ViewTest, DISABLED_RemoveNotification) {
ViewStorage* vs = ViewStorage::GetInstance();
Widget* widget = new Widget;
widget->Init(Widget::InitParams(Widget::InitParams::TYPE_WINDOW));
- RootView* root_view = widget->GetRootView();
+ View* root_view = widget->GetRootView();
View* v1 = new View;
int s1 = vs->CreateStorageID();
@@ -723,7 +723,7 @@ class HitTestView : public View {
gfx::Point ConvertPointToView(View* view, const gfx::Point& p) {
gfx::Point tmp(p);
- View::ConvertPointToView(view->GetRootView(), view, &tmp);
+ View::ConvertPointToView(view->GetWidget()->GetRootView(), view, &tmp);
return tmp;
}
}
@@ -731,7 +731,7 @@ gfx::Point ConvertPointToView(View* view, const gfx::Point& p) {
TEST_F(ViewTest, HitTestMasks) {
Widget* widget = new Widget;
widget->Init(Widget::InitParams(Widget::InitParams::TYPE_WINDOW));
- RootView* root_view = widget->GetRootView();
+ View* root_view = widget->GetRootView();
root_view->SetBounds(0, 0, 500, 500);
gfx::Rect v1_bounds = gfx::Rect(0, 0, 100, 100);
@@ -777,7 +777,7 @@ TEST_F(ViewTest, Textfield) {
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
- RootView* root_view = widget->GetRootView();
+ View* root_view = widget->GetRootView();
Textfield* textfield = new Textfield();
root_view->AddChildView(textfield);
@@ -815,7 +815,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
- RootView* root_view = widget->GetRootView();
+ View* root_view = widget->GetRootView();
Textfield* normal = new Textfield();
Textfield* read_only = new Textfield();
@@ -938,7 +938,7 @@ TEST_F(ViewTest, ActivateAccelerator) {
params.delete_on_destroy = false;
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(view);
// Get the focus manager.
@@ -1003,7 +1003,7 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) {
params.delete_on_destroy = false;
params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(view);
FocusManager* focus_manager = FocusManager::GetFocusManagerForNativeView(
@@ -1441,7 +1441,7 @@ TEST_F(ViewTest, ChangeVisibility) {
#endif
scoped_ptr<Widget> window(CreateWidget());
window->Init(NULL, gfx::Rect(0, 0, 500, 300));
- RootView* root_view = window->GetRootView();
+ View* root_view = window->GetRootView();
NativeButtonBase* native = new NativeButtonBase(NULL, L"Native");
root_view->SetContentsView(native);
@@ -1467,7 +1467,7 @@ class TestNativeViewHierarchy : public View {
virtual void NativeViewHierarchyChanged(bool attached,
gfx::NativeView native_view,
- RootView* root_view) {
+ internal::RootView* root_view) {
NotificationInfo info;
info.attached = attached;
info.native_view = native_view;
@@ -1477,7 +1477,7 @@ class TestNativeViewHierarchy : public View {
struct NotificationInfo {
bool attached;
gfx::NativeView native_view;
- RootView* root_view;
+ internal::RootView* root_view;
};
static const size_t kTotalViews = 2;
std::vector<NotificationInfo> notifications_;
@@ -1524,7 +1524,7 @@ class TestChangeNativeViewHierarchy {
// go through all of them.
for (NativeWidget::NativeWidgets::iterator i = widgets.begin();
i != widgets.end(); ++i) {
- RootView* root_view = (*i)->GetWidget()->GetRootView();
+ View* root_view = (*i)->GetWidget()->GetRootView();
if (host_->GetRootView() == root_view)
continue;
size_t j;
@@ -1543,10 +1543,10 @@ class TestChangeNativeViewHierarchy {
size_t i;
for (i = 0; i < TestNativeViewHierarchy::kTotalViews; ++i) {
// TODO(georgey): use actual hierarchy changes to send notifications.
- root_views_[i]->NotifyNativeViewHierarchyChanged(false,
- host_->GetNativeView());
- root_views_[i]->NotifyNativeViewHierarchyChanged(true,
- host_->GetNativeView());
+ static_cast<internal::RootView*>(root_views_[i])->
+ NotifyNativeViewHierarchyChanged(false, host_->GetNativeView());
+ static_cast<internal::RootView*>(root_views_[i])->
+ NotifyNativeViewHierarchyChanged(true, host_->GetNativeView());
}
for (i = 0; i < TestNativeViewHierarchy::kTotalViews; ++i) {
ASSERT_EQ(static_cast<size_t>(2), test_views_[i]->notifications_.size());
@@ -1564,7 +1564,7 @@ class TestChangeNativeViewHierarchy {
NativeViewHost* native_host_;
Widget* host_;
Widget* windows_[TestNativeViewHierarchy::kTotalViews];
- RootView* root_views_[TestNativeViewHierarchy::kTotalViews];
+ View* root_views_[TestNativeViewHierarchy::kTotalViews];
TestNativeViewHierarchy* test_views_[TestNativeViewHierarchy::kTotalViews];
ViewTest* view_test_;
};
@@ -1624,7 +1624,7 @@ TEST_F(ViewTest, TransformPaint) {
params.bounds = gfx::Rect(50, 50, 650, 650);
widget->Init(params);
widget->Show();
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(v1);
v1->AddChildView(v2);
@@ -1662,7 +1662,7 @@ TEST_F(ViewTest, TransformEvent) {
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
params.bounds = gfx::Rect(50, 50, 650, 650);
widget->Init(params);
- RootView* root = widget->GetRootView();
+ View* root = widget->GetRootView();
root->AddChildView(v1);
v1->AddChildView(v2);
@@ -1828,7 +1828,7 @@ TEST_F(ViewTest, OnVisibleBoundsChanged) {
widget->GetRootView()->SetBoundsRect(viewport_bounds);
View* viewport = new View;
- widget->GetRootView()->SetContentsView(viewport);
+ widget->SetContentsView(viewport);
View* contents = new View;
viewport->AddChildView(contents);
viewport->SetBoundsRect(viewport_bounds);
diff --git a/views/widget/drop_helper.cc b/views/widget/drop_helper.cc
index a0b7b76..4e5ce109 100644
--- a/views/widget/drop_helper.cc
+++ b/views/widget/drop_helper.cc
@@ -6,11 +6,11 @@
#include "ui/base/dragdrop/drag_drop_types.h"
#include "views/view.h"
-#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
namespace views {
-DropHelper::DropHelper(RootView* root_view)
+DropHelper::DropHelper(View* root_view)
: root_view_(root_view),
target_view_(NULL),
deepest_view_(NULL) {
@@ -61,7 +61,7 @@ int DropHelper::OnDrop(const OSExchangeData& data,
}
gfx::Point view_location(root_view_location);
- View* root_view = drop_view->GetRootView();
+ View* root_view = drop_view->GetWidget()->GetRootView();
View::ConvertPointToView(root_view, drop_view, &view_location);
DropTargetEvent drop_event(data, view_location.x(), view_location.y(),
drag_operation);
diff --git a/views/widget/drop_helper.h b/views/widget/drop_helper.h
index 453a04e..cc62bfc 100644
--- a/views/widget/drop_helper.h
+++ b/views/widget/drop_helper.h
@@ -29,14 +29,14 @@ class View;
// then either OnDragExit or OnDrop when the drop is done.
class DropHelper {
public:
- explicit DropHelper(RootView* root_view);
+ explicit DropHelper(View* root_view);
~DropHelper();
// Current view drop events are targeted at, may be NULL.
View* target_view() const { return target_view_; }
// Returns the RootView the DropHelper was created with.
- RootView* root_view() const { return root_view_; }
+ View* root_view() const { return root_view_; }
// Resets the target_view_ to NULL if it equals view.
//
@@ -92,7 +92,7 @@ class DropHelper {
void NotifyDragExit();
// RootView we were created for.
- RootView* root_view_;
+ View* root_view_;
// View we're targeting events at.
View* target_view_;
diff --git a/views/widget/drop_target_gtk.cc b/views/widget/drop_target_gtk.cc
index 4fecfcb..8d8e760 100644
--- a/views/widget/drop_target_gtk.cc
+++ b/views/widget/drop_target_gtk.cc
@@ -69,7 +69,7 @@ int CalculateTypes(GList* targets, std::set<GdkAtom>* type_set) {
namespace views {
-DropTargetGtk::DropTargetGtk(RootView* root_view,
+DropTargetGtk::DropTargetGtk(internal::RootView* root_view,
GdkDragContext* context)
: helper_(root_view),
requested_formats_(0),
diff --git a/views/widget/drop_target_gtk.h b/views/widget/drop_target_gtk.h
index 75fd1c0..bc2c3ca 100644
--- a/views/widget/drop_target_gtk.h
+++ b/views/widget/drop_target_gtk.h
@@ -21,8 +21,10 @@ using ui::OSExchangeDataProviderGtk;
namespace views {
-class RootView;
class View;
+namespace internal {
+class RootView;
+}
// DropTarget implementation for Gtk.
//
@@ -37,7 +39,7 @@ class View;
// which results in deleting the DropTargetGtk.
class DropTargetGtk {
public:
- explicit DropTargetGtk(RootView* root_view,
+ explicit DropTargetGtk(internal::RootView* root_view,
GdkDragContext* context);
~DropTargetGtk();
diff --git a/views/widget/drop_target_win.cc b/views/widget/drop_target_win.cc
index 7632f6a..c4c8e2c 100644
--- a/views/widget/drop_target_win.cc
+++ b/views/widget/drop_target_win.cc
@@ -16,7 +16,7 @@ using ui::OSExchangeDataProviderWin;
namespace views {
-DropTargetWin::DropTargetWin(RootView* root_view)
+DropTargetWin::DropTargetWin(internal::RootView* root_view)
: ui::DropTarget(root_view->GetWidget()->GetNativeView()),
helper_(root_view) {
}
diff --git a/views/widget/drop_target_win.h b/views/widget/drop_target_win.h
index 1498841..966bbc2 100644
--- a/views/widget/drop_target_win.h
+++ b/views/widget/drop_target_win.h
@@ -11,8 +11,10 @@
namespace views {
-class RootView;
class View;
+namespace internal {
+class RootView;
+}
// DropTargetWin takes care of managing drag and drop for NativeWidgetWin. It
// converts Windows OLE drop messages into Views drop messages.
@@ -21,7 +23,7 @@ class View;
// drop messages at.
class DropTargetWin : public ui::DropTarget {
public:
- explicit DropTargetWin(RootView* root_view);
+ explicit DropTargetWin(internal::RootView* root_view);
virtual ~DropTargetWin();
// If a drag and drop is underway and view is the current drop target, the
diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc
index 92ddd11..0aeb451 100644
--- a/views/widget/native_widget_gtk.cc
+++ b/views/widget/native_widget_gtk.cc
@@ -31,7 +31,6 @@
#include "views/widget/drop_target_gtk.h"
#include "views/widget/gtk_views_fixed.h"
#include "views/widget/gtk_views_window.h"
-#include "views/widget/root_view.h"
#include "views/widget/tooltip_manager_gtk.h"
#include "views/widget/widget_delegate.h"
#include "views/window/native_window_gtk.h"
@@ -1170,8 +1169,11 @@ gboolean NativeWidgetGtk::OnDragMotion(GtkWidget* widget,
gint x,
gint y,
guint time) {
- if (!drop_target_.get())
- drop_target_.reset(new DropTargetGtk(GetWidget()->GetRootView(), context));
+ if (!drop_target_.get()) {
+ drop_target_.reset(new DropTargetGtk(
+ reinterpret_cast<internal::RootView*>(GetWidget()->GetRootView()),
+ context));
+ }
return drop_target_->OnDragMotion(context, x, y, time);
}
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 50f4cca..ce28ef3 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -558,7 +558,8 @@ LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) {
props_.push_back(SetWindowSupportsRerouteMouseWheel(hwnd()));
- drop_target_ = new DropTargetWin(GetWidget()->GetRootView());
+ drop_target_ = new DropTargetWin(
+ static_cast<internal::RootView*>(GetWidget()->GetRootView()));
// We need to add ourselves as a message loop observer so that we can repaint
// aggressively if the contents of our window become invalid. Unfortunately
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index 6942d3d..9537bd8 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -22,6 +22,7 @@
#endif
namespace views {
+namespace internal {
// static
const char RootView::kViewClassName[] = "views/RootView";
@@ -415,19 +416,6 @@ bool RootView::GetKeepMouseCursor() {
#endif
-namespace {
-// Set to true if a pure Views implementation is preferred
-bool use_pure_views;
-}
-
-void RootView::SetPureViews(bool pure) {
- use_pure_views = pure;
-}
-
-bool RootView::IsPureViews() {
- return use_pure_views;
-}
-
////////////////////////////////////////////////////////////////////////////////
// RootView, protected:
@@ -481,4 +469,6 @@ void RootView::SetMouseLocationAndFlags(const MouseEvent& event) {
last_mouse_event_y_ = event.y();
}
+} // namespace internal
} // namespace views
+
diff --git a/views/widget/root_view.h b/views/widget/root_view.h
index fc8b632..587967f 100644
--- a/views/widget/root_view.h
+++ b/views/widget/root_view.h
@@ -20,6 +20,10 @@ class Widget;
class GestureManager;
#endif
+// This is a views-internal API and should not be used externally.
+// Widget exposes this object as a View*.
+namespace internal {
+
////////////////////////////////////////////////////////////////////////////////
// RootView class
//
@@ -34,9 +38,7 @@ class GestureManager;
// initialized to attach the contents view to the RootView.
// TODO(beng): Enforce no other callers to AddChildView/tree functions by
// overriding those methods as private here.
-// TODO(beng): Move to internal namespace and remove accessors from
-// View/Widget.
-// TODO(beng): Clean up API further, make WidgetImpl a friend.
+// TODO(beng): Clean up API further, make Widget a friend.
//
class RootView : public View,
public FocusTraversable {
@@ -118,11 +120,6 @@ class RootView : public View,
static bool GetKeepMouseCursor();
#endif
- // SetPureViews and IsPureViews update and return the state of a global
- // setting that tracks whether to use available pure Views implementations
- static void SetPureViews(bool pure);
- static bool IsPureViews();
-
protected:
// Overridden from View:
virtual void ViewHierarchyChanged(bool is_add, View* parent,
@@ -214,6 +211,8 @@ class RootView : public View,
DISALLOW_IMPLICIT_CONSTRUCTORS(RootView);
};
+
+} // namespace internal
} // namespace views
#endif // VIEWS_WIDGET_ROOT_VIEW_H_
diff --git a/views/widget/tooltip_manager_gtk.cc b/views/widget/tooltip_manager_gtk.cc
index 909dc57..d88f345 100644
--- a/views/widget/tooltip_manager_gtk.cc
+++ b/views/widget/tooltip_manager_gtk.cc
@@ -9,8 +9,8 @@
#include "ui/gfx/font.h"
#include "views/focus/focus_manager.h"
#include "views/screen.h"
+#include "views/view.h"
#include "views/widget/native_widget_gtk.h"
-#include "views/widget/root_view.h"
// WARNING: this implementation is good for a start, but it doesn't give us
// control of tooltip positioning both on mouse events and when showing from
@@ -85,7 +85,7 @@ bool TooltipManagerGtk::ShowTooltip(int x, int y, bool for_keyboard,
view = keyboard_view_;
view_loc.SetPoint(view->width() / 2, view->height() / 2);
} else if (!for_keyboard) {
- RootView* root_view = widget_->GetWidget()->GetRootView();
+ View* root_view = widget_->GetWidget()->GetRootView();
view = root_view->GetEventHandlerForPoint(gfx::Point(x, y));
view_loc.SetPoint(x, y);
View::ConvertPointFromWidget(view, &view_loc);
diff --git a/views/widget/tooltip_manager_win.cc b/views/widget/tooltip_manager_win.cc
index e905218..9158818 100644
--- a/views/widget/tooltip_manager_win.cc
+++ b/views/widget/tooltip_manager_win.cc
@@ -16,7 +16,6 @@
#include "views/screen.h"
#include "views/view.h"
#include "views/widget/monitor_win.h"
-#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace views {
@@ -148,7 +147,7 @@ LRESULT TooltipManagerWin::OnNotify(int w_param,
case TTN_GETDISPINFO: {
if (last_view_out_of_sync_) {
// View under the mouse is out of sync, determine it now.
- RootView* root_view = widget_->GetRootView();
+ View* root_view = widget_->GetRootView();
last_tooltip_view_ =
root_view->GetEventHandlerForPoint(last_mouse_pos_);
last_view_out_of_sync_ = false;
@@ -271,7 +270,7 @@ int TooltipManagerWin::CalcTooltipHeight() {
}
void TooltipManagerWin::UpdateTooltip(const gfx::Point& mouse_pos) {
- RootView* root_view = widget_->GetRootView();
+ View* root_view = widget_->GetRootView();
View* view = root_view->GetEventHandlerForPoint(mouse_pos);
if (view != last_tooltip_view_) {
// NOTE: This *must* be sent regardless of the visibility of the tooltip.
diff --git a/views/widget/widget.cc b/views/widget/widget.cc
index 6e1e693..8f28fec 100644
--- a/views/widget/widget.cc
+++ b/views/widget/widget.cc
@@ -16,6 +16,12 @@
namespace views {
+namespace {
+// Set to true if a pure Views implementation is preferred
+bool use_pure_views;
+}
+
+
////////////////////////////////////////////////////////////////////////////////
// Widget, InitParams:
@@ -78,6 +84,14 @@ Widget::~Widget() {
delete native_widget_;
}
+void Widget::SetPureViews(bool pure) {
+ use_pure_views = pure;
+}
+
+bool Widget::IsPureViews() {
+ return use_pure_views;
+}
+
void Widget::Init(const InitParams& params) {
delete_on_destroy_ = params.delete_on_destroy;
native_widget_ =
@@ -206,7 +220,7 @@ void Widget::SetAlwaysOnTop(bool on_top) {
native_widget_->SetAlwaysOnTop(on_top);
}
-RootView* Widget::GetRootView() {
+View* Widget::GetRootView() {
if (!root_view_.get()) {
// First time the root view is being asked for, create it now.
root_view_.reset(CreateRootView());
@@ -291,7 +305,7 @@ void Widget::ResetLastMouseMoveFlag() {
}
FocusTraversable* Widget::GetFocusTraversable() {
- return root_view_.get();
+ return static_cast<internal::RootView*>(root_view_.get());
}
void Widget::ThemeChanged() {
@@ -381,7 +395,7 @@ void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) {
}
bool Widget::OnKeyEvent(const KeyEvent& event) {
- return GetRootView()->OnKeyEvent(event);
+ return static_cast<internal::RootView*>(GetRootView())->OnKeyEvent(event);
}
bool Widget::OnMouseEvent(const MouseEvent& event) {
@@ -468,8 +482,8 @@ View* Widget::GetFocusTraversableParentView() {
////////////////////////////////////////////////////////////////////////////////
// Widget, protected:
-RootView* Widget::CreateRootView() {
- return new RootView(this);
+internal::RootView* Widget::CreateRootView() {
+ return new internal::RootView(this);
}
void Widget::DestroyRootView() {
diff --git a/views/widget/widget.h b/views/widget/widget.h
index f7c12ae..c19be52 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -36,11 +36,13 @@ namespace views {
class DefaultThemeProvider;
class InputMethod;
class NativeWidget;
-class RootView;
class TooltipManager;
class View;
class WidgetDelegate;
class Window;
+namespace internal {
+class RootView;
+}
////////////////////////////////////////////////////////////////////////////////
// Widget class
@@ -120,6 +122,11 @@ class Widget : public internal::NativeWidgetDelegate,
const Widget* target,
gfx::Rect* rect);
+ // SetPureViews and IsPureViews update and return the state of a global
+ // setting that tracks whether to use available pure Views implementations
+ static void SetPureViews(bool pure);
+ static bool IsPureViews();
+
void Init(const InitParams& params);
// Unconverted methods -------------------------------------------------------
@@ -212,8 +219,9 @@ class Widget : public internal::NativeWidgetDelegate,
// Sets the widget to be on top of all other widgets in the windowing system.
void SetAlwaysOnTop(bool on_top);
- // Returns the RootView contained by this Widget.
- RootView* GetRootView();
+ // Returns the View at the root of the View hierarchy contained by this
+ // Widget.
+ View* GetRootView();
// A secondary widget is one that is automatically closed (via Close()) when
// all non-secondary widgets are closed.
@@ -334,7 +342,7 @@ class Widget : public internal::NativeWidgetDelegate,
// Creates the RootView to be used within this Widget. Subclasses may override
// to create custom RootViews that do specialized event processing.
// TODO(beng): Investigate whether or not this is needed.
- virtual RootView* CreateRootView();
+ virtual internal::RootView* CreateRootView();
// Provided to allow the NativeWidget implementations to destroy the RootView
// _before_ the focus manager/tooltip manager.
@@ -373,7 +381,7 @@ class Widget : public internal::NativeWidgetDelegate,
// The root of the View hierarchy attached to this window.
// WARNING: see warning in tooltip_manager_ for ordering dependencies with
// this and tooltip_manager_.
- scoped_ptr<RootView> root_view_;
+ scoped_ptr<internal::RootView> root_view_;
// The focus manager keeping track of focus for this Widget and any of its
// children. NULL for non top-level widgets.
diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc
index 1afa346..e54deb9 100644
--- a/views/window/native_window_gtk.cc
+++ b/views/window/native_window_gtk.cc
@@ -11,7 +11,6 @@
#include "ui/gfx/rect.h"
#include "views/events/event.h"
#include "views/screen.h"
-#include "views/widget/root_view.h"
#include "views/window/custom_frame_view.h"
#include "views/window/hit_test.h"
#include "views/window/native_window_delegate.h"
diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc
index 487aa0d..b7708d8 100644
--- a/views/window/native_window_win.cc
+++ b/views/window/native_window_win.cc
@@ -21,7 +21,6 @@
#include "ui/gfx/icon_util.h"
#include "ui/gfx/path.h"
#include "views/accessibility/native_view_accessibility_win.h"
-#include "views/widget/root_view.h"
#include "views/window/client_view.h"
#include "views/window/custom_frame_view.h"
#include "views/window/native_window_delegate.h"
@@ -766,7 +765,6 @@ void NativeWindowWin::OnNCPaint(HRGN rgn) {
EnumChildWindows(GetNativeView(), &ClipDCToChild,
reinterpret_cast<LPARAM>(&clip_state));
- RootView* root_view = GetWidget()->GetRootView();
gfx::Rect old_paint_region = invalid_rect();
if (!old_paint_region.IsEmpty()) {