summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/accessibility/browser_views_accessibility_browsertest.cc8
-rw-r--r--chrome/browser/automation/automation_provider_win.cc1
-rw-r--r--chrome/browser/browser_focus_uitest.cc1
-rw-r--r--chrome/browser/browser_main_win.cc5
-rw-r--r--chrome/browser/chromeos/choose_mobile_network_dialog.cc2
-rw-r--r--chrome/browser/chromeos/external_protocol_dialog.cc10
-rw-r--r--chrome/browser/chromeos/external_protocol_dialog.h22
-rw-r--r--chrome/browser/chromeos/frame/browser_frame_chromeos.cc4
-rw-r--r--chrome/browser/chromeos/frame/browser_frame_chromeos.h2
-rw-r--r--chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc1
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc2
-rw-r--r--chrome/browser/chromeos/frame/bubble_frame_view.cc14
-rw-r--r--chrome/browser/chromeos/frame/bubble_frame_view.h8
-rw-r--r--chrome/browser/chromeos/frame/bubble_window.cc39
-rw-r--r--chrome/browser/chromeos/frame/bubble_window.h14
-rw-r--r--chrome/browser/chromeos/frame/panel_browser_view.cc1
-rw-r--r--chrome/browser/chromeos/frame/panel_controller.cc1
-rw-r--r--chrome/browser/chromeos/google_update_chromeos.cc9
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window.cc2
-rw-r--r--chrome/browser/chromeos/login/background_view.cc6
-rw-r--r--chrome/browser/chromeos/login/background_view.h4
-rw-r--r--chrome/browser/chromeos/login/captcha_view.cc4
-rw-r--r--chrome/browser/chromeos/login/captcha_view.h4
-rw-r--r--chrome/browser/chromeos/login/eula_view.cc10
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc6
-rw-r--r--chrome/browser/chromeos/login/login_html_dialog.cc8
-rw-r--r--chrome/browser/chromeos/login/network_screen.cc2
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc1
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.h1
-rw-r--r--chrome/browser/chromeos/login/password_changed_view.cc4
-rw-r--r--chrome/browser/chromeos/login/views_login_display.cc2
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.h5
-rw-r--r--chrome/browser/chromeos/native_dialog_window.cc20
-rw-r--r--chrome/browser/chromeos/network_login_observer.cc8
-rw-r--r--chrome/browser/chromeos/network_login_observer.h4
-rw-r--r--chrome/browser/chromeos/options/network_config_view.cc9
-rw-r--r--chrome/browser/chromeos/options/network_config_view.h6
-rw-r--r--chrome/browser/chromeos/options/take_photo_dialog.h1
-rw-r--r--chrome/browser/chromeos/options/vpn_config_view.cc1
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc1
-rw-r--r--chrome/browser/chromeos/sim_dialog_delegate.cc2
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button.cc1
-rw-r--r--chrome/browser/chromeos/status/input_method_menu.cc2
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.cc2
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.cc1
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc4
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc2
-rw-r--r--chrome/browser/chromeos/status/power_menu_button.cc2
-rw-r--r--chrome/browser/external_tab_container_win.cc10
-rw-r--r--chrome/browser/external_tab_container_win.h4
-rw-r--r--chrome/browser/google/google_update.cc9
-rw-r--r--chrome/browser/google/google_update.h6
-rw-r--r--chrome/browser/ui/browser_window.h4
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc7
-rw-r--r--chrome/browser/ui/input_window_dialog_win.cc12
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc11
-rw-r--r--chrome/browser/ui/panels/panel_browser_view.cc2
-rw-r--r--chrome/browser/ui/touch/tabs/touch_tab_strip.cc2
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc29
-rw-r--r--chrome/browser/ui/views/about_chrome_view.h4
-rw-r--r--chrome/browser/ui/views/about_ipc_dialog.cc4
-rw-r--r--chrome/browser/ui/views/about_ipc_dialog.h5
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views.cc1
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views_unittest.cc29
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc1
-rw-r--r--chrome/browser/ui/views/avatar_menu_button.cc2
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc1
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc8
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc1
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc13
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.h4
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc1
-rw-r--r--chrome/browser/ui/views/browser_bubble.cc4
-rw-r--r--chrome/browser/ui/views/browser_bubble_win.cc2
-rw-r--r--chrome/browser/ui/views/browser_dialogs.h3
-rw-r--r--chrome/browser/ui/views/bubble/bubble.cc3
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc12
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.h10
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.cc10
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.h2
-rw-r--r--chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc1
-rw-r--r--chrome/browser/ui/views/constrained_html_delegate_win.cc4
-rw-r--r--chrome/browser/ui/views/constrained_window_views.cc41
-rw-r--r--chrome/browser/ui/views/constrained_window_views.h23
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc12
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.h1
-rw-r--r--chrome/browser/ui/views/default_search_view.cc4
-rw-r--r--chrome/browser/ui/views/download/download_in_progress_dialog_view.cc4
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.cc6
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.h6
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc2
-rw-r--r--chrome/browser/ui/views/extensions/extension_dialog.cc4
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_dialog_view.cc4
-rw-r--r--chrome/browser/ui/views/extensions/extension_popup.cc4
-rw-r--r--chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc2
-rw-r--r--chrome/browser/ui/views/external_protocol_dialog.cc4
-rw-r--r--chrome/browser/ui/views/file_manager_dialog.cc1
-rw-r--r--chrome/browser/ui/views/first_run_bubble.cc8
-rw-r--r--chrome/browser/ui/views/first_run_search_engine_view.cc7
-rw-r--r--chrome/browser/ui/views/first_run_search_engine_view.h10
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc11
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.cc20
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.h7
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.cc12
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_gtk.h10
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.cc31
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.h12
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc27
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h10
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout.cc1
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/frame/native_browser_frame.h4
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc17
-rw-r--r--chrome/browser/ui/views/frame/popup_non_client_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.cc2
-rw-r--r--chrome/browser/ui/views/generic_info_view_unittest.cc2
-rw-r--r--chrome/browser/ui/views/html_dialog_view.cc21
-rw-r--r--chrome/browser/ui/views/html_dialog_view.h67
-rw-r--r--chrome/browser/ui/views/html_dialog_view_browsertest.cc13
-rw-r--r--chrome/browser/ui/views/hung_renderer_view.cc23
-rw-r--r--chrome/browser/ui/views/importer/import_lock_dialog_view.cc8
-rw-r--r--chrome/browser/ui/views/importer/import_progress_dialog_view.cc10
-rw-r--r--chrome/browser/ui/views/importer/import_progress_dialog_view.h3
-rw-r--r--chrome/browser/ui/views/infobars/after_translate_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/before_translate_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc1
-rw-r--r--chrome/browser/ui/views/instant_confirm_view.cc8
-rw-r--r--chrome/browser/ui/views/js_modal_dialog_views.cc18
-rw-r--r--chrome/browser/ui/views/js_modal_dialog_views.h38
-rw-r--r--chrome/browser/ui/views/keyboard_overlay_dialog_view.cc3
-rw-r--r--chrome/browser/ui/views/keyboard_overlay_dialog_view.h1
-rw-r--r--chrome/browser/ui/views/menu_item_view_test.cc2
-rw-r--r--chrome/browser/ui/views/native_constrained_window_win.cc14
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.cc5
-rw-r--r--chrome/browser/ui/views/profile_menu_button.cc62
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.cc1
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.h1
-rw-r--r--chrome/browser/ui/views/restart_message_box.cc4
-rw-r--r--chrome/browser/ui/views/select_file_dialog.cc1
-rw-r--r--chrome/browser/ui/views/status_bubble_views.cc3
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.cc2
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc1
-rw-r--r--chrome/browser/ui/views/tabs/tab.cc4
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.cc2
-rw-r--r--chrome/browser/ui/views/task_manager_view.cc18
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc1
-rw-r--r--chrome/browser/ui/views/update_recommended_message_box.cc2
-rw-r--r--chrome/browser/ui/views/user_data_dir_dialog.cc3
-rw-r--r--chrome/browser/ui/views/user_data_dir_dialog.h1
-rw-r--r--chrome/browser/ui/views/window.cc8
-rw-r--r--chrome/browser/ui/views/window.h8
-rw-r--r--chrome/browser/ui/views/wrench_menu.cc2
-rw-r--r--chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc4
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.h4
-rw-r--r--chrome/browser/ui/webui/options/personal_options_handler.cc1
-rw-r--r--chrome/test/interactive_ui/view_event_test_base.cc12
-rw-r--r--chrome/test/interactive_ui/view_event_test_base.h16
-rw-r--r--content/browser/tab_contents/constrained_window.h4
-rw-r--r--views/controls/button/button_dropdown.cc1
-rw-r--r--views/controls/button/menu_button.cc1
-rw-r--r--views/controls/combobox/native_combobox_views.cc2
-rw-r--r--views/controls/scrollbar/bitmap_scroll_bar.cc1
-rw-r--r--views/controls/scrollbar/native_scroll_bar_win.cc10
-rw-r--r--views/controls/tabbed_pane/tabbed_pane_unittest.cc11
-rw-r--r--views/controls/table/table_view_unittest.cc24
-rw-r--r--views/controls/textfield/native_textfield_views.cc1
-rw-r--r--views/desktop/desktop_views_delegate.cc17
-rw-r--r--views/desktop/desktop_views_delegate.h6
-rw-r--r--views/desktop/desktop_window.cc40
-rw-r--r--views/desktop/desktop_window.h6
-rw-r--r--views/desktop/desktop_window_root_view.cc4
-rw-r--r--views/desktop/desktop_window_root_view.h2
-rw-r--r--views/examples/examples_main.cc18
-rw-r--r--views/examples/examples_main.h14
-rw-r--r--views/examples/native_window_views_example.cc91
-rw-r--r--views/examples/native_window_views_example.h32
-rw-r--r--views/focus/accelerator_handler_gtk_unittest.cc19
-rw-r--r--views/focus/focus_manager_unittest.cc23
-rw-r--r--views/mouse_watcher.cc2
-rw-r--r--views/test/test_views_delegate.cc4
-rw-r--r--views/test/test_views_delegate.h8
-rw-r--r--views/view.cc1
-rw-r--r--views/view.h1
-rw-r--r--views/view_unittest.cc49
-rw-r--r--views/views.gyp15
-rw-r--r--views/views_delegate.h8
-rw-r--r--views/widget/native_widget.h6
-rw-r--r--views/widget/native_widget_gtk.cc29
-rw-r--r--views/widget/native_widget_gtk.h17
-rw-r--r--views/widget/native_widget_views.cc10
-rw-r--r--views/widget/native_widget_views.h4
-rw-r--r--views/widget/native_widget_win.cc78
-rw-r--r--views/widget/native_widget_win.h21
-rw-r--r--views/widget/native_widget_win_unittest.cc47
-rw-r--r--views/widget/root_view.cc1
-rw-r--r--views/widget/widget.cc48
-rw-r--r--views/widget/widget.h23
-rw-r--r--views/widget/widget_delegate.cc44
-rw-r--r--views/widget/widget_delegate.h35
-rw-r--r--views/window/client_view.cc4
-rw-r--r--views/window/client_view.h1
-rw-r--r--views/window/custom_frame_view.cc6
-rw-r--r--views/window/dialog_client_view.cc4
-rw-r--r--views/window/dialog_client_view.h1
-rw-r--r--views/window/dialog_delegate.cc32
-rw-r--r--views/window/dialog_delegate.h25
-rw-r--r--views/window/native_window.h51
-rw-r--r--views/window/native_window_delegate.h36
-rw-r--r--views/window/native_window_gtk.cc59
-rw-r--r--views/window/native_window_gtk.h44
-rw-r--r--views/window/native_window_views.cc46
-rw-r--r--views/window/native_window_views.h41
-rw-r--r--views/window/native_window_win.cc107
-rw-r--r--views/window/native_window_win.h60
-rw-r--r--views/window/native_window_win_unittest.cc58
-rw-r--r--views/window/non_client_view.cc1
-rw-r--r--views/window/window.cc82
-rw-r--r--views/window/window.h82
-rw-r--r--views/window/window_delegate.cc15
-rw-r--r--views/window/window_delegate.h32
221 files changed, 1038 insertions, 1736 deletions
diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
index eaba29d..a2da782 100644
--- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
+++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
@@ -20,7 +20,7 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/accessibility/native_view_accessibility_win.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -248,12 +248,12 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
TestAboutChromeViewAccObj) {
// Firstly, test that the WindowDelegate got updated.
- views::Window* about_chrome_window =
+ views::Widget* about_chrome_window =
GetBrowserView()->DoShowAboutChromeDialog();
EXPECT_STREQ(
- about_chrome_window->window_delegate()->GetWindowTitle().c_str(),
+ about_chrome_window->widget_delegate()->GetWindowTitle().c_str(),
UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE)).c_str());
- EXPECT_EQ(about_chrome_window->window_delegate()->GetAccessibleWindowRole(),
+ EXPECT_EQ(about_chrome_window->widget_delegate()->GetAccessibleWindowRole(),
ui::AccessibilityTypes::ROLE_DIALOG);
// Also test the accessibility object directly.
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index 365ad54..16538e2 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -26,7 +26,6 @@
#include "ui/base/keycodes/keyboard_codes.h"
#include "views/focus/accelerator_handler.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
// This task just adds another task to the event queue. This is useful if
// you want to ensure that any tasks added to the event queue after this one
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 6e9e102..401eac9 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -30,7 +30,6 @@
#if defined(TOOLKIT_VIEWS) || defined(OS_WIN)
#include "views/focus/focus_manager.h"
#include "views/view.h"
-#include "views/window/window.h"
#endif
#if defined(TOOLKIT_VIEWS)
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index f5d6714..a9ac974 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -42,7 +42,7 @@
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/base/message_box_win.h"
#include "views/focus/accelerator_handler.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -100,8 +100,7 @@ void RecordBrowserStartupTime() {
int AskForUninstallConfirmation() {
int ret = ResultCodes::NORMAL_EXIT;
- views::Window::CreateChromeWindow(NULL, gfx::Rect(),
- new UninstallView(ret))->Show();
+ views::Widget::CreateWindow(new UninstallView(ret))->Show();
views::AcceleratorHandler accelerator_handler;
MessageLoopForUI::current()->Run(&accelerator_handler);
return ret;
diff --git a/chrome/browser/chromeos/choose_mobile_network_dialog.cc b/chrome/browser/chromeos/choose_mobile_network_dialog.cc
index 7bd894f..1d4688a 100644
--- a/chrome/browser/chromeos/choose_mobile_network_dialog.cc
+++ b/chrome/browser/chromeos/choose_mobile_network_dialog.cc
@@ -39,7 +39,7 @@ void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) {
gfx::Rect(),
chromeos::BubbleWindow::STYLE_GENERIC,
html_view);
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
}
ChooseMobileNetworkDialog::ChooseMobileNetworkDialog() {
diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc
index 8ce2264..03cbecc 100644
--- a/chrome/browser/chromeos/external_protocol_dialog.cc
+++ b/chrome/browser/chromeos/external_protocol_dialog.cc
@@ -19,7 +19,7 @@
#include "ui/base/message_box_flags.h"
#include "ui/base/text/text_elider.h"
#include "views/controls/message_box_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -87,6 +87,14 @@ bool ExternalProtocolDialog::IsModal() const {
return false;
}
+const views::Widget* ExternalProtocolDialog::GetWidget() const {
+ return message_box_view_->GetWidget();
+}
+
+views::Widget* ExternalProtocolDialog::GetWidget() {
+ return message_box_view_->GetWidget();
+}
+
///////////////////////////////////////////////////////////////////////////////
// ExternalProtocolDialog, private:
diff --git a/chrome/browser/chromeos/external_protocol_dialog.h b/chrome/browser/chromeos/external_protocol_dialog.h
index c91b58b..8d9d91a 100644
--- a/chrome/browser/chromeos/external_protocol_dialog.h
+++ b/chrome/browser/chromeos/external_protocol_dialog.h
@@ -27,17 +27,19 @@ class ExternalProtocolDialog : public views::DialogDelegate {
virtual ~ExternalProtocolDialog();
// views::DialogDelegate Methods:
- virtual int GetDialogButtons() const;
+ virtual int GetDialogButtons() const OVERRIDE;
virtual std::wstring GetDialogButtonLabel(
- MessageBoxFlags::DialogButton button) const;
- virtual std::wstring GetWindowTitle() const;
- virtual void DeleteDelegate();
- virtual bool Accept();
- virtual views::View* GetContentsView();
-
- // views::WindowDelegate Methods:
- virtual bool IsAlwaysOnTop() const;
- virtual bool IsModal() const;
+ MessageBoxFlags::DialogButton button) const OVERRIDE;
+ virtual std::wstring GetWindowTitle() const OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+ virtual bool Accept() OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+
+ // views::WidgetDelegate Methods:
+ virtual bool IsAlwaysOnTop() const OVERRIDE;
+ virtual bool IsModal() const OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
private:
// The message box view whose commands we handle.
diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
index 876f67f4..7d09f01 100644
--- a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
+++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
@@ -40,11 +40,11 @@ void BrowserFrameChromeos::InitBrowserFrame() {
bool BrowserFrameChromeos::IsMaximized() const {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeosFrame))
- return NativeWindowGtk::IsMaximized();
+ return NativeWidgetGtk::IsMaximized();
bool is_popup_or_panel = browser_view()->IsBrowserTypePopup() ||
browser_view()->IsBrowserTypePanel();
return !IsFullscreen() &&
- (!is_popup_or_panel || NativeWindowGtk::IsMaximized());
+ (!is_popup_or_panel || NativeWidgetGtk::IsMaximized());
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.h b/chrome/browser/chromeos/frame/browser_frame_chromeos.h
index 22f33f2..bb4edbc 100644
--- a/chrome/browser/chromeos/frame/browser_frame_chromeos.h
+++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.h
@@ -18,7 +18,7 @@ class BrowserFrameChromeos : public BrowserFrameGtk {
// BrowserFrameGtk overrides.
virtual void InitBrowserFrame();
- // views::NativeWindowGtk overrides.
+ // views::NativeWidgetGtk overrides.
virtual bool IsMaximized() const;
private:
diff --git a/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc
index 23ce2e8..be4f1b4 100644
--- a/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc
+++ b/chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc
@@ -9,7 +9,6 @@
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
#include "views/window/hit_test.h"
-#include "views/window/window.h"
#include "ui/base/theme_provider.h"
namespace {
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 1677ab1..7596122 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -39,8 +39,8 @@
#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"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc
index ebc0abf..3aa20be 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.cc
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc
@@ -17,9 +17,9 @@
#include "views/controls/button/image_button.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/hit_test.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
#include "third_party/skia/include/core/SkPaint.h"
namespace {
@@ -39,8 +39,8 @@ static const int kTitleFontSizeDelta = 1;
namespace chromeos {
-BubbleFrameView::BubbleFrameView(views::Window* frame,
- views::WindowDelegate* window_delegate,
+BubbleFrameView::BubbleFrameView(views::Widget* frame,
+ views::WidgetDelegate* widget_delegate,
BubbleWindow::Style style)
: frame_(frame),
style_(style),
@@ -49,8 +49,8 @@ BubbleFrameView::BubbleFrameView(views::Window* frame,
throbber_(NULL) {
set_border(new BubbleBorder(BubbleBorder::NONE));
- if (window_delegate->ShouldShowWindowTitle()) {
- title_ = new views::Label(window_delegate->GetWindowTitle());
+ if (widget_delegate->ShouldShowWindowTitle()) {
+ title_ = new views::Label(widget_delegate->GetWindowTitle());
title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta,
gfx::Font::BOLD));
@@ -89,7 +89,7 @@ void BubbleFrameView::StopThrobber() {
DCHECK(throbber_ != NULL);
throbber_->Stop();
if (title_)
- title_->SetText(frame_->window_delegate()->GetWindowTitle());
+ title_->SetText(frame_->widget_delegate()->GetWindowTitle());
}
gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.h b/chrome/browser/chromeos/frame/bubble_frame_view.h
index a85f428..560534e 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.h
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.h
@@ -21,7 +21,7 @@ class Size;
namespace views {
class ImageButton;
class Label;
-class Window;
+class Widget;
}
namespace chromeos {
@@ -30,8 +30,8 @@ namespace chromeos {
class BubbleFrameView : public views::NonClientFrameView,
public views::ButtonListener {
public:
- BubbleFrameView(views::Window* frame,
- views::WindowDelegate* window_delegate,
+ BubbleFrameView(views::Widget* frame,
+ views::WidgetDelegate* widget_delegate,
BubbleWindow::Style style);
virtual ~BubbleFrameView();
@@ -61,7 +61,7 @@ class BubbleFrameView : public views::NonClientFrameView,
private:
// The window that owns this view.
- views::Window* frame_;
+ views::Widget* frame_;
// Allows to tweak appearance of the view.
BubbleWindow::Style style_;
diff --git a/chrome/browser/chromeos/frame/bubble_window.cc b/chrome/browser/chromeos/frame/bubble_window.cc
index 7ab60d5..e06ad11 100644
--- a/chrome/browser/chromeos/frame/bubble_window.cc
+++ b/chrome/browser/chromeos/frame/bubble_window.cc
@@ -30,13 +30,13 @@ namespace chromeos {
// static
const SkColor BubbleWindow::kBackgroundColor = SK_ColorWHITE;
-BubbleWindow::BubbleWindow(views::Window* window, Style style)
- : views::NativeWindowGtk(window),
+BubbleWindow::BubbleWindow(views::Widget* window, Style style)
+ : views::NativeWidgetGtk(window),
style_(style) {
}
void BubbleWindow::InitNativeWidget(const views::Widget::InitParams& params) {
- views::NativeWindowGtk::InitNativeWidget(params);
+ views::NativeWidgetGtk::InitNativeWidget(params);
// Turn on double buffering so that the hosted GtkWidgets does not
// flash as in http://crosbug.com/9065.
@@ -57,14 +57,14 @@ void BubbleWindow::InitNativeWidget(const views::Widget::InitParams& params) {
}
views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() {
- views::Window* window = GetWindow();
- return new BubbleFrameView(window, window->window_delegate(), style_);
+ views::Widget* window = GetWidget();
+ return new BubbleFrameView(window, window->widget_delegate(), style_);
}
void BubbleWindow::TrimMargins(int margin_left, int margin_right,
int margin_top, int margin_bottom,
int border_radius) {
- gfx::Size size = GetWindow()->non_client_view()->GetPreferredSize();
+ gfx::Size size = GetWidget()->non_client_view()->GetPreferredSize();
const int w = size.width() - margin_left - margin_right;
const int h = size.height() - margin_top - margin_bottom;
GdkRectangle rect0 = {0, border_radius, w, h - 2 * border_radius};
@@ -114,22 +114,20 @@ void BubbleWindow::TrimMargins(int margin_left, int margin_right,
gdk_region_destroy(region);
}
-views::Window* BubbleWindow::Create(
+views::Widget* BubbleWindow::Create(
gfx::NativeWindow parent,
const gfx::Rect& bounds,
Style style,
- views::WindowDelegate* window_delegate) {
- views::Window* window = new views::Window;
+ views::WidgetDelegate* widget_delegate) {
+ views::Widget* window = new views::Widget;
BubbleWindow* bubble_window = new BubbleWindow(window, style);
- views::Window::InitParams params(window_delegate);
- params.parent_window = parent;
- params.native_window = bubble_window;
- params.widget_init_params.parent = GTK_WIDGET(parent);
- params.widget_init_params.bounds = bounds;
- params.widget_init_params.parent = GTK_WIDGET(parent);
- params.widget_init_params.native_widget = bubble_window;
- params.widget_init_params.transparent = true;
- window->InitWindow(params);
+ views::Widget::InitParams params;
+ params.delegate = widget_delegate;
+ params.native_widget = bubble_window;
+ params.parent = GTK_WIDGET(parent);
+ params.bounds = bounds;
+ params.transparent = true;
+ window->Init(params);
if (style == STYLE_XSHAPE) {
const int kMarginLeft = 14;
@@ -137,9 +135,8 @@ views::Window* BubbleWindow::Create(
const int kMarginTop = 12;
const int kMarginBottom = 16;
const int kBorderRadius = 8;
- static_cast<BubbleWindow*>(window->native_window())->
- TrimMargins(kMarginLeft, kMarginRight, kMarginTop, kMarginBottom,
- kBorderRadius);
+ bubble_window->TrimMargins(kMarginLeft, kMarginRight, kMarginTop,
+ kMarginBottom, kBorderRadius);
}
return window;
diff --git a/chrome/browser/chromeos/frame/bubble_window.h b/chrome/browser/chromeos/frame/bubble_window.h
index 07fa6a4..5d9f255 100644
--- a/chrome/browser/chromeos/frame/bubble_window.h
+++ b/chrome/browser/chromeos/frame/bubble_window.h
@@ -7,7 +7,7 @@
#pragma once
#include "third_party/skia/include/core/SkColor.h"
-#include "views/window/native_window_gtk.h"
+#include "views/widget/native_widget_gtk.h"
namespace gfx {
class Rect;
@@ -15,13 +15,13 @@ class Rect;
namespace views {
class Throbber;
-class WindowDelegate;
+class WidgetDelegate;
}
namespace chromeos {
// A window that uses BubbleFrameView as its frame.
-class BubbleWindow : public views::NativeWindowGtk {
+class BubbleWindow : public views::NativeWidgetGtk {
public:
enum Style {
STYLE_GENERIC = 0, // Default style.
@@ -30,17 +30,17 @@ class BubbleWindow : public views::NativeWindowGtk {
STYLE_XSHAPE = 1 << 2 // Trim the window margins and round corners.
};
- static views::Window* Create(gfx::NativeWindow parent,
+ static views::Widget* Create(gfx::NativeWindow parent,
const gfx::Rect& bounds,
Style style,
- views::WindowDelegate* window_delegate);
+ views::WidgetDelegate* widget_delegate);
static const SkColor kBackgroundColor;
protected:
- BubbleWindow(views::Window* window, Style style);
+ BubbleWindow(views::Widget* window, Style style);
- // Overidden from views::NativeWindowGtk:
+ // Overridden from views::NativeWidgetGtk:
virtual void InitNativeWidget(
const views::Widget::InitParams& params) OVERRIDE;
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
diff --git a/chrome/browser/chromeos/frame/panel_browser_view.cc b/chrome/browser/chromeos/frame/panel_browser_view.cc
index 022839f..8991305 100644
--- a/chrome/browser/chromeos/frame/panel_browser_view.cc
+++ b/chrome/browser/chromeos/frame/panel_browser_view.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/chromeos/frame/panel_controller.h"
#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc
index 37f07bc..07b93b7 100644
--- a/chrome/browser/chromeos/frame/panel_controller.cc
+++ b/chrome/browser/chromeos/frame/panel_controller.cc
@@ -36,7 +36,6 @@
#include "views/painter.h"
#include "views/view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(TOUCH_UI)
namespace {
diff --git a/chrome/browser/chromeos/google_update_chromeos.cc b/chrome/browser/chromeos/google_update_chromeos.cc
index 4a7b3eb..879b8b8 100644
--- a/chrome/browser/chromeos/google_update_chromeos.cc
+++ b/chrome/browser/chromeos/google_update_chromeos.cc
@@ -13,9 +13,7 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "content/browser/browser_thread.h"
#include "third_party/cros/chromeos_update.h"
-#include "views/window/window.h"
-
-using views::Window;
+#include "views/widget/widget.h"
////////////////////////////////////////////////////////////////////////////////
// GoogleUpdate, public:
@@ -31,7 +29,8 @@ GoogleUpdate::~GoogleUpdate() {
////////////////////////////////////////////////////////////////////////////////
// GoogleUpdate, views::DialogDelegate implementation:
-void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) {
+void GoogleUpdate::CheckForUpdate(bool install_if_newer,
+ views::Widget* window) {
// We need to shunt this request over to InitiateGoogleUpdateCheck and have
// it run in the file thread.
BrowserThread::PostTask(
@@ -45,7 +44,7 @@ void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) {
// GoogleUpdate, private:
bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer,
- Window* window,
+ views::Widget* window,
MessageLoop* main_loop) {
chromeos::UpdateInformation result;
bool success = false;
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc
index 77a77ce..5ebec89 100644
--- a/chrome/browser/chromeos/input_method/candidate_window.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window.cc
@@ -25,8 +25,6 @@
#include "views/screen.h"
#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
namespace {
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc
index 80bd3c7..b2a134d 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -41,7 +41,7 @@
#include "views/controls/button/text_button.h"
#include "views/controls/label.h"
#include "views/screen.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
using views::Widget;
@@ -151,8 +151,8 @@ views::Widget* BackgroundView::CreateWindowContainingView(
return window;
}
-void BackgroundView::CreateModalPopup(views::WindowDelegate* view) {
- views::Window* window = browser::CreateViewsWindow(
+void BackgroundView::CreateModalPopup(views::WidgetDelegate* view) {
+ views::Widget* window = browser::CreateViewsWindow(
GetNativeWindow(), gfx::Rect(), view);
window->SetAlwaysOnTop(true);
window->Show();
diff --git a/chrome/browser/chromeos/login/background_view.h b/chrome/browser/chromeos/login/background_view.h
index 54ba730..4fa4d97 100644
--- a/chrome/browser/chromeos/login/background_view.h
+++ b/chrome/browser/chromeos/login/background_view.h
@@ -18,7 +18,7 @@ namespace views {
class Label;
class TextButton;
class Widget;
-class WindowDelegate;
+class WidgetDelegate;
}
class DOMView;
@@ -69,7 +69,7 @@ class BackgroundView : public views::View,
BackgroundView** view);
// Create a modal popup view.
- void CreateModalPopup(views::WindowDelegate* view);
+ void CreateModalPopup(views::WidgetDelegate* view);
// Overridden from StatusAreaHost:
virtual gfx::NativeWindow GetNativeWindow() const;
diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc
index 977166f..19b4e20 100644
--- a/chrome/browser/chromeos/login/captcha_view.cc
+++ b/chrome/browser/chromeos/login/captcha_view.cc
@@ -22,7 +22,7 @@
#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
using views::Label;
using views::Textfield;
@@ -109,7 +109,7 @@ void CaptchaView::SetCaptchaURL(const GURL& captcha_url) {
}
gfx::Size CaptchaView::GetPreferredSize() {
- gfx::Size size = gfx::Size(views::Window::GetLocalizedContentsSize(
+ gfx::Size size = gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_CAPTCHA_INPUT_DIALOG_WIDTH_CHARS,
IDS_CAPTCHA_INPUT_DIALOG_HEIGHT_LINES));
if (is_standalone_)
diff --git a/chrome/browser/chromeos/login/captcha_view.h b/chrome/browser/chromeos/login/captcha_view.h
index 26fdfb9..764abde 100644
--- a/chrome/browser/chromeos/login/captcha_view.h
+++ b/chrome/browser/chromeos/login/captcha_view.h
@@ -18,14 +18,12 @@ namespace views {
class ImageView;
class TextButton;
class View;
-class Window;
} // namespace views
namespace chromeos {
// A dialog box that shows a CAPTCHA image and allows user to input response.
-class CaptchaView : public views::View,
- public views::DialogDelegate,
+class CaptchaView : public views::DialogDelegateView,
public views::TextfieldController,
public ImageDecoder::Delegate,
public views::ButtonListener {
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index 409ee9f..5b94b31 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -47,7 +47,6 @@
#include "views/layout/layout_constants.h"
#include "views/layout/layout_manager.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
namespace {
@@ -79,8 +78,7 @@ struct FillLayoutWithBorder : public views::LayoutManager {
};
// System security setting dialog.
-class TpmInfoView : public views::View,
- public views::DialogDelegate {
+class TpmInfoView : public views::DialogDelegateView {
public:
explicit TpmInfoView(std::string* password)
: ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)),
@@ -91,7 +89,7 @@ class TpmInfoView : public views::View,
void Init();
protected:
- // views::DialogDelegate overrides:
+ // views::DialogDelegateView overrides:
virtual bool Accept() { return true; }
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView() { return this; }
@@ -106,7 +104,7 @@ class TpmInfoView : public views::View,
}
gfx::Size GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_TPM_INFO_DIALOG_WIDTH_CHARS,
IDS_TPM_INFO_DIALOG_HEIGHT_LINES));
}
@@ -457,7 +455,7 @@ void EulaView::LinkClicked(views::Link* source, int event_flags) {
TpmInfoView* view =
new TpmInfoView(actor_->screen()->GetTpmPasswordStorage());
view->Init();
- views::Window* window = browser::CreateViewsWindow(parent_window,
+ views::Widget* window = browser::CreateViewsWindow(parent_window,
gfx::Rect(),
view);
window->SetAlwaysOnTop(true);
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index cee4db0..36bb99b 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -35,7 +35,7 @@
#include "content/common/notification_type.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace chromeos {
@@ -264,7 +264,7 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
new CaptchaView(failure.error().captcha().image_url, false);
view->Init();
view->set_delegate(this);
- views::Window* window = browser::CreateViewsWindow(
+ views::Widget* window = browser::CreateViewsWindow(
GetNativeWindow(), gfx::Rect(), view);
window->SetAlwaysOnTop(true);
window->Show();
@@ -408,7 +408,7 @@ void ExistingUserController::OnPasswordChangeDetected(
// TODO(gspencer): We shouldn't have to erase stateful data when
// doing this. See http://crosbug.com/9115 http://crosbug.com/7792
PasswordChangedView* view = new PasswordChangedView(this, false);
- views::Window* window = browser::CreateViewsWindow(GetNativeWindow(),
+ views::Widget* window = browser::CreateViewsWindow(GetNativeWindow(),
gfx::Rect(),
view);
window->SetAlwaysOnTop(true);
diff --git a/chrome/browser/chromeos/login/login_html_dialog.cc b/chrome/browser/chromeos/login/login_html_dialog.cc
index b0f4a8e..bfc84fe 100644
--- a/chrome/browser/chromeos/login/login_html_dialog.cc
+++ b/chrome/browser/chromeos/login/login_html_dialog.cc
@@ -13,7 +13,7 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace chromeos {
@@ -52,7 +52,7 @@ void LoginHtmlDialog::Show() {
HtmlDialogView* html_view =
new HtmlDialogView(ProfileManager::GetDefaultProfile(), this);
if (style_ & STYLE_BUBBLE) {
- views::Window* bubble_window = BubbleWindow::Create(
+ views::Widget* bubble_window = BubbleWindow::Create(
parent_window_, gfx::Rect(),
static_cast<BubbleWindow::Style>(
BubbleWindow::STYLE_XBAR | BubbleWindow::STYLE_THROBBER),
@@ -60,7 +60,7 @@ void LoginHtmlDialog::Show() {
bubble_frame_view_ = static_cast<BubbleFrameView*>(
bubble_window->non_client_view()->frame_view());
} else {
- views::Window::CreateChromeWindow(parent_window_, gfx::Rect(), html_view);
+ views::Widget::CreateWindowWithParent(html_view, parent_window_);
}
if (bubble_frame_view_) {
bubble_frame_view_->StartThrobber();
@@ -69,7 +69,7 @@ void LoginHtmlDialog::Show() {
NotificationService::AllSources());
}
html_view->InitDialog();
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
is_open_ = true;
}
diff --git a/chrome/browser/chromeos/login/network_screen.cc b/chrome/browser/chromeos/login/network_screen.cc
index 84946c5..83233ad 100644
--- a/chrome/browser/chromeos/login/network_screen.cc
+++ b/chrome/browser/chromeos/login/network_screen.cc
@@ -21,8 +21,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/menu/menu_2.h"
-#include "views/window/window.h"
-
namespace {
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index 4bc43d1..c59d0a5 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -32,7 +32,6 @@
#include "views/layout/layout_constants.h"
#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
using views::Background;
using views::GridLayout;
diff --git a/chrome/browser/chromeos/login/network_selection_view.h b/chrome/browser/chromeos/login/network_selection_view.h
index 9d41d5c..617fb57 100644
--- a/chrome/browser/chromeos/login/network_selection_view.h
+++ b/chrome/browser/chromeos/login/network_selection_view.h
@@ -14,7 +14,6 @@
#include "chrome/browser/chromeos/views/dropdown_button.h"
#include "views/controls/link_listener.h"
#include "views/view.h"
-#include "views/window/window_delegate.h"
namespace gfx {
class Size;
diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc
index cd88a4e..f2328e2 100644
--- a/chrome/browser/chromeos/login/password_changed_view.cc
+++ b/chrome/browser/chromeos/login/password_changed_view.cc
@@ -18,7 +18,7 @@
#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
using views::Button;
using views::GridLayout;
@@ -75,7 +75,7 @@ std::wstring PasswordChangedView::GetWindowTitle() const {
gfx::Size PasswordChangedView::GetPreferredSize() {
// TODO(nkostylev): Once UI is finalized, create locale settings.
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_PASSWORD_CHANGED_DIALOG_WIDTH_CHARS,
IDS_PASSWORD_CHANGED_DIALOG_HEIGHT_LINES));
}
diff --git a/chrome/browser/chromeos/login/views_login_display.cc b/chrome/browser/chromeos/login/views_login_display.cc
index 11ebef1..398d6e1 100644
--- a/chrome/browser/chromeos/login/views_login_display.cc
+++ b/chrome/browser/chromeos/login/views_login_display.cc
@@ -19,7 +19,7 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h
index f0dabbd..48bc7ac 100644
--- a/chrome/browser/chromeos/login/webui_login_view.h
+++ b/chrome/browser/chromeos/login/webui_login_view.h
@@ -15,11 +15,6 @@ class GURL;
class Profile;
class WebUI;
-namespace views {
-class Widget;
-class WindowDelegate;
-}
-
namespace chromeos {
class StatusAreaView;
diff --git a/chrome/browser/chromeos/native_dialog_window.cc b/chrome/browser/chromeos/native_dialog_window.cc
index 0bdd2e3..48c959d 100644
--- a/chrome/browser/chromeos/native_dialog_window.cc
+++ b/chrome/browser/chromeos/native_dialog_window.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/ui/views/window.h"
#include "ui/base/gtk/gtk_signal.h"
#include "views/controls/native/native_view_host.h"
+#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
namespace {
@@ -50,8 +50,7 @@ GtkWidget* GetDialogDefaultWidget(GtkDialog* dialog) {
namespace chromeos {
-class NativeDialogHost : public views::View,
- public views::DialogDelegate {
+class NativeDialogHost : public views::DialogDelegateView {
public:
NativeDialogHost(gfx::NativeView native_dialog,
int flags,
@@ -143,11 +142,12 @@ void NativeDialogHost::OnCheckResize(GtkWidget* widget) {
CheckSize();
SizeToPreferredSize();
- gfx::Size window_size = window()->non_client_view()->GetPreferredSize();
- gfx::Rect window_bounds = window()->GetWindowScreenBounds();
+ gfx::Size window_size =
+ GetWidget()->non_client_view()->GetPreferredSize();
+ gfx::Rect window_bounds = GetWidget()->GetWindowScreenBounds();
window_bounds.set_width(window_size.width());
window_bounds.set_height(window_size.height());
- window()->SetBoundsConstrained(window_bounds, NULL);
+ GetWidget()->SetBoundsConstrained(window_bounds, NULL);
}
}
}
@@ -155,7 +155,7 @@ void NativeDialogHost::OnCheckResize(GtkWidget* widget) {
void NativeDialogHost::OnDialogDestroy(GtkWidget* widget) {
dialog_ = NULL;
destroy_signal_id_ = 0;
- window()->Close();
+ GetWidget()->Close();
}
///////////////////////////////////////////////////////////////////////////////
@@ -225,7 +225,7 @@ void NativeDialogHost::Init() {
AddChildView(contents_view_);
contents_view_->Attach(contents);
- g_signal_connect(window()->GetNativeWindow(), "check-resize",
+ g_signal_connect(GetWidget()->GetNativeWindow(), "check-resize",
G_CALLBACK(&OnCheckResizeThunk), this);
const int padding = 2 * kDialogPadding;
@@ -272,13 +272,13 @@ void ShowNativeDialog(gfx::NativeWindow parent,
NativeDialogHost* native_dialog_host =
new NativeDialogHost(native_dialog, flags, size, min_size);
browser::CreateViewsWindow(parent, gfx::Rect(), native_dialog_host);
- native_dialog_host->window()->Show();
+ native_dialog_host->GetWidget()->Show();
}
gfx::NativeWindow GetNativeDialogWindow(gfx::NativeView native_dialog) {
NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>(
g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost));
- return host ? host->window()->GetNativeWindow() : NULL;
+ return host ? host->GetWidget()->GetNativeWindow() : NULL;
}
gfx::Rect GetNativeDialogContentsBounds(gfx::NativeView native_dialog) {
diff --git a/chrome/browser/chromeos/network_login_observer.cc b/chrome/browser/chromeos/network_login_observer.cc
index ef9d36d..7e27d00 100644
--- a/chrome/browser/chromeos/network_login_observer.cc
+++ b/chrome/browser/chromeos/network_login_observer.cc
@@ -13,8 +13,8 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/window.h"
-#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
namespace chromeos {
@@ -26,13 +26,13 @@ NetworkLoginObserver::~NetworkLoginObserver() {
CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this);
}
-void NetworkLoginObserver::CreateModalPopup(views::WindowDelegate* view) {
+void NetworkLoginObserver::CreateModalPopup(views::WidgetDelegate* view) {
Browser* browser = BrowserList::GetLastActive();
if (browser && !browser->is_type_tabbed()) {
browser = BrowserList::FindTabbedBrowser(browser->profile(), true);
}
if (browser) {
- views::Window* window = browser::CreateViewsWindow(
+ views::Widget* window = browser::CreateViewsWindow(
browser->window()->GetNativeHandle(), gfx::Rect(), view);
window->SetAlwaysOnTop(true);
window->Show();
diff --git a/chrome/browser/chromeos/network_login_observer.h b/chrome/browser/chromeos/network_login_observer.h
index 5057211..d91f1eb 100644
--- a/chrome/browser/chromeos/network_login_observer.h
+++ b/chrome/browser/chromeos/network_login_observer.h
@@ -13,7 +13,7 @@
#include "chrome/browser/chromeos/cros/network_library.h"
namespace views {
-class WindowDelegate;
+class WidgetDelegate;
}
namespace chromeos {
@@ -27,7 +27,7 @@ class NetworkLoginObserver : public NetworkLibrary::NetworkManagerObserver {
typedef std::map<std::string, bool> NetworkFailureMap;
private:
- void CreateModalPopup(views::WindowDelegate* view);
+ void CreateModalPopup(views::WidgetDelegate* view);
// NetworkLibrary::NetworkManagerObserver implementation.
virtual void OnNetworkManagerChanged(NetworkLibrary* obj);
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index 1163d23..7a4dd05 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -20,7 +20,6 @@
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace chromeos {
@@ -132,16 +131,16 @@ void NetworkConfigView::ShowAdvancedView() {
child_config_view_ = new WifiConfigView(this, true /* show_8021x */);
AddChildView(child_config_view_);
// Resize the window to be able to hold the new widgets.
- gfx::Size size = views::Window::GetLocalizedContentsSize(
+ gfx::Size size = views::Widget::GetLocalizedContentsSize(
IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_WIDTH_CHARS,
IDS_JOIN_WIFI_NETWORK_DIALOG_ADVANCED_MINIMUM_HEIGHT_LINES);
// Get the new bounds with desired size at the same center point.
- gfx::Rect bounds = window()->GetWindowScreenBounds();
+ gfx::Rect bounds = GetWidget()->GetWindowScreenBounds();
int horiz_padding = bounds.width() - size.width();
int vert_padding = bounds.height() - size.height();
bounds.Inset(horiz_padding / 2, vert_padding / 2,
horiz_padding / 2, vert_padding / 2);
- window()->SetBoundsConstrained(bounds, NULL);
+ GetWidget()->SetBoundsConstrained(bounds, NULL);
Layout();
child_config_view_->InitFocus();
}
@@ -151,7 +150,7 @@ void NetworkConfigView::Layout() {
}
gfx::Size NetworkConfigView::GetPreferredSize() {
- gfx::Size result(views::Window::GetLocalizedContentsSize(
+ gfx::Size result(views::Widget::GetLocalizedContentsSize(
IDS_JOIN_WIFI_NETWORK_DIALOG_WIDTH_CHARS,
IDS_JOIN_WIFI_NETWORK_DIALOG_MINIMUM_HEIGHT_LINES));
gfx::Size size = child_config_view_->GetPreferredSize();
diff --git a/chrome/browser/chromeos/options/network_config_view.h b/chrome/browser/chromeos/options/network_config_view.h
index 706d3cc..89f3c3a 100644
--- a/chrome/browser/chromeos/options/network_config_view.h
+++ b/chrome/browser/chromeos/options/network_config_view.h
@@ -14,7 +14,6 @@
namespace views {
class NativeButton;
class View;
-class Window;
}
namespace chromeos {
@@ -22,8 +21,7 @@ namespace chromeos {
class ChildNetworkConfigView;
// A dialog box for showing a password textfield.
-class NetworkConfigView : public views::View,
- public views::DialogDelegate,
+class NetworkConfigView : public views::DialogDelegateView,
public views::ButtonListener {
public:
class Delegate {
@@ -56,7 +54,7 @@ class NetworkConfigView : public views::View,
virtual bool Accept() OVERRIDE;
virtual views::View* GetExtraView() OVERRIDE;
- // views::WindowDelegate method.
+ // views::WidgetDelegate methods.
virtual bool IsModal() const OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
virtual std::wstring GetWindowTitle() const OVERRIDE;
diff --git a/chrome/browser/chromeos/options/take_photo_dialog.h b/chrome/browser/chromeos/options/take_photo_dialog.h
index 3734cfa..0bf1fbc 100644
--- a/chrome/browser/chromeos/options/take_photo_dialog.h
+++ b/chrome/browser/chromeos/options/take_photo_dialog.h
@@ -15,7 +15,6 @@
namespace views {
class View;
-class Window;
}
namespace chromeos {
diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc
index 77faee5..a11e98d 100644
--- a/chrome/browser/chromeos/options/vpn_config_view.cc
+++ b/chrome/browser/chromeos/options/vpn_config_view.cc
@@ -22,7 +22,6 @@
#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index 4eeea16..9fe3c6ccb3 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -21,7 +21,6 @@
#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/sim_dialog_delegate.cc b/chrome/browser/chromeos/sim_dialog_delegate.cc
index b9ea14e..81000d6 100644
--- a/chrome/browser/chromeos/sim_dialog_delegate.cc
+++ b/chrome/browser/chromeos/sim_dialog_delegate.cc
@@ -58,7 +58,7 @@ void SimDialogDelegate::ShowDialog(gfx::NativeWindow owning_window,
gfx::Rect(),
chromeos::BubbleWindow::STYLE_GENERIC,
html_view);
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
}
SimDialogDelegate::SimDialogDelegate(SimDialogMode dialog_mode)
diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc
index 062c0d3..d8cc2b1 100644
--- a/chrome/browser/chromeos/status/clock_menu_button.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button.cc
@@ -20,7 +20,6 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#include "unicode/datefmt.h"
namespace {
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc
index 097ebef..3fc9cff 100644
--- a/chrome/browser/chromeos/status/input_method_menu.cc
+++ b/chrome/browser/chromeos/status/input_method_menu.cc
@@ -26,7 +26,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/menu/menu_model_adapter.h"
#include "views/controls/menu/submenu_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
// The language menu consists of 3 parts (in this order):
//
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.cc b/chrome/browser/chromeos/status/input_method_menu_button.cc
index 1d617e3..c9502f5 100644
--- a/chrome/browser/chromeos/status/input_method_menu_button.cc
+++ b/chrome/browser/chromeos/status/input_method_menu_button.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index 1ee483e..ccf0f20 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -13,7 +13,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
-#include "views/window/window.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index a0b150a..cdbc0db 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -29,7 +29,7 @@
#include "ui/gfx/skbitmap_operations.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/submenu_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -510,7 +510,7 @@ void NetworkMenuModel::ActivatedAt(int index) {
// Meanwhile, if MenuUI::IsEnabled() is true, always show the settings UI,
// otherwise show NetworkConfigView only to get passwords when not connected.
void NetworkMenuModel::ShowNetworkConfigView(NetworkConfigView* view) const {
- views::Window* window = browser::CreateViewsWindow(
+ views::Widget* window = browser::CreateViewsWindow(
owner_->GetNativeWindow(), gfx::Rect(), view);
window->SetAlwaysOnTop(true);
window->Show();
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index c5daf56..2cdbf74 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -29,7 +29,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc
index b233e06..1e9bbda 100644
--- a/chrome/browser/chromeos/status/power_menu_button.cc
+++ b/chrome/browser/chromeos/status/power_menu_button.cc
@@ -15,7 +15,7 @@
#include "ui/gfx/canvas.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/submenu_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index a625405..c738c55 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -54,7 +54,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/view_prop.h"
#include "views/layout/grid_layout.h"
-#include "views/window/window.h"
using ui::ViewProp;
@@ -953,15 +952,6 @@ bool ExternalTabContainer::DrawInfoBarArrows(int* x) const {
return false;
}
-// ExternalTabContainer instances do not have a window.
-views::Window* ExternalTabContainer::GetContainingWindow() {
- return NULL;
-}
-
-const views::Window* ExternalTabContainer::GetContainingWindow() const {
- return NULL;
-}
-
bool ExternalTabContainer::AcceleratorPressed(
const views::Accelerator& accelerator) {
std::map<views::Accelerator, int>::const_iterator iter =
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 1aa89be..6b33a1b 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -197,10 +197,6 @@ class ExternalTabContainer : public TabContentsDelegate,
// Returns NULL if we fail to find the cookie in the map.
static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie);
- // Overridden from views::NativeWidgetWin:
- virtual views::Window* GetContainingWindow() OVERRIDE;
- virtual const views::Window* GetContainingWindow() const OVERRIDE;
-
// Handles the specified |accelerator| being pressed.
bool AcceleratorPressed(const views::Accelerator& accelerator);
diff --git a/chrome/browser/google/google_update.cc b/chrome/browser/google/google_update.cc
index 06d6591..097b18f 100644
--- a/chrome/browser/google/google_update.cc
+++ b/chrome/browser/google/google_update.cc
@@ -22,9 +22,7 @@
#include "chrome/installer/util/install_util.h"
#include "content/browser/browser_thread.h"
#include "google_update_idl_i.c"
-#include "views/window/window.h"
-
-using views::Window;
+#include "views/widget/widget.h"
namespace {
@@ -251,7 +249,8 @@ GoogleUpdate::~GoogleUpdate() {
////////////////////////////////////////////////////////////////////////////////
// GoogleUpdate, views::DialogDelegate implementation:
-void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) {
+void GoogleUpdate::CheckForUpdate(bool install_if_newer,
+ views::Widget* window) {
// We need to shunt this request over to InitiateGoogleUpdateCheck and have
// it run in the file thread.
BrowserThread::PostTask(
@@ -265,7 +264,7 @@ void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) {
// GoogleUpdate, private:
bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer,
- Window* window,
+ views::Widget* window,
MessageLoop* main_loop) {
FilePath chrome_exe_path;
if (!PathService::Get(base::DIR_EXE, &chrome_exe_path)) {
diff --git a/chrome/browser/google/google_update.h b/chrome/browser/google/google_update.h
index dcc68f0..293f2ca 100644
--- a/chrome/browser/google/google_update.h
+++ b/chrome/browser/google/google_update.h
@@ -16,7 +16,7 @@
class MessageLoop;
namespace views {
-class Window;
+class Widget;
}
// The status of the upgrade. UPGRADE_STARTED and UPGRADE_CHECK_STARTED are
@@ -94,7 +94,7 @@ class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> {
// |window| should point to a foreground window. This is needed to ensure
// that Vista/Windows 7 UAC prompts show up in the foreground. It may also
// be null.
- void CheckForUpdate(bool install_if_newer, views::Window* window);
+ void CheckForUpdate(bool install_if_newer, views::Widget* window);
// Pass NULL to clear the listener
void set_status_listener(GoogleUpdateStatusListener* listener) {
@@ -123,7 +123,7 @@ class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> {
// to the message loop that we want the response to come from.
// |window| should point to a foreground window. This is needed to ensure that
// Vista/Windows 7 UAC prompts show up in the foreground. It may also be null.
- bool InitiateGoogleUpdateCheck(bool install_if_newer, views::Window* window,
+ bool InitiateGoogleUpdateCheck(bool install_if_newer, views::Widget* window,
MessageLoop* main_loop);
// This function reports the results of the GoogleUpdate operation to the
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 74c67a3..e72fc97 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -34,10 +34,6 @@ namespace gfx {
class Rect;
}
-namespace views {
-class Window;
-}
-
class Extension;
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index c07fb15..05c3136 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -44,7 +44,6 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/frame/browser_view.h"
#include "chrome/browser/chromeos/native_dialog_window.h"
-#include "views/window/window.h"
#else
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#endif
@@ -1082,9 +1081,9 @@ void ShowDialogWithLocalizedSize(GtkWidget* dialog,
int height_id,
bool resizeable) {
int width = (width_id == -1) ? 0 :
- views::Window::GetLocalizedContentsWidth(width_id);
+ views::Widget::GetLocalizedContentsWidth(width_id);
int height = (height_id == -1) ? 0 :
- views::Window::GetLocalizedContentsHeight(height_id);
+ views::Widget::GetLocalizedContentsHeight(height_id);
chromeos::ShowNativeDialog(GetDialogTransientParent(GTK_WINDOW(dialog)),
dialog,
@@ -1097,7 +1096,7 @@ void ShowDialogWithLocalizedSize(GtkWidget* dialog,
void ShowDialogWithMinLocalizedWidth(GtkWidget* dialog,
int width_id) {
int width = (width_id == -1) ? 0 :
- views::Window::GetLocalizedContentsWidth(width_id);
+ views::Widget::GetLocalizedContentsWidth(width_id);
chromeos::ShowNativeDialog(GetDialogTransientParent(GTK_WINDOW(dialog)),
dialog,
diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc
index 7012d10..58bbd08 100644
--- a/chrome/browser/ui/input_window_dialog_win.cc
+++ b/chrome/browser/ui/input_window_dialog_win.cc
@@ -13,14 +13,18 @@
#include "views/controls/textfield/textfield_controller.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
+#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
// Width to make the text field, in pixels.
static const int kTextfieldWidth = 200;
class ContentView;
+namespace views {
+class Widget;
+}
+
// The Windows implementation of the cross platform input dialog interface.
class WinInputWindowDialog : public InputWindowDialog {
public:
@@ -42,7 +46,7 @@ class WinInputWindowDialog : public InputWindowDialog {
private:
// Our chrome views window.
- views::Window* window_;
+ views::Widget* window_;
// Strings to feed to the on screen window.
std::wstring window_title_;
@@ -207,8 +211,8 @@ WinInputWindowDialog::WinInputWindowDialog(HWND parent,
label_(label),
contents_(contents),
delegate_(delegate) {
- window_ = views::Window::CreateChromeWindow(parent, gfx::Rect(),
- new ContentView(this));
+ window_ = views::Widget::CreateWindowWithParent(new ContentView(this),
+ parent);
window_->client_view()->AsDialogClientView()->UpdateDialogButtons();
}
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index c2ff574..fb1796f 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -28,7 +28,7 @@
#include "views/controls/menu/menu_2.h"
#include "views/painter.h"
#include "views/screen.h"
-#include "views/window/window.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/window_shape.h"
#if !defined(OS_WIN)
@@ -200,7 +200,7 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame,
title_icon_(NULL),
title_label_(NULL) {
EnsureResourcesInitialized();
- frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
+ frame_->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
settings_button_ = new views::MenuButton(NULL, std::wstring(), this, false);
settings_button_->SetIcon(*(settings_button_resources.normal_image));
@@ -291,7 +291,7 @@ int PanelBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
int window_component = GetHTComponentForFrame(point,
NonClientBorderThickness(), NonClientBorderThickness(),
0, 0,
- frame_->window_delegate()->CanResize());
+ frame_->widget_delegate()->CanResize());
// Fall back to the caption if no other component matches.
return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
}
@@ -494,7 +494,7 @@ bool PanelBrowserFrameView::ShouldTabIconViewAnimate() const {
}
SkBitmap PanelBrowserFrameView::GetFaviconForTabIconView() {
- return frame_->window_delegate()->GetWindowIcon();
+ return frame_->widget_delegate()->GetWindowIcon();
}
void PanelBrowserFrameView::ExtensionDialogAccepted() {
@@ -626,8 +626,7 @@ void PanelBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) {
}
void PanelBrowserFrameView::UpdateTitleBar() {
- title_label_->SetText(
- frame_->window_delegate()->GetWindowTitle());
+ title_label_->SetText(frame_->widget_delegate()->GetWindowTitle());
}
void PanelBrowserFrameView::OnActivationChanged(bool active) {
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index 39e58cd..9da81a6 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -12,7 +12,7 @@
#include "grit/chromium_strings.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/base/l10n/l10n_util.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
// This value is experimental and subjective.
diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc
index e2cc8bc..fa8490d 100644
--- a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc
+++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc
@@ -12,8 +12,8 @@
#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
#include "ui/gfx/canvas_skia.h"
#include "views/metrics.h"
+#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
static const int kTouchTabStripHeight = 64;
static const int kTouchTabWidth = 64;
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 352c3d1..6765a73 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -41,7 +41,6 @@
#include "views/layout/layout_constants.h"
#include "views/view_text_utils.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#include "webkit/glue/webkit_glue.h"
#if defined(OS_WIN)
@@ -82,17 +81,15 @@ std::wstring StringSubRange(const std::wstring& text, size_t start,
namespace browser {
- // Declared in browser_dialogs.h so that others don't
- // need to depend on our .h.
- views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
- Profile* profile) {
- views::Window* about_chrome_window =
- browser::CreateViewsWindow(parent,
- gfx::Rect(),
- new AboutChromeView(profile));
+// Declared in browser_dialogs.h so that others don't
+// need to depend on our .h.
+views::Widget* ShowAboutChromeView(gfx::NativeWindow parent, Profile* profile) {
+ views::Widget* about_chrome_window =
+ browser::CreateViewsWindow(parent, gfx::Rect(),
+ new AboutChromeView(profile));
about_chrome_window->Show();
- return about_chrome_window;
- }
+ return about_chrome_window;
+}
} // namespace browser
@@ -278,7 +275,7 @@ void AboutChromeView::Init() {
main_label_chunk2_ + open_source_url_->GetText() +
main_label_chunk3_;
- dialog_dimensions_ = views::Window::GetLocalizedContentsSize(
+ dialog_dimensions_ = views::Widget::GetLocalizedContentsSize(
IDS_ABOUT_DIALOG_WIDTH_CHARS,
IDS_ABOUT_DIALOG_MINIMUM_HEIGHT_LINES);
@@ -530,7 +527,7 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add,
!base::win::UserAccountControlIsEnabled())) {
UpdateStatus(UPGRADE_CHECK_STARTED, GOOGLE_UPDATE_NO_ERROR);
// CheckForUpdate(false, ...) means don't upgrade yet.
- google_updater_->CheckForUpdate(false, window());
+ google_updater_->CheckForUpdate(false, GetWidget());
}
#endif
} else {
@@ -698,7 +695,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
google_updater_->set_status_listener(this);
UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR);
// CheckForUpdate(true,...) means perform upgrade if new version found.
- google_updater_->CheckForUpdate(true, window());
+ google_updater_->CheckForUpdate(true, GetWidget());
// TODO(seanparent): Need to see if this code needs to change to
// force a machine restart.
return;
@@ -784,8 +781,8 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
parent()->Layout();
// Check button may have appeared/disappeared. We cannot call this during
- // ViewHierarchyChanged because the |window()| pointer hasn't been set yet.
- if (window())
+ // ViewHierarchyChanged because the view hasn't been added to a Widget yet.
+ if (GetWidget())
GetDialogClientView()->UpdateDialogButtons();
}
diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h
index 35c02ec..d3d2417 100644
--- a/chrome/browser/ui/views/about_chrome_view.h
+++ b/chrome/browser/ui/views/about_chrome_view.h
@@ -21,7 +21,6 @@
namespace views {
class Textfield;
class Throbber;
-class Window;
}
class Profile;
@@ -33,8 +32,7 @@ class Profile;
// and check for updates.
//
////////////////////////////////////////////////////////////////////////////////
-class AboutChromeView : public views::View,
- public views::DialogDelegate,
+class AboutChromeView : public views::DialogDelegateView,
public views::LinkListener
#if defined(OS_WIN)
, public GoogleUpdateStatusListener
diff --git a/chrome/browser/ui/views/about_ipc_dialog.cc b/chrome/browser/ui/views/about_ipc_dialog.cc
index fbb6e29..266a989 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/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
@@ -214,8 +213,7 @@ AboutIPCDialog::~AboutIPCDialog() {
void AboutIPCDialog::RunDialog() {
if (!g_active_dialog) {
g_active_dialog = new AboutIPCDialog;
- views::Window::CreateChromeWindow(NULL, gfx::Rect(),
- g_active_dialog)->Show();
+ views::Widget::CreateWindow(g_active_dialog)->Show();
} else {
// TODO(brettw) it would be nice to focus the existing window.
}
diff --git a/chrome/browser/ui/views/about_ipc_dialog.h b/chrome/browser/ui/views/about_ipc_dialog.h
index a243aac..482df2e 100644
--- a/chrome/browser/ui/views/about_ipc_dialog.h
+++ b/chrome/browser/ui/views/about_ipc_dialog.h
@@ -26,10 +26,9 @@ class NativeViewHost;
class TextButton;
} // namespace views
-class AboutIPCDialog : public views::DialogDelegate,
+class AboutIPCDialog : public views::DialogDelegateView,
public views::ButtonListener,
- public IPC::Logging::Consumer,
- public views::View {
+ public IPC::Logging::Consumer {
public:
// This dialog is a singleton. If the dialog is already opened, it won't do
// anything, so you can just blindly call this function all you want.
diff --git a/chrome/browser/ui/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc
index 84ecf45..0c85ff9 100644
--- a/chrome/browser/ui/views/accessibility_event_router_views.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views.cc
@@ -28,7 +28,6 @@
#include "views/view.h"
#include "views/widget/native_widget.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using views::FocusManager;
diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
index 3ca6466..3f1223d 100644
--- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
@@ -19,8 +19,7 @@
#include "views/widget/native_widget.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
#if defined(TOOLKIT_VIEWS)
@@ -31,17 +30,17 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate {
// Overridden from views::ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const { return NULL; }
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) {
}
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const {
return false;
}
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const {
return false;
@@ -72,14 +71,18 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate {
DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate);
};
-class AccessibilityWindowDelegate : public views::WindowDelegate {
+class AccessibilityWindowDelegate : public views::WidgetDelegate {
public:
explicit AccessibilityWindowDelegate(views::View* contents)
: contents_(contents) { }
- virtual void DeleteDelegate() { delete this; }
-
- virtual views::View* GetContentsView() { return contents_; }
+ // Overridden from views::WidgetDelegate:
+ virtual void DeleteDelegate() OVERRIDE { delete this; }
+ virtual views::View* GetContentsView() OVERRIDE { return contents_; }
+ virtual const views::Widget* GetWidget() const OVERRIDE {
+ return contents_->GetWidget();
+ }
+ virtual views::Widget* GetWidget() OVERRIDE { return contents_->GetWidget(); }
private:
views::View* contents_;
@@ -101,10 +104,10 @@ class AccessibilityEventRouterViewsTest
delete window_delegate_;
}
- views::Window* CreateWindowWithContents(views::View* contents) {
+ views::Widget* CreateWindowWithContents(views::View* contents) {
window_delegate_ = new AccessibilityWindowDelegate(contents);
- return views::Window::CreateChromeWindow(
- NULL, gfx::Rect(0, 0, 500, 500), window_delegate_);
+ return views::Widget::CreateWindowWithBounds(window_delegate_,
+ gfx::Rect(0, 0, 500, 500));
}
protected:
@@ -145,7 +148,7 @@ TEST_F(AccessibilityEventRouterViewsTest, TestFocusNotification) {
contents->AddChildView(button3);
// Put the view in a window.
- views::Window* window = CreateWindowWithContents(contents);
+ views::Widget* window = CreateWindowWithContents(contents);
// Set focus to the first button initially.
button1->RequestFocus();
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 510faf2..13a73fb 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -31,7 +31,6 @@
#include "views/layout/layout_constants.h"
#include "views/painter.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include <commctrl.h>
diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc
index c94fab0..4e81a81 100644
--- a/chrome/browser/ui/views/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/avatar_menu_button.cc
@@ -6,7 +6,7 @@
#include "ui/gfx/canvas_skia.h"
#include "views/controls/menu/menu_model_adapter.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
// Menu should display below the image on the frame. This
// offset size depends on whether the frame is in glass or opaque mode.
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 301109e..ddc2e9e 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -58,7 +58,6 @@
#include "views/view_constants.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using views::CustomButton;
using views::DropTargetEvent;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index 54c3277..fc01da5 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -27,7 +27,7 @@
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/submenu_view.h"
#include "views/views_delegate.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_LINUX)
// See http://crbug.com/40040 for details.
@@ -66,16 +66,16 @@ class ViewsDelegateImpl : public views::ViewsDelegate {
public:
ViewsDelegateImpl() {}
virtual ui::Clipboard* GetClipboard() const { return NULL; }
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) {}
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const {
return false;
}
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const {
return false;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
index 736a2f1..6260f17 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -33,7 +33,6 @@
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/client_view.h"
-#include "views/window/window.h"
using views::ColumnSet;
using views::GridLayout;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
index 6fd396b..6198ab8 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
@@ -30,7 +30,6 @@
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using views::Button;
using views::ColumnSet;
@@ -152,7 +151,7 @@ gfx::Size BookmarkEditorView::GetPreferredSize() {
if (!show_tree_)
return views::View::GetPreferredSize();
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_EDITBOOKMARK_DIALOG_WIDTH_CHARS,
IDS_EDITBOOKMARK_DIALOG_HEIGHT_LINES));
}
@@ -224,11 +223,11 @@ void BookmarkEditorView::ExecuteCommand(int command_id) {
}
void BookmarkEditorView::Show(HWND parent_hwnd) {
- views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this);
+ views::Widget::CreateWindowWithParent(this, parent_hwnd);
UserInputChanged();
if (show_tree_ && bb_model_->IsLoaded())
ExpandAndSelect();
- window()->Show();
+ GetWidget()->Show();
// Select all the text in the name Textfield.
title_tf_.SelectAll();
// Give focus to the name Textfield.
@@ -236,8 +235,8 @@ void BookmarkEditorView::Show(HWND parent_hwnd) {
}
void BookmarkEditorView::Close() {
- DCHECK(window());
- window()->Close();
+ DCHECK(GetWidget());
+ GetWidget()->Close();
}
void BookmarkEditorView::ShowContextMenuForView(View* source,
@@ -391,7 +390,7 @@ void BookmarkEditorView::BookmarkNodeRemoved(BookmarkModel* model,
details_.existing_node->HasAncestor(node)) ||
(parent_ && parent_->HasAncestor(node))) {
// The node, or its parent was removed. Close the dialog.
- window()->Close();
+ GetWidget()->Close();
} else {
Reset();
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
index 69b4a8a..c73b52d 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
@@ -22,7 +22,6 @@ namespace views {
class Label;
class Menu2;
class NativeButton;
-class Window;
}
class BookmarkEditorViewTest;
@@ -41,10 +40,9 @@ class Profile;
// To use BookmarkEditorView invoke the static show method.
class BookmarkEditorView : public BookmarkEditor,
- public views::View,
public views::ButtonListener,
public views::TreeViewController,
- public views::DialogDelegate,
+ public views::DialogDelegateView,
public views::TextfieldController,
public views::ContextMenuController,
public ui::SimpleMenuModel::Delegate,
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index 21f7864..f7649f7 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -46,7 +46,6 @@
#include "views/controls/menu/menu_model_adapter.h"
#include "views/drag_utils.h"
#include "views/metrics.h"
-#include "views/window/window.h"
// Horizontal spacing between most items in the container, as well as after the
// last item or chevron (if visible).
diff --git a/chrome/browser/ui/views/browser_bubble.cc b/chrome/browser/ui/views/browser_bubble.cc
index c960bdd..6dcd658 100644
--- a/chrome/browser/ui/views/browser_bubble.cc
+++ b/chrome/browser/ui/views/browser_bubble.cc
@@ -8,7 +8,7 @@
#if defined(OS_WIN)
#include "chrome/browser/external_tab_container_win.h"
#endif
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -17,7 +17,7 @@ BrowserBubbleHost* GetBubbleHostFromFrame(views::Widget* frame) {
return NULL;
BrowserBubbleHost* bubble_host = NULL;
- views::Window* window = frame->GetContainingWindow();
+ views::Widget* window = frame->GetTopLevelWidget();
if (window) {
bubble_host = BrowserView::GetBrowserViewForNativeWindow(
window->GetNativeWindow());
diff --git a/chrome/browser/ui/views/browser_bubble_win.cc b/chrome/browser/ui/views/browser_bubble_win.cc
index 3696019..e53b7aa 100644
--- a/chrome/browser/ui/views/browser_bubble_win.cc
+++ b/chrome/browser/ui/views/browser_bubble_win.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "views/widget/root_view.h"
#include "views/widget/native_widget_win.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
class BubbleWidget : public views::NativeWidgetWin {
public:
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h
index 21dda5c..a9575e53 100644
--- a/chrome/browser/ui/views/browser_dialogs.h
+++ b/chrome/browser/ui/views/browser_dialogs.h
@@ -35,7 +35,6 @@ class Size;
namespace views {
class Widget;
-class Window;
}
namespace browser {
@@ -51,7 +50,7 @@ void HideBookmarkBubbleView();
bool IsBookmarkBubbleViewShowing();
// Shows the about dialog. See AboutChromeView.
-views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
+views::Widget* ShowAboutChromeView(gfx::NativeWindow parent,
Profile* profile);
// Creates and returns a find bar for the given browser window. See FindBarWin.
diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc
index 5fa32e7..477e96b 100644
--- a/chrome/browser/ui/views/bubble/bubble.cc
+++ b/chrome/browser/ui/views/bubble/bubble.cc
@@ -14,7 +14,6 @@
#include "views/layout/fill_layout.h"
#include "views/widget/widget.h"
#include "views/window/client_view.h"
-#include "views/window/window.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
@@ -173,7 +172,7 @@ void Bubble::InitBubble(views::Widget* parent,
// Create the main window.
#if defined(OS_WIN)
- views::Window* parent_window = parent->GetContainingWindow();
+ views::Widget* parent_window = parent->GetTopLevelWidget();
if (parent_window)
parent_window->DisableInactiveRendering();
set_window_style(WS_POPUP | WS_CLIPCHILDREN);
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index a72e548..fef4e22 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -19,7 +19,6 @@
#include "ui/gfx/rect.h"
#include "views/widget/native_widget.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "chrome/browser/app_icon_win.h"
@@ -33,10 +32,9 @@ namespace {
// been initialized.
// TODO(mirandac): This function will also separate windows by profile in a
// multi-profile environment.
-PrefService* GetPrefsForWindow(views::Window* window) {
+PrefService* GetPrefsForWindow(const views::Widget* window) {
Profile* profile = reinterpret_cast<Profile*>(
- window->AsWidget()->native_widget()->GetNativeWindowProperty(
- Profile::kProfileKey));
+ window->native_widget()->GetNativeWindowProperty(Profile::kProfileKey));
if (!profile) {
// Use local state for windows that have no explicit profile.
return g_browser_process->local_state();
@@ -53,7 +51,7 @@ ui::Clipboard* ChromeViewsDelegate::GetClipboard() const {
return g_browser_process->clipboard();
}
-void ChromeViewsDelegate::SaveWindowPlacement(views::Window* window,
+void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) {
@@ -80,7 +78,7 @@ void ChromeViewsDelegate::SaveWindowPlacement(views::Window* window,
window_preferences->SetInteger("work_area_bottom", work_area.bottom());
}
-bool ChromeViewsDelegate::GetSavedWindowBounds(views::Window* window,
+bool ChromeViewsDelegate::GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const {
PrefService* prefs = GetPrefsForWindow(window);
@@ -102,7 +100,7 @@ bool ChromeViewsDelegate::GetSavedWindowBounds(views::Window* window,
}
bool ChromeViewsDelegate::GetSavedMaximizedState(
- views::Window* window,
+ const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const {
PrefService* prefs = GetPrefsForWindow(window);
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h
index 8f8e67c..210ee06 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.h
+++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -12,10 +12,6 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "views/views_delegate.h"
-namespace views {
-class Window;
-}
-
class ChromeViewsDelegate : public views::ViewsDelegate {
public:
ChromeViewsDelegate() {}
@@ -23,14 +19,14 @@ class ChromeViewsDelegate : public views::ViewsDelegate {
// Overridden from views::ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const OVERRIDE;
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) OVERRIDE;
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const OVERRIDE;
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const OVERRIDE;
virtual void NotifyAccessibilityEvent(
diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index 1b23611c..5d2cda8 100644
--- a/chrome/browser/ui/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
@@ -27,7 +27,7 @@
#include "views/layout/box_layout.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace browser {
@@ -387,6 +387,14 @@ views::View* CollectedCookiesWin::GetContentsView() {
return this;
}
+views::Widget* CollectedCookiesWin::GetWidget() {
+ return View::GetWidget();
+}
+
+const views::Widget* CollectedCookiesWin::GetWidget() const {
+ return View::GetWidget();
+}
+
///////////////////////////////////////////////////////////////////////////////
// views::ButtonListener implementation.
diff --git a/chrome/browser/ui/views/collected_cookies_win.h b/chrome/browser/ui/views/collected_cookies_win.h
index b05f8d6..329638d 100644
--- a/chrome/browser/ui/views/collected_cookies_win.h
+++ b/chrome/browser/ui/views/collected_cookies_win.h
@@ -51,6 +51,8 @@ class CollectedCookiesWin : public ConstrainedDialogDelegate,
virtual void DeleteDelegate() OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc
index dd9fd3b..2dbac47 100644
--- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc
+++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc
@@ -39,7 +39,6 @@
#include "views/controls/button/image_button.h"
#include "views/controls/native/native_view_host.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/ui/views/constrained_html_delegate_win.cc b/chrome/browser/ui/views/constrained_html_delegate_win.cc
index 0f4ab34..33d532e 100644
--- a/chrome/browser/ui/views/constrained_html_delegate_win.cc
+++ b/chrome/browser/ui/views/constrained_html_delegate_win.cc
@@ -11,7 +11,7 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "ui/gfx/rect.h"
#include "views/view.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
class ConstrainedHtmlDelegateWin : public TabContentsContainer,
public ConstrainedHtmlUIDelegate,
@@ -26,7 +26,7 @@ class ConstrainedHtmlDelegateWin : public TabContentsContainer,
virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate();
virtual void OnDialogClose();
- // ConstrainedWindowDelegate (aka views::WindowDelegate) interface.
+ // ConstrainedWindowDelegate (aka views::WidgetDelegate) interface.
virtual bool CanResize() const { return true; }
virtual views::View* GetContentsView() {
return this;
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index e6fb0bd..5679c37 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -28,16 +28,14 @@
#include "ui/gfx/rect.h"
#include "views/controls/button/image_button.h"
#include "views/focus/focus_manager.h"
+#include "views/widget/widget.h"
#include "views/window/client_view.h"
-#include "views/window/native_window.h"
#include "views/window/non_client_view.h"
#include "views/window/window_resources.h"
#include "views/window/window_shape.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "views/widget/native_widget_win.h"
-#include "views/window/native_window_win.h"
#endif
using base::TimeDelta;
@@ -274,7 +272,7 @@ ConstrainedWindowFrameView::ConstrainedWindowFrameView(
// Constrained windows always use the custom frame - they just have a
// different set of bitmaps.
- container->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
+ container->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -335,7 +333,7 @@ int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) {
int window_component = GetHTComponentForFrame(point, kFrameBorderThickness,
NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize,
- container_->window_delegate()->CanResize());
+ container_->widget_delegate()->CanResize());
// Fall back to the caption if no other component matches.
return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
}
@@ -490,7 +488,7 @@ void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas* canvas) {
void ConstrainedWindowFrameView::PaintTitleBar(gfx::Canvas* canvas) {
canvas->DrawStringInt(
- container_->window_delegate()->GetWindowTitle(),
+ container_->widget_delegate()->GetWindowTitle(),
*title_font_, GetTitleColor(), GetMirroredXForRect(title_bounds_),
title_bounds_.y(), title_bounds_.width(), title_bounds_.height());
}
@@ -556,7 +554,7 @@ void ConstrainedWindowFrameView::InitClass() {
static bool initialized = false;
if (!initialized) {
#if defined(OS_WIN)
- title_font_ = new gfx::Font(views::NativeWindowWin::GetWindowTitleFont());
+ title_font_ = new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont());
#endif
initialized = true;
}
@@ -567,17 +565,16 @@ void ConstrainedWindowFrameView::InitClass() {
ConstrainedWindowViews::ConstrainedWindowViews(
TabContents* owner,
- views::WindowDelegate* window_delegate)
+ views::WidgetDelegate* widget_delegate)
: owner_(owner),
ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_(
NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) {
- views::Window::InitParams params(window_delegate);
- params.native_window = native_constrained_window_->AsNativeWindow();
- params.widget_init_params.child = true;
- params.widget_init_params.parent = owner->GetNativeView();
- params.widget_init_params.native_widget =
- native_constrained_window_->AsNativeWindow()->AsNativeWidget();
- InitWindow(params);
+ views::Widget::InitParams params;
+ params.delegate = widget_delegate;
+ params.child = true;
+ params.parent = owner->GetNativeView();
+ params.native_widget = native_constrained_window_->AsNativeWidget();
+ Init(params);
}
ConstrainedWindowViews::~ConstrainedWindowViews() {
@@ -609,9 +606,9 @@ void ConstrainedWindowViews::CloseConstrainedWindow() {
void ConstrainedWindowViews::FocusConstrainedWindow() {
if ((!owner_->delegate() ||
owner_->delegate()->ShouldFocusConstrainedWindow()) &&
- window_delegate() &&
- window_delegate()->GetInitiallyFocusedView()) {
- window_delegate()->GetInitiallyFocusedView()->RequestFocus();
+ widget_delegate() &&
+ widget_delegate()->GetInitiallyFocusedView()) {
+ widget_delegate()->GetInitiallyFocusedView()->RequestFocus();
}
}
@@ -635,8 +632,8 @@ void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() {
Activate();
}
-views::internal::NativeWindowDelegate*
- ConstrainedWindowViews::AsNativeWindowDelegate() {
+views::internal::NativeWidgetDelegate*
+ ConstrainedWindowViews::AsNativeWidgetDelegate() {
return this;
}
@@ -647,6 +644,6 @@ views::internal::NativeWindowDelegate*
// static
ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog(
TabContents* parent,
- views::WindowDelegate* window_delegate) {
- return new ConstrainedWindowViews(parent, window_delegate);
+ views::WidgetDelegate* widget_delegate) {
+ return new ConstrainedWindowViews(parent, widget_delegate);
}
diff --git a/chrome/browser/ui/views/constrained_window_views.h b/chrome/browser/ui/views/constrained_window_views.h
index 14a93c2..15a69c0 100644
--- a/chrome/browser/ui/views/constrained_window_views.h
+++ b/chrome/browser/ui/views/constrained_window_views.h
@@ -10,19 +10,18 @@
#include "content/browser/tab_contents/constrained_window.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
class ConstrainedTabContentsWindowDelegate;
class ConstrainedWindowAnimation;
class ConstrainedWindowFrameView;
namespace views {
namespace internal {
-class NativeWindowDelegate;
+class NativeWidgetDelegate;
}
-class NativeWindow;
+class NativeWidget;
class NonClientFrameView;
-class Window;
-class WindowDelegate;
+class WidgetDelegate;
}
class NativeConstrainedWindowDelegate {
@@ -36,7 +35,7 @@ class NativeConstrainedWindowDelegate {
// Called when the NativeConstrainedWindow is clicked on when inactive.
virtual void OnNativeConstrainedWindowMouseActivate() = 0;
- virtual views::internal::NativeWindowDelegate* AsNativeWindowDelegate() = 0;
+ virtual views::internal::NativeWidgetDelegate* AsNativeWidgetDelegate() = 0;
};
class NativeConstrainedWindow {
@@ -47,7 +46,7 @@ class NativeConstrainedWindow {
static NativeConstrainedWindow* CreateNativeConstrainedWindow(
NativeConstrainedWindowDelegate* delegate);
- virtual views::NativeWindow* AsNativeWindow() = 0;
+ virtual views::NativeWidget* AsNativeWidget() = 0;
};
///////////////////////////////////////////////////////////////////////////////
@@ -56,12 +55,12 @@ class NativeConstrainedWindow {
// A ConstrainedWindow implementation that implements a Constrained Window as
// a child HWND with a custom window frame.
//
-class ConstrainedWindowViews : public views::Window,
+class ConstrainedWindowViews : public views::Widget,
public ConstrainedWindow,
public NativeConstrainedWindowDelegate {
public:
ConstrainedWindowViews(TabContents* owner,
- views::WindowDelegate* window_delegate);
+ views::WidgetDelegate* widget_delegate);
virtual ~ConstrainedWindowViews();
// Returns the TabContents that constrains this Constrained Window.
@@ -73,14 +72,14 @@ class ConstrainedWindowViews : public views::Window,
virtual void FocusConstrainedWindow() OVERRIDE;
private:
- // Overridden from views::Window:
+ // Overridden from views::Widget:
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
// Overridden from NativeConstrainedWindowDelegate:
virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE;
virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE;
- virtual views::internal::NativeWindowDelegate*
- AsNativeWindowDelegate() OVERRIDE;
+ virtual views::internal::NativeWidgetDelegate*
+ AsNativeWidgetDelegate() OVERRIDE;
// The TabContents that owns and constrains this ConstrainedWindow.
TabContents* owner_;
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index bcc4af4..022b7d6 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -36,7 +36,7 @@
#include "views/controls/label.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -198,15 +198,17 @@ namespace browser {
void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window,
TabContentsWrapper* tab_contents) {
- views::Window::CreateChromeWindow(parent_window, gfx::Rect(),
- new CreateUrlApplicationShortcutView(tab_contents))->Show();
+ views::Widget::CreateWindowWithParent(
+ new CreateUrlApplicationShortcutView(tab_contents),
+ parent_window)->Show();
}
void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window,
Profile* profile,
const Extension* app) {
- views::Window::CreateChromeWindow(parent_window, gfx::Rect(),
- new CreateChromeApplicationShortcutView(profile, app))->Show();
+ views::Widget::CreateWindowWithParent(
+ new CreateChromeApplicationShortcutView(profile, app),
+ parent_window)->Show();
}
} // namespace browser
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h
index 5f4efae..2117116 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.h
+++ b/chrome/browser/ui/views/create_application_shortcut_view.h
@@ -18,7 +18,6 @@
namespace views {
class Checkbox;
class Label;
-class Window;
}; // namespace views
class Extension;
diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc
index 1e0d72c..12da394 100644
--- a/chrome/browser/ui/views/default_search_view.cc
+++ b/chrome/browser/ui/views/default_search_view.cc
@@ -25,7 +25,7 @@
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/dialog_client_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -226,7 +226,7 @@ void DefaultSearchView::SetupControls(PrefService* prefs) {
layout->AddColumnSet(kWholeDialogViewSetId);
whole_dialog_column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING,
1, GridLayout::FIXED,
- views::Window::GetLocalizedContentsWidth(
+ views::Widget::GetLocalizedContentsWidth(
IDS_DEFAULT_SEARCH_WIDTH_CHARS),
0);
diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
index 722f10f..47045a8 100644
--- a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
+++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
@@ -18,7 +18,7 @@
#include "views/border.h"
#include "views/controls/label.h"
#include "views/layout/grid_layout.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
DownloadInProgressDialogView::DownloadInProgressDialogView(Browser* browser)
: browser_(browser),
@@ -79,7 +79,7 @@ DownloadInProgressDialogView::DownloadInProgressDialogView(Browser* browser)
layout->StartRow(0, columnset_id);
layout->AddView(explanation_);
- dialog_dimensions_ = views::Window::GetLocalizedContentsSize(
+ dialog_dimensions_ = views::Widget::GetLocalizedContentsSize(
IDS_DOWNLOAD_IN_PROGRESS_WIDTH_CHARS,
IDS_DOWNLOAD_IN_PROGRESS_MINIMUM_HEIGHT_LINES);
const int height =
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc
index a727fdb..767593e 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.cc
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc
@@ -21,7 +21,7 @@
#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
using views::GridLayout;
using views::ImageView;
@@ -66,8 +66,8 @@ void EditSearchEngineDialog::Show(gfx::NativeWindow parent,
new EditSearchEngineDialog(template_url, delegate, profile);
// Window interprets an empty rectangle as needing to query the content for
// the size as well as centering relative to the parent.
- views::Window::CreateChromeWindow(parent, gfx::Rect(), contents);
- contents->window()->Show();
+ views::Widget::CreateWindowWithParent(contents, parent);
+ contents->GetWidget()->Show();
contents->GetDialogClientView()->UpdateDialogButtons();
contents->title_tf_->SelectAll();
contents->title_tf_->RequestFocus();
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.h b/chrome/browser/ui/views/edit_search_engine_dialog.h
index 9d7ffcc..b944fac 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.h
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.h
@@ -19,7 +19,6 @@
namespace views {
class Label;
class ImageView;
-class Window;
}
class EditSearchEngineController;
@@ -28,9 +27,8 @@ class Profile;
class TemplateURL;
class TemplateURLService;
-class EditSearchEngineDialog : public views::View,
- public views::TextfieldController,
- public views::DialogDelegate {
+class EditSearchEngineDialog : public views::TextfieldController,
+ public views::DialogDelegateView {
public:
// The |template_url| and/or |delegate| may be NULL.
EditSearchEngineDialog(const TemplateURL* template_url,
diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
index dbdf75e..0ed6a2f 100644
--- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc
@@ -16,7 +16,7 @@
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
#include "views/controls/menu/submenu_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
BrowserActionOverflowMenuController::BrowserActionOverflowMenuController(
BrowserActionsContainer* owner,
diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc
index 50ac515..4455ec0 100644
--- a/chrome/browser/ui/views/extensions/extension_dialog.cc
+++ b/chrome/browser/ui/views/extensions/extension_dialog.cc
@@ -19,7 +19,7 @@
#include "content/common/notification_type.h"
#include "googleurl/src/gurl.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
@@ -101,7 +101,7 @@ void ExtensionDialog::Show(bool activate) {
return;
#if defined(OS_WIN)
- frame_->GetContainingWindow()->DisableInactiveRendering();
+ frame_->GetTopLevelWidget()->DisableInactiveRendering();
#endif
BrowserBubble::Show(activate);
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index 27a52e2..99f4e7e 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -18,8 +18,8 @@
#include "views/controls/label.h"
#include "views/layout/layout_constants.h"
#include "views/view.h"
+#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
namespace {
@@ -338,7 +338,7 @@ void ShowExtensionInstallDialog(
ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView(
delegate, extension, icon, permissions, type);
- views::Window* window = browser::CreateViewsWindow(
+ views::Widget* window = browser::CreateViewsWindow(
browser_window->GetNativeHandle(), gfx::Rect(), dialog);
window->Show();
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
index 121f0b7..4007371 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -21,7 +21,7 @@
#include "content/common/notification_source.h"
#include "content/common/notification_type.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
@@ -77,7 +77,7 @@ void ExtensionPopup::Show(bool activate) {
return;
#if defined(OS_WIN)
- frame_->GetContainingWindow()->DisableInactiveRendering();
+ frame_->GetTopLevelWidget()->DisableInactiveRendering();
#endif
ResizeToView();
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
index 1e6af5d..74fdd9e 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -18,8 +18,8 @@
#include "views/controls/label.h"
#include "views/layout/layout_constants.h"
#include "views/view.h"
+#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc
index 3a9b63f..99e5ece 100644
--- a/chrome/browser/ui/views/external_protocol_dialog.cc
+++ b/chrome/browser/ui/views/external_protocol_dialog.cc
@@ -19,7 +19,7 @@
#include "ui/base/message_box_flags.h"
#include "ui/base/text/text_elider.h"
#include "views/controls/message_box_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -157,7 +157,7 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents,
root_hwnd = NULL;
}
- views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show();
+ views::Widget::CreateWindowWithParent(this, root_hwnd)->Show();
}
// static
diff --git a/chrome/browser/ui/views/file_manager_dialog.cc b/chrome/browser/ui/views/file_manager_dialog.cc
index d2da11e..543d347 100644
--- a/chrome/browser/ui/views/file_manager_dialog.cc
+++ b/chrome/browser/ui/views/file_manager_dialog.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/views/window.h"
#include "content/browser/browser_thread.h"
#include "content/browser/tab_contents/tab_contents.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc
index d1965de..7708120 100644
--- a/chrome/browser/ui/views/first_run_bubble.cc
+++ b/chrome/browser/ui/views/first_run_bubble.cc
@@ -25,7 +25,7 @@
#include "views/focus/focus_manager.h"
#include "views/layout/layout_constants.h"
#include "views/widget/native_widget_win.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -201,7 +201,7 @@ void FirstRunBubbleView::Layout() {
}
gfx::Size FirstRunBubbleView::GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_FIRSTRUNBUBBLE_DIALOG_WIDTH_CHARS,
IDS_FIRSTRUNBUBBLE_DIALOG_HEIGHT_LINES));
}
@@ -453,7 +453,7 @@ void FirstRunMinimalBubbleView::Layout() {
}
gfx::Size FirstRunMinimalBubbleView::GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_FIRSTRUN_MINIMAL_BUBBLE_DIALOG_WIDTH_CHARS,
IDS_FIRSTRUN_MINIMAL_BUBBLE_DIALOG_HEIGHT_LINES));
}
@@ -517,7 +517,7 @@ void FirstRunBubble::EnableParent() {
views::NativeWidget* parent =
views::NativeWidget::GetNativeWidgetForNativeView(GetParent());
if (parent)
- parent->GetWidget()->GetContainingWindow()->DisableInactiveRendering();
+ parent->GetWidget()->GetTopLevelWidget()->DisableInactiveRendering();
// Reactivate the FirstRunBubble so it responds to OnActivate messages.
SetWindowPos(GetParent(), 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW);
diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc
index f554420..98ce3b4 100644
--- a/chrome/browser/ui/views/first_run_search_engine_view.cc
+++ b/chrome/browser/ui/views/first_run_search_engine_view.cc
@@ -37,7 +37,6 @@
#include "views/layout/layout_constants.h"
#include "views/view_text_utils.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
@@ -64,9 +63,7 @@ void ShowFirstRunDialog(Profile* profile,
return;
}
- views::Window* window = views::Window::CreateChromeWindow(
- NULL,
- gfx::Rect(),
+ views::Widget* window = views::Widget::CreateWindow(
new FirstRunSearchEngineView(
profile, randomize_search_engine_experiment));
DCHECK(window);
@@ -301,7 +298,7 @@ void FirstRunSearchEngineView::OnTemplateURLServiceChanged() {
}
gfx::Size FirstRunSearchEngineView::GetPreferredSize() {
- return views::Window::GetLocalizedContentsSize(
+ return views::Widget::GetLocalizedContentsSize(
IDS_FIRSTRUN_SEARCH_ENGINE_SELECTION_WIDTH_CHARS,
IDS_FIRSTRUN_SEARCH_ENGINE_SELECTION_HEIGHT_LINES);
}
diff --git a/chrome/browser/ui/views/first_run_search_engine_view.h b/chrome/browser/ui/views/first_run_search_engine_view.h
index 95252ff..d689f7f 100644
--- a/chrome/browser/ui/views/first_run_search_engine_view.h
+++ b/chrome/browser/ui/views/first_run_search_engine_view.h
@@ -12,14 +12,13 @@
#include "ui/gfx/size.h"
#include "views/controls/button/native_button.h"
#include "views/view.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
namespace views {
class ButtonListener;
class ImageView;
class Label;
class Separator;
-class Window;
}
class Profile;
@@ -77,9 +76,8 @@ class SearchEngineChoice : public views::NativeButton {
// This class displays a large search engine choice dialog view during
// initial first run import.
class FirstRunSearchEngineView
- : public views::View,
- public views::ButtonListener,
- public views::WindowDelegate,
+ : public views::ButtonListener,
+ public views::WidgetDelegateView,
public TemplateURLServiceObserver {
public:
// |profile| allows us to get the set of imported search engines.
@@ -96,7 +94,7 @@ class FirstRunSearchEngineView
virtual void Layout() OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- // Overridden from views::WindowDelegate:
+ // Overridden from views::WidgetDelegate:
virtual std::wstring GetWindowTitle() const OVERRIDE;
views::View* GetContentsView() OVERRIDE { return this; }
bool CanResize() const OVERRIDE{ return false; }
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
index 68816a2..a5ed604 100644
--- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
@@ -19,7 +19,8 @@
#include "ui/gfx/font.h"
#include "ui/gfx/path.h"
#include "views/controls/button/image_button.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/window_resources.h"
#if !defined(OS_WIN)
@@ -65,7 +66,7 @@ AppPanelBrowserFrameView::AppPanelBrowserFrameView(BrowserFrame* frame,
DCHECK(browser_view->ShouldShowWindowIcon());
DCHECK(browser_view->ShouldShowWindowTitle());
- frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
+ frame_->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -164,7 +165,7 @@ int AppPanelBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
int window_component = GetHTComponentForFrame(point,
NonClientBorderThickness(), NonClientBorderThickness(),
kResizeAreaCornerSize, kResizeAreaCornerSize,
- frame_->window_delegate()->CanResize());
+ frame_->widget_delegate()->CanResize());
// Fall back to the caption if no other component matches.
return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
}
@@ -248,7 +249,7 @@ bool AppPanelBrowserFrameView::ShouldTabIconViewAnimate() const {
}
SkBitmap AppPanelBrowserFrameView::GetFaviconForTabIconView() {
- return frame_->window_delegate()->GetWindowIcon();
+ return frame_->widget_delegate()->GetWindowIcon();
}
///////////////////////////////////////////////////////////////////////////////
@@ -399,7 +400,7 @@ void AppPanelBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
void AppPanelBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) {
// The window icon is painted by the TabIconView.
- views::WindowDelegate* d = frame_->window_delegate();
+ views::WidgetDelegate* d = frame_->widget_delegate();
canvas->DrawStringInt(d->GetWindowTitle(), BrowserFrame::GetTitleFont(),
SK_ColorBLACK, GetMirroredXForRect(title_bounds_), title_bounds_.y(),
title_bounds_.width(), title_bounds_.height());
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 1302436..6a4a5d1 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -15,9 +15,6 @@
#include "chrome/common/chrome_switches.h"
#include "ui/base/theme_provider.h"
#include "views/widget/native_widget.h"
-#include "views/widget/widget.h"
-#include "views/window/native_window.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
@@ -41,11 +38,10 @@ BrowserFrame::~BrowserFrame() {
void BrowserFrame::InitBrowserFrame() {
native_browser_frame_ =
NativeBrowserFrame::CreateNativeBrowserFrame(this, browser_view_);
- views::Window::InitParams params(browser_view_);
- params.native_window = native_browser_frame_->AsNativeWindow();
- params.widget_init_params.native_widget =
- params.native_window->AsNativeWidget();
- InitWindow(params);
+ views::Widget::InitParams params;
+ params.delegate = browser_view_;
+ params.native_widget = native_browser_frame_->AsNativeWidget();
+ Init(params);
#if defined(OS_CHROMEOS)
// On ChromeOS we always want top-level windows to appear active.
if (!browser_view_->IsBrowserTypePopup())
@@ -89,10 +85,10 @@ bool BrowserFrame::IsMaximized() const {
#if defined(OS_CHROMEOS)
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeosFrame)) {
return !IsFullscreen() &&
- (!browser_view_->IsBrowserTypePopup() || Window::IsMaximized());
+ (!browser_view_->IsBrowserTypePopup() || Widget::IsMaximized());
}
#endif
- return Window::IsMaximized();
+ return Widget::IsMaximized();
}
views::internal::RootView* BrowserFrame::CreateRootView() {
@@ -128,12 +124,12 @@ void BrowserFrame::OnNativeWidgetActivationChanged(bool active) {
if (active) {
// When running under remote desktop, if the remote desktop client is not
// active on the users desktop, then none of the windows contained in the
- // remote desktop will be activated. However, NativeWindowWin::Activate()
+ // remote desktop will be activated. However, NativeWidgetWin::Activate()
// will still bring this browser window to the foreground. We explicitly
// set ourselves as the last active browser window to ensure that we get
// treated as such by the rest of Chrome.
BrowserList::SetLastActive(browser_view_->browser());
}
- Window::OnNativeWidgetActivationChanged(active);
+ Widget::OnNativeWidgetActivationChanged(active);
}
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h
index 2c5dc35..4fc1661 100644
--- a/chrome/browser/ui/views/frame/browser_frame.h
+++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "chrome/browser/ui/views/frame/native_browser_frame_delegate.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
class AeroGlassNonClientView;
class BrowserNonClientFrameView;
@@ -31,11 +31,10 @@ class ThemeProvider;
namespace views {
class View;
-class Window;
}
// This is a virtual interface that allows system specific browser frames.
-class BrowserFrame : public views::Window {
+class BrowserFrame : public views::Widget {
public:
explicit BrowserFrame(BrowserView* browser_view);
virtual ~BrowserFrame();
@@ -68,7 +67,7 @@ class BrowserFrame : public views::Window {
// its frame treatment if necessary.
void TabStripDisplayModeChanged();
- // Overridden from views::Window:
+ // Overridden from views::Widget:
virtual bool IsMaximized() const OVERRIDE;
virtual views::internal::RootView* CreateRootView() OVERRIDE;
virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
index f996f2c..5513a98 100644
--- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc
@@ -24,7 +24,7 @@ const gfx::Font& BrowserFrame::GetTitleFont() {
BrowserFrameGtk::BrowserFrameGtk(BrowserFrame* browser_frame,
BrowserView* browser_view)
- : views::NativeWindowGtk(browser_frame),
+ : views::NativeWidgetGtk(browser_frame),
browser_view_(browser_view) {
// Don't focus anything on creation, selecting a tab will set the focus.
set_focus_on_creation(false);
@@ -36,11 +36,11 @@ BrowserFrameGtk::~BrowserFrameGtk() {
////////////////////////////////////////////////////////////////////////////////
// BrowserFrameGtk, NativeBrowserFrame implementation:
-views::NativeWindow* BrowserFrameGtk::AsNativeWindow() {
+views::NativeWidget* BrowserFrameGtk::AsNativeWidget() {
return this;
}
-const views::NativeWindow* BrowserFrameGtk::AsNativeWindow() const {
+const views::NativeWidget* BrowserFrameGtk::AsNativeWidget() const {
return this;
}
@@ -58,12 +58,12 @@ void BrowserFrameGtk::TabStripDisplayModeChanged() {
}
////////////////////////////////////////////////////////////////////////////////
-// BrowserFrameGtk, NativeWindowGtk overrides:
+// BrowserFrameGtk, NativeWidgetGtk overrides:
gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget,
GdkEventWindowState* event) {
bool was_full_screen = IsFullscreen();
- gboolean result = views::NativeWindowGtk::OnWindowStateEvent(widget, event);
+ gboolean result = views::NativeWidgetGtk::OnWindowStateEvent(widget, event);
if ((!IsVisible() || IsMinimized()) && browser_view_->GetStatusBubble()) {
// The window is effectively hidden. We have to hide the status bubble as
// unlike windows gtk has no notion of child windows that are hidden along
@@ -78,7 +78,7 @@ gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget,
gboolean BrowserFrameGtk::OnConfigureEvent(GtkWidget* widget,
GdkEventConfigure* event) {
browser_view_->WindowMoved();
- return views::NativeWindowGtk::OnConfigureEvent(widget, event);
+ return views::NativeWidgetGtk::OnConfigureEvent(widget, event);
}
diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.h b/chrome/browser/ui/views/frame/browser_frame_gtk.h
index d1c2014..59e6c49 100644
--- a/chrome/browser/ui/views/frame/browser_frame_gtk.h
+++ b/chrome/browser/ui/views/frame/browser_frame_gtk.h
@@ -9,12 +9,12 @@
#include "base/basictypes.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/native_browser_frame.h"
-#include "views/window/native_window_gtk.h"
+#include "views/widget/native_widget_gtk.h"
class BrowserNonClientFrameView;
class BrowserRootView;
-class BrowserFrameGtk : public views::NativeWindowGtk,
+class BrowserFrameGtk : public views::NativeWidgetGtk,
public NativeBrowserFrame {
public:
// Normally you will create this class by calling BrowserFrame::Create.
@@ -24,12 +24,12 @@ class BrowserFrameGtk : public views::NativeWindowGtk,
protected:
// Overridden from NativeBrowserFrame:
- virtual views::NativeWindow* AsNativeWindow() OVERRIDE;
- virtual const views::NativeWindow* AsNativeWindow() const OVERRIDE;
+ virtual views::NativeWidget* AsNativeWidget() OVERRIDE;
+ virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE;
virtual int GetMinimizeButtonOffset() const OVERRIDE;
virtual void TabStripDisplayModeChanged() OVERRIDE;
- // Overridden from views::NativeWindowGtk:
+ // Overridden from views::NativeWidgetGtk:
virtual gboolean OnWindowStateEvent(GtkWidget* widget,
GdkEventWindowState* event) OVERRIDE;
virtual gboolean OnConfigureEvent(GtkWidget* widget,
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index cfba2d1..1d2d4f5 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
@@ -16,8 +16,9 @@
#include "ui/base/theme_provider.h"
#include "ui/gfx/font.h"
#include "views/screen.h"
+#include "views/widget/native_widget_win.h"
+#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
// static
static const int kClientEdgeThickness = 3;
@@ -33,7 +34,7 @@ static int explicit_show_state = -1;
BrowserFrameWin::BrowserFrameWin(BrowserFrame* browser_frame,
BrowserView* browser_view)
- : views::NativeWindowWin(browser_frame),
+ : views::NativeWidgetWin(browser_frame),
browser_view_(browser_view),
browser_frame_(browser_frame) {
// Don't focus anything on creation, selecting a tab will set the focus.
@@ -49,7 +50,7 @@ void BrowserFrameWin::SetShowState(int state) {
}
///////////////////////////////////////////////////////////////////////////////
-// BrowserFrameWin, views::NativeWindowWin overrides:
+// BrowserFrameWin, views::NativeWidgetWin overrides:
int BrowserFrameWin::GetShowState() const {
if (explicit_show_state != -1)
@@ -65,9 +66,9 @@ int BrowserFrameWin::GetShowState() const {
gfx::Insets BrowserFrameWin::GetClientAreaInsets() const {
// Use the default client insets for an opaque frame or a glass popup/app
// frame.
- if (!GetWindow()->ShouldUseNativeFrame() ||
+ if (!GetWidget()->ShouldUseNativeFrame() ||
!browser_view_->IsBrowserTypeNormal()) {
- return NativeWindowWin::GetClientAreaInsets();
+ return NativeWidgetWin::GetClientAreaInsets();
}
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
@@ -84,7 +85,7 @@ void BrowserFrameWin::UpdateFrameAfterFrameChange() {
// We need to update the glass region on or off before the base class adjusts
// the window region.
UpdateDWMFrame();
- NativeWindowWin::UpdateFrameAfterFrameChange();
+ NativeWidgetWin::UpdateFrameAfterFrameChange();
}
void BrowserFrameWin::OnEndSession(BOOL ending, UINT logoff) {
@@ -97,7 +98,7 @@ void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position,
}
void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) {
- NativeWindowWin::OnWindowPosChanged(window_pos);
+ NativeWidgetWin::OnWindowPosChanged(window_pos);
UpdateDWMFrame();
// Windows lies to us about the position of the minimize button before a
@@ -110,14 +111,14 @@ void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) {
// SWP_SHOWWINDOW, however callers typically are careful about not specifying
// this flag unless necessary to avoid flicker.
if (window_pos->flags & SWP_SHOWWINDOW) {
- GetWindow()->non_client_view()->Layout();
- GetWindow()->non_client_view()->SchedulePaint();
+ GetWidget()->non_client_view()->Layout();
+ GetWidget()->non_client_view()->SchedulePaint();
}
}
void BrowserFrameWin::OnScreenReaderDetected() {
BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected();
- NativeWindowWin::OnScreenReaderDetected();
+ NativeWidgetWin::OnScreenReaderDetected();
}
bool BrowserFrameWin::ShouldUseNativeFrame() const {
@@ -129,7 +130,7 @@ bool BrowserFrameWin::ShouldUseNativeFrame() const {
// theme is active for normal browser windows, we don't want to use the custom
// frame for popups/apps.
if (!browser_view_->IsBrowserTypeNormal() &&
- NativeWindowWin::ShouldUseNativeFrame()) {
+ NativeWidgetWin::ShouldUseNativeFrame()) {
return true;
}
@@ -141,11 +142,11 @@ bool BrowserFrameWin::ShouldUseNativeFrame() const {
////////////////////////////////////////////////////////////////////////////////
// BrowserFrameWin, NativeBrowserFrame implementation:
-views::NativeWindow* BrowserFrameWin::AsNativeWindow() {
+views::NativeWidget* BrowserFrameWin::AsNativeWidget() {
return this;
}
-const views::NativeWindow* BrowserFrameWin::AsNativeWindow() const {
+const views::NativeWidget* BrowserFrameWin::AsNativeWidget() const {
return this;
}
@@ -170,7 +171,7 @@ void BrowserFrameWin::TabStripDisplayModeChanged() {
void BrowserFrameWin::UpdateDWMFrame() {
// Nothing to do yet, or we're not showing a DWM frame.
- if (!GetWindow()->client_view() || !browser_frame_->ShouldUseNativeFrame())
+ if (!GetWidget()->client_view() || !browser_frame_->ShouldUseNativeFrame())
return;
MARGINS margins = { 0 };
@@ -204,7 +205,7 @@ void BrowserFrameWin::UpdateDWMFrame() {
// static
const gfx::Font& BrowserFrame::GetTitleFont() {
static gfx::Font* title_font =
- new gfx::Font(views::NativeWindowWin::GetWindowTitleFont());
+ new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont());
return *title_font;
}
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.h b/chrome/browser/ui/views/frame/browser_frame_win.h
index 56391aeb..b0365c0 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.h
+++ b/chrome/browser/ui/views/frame/browser_frame_win.h
@@ -9,17 +9,17 @@
#include "base/basictypes.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/native_browser_frame.h"
-#include "views/window/native_window_win.h"
+#include "views/widget/native_widget_win.h"
class BrowserView;
////////////////////////////////////////////////////////////////////////////////
// BrowserFrameWin
//
-// BrowserFrame is a NativeWindowWin subclass that provides the window frame
+// BrowserFrameWin is a NativeWidgetWin subclass that provides the window frame
// for the Chrome browser window.
//
-class BrowserFrameWin : public views::NativeWindowWin,
+class BrowserFrameWin : public views::NativeWidgetWin,
public NativeBrowserFrame {
public:
BrowserFrameWin(BrowserFrame* browser_frame, BrowserView* browser_view);
@@ -33,7 +33,7 @@ class BrowserFrameWin : public views::NativeWindowWin,
static void SetShowState(int state);
protected:
- // Overridden from views::NativeWindowWin:
+ // Overridden from views::NativeWidgetWin:
virtual int GetShowState() const OVERRIDE;
virtual gfx::Insets GetClientAreaInsets() const OVERRIDE;
virtual void UpdateFrameAfterFrameChange() OVERRIDE;
@@ -46,8 +46,8 @@ class BrowserFrameWin : public views::NativeWindowWin,
virtual bool ShouldUseNativeFrame() const OVERRIDE;
// Overridden from NativeBrowserFrame:
- virtual views::NativeWindow* AsNativeWindow() OVERRIDE;
- virtual const views::NativeWindow* AsNativeWindow() const OVERRIDE;
+ virtual views::NativeWidget* AsNativeWidget() OVERRIDE;
+ virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE;
virtual int GetMinimizeButtonOffset() const OVERRIDE;
virtual void TabStripDisplayModeChanged() OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 3c4b856..73247fb 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -98,9 +98,8 @@
#include "views/layout/grid_layout.h"
#include "views/widget/native_widget.h"
#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/native_window.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "chrome/browser/aeropeek_manager.h"
@@ -646,7 +645,7 @@ void BrowserView::FlashFrame() {
}
gfx::NativeWindow BrowserView::GetNativeHandle() {
- return GetWidget()->GetContainingWindow()->GetNativeWindow();
+ return GetWidget()->GetTopLevelWidget()->GetNativeWindow();
}
BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() {
@@ -1014,7 +1013,7 @@ void BrowserView::ShowAboutChromeDialog() {
DoShowAboutChromeDialog();
}
-views::Window* BrowserView::DoShowAboutChromeDialog() {
+views::Widget* BrowserView::DoShowAboutChromeDialog() {
return browser::ShowAboutChromeView(GetWidget()->GetNativeWindow(),
browser_->profile());
}
@@ -1583,7 +1582,7 @@ void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds,
// we're catching the going-into-fullscreen sizing and positioning calls,
// which we want to ignore.
if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) {
- WindowDelegate::SaveWindowPlacement(bounds, maximized);
+ WidgetDelegate::SaveWindowPlacement(bounds, maximized);
browser_->SaveWindowPlacement(bounds, maximized);
}
}
@@ -1673,6 +1672,14 @@ void BrowserView::OnWidgetMove() {
location_bar_view->location_entry()->ClosePopup();
}
+views::Widget* BrowserView::GetWidget() {
+ return View::GetWidget();
+}
+
+const views::Widget* BrowserView::GetWidget() const {
+ return View::GetWidget();
+}
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, views::ClientView overrides:
@@ -2264,9 +2271,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen) {
#endif
}
#if defined(OS_WIN)
- static_cast<views::NativeWidgetWin*>(
- frame_->native_window()->AsNativeWidget())->
- PushForceHidden();
+ static_cast<views::NativeWidgetWin*>(frame_->native_widget())->
+ PushForceHidden();
#endif
// Notify bookmark bar, so it can set itself to the appropriate drawing state.
@@ -2307,9 +2313,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen) {
ignore_layout_ = false;
Layout();
#if defined(OS_WIN)
- static_cast<views::NativeWidgetWin*>(
- frame_->native_window()->AsNativeWidget())->
- PopForceHidden();
+ static_cast<views::NativeWidgetWin*>(frame_->native_widget())->
+ PopForceHidden();
#endif
}
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index d61522a..2726d95 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -27,8 +27,8 @@
#include "ui/base/models/simple_menu_model.h"
#include "ui/gfx/native_widget_types.h"
#include "views/controls/single_split_view.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/client_view.h"
-#include "views/window/window_delegate.h"
#if defined(OS_WIN)
#include "chrome/browser/hang_monitor/hung_plugin_action.h"
@@ -84,7 +84,7 @@ class BrowserView : public BrowserBubbleHost,
public NotificationObserver,
public TabStripModelObserver,
public ui::SimpleMenuModel::Delegate,
- public views::WindowDelegate,
+ public views::WidgetDelegate,
public views::ClientView,
public InfoBarContainer::Delegate,
public views::SingleSplitView::Observer {
@@ -374,7 +374,7 @@ class BrowserView : public BrowserBubbleHost,
virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
virtual void ExecuteCommand(int command_id) OVERRIDE;
- // Overridden from views::WindowDelegate:
+ // Overridden from views::WidgetDelegate:
virtual bool CanResize() const OVERRIDE;
virtual bool CanMaximize() const OVERRIDE;
virtual bool CanActivate() const OVERRIDE;
@@ -397,6 +397,8 @@ class BrowserView : public BrowserBubbleHost,
virtual void OnWindowActivationChanged(bool active) OVERRIDE;
virtual void OnWindowBeginUserBoundsChange() OVERRIDE;
virtual void OnWidgetMove() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
// Overridden from views::ClientView:
virtual bool CanClose() OVERRIDE;
@@ -550,7 +552,7 @@ class BrowserView : public BrowserBubbleHost,
gfx::Size GetResizeCornerSize() const;
// Shows the about chrome modal dialog and returns the Window object.
- views::Window* DoShowAboutChromeDialog();
+ views::Widget* DoShowAboutChromeDialog();
// Shows the Compact Location Bar under the selected tab.
void ShowCompactLocationBarUnderSelectedTab();
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc
index e6b07c0..fb2634e 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -21,7 +21,6 @@
#include "ui/gfx/scrollbar_size.h"
#include "ui/gfx/size.h"
#include "views/controls/single_split_view.h"
-#include "views/window/window.h"
#if !defined(OS_WIN)
#include "views/window/hit_test.h"
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index f2e26c9..9f6e0c3 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -220,7 +220,7 @@ int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
int window_component = GetHTComponentForFrame(point, frame_border_thickness,
nonclient_border_thickness, frame_border_thickness,
kResizeAreaCornerSize - frame_border_thickness,
- frame_->window_delegate()->CanResize());
+ frame_->widget_delegate()->CanResize());
// Fall back to the caption if no other component matches.
return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
}
diff --git a/chrome/browser/ui/views/frame/native_browser_frame.h b/chrome/browser/ui/views/frame/native_browser_frame.h
index 120fa1f..756cd8e 100644
--- a/chrome/browser/ui/views/frame/native_browser_frame.h
+++ b/chrome/browser/ui/views/frame/native_browser_frame.h
@@ -17,8 +17,8 @@ class NativeBrowserFrame {
BrowserFrame* browser_frame,
BrowserView* browser_view);
- virtual views::NativeWindow* AsNativeWindow() = 0;
- virtual const views::NativeWindow* AsNativeWindow() const = 0;
+ virtual views::NativeWidget* AsNativeWidget() = 0;
+ virtual const views::NativeWidget* AsNativeWidget() const = 0;
protected:
friend class BrowserFrame;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 66f4c70..b0c6f66 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -35,7 +35,6 @@
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
#include "views/window/window_resources.h"
#include "views/window/window_shape.h"
@@ -245,7 +244,7 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForReservedArea() const {
int OpaqueBrowserFrameView::NonClientTopBorderHeight(
bool restored,
bool ignore_vertical_tabs) const {
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
// |delegate| may be NULL if called from callback of InputMethodChanged while
// a window is being destroyed.
// See more discussion at http://crosbug.com/8958
@@ -308,7 +307,7 @@ gfx::Size OpaqueBrowserFrameView::GetMinimumSize() {
min_size.Enlarge(2 * border_thickness,
NonClientTopBorderHeight(false, false) + border_thickness);
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
int min_titlebar_width = (2 * FrameBorderThickness(false)) +
kIconLeftSpacing +
(delegate && delegate->ShouldShowWindowIcon() ?
@@ -379,7 +378,7 @@ int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
minimize_button_->GetMirroredBounds().Contains(point))
return HTMINBUTTON;
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
if (!delegate) {
LOG(WARNING) << "delegate is NULL, returning safe default.";
return HTCAPTION;
@@ -507,7 +506,7 @@ bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const {
}
SkBitmap OpaqueBrowserFrameView::GetFaviconForTabIconView() {
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
if (!delegate) {
LOG(WARNING) << "delegate is NULL, returning safe default.";
return SkBitmap();
@@ -576,7 +575,7 @@ gfx::Rect OpaqueBrowserFrameView::IconBounds() const {
int size = IconSize();
int frame_thickness = FrameBorderThickness(false);
int y;
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
if (delegate && (delegate->ShouldShowWindowIcon() ||
delegate->ShouldShowWindowTitle())) {
// Our frame border has a different "3D look" than Windows'. Theirs has a
@@ -802,7 +801,7 @@ void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
void OpaqueBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) {
// The window icon is painted by the TabIconView.
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
if (!delegate) {
LOG(WARNING) << "delegate is NULL";
return;
@@ -1036,7 +1035,7 @@ void OpaqueBrowserFrameView::LayoutWindowControls() {
#if defined(OS_CHROMEOS)
// LayoutWindowControls could be triggered from
- // NativeWindowGtk::UpdateWindowTitle(), which could happen when user
+ // NativeWidgetGtk::UpdateWindowTitle(), which could happen when user
// navigates in fullscreen mode. And because
// BrowserFrameChromeos::IsMaximized() return false for fullscreen mode, we
// explicitly test fullscreen mode here and make it use the same code path
@@ -1098,7 +1097,7 @@ void OpaqueBrowserFrameView::LayoutTitleBar() {
// The window title is based on the calculated icon position, even when there
// is no icon.
gfx::Rect icon_bounds(IconBounds());
- views::WindowDelegate* delegate = frame_->window_delegate();
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
if (delegate && delegate->ShouldShowWindowIcon())
window_icon_->SetBoundsRect(icon_bounds);
diff --git a/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
index c2e6f63..624a4ae 100644
--- a/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
@@ -14,7 +14,7 @@
#endif
PopupNonClientFrameView::PopupNonClientFrameView(BrowserFrame* frame) {
- frame->set_frame_type(views::Window::FRAME_TYPE_FORCE_NATIVE);
+ frame->set_frame_type(views::Widget::FRAME_TYPE_FORCE_NATIVE);
}
gfx::Rect PopupNonClientFrameView::GetBoundsForClientView() const {
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
index bdb219d..3009674 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
@@ -15,7 +15,7 @@
#include "ui/gfx/canvas_skia.h"
#include "views/controls/link.h"
#include "views/screen.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_WIN)
#include "ui/base/l10n/l10n_util_win.h"
diff --git a/chrome/browser/ui/views/generic_info_view_unittest.cc b/chrome/browser/ui/views/generic_info_view_unittest.cc
index 153d96d8..88a5897 100644
--- a/chrome/browser/ui/views/generic_info_view_unittest.cc
+++ b/chrome/browser/ui/views/generic_info_view_unittest.cc
@@ -11,7 +11,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
// This class is only used on windows for now.
#if defined(OS_WIN)
diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc
index 8e98c51..dd48600 100644
--- a/chrome/browser/ui/views/html_dialog_view.cc
+++ b/chrome/browser/ui/views/html_dialog_view.cc
@@ -17,10 +17,9 @@
#include "views/events/event.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(TOOLKIT_USES_GTK)
-#include "views/window/native_window_gtk.h"
+#include "views/widget/native_widget_gtk.h"
#endif
class RenderWidgetHost;
@@ -34,8 +33,8 @@ gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent, Profile* profile,
new HtmlDialogView(profile, delegate);
browser::CreateViewsWindow(parent, gfx::Rect(), html_view);
html_view->InitDialog();
- html_view->window()->Show();
- return html_view->window()->GetNativeWindow();
+ html_view->GetWidget()->Show();
+ return html_view->GetWidget()->GetNativeWindow();
}
} // namespace browser
@@ -127,6 +126,14 @@ bool HtmlDialogView::ShouldShowWindowTitle() const {
return ShouldShowDialogTitle();
}
+views::Widget* HtmlDialogView::GetWidget() {
+ return View::GetWidget();
+}
+
+const views::Widget* HtmlDialogView::GetWidget() const {
+ return View::GetWidget();
+}
+
////////////////////////////////////////////////////////////////////////////////
// HtmlDialogUIDelegate implementation:
@@ -168,7 +175,7 @@ void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
delegate_ = NULL; // We will not communicate further with the delegate.
dialog_delegate->OnDialogClosed(json_retval);
}
- window()->Close();
+ GetWidget()->Close();
}
void HtmlDialogView::OnWindowClosed() {
@@ -213,8 +220,8 @@ void HtmlDialogView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
DefWindowProc(event.os_event.hwnd, event.os_event.message,
event.os_event.wParam, event.os_event.lParam);
#elif defined(TOOLKIT_USES_GTK)
- views::NativeWindowGtk* window_gtk =
- static_cast<views::NativeWindowGtk*>(window()->native_window());
+ views::NativeWidgetGtk* window_gtk =
+ static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget());
if (event.os_event && !event.skip_in_browser) {
views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event));
window_gtk->HandleKeyboardEvent(views_event);
diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h
index dd2d903..cc06018 100644
--- a/chrome/browser/ui/views/html_dialog_view.h
+++ b/chrome/browser/ui/views/html_dialog_view.h
@@ -15,12 +15,9 @@
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "ui/gfx/size.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
class Browser;
-namespace views {
-class Window;
-}
////////////////////////////////////////////////////////////////////////////////
//
@@ -39,7 +36,7 @@ class HtmlDialogView
: public DOMView,
public HtmlDialogTabContentsDelegate,
public HtmlDialogUIDelegate,
- public views::WindowDelegate,
+ public views::WidgetDelegate,
public NotificationObserver {
public:
HtmlDialogView(Profile* profile, HtmlDialogUIDelegate* delegate);
@@ -49,42 +46,48 @@ class HtmlDialogView
void InitDialog();
// Overridden from views::View:
- virtual gfx::Size GetPreferredSize();
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
-
- // Overridden from views::WindowDelegate:
- virtual bool CanResize() const;
- virtual bool IsModal() const;
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual views::View* GetContentsView();
- virtual views::View* GetInitiallyFocusedView();
- virtual bool ShouldShowWindowTitle() const;
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator)
+ OVERRIDE;
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child)
+ OVERRIDE;
+
+ // Overridden from views::WidgetDelegate:
+ virtual bool CanResize() const OVERRIDE;
+ virtual bool IsModal() const OVERRIDE;
+ virtual std::wstring GetWindowTitle() const OVERRIDE;
+ virtual void WindowClosing() OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ virtual views::View* GetInitiallyFocusedView() OVERRIDE;
+ virtual bool ShouldShowWindowTitle() const OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
// Overridden from HtmlDialogUIDelegate:
- virtual bool IsDialogModal() const;
- virtual std::wstring GetDialogTitle() const;
- virtual GURL GetDialogContentURL() const;
+ virtual bool IsDialogModal() const OVERRIDE;
+ virtual std::wstring GetDialogTitle() const OVERRIDE;
+ virtual GURL GetDialogContentURL() const OVERRIDE;
virtual void GetWebUIMessageHandlers(
- std::vector<WebUIMessageHandler*>* handlers) const;
- virtual void GetDialogSize(gfx::Size* size) const;
- virtual std::string GetDialogArgs() const;
- virtual void OnWindowClosed();
- virtual void OnDialogClosed(const std::string& json_retval);
- virtual void OnCloseContents(TabContents* source, bool* out_close_dialog);
- virtual bool ShouldShowDialogTitle() const;
- virtual bool HandleContextMenu(const ContextMenuParams& params);
+ std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
+ virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
+ virtual std::string GetDialogArgs() const OVERRIDE;
+ virtual void OnWindowClosed() OVERRIDE;
+ virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
+ virtual void OnCloseContents(TabContents* source, bool* out_close_dialog)
+ OVERRIDE;
+ virtual bool ShouldShowDialogTitle() const OVERRIDE;
+ virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE;
// Overridden from TabContentsDelegate:
- virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
- virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
- virtual void CloseContents(TabContents* source);
+ virtual void MoveContents(TabContents* source, const gfx::Rect& pos) OVERRIDE;
+ virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event)
+ OVERRIDE;
+ virtual void CloseContents(TabContents* source) OVERRIDE;
// Overridden from NotificationObserver
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details) OVERRIDE;
protected:
// Register accelerators for this dialog.
diff --git a/chrome/browser/ui/views/html_dialog_view_browsertest.cc b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
index 1d81977..60f3ebb 100644
--- a/chrome/browser/ui/views/html_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
@@ -17,7 +17,6 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using testing::Eq;
@@ -131,10 +130,10 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) {
new HtmlDialogView(browser()->profile(), delegate);
TabContents* tab_contents = browser()->GetSelectedTabContents();
ASSERT_TRUE(tab_contents != NULL);
- views::Window::CreateChromeWindow(tab_contents->GetDialogRootWindow(),
- gfx::Rect(), html_view);
+ views::Widget::CreateWindowWithParent(html_view,
+ tab_contents->GetDialogRootWindow());
html_view->InitDialog();
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
MessageLoopForUI::current()->AddObserver(
WindowChangedObserver::GetInstance());
@@ -213,13 +212,13 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, FLAKY_TestStateTransition) {
new HtmlDialogView(browser()->profile(), delegate);
TabContents* tab_contents = browser()->GetSelectedTabContents();
ASSERT_TRUE(tab_contents != NULL);
- views::Window::CreateChromeWindow(tab_contents->GetDialogRootWindow(),
- gfx::Rect(), html_view);
+ views::Widget::CreateWindowWithParent(html_view,
+ tab_contents->GetDialogRootWindow());
// Test if the state transitions from INITIALIZED to -> PAINTED
EXPECT_EQ(HtmlDialogView::INITIALIZED, html_view->state_);
html_view->InitDialog();
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
MessageLoopForUI::current()->AddObserver(
WindowChangedObserver::GetInstance());
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index 652ec2b..5833c64 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -27,9 +27,9 @@
#include "views/controls/table/group_table_view.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
+#include "views/widget/widget.h"
#include "views/window/client_view.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
class HungRendererDialogView;
@@ -123,8 +123,7 @@ void HungPagesTableModel::GetGroupRangeForItem(int item,
///////////////////////////////////////////////////////////////////////////////
// HungRendererDialogView
-class HungRendererDialogView : public views::View,
- public views::DialogDelegate,
+class HungRendererDialogView : public views::DialogDelegateView,
public views::ButtonListener,
public TabContentsObserver {
public:
@@ -233,7 +232,7 @@ HungRendererDialogView::~HungRendererDialogView() {
}
void HungRendererDialogView::ShowForTabContents(TabContents* contents) {
- DCHECK(contents && window());
+ DCHECK(contents && GetWidget());
contents_ = contents;
Observe(contents);
@@ -243,20 +242,20 @@ void HungRendererDialogView::ShowForTabContents(TabContents* contents) {
HWND frame_hwnd = GetAncestor(contents->GetNativeView(), GA_ROOT);
HWND foreground_window = GetForegroundWindow();
if (foreground_window != frame_hwnd &&
- foreground_window != window()->GetNativeWindow()) {
+ foreground_window != GetWidget()->GetNativeWindow()) {
return;
}
- if (!window()->IsActive()) {
+ if (!GetWidget()->IsActive()) {
volatile TabContents* passed_c = contents;
volatile TabContents* this_contents = contents_;
gfx::Rect bounds = GetDisplayBounds(contents);
views::Widget* insert_after =
views::Widget::GetWidgetForNativeView(frame_hwnd);
- window()->SetBoundsConstrained(bounds, insert_after);
+ GetWidget()->SetBoundsConstrained(bounds, insert_after);
if (insert_after)
- window()->MoveAboveWidget(insert_after);
+ GetWidget()->MoveAboveWidget(insert_after);
// We only do this if the window isn't active (i.e. hasn't been shown yet,
// or is currently shown but deactivated for another TabContents). This is
@@ -265,7 +264,7 @@ void HungRendererDialogView::ShowForTabContents(TabContents* contents) {
// the list of hung pages for a potentially unrelated renderer while this
// one is showing.
hung_pages_table_model_->InitForTabContents(contents);
- window()->Show();
+ GetWidget()->Show();
}
}
@@ -273,7 +272,7 @@ void HungRendererDialogView::EndForTabContents(TabContents* contents) {
DCHECK(contents);
if (contents_ && contents_->GetRenderProcessHost() ==
contents->GetRenderProcessHost()) {
- window()->Close();
+ GetWidget()->Close();
// Since we're closing, we no longer need this TabContents.
contents_ = NULL;
Observe(NULL);
@@ -447,7 +446,7 @@ gfx::Rect HungRendererDialogView::GetDisplayBounds(
RECT contents_bounds_rect;
GetWindowRect(contents_hwnd, &contents_bounds_rect);
gfx::Rect contents_bounds(contents_bounds_rect);
- gfx::Rect window_bounds = window()->GetWindowScreenBounds();
+ gfx::Rect window_bounds = GetWidget()->GetWindowScreenBounds();
int window_x = contents_bounds.x() +
(contents_bounds.width() - window_bounds.width()) / 2;
@@ -468,7 +467,7 @@ void HungRendererDialogView::InitClass() {
static HungRendererDialogView* CreateHungRendererDialogView() {
HungRendererDialogView* cv = new HungRendererDialogView;
- views::Window::CreateChromeWindow(NULL, gfx::Rect(), cv);
+ views::Widget::CreateWindow(cv);
return cv;
}
diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc
index 1149ccc..7e0a2f5 100644
--- a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc
+++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc
@@ -15,7 +15,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/label.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
// Default size of the dialog window.
static const int kDefaultWindowWidth = 320;
@@ -34,9 +34,7 @@ void ShowImportLockDialog(gfx::NativeWindow parent,
// static
void ImportLockDialogView::Show(gfx::NativeWindow parent,
ImporterHost* importer_host) {
- views::Window::CreateChromeWindow(
- NULL, gfx::Rect(),
- new ImportLockDialogView(importer_host))->Show();
+ views::Widget::CreateWindow(new ImportLockDialogView(importer_host))->Show();
}
ImportLockDialogView::ImportLockDialogView(ImporterHost* importer_host)
@@ -53,7 +51,7 @@ ImportLockDialogView::~ImportLockDialogView() {
}
gfx::Size ImportLockDialogView::GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS,
IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES));
}
diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
index 624dda5..2124841 100644
--- a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
+++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
@@ -16,7 +16,7 @@
#include "views/controls/throbber.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
ImportProgressDialogView::ImportProgressDialogView(
HWND parent_window,
@@ -98,7 +98,7 @@ ImportProgressDialogView::~ImportProgressDialogView() {
}
gfx::Size ImportProgressDialogView::GetPreferredSize() {
- return gfx::Size(views::Window::GetLocalizedContentsSize(
+ return gfx::Size(views::Widget::GetLocalizedContentsSize(
IDS_IMPORTPROGRESS_DIALOG_WIDTH_CHARS,
IDS_IMPORTPROGRESS_DIALOG_HEIGHT_LINES));
}
@@ -275,7 +275,7 @@ void ImportProgressDialogView::ImportEnded() {
// In every case, we need to close the UI now.
importing_ = false;
importer_host_->SetObserver(NULL);
- window()->Close();
+ GetWidget()->Close();
if (importer_observer_)
importer_observer_->ImportCompleted();
}
@@ -298,8 +298,8 @@ void ShowImportProgressDialog(HWND parent_window,
source_profile.importer_name,
source_profile.importer_type == importer::BOOKMARKS_HTML);
- views::Window* window = views::Window::CreateChromeWindow(
- parent_window, gfx::Rect(), progress_view);
+ views::Widget* window =
+ views::Widget::CreateWindowWithParent(progress_view, parent_window);
if (!importer_host->is_headless() && !first_run)
window->Show();
diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.h b/chrome/browser/ui/views/importer/import_progress_dialog_view.h
index afed11a..cbd23e5 100644
--- a/chrome/browser/ui/views/importer/import_progress_dialog_view.h
+++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.h
@@ -23,8 +23,7 @@ class CheckmarkThrobber;
class Label;
}
-class ImportProgressDialogView : public views::View,
- public views::DialogDelegate,
+class ImportProgressDialogView : public views::DialogDelegateView,
public importer::ImporterProgressObserver {
public:
// |items| is a bitmask of importer::ImportItem being imported.
diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.cc b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
index 2355093..e08fffc 100644
--- a/chrome/browser/ui/views/infobars/after_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/after_translate_infobar.cc
@@ -12,7 +12,7 @@
#include "views/controls/label.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
AfterTranslateInfoBar::AfterTranslateInfoBar(
TabContentsWrapper* owner,
diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.cc b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
index 4e89da5..1637922 100644
--- a/chrome/browser/ui/views/infobars/before_translate_infobar.cc
+++ b/chrome/browser/ui/views/infobars/before_translate_infobar.cc
@@ -12,7 +12,7 @@
#include "views/controls/label.h"
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
BeforeTranslateInfoBar::BeforeTranslateInfoBar(
TabContentsWrapper* owner,
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index 182b03d..35fd409 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -21,7 +21,6 @@
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
// ExtensionInfoBarDelegate ---------------------------------------------------
diff --git a/chrome/browser/ui/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc
index cd8bcb7..4f5f02b 100644
--- a/chrome/browser/ui/views/instant_confirm_view.cc
+++ b/chrome/browser/ui/views/instant_confirm_view.cc
@@ -18,7 +18,7 @@
#include "views/controls/link.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) {
views::Label* description_label = new views::Label(
@@ -67,7 +67,7 @@ std::wstring InstantConfirmView::GetWindowTitle() const {
gfx::Size InstantConfirmView::GetPreferredSize() {
DCHECK(GetLayoutManager());
- int pref_width = views::Window::GetLocalizedContentsWidth(
+ int pref_width = views::Widget::GetLocalizedContentsWidth(
IDS_INSTANT_CONFIRM_DIALOG_WIDTH_CHARS);
int pref_height =
GetLayoutManager()->GetPreferredHeightForWidth(this, pref_width);
@@ -87,8 +87,8 @@ void InstantConfirmView::LinkClicked(views::Link* source, int event_flags) {
namespace browser {
void ShowInstantConfirmDialog(gfx::NativeWindow parent, Profile* profile) {
- views::Window::CreateChromeWindow(parent, gfx::Rect(),
- new InstantConfirmView(profile))->Show();
+ views::Widget::CreateWindowWithParent(new InstantConfirmView(profile),
+ parent)->Show();
}
} // namespace browser
diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc
index 4f3f472..c01c7fa 100644
--- a/chrome/browser/ui/views/js_modal_dialog_views.cc
+++ b/chrome/browser/ui/views/js_modal_dialog_views.cc
@@ -13,7 +13,7 @@
#include "ui/base/message_box_flags.h"
#include "views/controls/message_box_view.h"
#include "views/controls/textfield/textfield.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
////////////////////////////////////////////////////////////////////////////////
// JSModalDialogViews, public:
@@ -46,16 +46,16 @@ int JSModalDialogViews::GetAppModalDialogButtons() const {
}
void JSModalDialogViews::ShowAppModalDialog() {
- window()->Show();
+ GetWidget()->Show();
}
void JSModalDialogViews::ActivateAppModalDialog() {
- window()->Show();
- window()->Activate();
+ GetWidget()->Show();
+ GetWidget()->Activate();
}
void JSModalDialogViews::CloseAppModalDialog() {
- window()->Close();
+ GetWidget()->Close();
}
void JSModalDialogViews::AcceptAppModalDialog() {
@@ -118,6 +118,14 @@ void JSModalDialogViews::OnClose() {
parent_->OnClose();
}
+views::Widget* JSModalDialogViews::GetWidget() {
+ return message_box_view_->GetWidget();
+}
+
+const views::Widget* JSModalDialogViews::GetWidget() const {
+ return message_box_view_->GetWidget();
+}
+
std::wstring JSModalDialogViews::GetDialogButtonLabel(
ui::MessageBoxFlags::DialogButton button) const {
if (parent_->is_before_unload_dialog()) {
diff --git a/chrome/browser/ui/views/js_modal_dialog_views.h b/chrome/browser/ui/views/js_modal_dialog_views.h
index c0bb886..abb2b60 100644
--- a/chrome/browser/ui/views/js_modal_dialog_views.h
+++ b/chrome/browser/ui/views/js_modal_dialog_views.h
@@ -25,29 +25,31 @@ class JSModalDialogViews : public NativeAppModalDialog,
virtual ~JSModalDialogViews();
// Overridden from NativeAppModalDialog:
- virtual int GetAppModalDialogButtons() const;
- virtual void ShowAppModalDialog();
- virtual void ActivateAppModalDialog();
- virtual void CloseAppModalDialog();
- virtual void AcceptAppModalDialog();
- virtual void CancelAppModalDialog();
+ virtual int GetAppModalDialogButtons() const OVERRIDE;
+ virtual void ShowAppModalDialog() OVERRIDE;
+ virtual void ActivateAppModalDialog() OVERRIDE;
+ virtual void CloseAppModalDialog() OVERRIDE;
+ virtual void AcceptAppModalDialog() OVERRIDE;
+ virtual void CancelAppModalDialog() OVERRIDE;
// Overridden from views::DialogDelegate:
- virtual int GetDefaultDialogButton() const;
- virtual int GetDialogButtons() const;
- virtual std::wstring GetWindowTitle() const;
- virtual void WindowClosing();
- virtual void DeleteDelegate();
- virtual bool Cancel();
- virtual bool Accept();
+ virtual int GetDefaultDialogButton() const OVERRIDE;
+ virtual int GetDialogButtons() const OVERRIDE;
+ virtual std::wstring GetWindowTitle() const OVERRIDE;
+ virtual void WindowClosing() OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+ virtual bool Cancel() OVERRIDE;
+ virtual bool Accept() OVERRIDE;
virtual std::wstring GetDialogButtonLabel(
- ui::MessageBoxFlags::DialogButton button) const;
+ ui::MessageBoxFlags::DialogButton button) const OVERRIDE;
// Overridden from views::WindowDelegate:
- virtual bool IsModal() const;
- virtual views::View* GetContentsView();
- virtual views::View* GetInitiallyFocusedView();
- virtual void OnClose();
+ virtual bool IsModal() const OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ virtual views::View* GetInitiallyFocusedView() OVERRIDE;
+ virtual void OnClose() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
private:
// A pointer to the AppModalDialog that owns us.
diff --git a/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc b/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
index bfdb86a..4375472 100644
--- a/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
+++ b/chrome/browser/ui/views/keyboard_overlay_dialog_view.cc
@@ -18,7 +18,6 @@
#include "views/events/event.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
struct Accelerator {
@@ -94,7 +93,7 @@ void KeyboardOverlayDialogView::ShowDialog(
gfx::Rect(),
chromeos::BubbleWindow::STYLE_XSHAPE,
html_view);
- html_view->window()->Show();
+ html_view->GetWidget()->Show();
}
bool KeyboardOverlayDialogView::IsCloseAccelerator(
diff --git a/chrome/browser/ui/views/keyboard_overlay_dialog_view.h b/chrome/browser/ui/views/keyboard_overlay_dialog_view.h
index 6aafc0d..ff0d95f 100644
--- a/chrome/browser/ui/views/keyboard_overlay_dialog_view.h
+++ b/chrome/browser/ui/views/keyboard_overlay_dialog_view.h
@@ -11,7 +11,6 @@
#include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "chrome/browser/ui/views/html_dialog_view.h"
-#include "views/window/window_delegate.h"
class BrowserView;
diff --git a/chrome/browser/ui/views/menu_item_view_test.cc b/chrome/browser/ui/views/menu_item_view_test.cc
index c3f27d3..05bf1ea 100644
--- a/chrome/browser/ui/views/menu_item_view_test.cc
+++ b/chrome/browser/ui/views/menu_item_view_test.cc
@@ -10,7 +10,7 @@
#include "views/controls/menu/submenu_view.h"
#include "views/controls/menu/view_menu_delegate.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
// This is a convenience base class for all tests to provide some
// common functionality. It sets up a MenuButton and a MenuItemView
diff --git a/chrome/browser/ui/views/native_constrained_window_win.cc b/chrome/browser/ui/views/native_constrained_window_win.cc
index 7ae1e34..1602e21 100644
--- a/chrome/browser/ui/views/native_constrained_window_win.cc
+++ b/chrome/browser/ui/views/native_constrained_window_win.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/views/constrained_window_views.h"
-#include "views/window/native_window_win.h"
+#include "views/widget/native_widget_win.h"
namespace {
bool IsNonClientHitTestCode(UINT hittest) {
@@ -13,10 +13,10 @@ bool IsNonClientHitTestCode(UINT hittest) {
}
class NativeConstrainedWindowWin : public NativeConstrainedWindow,
- public views::NativeWindowWin {
+ public views::NativeWidgetWin {
public:
explicit NativeConstrainedWindowWin(NativeConstrainedWindowDelegate* delegate)
- : views::NativeWindowWin(delegate->AsNativeWindowDelegate()),
+ : views::NativeWidgetWin(delegate->AsNativeWidgetDelegate()),
delegate_(delegate) {
}
@@ -25,21 +25,21 @@ class NativeConstrainedWindowWin : public NativeConstrainedWindow,
private:
// Overridden from NativeConstrainedWindow:
- virtual views::NativeWindow* AsNativeWindow() OVERRIDE {
+ virtual views::NativeWidget* AsNativeWidget() OVERRIDE {
return this;
}
- // Overridden from views::NativeWindowWin:
+ // Overridden from views::NativeWidgetWin:
virtual void OnFinalMessage(HWND window) OVERRIDE {
delegate_->OnNativeConstrainedWindowDestroyed();
- NativeWindowWin::OnFinalMessage(window);
+ NativeWidgetWin::OnFinalMessage(window);
}
virtual LRESULT OnMouseActivate(UINT message,
WPARAM w_param,
LPARAM l_param) OVERRIDE {
if (IsNonClientHitTestCode(static_cast<UINT>(LOWORD(l_param))))
delegate_->OnNativeConstrainedWindowMouseActivate();
- return NativeWindowWin::OnMouseActivate(message, w_param, l_param);
+ return NativeWidgetWin::OnMouseActivate(message, w_param, l_param);
}
NativeConstrainedWindowDelegate* delegate_;
diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc
index 56f1a07..520eb32 100644
--- a/chrome/browser/ui/views/page_info_bubble_view.cc
+++ b/chrome/browser/ui/views/page_info_bubble_view.cc
@@ -25,7 +25,6 @@
#include "views/controls/separator.h"
#include "views/layout/grid_layout.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace {
@@ -195,7 +194,7 @@ void PageInfoBubbleView::LayoutSections() {
// according to the animation stage, and let it know how transparent it
// should draw itself.
section->SetAnimationStage(resize_animation_.GetCurrentValue());
- gfx::Size sz(views::Window::GetLocalizedContentsSize(
+ gfx::Size sz(views::Widget::GetLocalizedContentsSize(
IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES));
layout->AddView(section,
1, 1, // Colspan & Rowspan.
@@ -229,7 +228,7 @@ void PageInfoBubbleView::LayoutSections() {
}
gfx::Size PageInfoBubbleView::GetPreferredSize() {
- gfx::Size size(views::Window::GetLocalizedContentsSize(
+ gfx::Size size(views::Widget::GetLocalizedContentsSize(
IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES));
size.set_height(0);
diff --git a/chrome/browser/ui/views/profile_menu_button.cc b/chrome/browser/ui/views/profile_menu_button.cc
new file mode 100644
index 0000000..6c7c983
--- /dev/null
+++ b/chrome/browser/ui/views/profile_menu_button.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 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 "chrome/browser/ui/views/profile_menu_button.h"
+
+#include "chrome/browser/ui/profile_menu_model.h"
+#include "ui/base/text/text_elider.h"
+#include "ui/gfx/color_utils.h"
+#include "views/controls/button/button.h"
+#include "views/controls/menu/menu_item_view.h"
+#include "views/controls/menu/menu_model_adapter.h"
+#include "views/widget/widget.h"
+
+// Menu should display below the profile button tag image on the frame. This
+// offset size depends on whether the frame is in glass or opaque mode.
+const int kMenuDisplayOffset = 7;
+
+// TextHover is slightly darker than enabled color, for a subtle hover shift.
+const SkColor kTextHover = 0xFFDDDDDD;
+const SkColor kTextEnabled = SK_ColorWHITE;
+const SkColor kTextHighlighted = SK_ColorWHITE;
+
+// Horizontal padding beside profile menu button, to center it in the
+// underlying tag image.
+const int kProfileButtonBorderSpacing = 10;
+
+// Maximum width for name string in pixels.
+const int kMaxTextWidth = 200;
+
+ProfileMenuButton::ProfileMenuButton(const std::wstring& text, Profile* profile)
+ : MenuButton(NULL, text, this, true) {
+ // Turn off hover highlighting and position button in the center of the
+ // underlying profile tag image.
+ set_border(views::Border::CreateEmptyBorder(
+ 0, kProfileButtonBorderSpacing, 0, kProfileButtonBorderSpacing));
+ SetHoverColor(kTextHover);
+ SetEnabledColor(kTextEnabled);
+ SetHighlightColor(kTextHighlighted);
+
+ profile_menu_model_.reset(new ProfileMenuModel);
+}
+
+ProfileMenuButton::~ProfileMenuButton() {}
+
+void ProfileMenuButton::SetText(const std::wstring& text) {
+ MenuButton::SetText(UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(text),
+ font(), kMaxTextWidth, false)));
+}
+
+// views::ViewMenuDelegate implementation
+void ProfileMenuButton::RunMenu(views::View* source, const gfx::Point &pt) {
+ views::MenuModelAdapter menu_model_adapter(profile_menu_model_.get());
+ views::MenuItemView menu(&menu_model_adapter);
+ menu_model_adapter.BuildMenu(&menu);
+
+ gfx::Point menu_point(pt.x(), pt.y() + kMenuDisplayOffset);
+ menu.RunMenuAt(source->GetWidget()->GetNativeWindow(), NULL,
+ gfx::Rect(pt, gfx::Size(0, 0)),
+ views::MenuItemView::TOPRIGHT,
+ true);
+}
diff --git a/chrome/browser/ui/views/repost_form_warning_view.cc b/chrome/browser/ui/views/repost_form_warning_view.cc
index df26298..8c5aa2c 100644
--- a/chrome/browser/ui/views/repost_form_warning_view.cc
+++ b/chrome/browser/ui/views/repost_form_warning_view.cc
@@ -14,7 +14,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/message_box_flags.h"
#include "views/controls/message_box_view.h"
-#include "views/window/window.h"
namespace browser {
diff --git a/chrome/browser/ui/views/repost_form_warning_view.h b/chrome/browser/ui/views/repost_form_warning_view.h
index c698c93..ae98c40 100644
--- a/chrome/browser/ui/views/repost_form_warning_view.h
+++ b/chrome/browser/ui/views/repost_form_warning_view.h
@@ -17,7 +17,6 @@ class TabContents;
namespace views {
class MessageBoxView;
-class Window;
}
// Displays a dialog that warns the user that they are about to resubmit
diff --git a/chrome/browser/ui/views/restart_message_box.cc b/chrome/browser/ui/views/restart_message_box.cc
index 91a736f..6d04555 100644
--- a/chrome/browser/ui/views/restart_message_box.cc
+++ b/chrome/browser/ui/views/restart_message_box.cc
@@ -10,7 +10,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/message_box_flags.h"
#include "views/controls/message_box_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
////////////////////////////////////////////////////////////////////////////////
// RestartMessageBox, public:
@@ -60,7 +60,7 @@ RestartMessageBox::RestartMessageBox(gfx::NativeWindow parent_window) {
l10n_util::GetStringUTF16(IDS_OPTIONS_RELAUNCH_REQUIRED)).c_str(),
std::wstring(),
kDialogWidth);
- views::Window::CreateChromeWindow(parent_window, gfx::Rect(), this)->Show();
+ views::Widget::CreateWindowWithParent(this, parent_window)->Show();
}
RestartMessageBox::~RestartMessageBox() {
diff --git a/chrome/browser/ui/views/select_file_dialog.cc b/chrome/browser/ui/views/select_file_dialog.cc
index 563707c..b8802d2 100644
--- a/chrome/browser/ui/views/select_file_dialog.cc
+++ b/chrome/browser/ui/views/select_file_dialog.cc
@@ -24,7 +24,6 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc
index 35319a4..a99449e 100644
--- a/chrome/browser/ui/views/status_bubble_views.cc
+++ b/chrome/browser/ui/views/status_bubble_views.cc
@@ -29,7 +29,6 @@
#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using views::Widget;
@@ -794,7 +793,7 @@ bool StatusBubbleViews::IsFrameVisible() {
if (!frame->IsVisible())
return false;
- views::Window* window = frame->GetContainingWindow();
+ views::Widget* window = frame->GetTopLevelWidget();
return !window || !window->IsMinimized();
}
diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc
index a6de3a9..e933f5d 100644
--- a/chrome/browser/ui/views/tabs/base_tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/ui/views/tabs/dragged_tab_controller.h"
#include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_WIN)
// GET_X_LPARAM, et al.
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index e42f8e8..298b2fc 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
@@ -37,7 +37,6 @@
#include "views/events/event.h"
#include "views/screen.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h> // NOLINT
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 3a83bfe..9526e99 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -27,7 +27,6 @@
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
static const int kLeftPadding = 16;
static const int kTopPadding = 6;
@@ -449,8 +448,7 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
int offset = GetMirroredX() + background_offset_.x();
int tab_id;
- if (GetWidget() &&
- GetWidget()->GetContainingWindow()->ShouldUseNativeFrame()) {
+ if (GetWidget() && GetWidget()->GetTopLevelWidget()->ShouldUseNativeFrame()) {
tab_id = IDR_THEME_TAB_BACKGROUND_V;
} else {
tab_id = data().incognito ? IDR_THEME_TAB_BACKGROUND_INCOGNITO :
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index d247063..ce53b94 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -27,8 +27,8 @@
#include "ui/gfx/size.h"
#include "views/controls/image_view.h"
#include "views/widget/default_theme_provider.h"
+#include "views/widget/widget.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "views/widget/monitor_win.h"
diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc
index df8cbaf..06654c1 100644
--- a/chrome/browser/ui/views/task_manager_view.cc
+++ b/chrome/browser/ui/views/task_manager_view.cc
@@ -34,7 +34,6 @@
#include "views/layout/layout_constants.h"
#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
// The task manager window default size.
static const int kDefaultWidth = 460;
@@ -257,9 +256,8 @@ class BackgroundColorGroupTableView : public views::GroupTableView {
};
// The Task manager UI container.
-class TaskManagerView : public views::View,
- public views::ButtonListener,
- public views::DialogDelegate,
+class TaskManagerView : public views::ButtonListener,
+ public views::DialogDelegateView,
public views::TableViewObserver,
public views::LinkListener,
public views::ContextMenuController,
@@ -567,18 +565,18 @@ void TaskManagerView::Show(bool highlight_background_resources) {
if (instance_) {
if (instance_->highlight_background_resources_ !=
highlight_background_resources) {
- instance_->window()->Close();
+ instance_->GetWidget()->Close();
} else {
// If there's a Task manager window open already, just activate it.
- instance_->window()->Activate();
+ instance_->GetWidget()->Activate();
return;
}
}
instance_ = new TaskManagerView(highlight_background_resources);
- views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_);
+ views::Widget::CreateWindow(instance_);
instance_->InitAlwaysOnTopState();
instance_->model_->StartUpdating();
- instance_->window()->Show();
+ instance_->GetWidget()->Show();
// Set the initial focus to the list of tasks.
views::FocusManager* focus_manager = instance_->GetFocusManager();
@@ -626,7 +624,7 @@ bool TaskManagerView::ExecuteWindowsCommand(int command_id) {
r = SetMenuItemInfo(system_menu, IDC_ALWAYS_ON_TOP, FALSE, &menu_info);
// Now change the actual window's behavior.
- window()->SetAlwaysOnTop(is_always_on_top_);
+ GetWidget()->SetAlwaysOnTop(is_always_on_top_);
// Save the state.
if (g_browser_process->local_state()) {
@@ -718,7 +716,7 @@ void TaskManagerView::ExecuteCommand(int id) {
void TaskManagerView::InitAlwaysOnTopState() {
is_always_on_top_ = false;
if (GetSavedAlwaysOnTopState(&is_always_on_top_))
- window()->SetAlwaysOnTop(is_always_on_top_);
+ GetWidget()->SetAlwaysOnTop(is_always_on_top_);
AddAlwaysOnTopSystemMenuItem();
}
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index 9721b0b..c9908f4 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -36,7 +36,6 @@
#include "views/focus/view_storage.h"
#include "views/widget/tooltip_manager.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "chrome/browser/enumerate_modules_model_win.h"
diff --git a/chrome/browser/ui/views/update_recommended_message_box.cc b/chrome/browser/ui/views/update_recommended_message_box.cc
index 1eb76c4..09ce309 100644
--- a/chrome/browser/ui/views/update_recommended_message_box.cc
+++ b/chrome/browser/ui/views/update_recommended_message_box.cc
@@ -15,7 +15,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/message_box_flags.h"
#include "views/controls/message_box_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
diff --git a/chrome/browser/ui/views/user_data_dir_dialog.cc b/chrome/browser/ui/views/user_data_dir_dialog.cc
index 996f442..26235fd 100644
--- a/chrome/browser/ui/views/user_data_dir_dialog.cc
+++ b/chrome/browser/ui/views/user_data_dir_dialog.cc
@@ -11,7 +11,6 @@
#include "ui/base/message_box_flags.h"
#include "views/controls/message_box_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
// static
FilePath UserDataDirDialog::RunUserDataDirDialog(
@@ -34,7 +33,7 @@ UserDataDirDialog::UserDataDirDialog(const FilePath& user_data_dir)
ui::MessageBoxFlags::kIsConfirmMessageBox,
message_text.c_str(), std::wstring(), kDialogWidth);
- views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show();
+ views::Widget::CreateWindow(this)->Show();
}
UserDataDirDialog::~UserDataDirDialog() {
diff --git a/chrome/browser/ui/views/user_data_dir_dialog.h b/chrome/browser/ui/views/user_data_dir_dialog.h
index fd00ac6..fa51df1 100644
--- a/chrome/browser/ui/views/user_data_dir_dialog.h
+++ b/chrome/browser/ui/views/user_data_dir_dialog.h
@@ -18,7 +18,6 @@ class FilePath;
namespace views {
class MessageBoxView;
-class Window;
}
class UserDataDirDialog : public views::DialogDelegate,
diff --git a/chrome/browser/ui/views/window.cc b/chrome/browser/ui/views/window.cc
index ed52599..59a6d93 100644
--- a/chrome/browser/ui/views/window.cc
+++ b/chrome/browser/ui/views/window.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/window.h"
#include "ui/gfx/rect.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/frame/bubble_window.h"
@@ -13,16 +13,16 @@
namespace browser {
-views::Window* CreateViewsWindow(gfx::NativeWindow parent,
+views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
const gfx::Rect& bounds,
- views::WindowDelegate* delegate) {
+ views::WidgetDelegate* delegate) {
#if defined(OS_CHROMEOS)
return chromeos::BubbleWindow::Create(parent,
gfx::Rect(),
chromeos::BubbleWindow::STYLE_GENERIC,
delegate);
#else
- return views::Window::CreateChromeWindow(parent, gfx::Rect(), delegate);
+ return views::Widget::CreateWindowWithParent(delegate, parent);
#endif
}
diff --git a/chrome/browser/ui/views/window.h b/chrome/browser/ui/views/window.h
index 9981f2d..04c4b81 100644
--- a/chrome/browser/ui/views/window.h
+++ b/chrome/browser/ui/views/window.h
@@ -13,16 +13,16 @@ class Rect;
}
namespace views {
-class Window;
-class WindowDelegate;
+class Widget;
+class WidgetDelegate;
}
namespace browser {
// Create a window for given |delegate| using default frame view.
-views::Window* CreateViewsWindow(gfx::NativeWindow parent,
+views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
const gfx::Rect& bounds,
- views::WindowDelegate* delegate);
+ views::WidgetDelegate* delegate);
} // namespace browser
diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc
index 9094a9e..93abf2a 100644
--- a/chrome/browser/ui/views/wrench_menu.cc
+++ b/chrome/browser/ui/views/wrench_menu.cc
@@ -38,7 +38,7 @@
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_scroll_view_container.h"
#include "views/controls/menu/submenu_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
using ui::MenuModel;
using views::CustomButton;
diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
index 3c7979e..66ac058 100644
--- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc
@@ -19,7 +19,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace chromeos {
@@ -113,7 +113,7 @@ void ChangePictureOptionsHandler::ChooseFile(const ListValue* args) {
void ChangePictureOptionsHandler::TakePhoto(const ListValue* args) {
DCHECK(args && args->empty());
- views::Window* window = browser::CreateViewsWindow(
+ views::Widget* window = browser::CreateViewsWindow(
GetBrowserWindow(),
gfx::Rect(),
new TakePhotoDialog());
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 7f63487..bd8762c 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -44,7 +44,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
static const char kOtherNetworksFakePath[] = "?";
@@ -813,8 +813,8 @@ void InternetOptionsHandler::SetActivationButtonVisibility(
}
}
-void InternetOptionsHandler::CreateModalPopup(views::WindowDelegate* view) {
- views::Window* window = browser::CreateViewsWindow(GetNativeWindow(),
+void InternetOptionsHandler::CreateModalPopup(views::WidgetDelegate* view) {
+ views::Widget* window = browser::CreateViewsWindow(GetNativeWindow(),
gfx::Rect(),
view);
window->SetAlwaysOnTop(true);
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
index f8a0d7a..9b2a02b 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h
@@ -14,7 +14,7 @@
class SkBitmap;
namespace views {
-class WindowDelegate;
+class WidgetDelegate;
}
// ChromeOS internet options page UI handler.
@@ -49,7 +49,7 @@ class InternetOptionsHandler
private:
// Opens a modal popup dialog.
- void CreateModalPopup(views::WindowDelegate* view);
+ void CreateModalPopup(views::WidgetDelegate* view);
gfx::NativeWindow GetNativeWindow() const;
// Passes data needed to show details overlay for network.
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
index e3ed25b..958ecea 100644
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
@@ -42,7 +42,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/window.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "views/window/window.h"
#endif // defined(OS_CHROMEOS)
#if defined(TOOLKIT_GTK)
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
diff --git a/chrome/test/interactive_ui/view_event_test_base.cc b/chrome/test/interactive_ui/view_event_test_base.cc
index 06f6804..77e4479 100644
--- a/chrome/test/interactive_ui/view_event_test_base.cc
+++ b/chrome/test/interactive_ui/view_event_test_base.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/test/ui_test_utils.h"
#include "views/view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace {
@@ -77,7 +77,7 @@ void ViewEventTestBase::SetUp() {
#if defined(OS_WIN)
OleInitialize(NULL);
#endif
- window_ = views::Window::CreateChromeWindow(NULL, gfx::Rect(), this);
+ window_ = views::Widget::CreateWindow(this);
}
void ViewEventTestBase::TearDown() {
@@ -112,6 +112,14 @@ views::View* ViewEventTestBase::GetContentsView() {
return content_view_;
}
+const views::Widget* ViewEventTestBase::GetWidget() const {
+ return content_view_->GetWidget();
+}
+
+views::Widget* ViewEventTestBase::GetWidget() {
+ return content_view_->GetWidget();
+}
+
ViewEventTestBase::~ViewEventTestBase() {
}
diff --git a/chrome/test/interactive_ui/view_event_test_base.h b/chrome/test/interactive_ui/view_event_test_base.h
index 7592f7d..eee41f1 100644
--- a/chrome/test/interactive_ui/view_event_test_base.h
+++ b/chrome/test/interactive_ui/view_event_test_base.h
@@ -15,7 +15,7 @@
#include "base/task.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
class Task;
@@ -60,7 +60,7 @@ class Size;
// // Then use this to schedule another mouse move.
// ScheduleMouseMoveInBackground(loc.x, loc.y);
-class ViewEventTestBase : public views::WindowDelegate,
+class ViewEventTestBase : public views::WidgetDelegate,
public testing::Test {
public:
ViewEventTestBase();
@@ -75,11 +75,11 @@ class ViewEventTestBase : public views::WindowDelegate,
// Destroys the window.
virtual void TearDown();
- virtual bool CanResize() const;
-
- // WindowDelegate method. Calls into CreateContentsView to get the actual
- // view.
- virtual views::View* GetContentsView();
+ // Overridden from views::WidgetDelegate:
+ virtual bool CanResize() const OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
// Overriden to do nothing so that this class can be used in runnable tasks.
void AddRef() {}
@@ -116,7 +116,7 @@ class ViewEventTestBase : public views::WindowDelegate,
// Spawns a new thread posts a MouseMove in the background.
void ScheduleMouseMoveInBackground(int x, int y);
- views::Window* window_;
+ views::Widget* window_;
private:
// Stops the thread started by ScheduleMouseMoveInBackground.
diff --git a/content/browser/tab_contents/constrained_window.h b/content/browser/tab_contents/constrained_window.h
index 7dd0b40..db800ac 100644
--- a/content/browser/tab_contents/constrained_window.h
+++ b/content/browser/tab_contents/constrained_window.h
@@ -12,10 +12,10 @@
// dialogs.
#if defined(OS_WIN)
namespace views {
-class WindowDelegate;
+class WidgetDelegate;
class DialogDelegate;
}
-typedef views::WindowDelegate ConstrainedWindowDelegate;
+typedef views::WidgetDelegate ConstrainedWindowDelegate;
typedef views::DialogDelegate ConstrainedDialogDelegate;
#elif defined(OS_MACOSX)
class ConstrainedWindowMacDelegate;
diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc
index 0eb6d2f..dc893df 100644
--- a/views/controls/button/button_dropdown.cc
+++ b/views/controls/button/button_dropdown.cc
@@ -14,7 +14,6 @@
#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_model_adapter.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
namespace views {
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index 0e5d702..3c8bbed 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -18,7 +18,6 @@
#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
using base::Time;
using base::TimeDelta;
diff --git a/views/controls/combobox/native_combobox_views.cc b/views/controls/combobox/native_combobox_views.cc
index 10e197f..cf34ac1 100644
--- a/views/controls/combobox/native_combobox_views.cc
+++ b/views/controls/combobox/native_combobox_views.cc
@@ -20,7 +20,7 @@
#include "views/controls/focusable_border.h"
#include "views/controls/menu/submenu_view.h"
#include "views/widget/root_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
#if defined(OS_LINUX)
#include "ui/gfx/gtk_util.h"
diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc
index 20a1a96..2785987 100644
--- a/views/controls/scrollbar/bitmap_scroll_bar.cc
+++ b/views/controls/scrollbar/bitmap_scroll_bar.cc
@@ -21,7 +21,6 @@
#include "views/controls/menu/menu.h"
#include "views/controls/scroll_view.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#undef min
#undef max
diff --git a/views/controls/scrollbar/native_scroll_bar_win.cc b/views/controls/scrollbar/native_scroll_bar_win.cc
index 7c1b5d7..e46e52a 100644
--- a/views/controls/scrollbar/native_scroll_bar_win.cc
+++ b/views/controls/scrollbar/native_scroll_bar_win.cc
@@ -75,11 +75,11 @@ class ScrollBarContainer : public ui::WindowImpl {
private:
LRESULT OnCreate(LPCREATESTRUCT create_struct) {
- scrollbar_ = CreateWindow(L"SCROLLBAR", L"",
- WS_CHILD | (parent_->IsHorizontal() ?
- SBS_HORZ : SBS_VERT),
- 0, 0, parent_->width(), parent_->height(),
- hwnd(), NULL, NULL, NULL);
+ scrollbar_ = CreateWindowW(L"SCROLLBAR", L"",
+ WS_CHILD | (parent_->IsHorizontal() ?
+ SBS_HORZ : SBS_VERT),
+ 0, 0, parent_->width(), parent_->height(),
+ hwnd(), NULL, NULL, NULL);
ui::CheckWindowCreated(scrollbar_);
ShowWindow(scrollbar_, SW_SHOW);
return 1;
diff --git a/views/controls/tabbed_pane/tabbed_pane_unittest.cc b/views/controls/tabbed_pane/tabbed_pane_unittest.cc
index 1ceef86..12f82a5 100644
--- a/views/controls/tabbed_pane/tabbed_pane_unittest.cc
+++ b/views/controls/tabbed_pane/tabbed_pane_unittest.cc
@@ -5,8 +5,8 @@
#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "views/controls/tabbed_pane/tabbed_pane.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
namespace views {
@@ -26,7 +26,8 @@ class FixedSizeView : public View {
DISALLOW_COPY_AND_ASSIGN(FixedSizeView);
};
-class TabbedPaneTest : public testing::Test, WindowDelegate {
+class TabbedPaneTest : public testing::Test,
+ public WidgetDelegate {
public:
TabbedPaneTest() {}
@@ -39,7 +40,7 @@ class TabbedPaneTest : public testing::Test, WindowDelegate {
private:
virtual void SetUp() {
tabbed_pane_ = new TabbedPane();
- window_ = Window::CreateChromeWindow(NULL, gfx::Rect(0, 0, 100, 100), this);
+ window_ = Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 100, 100));
window_->Show();
}
@@ -53,7 +54,7 @@ class TabbedPaneTest : public testing::Test, WindowDelegate {
}
MessageLoopForUI message_loop_;
- Window* window_;
+ Widget* window_;
DISALLOW_COPY_AND_ASSIGN(TabbedPaneTest);
};
diff --git a/views/controls/table/table_view_unittest.cc b/views/controls/table/table_view_unittest.cc
index 572ace2..ee6734b 100644
--- a/views/controls/table/table_view_unittest.cc
+++ b/views/controls/table/table_view_unittest.cc
@@ -20,8 +20,8 @@
#include "ui/base/models/table_model_observer.h"
#include "views/controls/table/table_view.h"
#include "views/controls/table/table_view2.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
using ui::TableModel;
using ui::TableModelObserver; // TODO(beng): remove these
@@ -139,7 +139,7 @@ int TestTableModel::CompareValues(int row1, int row2, int column_id) {
// TableViewTest ---------------------------------------------------------------
-class TableViewTest : public testing::Test, views::WindowDelegate {
+class TableViewTest : public testing::Test, views::WidgetDelegate {
public:
virtual void SetUp();
virtual void TearDown();
@@ -174,7 +174,7 @@ class TableViewTest : public testing::Test, views::WindowDelegate {
private:
MessageLoopForUI message_loop_;
- views::Window* window_;
+ views::Widget* window_;
};
void TableViewTest::SetUp() {
@@ -186,9 +186,9 @@ void TableViewTest::SetUp() {
columns[1].id = 1;
table_ = new TableView(model_.get(), columns, views::ICON_AND_TEXT,
false, false, false);
- window_ =
- views::Window::CreateChromeWindow(NULL, gfx::Rect(100, 100, 512, 512),
- this);
+ window_ = views::Widget::CreateWindowWithBounds(
+ this,
+ gfx::Rect(100, 100, 512, 512));
}
void TableViewTest::TearDown() {
@@ -466,7 +466,7 @@ TEST_F(NullModelTableViewTest, DISABLED_NullModel) {
////////////////////////////////////////////////////////////////////////////////
// TableView2 Tests
-class TableView2Test : public testing::Test, views::WindowDelegate {
+class TableView2Test : public testing::Test, views::WidgetDelegate {
public:
virtual void SetUp();
virtual void TearDown();
@@ -493,7 +493,7 @@ class TableView2Test : public testing::Test, views::WindowDelegate {
private:
MessageLoopForUI message_loop_;
- views::Window* window_;
+ views::Widget* window_;
};
void TableView2Test::SetUp() {
@@ -507,9 +507,9 @@ void TableView2Test::SetUp() {
columns[1].id = 1;
table_ = new views::TableView2(model_.get(), columns, GetTableType(),
views::TableView2::NONE);
- window_ = views::Window::CreateChromeWindow(NULL,
- gfx::Rect(100, 100, 512, 512),
- this);
+ window_ = views::Widget::CreateWindowWithBounds(
+ this,
+ gfx::Rect(100, 100, 512, 512));
window_->Show();
}
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index 2204913..423b6eb 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -30,7 +30,6 @@
#include "views/metrics.h"
#include "views/views_delegate.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(OS_LINUX)
#include "ui/gfx/gtk_util.h"
diff --git a/views/desktop/desktop_views_delegate.cc b/views/desktop/desktop_views_delegate.cc
index 00a2014..98adee5 100644
--- a/views/desktop/desktop_views_delegate.cc
+++ b/views/desktop/desktop_views_delegate.cc
@@ -27,21 +27,22 @@ ui::Clipboard* DesktopViewsDelegate::GetClipboard() const {
return NULL;
}
-void DesktopViewsDelegate::SaveWindowPlacement(views::Window* window,
- const std::wstring& window_name,
- const gfx::Rect& bounds,
- bool maximized) {
+void DesktopViewsDelegate::SaveWindowPlacement(const Widget* widget,
+ const std::wstring& window_name,
+ const gfx::Rect& bounds,
+ bool maximized) {
}
-bool DesktopViewsDelegate::GetSavedWindowBounds(views::Window* window,
+bool DesktopViewsDelegate::GetSavedWindowBounds(const Widget* widget,
const std::wstring& window_name,
gfx::Rect* bounds) const {
return false;
}
-bool DesktopViewsDelegate::GetSavedMaximizedState(views::Window* window,
- const std::wstring& window_name,
- bool* maximized) const {
+bool DesktopViewsDelegate::GetSavedMaximizedState(
+ const Widget* widget,
+ const std::wstring& window_name,
+ bool* maximized) const {
return false;
}
diff --git a/views/desktop/desktop_views_delegate.h b/views/desktop/desktop_views_delegate.h
index fdc2fe0..cf7fa3d 100644
--- a/views/desktop/desktop_views_delegate.h
+++ b/views/desktop/desktop_views_delegate.h
@@ -19,14 +19,14 @@ class DesktopViewsDelegate : public ViewsDelegate {
private:
// Overridden from ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const OVERRIDE;
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const Widget* widget,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) OVERRIDE;
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const Widget* widget,
const std::wstring& window_name,
gfx::Rect* bounds) const OVERRIDE;
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const Widget* widget,
const std::wstring& window_name,
bool* maximized) const OVERRIDE;
virtual void NotifyAccessibilityEvent(
diff --git a/views/desktop/desktop_window.cc b/views/desktop/desktop_window.cc
index b59fc5d..c0999fb 100644
--- a/views/desktop/desktop_window.cc
+++ b/views/desktop/desktop_window.cc
@@ -9,20 +9,20 @@
#include "views/desktop/desktop_background.h"
#include "views/desktop/desktop_window_root_view.h"
#include "views/widget/native_widget_view.h"
-#include "views/window/native_window_views.h"
-#include "views/window/window.h"
+#include "views/widget/native_widget_views.h"
+#include "views/widget/widget.h"
#if defined(OS_WIN)
-#include "views/window/native_window_win.h"
+#include "views/widget/native_widget_win.h"
#elif defined(TOOLKIT_USES_GTK)
-#include "views/window/native_window_gtk.h"
+#include "views/widget/native_widget_gtk.h"
#endif
namespace views {
namespace desktop {
// TODO(beng): resolve naming!
-class DesktopWindowWindow : public Window {
+class DesktopWindowWindow : public Widget {
public:
explicit DesktopWindowWindow(DesktopWindow* desktop_window)
: desktop_window_(desktop_window) {}
@@ -40,7 +40,7 @@ class DesktopWindowWindow : public Window {
};
class TestWindowContentView : public View,
- public WindowDelegate {
+ public WidgetDelegate {
public:
TestWindowContentView(const std::wstring& title, SkColor color)
: title_(title),
@@ -81,18 +81,19 @@ DesktopWindow::~DesktopWindow() {
// static
void DesktopWindow::CreateDesktopWindow() {
DesktopWindow* desktop = new DesktopWindow;
- views::Window* window = new DesktopWindowWindow(desktop);
- views::Window::InitParams params(desktop);
+ views::Widget* window = new DesktopWindowWindow(desktop);
+ views::Widget::InitParams params;
+ params.delegate = desktop;
// In this environment, CreateChromeWindow will default to creating a views-
- // window, so we need to construct a NativeWindowWin by hand.
+ // window, so we need to construct a NativeWidgetWin by hand.
// TODO(beng): Replace this with NativeWindow::CreateNativeRootWindow().
#if defined(OS_WIN)
- params.native_window = new views::NativeWindowWin(window);
+ params.native_widget = new views::NativeWidgetWin(window);
#elif defined(TOOLKIT_USES_GTK)
- params.native_window = new views::NativeWindowGtk(window);
+ params.native_widget = new views::NativeWidgetGtk(window);
#endif
- params.widget_init_params.bounds = gfx::Rect(20, 20, 1920, 1200);
- window->InitWindow(params);
+ params.bounds = gfx::Rect(20, 20, 1920, 1200);
+ window->Init(params);
window->Show();
desktop->CreateTestWindow(L"Sample Window 1", SK_ColorWHITE,
@@ -161,12 +162,13 @@ void DesktopWindow::CreateTestWindow(const std::wstring& title,
SkColor color,
gfx::Rect initial_bounds,
bool rotate) {
- views::Window* window = new views::Window;
- views::NativeWindowViews* nwv = new views::NativeWindowViews(this, window);
- views::Window::InitParams params(new TestWindowContentView(title, color));
- params.native_window = nwv;
- params.widget_init_params.bounds = initial_bounds;
- window->InitWindow(params);
+ views::Widget* window = new views::Widget;
+ views::NativeWidgetViews* nwv = new views::NativeWidgetViews(this, window);
+ views::Widget::InitParams params;
+ params.delegate = new TestWindowContentView(title, color);
+ params.native_widget = nwv;
+ params.bounds = initial_bounds;
+ window->Init(params);
window->Show();
if (rotate) {
diff --git a/views/desktop/desktop_window.h b/views/desktop/desktop_window.h
index 8cd943a..453030c 100644
--- a/views/desktop/desktop_window.h
+++ b/views/desktop/desktop_window.h
@@ -6,7 +6,7 @@
#define VIEWS_DESKTOP_DESKTOP_WINDOW_H_
#include "views/view.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
namespace views {
class NativeWidgetViews;
@@ -14,7 +14,7 @@ class NativeWidgetViews;
namespace desktop {
class DesktopWindow : public View,
- public WindowDelegate {
+ public WidgetDelegate {
public:
DesktopWindow();
virtual ~DesktopWindow();
@@ -29,7 +29,7 @@ class DesktopWindow : public View,
// Overridden from View:
virtual void Layout() OVERRIDE;
- // Overridden from WindowDelegate:
+ // Overridden from WidgetDelegate:
virtual bool CanResize() const OVERRIDE;
virtual bool CanMaximize() const OVERRIDE;
virtual std::wstring GetWindowTitle() const OVERRIDE;
diff --git a/views/desktop/desktop_window_root_view.cc b/views/desktop/desktop_window_root_view.cc
index 5639cb5..fec23fb 100644
--- a/views/desktop/desktop_window_root_view.cc
+++ b/views/desktop/desktop_window_root_view.cc
@@ -6,7 +6,7 @@
#include "views/desktop/desktop_window.h"
#include "views/widget/native_widget_view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace views {
namespace desktop {
@@ -15,7 +15,7 @@ namespace desktop {
// DesktopWindowRootView, public:
DesktopWindowRootView::DesktopWindowRootView(DesktopWindow* desktop_window,
- Window* window)
+ Widget* window)
: internal::RootView(window),
desktop_window_(desktop_window) {
}
diff --git a/views/desktop/desktop_window_root_view.h b/views/desktop/desktop_window_root_view.h
index 9ad5f1c..1896942 100644
--- a/views/desktop/desktop_window_root_view.h
+++ b/views/desktop/desktop_window_root_view.h
@@ -14,7 +14,7 @@ class DesktopWindow;
class DesktopWindowRootView : public internal::RootView {
public:
- DesktopWindowRootView(DesktopWindow* desktop_window, Window* window);
+ DesktopWindowRootView(DesktopWindow* desktop_window, Widget* window);
virtual ~DesktopWindowRootView();
private:
diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc
index 7e123aa..2e95b65 100644
--- a/views/examples/examples_main.cc
+++ b/views/examples/examples_main.cc
@@ -22,7 +22,6 @@
#include "views/examples/native_theme_button_example.h"
#include "views/examples/native_theme_checkbox_example.h"
#include "views/examples/native_widget_views_example.h"
-#include "views/examples/native_window_views_example.h"
#include "views/examples/radio_button_example.h"
#include "views/examples/scroll_view_example.h"
#include "views/examples/single_split_view_example.h"
@@ -34,7 +33,6 @@
#include "views/focus/accelerator_handler.h"
#include "views/layout/grid_layout.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#include "views/test/test_views_delegate.h"
#if defined(OS_WIN)
@@ -60,6 +58,14 @@ void ExamplesMain::WindowClosing() {
MessageLoopForUI::current()->Quit();
}
+views::Widget* ExamplesMain::GetWidget() {
+ return contents_->GetWidget();
+}
+
+const views::Widget* ExamplesMain::GetWidget() const {
+ return contents_->GetWidget();
+}
+
void ExamplesMain::SetStatus(const std::wstring& status) {
status_label_->SetText(status);
}
@@ -101,8 +107,8 @@ void ExamplesMain::Run() {
// TODO(satorux): The window is getting wide. Eventually, we would have
// the second tabbed pane.
- views::Window* window =
- views::Window::CreateChromeWindow(NULL, gfx::Rect(0, 0, 850, 300), this);
+ views::Widget* window =
+ views::Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 850, 300));
examples::NativeThemeCheckboxExample native_theme_checkbox_example(this);
tabbed_pane->AddTab(native_theme_checkbox_example.GetExampleTitle(),
@@ -116,10 +122,6 @@ void ExamplesMain::Run() {
tabbed_pane->AddTab(native_widget_views_example.GetExampleTitle(),
native_widget_views_example.GetExampleView());
- examples::NativeWindowViewsExample native_window_views_example(this);
- tabbed_pane->AddTab(native_window_views_example.GetExampleTitle(),
- native_window_views_example.GetExampleView());
-
examples::TextfieldExample textfield_example(this);
tabbed_pane->AddTab(textfield_example.GetExampleTitle(),
textfield_example.GetExampleView());
diff --git a/views/examples/examples_main.h b/views/examples/examples_main.h
index db4b86c..ce2124d 100644
--- a/views/examples/examples_main.h
+++ b/views/examples/examples_main.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget_delegate.h"
namespace views {
class Label;
@@ -19,15 +19,17 @@ class View;
namespace examples {
// ExamplesMainBase creates all view examples and start event loop.
-class ExamplesMain : public views::WindowDelegate {
+class ExamplesMain : public views::WidgetDelegate {
public:
ExamplesMain();
virtual ~ExamplesMain();
- // views::WindowDelegate implementation:
- virtual bool CanResize() const;
- virtual views::View* GetContentsView();
- virtual void WindowClosing();
+ // views::WidgetDelegate implementation:
+ virtual bool CanResize() const OVERRIDE;
+ virtual views::View* GetContentsView() OVERRIDE;
+ virtual void WindowClosing() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
// Prints a message in the status area, at the bottom of the window.
void SetStatus(const std::wstring& status);
diff --git a/views/examples/native_window_views_example.cc b/views/examples/native_window_views_example.cc
deleted file mode 100644
index b5291de..0000000
--- a/views/examples/native_window_views_example.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2011 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 "views/examples/native_window_views_example.h"
-
-#include "ui/gfx/canvas.h"
-#include "views/examples/example_base.h"
-#include "views/controls/button/text_button.h"
-#include "views/controls/label.h"
-#include "views/layout/grid_layout.h"
-#include "views/view.h"
-#include "views/window/native_window_views.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
-
-namespace examples {
-
-class WindowContentView : public views::View,
- public views::WindowDelegate,
- public views::ButtonListener {
- public:
- WindowContentView()
- : ALLOW_THIS_IN_INITIALIZER_LIST(
- button_(new views::TextButton(this, L"Click me!"))),
- label_(new views::Label(L"Some label")) {
- views::GridLayout* layout = new views::GridLayout(this);
- views::ColumnSet* columns = layout->AddColumnSet(0);
- columns->AddColumn(views::GridLayout::FILL,
- views::GridLayout::FILL,
- 1,
- views::GridLayout::USE_PREF,
- 0,
- 0);
- SetLayoutManager(layout);
- layout->StartRow(0, 0);
- layout->AddView(button_);
- layout->StartRow(1, 0);
- layout->AddView(label_);
- }
- virtual ~WindowContentView() {}
-
- // Overridden from views::View:
- virtual void OnPaint(gfx::Canvas* canvas) {
- canvas->FillRectInt(SK_ColorWHITE, 0, 0, width(), height());
- }
-
- // Overridden from views::WindowDelegate:
- virtual std::wstring GetWindowTitle() const {
- return L"Example NativeWindowViews";
- }
- virtual View* GetContentsView() {
- return this;
- }
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender, const views::Event& event) {
- if (sender == button_)
- label_->SetText(L"Button Clicked!");
- }
-
- private:
- views::TextButton* button_;
- views::Label* label_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowContentView);
-};
-
-NativeWindowViewsExample::NativeWindowViewsExample(ExamplesMain* main)
- : ExampleBase(main) {
-}
-
-NativeWindowViewsExample::~NativeWindowViewsExample() {
-}
-
-std::wstring NativeWindowViewsExample::GetExampleTitle() {
- return L"NativeWindowViews";
-}
-
-void NativeWindowViewsExample::CreateExampleView(views::View* container) {
- views::Window* window = new views::Window;
- views::NativeWindowViews* nwv =
- new views::NativeWindowViews(container, window);
- views::Window::InitParams params(new WindowContentView);
- params.native_window = nwv;
- params.widget_init_params.bounds = gfx::Rect(20, 20, 600, 300);
- window->InitWindow(params);
- window->Show();
-}
-
-} // namespace examples
diff --git a/views/examples/native_window_views_example.h b/views/examples/native_window_views_example.h
deleted file mode 100644
index 361fdf8..0000000
--- a/views/examples/native_window_views_example.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_EXAMPLES_NATIVE_WINDOW_VIEWS_EXAMPLE_H_
-#define VIEWS_EXAMPLES_NATIVE_WINDOW_VIEWS_EXAMPLE_H_
-#pragma once
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "views/examples/example_base.h"
-
-namespace examples {
-
-class NativeWindowViewsExample : public ExampleBase {
- public:
- explicit NativeWindowViewsExample(ExamplesMain* main);
- virtual ~NativeWindowViewsExample();
-
- // Overridden from ExampleBase:
- virtual std::wstring GetExampleTitle() OVERRIDE;
- virtual void CreateExampleView(views::View* container) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NativeWindowViewsExample);
-};
-
-} // namespace examples
-
-#endif // VIEWS_EXAMPLES_NATIVE_WINDOW_VIEWS_EXAMPLE_H_
diff --git a/views/focus/accelerator_handler_gtk_unittest.cc b/views/focus/accelerator_handler_gtk_unittest.cc
index 3996e77..6a3eebaf 100644
--- a/views/focus/accelerator_handler_gtk_unittest.cc
+++ b/views/focus/accelerator_handler_gtk_unittest.cc
@@ -9,14 +9,14 @@
#include "views/focus/accelerator_handler.h"
#include "views/focus/focus_manager.h"
#include "views/view.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
namespace views {
class AcceleratorHandlerGtkTest
: public testing::Test,
- public WindowDelegate,
+ public WidgetDelegate,
public AcceleratorTarget {
public:
AcceleratorHandlerGtkTest()
@@ -26,8 +26,7 @@ class AcceleratorHandlerGtkTest
}
virtual void SetUp() {
- window_ = Window::CreateChromeWindow(
- NULL, gfx::Rect(0, 0, 500, 500), this);
+ window_ = Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 500, 500));
window_->Show();
FocusManager* focus_manager = window_->GetFocusManager();
focus_manager->RegisterAccelerator(kMenuAccelerator, this);
@@ -67,12 +66,18 @@ class AcceleratorHandlerGtkTest
return true;
}
- // WindowDelegate Implementation.
+ // WidgetDelegate Implementation.
virtual View* GetContentsView() {
if (!content_view_)
content_view_ = new View();
return content_view_;
}
+ virtual const views::Widget* GetWidget() const {
+ return content_view_->GetWidget();
+ }
+ virtual views::Widget* GetWidget() {
+ return content_view_->GetWidget();
+ }
virtual void InitContentView() {
}
@@ -84,7 +89,7 @@ class AcceleratorHandlerGtkTest
private:
Accelerator kMenuAccelerator;
Accelerator kHomepageAccelerator;
- Window* window_;
+ Widget* window_;
View* content_view_;
MessageLoopForUI message_loop_;
DISALLOW_COPY_AND_ASSIGN(AcceleratorHandlerGtkTest);
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index a40b6c3..7ea323e 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -28,9 +28,9 @@
#include "views/controls/textfield/textfield.h"
#include "views/focus/accelerator_handler.h"
#include "views/widget/root_view.h"
+#include "views/widget/widget.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/non_client_view.h"
-#include "views/window/window.h"
-#include "views/window/window_delegate.h"
#if defined(OS_LINUX)
#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
@@ -99,7 +99,7 @@ const int kThumbnailSuperStarID = count++;
namespace views {
-class FocusManagerTest : public testing::Test, public WindowDelegate {
+class FocusManagerTest : public testing::Test, public WidgetDelegate {
public:
FocusManagerTest()
: window_(NULL),
@@ -117,7 +117,7 @@ class FocusManagerTest : public testing::Test, public WindowDelegate {
}
virtual void SetUp() {
- window_ = Window::CreateChromeWindow(NULL, bounds(), this);
+ window_ = Widget::CreateWindowWithBounds(this, bounds());
InitContentView();
window_->Show();
}
@@ -151,7 +151,7 @@ class FocusManagerTest : public testing::Test, public WindowDelegate {
#endif
}
- // WindowDelegate Implementation.
+ // WidgetDelegate Implementation.
virtual View* GetContentsView() {
if (!content_view_)
content_view_ = new View();
@@ -188,7 +188,7 @@ class FocusManagerTest : public testing::Test, public WindowDelegate {
MessageLoopForUI* message_loop() { return &message_loop_; }
- Window* window_;
+ Widget* window_;
View* content_view_;
void AddFocusChangeListener(FocusChangeListener* listener) {
@@ -1664,15 +1664,16 @@ class FocusManagerDtorTest : public FocusManagerTest {
DtorTrackVector* dtor_tracker_;
};
- class WindowDtorTracked : public Window {
+ class WindowDtorTracked : public Widget {
public:
- WindowDtorTracked(WindowDelegate* window_delegate,
+ WindowDtorTracked(WidgetDelegate* widget_delegate,
DtorTrackVector* dtor_tracker)
: dtor_tracker_(dtor_tracker) {
tracked_focus_manager_ = new FocusManagerDtorTracked(this, dtor_tracker_);
- Window::InitParams params(window_delegate);
- params.widget_init_params.bounds = gfx::Rect(0, 0, 100, 100);
- InitWindow(params);
+ Widget::InitParams params;
+ params.delegate = widget_delegate;
+ params.bounds = gfx::Rect(0, 0, 100, 100);
+ Init(params);
ReplaceFocusManager(tracked_focus_manager_);
}
diff --git a/views/mouse_watcher.cc b/views/mouse_watcher.cc
index f5a4726..09aaa8a 100644
--- a/views/mouse_watcher.cc
+++ b/views/mouse_watcher.cc
@@ -9,7 +9,7 @@
#include "base/task.h"
#include "views/screen.h"
#include "views/view.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace views {
diff --git a/views/test/test_views_delegate.cc b/views/test/test_views_delegate.cc
index 37a7797..077f6f0 100644
--- a/views/test/test_views_delegate.cc
+++ b/views/test/test_views_delegate.cc
@@ -23,13 +23,13 @@ ui::Clipboard* TestViewsDelegate::GetClipboard() const {
}
-bool TestViewsDelegate::GetSavedWindowBounds(views::Window* window,
+bool TestViewsDelegate::GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const {
return false;
}
-bool TestViewsDelegate::GetSavedMaximizedState(views::Window* window,
+bool TestViewsDelegate::GetSavedMaximizedState(const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const {
return false;
diff --git a/views/test/test_views_delegate.h b/views/test/test_views_delegate.h
index b7ffabe..45a2341 100644
--- a/views/test/test_views_delegate.h
+++ b/views/test/test_views_delegate.h
@@ -11,7 +11,7 @@
#include "views/views_delegate.h"
namespace views {
-class Window;
+class Widget;
}
class TestViewsDelegate : public views::ViewsDelegate {
@@ -21,15 +21,15 @@ class TestViewsDelegate : public views::ViewsDelegate {
// Overridden from views::ViewsDelegate:
virtual ui::Clipboard* GetClipboard() const;
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) OVERRIDE { }
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const views::Widget* window,
const std::wstring& window_name,
gfx::Rect* bounds) const;
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const views::Widget* window,
const std::wstring& window_name,
bool* maximized) const;
diff --git a/views/view.cc b/views/view.cc
index ddf81bf..edc0178 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -24,7 +24,6 @@
#include "views/widget/root_view.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "base/win/scoped_gdi_object.h"
diff --git a/views/view.h b/views/view.h
index 30efeac0..618c53d 100644
--- a/views/view.h
+++ b/views/view.h
@@ -55,7 +55,6 @@ class LayoutManager;
class ScrollView;
class TextInputClient;
class Widget;
-class Window;
namespace internal {
class RootView;
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 7cb8266..b6dc1ed 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -28,7 +28,6 @@
#include "views/widget/native_widget.h"
#include "views/widget/root_view.h"
#include "views/window/dialog_delegate.h"
-#include "views/window/window.h"
#if defined(OS_WIN)
#include "views/controls/button/native_button_win.h"
@@ -1076,9 +1075,9 @@ class TestViewWithControls : public View {
Textfield* text_field_;
};
-class SimpleWindowDelegate : public WindowDelegate {
+class SimpleWidgetDelegate : public WidgetDelegate {
public:
- explicit SimpleWindowDelegate(View* contents) : contents_(contents) { }
+ explicit SimpleWidgetDelegate(View* contents) : contents_(contents) { }
virtual void DeleteDelegate() { delete this; }
@@ -1099,15 +1098,15 @@ class SimpleWindowDelegate : public WindowDelegate {
// area that it opens the test windows. --beng
TEST_F(ViewTest, DISABLED_RerouteMouseWheelTest) {
TestViewWithControls* view_with_controls = new TestViewWithControls();
- Window* window1 = Window::CreateChromeWindow(
- NULL, gfx::Rect(0, 0, 100, 100),
- new SimpleWindowDelegate(view_with_controls));
+ Widget* window1 = Widget::CreateWindowWithBounds(
+ new SimpleWidgetDelegate(view_with_controls),
+ gfx::Rect(0, 0, 100, 100));
window1->Show();
ScrollView* scroll_view = new ScrollView();
scroll_view->SetContents(new ScrollableTestView());
- Window* window2 = Window::CreateChromeWindow(
- NULL, gfx::Rect(200, 200, 100, 100),
- new SimpleWindowDelegate(scroll_view));
+ Widget* window2 = Widget::CreateWindowWithBounds(
+ new SimpleWidgetDelegate(scroll_view),
+ gfx::Rect(200, 200, 100, 100));
window2->Show();
EXPECT_EQ(0, scroll_view->GetVisibleRect().y());
@@ -1197,11 +1196,11 @@ class TestDialog : public DialogDelegate, public ButtonListener {
}
// DialogDelegate implementation:
- virtual int GetDefaultDialogButton() const {
+ virtual int GetDefaultDialogButton() const OVERRIDE {
return MessageBoxFlags::DIALOGBUTTON_OK;
}
- virtual View* GetContentsView() {
+ virtual View* GetContentsView() OVERRIDE {
if (!contents_) {
contents_ = new View();
button1_ = new NativeButtonBase(this, L"Button1");
@@ -1218,17 +1217,24 @@ class TestDialog : public DialogDelegate, public ButtonListener {
// Prevent the dialog from really closing (so we can click the OK/Cancel
// buttons to our heart's content).
- virtual bool Cancel() {
+ virtual bool Cancel() OVERRIDE {
canceled_ = true;
return false;
}
- virtual bool Accept() {
+ virtual bool Accept() OVERRIDE {
oked_ = true;
return false;
}
+ virtual Widget* GetWidget() OVERRIDE {
+ return widget_;
+ }
+ virtual const Widget* GetWidget() const OVERRIDE {
+ return widget_;
+ }
+
// ButtonListener implementation.
- virtual void ButtonPressed(Button* sender, const Event& event) {
+ virtual void ButtonPressed(Button* sender, const Event& event) OVERRIDE {
last_pressed_button_ = sender;
}
@@ -1259,6 +1265,7 @@ class TestDialog : public DialogDelegate, public ButtonListener {
bool canceled_;
bool oked_;
+ Widget* widget_;
};
class DefaultButtonTest : public ViewTest {
@@ -1280,8 +1287,9 @@ class DefaultButtonTest : public ViewTest {
virtual void SetUp() {
test_dialog_ = new TestDialog(NULL);
- Window* window = Window::CreateChromeWindow(NULL, gfx::Rect(0, 0, 100, 100),
- test_dialog_);
+ Widget* window =
+ Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100));
+ test_dialog_->widget_ = window;
window->Show();
focus_manager_ = test_dialog_->contents_->GetFocusManager();
ASSERT_TRUE(focus_manager_ != NULL);
@@ -1384,8 +1392,9 @@ class ButtonDropDownTest : public ViewTest {
virtual void SetUp() {
test_dialog_ = new TestDialog(&mock_menu_model_);
- Window* window = Window::CreateChromeWindow(NULL, gfx::Rect(0, 0, 100, 100),
- test_dialog_);
+ Widget* window =
+ Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100));
+ test_dialog_->widget_ = window;
window->Show();
test_dialog_->button_drop_->SetBounds(0, 0, 100, 100);
// We have to cast the button back into a View in order to invoke it's
@@ -1479,7 +1488,7 @@ class TestChangeNativeViewHierarchy {
host_->GetRootView()->AddChildView(native_host_);
for (size_t i = 0; i < TestNativeViewHierarchy::kTotalViews; ++i) {
windows_[i] = new Widget;
- Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
+ Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
params.parent = host_->GetNativeView();
params.bounds = gfx::Rect(0, 0, 500, 300);
windows_[i]->Init(params);
@@ -1499,7 +1508,7 @@ class TestChangeNativeViewHierarchy {
}
void CheckEnumeratingNativeWidgets() {
- if (!host_->GetContainingWindow())
+ if (!host_->GetTopLevelWidget())
return;
NativeWidget::NativeWidgets widgets;
NativeWidget::GetAllNativeWidgets(host_->GetNativeView(), &widgets);
diff --git a/views/views.gyp b/views/views.gyp
index 162d920..eeb67ee 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -388,20 +388,8 @@
'window/dialog_delegate.h',
'window/native_frame_view.cc',
'window/native_frame_view.h',
- 'window/native_window.h',
- 'window/native_window_delegate.h',
- 'window/native_window_gtk.cc',
- 'window/native_window_gtk.h',
- 'window/native_window_views.cc',
- 'window/native_window_views.h',
- 'window/native_window_win.cc',
- 'window/native_window_win.h',
'window/non_client_view.cc',
'window/non_client_view.h',
- 'window/window.cc',
- 'window/window.h',
- 'window/window_delegate.h',
- 'window/window_delegate.cc',
'window/window_resources.h',
'window/window_shape.cc',
'window/window_shape.h',
@@ -512,7 +500,6 @@
'widget/native_widget_test_utils_win.cc',
'widget/native_widget_unittest.cc',
'widget/native_widget_win_unittest.cc',
- 'window/native_window_win_unittest.cc',
'<(SHARED_INTERMEDIATE_DIR)/app/app_resources/app_resources.rc',
],
@@ -587,8 +574,6 @@
'examples/native_theme_checkbox_example.h',
'examples/native_widget_views_example.cc',
'examples/native_widget_views_example.h',
- 'examples/native_window_views_example.cc',
- 'examples/native_window_views_example.h',
'examples/radio_button_example.cc',
'examples/radio_button_example.h',
'examples/scroll_view_example.cc',
diff --git a/views/views_delegate.h b/views/views_delegate.h
index 3b53b67..e9f9113 100644
--- a/views/views_delegate.h
+++ b/views/views_delegate.h
@@ -24,7 +24,7 @@ class Clipboard;
namespace views {
class View;
-class Window;
+class Widget;
// ViewsDelegate is an interface implemented by an object using the views
// framework. It is used to obtain various high level application utilities
@@ -41,20 +41,20 @@ class ViewsDelegate {
// Saves the position, size and maximized state for the window with the
// specified name.
- virtual void SaveWindowPlacement(views::Window* window,
+ virtual void SaveWindowPlacement(const Widget* widget,
const std::wstring& window_name,
const gfx::Rect& bounds,
bool maximized) = 0;
// Retrieves the saved position and size for the window with the specified
// name.
- virtual bool GetSavedWindowBounds(views::Window* window,
+ virtual bool GetSavedWindowBounds(const Widget* widget,
const std::wstring& window_name,
gfx::Rect* bounds) const = 0;
// Retrieves the saved maximized state for the window with the specified
// name.
- virtual bool GetSavedMaximizedState(views::Window* window,
+ virtual bool GetSavedMaximizedState(const Widget* widget,
const std::wstring& window_name,
bool* maximized) const = 0;
diff --git a/views/widget/native_widget.h b/views/widget/native_widget.h
index c410110..1e5b2df 100644
--- a/views/widget/native_widget.h
+++ b/views/widget/native_widget.h
@@ -83,10 +83,6 @@ class NativeWidget {
virtual gfx::NativeView GetNativeView() const = 0;
virtual gfx::NativeWindow GetNativeWindow() const = 0;
- // Returns the enclosing Window, or NULL if there is no enclosing Window.
- virtual Window* GetContainingWindow() = 0;
- virtual const Window* GetContainingWindow() const = 0;
-
// Notifies the NativeWidget that a view was removed from the Widget's view
// hierarchy.
virtual void ViewRemoved(View* view) = 0;
@@ -95,7 +91,7 @@ class NativeWidget {
// Returns NULL if the property does not exist. Setting the property value to
// NULL removes the property.
virtual void SetNativeWindowProperty(const char* name, void* value) = 0;
- virtual void* GetNativeWindowProperty(const char* name) = 0;
+ virtual void* GetNativeWindowProperty(const char* name) const = 0;
// Returns the native widget's tooltip manager. Called from the View hierarchy
// to update tooltips.
diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc
index 251177c..c54e96e 100644
--- a/views/widget/native_widget_gtk.cc
+++ b/views/widget/native_widget_gtk.cc
@@ -38,7 +38,6 @@
#include "views/widget/tooltip_manager_gtk.h"
#include "views/widget/widget_delegate.h"
#include "views/window/hit_test.h"
-#include "views/window/native_window_gtk.h"
#if defined(TOUCH_UI)
#if defined(HAVE_XINPUT2)
@@ -353,9 +352,7 @@ GtkWidget* NativeWidgetGtk::null_parent_ = NULL;
// NativeWidgetGtk, public:
NativeWidgetGtk::NativeWidgetGtk(internal::NativeWidgetDelegate* delegate)
- : is_window_(false),
- window_state_(GDK_WINDOW_STATE_WITHDRAWN),
- delegate_(delegate),
+ : delegate_(delegate),
widget_(NULL),
window_contents_(NULL),
child_(false),
@@ -366,6 +363,7 @@ NativeWidgetGtk::NativeWidgetGtk(internal::NativeWidgetDelegate* delegate)
ignore_drag_leave_(false),
opacity_(255),
drag_data_(NULL),
+ window_state_(GDK_WINDOW_STATE_WITHDRAWN),
is_active_(false),
transient_to_parent_(false),
got_initial_focus_in_(false),
@@ -851,14 +849,6 @@ gfx::NativeWindow NativeWidgetGtk::GetNativeWindow() const {
return child_ ? NULL : GTK_WINDOW(widget_);
}
-Window* NativeWidgetGtk::GetContainingWindow() {
- return GetWindowImpl(widget_);
-}
-
-const Window* NativeWidgetGtk::GetContainingWindow() const {
- return GetWindowImpl(widget_);
-}
-
void NativeWidgetGtk::ViewRemoved(View* view) {
if (drop_target_.get())
drop_target_->ResetTargetViewIfEquals(view);
@@ -868,7 +858,7 @@ void NativeWidgetGtk::SetNativeWindowProperty(const char* name, void* value) {
g_object_set_data(G_OBJECT(widget_), name, value);
}
-void* NativeWidgetGtk::GetNativeWindowProperty(const char* name) {
+void* NativeWidgetGtk::GetNativeWindowProperty(const char* name) const {
return g_object_get_data(G_OBJECT(widget_), name);
}
@@ -1774,19 +1764,6 @@ gboolean NativeWidgetGtk::ChildExposeHandler(GtkWidget* widget,
return false;
}
-// static
-Window* NativeWidgetGtk::GetWindowImpl(GtkWidget* widget) {
- GtkWidget* parent = widget;
- while (parent) {
- NativeWidgetGtk* widget_gtk = static_cast<NativeWidgetGtk*>(
- NativeWidget::GetNativeWidgetForNativeView(parent));
- if (widget_gtk && widget_gtk->is_window_)
- return static_cast<NativeWindowGtk*>(widget_gtk)->GetWindow();
- parent = gtk_widget_get_parent(parent);
- }
- return NULL;
-}
-
void NativeWidgetGtk::CreateGtkWidget(const Widget::InitParams& params) {
// We turn off double buffering for two reasons:
// 1. We draw to a canvas then composite to the screen, which means we're
diff --git a/views/widget/native_widget_gtk.h b/views/widget/native_widget_gtk.h
index 85426aa..559d98c 100644
--- a/views/widget/native_widget_gtk.h
+++ b/views/widget/native_widget_gtk.h
@@ -163,11 +163,9 @@ class NativeWidgetGtk : public NativeWidget,
virtual const Widget* GetWidget() const OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual Window* GetContainingWindow() OVERRIDE;
- virtual const Window* GetContainingWindow() const OVERRIDE;
virtual void ViewRemoved(View* view) OVERRIDE;
virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
- virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
+ virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
virtual TooltipManager* GetTooltipManager() const OVERRIDE;
virtual bool IsScreenReaderActive() const OVERRIDE;
virtual void SendNativeAccessibilityEvent(
@@ -301,13 +299,6 @@ class NativeWidgetGtk : public NativeWidget,
// when a window holding grab is closed without releasing grab.
virtual void HandleXGrabBroke();
- // Are we a subclass of NativeWindowGtk?
- bool is_window_;
-
- // State of the window, such as fullscreen, hidden...
- // TODO(beng): move to private once NativeWindowGtk no longer refers to it.
- GdkWindowState window_state_;
-
private:
class DropObserver;
friend class DropObserver;
@@ -329,9 +320,6 @@ class NativeWidgetGtk : public NativeWidget,
void OnChildExpose(GtkWidget* child);
static gboolean ChildExposeHandler(GtkWidget* widget, GdkEventExpose* event);
- // Returns the first ancestor of |widget| that is a window.
- static Window* GetWindowImpl(GtkWidget* widget);
-
// Creates the GtkWidget.
void CreateGtkWidget(const Widget::InitParams& params);
@@ -403,6 +391,9 @@ class NativeWidgetGtk : public NativeWidget,
// region to be painted to flash in red.
static bool debug_paint_enabled_;
+ // State of the window, such as fullscreen, hidden...
+ GdkWindowState window_state_;
+
// Are we active?
bool is_active_;
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
index f46f0e6..3f400c4 100644
--- a/views/widget/native_widget_views.cc
+++ b/views/widget/native_widget_views.cc
@@ -79,14 +79,6 @@ gfx::NativeWindow NativeWidgetViews::GetNativeWindow() const {
return GetParentNativeWidget()->GetNativeWindow();
}
-Window* NativeWidgetViews::GetContainingWindow() {
- return view_->GetWidget()->AsWindow();
-}
-
-const Window* NativeWidgetViews::GetContainingWindow() const {
- return view_->GetWidget()->AsWindow();
-}
-
void NativeWidgetViews::ViewRemoved(View* view) {
return GetParentNativeWidget()->ViewRemoved(view);
}
@@ -95,7 +87,7 @@ void NativeWidgetViews::SetNativeWindowProperty(const char* name, void* value) {
NOTIMPLEMENTED();
}
-void* NativeWidgetViews::GetNativeWindowProperty(const char* name) {
+void* NativeWidgetViews::GetNativeWindowProperty(const char* name) const {
NOTIMPLEMENTED();
return NULL;
}
diff --git a/views/widget/native_widget_views.h b/views/widget/native_widget_views.h
index cbc910a..1b0a47f 100644
--- a/views/widget/native_widget_views.h
+++ b/views/widget/native_widget_views.h
@@ -43,11 +43,9 @@ class NativeWidgetViews : public NativeWidget {
virtual const Widget* GetWidget() const OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual Window* GetContainingWindow() OVERRIDE;
- virtual const Window* GetContainingWindow() const OVERRIDE;
virtual void ViewRemoved(View* view) OVERRIDE;
virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
- virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
+ virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
virtual TooltipManager* GetTooltipManager() const OVERRIDE;
virtual bool IsScreenReaderActive() const OVERRIDE;
virtual void SendNativeAccessibilityEvent(
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index d06b47e..997d50f 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -42,7 +42,6 @@
#include "views/widget/root_view.h"
#include "views/widget/widget_delegate.h"
#include "views/window/native_frame_view.h"
-#include "views/window/native_window_win.h"
#pragma comment(lib, "dwmapi.lib")
@@ -50,6 +49,47 @@ using ui::ViewProp;
namespace views {
+namespace internal {
+
+void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
+ gfx::Rect* child_rect,
+ int padding) {
+ DCHECK(child_rect);
+
+ // We use padding here because it allows some of the original web page to
+ // bleed through around the edges.
+ int twice_padding = padding * 2;
+
+ // FIRST, clamp width and height so we don't open child windows larger than
+ // the containing parent.
+ if (child_rect->width() > (parent_rect.width() + twice_padding))
+ child_rect->set_width(std::max(0, parent_rect.width() - twice_padding));
+ if (child_rect->height() > parent_rect.height() + twice_padding)
+ child_rect->set_height(std::max(0, parent_rect.height() - twice_padding));
+
+ // SECOND, clamp x,y position to padding,padding so we don't position child
+ // windows in hyperspace.
+ // TODO(mpcomplete): I don't see what the second check in each 'if' does that
+ // isn't handled by the LAST set of 'ifs'. Maybe we can remove it.
+ if (child_rect->x() < parent_rect.x() ||
+ child_rect->x() > parent_rect.right()) {
+ child_rect->set_x(parent_rect.x() + padding);
+ }
+ if (child_rect->y() < parent_rect.y() ||
+ child_rect->y() > parent_rect.bottom()) {
+ child_rect->set_y(parent_rect.y() + padding);
+ }
+
+ // LAST, nudge the window back up into the client area if its x,y position is
+ // within the parent bounds but its width/height place it off-screen.
+ if (child_rect->bottom() > parent_rect.bottom())
+ child_rect->set_y(parent_rect.bottom() - child_rect->height() - padding);
+ if (child_rect->right() > parent_rect.right())
+ child_rect->set_x(parent_rect.right() - child_rect->width() - padding);
+}
+
+} // namespace internal
+
namespace {
// Returns whether the specified window is the current active window.
@@ -328,8 +368,7 @@ class NativeWidgetWin::ScopedRedrawLock {
// NativeWidgetWin, public:
NativeWidgetWin::NativeWidgetWin(internal::NativeWidgetDelegate* delegate)
- : is_window_(false),
- delegate_(delegate),
+ : delegate_(delegate),
close_widget_factory_(this),
active_mouse_tracking_flags_(0),
use_layered_buffer_(false),
@@ -514,14 +553,6 @@ gfx::NativeWindow NativeWidgetWin::GetNativeWindow() const {
return WindowImpl::hwnd();
}
-Window* NativeWidgetWin::GetContainingWindow() {
- return GetWindowImpl(hwnd());
-}
-
-const Window* NativeWidgetWin::GetContainingWindow() const {
- return GetWindowImpl(hwnd());
-}
-
void NativeWidgetWin::ViewRemoved(View* view) {
if (drop_target_.get())
drop_target_->ResetTargetViewIfEquals(view);
@@ -542,7 +573,7 @@ void NativeWidgetWin::SetNativeWindowProperty(const char* name, void* value) {
props_.push_back(new ViewProp(hwnd(), name, value));
}
-void* NativeWidgetWin::GetNativeWindowProperty(const char* name) {
+void* NativeWidgetWin::GetNativeWindowProperty(const char* name) const {
return ViewProp::GetValue(hwnd(), name);
}
@@ -1156,8 +1187,8 @@ LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) {
// Windows special DWM window frame requires a special tooltip manager so
// that window controls in Chrome windows don't flicker when you move your
// mouse over them. See comment in aero_tooltip_manager.h.
- Window* window = GetWidget()->GetContainingWindow();
- if (window && window->ShouldUseNativeFrame()) {
+ Widget* widget = GetWidget()->GetTopLevelWidget();
+ if (widget && widget->ShouldUseNativeFrame()) {
tooltip_manager_.reset(new AeroTooltipManager(GetWidget()));
} else {
tooltip_manager_.reset(new TooltipManagerWin(GetWidget()));
@@ -2094,21 +2125,6 @@ void NativeWidgetWin::ExecuteSystemMenuCommand(int command) {
// NativeWidgetWin, private:
// static
-Window* NativeWidgetWin::GetWindowImpl(HWND hwnd) {
- // NOTE: we can't use GetAncestor here as constrained windows are a Window,
- // but not a top level window.
- HWND parent = hwnd;
- while (parent) {
- NativeWidgetWin* widget =
- reinterpret_cast<NativeWidgetWin*>(ui::GetWindowUserData(parent));
- if (widget && widget->is_window_)
- return static_cast<NativeWindowWin*>(widget)->GetWindow();
- parent = ::GetParent(parent);
- }
- return NULL;
-}
-
-// static
void NativeWidgetWin::PostProcessActivateMessage(NativeWidgetWin* widget,
int activation_state) {
if (!widget->delegate_->HasFocusManager()) {
@@ -2257,8 +2273,8 @@ void NativeWidgetWin::UnlockUpdates() {
void NativeWidgetWin::ClientAreaSizeChanged() {
RECT r;
- Window* window = GetWidget()->GetContainingWindow();
- if (IsZoomed() || (window && window->ShouldUseNativeFrame()))
+ Widget* widget = GetWidget()->GetTopLevelWidget();
+ if (IsZoomed() || (widget && widget->ShouldUseNativeFrame()))
GetClientRect(&r);
else
GetWindowRect(&r);
diff --git a/views/widget/native_widget_win.h b/views/widget/native_widget_win.h
index 524fd84..5162988 100644
--- a/views/widget/native_widget_win.h
+++ b/views/widget/native_widget_win.h
@@ -39,11 +39,17 @@ namespace views {
class DropTargetWin;
class RootView;
class TooltipManagerWin;
-class Window;
namespace internal {
class NativeWidgetDelegate;
-}
+
+// This is exposed only for testing
+// Adjusts the value of |child_rect| if necessary to ensure that it is
+// completely visible within |parent_rect|.
+void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
+ gfx::Rect* child_rect,
+ int padding);
+} // namespace internal
// A Windows message reflected from other windows. This message is sent
// with the following arguments:
@@ -191,11 +197,9 @@ class NativeWidgetWin : public ui::WindowImpl,
virtual const Widget* GetWidget() const OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
- virtual Window* GetContainingWindow() OVERRIDE;
- virtual const Window* GetContainingWindow() const OVERRIDE;
virtual void ViewRemoved(View* view) OVERRIDE;
virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
- virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
+ virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE;
virtual TooltipManager* GetTooltipManager() const OVERRIDE;
virtual bool IsScreenReaderActive() const OVERRIDE;
virtual void SendNativeAccessibilityEvent(
@@ -469,9 +473,6 @@ class NativeWidgetWin : public ui::WindowImpl,
scoped_refptr<DropTargetWin> drop_target_;
- // Are a subclass of NativeWindowWin?
- bool is_window_;
-
const gfx::Rect& invalid_rect() const { return invalid_rect_; }
// Saved window information from before entering fullscreen mode.
@@ -481,10 +482,6 @@ class NativeWidgetWin : public ui::WindowImpl,
private:
typedef ScopedVector<ui::ViewProp> ViewProps;
- // Implementation of GetWindow. Ascends the parents of |hwnd| returning the
- // first ancestor that is a Window.
- static Window* GetWindowImpl(HWND hwnd);
-
// Called after the WM_ACTIVATE message has been processed by the default
// windows procedure.
static void PostProcessActivateMessage(NativeWidgetWin* widget,
diff --git a/views/widget/native_widget_win_unittest.cc b/views/widget/native_widget_win_unittest.cc
index f2465f4..d53ee59 100644
--- a/views/widget/native_widget_win_unittest.cc
+++ b/views/widget/native_widget_win_unittest.cc
@@ -82,5 +82,52 @@ TEST_F(NativeWidgetWinTest, SetBoundsForZoomedWindow) {
window2->CloseNow();
}
+TEST_F(NativeWidgetWinTest, EnsureRectIsVisibleInRect) {
+ gfx::Rect parent_rect(0, 0, 500, 400);
+
+ {
+ // Child rect x < 0
+ gfx::Rect child_rect(-50, 20, 100, 100);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(10, 20, 100, 100), child_rect);
+ }
+
+ {
+ // Child rect y < 0
+ gfx::Rect child_rect(20, -50, 100, 100);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(20, 10, 100, 100), child_rect);
+ }
+
+ {
+ // Child rect right > parent_rect.right
+ gfx::Rect child_rect(450, 20, 100, 100);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(390, 20, 100, 100), child_rect);
+ }
+
+ {
+ // Child rect bottom > parent_rect.bottom
+ gfx::Rect child_rect(20, 350, 100, 100);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(20, 290, 100, 100), child_rect);
+ }
+
+ {
+ // Child rect width > parent_rect.width
+ gfx::Rect child_rect(20, 20, 700, 100);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(20, 20, 480, 100), child_rect);
+ }
+
+ {
+ // Child rect height > parent_rect.height
+ gfx::Rect child_rect(20, 20, 100, 700);
+ internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
+ EXPECT_EQ(gfx::Rect(20, 20, 100, 380), child_rect);
+ }
+}
+
+
} // namespace
} // namespace views
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index ce9cc7a..1136908 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -15,7 +15,6 @@
#include "views/focus/view_storage.h"
#include "views/layout/fill_layout.h"
#include "views/widget/widget.h"
-#include "views/window/window.h"
#if defined(TOUCH_UI)
#include "views/touchui/gesture_manager.h"
diff --git a/views/widget/widget.cc b/views/widget/widget.cc
index 8638f7d..f282823 100644
--- a/views/widget/widget.cc
+++ b/views/widget/widget.cc
@@ -113,6 +113,38 @@ Widget::~Widget() {
}
// static
+Widget* Widget::CreateWindow(WidgetDelegate* delegate) {
+ return CreateWindowWithParentAndBounds(delegate, NULL, gfx::Rect());
+}
+
+// static
+Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate,
+ gfx::NativeWindow parent) {
+ return CreateWindowWithParentAndBounds(delegate, parent, gfx::Rect());
+}
+
+// static
+Widget* Widget::CreateWindowWithBounds(WidgetDelegate* delegate,
+ const gfx::Rect& bounds) {
+ return CreateWindowWithParentAndBounds(delegate, NULL, bounds);
+}
+
+// static
+Widget* Widget::CreateWindowWithParentAndBounds(WidgetDelegate* delegate,
+ gfx::NativeWindow parent,
+ const gfx::Rect& bounds) {
+ Widget* widget = new Widget;
+ Widget::InitParams params;
+ params.delegate = delegate;
+#if defined(OS_WIN)
+ params.parent = parent;
+#endif
+ params.bounds = bounds;
+ widget->Init(params);
+ return widget;
+}
+
+// static
void Widget::SetPureViews(bool pure) {
use_pure_views = pure;
}
@@ -186,14 +218,6 @@ bool Widget::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) {
return false;
}
-Window* Widget::GetContainingWindow() {
- return native_widget_->GetContainingWindow();
-}
-
-const Window* Widget::GetContainingWindow() const {
- return native_widget_->GetContainingWindow();
-}
-
void Widget::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (!is_add) {
if (child == dragged_view_)
@@ -219,14 +243,6 @@ void Widget::NotifyNativeViewHierarchyChanged(bool attached,
root_view_->NotifyNativeViewHierarchyChanged(attached, native_view);
}
-Window* Widget::AsWindow() {
- return NULL;
-}
-
-const Window* Widget::AsWindow() const {
- return NULL;
-}
-
// Converted methods (see header) ----------------------------------------------
Widget* Widget::GetTopLevelWidget() {
diff --git a/views/widget/widget.h b/views/widget/widget.h
index 9916d95c..42866f6 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -26,6 +26,9 @@
#if defined(IsMinimized)
#undef IsMinimized
#endif
+#if defined(CreateWindow)
+#undef CreateWindow
+#endif
#endif
namespace gfx {
@@ -52,7 +55,6 @@ class NonClientFrameView;
class TooltipManager;
class View;
class WidgetDelegate;
-class Window;
namespace internal {
class RootView;
}
@@ -143,6 +145,16 @@ class Widget : public internal::NativeWidgetDelegate,
Widget();
virtual ~Widget();
+ // Creates a decorated window Widget with the specified properties.
+ static Widget* CreateWindow(WidgetDelegate* delegate);
+ static Widget* CreateWindowWithParent(WidgetDelegate* delegate,
+ gfx::NativeWindow parent);
+ static Widget* CreateWindowWithBounds(WidgetDelegate* delegate,
+ const gfx::Rect& bounds);
+ static Widget* CreateWindowWithParentAndBounds(WidgetDelegate* delegate,
+ gfx::NativeWindow parent,
+ const gfx::Rect& bounds);
+
// Enumerates all windows pertaining to us and notifies their
// view hierarchies that the locale has changed.
static void NotifyLocaleChanged();
@@ -196,11 +208,6 @@ class Widget : public internal::NativeWidgetDelegate,
// no accelerator associated with a given id, which is a common condition.
virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator);
- // Returns the Window containing this Widget, or NULL if not contained in a
- // window.
- Window* GetContainingWindow();
- const Window* GetContainingWindow() const;
-
// Forwarded from the RootView so that the widget can do any cleanup.
void ViewHierarchyChanged(bool is_add, View* parent, View* child);
@@ -454,10 +461,6 @@ class Widget : public internal::NativeWidgetDelegate,
const NativeWidget* native_widget() const { return native_widget_; }
NativeWidget* native_widget() { return native_widget_; }
- // TODO(beng): remove once Window is folded in.
- virtual Window* AsWindow();
- virtual const Window* AsWindow() const;
-
// Overridden from NativeWidgetDelegate:
virtual bool IsModal() const OVERRIDE;
virtual bool IsDialogBox() const OVERRIDE;
diff --git a/views/widget/widget_delegate.cc b/views/widget/widget_delegate.cc
index f58e891..aecf12f 100644
--- a/views/widget/widget_delegate.cc
+++ b/views/widget/widget_delegate.cc
@@ -6,13 +6,16 @@
#include "views/view.h"
#include "views/views_delegate.h"
+#include "views/widget/widget.h"
#include "views/window/client_view.h"
-#include "views/window/window.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace views {
-WidgetDelegate::WidgetDelegate() : window_(NULL) {
+////////////////////////////////////////////////////////////////////////////////
+// WidgetDelegate:
+
+WidgetDelegate::WidgetDelegate() : default_contents_view_(NULL) {
}
void WidgetDelegate::OnWidgetActivated(bool active) {
@@ -104,35 +107,43 @@ void WidgetDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
return;
ViewsDelegate::views_delegate->SaveWindowPlacement(
- window_, window_name, bounds, maximized);
+ GetWidget(), window_name, bounds, maximized);
}
bool WidgetDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const {
- DCHECK(window_);
std::wstring window_name = GetWindowName();
if (!ViewsDelegate::views_delegate || window_name.empty())
return false;
return ViewsDelegate::views_delegate->GetSavedWindowBounds(
- window_, window_name, bounds);
+ GetWidget(), window_name, bounds);
}
bool WidgetDelegate::GetSavedMaximizedState(bool* maximized) const {
- DCHECK(window_);
std::wstring window_name = GetWindowName();
if (!ViewsDelegate::views_delegate || window_name.empty())
return false;
return ViewsDelegate::views_delegate->GetSavedMaximizedState(
- window_, window_name, maximized);
+ GetWidget(), window_name, maximized);
}
bool WidgetDelegate::ShouldRestoreWindowSize() const {
return true;
}
+Widget* WidgetDelegate::GetWidget() {
+ return NULL;
+}
+
+const Widget* WidgetDelegate::GetWidget() const {
+ return NULL;
+}
+
View* WidgetDelegate::GetContentsView() {
- return new View;
+ if (!default_contents_view_)
+ default_contents_view_ = new View;
+ return default_contents_view_;
}
ClientView* WidgetDelegate::CreateClientView(Widget* widget) {
@@ -147,5 +158,22 @@ bool WidgetDelegate::WillProcessWorkAreaChange() const {
return false;
}
+////////////////////////////////////////////////////////////////////////////////
+// WidgetDelegateView:
+
+WidgetDelegateView::WidgetDelegateView() {
+}
+
+WidgetDelegateView::~WidgetDelegateView() {
+}
+
+Widget* WidgetDelegateView::GetWidget() {
+ return View::GetWidget();
+}
+
+const Widget* WidgetDelegateView::GetWidget() const {
+ return View::GetWidget();
+}
+
} // namespace views
diff --git a/views/widget/widget_delegate.h b/views/widget/widget_delegate.h
index a985051..8c9e069 100644
--- a/views/widget/widget_delegate.h
+++ b/views/widget/widget_delegate.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/base/accessibility/accessibility_types.h"
+#include "views/view.h"
class SkBitmap;
@@ -23,7 +24,6 @@ class DialogDelegate;
class NonClientFrameView;
class View;
class Widget;
-class Window;
// WidgetDelegate interface
// Handles events on Widgets in context-specific ways.
@@ -134,10 +134,14 @@ class WidgetDelegate {
virtual void OnWindowBeginUserBoundsChange() {}
virtual void OnWindowEndUserBoundsChange() {}
- // Returns the View that is contained within this Window.
+ // Returns the Widget associated with this delegate.
+ virtual Widget* GetWidget();
+ virtual const Widget* GetWidget() const;
+
+ // Returns the View that is contained within this Widget.
virtual View* GetContentsView();
- // Called by the Window to create the Client View used to host the contents
+ // Called by the Widget to create the Client View used to host the contents
// of the widget.
virtual ClientView* CreateClientView(Widget* widget);
@@ -151,15 +155,30 @@ class WidgetDelegate {
// manage the positions by ourselves.
virtual bool WillProcessWorkAreaChange() const;
- Window* window() const { return window_; }
-
protected:
virtual ~WidgetDelegate() {}
private:
- friend class Window;
- // The Window this delegate is bound to. Weak reference.
- Window* window_;
+ View* default_contents_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(WidgetDelegate);
+};
+
+// A WidgetDelegate implementation that is-a View. Used to override GetWidget()
+// to call View's GetWidget() for the common case where a WidgetDelegate
+// implementation is-a View.
+class WidgetDelegateView : public WidgetDelegate,
+ public View {
+ public:
+ WidgetDelegateView();
+ virtual ~WidgetDelegateView();
+
+ // Overridden from WidgetDelegate:
+ virtual Widget* GetWidget() OVERRIDE;
+ virtual const Widget* GetWidget() const OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView);
};
} // namespace views
diff --git a/views/window/client_view.cc b/views/window/client_view.cc
index bbea28c..6646727 100644
--- a/views/window/client_view.cc
+++ b/views/window/client_view.cc
@@ -33,6 +33,10 @@ DialogClientView* ClientView::AsDialogClientView() {
return NULL;
}
+const DialogClientView* ClientView::AsDialogClientView() const {
+ return NULL;
+}
+
bool ClientView::CanClose() {
return true;
}
diff --git a/views/window/client_view.h b/views/window/client_view.h
index de1ca7e..0af791e 100644
--- a/views/window/client_view.h
+++ b/views/window/client_view.h
@@ -35,6 +35,7 @@ class ClientView : public View {
// Manual RTTI ftw.
virtual DialogClientView* AsDialogClientView();
+ virtual const DialogClientView* AsDialogClientView() const;
// Returns true to signal that the Widget can be closed. Specialized
// ClientView subclasses can override this default behavior to allow the
diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc
index 6f9bb8f..ff59913 100644
--- a/views/window/custom_frame_view.cc
+++ b/views/window/custom_frame_view.cc
@@ -12,16 +12,16 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
#include "ui/gfx/path.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/client_view.h"
#include "views/window/window_shape.h"
-#include "views/window/window_delegate.h"
#if defined(OS_LINUX)
#include "views/window/hit_test.h"
#endif
#if defined(OS_WIN)
-#include "views/window/native_window_win.h"
+#include "views/widget/native_widget_win.h"
#endif
namespace views {
@@ -568,7 +568,7 @@ void CustomFrameView::InitClass() {
static bool initialized = false;
if (!initialized) {
#if defined(OS_WIN)
- title_font_ = new gfx::Font(NativeWindowWin::GetWindowTitleFont());
+ title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont());
#elif defined(OS_LINUX)
// TODO(ben): need to resolve what font this is.
title_font_ = new gfx::Font();
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index f4a3985..b17f370 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -302,6 +302,10 @@ DialogClientView* DialogClientView::AsDialogClientView() {
return this;
}
+const DialogClientView* DialogClientView::AsDialogClientView() const {
+ return this;
+}
+
////////////////////////////////////////////////////////////////////////////////
// DialogClientView, View overrides:
diff --git a/views/window/dialog_client_view.h b/views/window/dialog_client_view.h
index 27365b5..ad72e77 100644
--- a/views/window/dialog_client_view.h
+++ b/views/window/dialog_client_view.h
@@ -73,6 +73,7 @@ class DialogClientView : public ClientView,
virtual void WidgetClosing() OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
virtual DialogClientView* AsDialogClientView() OVERRIDE;
+ virtual const DialogClientView* AsDialogClientView() const OVERRIDE;
// FocusChangeListener implementation:
virtual void FocusWillChange(View* focused_before,
diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc
index ee22c12..13ff590 100644
--- a/views/window/dialog_delegate.cc
+++ b/views/window/dialog_delegate.cc
@@ -6,11 +6,12 @@
#include "base/logging.h"
#include "views/controls/button/native_button.h"
-#include "views/window/window.h"
+#include "views/widget/widget.h"
namespace views {
-// Overridden from WindowDelegate:
+////////////////////////////////////////////////////////////////////////////////
+// DialogDelegate:
DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; }
@@ -72,7 +73,7 @@ bool DialogDelegate::Accept() {
View* DialogDelegate::GetInitiallyFocusedView() {
// Focus the default button if any.
- DialogClientView* dcv = GetDialogClientView();
+ const DialogClientView* dcv = GetDialogClientView();
int default_button = GetDefaultDialogButton();
if (default_button == MessageBoxFlags::DIALOGBUTTON_NONE)
return NULL;
@@ -94,12 +95,33 @@ ClientView* DialogDelegate::CreateClientView(Widget* widget) {
return new DialogClientView(widget, GetContentsView());
}
-DialogClientView* DialogDelegate::GetDialogClientView() const {
- return window()->client_view()->AsDialogClientView();
+const DialogClientView* DialogDelegate::GetDialogClientView() const {
+ return GetWidget()->client_view()->AsDialogClientView();
+}
+
+DialogClientView* DialogDelegate::GetDialogClientView() {
+ return GetWidget()->client_view()->AsDialogClientView();
}
ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const {
return ui::AccessibilityTypes::ROLE_DIALOG;
}
+////////////////////////////////////////////////////////////////////////////////
+// DialogDelegateView:
+
+DialogDelegateView::DialogDelegateView() {
+}
+
+DialogDelegateView::~DialogDelegateView() {
+}
+
+Widget* DialogDelegateView::GetWidget() {
+ return View::GetWidget();
+}
+
+const Widget* DialogDelegateView::GetWidget() const {
+ return View::GetWidget();
+}
+
} // namespace views
diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h
index 607132b..bfcec75 100644
--- a/views/window/dialog_delegate.h
+++ b/views/window/dialog_delegate.h
@@ -8,8 +8,8 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/message_box_flags.h"
+#include "views/widget/widget_delegate.h"
#include "views/window/dialog_client_view.h"
-#include "views/window/window_delegate.h"
using ui::MessageBoxFlags;
@@ -27,7 +27,7 @@ class View;
// certain events.
//
///////////////////////////////////////////////////////////////////////////////
-class DialogDelegate : public WindowDelegate {
+class DialogDelegate : public WidgetDelegate {
public:
virtual DialogDelegate* AsDialogDelegate();
@@ -104,13 +104,32 @@ class DialogDelegate : public WindowDelegate {
// A helper for accessing the DialogClientView object contained by this
// delegate's Window.
- DialogClientView* GetDialogClientView() const;
+ const DialogClientView* GetDialogClientView() const;
+ DialogClientView* GetDialogClientView();
protected:
// Overridden from WindowDelegate:
virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE;
};
+// A DialogDelegate implementation that is-a View. Used to override GetWidget()
+// to call View's GetWidget() for the common case where a DialogDelegate
+// implementation is-a View.
+class DialogDelegateView : public DialogDelegate,
+ public View {
+ public:
+ DialogDelegateView();
+ virtual ~DialogDelegateView();
+
+ // Overridden from DialogDelegate:
+ virtual Widget* GetWidget() OVERRIDE;
+ virtual const Widget* GetWidget() const OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
+};
+
+
} // namespace views
#endif // VIEWS_WINDOW_DIALOG_DELEGATE_H_
diff --git a/views/window/native_window.h b/views/window/native_window.h
deleted file mode 100644
index de5cce8..0000000
--- a/views/window/native_window.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WINDOW_H_
-#define VIEWS_WIDGET_NATIVE_WINDOW_H_
-#pragma once
-
-#include "ui/base/accessibility/accessibility_types.h"
-#include "ui/gfx/native_widget_types.h"
-#include "views/window/window.h"
-
-class SkBitmap;
-
-namespace gfx {
-class Rect;
-class Size;
-}
-
-namespace views {
-
-class NativeWidget;
-class NonClientFrameView;
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow interface
-//
-// An interface implemented by an object that encapsulates a native window.
-//
-class NativeWindow {
- public:
- virtual ~NativeWindow() {}
-
- // Creates an appropriate default NativeWindow implementation for the current
- // OS/circumstance.
- static NativeWindow* CreateNativeWindow(
- internal::NativeWindowDelegate* delegate);
-
- virtual Window* GetWindow() = 0;
- virtual const Window* GetWindow() const = 0;
-
- virtual NativeWidget* AsNativeWidget() = 0;
- virtual const NativeWidget* AsNativeWidget() const = 0;
-
- protected:
- friend class Window;
-};
-
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WINDOW_H_
diff --git a/views/window/native_window_delegate.h b/views/window/native_window_delegate.h
deleted file mode 100644
index 41621ac..0000000
--- a/views/window/native_window_delegate.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
-#define VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
-#pragma once
-
-namespace ui {
-class ThemeProvider;
-}
-
-namespace views {
-namespace internal {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowDelegate interface
-//
-// An interface implemented by an object that receives notifications from a
-// NativeWindow implementation.
-//
-class NativeWindowDelegate {
- public:
- virtual ~NativeWindowDelegate() {}
-
- //
- virtual Window* AsWindow() = 0;
-
- //
- virtual NativeWidgetDelegate* AsNativeWidgetDelegate() = 0;
-};
-
-} // namespace internal
-} // namespace views
-
-#endif // VIEWS_WIDGET_NATIVE_WINDOW_DELEGATE_H_
diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc
deleted file mode 100644
index 2ca707a..0000000
--- a/views/window/native_window_gtk.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2011 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 "views/window/native_window_gtk.h"
-
-#include "base/i18n/rtl.h"
-#include "base/utf_string_conversions.h"
-#include "ui/gfx/path.h"
-#include "ui/gfx/rect.h"
-#include "views/events/event.h"
-#include "views/window/hit_test.h"
-#include "views/window/native_window_delegate.h"
-#include "views/window/non_client_view.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-
-NativeWindowGtk::NativeWindowGtk(internal::NativeWindowDelegate* delegate)
- : NativeWidgetGtk(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
- is_window_ = true;
-}
-
-NativeWindowGtk::~NativeWindowGtk() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowGtk, NativeWindow implementation:
-
-NativeWidget* NativeWindowGtk::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowGtk::AsNativeWidget() const {
- return this;
-}
-
-Window* NativeWindowGtk::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowGtk::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowGtk, private:
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow, public:
-
-// static
-NativeWindow* NativeWindow::CreateNativeWindow(
- internal::NativeWindowDelegate* delegate) {
- return new NativeWindowGtk(delegate);
-}
-
-} // namespace views
diff --git a/views/window/native_window_gtk.h b/views/window/native_window_gtk.h
deleted file mode 100644
index 9988a23..0000000
--- a/views/window/native_window_gtk.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "views/widget/native_widget_gtk.h"
-#include "views/window/native_window.h"
-
-namespace views {
-namespace internal {
-class NativeWindowDelegate;
-}
-
-// Window implementation for Gtk.
-class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow {
- public:
- explicit NativeWindowGtk(internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowGtk();
-
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
-
- protected:
- // Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
-
- // For the constructor.
- friend class Window;
-
- private:
- // A delegate implementation that handles events received here.
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowGtk);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_GTK_H_
diff --git a/views/window/native_window_views.cc b/views/window/native_window_views.cc
deleted file mode 100644
index 409380c..0000000
--- a/views/window/native_window_views.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 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 "views/window/native_window_views.h"
-
-#include "views/view.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews, public:
-
-NativeWindowViews::NativeWindowViews(View* host,
- internal::NativeWindowDelegate* delegate)
- : NativeWidgetViews(host, delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
-}
-
-NativeWindowViews::~NativeWindowViews() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews, NativeWindow implementation:
-
-Window* NativeWindowViews::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowViews::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-NativeWidget* NativeWindowViews::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowViews::AsNativeWidget() const {
- return this;
-}
-
-void NativeWindowViews::BecomeModal() {
- NOTIMPLEMENTED();
-}
-
-} // namespace views
diff --git a/views/window/native_window_views.h b/views/window/native_window_views.h
deleted file mode 100644
index f944c00..0000000
--- a/views/window/native_window_views.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
-#pragma once
-
-#include "base/message_loop.h"
-#include "views/window/native_window.h"
-#include "views/widget/native_widget_views.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowViews
-//
-// A NativeWindow implementation that uses another View as its native widget.
-//
-class NativeWindowViews : public NativeWidgetViews,
- public NativeWindow {
- public:
- NativeWindowViews(View* host, internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowViews();
-
- private:
- // Overridden from NativeWindow:
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
- virtual void BecomeModal() OVERRIDE;
-
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowViews);
-};
-
-}
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_VIEWS_H_
diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc
deleted file mode 100644
index a902d10..0000000
--- a/views/window/native_window_win.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2011 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 "views/window/native_window_win.h"
-
-#include "base/i18n/rtl.h"
-#include "ui/base/accessibility/accessibility_types.h"
-#include "ui/base/keycodes/keyboard_code_conversion_win.h"
-#include "ui/base/l10n/l10n_util_win.h"
-#include "ui/base/theme_provider.h"
-#include "ui/base/win/hwnd_util.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/path.h"
-#include "views/accessibility/native_view_accessibility_win.h"
-#include "views/window/client_view.h"
-#include "views/window/native_window_delegate.h"
-#include "views/window/non_client_view.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-namespace internal {
-
-void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
- gfx::Rect* child_rect,
- int padding) {
- DCHECK(child_rect);
-
- // We use padding here because it allows some of the original web page to
- // bleed through around the edges.
- int twice_padding = padding * 2;
-
- // FIRST, clamp width and height so we don't open child windows larger than
- // the containing parent.
- if (child_rect->width() > (parent_rect.width() + twice_padding))
- child_rect->set_width(std::max(0, parent_rect.width() - twice_padding));
- if (child_rect->height() > parent_rect.height() + twice_padding)
- child_rect->set_height(std::max(0, parent_rect.height() - twice_padding));
-
- // SECOND, clamp x,y position to padding,padding so we don't position child
- // windows in hyperspace.
- // TODO(mpcomplete): I don't see what the second check in each 'if' does that
- // isn't handled by the LAST set of 'ifs'. Maybe we can remove it.
- if (child_rect->x() < parent_rect.x() ||
- child_rect->x() > parent_rect.right()) {
- child_rect->set_x(parent_rect.x() + padding);
- }
- if (child_rect->y() < parent_rect.y() ||
- child_rect->y() > parent_rect.bottom()) {
- child_rect->set_y(parent_rect.y() + padding);
- }
-
- // LAST, nudge the window back up into the client area if its x,y position is
- // within the parent bounds but its width/height place it off-screen.
- if (child_rect->bottom() > parent_rect.bottom())
- child_rect->set_y(parent_rect.bottom() - child_rect->height() - padding);
- if (child_rect->right() > parent_rect.right())
- child_rect->set_x(parent_rect.right() - child_rect->width() - padding);
-}
-
-} // namespace internal
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowWin, public:
-
-NativeWindowWin::NativeWindowWin(internal::NativeWindowDelegate* delegate)
- : NativeWidgetWin(delegate->AsNativeWidgetDelegate()),
- delegate_(delegate) {
- is_window_ = true;
- // Initialize these values to 0 so that subclasses can override the default
- // behavior before calling Init.
- set_window_style(0);
- set_window_ex_style(0);
-}
-
-NativeWindowWin::~NativeWindowWin() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindowWin, NativeWindow implementation:
-
-Window* NativeWindowWin::GetWindow() {
- return delegate_->AsWindow();
-}
-
-const Window* NativeWindowWin::GetWindow() const {
- return delegate_->AsWindow();
-}
-
-NativeWidget* NativeWindowWin::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* NativeWindowWin::AsNativeWidget() const {
- return this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// NativeWindow, public:
-
-// static
-NativeWindow* NativeWindow::CreateNativeWindow(
- internal::NativeWindowDelegate* delegate) {
- return new NativeWindowWin(delegate);
-}
-
-} // namespace views
diff --git a/views/window/native_window_win.h b/views/window/native_window_win.h
deleted file mode 100644
index 956a3ac..0000000
--- a/views/window/native_window_win.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
-#define VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
-#pragma once
-
-#include "views/widget/native_widget_win.h"
-#include "views/window/native_window.h"
-
-namespace views {
-namespace internal {
-class NativeWindowDelegate;
-
-// This is exposed only for testing
-// Adjusts the value of |child_rect| if necessary to ensure that it is
-// completely visible within |parent_rect|.
-void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
- gfx::Rect* child_rect,
- int padding);
-
-} // namespace internal
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// NativeWindowWin
-//
-// A NativeWindowWin is a NativeWidgetWin that encapsulates a window with a
-// frame. The frame may or may not be rendered by the operating system. The
-// window may or may not be top level.
-//
-////////////////////////////////////////////////////////////////////////////////
-class NativeWindowWin : public NativeWidgetWin,
- public NativeWindow {
- public:
- explicit NativeWindowWin(internal::NativeWindowDelegate* delegate);
- virtual ~NativeWindowWin();
-
- // Overridden from NativeWindow:
- virtual Window* GetWindow() OVERRIDE;
- virtual const Window* GetWindow() const OVERRIDE;
-
- protected:
- friend Window;
-
- // Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
-
- private:
- // A delegate implementation that handles events received here.
- internal::NativeWindowDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeWindowWin);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_NATIVE_WINDOW_WIN_H_
diff --git a/views/window/native_window_win_unittest.cc b/views/window/native_window_win_unittest.cc
deleted file mode 100644
index a612af5..0000000
--- a/views/window/native_window_win_unittest.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2011 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 "views/window/native_window_win.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-namespace views {
-
-TEST(NativeWindowWinTest, EnsureRectIsVisibleInRect) {
- gfx::Rect parent_rect(0, 0, 500, 400);
-
- {
- // Child rect x < 0
- gfx::Rect child_rect(-50, 20, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(10, 20, 100, 100), child_rect);
- }
-
- {
- // Child rect y < 0
- gfx::Rect child_rect(20, -50, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 10, 100, 100), child_rect);
- }
-
- {
- // Child rect right > parent_rect.right
- gfx::Rect child_rect(450, 20, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(390, 20, 100, 100), child_rect);
- }
-
- {
- // Child rect bottom > parent_rect.bottom
- gfx::Rect child_rect(20, 350, 100, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 290, 100, 100), child_rect);
- }
-
- {
- // Child rect width > parent_rect.width
- gfx::Rect child_rect(20, 20, 700, 100);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 20, 480, 100), child_rect);
- }
-
- {
- // Child rect height > parent_rect.height
- gfx::Rect child_rect(20, 20, 100, 700);
- internal::EnsureRectIsVisibleInRect(parent_rect, &child_rect, 10);
- EXPECT_EQ(gfx::Rect(20, 20, 100, 380), child_rect);
- }
-}
-
-} // namespace views
diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc
index fdf4230..1f7effa 100644
--- a/views/window/non_client_view.cc
+++ b/views/window/non_client_view.cc
@@ -8,7 +8,6 @@
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/client_view.h"
-#include "views/window/window.h"
#if !defined(OS_WIN)
#include "views/window/hit_test.h"
diff --git a/views/window/window.cc b/views/window/window.cc
deleted file mode 100644
index ecfaa57..0000000
--- a/views/window/window.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 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 "views/window/window.h"
-
-#include "base/string_util.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
-#include "views/widget/widget.h"
-#include "views/widget/native_widget.h"
-#include "views/window/native_window.h"
-#include "views/window/window_delegate.h"
-
-namespace views {
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, public:
-
-Window::InitParams::InitParams(WindowDelegate* window_delegate)
- : window_delegate(window_delegate),
- parent_window(NULL),
- native_window(NULL),
- widget_init_params(Widget::InitParams::TYPE_WINDOW) {
-}
-
-Window::Window()
- : native_window_(NULL) {
-}
-
-Window::~Window() {
-}
-
-// static
-Window* Window::CreateChromeWindow(gfx::NativeWindow parent,
- const gfx::Rect& bounds,
- WindowDelegate* window_delegate) {
- Window* window = new Window;
- Window::InitParams params(window_delegate);
- params.parent_window = parent;
-#if defined(OS_WIN)
- params.widget_init_params.parent = parent;
-#endif
- params.widget_init_params.bounds = bounds;
- window->InitWindow(params);
- return window;
-}
-
-void Window::InitWindow(const InitParams& params) {
- native_window_ =
- params.native_window ? params.native_window
- : NativeWindow::CreateNativeWindow(this);
- InitParams modified_params = params;
- modified_params.widget_init_params.delegate = params.window_delegate;
- DCHECK(!modified_params.widget_init_params.delegate->window_);
- modified_params.widget_init_params.delegate->window_ = this;
- modified_params.widget_init_params.native_widget =
- native_window_->AsNativeWidget();
- Init(modified_params.widget_init_params);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, Widget overrides:
-
-Window* Window::AsWindow() {
- return this;
-}
-
-const Window* Window::AsWindow() const {
- return this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, internal::NativeWindowDelegate implementation:
-
-internal::NativeWidgetDelegate* Window::AsNativeWidgetDelegate() {
- return this;
-}
-
-} // namespace views
diff --git a/views/window/window.h b/views/window/window.h
deleted file mode 100644
index e3a36d5..0000000
--- a/views/window/window.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_WINDOW_H_
-#define VIEWS_WINDOW_WINDOW_H_
-#pragma once
-
-#include "ui/gfx/native_widget_types.h"
-#include "views/widget/widget.h"
-#include "views/window/native_window_delegate.h"
-
-namespace gfx {
-class Rect;
-class Size;
-} // namespace gfx
-
-namespace views {
-
-class NativeWindow;
-class Widget;
-class WindowDelegate;
-
-////////////////////////////////////////////////////////////////////////////////
-// Window class
-//
-// Encapsulates window-like behavior. See WindowDelegate.
-//
-class Window : public Widget,
- public internal::NativeWindowDelegate {
- public:
- struct InitParams {
- // |window_delegate| cannot be NULL.
- explicit InitParams(WindowDelegate* window_delegate);
-
- WindowDelegate* window_delegate;
- gfx::NativeWindow parent_window;
- NativeWindow* native_window;
- Widget::InitParams widget_init_params;
- };
-
- Window();
- virtual ~Window();
-
- // Creates an instance of an object implementing this interface.
- // TODO(beng): create a version of this function that takes a NativeView, for
- // constrained windows.
- static Window* CreateChromeWindow(gfx::NativeWindow parent,
- const gfx::Rect& bounds,
- WindowDelegate* window_delegate);
-
- // Initializes the window. Must be called before any post-configuration
- // operations are performed.
- void InitWindow(const InitParams& params);
-
- // Overridden from Widget:
- virtual Window* AsWindow() OVERRIDE;
- virtual const Window* AsWindow() const OVERRIDE;
-
- WindowDelegate* window_delegate() {
- return const_cast<WindowDelegate*>(
- const_cast<const Window*>(this)->window_delegate());
- }
- const WindowDelegate* window_delegate() const {
- return reinterpret_cast<WindowDelegate*>(widget_delegate());
- }
-
- NativeWindow* native_window() { return native_window_; }
-
- protected:
- // Overridden from NativeWindowDelegate:
- virtual internal::NativeWidgetDelegate* AsNativeWidgetDelegate() OVERRIDE;
-
- private:
- NativeWindow* native_window_;
-
- DISALLOW_COPY_AND_ASSIGN(Window);
-};
-
-} // namespace views
-
-#endif // #ifndef VIEWS_WINDOW_WINDOW_H_
diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc
deleted file mode 100644
index d75f881..0000000
--- a/views/window/window_delegate.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2011 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 "views/window/window_delegate.h"
-
-namespace views {
-
-WindowDelegate::WindowDelegate() {
-}
-
-WindowDelegate::~WindowDelegate() {
-}
-
-} // namespace views
diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h
deleted file mode 100644
index a7715ab..0000000
--- a/views/window/window_delegate.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2011 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 VIEWS_WINDOW_WINDOW_DELEGATE_H_
-#define VIEWS_WINDOW_WINDOW_DELEGATE_H_
-#pragma once
-
-#include "views/widget/widget_delegate.h"
-
-namespace views {
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// WindowDelegate
-//
-// WindowDelegate is an interface implemented by objects that wish to show a
-// Window. The window that is displayed uses this interface to determine how
-// it should be displayed and notify the delegate object of certain events.
-//
-class WindowDelegate : public WidgetDelegate {
- public:
- WindowDelegate();
- virtual ~WindowDelegate();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WindowDelegate);
-};
-
-} // namespace views
-
-#endif // VIEWS_WINDOW_WINDOW_DELEGATE_H_