diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 16:54:50 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 16:54:50 +0000 |
commit | c642dbbd4b8d3c44cf6092b0b8ecfab2be8992e5 (patch) | |
tree | c36eaad8f67fface68c71a0d292eedc151438e52 | |
parent | b964e3589f3127be36cddf3deade64f00e2afc2c (diff) | |
download | chromium_src-c642dbbd4b8d3c44cf6092b0b8ecfab2be8992e5.zip chromium_src-c642dbbd4b8d3c44cf6092b0b8ecfab2be8992e5.tar.gz chromium_src-c642dbbd4b8d3c44cf6092b0b8ecfab2be8992e5.tar.bz2 |
Add CreateParams to Widget, and replace CreatePopupWidget with CreateParams.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/6712008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78893 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 181 insertions, 135 deletions
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc index aacee58..14ad5be 100644 --- a/chrome/browser/chromeos/input_method/candidate_window.cc +++ b/chrome/browser/chromeos/input_method/candidate_window.cc @@ -1286,10 +1286,7 @@ bool CandidateWindowController::Impl::Init() { void CandidateWindowController::Impl::CreateView() { // Create a non-decorated frame. frame_.reset(views::Widget::CreatePopupWidget( - views::Widget::NotTransparent, - views::Widget::AcceptEvents, - views::Widget::DeleteOnDestroy, - views::Widget::MirrorOriginInRTL)); + views::Widget::CreateParams(views::Widget::CreateParams::TYPE_POPUP))); // The size is initially zero. frame_->Init(NULL, gfx::Rect(0, 0)); diff --git a/chrome/browser/ui/views/dom_view_browsertest.cc b/chrome/browser/ui/views/dom_view_browsertest.cc index 1e7ed8d7..a4e77c1 100644 --- a/chrome/browser/ui/views/dom_view_browsertest.cc +++ b/chrome/browser/ui/views/dom_view_browsertest.cc @@ -14,11 +14,9 @@ using namespace views; class DOMViewTest : public InProcessBrowserTest { public: Widget* CreatePopupWindow() { - Widget* window = - Widget::CreatePopupWidget(Widget::NotTransparent, - Widget::AcceptEvents, - Widget::DeleteOnDestroy, - Widget::DontMirrorOriginInRTL); + Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); + params.mirror_origin_in_rtl = false; + Widget* window = Widget::CreatePopupWidget(params); window->Init(NULL, gfx::Rect(0, 0, 400, 400)); return window; } diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 2f8b1a2..da3f9a1 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -99,10 +99,10 @@ ExtensionPopup::ExtensionPopup(ExtensionHost* host, static_cast<views::WidgetGtk*>(border_widget_)->MakeTransparent(); static_cast<views::WidgetGtk*>(border_widget_)->make_transient_to_parent(); #else - border_widget_ = Widget::CreatePopupWidget(Widget::Transparent, - Widget::NotAcceptEvents, - Widget::DeleteOnDestroy, - Widget::MirrorOriginInRTL); + Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); + params.transparent = true; + params.accept_events = false; + border_widget_ = Widget::CreatePopupWidget(params); #endif border_widget_->Init(native_window, bounds()); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc index f35ac74..9c08d54 100644 --- a/chrome/browser/ui/views/frame/contents_container.cc +++ b/chrome/browser/ui/views/frame/contents_container.cc @@ -151,10 +151,10 @@ void ContentsContainer::Layout() { void ContentsContainer::CreateOverlay(int initial_opacity) { DCHECK(!active_overlay_); - active_overlay_ = views::Widget::CreatePopupWidget(views::Widget::Transparent, - views::Widget::NotAcceptEvents, - views::Widget::DeleteOnDestroy, - views::Widget::MirrorOriginInRTL); + views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); + params.transparent = true; + params.accept_events = false; + active_overlay_ = views::Widget::CreatePopupWidget(params); active_overlay_->SetOpacity(initial_opacity); gfx::Point screen_origin; views::View::ConvertPointToScreen(active_, &screen_origin); diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 26bee52..a4aba18 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -316,19 +316,16 @@ void BalloonViewImpl::Show(Balloon* balloon) { gfx::Rect contents_rect = GetContentsRectangle(); html_contents_.reset(new BalloonViewHost(balloon)); html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); - html_container_ = Widget::CreatePopupWidget(Widget::NotTransparent, - Widget::AcceptEvents, - Widget::DeleteOnDestroy, - Widget::DontMirrorOriginInRTL); + Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); + params.mirror_origin_in_rtl = false; + html_container_ = Widget::CreatePopupWidget(params); html_container_->SetAlwaysOnTop(true); html_container_->Init(NULL, contents_rect); html_container_->SetContentsView(html_contents_->view()); gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); - frame_container_ = Widget::CreatePopupWidget(Widget::Transparent, - Widget::AcceptEvents, - Widget::DeleteOnDestroy, - Widget::DontMirrorOriginInRTL); + params.transparent = true; + frame_container_ = Widget::CreatePopupWidget(params); frame_container_->set_widget_delegate(this); frame_container_->SetAlwaysOnTop(true); frame_container_->Init(NULL, balloon_rect); diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc index f7d2f97..398ae3e 100644 --- a/chrome/browser/ui/views/status_bubble_views.cc +++ b/chrome/browser/ui/views/status_bubble_views.cc @@ -557,10 +557,11 @@ StatusBubbleViews::~StatusBubbleViews() { void StatusBubbleViews::Init() { if (!popup_.get()) { - popup_.reset(Widget::CreatePopupWidget(Widget::Transparent, - Widget::NotAcceptEvents, - Widget::NotDeleteOnDestroy, - Widget::MirrorOriginInRTL)); + Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); + params.transparent = true; + params.accept_events = false; + params.delete_on_destroy = false; + popup_.reset(Widget::CreatePopupWidget(params)); views::Widget* frame = base_view_->GetWidget(); if (!view_) view_ = new StatusView(this, popup_.get(), frame->GetThemeProvider()); diff --git a/chrome/browser/ui/views/theme_install_bubble_view.cc b/chrome/browser/ui/views/theme_install_bubble_view.cc index 7c0be9f..ddb2016 100644 --- a/chrome/browser/ui/views/theme_install_bubble_view.cc +++ b/chrome/browser/ui/views/theme_install_bubble_view.cc @@ -71,10 +71,10 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) NotificationService::AllSources()); gfx::Rect rc(0, 0, 0, 0); - popup_ = views::Widget::CreatePopupWidget(views::Widget::Transparent, - views::Widget::NotAcceptEvents, - views::Widget::DeleteOnDestroy, - views::Widget::MirrorOriginInRTL); + views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); + params.transparent = true; + params.accept_events = false; + popup_ = views::Widget::CreatePopupWidget(params); popup_->SetOpacity(0xCC); popup_->Init(tab_contents->GetNativeView(), rc); popup_->SetContentsView(this); diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc index 8679490..5552fbe 100644 --- a/views/controls/menu/menu_host_gtk.cc +++ b/views/controls/menu/menu_host_gtk.cc @@ -40,6 +40,10 @@ MenuHostGtk::MenuHostGtk(SubmenuView* submenu) } gdk_event_free(event); } + CreateParams params; + params.type = CreateParams::TYPE_MENU; + params.has_dropshadow = true; + SetCreateParams(params); } MenuHostGtk::~MenuHostGtk() { diff --git a/views/controls/menu/menu_host_win.cc b/views/controls/menu/menu_host_win.cc index 1beda38..3e77287 100644 --- a/views/controls/menu/menu_host_win.cc +++ b/views/controls/menu/menu_host_win.cc @@ -21,18 +21,10 @@ MenuHostWin::MenuHostWin(SubmenuView* submenu) : destroying_(false), submenu_(submenu), owns_capture_(false) { - set_window_style(WS_POPUP); - set_initial_class_style( - (base::win::GetVersion() < base::win::VERSION_XP) ? - 0 : CS_DROPSHADOW); - is_mouse_down_ = - ((GetKeyState(VK_LBUTTON) & 0x80) || - (GetKeyState(VK_RBUTTON) & 0x80) || - (GetKeyState(VK_MBUTTON) & 0x80) || - (GetKeyState(VK_XBUTTON1) & 0x80) || - (GetKeyState(VK_XBUTTON2) & 0x80)); - // Mouse clicks shouldn't give us focus. - set_window_ex_style(WS_EX_TOPMOST | WS_EX_NOACTIVATE); + CreateParams params; + params.type = CreateParams::TYPE_MENU; + params.has_dropshadow = true; + SetCreateParams(params); } MenuHostWin::~MenuHostWin() { diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index b284e6e..417a4b9 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -76,11 +76,9 @@ class NativeTextfieldViewsTest : public ViewsTestBase, ASSERT_FALSE(textfield_); textfield_ = new Textfield(style); textfield_->SetController(this); - widget_ = Widget::CreatePopupWidget( - Widget::NotTransparent, - Widget::AcceptEvents, - Widget::DeleteOnDestroy, - Widget::DontMirrorOriginInRTL); + Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); + params.mirror_origin_in_rtl = false; + widget_ = Widget::CreatePopupWidget(params); widget_->Init(NULL, gfx::Rect(100, 100, 100, 100)); View* container = new View(); widget_->SetContentsView(container); diff --git a/views/examples/widget_example.cc b/views/examples/widget_example.cc index 65de2a3..7b53a69 100644 --- a/views/examples/widget_example.cc +++ b/views/examples/widget_example.cc @@ -79,9 +79,7 @@ void WidgetExample::BuildButton(views::View* container, container->AddChildView(button); } -void WidgetExample::InitWidget( - views::Widget* widget, - const views::Widget::TransparencyParam transparency) { +void WidgetExample::InitWidget(views::Widget* widget, bool transparent) { // Add view/native buttons to close the popup widget. views::TextButton* close_button = new views::TextButton(this, L"Close"); close_button->set_tag(CLOSE_WIDGET); @@ -102,7 +100,7 @@ void WidgetExample::InitWidget( widget->SetContentsView(widget_container); - if (transparency != views::Widget::Transparent) { + if (!transparent) { widget_container->set_background( views::Background::CreateStandardPanelBackground()); } @@ -112,12 +110,10 @@ void WidgetExample::InitWidget( } #if defined(OS_LINUX) -void WidgetExample::CreateChild( - views::View* parent, - const views::Widget::TransparencyParam transparency) { +void WidgetExample::CreateChild(views::View* parent, bool transparent) { views::WidgetGtk* widget = new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); - if (transparency == views::Widget::Transparent) + if (transparent) widget->MakeTransparent(); // Compute where to place the child widget. // We'll place it at the center of the root widget. @@ -128,18 +124,14 @@ void WidgetExample::CreateChild( 200, 200); // Initialize the child widget with the computed bounds. widget->InitWithWidget(parent_widget, bounds); - InitWidget(widget, transparency); + InitWidget(widget, transparent); } #endif -void WidgetExample::CreatePopup( - views::View* parent, - const views::Widget::TransparencyParam transparency) { - views::Widget* widget = views::Widget::CreatePopupWidget( - transparency, - views::Widget::AcceptEvents, - views::Widget::DeleteOnDestroy, - views::Widget::MirrorOriginInRTL); +void WidgetExample::CreatePopup(views::View* parent, bool transparent) { + views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); + params.transparent = transparent; + views::Widget* widget = views::Widget::CreatePopupWidget(params); // Compute where to place the popup widget. // We'll place it right below the create button. @@ -151,24 +143,24 @@ void WidgetExample::CreatePopup( gfx::Rect bounds(point.x(), point.y(), 200, 300); // Initialize the popup widget with the computed bounds. widget->InitWithWidget(parent->GetWidget(), bounds); - InitWidget(widget, transparency); + InitWidget(widget, transparent); } void WidgetExample::ButtonPressed(views::Button* sender, const views::Event& event) { switch (sender->tag()) { case POPUP: - CreatePopup(sender, views::Widget::NotTransparent); + CreatePopup(sender, false); break; case TRANSPARENT_POPUP: - CreatePopup(sender, views::Widget::Transparent); + CreatePopup(sender, true); break; #if defined(OS_LINUX) case CHILD: - CreateChild(sender, views::Widget::NotTransparent); + CreateChild(sender, false); break; case TRANSPARENT_CHILD: - CreateChild(sender, views::Widget::Transparent); + CreateChild(sender, true); break; #endif case CLOSE_WIDGET: diff --git a/views/examples/widget_example.h b/views/examples/widget_example.h index b6d143a..14ddb65 100644 --- a/views/examples/widget_example.h +++ b/views/examples/widget_example.h @@ -37,16 +37,13 @@ class WidgetExample : public ExampleBase, public views::ButtonListener { void BuildButton(views::View* container, const std::wstring& label, int tag); - void InitWidget(views::Widget* widget, - const views::Widget::TransparencyParam transparency); + void InitWidget(views::Widget* widget, bool transparent); #if defined(OS_LINUX) - void CreateChild(views::View* parent, - const views::Widget::TransparencyParam transparency); + void CreateChild(views::View* parent, bool transparent); #endif - void CreatePopup(views::View* parent, - const views::Widget::TransparencyParam transparency); + void CreatePopup(views::View* parent, bool transparent); // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, diff --git a/views/widget/widget.cc b/views/widget/widget.cc index 8944ff9..65b9f916 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -15,6 +15,29 @@ namespace views { //////////////////////////////////////////////////////////////////////////////// +// Widget, CreateParams: + +Widget::CreateParams::CreateParams() + : type(TYPE_TOPLEVEL), + transparent(false), + accept_events(true), + delete_on_destroy(true), + mirror_origin_in_rtl(true), + has_dropshadow(false), + native_widget(NULL) { +} + +Widget::CreateParams::CreateParams(Type type) + : type(type), + transparent(false), + accept_events(true), + delete_on_destroy(true), + mirror_origin_in_rtl(true), + has_dropshadow(false), + native_widget(NULL) { +} + +//////////////////////////////////////////////////////////////////////////////// // Widget, public: Widget::Widget() diff --git a/views/widget/widget.h b/views/widget/widget.h index b094932..c164c16 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -60,44 +60,37 @@ class Window; class Widget : public internal::NativeWidgetDelegate, public FocusTraversable { public: - enum TransparencyParam { - Transparent, - NotTransparent - }; - - enum EventsParam { - AcceptEvents, - NotAcceptEvents - }; - - enum DeleteParam { - DeleteOnDestroy, - NotDeleteOnDestroy - }; - - enum MirroringParam { - MirrorOriginInRTL, - DontMirrorOriginInRTL + struct CreateParams { + enum Type { + TYPE_TOPLEVEL, + TYPE_CHILD, + TYPE_POPUP, + TYPE_MENU + }; + + CreateParams(); + explicit CreateParams(Type type); + + Type type; + + bool transparent; + bool accept_events; + bool delete_on_destroy; + bool mirror_origin_in_rtl; + bool has_dropshadow; + NativeWidget* native_widget; }; + Widget(); virtual ~Widget(); - // Creates a transient popup widget specific to the current platform. - // If |mirror_in_rtl| is set to MirrorOriginInRTL, the contents of the - // popup will be mirrored if the current locale is RTL. You should use - // DontMirrorOriginInRTL if you are aleady handling the RTL layout within - // the widget. - static Widget* CreatePopupWidget(TransparencyParam transparent, - EventsParam accept_events, - DeleteParam delete_on_destroy, - MirroringParam mirror_in_rtl); + // Creates a Widget instance suitable for use as a transient popup. + static Widget* CreatePopupWidget(const CreateParams& params); // Enumerates all windows pertaining to us and notifies their // view hierarchies that the locale has changed. static void NotifyLocaleChanged(); - Widget(); - // Unconverted methods ------------------------------------------------------- // TODO(beng): diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 1c3d541..5f470c5 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -298,6 +298,16 @@ WidgetGtk::~WidgetGtk() { ActiveWindowWatcherX::RemoveObserver(this); } +void WidgetGtk::SetCreateParams(const CreateParams& params) { + // Set non-style attributes. + set_delete_on_destroy(params.delete_on_destroy); + + if (params.transparent) + MakeTransparent(); + if (!params.accept_events) + MakeIgnoreEvents(); +} + GtkWindow* WidgetGtk::GetTransientParent() const { return (type_ != TYPE_CHILD && widget_) ? gtk_window_get_transient_for(GTK_WINDOW(widget_)) : NULL; @@ -1540,16 +1550,9 @@ void WidgetGtk::DrawTransparentBackground(GtkWidget* widget, // Widget, public: // static -Widget* Widget::CreatePopupWidget(TransparencyParam transparent, - EventsParam accept_events, - DeleteParam delete_on_destroy, - MirroringParam mirror_in_rtl) { +Widget* Widget::CreatePopupWidget(const CreateParams& params) { WidgetGtk* popup = new WidgetGtk(WidgetGtk::TYPE_POPUP); - popup->set_delete_on_destroy(delete_on_destroy == DeleteOnDestroy); - if (transparent == Transparent) - popup->MakeTransparent(); - if (accept_events == NotAcceptEvents) - popup->MakeIgnoreEvents(); + popup->SetCreateParams(params); return popup; } diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 39f6de5..ed9e9fb 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -64,6 +64,9 @@ class WidgetGtk : public Widget, explicit WidgetGtk(Type type); virtual ~WidgetGtk(); + // Initializes native widget properties based on |params|. + void SetCreateParams(const CreateParams& params); + // Marks this window as transient to its parent. A window that is transient // to its parent results in the parent rendering active when the child is // active. diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 2c247fd..c97d8e0 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -153,6 +153,56 @@ WidgetWin::~WidgetWin() { DestroyRootView(); } +void WidgetWin::SetCreateParams(const CreateParams& params) { + // Set non-style attributes. + set_delete_on_destroy(params.delete_on_destroy); + + DWORD style = 0; + DWORD ex_style = 0; + DWORD class_style = CS_DBLCLKS; + + // Set type-independent style attributes. + if (params.accept_events) + ex_style |= WS_EX_TRANSPARENT; + if (params.mirror_origin_in_rtl) + ex_style |= l10n_util::GetExtendedTooltipStyles(); + if (params.transparent) + ex_style |= WS_EX_LAYERED; + if (params.has_dropshadow) { + class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ? + 0 : CS_DROPSHADOW; + } + + // Set type-dependent style attributes. + switch (params.type) { + case CreateParams::TYPE_TOPLEVEL: + break; + case CreateParams::TYPE_CHILD: + style |= WS_CHILD; + break; + case CreateParams::TYPE_POPUP: + style |= WS_POPUP; + ex_style |= WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE; + break; + case CreateParams::TYPE_MENU: + style |= WS_POPUP; + ex_style |= WS_EX_TOPMOST | WS_EX_NOACTIVATE; + is_mouse_down_ = + ((GetKeyState(VK_LBUTTON) & 0x80) || + (GetKeyState(VK_RBUTTON) & 0x80) || + (GetKeyState(VK_MBUTTON) & 0x80) || + (GetKeyState(VK_XBUTTON1) & 0x80) || + (GetKeyState(VK_XBUTTON2) & 0x80)); + break; + default: + NOTREACHED(); + } + + set_initial_class_style(class_style); + set_window_style(style); + set_window_ex_style(ex_style); +} + // static WidgetWin* WidgetWin::GetWidget(HWND hwnd) { // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is @@ -1147,21 +1197,9 @@ gfx::AcceleratedWidget WidgetWin::GetAcceleratedWidget() { // Widget, public: // static -Widget* Widget::CreatePopupWidget(TransparencyParam transparent, - EventsParam accept_events, - DeleteParam delete_on_destroy, - MirroringParam mirror_in_rtl) { +Widget* Widget::CreatePopupWidget(const CreateParams& params) { WidgetWin* popup = new WidgetWin; - DWORD ex_style = WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE; - if (mirror_in_rtl == MirrorOriginInRTL) - ex_style |= l10n_util::GetExtendedTooltipStyles(); - if (transparent == Transparent) - ex_style |= WS_EX_LAYERED; - if (accept_events != AcceptEvents) - ex_style |= WS_EX_TRANSPARENT; - popup->set_window_style(WS_POPUP); - popup->set_window_ex_style(ex_style); - popup->set_delete_on_destroy(delete_on_destroy == DeleteOnDestroy); + popup->SetCreateParams(params); return popup; } diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index 2428a3e8..41e24f9 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -86,6 +86,9 @@ class WidgetWin : public ui::WindowImpl, WidgetWin(); virtual ~WidgetWin(); + // Initializes native widget properties based on |params|. + void SetCreateParams(const CreateParams& params); + // Returns the Widget associated with the specified HWND (if any). static WidgetWin* GetWidget(HWND hwnd); diff --git a/views/window/window.cc b/views/window/window.cc index ba7d055..16d4170 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -236,6 +236,15 @@ const Widget* Window::AsWidget() const { } //////////////////////////////////////////////////////////////////////////////// +// Window, protected: + +void Window::SetNativeWindow(NativeWindow* native_window) { + native_window_ = native_window; + native_window->AsNativeWidget()->GetWidget()->set_widget_delegate( + window_delegate_); +} + +//////////////////////////////////////////////////////////////////////////////// // Window, internal::NativeWindowDelegate implementation: bool Window::CanActivate() const { diff --git a/views/window/window.h b/views/window/window.h index f18f4bb..d043dc1 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -197,9 +197,7 @@ class Window : public internal::NativeWindowDelegate { protected: // TODO(beng): Temporarily provided as a way to associate the subclass' // implementation of NativeWidget with this. - void set_native_window(NativeWindow* native_window) { - native_window_ = native_window; - } + void SetNativeWindow(NativeWindow* native_window); // Overridden from NativeWindowDelegate: virtual bool CanActivate() const OVERRIDE; diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 46af221..2257f07 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -418,7 +418,7 @@ WindowGtk::WindowGtk(WindowDelegate* window_delegate) ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)), window_state_(GDK_WINDOW_STATE_WITHDRAWN), window_closed_(false) { - set_native_window(this); + SetNativeWindow(this); is_window_ = true; } diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 9ba6056..cc0c6dd 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -311,7 +311,7 @@ WindowWin::WindowWin(WindowDelegate* window_delegate) force_hidden_count_(0), is_right_mouse_pressed_on_caption_(false), last_monitor_(NULL) { - set_native_window(this); + SetNativeWindow(this); is_window_ = true; InitClass(); // Initialize these values to 0 so that subclasses can override the default |