diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 22:03:10 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 22:03:10 +0000 |
commit | 94098fe02a8c5950df6453ccca7621a2d2a6816f (patch) | |
tree | 202c8855a76a7e11bb88fb46fe409a3c4d0888cd /views | |
parent | 172f155f817cc56e1ca36bee6aeeca7f8f95bb64 (diff) | |
download | chromium_src-94098fe02a8c5950df6453ccca7621a2d2a6816f.zip chromium_src-94098fe02a8c5950df6453ccca7621a2d2a6816f.tar.gz chromium_src-94098fe02a8c5950df6453ccca7621a2d2a6816f.tar.bz2 |
Move WindowDelegate and NonClientView creation and management to Window.
This makes WindowGtk/WindowWin a little uglier for now, will improve with consolidation of more functions into Window.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/6621033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 2 | ||||
-rw-r--r-- | views/view_unittest.cc | 2 | ||||
-rw-r--r-- | views/window/client_view.cc | 1 | ||||
-rw-r--r-- | views/window/custom_frame_view.cc | 26 | ||||
-rw-r--r-- | views/window/dialog_client_view.cc | 11 | ||||
-rw-r--r-- | views/window/dialog_delegate.cc | 5 | ||||
-rw-r--r-- | views/window/native_frame_view.cc | 6 | ||||
-rw-r--r-- | views/window/native_window_delegate.h | 7 | ||||
-rw-r--r-- | views/window/non_client_view.cc | 3 | ||||
-rw-r--r-- | views/window/window.cc | 33 | ||||
-rw-r--r-- | views/window/window.h | 54 | ||||
-rw-r--r-- | views/window/window_delegate.h | 3 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 61 | ||||
-rw-r--r-- | views/window/window_gtk.h | 3 | ||||
-rw-r--r-- | views/window/window_win.cc | 141 | ||||
-rw-r--r-- | views/window/window_win.h | 12 |
16 files changed, 184 insertions, 186 deletions
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index bcf2b94..240d941 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -1677,7 +1677,7 @@ class FocusManagerDtorTest : public FocusManagerTest { dtor_tracker_(dtor_tracker) { tracked_focus_manager_ = new FocusManagerDtorTracked(this, dtor_tracker_); - GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); + non_client_view()->SetFrameView(CreateFrameViewForWindow()); InitWindow(NULL, gfx::Rect(0, 0, 100, 100)); ReplaceFocusManager(tracked_focus_manager_); } diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 16109f7..3eaa9e0 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1270,7 +1270,7 @@ class DefaultButtonTest : public ViewTest { focus_manager_ = test_dialog_->contents_->GetFocusManager(); ASSERT_TRUE(focus_manager_ != NULL); client_view_ = - static_cast<views::DialogClientView*>(window->GetClientView()); + static_cast<views::DialogClientView*>(window->client_view()); ok_button_ = client_view_->ok_button(); cancel_button_ = client_view_->cancel_button(); } diff --git a/views/window/client_view.cc b/views/window/client_view.cc index 9fb3e70..5d964de 100644 --- a/views/window/client_view.cc +++ b/views/window/client_view.cc @@ -33,7 +33,6 @@ bool ClientView::CanClose() { } void ClientView::WindowClosing() { - window_->GetDelegate()->WindowClosing(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc index cd687b7..c71a917 100644 --- a/views/window/custom_frame_view.cc +++ b/views/window/custom_frame_view.cc @@ -113,11 +113,10 @@ CustomFrameView::CustomFrameView(Window* frame) rb.GetBitmapNamed(IDR_MINIMIZE_P)); AddChildView(minimize_button_); - views::WindowDelegate* d = frame_->GetDelegate(); - should_show_minmax_buttons_ = d->CanMaximize(); - should_show_client_edge_ = d->ShouldShowClientEdge(); + should_show_minmax_buttons_ = frame_->window_delegate()->CanMaximize(); + should_show_client_edge_ = frame_->window_delegate()->ShouldShowClientEdge(); - if (d->ShouldShowWindowIcon()) { + if (frame_->window_delegate()->ShouldShowWindowIcon()) { window_icon_ = new ImageButton(this); AddChildView(window_icon_); } @@ -148,7 +147,7 @@ int CustomFrameView::NonClientHitTest(const gfx::Point& point) { if (!bounds().Contains(point)) return HTNOWHERE; - int frame_component = frame_->GetClientView()->NonClientHitTest(point); + int frame_component = frame_->client_view()->NonClientHitTest(point); // See if we're in the sysmenu region. (We check the ClientView first to be // consistent with OpaqueBrowserFrameView; it's not really necessary here.) @@ -178,7 +177,7 @@ int CustomFrameView::NonClientHitTest(const gfx::Point& point) { int window_component = GetHTComponentForFrame(point, FrameBorderThickness(), NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, - frame_->GetDelegate()->CanResize()); + frame_->window_delegate()->CanResize()); // Fall back to the caption if no other component matches. return (window_component == HTNOWHERE) ? HTCAPTION : window_component; } @@ -223,9 +222,9 @@ void CustomFrameView::Layout() { } gfx::Size CustomFrameView::GetPreferredSize() { - gfx::Size pref = frame_->GetClientView()->GetPreferredSize(); + gfx::Size pref = frame_->client_view()->GetPreferredSize(); gfx::Rect bounds(0, 0, pref.width(), pref.height()); - return frame_->GetNonClientView()->GetWindowBoundsForClientBounds( + return frame_->non_client_view()->GetWindowBoundsForClientBounds( bounds).size(); } @@ -397,11 +396,11 @@ void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { int edge_height = titlebar_bottom->height() - ShouldShowClientEdge() ? kClientEdgeThickness : 0; canvas->TileImageInt(*titlebar_bottom, 0, - frame_->GetClientView()->y() - edge_height, width(), edge_height); + frame_->client_view()->y() - edge_height, width(), edge_height); } void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { - WindowDelegate* d = frame_->GetDelegate(); + WindowDelegate* d = frame_->window_delegate(); // It seems like in some conditions we can be asked to paint after the window // that contains us is WM_DESTROYed. At this point, our delegate is NULL. The @@ -416,7 +415,7 @@ void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { } void CustomFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { - gfx::Rect client_area_bounds = frame_->GetClientView()->bounds(); + gfx::Rect client_area_bounds = frame_->client_view()->bounds(); int client_area_top = client_area_bounds.y(); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -534,12 +533,11 @@ void CustomFrameView::LayoutTitleBar() { // The window title is based on the calculated icon position, even when there // is no icon. gfx::Rect icon_bounds(IconBounds()); - views::WindowDelegate* d = frame_->GetDelegate(); - if (d->ShouldShowWindowIcon()) + if (frame_->window_delegate()->ShouldShowWindowIcon()) window_icon_->SetBoundsRect(icon_bounds); // Size the title. - int title_x = d->ShouldShowWindowIcon() ? + int title_x = frame_->window_delegate()->ShouldShowWindowIcon() ? icon_bounds.right() + kIconTitleSpacing : icon_bounds.x(); int title_height = title_font_->GetHeight(); // We bias the title position so that when the difference between the icon and diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index cdf684c..81e8685 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -79,7 +79,7 @@ class DialogButton : public NativeButton { // Overridden to forward to the delegate. virtual bool AcceleratorPressed(const Accelerator& accelerator) { - if (!owner_->GetDelegate()->AsDialogDelegate()-> + if (!owner_->window_delegate()->AsDialogDelegate()-> AreAcceleratorsEnabled(type_)) { return false; } @@ -288,7 +288,6 @@ void DialogClientView::WindowClosing() { if (saved_focus_manager_) saved_focus_manager_->RemoveFocusChangeListener(this); } - ClientView::WindowClosing(); } int DialogClientView::NonClientHitTest(const gfx::Point& point) { @@ -425,8 +424,8 @@ void DialogClientView::ButtonPressed( // DialogClientView, private: void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { - if (window()->GetDelegate()->CanResize() || - window()->GetDelegate()->CanMaximize()) { + if (window()->window_delegate()->CanResize() || + window()->window_delegate()->CanMaximize()) { #if defined(OS_WIN) HDC dc = canvas->BeginPlatformPaint(); SIZE gripper_size = { 0, 0 }; @@ -537,9 +536,7 @@ void DialogClientView::CreateExtraView() { } DialogDelegate* DialogClientView::GetDialogDelegate() const { - DialogDelegate* dd = window()->GetDelegate()->AsDialogDelegate(); - DCHECK(dd); - return dd; + return window()->window_delegate()->AsDialogDelegate(); } void DialogClientView::Close() { diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc index 43bdce3..84feb9b 100644 --- a/views/window/dialog_delegate.cc +++ b/views/window/dialog_delegate.cc @@ -95,10 +95,7 @@ ClientView* DialogDelegate::CreateClientView(Window* window) { } DialogClientView* DialogDelegate::GetDialogClientView() const { - ClientView* client_view = window()->GetClientView(); - DialogClientView* dialog_client_view = client_view->AsDialogClientView(); - DCHECK(dialog_client_view); - return dialog_client_view; + return window()->client_view()->AsDialogClientView(); } AccessibilityTypes::Role DialogDelegate::accessible_role() const { diff --git a/views/window/native_frame_view.cc b/views/window/native_frame_view.cc index 5b0d34e..bcef23a 100644 --- a/views/window/native_frame_view.cc +++ b/views/window/native_frame_view.cc @@ -35,7 +35,7 @@ gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( } int NativeFrameView::NonClientHitTest(const gfx::Point& point) { - return frame_->GetClientView()->NonClientHitTest(point); + return frame_->client_view()->NonClientHitTest(point); } void NativeFrameView::GetWindowMask(const gfx::Size& size, @@ -52,9 +52,9 @@ void NativeFrameView::ResetWindowControls() { } gfx::Size NativeFrameView::GetPreferredSize() { - gfx::Size pref = frame_->GetClientView()->GetPreferredSize(); + gfx::Size pref = frame_->client_view()->GetPreferredSize(); gfx::Rect bounds(0, 0, pref.width(), pref.height()); - return frame_->GetNonClientView()->GetWindowBoundsForClientBounds( + return frame_->non_client_view()->GetWindowBoundsForClientBounds( bounds).size(); } diff --git a/views/window/native_window_delegate.h b/views/window/native_window_delegate.h index 229d588..4668de4 100644 --- a/views/window/native_window_delegate.h +++ b/views/window/native_window_delegate.h @@ -18,6 +18,13 @@ namespace internal { class NativeWindowDelegate { public: virtual ~NativeWindowDelegate() {} + + // Called just before the native window is destroyed. This is the delegate's + // last chance to do anything with the native window handle. + virtual void OnWindowDestroying() = 0; + + // Called just after the native window is destroyed. + virtual void OnWindowDestroyed() = 0; }; } // namespace internal diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index e882105..f297c45 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -6,6 +6,7 @@ #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) @@ -192,7 +193,7 @@ bool NonClientFrameView::AlwaysUseNativeFrame() const { bool NonClientFrameView::HitTest(const gfx::Point& l) const { // For the default case, we assume the non-client frame view never overlaps // the client view. - return !GetWindow()->GetClientView()->bounds().Contains(l); + return !GetWindow()->client_view()->bounds().Contains(l); } void NonClientFrameView::OnBoundsChanged() { diff --git a/views/window/window.cc b/views/window/window.cc index 3a14335..5531cff 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -11,13 +11,21 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" #include "views/widget/widget.h" +#include "views/window/window_delegate.h" namespace views { //////////////////////////////////////////////////////////////////////////////// // Window, public: -Window::Window() : native_window_(NULL) { +Window::Window(WindowDelegate* window_delegate) + : native_window_(NULL), + window_delegate_(window_delegate), + ALLOW_THIS_IN_INITIALIZER_LIST( + non_client_view_(new NonClientView(this))) { + DCHECK(window_delegate_); + DCHECK(!window_delegate_->window_); + window_delegate_->window_ = this; } Window::~Window() { @@ -151,27 +159,28 @@ NonClientFrameView* Window::CreateFrameViewForWindow() { void Window::UpdateFrameAfterFrameChange() { } -WindowDelegate* Window::GetDelegate() const { +gfx::NativeWindow Window::GetNativeWindow() const { return NULL; } -NonClientView* Window::GetNonClientView() const { - return NULL; +bool Window::ShouldUseNativeFrame() const { + return false; } -ClientView* Window::GetClientView() const { - return NULL; +void Window::FrameTypeChanged() { } -gfx::NativeWindow Window::GetNativeWindow() const { - return NULL; -} +//////////////////////////////////////////////////////////////////////////////// +// Window, internal::NativeWindowDelegate implementation: -bool Window::ShouldUseNativeFrame() const { - return false; +void Window::OnWindowDestroying() { + non_client_view_->WindowClosing(); + window_delegate_->WindowClosing(); } -void Window::FrameTypeChanged() { +void Window::OnWindowDestroyed() { + window_delegate_->DeleteDelegate(); + window_delegate_ = NULL; } } // namespace views diff --git a/views/window/window.h b/views/window/window.h index df5a28c..7bc9406 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -7,7 +7,9 @@ #pragma once #include "ui/gfx/native_widget_types.h" +#include "views/window/client_view.h" #include "views/window/native_window_delegate.h" +#include "views/window/non_client_view.h" namespace gfx { class Font; @@ -17,10 +19,8 @@ class Size; namespace views { -class ClientView; class NativeWindow; class NonClientFrameView; -class NonClientView; class Widget; class WindowDelegate; @@ -40,7 +40,7 @@ class WindowDelegate; // class Window : public internal::NativeWindowDelegate { public: - Window(); + explicit Window(WindowDelegate* window_delegate); virtual ~Window(); // Creates an instance of an object implementing this interface. @@ -177,15 +177,6 @@ class Window : public internal::NativeWindowDelegate { // Updates the frame after an event caused it to be changed. virtual void UpdateFrameAfterFrameChange(); - // Retrieves the Window's delegate. - virtual WindowDelegate* GetDelegate() const; - - // Retrieves the Window's non-client view. - virtual NonClientView* GetNonClientView() const; - - // Retrieves the Window's client view. - virtual ClientView* GetClientView() const; - // Retrieves the Window's native window handle. virtual gfx::NativeWindow GetNativeWindow() const; @@ -195,6 +186,30 @@ class Window : public internal::NativeWindowDelegate { // Tell the window that something caused the frame type to change. virtual void FrameTypeChanged(); + WindowDelegate* window_delegate() { + return const_cast<WindowDelegate*>( + const_cast<const Window*>(this)->window_delegate()); + } + const WindowDelegate* window_delegate() const { + return window_delegate_; + } + + NonClientView* non_client_view() { + return const_cast<NonClientView*>( + const_cast<const Window*>(this)->non_client_view()); + } + const NonClientView* non_client_view() const { + return non_client_view_; + } + + ClientView* client_view() { + return const_cast<ClientView*>( + const_cast<const Window*>(this)->client_view()); + } + const ClientView* client_view() const { + return non_client_view()->client_view(); + } + protected: // TODO(beng): Temporarily provided as a way to associate the subclass' // implementation of NativeWidget with this. @@ -202,9 +217,24 @@ class Window : public internal::NativeWindowDelegate { native_window_ = native_window; } + // Overridden from NativeWindowDelegate: + virtual void OnWindowDestroying(); + virtual void OnWindowDestroyed(); + private: + Window(); + NativeWindow* native_window_; + // Our window delegate (see InitWindow() method for documentation). + WindowDelegate* window_delegate_; + + // The View that provides the non-client area of the window (title bar, + // window controls, sizing borders etc). To use an implementation other than + // the default, this class must be sub-classed and this value set to the + // desired implementation before calling |InitWindow()|. + NonClientView* non_client_view_; + DISALLOW_COPY_AND_ASSIGN(Window); }; diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h index 9b02387..fd7b1d1 100644 --- a/views/window/window_delegate.h +++ b/views/window/window_delegate.h @@ -122,8 +122,7 @@ class WindowDelegate { Window* window() const { return window_; } private: - friend class WindowGtk; - friend class WindowWin; + friend class Window; // The Window this delegate is bound to. Weak reference. Window* window_; }; diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 08c19ed..06feab3 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -87,7 +87,7 @@ Window* Window::CreateChromeWindow(gfx::NativeWindow parent, const gfx::Rect& bounds, WindowDelegate* window_delegate) { WindowGtk* window = new WindowGtk(window_delegate); - window->GetNonClientView()->SetFrameView(window->CreateFrameViewForWindow()); + window->non_client_view()->SetFrameView(window->CreateFrameViewForWindow()); window->InitWindow(parent, bounds); return window; } @@ -149,7 +149,7 @@ void WindowGtk::Close() { return; } - if (non_client_view_->CanClose()) { + if (GetWindow()->non_client_view()->CanClose()) { WidgetGtk::Close(); window_closed_ = true; } @@ -213,11 +213,11 @@ void WindowGtk::UpdateWindowTitle() { // If the non-client view is rendering its own title, it'll need to relayout // now. - non_client_view_->Layout(); + GetWindow()->non_client_view()->Layout(); // Update the native frame's text. We do this regardless of whether or not // the native frame is being used, since this also updates the taskbar, etc. - std::wstring window_title = window_delegate_->GetWindowTitle(); + std::wstring window_title = GetWindow()->window_delegate()->GetWindowTitle(); base::i18n::AdjustStringForLocaleDirection(&window_title); gtk_window_set_title(GetNativeWindow(), WideToUTF8(window_title).c_str()); @@ -244,18 +244,6 @@ void WindowGtk::UpdateFrameAfterFrameChange() { NOTIMPLEMENTED(); } -WindowDelegate* WindowGtk::GetDelegate() const { - return window_delegate_; -} - -NonClientView* WindowGtk::GetNonClientView() const { - return non_client_view_; -} - -ClientView* WindowGtk::GetClientView() const { - return non_client_view_->client_view(); -} - gfx::NativeWindow WindowGtk::GetNativeWindow() const { return GTK_WINDOW(GetNativeView()); } @@ -286,7 +274,7 @@ gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { GetContainedWidgetEventCoordinates(event, &x, &y); int hittest_code = - non_client_view_->NonClientHitTest(gfx::Point(x, y)); + GetWindow()->non_client_view()->NonClientHitTest(gfx::Point(x, y)); switch (hittest_code) { case HTCAPTION: { MouseEvent mouse_pressed(ui::ET_MOUSE_PRESSED, event->x, event->y, @@ -345,7 +333,7 @@ gboolean WindowGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) { // Update the cursor for the screen edge. int hittest_code = - non_client_view_->NonClientHitTest(gfx::Point(x, y)); + GetWindow()->non_client_view()->NonClientHitTest(gfx::Point(x, y)); if (hittest_code != HTCLIENT) { GdkCursorType cursor_type = HitTestCodeToGdkCursorType(hittest_code); gdk_window_set_cursor(widget->window, gfx::GetCursor(cursor_type)); @@ -359,9 +347,9 @@ void WindowGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { // The Window's NonClientView may provide a custom shape for the Window. gfx::Path window_mask; - non_client_view_->GetWindowMask(gfx::Size(allocation->width, - allocation->height), - &window_mask); + GetWindow()->non_client_view()->GetWindowMask(gfx::Size(allocation->width, + allocation->height), + &window_mask); GdkRegion* mask_region = window_mask.CreateNativeRegion(); gdk_window_shape_combine_region(GetNativeView()->window, mask_region, 0, 0); if (mask_region) @@ -385,7 +373,7 @@ gboolean WindowGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { } void WindowGtk::SetInitialFocus() { - View* v = window_delegate_->GetInitiallyFocusedView(); + View* v = GetWindow()->window_delegate()->GetInitiallyFocusedView(); if (v) { v->RequestFocus(); } @@ -396,16 +384,13 @@ void WindowGtk::SetInitialFocus() { WindowGtk::WindowGtk(WindowDelegate* window_delegate) : WidgetGtk(TYPE_WINDOW), + Window(window_delegate), ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)), is_modal_(false), - window_delegate_(window_delegate), - non_client_view_(new NonClientView(this)), window_state_(GDK_WINDOW_STATE_WITHDRAWN), window_closed_(false) { set_native_window(this); is_window_ = true; - DCHECK(!window_delegate_->window_); - window_delegate_->window_ = this; } void WindowGtk::InitWindow(GtkWindow* parent, const gfx::Rect& bounds) { @@ -415,7 +400,7 @@ void WindowGtk::InitWindow(GtkWindow* parent, const gfx::Rect& bounds) { // We call this after initializing our members since our implementations of // assorted WidgetWin functions may be called during initialization. - is_modal_ = window_delegate_->IsModal(); + is_modal_ = GetWindow()->window_delegate()->IsModal(); if (is_modal_) gtk_window_set_modal(GetNativeWindow(), true); @@ -426,8 +411,9 @@ void WindowGtk::InitWindow(GtkWindow* parent, const gfx::Rect& bounds) { // Create the ClientView, add it to the NonClientView and add the // NonClientView to the RootView. This will cause everything to be parented. - non_client_view_->set_client_view(window_delegate_->CreateClientView(this)); - WidgetGtk::SetContentsView(non_client_view_); + GetWindow()->non_client_view()->set_client_view( + GetWindow()->window_delegate()->CreateClientView(this)); + WidgetGtk::SetContentsView(GetWindow()->non_client_view()); UpdateWindowTitle(); SetInitialBounds(parent, bounds); @@ -461,19 +447,19 @@ gboolean WindowGtk::CallWindowStateEvent(GtkWidget* widget, void WindowGtk::SaveWindowPosition() { // The delegate may have gone away on us. - if (!window_delegate_) + if (!GetWindow()->window_delegate()) return; bool maximized = window_state_ & GDK_WINDOW_STATE_MAXIMIZED; - window_delegate_->SaveWindowPlacement(GetBounds(), maximized); + GetWindow()->window_delegate()->SaveWindowPlacement(GetBounds(), maximized); } void WindowGtk::SetInitialBounds(GtkWindow* parent, const gfx::Rect& create_bounds) { gfx::Rect saved_bounds(create_bounds.ToGdkRectangle()); - if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) { - if (!window_delegate_->ShouldRestoreWindowSize()) - saved_bounds.set_size(non_client_view_->GetPreferredSize()); + if (GetWindow()->window_delegate()->GetSavedWindowBounds(&saved_bounds)) { + if (!GetWindow()->window_delegate()->ShouldRestoreWindowSize()) + saved_bounds.set_size(GetWindow()->non_client_view()->GetPreferredSize()); WidgetGtk::SetBounds(saved_bounds); } else { if (create_bounds.IsEmpty()) { @@ -500,7 +486,7 @@ void WindowGtk::SizeWindowToDefault(GtkWindow* parent) { // We have no parent window, center over the screen. center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); } - gfx::Size size = non_client_view_->GetPreferredSize(); + gfx::Size size = GetWindow()->non_client_view()->GetPreferredSize(); gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, center_rect.y() + (center_rect.height() - size.height()) / 2, size.width(), size.height()); @@ -508,10 +494,9 @@ void WindowGtk::SizeWindowToDefault(GtkWindow* parent) { } void WindowGtk::OnDestroy(GtkWidget* widget) { - non_client_view_->WindowClosing(); + delegate_->OnWindowDestroying(); WidgetGtk::OnDestroy(widget); - window_delegate_->DeleteDelegate(); - window_delegate_ = NULL; + delegate_->OnWindowDestroyed(); } } // namespace views diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index 75a5702..ef1cde8 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -57,9 +57,6 @@ class WindowGtk : public WidgetGtk, public NativeWindow, public Window { virtual void SetIsAlwaysOnTop(bool always_on_top); virtual NonClientFrameView* CreateFrameViewForWindow(); virtual void UpdateFrameAfterFrameChange(); - virtual WindowDelegate* GetDelegate() const; - virtual NonClientView* GetNonClientView() const; - virtual ClientView* GetClientView() const; virtual gfx::NativeWindow GetNativeWindow() const; virtual bool ShouldUseNativeFrame() const; virtual void FrameTypeChanged(); diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 43bfce5..3122a94 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -218,7 +218,8 @@ Window* Window::CreateChromeWindow(gfx::NativeWindow parent, const gfx::Rect& bounds, WindowDelegate* window_delegate) { WindowWin* window = new WindowWin(window_delegate); - window->GetNonClientView()->SetFrameView(window->CreateFrameViewForWindow()); + window->GetWindow()->non_client_view()->SetFrameView( + window->CreateFrameViewForWindow()); window->Init(parent, bounds); return window; } @@ -341,7 +342,7 @@ void WindowWin::Close() { return; } - if (non_client_view_->CanClose()) { + if (GetWindow()->non_client_view()->CanClose()) { SaveWindowPosition(); RestoreEnabledIfNecessary(); WidgetWin::Close(); @@ -466,7 +467,7 @@ void WindowWin::SetUseDragFrame(bool use_drag_frame) { void WindowWin::EnableClose(bool enable) { // If the native frame is rendering its own close button, ask it to disable. - non_client_view_->EnableClose(enable); + GetWindow()->non_client_view()->EnableClose(enable); // Disable the native frame's close button regardless of whether or not the // native frame is in use, since this also affects the system menu. @@ -482,21 +483,22 @@ void WindowWin::EnableClose(bool enable) { void WindowWin::DisableInactiveRendering() { disable_inactive_rendering_ = true; - non_client_view_->DisableInactiveRendering(disable_inactive_rendering_); + GetWindow()->non_client_view()->DisableInactiveRendering( + disable_inactive_rendering_); } void WindowWin::UpdateWindowTitle() { // If the non-client view is rendering its own title, it'll need to relayout // now. - non_client_view_->Layout(); + GetWindow()->non_client_view()->Layout(); // Update the native frame's text. We do this regardless of whether or not // the native frame is being used, since this also updates the taskbar, etc. std::wstring window_title; if (IsAccessibleWidget()) - window_title = window_delegate_->GetAccessibleWindowTitle(); + window_title = GetWindow()->window_delegate()->GetAccessibleWindowTitle(); else - window_title = window_delegate_->GetWindowTitle(); + window_title = GetWindow()->window_delegate()->GetWindowTitle(); base::i18n::AdjustStringForLocaleDirection(&window_title); SetWindowText(GetNativeView(), window_title.c_str()); @@ -507,11 +509,11 @@ void WindowWin::UpdateWindowTitle() { void WindowWin::UpdateWindowIcon() { // If the non-client view is rendering its own icon, we need to tell it to // repaint. - non_client_view_->SchedulePaint(); + GetWindow()->non_client_view()->SchedulePaint(); // Update the native frame's icon. We do this regardless of whether or not // the native frame is being used, since this also updates the taskbar, etc. - SkBitmap icon = window_delegate_->GetWindowIcon(); + SkBitmap icon = GetWindow()->window_delegate()->GetWindowIcon(); if (!icon.isNull()) { HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(icon); // We need to make sure to destroy the previous icon, otherwise we'll leak @@ -523,7 +525,7 @@ void WindowWin::UpdateWindowIcon() { DestroyIcon(old_icon); } - icon = window_delegate_->GetWindowAppIcon(); + icon = GetWindow()->window_delegate()->GetWindowAppIcon(); if (!icon.isNull()) { HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(icon); HICON old_icon = reinterpret_cast<HICON>( @@ -552,18 +554,6 @@ void WindowWin::UpdateFrameAfterFrameChange() { ResetWindowRegion(true); } -WindowDelegate* WindowWin::GetDelegate() const { - return window_delegate_; -} - -NonClientView* WindowWin::GetNonClientView() const { - return non_client_view_; -} - -ClientView* WindowWin::GetClientView() const { - return non_client_view_->client_view(); -} - gfx::NativeWindow WindowWin::GetNativeWindow() const { return GetNativeView(); } @@ -585,8 +575,8 @@ void WindowWin::FrameTypeChanged() { // DWMNCRP_ENABLED is used for the native frame case. _DISABLED means the // DWM doesn't render glass, and so is used in the custom frame case. DWMNCRENDERINGPOLICY policy = - non_client_view_->UseNativeFrame() ? DWMNCRP_ENABLED - : DWMNCRP_DISABLED; + GetWindow()->non_client_view()->UseNativeFrame() ? DWMNCRP_ENABLED + : DWMNCRP_DISABLED; DwmSetWindowAttribute(GetNativeView(), DWMWA_NCRENDERING_POLICY, &policy, sizeof(DWMNCRENDERINGPOLICY)); } @@ -599,7 +589,7 @@ void WindowWin::FrameTypeChanged() { // Update the non-client view with the correct frame view for the active frame // type. - non_client_view_->UpdateFrame(); + GetWindow()->non_client_view()->UpdateFrame(); // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want // to notify our children too, since we can have MDI child windows who need to @@ -622,10 +612,9 @@ gfx::Font WindowWin::GetWindowTitleFont() { WindowWin::WindowWin(WindowDelegate* window_delegate) : WidgetWin(), + Window(window_delegate), ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)), focus_on_creation_(true), - window_delegate_(window_delegate), - non_client_view_(new NonClientView(this)), owning_hwnd_(NULL), minimum_size_(100, 100), is_modal_(false), @@ -645,9 +634,6 @@ WindowWin::WindowWin(WindowDelegate* window_delegate) set_native_window(this); is_window_ = true; InitClass(); - DCHECK(window_delegate_); - DCHECK(!window_delegate_->window_); - window_delegate_->window_ = this; // Initialize these values to 0 so that subclasses can override the default // behavior before calling Init. set_window_style(0); @@ -660,7 +646,7 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) { owning_hwnd_ = parent; // We call this after initializing our members since our implementations of // assorted WidgetWin functions may be called during initialization. - is_modal_ = window_delegate_->IsModal(); + is_modal_ = GetWindow()->window_delegate()->IsModal(); if (is_modal_) BecomeModal(); @@ -674,8 +660,9 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) { // Create the ClientView, add it to the NonClientView and add the // NonClientView to the RootView. This will cause everything to be parented. - non_client_view_->set_client_view(window_delegate_->CreateClientView(this)); - WidgetWin::SetContentsView(non_client_view_); + GetWindow()->non_client_view()->set_client_view( + GetWindow()->window_delegate()->CreateClientView(this)); + WidgetWin::SetContentsView(GetWindow()->non_client_view()); UpdateWindowTitle(); UpdateAccessibleRole(); @@ -690,14 +677,14 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) { void WindowWin::SizeWindowToDefault() { ui::CenterAndSizeWindow(owning_window(), GetNativeView(), - non_client_view_->GetPreferredSize(), + GetWindow()->non_client_view()->GetPreferredSize(), false); } gfx::Insets WindowWin::GetClientAreaInsets() const { // Returning an empty Insets object causes the default handling in // WidgetWin::OnNCCalcSize() to be invoked. - if (GetNonClientView()->UseNativeFrame()) + if (GetWindow()->non_client_view()->UseNativeFrame()) return gfx::Insets(); if (IsMaximized()) { @@ -734,7 +721,7 @@ void WindowWin::OnActivateApp(BOOL active, DWORD thread_id) { // Another application was activated, we should reset any state that // disables inactive rendering now. disable_inactive_rendering_ = false; - non_client_view_->DisableInactiveRendering(false); + GetWindow()->non_client_view()->DisableInactiveRendering(false); // Update the native frame too, since it could be rendering the non-client // area. CallDefaultNCActivateHandler(FALSE); @@ -745,7 +732,7 @@ LRESULT WindowWin::OnAppCommand(HWND window, short app_command, WORD device, int keystate) { // We treat APPCOMMAND ids as an extension of our command namespace, and just // let the delegate figure out what to do... - if (!window_delegate_->ExecuteWindowsCommand(app_command)) + if (!GetWindow()->window_delegate()->ExecuteWindowsCommand(app_command)) return WidgetWin::OnAppCommand(window, app_command, device, keystate); return 0; } @@ -754,13 +741,13 @@ void WindowWin::OnCommand(UINT notification_code, int command_id, HWND window) { // If the notification code is > 1 it means it is control specific and we // should ignore it. if (notification_code > 1 || - window_delegate_->ExecuteWindowsCommand(command_id)) { + GetWindow()->window_delegate()->ExecuteWindowsCommand(command_id)) { WidgetWin::OnCommand(notification_code, command_id, window); } } void WindowWin::OnDestroy() { - non_client_view_->WindowClosing(); + delegate_->OnWindowDestroying(); RestoreEnabledIfNecessary(); WidgetWin::OnDestroy(); } @@ -778,15 +765,12 @@ LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param, } void WindowWin::OnFinalMessage(HWND window) { - // Delete and NULL the delegate here once we're guaranteed to get no more - // messages. - window_delegate_->DeleteDelegate(); - window_delegate_ = NULL; + delegate_->OnWindowDestroyed(); WidgetWin::OnFinalMessage(window); } void WindowWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { - gfx::Size min_window_size(GetNonClientView()->GetMinimumSize()); + gfx::Size min_window_size(GetWindow()->non_client_view()->GetMinimumSize()); minmax_info->ptMinTrackSize.x = min_window_size.width(); minmax_info->ptMinTrackSize.y = min_window_size.height(); WidgetWin::OnGetMinMaxInfo(minmax_info); @@ -802,7 +786,7 @@ static void EnableMenuItem(HMENU menu, UINT command, bool enabled) { void WindowWin::OnInitMenu(HMENU menu) { // We only need to manually enable the system menu if we're not using a native // frame. - if (non_client_view_->UseNativeFrame()) + if (GetWindow()->non_client_view()->UseNativeFrame()) WidgetWin::OnInitMenu(menu); bool is_fullscreen = IsFullscreen(); @@ -813,17 +797,20 @@ void WindowWin::OnInitMenu(HMENU menu) { ScopedRedrawLock lock(this); EnableMenuItem(menu, SC_RESTORE, is_minimized || is_maximized); EnableMenuItem(menu, SC_MOVE, is_restored); - EnableMenuItem(menu, SC_SIZE, window_delegate_->CanResize() && is_restored); + EnableMenuItem(menu, SC_SIZE, + GetWindow()->window_delegate()->CanResize() && is_restored); EnableMenuItem(menu, SC_MAXIMIZE, - window_delegate_->CanMaximize() && !is_fullscreen && !is_maximized); + GetWindow()->window_delegate()->CanMaximize() && + !is_fullscreen && !is_maximized); EnableMenuItem(menu, SC_MINIMIZE, - window_delegate_->CanMaximize() && !is_minimized); + GetWindow()->window_delegate()->CanMaximize() && + !is_minimized); } void WindowWin::OnMouseLeave() { // We only need to manually track WM_MOUSELEAVE messages between the client // and non-client area when we're not using the native frame. - if (non_client_view_->UseNativeFrame()) { + if (GetWindow()->non_client_view()->UseNativeFrame()) { SetMsgHandled(FALSE); return; } @@ -854,14 +841,14 @@ LRESULT WindowWin::OnNCActivate(BOOL active) { // We can get WM_NCACTIVATE before we're actually visible. If we're not // visible, no need to paint. if (IsVisible()) - non_client_view_->SchedulePaint(); + GetWindow()->non_client_view()->SchedulePaint(); // If we're active again, we should be allowed to render as inactive, so // tell the non-client view. This must be done independently of the check for // disable_inactive_rendering_ since that check is valid even if the frame // is not active, but this can only be done if we've become active. if (IsActive()) - non_client_view_->DisableInactiveRendering(false); + GetWindow()->non_client_view()->DisableInactiveRendering(false); // Reset the disable inactive rendering state since activation has changed. if (disable_inactive_rendering_) { @@ -913,7 +900,7 @@ LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { if (EdgeHasTopmostAutoHideTaskbar(ABE_LEFT, monitor)) client_rect->left += kAutoHideTaskbarThicknessPx; if (EdgeHasTopmostAutoHideTaskbar(ABE_TOP, monitor)) { - if (GetNonClientView()->UseNativeFrame()) { + if (GetWindow()->non_client_view()->UseNativeFrame()) { // Tricky bit. Due to a bug in DwmDefWindowProc()'s handling of // WM_NCHITTEST, having any nonclient area atop the window causes the // caption buttons to draw onscreen but not respond to mouse @@ -956,7 +943,8 @@ LRESULT WindowWin::OnNCHitTest(const CPoint& point) { // provides any of the non-client area. CPoint temp = point; MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1); - int component = non_client_view_->NonClientHitTest(gfx::Point(temp)); + int component = + GetWindow()->non_client_view()->NonClientHitTest(gfx::Point(temp)); if (component != HTNOWHERE) return component; @@ -968,13 +956,13 @@ LRESULT WindowWin::OnNCHitTest(const CPoint& point) { void WindowWin::OnNCPaint(HRGN rgn) { // When using a custom frame, we want to avoid calling DefWindowProc() since // that may render artifacts. - SetMsgHandled(!non_client_view_->UseNativeFrame()); + SetMsgHandled(!GetWindow()->non_client_view()->UseNativeFrame()); } void WindowWin::OnNCLButtonDown(UINT ht_component, const CPoint& point) { // When we're using a native frame, window controls work without us // interfering. - if (!non_client_view_->UseNativeFrame()) { + if (!GetWindow()->non_client_view()->UseNativeFrame()) { switch (ht_component) { case HTCLOSE: case HTMINBUTTON: @@ -1056,7 +1044,7 @@ LRESULT WindowWin::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param) { // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for // an explanation about why we need to handle this message. - SetMsgHandled(!non_client_view_->UseNativeFrame()); + SetMsgHandled(!GetWindow()->non_client_view()->UseNativeFrame()); return 0; } @@ -1064,7 +1052,7 @@ LRESULT WindowWin::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { // See comment in widget_win.h at the definition of WM_NCUAHDRAWCAPTION for // an explanation about why we need to handle this message. - SetMsgHandled(!non_client_view_->UseNativeFrame()); + SetMsgHandled(!GetWindow()->non_client_view()->UseNativeFrame()); return 0; } @@ -1116,11 +1104,11 @@ void WindowWin::OnSysCommand(UINT notification_code, CPoint click) { ((notification_code & sc_mask) == SC_MOVE) || ((notification_code & sc_mask) == SC_MAXIMIZE))) return; - if (!non_client_view_->UseNativeFrame()) { + if (!GetWindow()->non_client_view()->UseNativeFrame()) { if ((notification_code & sc_mask) == SC_MINIMIZE || (notification_code & sc_mask) == SC_MAXIMIZE || (notification_code & sc_mask) == SC_RESTORE) { - non_client_view_->ResetWindowControls(); + GetWindow()->non_client_view()->ResetWindowControls(); } else if ((notification_code & sc_mask) == SC_MOVE || (notification_code & sc_mask) == SC_SIZE) { if (lock_updates_) { @@ -1146,7 +1134,7 @@ void WindowWin::OnSysCommand(UINT notification_code, CPoint click) { } // First see if the delegate can handle it. - if (window_delegate_->ExecuteWindowsCommand(notification_code)) + if (GetWindow()->window_delegate()->ExecuteWindowsCommand(notification_code)) return; // Use the default implementation for any other command. @@ -1244,7 +1232,7 @@ void WindowWin::SetInitialFocus() { if (!focus_on_creation_) return; - View* v = window_delegate_->GetInitiallyFocusedView(); + View* v = GetWindow()->window_delegate()->GetInitiallyFocusedView(); if (v) { v->RequestFocus(); } else { @@ -1261,13 +1249,14 @@ void WindowWin::SetInitialBounds(const gfx::Rect& create_bounds) { // state will have been lost. Sadly there's no way to tell on Windows when // a window is restored from maximized state, so we can't more accurately // track maximized state independently of sizing information. - window_delegate_->GetSavedMaximizedState(&saved_maximized_state_); + GetWindow()->window_delegate()->GetSavedMaximizedState( + &saved_maximized_state_); // Restore the window's placement from the controller. gfx::Rect saved_bounds(create_bounds.ToRECT()); - if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) { - if (!window_delegate_->ShouldRestoreWindowSize()) { - saved_bounds.set_size(non_client_view_->GetPreferredSize()); + if (GetWindow()->window_delegate()->GetSavedWindowBounds(&saved_bounds)) { + if (!GetWindow()->window_delegate()->ShouldRestoreWindowSize()) { + saved_bounds.set_size(GetWindow()->non_client_view()->GetPreferredSize()); } else { // Make sure the bounds are at least the minimum size. if (saved_bounds.width() < minimum_size_.width()) { @@ -1319,14 +1308,14 @@ void WindowWin::RestoreEnabledIfNecessary() { DWORD WindowWin::CalculateWindowStyle() { DWORD window_styles = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_SYSMENU | WS_CAPTION; - bool can_resize = window_delegate_->CanResize(); - bool can_maximize = window_delegate_->CanMaximize(); + bool can_resize = GetWindow()->window_delegate()->CanResize(); + bool can_maximize = GetWindow()->window_delegate()->CanMaximize(); if (can_maximize) { window_styles |= WS_OVERLAPPEDWINDOW; } else if (can_resize) { window_styles |= WS_OVERLAPPED | WS_THICKFRAME; } - if (window_delegate_->AsDialogDelegate()) { + if (GetWindow()->window_delegate()->AsDialogDelegate()) { window_styles |= DS_MODALFRAME; // NOTE: Turning this off means we lose the close button, which is bad. // Turning it on though means the user can maximize or size the window @@ -1339,7 +1328,7 @@ DWORD WindowWin::CalculateWindowStyle() { DWORD WindowWin::CalculateWindowExStyle() { DWORD window_ex_styles = 0; - if (window_delegate_->AsDialogDelegate()) + if (GetWindow()->window_delegate()->AsDialogDelegate()) window_ex_styles |= WS_EX_DLGMODALFRAME; return window_ex_styles; } @@ -1349,13 +1338,13 @@ void WindowWin::SaveWindowPosition() { // by go/crash) that in some circumstances we can end up here after // WM_DESTROY, at which point the window delegate is likely gone. So just // bail. - if (!window_delegate_) + if (!GetWindow()->window_delegate()) return; bool maximized; gfx::Rect bounds; GetWindowBoundsAndMaximizedState(&bounds, &maximized); - window_delegate_->SaveWindowPlacement(bounds, maximized); + GetWindow()->window_delegate()->SaveWindowPlacement(bounds, maximized); } void WindowWin::LockUpdates() { @@ -1372,7 +1361,7 @@ void WindowWin::UnlockUpdates() { void WindowWin::ResetWindowRegion(bool force) { // A native frame uses the native window region, and we don't want to mess // with it. - if (non_client_view_->UseNativeFrame()) { + if (GetWindow()->non_client_view()->UseNativeFrame()) { if (force) SetWindowRgn(NULL, TRUE); return; @@ -1397,7 +1386,7 @@ void WindowWin::ResetWindowRegion(bool force) { new_region = CreateRectRgnIndirect(&work_rect); } else { gfx::Path window_mask; - non_client_view_->GetWindowMask( + GetWindow()->non_client_view()->GetWindowMask( gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); new_region = window_mask.CreateNativeRegion(); } @@ -1431,7 +1420,8 @@ void WindowWin::UpdateAccessibleRole() { IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); if (SUCCEEDED(hr)) { VARIANT var; - AccessibilityTypes::Role role = window_delegate_->accessible_role(); + AccessibilityTypes::Role role = + GetWindow()->window_delegate()->accessible_role(); if (role) { var.vt = VT_I4; var.lVal = ViewAccessibility::MSAARole(role); @@ -1447,7 +1437,8 @@ void WindowWin::UpdateAccessibleState() { IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); if (SUCCEEDED(hr)) { VARIANT var; - AccessibilityTypes::State state = window_delegate_->accessible_state(); + AccessibilityTypes::State state = + GetWindow()->window_delegate()->accessible_state(); if (state) { var.lVal = ViewAccessibility::MSAAState(state); hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, diff --git a/views/window/window_win.h b/views/window/window_win.h index aeab57f..e9db7687 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -96,9 +96,6 @@ class WindowWin : public WidgetWin, virtual void SetIsAlwaysOnTop(bool always_on_top); virtual NonClientFrameView* CreateFrameViewForWindow(); virtual void UpdateFrameAfterFrameChange(); - virtual WindowDelegate* GetDelegate() const; - virtual NonClientView* GetNonClientView() const; - virtual ClientView* GetClientView() const; virtual gfx::NativeWindow GetNativeWindow() const; virtual bool ShouldUseNativeFrame() const; virtual void FrameTypeChanged(); @@ -240,15 +237,6 @@ class WindowWin : public WidgetWin, // A delegate implementation that handles events received here. internal::NativeWindowDelegate* delegate_; - // Our window delegate (see Init method for documentation). - WindowDelegate* window_delegate_; - - // The View that provides the non-client area of the window (title bar, - // window controls, sizing borders etc). To use an implementation other than - // the default, this class must be subclassed and this value set to the - // desired implementation before calling |Init|. - NonClientView* non_client_view_; - // Whether we should SetFocus() on a newly created window after // Init(). Defaults to true. bool focus_on_creation_; |