diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 20:31:30 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 20:31:30 +0000 |
commit | 5d7688381483532b842b500b95042f4548f22291 (patch) | |
tree | e8db4aacb20eb8cb7221be60d951cae20f5f23a5 /views/window | |
parent | 32de41423d352fb1932f538803193f54b3cc2a26 (diff) | |
download | chromium_src-5d7688381483532b842b500b95042f4548f22291.zip chromium_src-5d7688381483532b842b500b95042f4548f22291.tar.gz chromium_src-5d7688381483532b842b500b95042f4548f22291.tar.bz2 |
Move the last of the easy stuff from Window onto Widget.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/7080060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/native_window.h | 23 | ||||
-rw-r--r-- | views/window/native_window_gtk.cc | 51 | ||||
-rw-r--r-- | views/window/native_window_gtk.h | 10 | ||||
-rw-r--r-- | views/window/native_window_views.cc | 31 | ||||
-rw-r--r-- | views/window/native_window_views.h | 10 | ||||
-rw-r--r-- | views/window/native_window_win.cc | 192 | ||||
-rw-r--r-- | views/window/native_window_win.h | 34 | ||||
-rw-r--r-- | views/window/window.cc | 22 | ||||
-rw-r--r-- | views/window/window.h | 4 |
9 files changed, 11 insertions, 366 deletions
diff --git a/views/window/native_window.h b/views/window/native_window.h index 1decf93..dc3a579 100644 --- a/views/window/native_window.h +++ b/views/window/native_window.h @@ -61,35 +61,12 @@ class NativeWindow { // Makes the NativeWindow modal. virtual void BecomeModal() = 0; - // Centers the window and sizes it to the specified size. - virtual void CenterWindow(const gfx::Size& size) = 0; - - // Retrieves the window's current restored bounds and maximized state, for - // persisting. - virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const = 0; - // Enables or disables the close button for the window. virtual void EnableClose(bool enable) = 0; - // Sets the NativeWindow title. - virtual void SetWindowTitle(const std::wstring& title) = 0; - - // Sets the Window icons. |window_icon| is a 16x16 icon suitable for use in - // a title bar. |app_icon| is a larger size for use in the host environment - // app switching UI. - virtual void SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) = 0; - - // Update native accessibility properties on the native window. - virtual void SetAccessibleName(const std::wstring& name) = 0; - virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) = 0; - virtual void SetAccessibleState(ui::AccessibilityTypes::State state) = 0; - // Window pass-thrus --------------------------------------------------------- // See documentation in window.h - virtual void SetUseDragFrame(bool use_drag_frame) = 0; virtual NonClientFrameView* CreateFrameViewForWindow() = 0; virtual void UpdateFrameAfterFrameChange() = 0; virtual bool ShouldUseNativeFrame() const = 0; diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc index d01ffe4..7d238d4 100644 --- a/views/window/native_window_gtk.cc +++ b/views/window/native_window_gtk.cc @@ -10,7 +10,6 @@ #include "ui/gfx/path.h" #include "ui/gfx/rect.h" #include "views/events/event.h" -#include "views/screen.h" #include "views/window/hit_test.h" #include "views/window/native_window_delegate.h" #include "views/window/non_client_view.h" @@ -227,56 +226,10 @@ void NativeWindowGtk::BecomeModal() { gtk_window_set_modal(GetNativeWindow(), true); } -void NativeWindowGtk::CenterWindow(const gfx::Size& size) { - gfx::Rect center_rect; - - GtkWindow* parent = gtk_window_get_transient_for(GetNativeWindow()); - if (parent) { - // We have a parent window, center over it. - gint parent_x = 0; - gint parent_y = 0; - gtk_window_get_position(parent, &parent_x, &parent_y); - gint parent_w = 0; - gint parent_h = 0; - gtk_window_get_size(parent, &parent_w, &parent_h); - center_rect = gfx::Rect(parent_x, parent_y, parent_w, parent_h); - } else { - // We have no parent window, center over the screen. - center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); - } - gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, - center_rect.y() + (center_rect.height() - size.height()) / 2, - size.width(), size.height()); - SetBoundsConstrained(bounds, NULL); -} - -void NativeWindowGtk::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const { - // Do nothing for now. ChromeOS isn't yet saving window placement. -} - void NativeWindowGtk::EnableClose(bool enable) { gtk_window_set_deletable(GetNativeWindow(), enable); } -void NativeWindowGtk::SetWindowTitle(const std::wstring& title) { - // We don't have a window title on ChromeOS (right now). -} - -void NativeWindowGtk::SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) { - // We don't have window icons on ChromeOS. -} - -void NativeWindowGtk::SetAccessibleName(const std::wstring& name) { -} - -void NativeWindowGtk::SetAccessibleRole(ui::AccessibilityTypes::Role role) { -} - -void NativeWindowGtk::SetAccessibleState(ui::AccessibilityTypes::State state) { -} - Window* NativeWindowGtk::GetWindow() { return delegate_->AsWindow(); } @@ -285,10 +238,6 @@ const Window* NativeWindowGtk::GetWindow() const { return delegate_->AsWindow(); } -void NativeWindowGtk::SetUseDragFrame(bool use_drag_frame) { - NOTIMPLEMENTED(); -} - NonClientFrameView* NativeWindowGtk::CreateFrameViewForWindow() { return NULL; } diff --git a/views/window/native_window_gtk.h b/views/window/native_window_gtk.h index 776356b..f939f97 100644 --- a/views/window/native_window_gtk.h +++ b/views/window/native_window_gtk.h @@ -51,17 +51,7 @@ class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow { virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual void ShowNativeWindow(ShowState state) OVERRIDE; virtual void BecomeModal() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; - virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const OVERRIDE; virtual void EnableClose(bool enable) OVERRIDE; - virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; - virtual void SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) OVERRIDE; - virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; - virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; - virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; virtual void UpdateFrameAfterFrameChange() OVERRIDE; virtual bool ShouldUseNativeFrame() const OVERRIDE; diff --git a/views/window/native_window_views.cc b/views/window/native_window_views.cc index b37e9d3..c9f2a84 100644 --- a/views/window/native_window_views.cc +++ b/views/window/native_window_views.cc @@ -53,41 +53,10 @@ void NativeWindowViews::BecomeModal() { NOTIMPLEMENTED(); } -void NativeWindowViews::CenterWindow(const gfx::Size& size) { - // TODO(beng): actually center. - GetView()->SetBounds(0, 0, size.width(), size.height()); -} - -void NativeWindowViews::GetWindowBoundsAndMaximizedState( - gfx::Rect* bounds, - bool* maximized) const { - *bounds = GetView()->bounds(); - *maximized = false; -} void NativeWindowViews::EnableClose(bool enable) { } -void NativeWindowViews::SetWindowTitle(const std::wstring& title) { -} - -void NativeWindowViews::SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) { -} - -void NativeWindowViews::SetAccessibleName(const std::wstring& name) { -} - -void NativeWindowViews::SetAccessibleRole(ui::AccessibilityTypes::Role role) { -} - -void NativeWindowViews::SetAccessibleState( - ui::AccessibilityTypes::State state) { -} - -void NativeWindowViews::SetUseDragFrame(bool use_drag_frame) { -} - NonClientFrameView* NativeWindowViews::CreateFrameViewForWindow() { return NULL; } diff --git a/views/window/native_window_views.h b/views/window/native_window_views.h index c75d126..20eb3d0 100644 --- a/views/window/native_window_views.h +++ b/views/window/native_window_views.h @@ -32,17 +32,7 @@ class NativeWindowViews : public NativeWidgetViews, virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual void ShowNativeWindow(ShowState state) OVERRIDE; virtual void BecomeModal() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; - virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const OVERRIDE; virtual void EnableClose(bool enable) OVERRIDE; - virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; - virtual void SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) OVERRIDE; - virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; - virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; - virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; virtual void UpdateFrameAfterFrameChange() OVERRIDE; virtual bool ShouldUseNativeFrame() const OVERRIDE; diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc index 9d12226..db688df 100644 --- a/views/window/native_window_win.cc +++ b/views/window/native_window_win.cc @@ -18,7 +18,6 @@ #include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/font.h" -#include "ui/gfx/icon_util.h" #include "ui/gfx/path.h" #include "views/accessibility/native_view_accessibility_win.h" #include "views/window/client_view.h" @@ -30,8 +29,6 @@ namespace views { namespace { -static const int kDragFrameWindowAlpha = 200; - // The thickness of an auto-hide taskbar in pixels. static const int kAutoHideTaskbarThicknessPx = 2; @@ -180,7 +177,6 @@ class NativeWindowWin::ScopedRedrawLock { NativeWindowWin::NativeWindowWin(internal::NativeWindowDelegate* delegate) : NativeWidgetWin(delegate->AsNativeWidgetDelegate()), delegate_(delegate), - focus_on_creation_(true), restored_enabled_(false), is_active_(false), lock_updates_(false), @@ -291,31 +287,6 @@ void NativeWindowWin::OnActivateApp(BOOL active, DWORD thread_id) { } } -LRESULT NativeWindowWin::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... - return GetWindow()->window_delegate()->ExecuteWindowsCommand(app_command) || - NativeWidgetWin::OnAppCommand(window, app_command, device, keystate); -} - -void NativeWindowWin::OnClose() { - GetWindow()->Close(); -} - -void NativeWindowWin::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 || - GetWindow()->window_delegate()->ExecuteWindowsCommand(command_id)) { - NativeWidgetWin::OnCommand(notification_code, command_id, window); - } -} - void NativeWindowWin::OnDestroy() { delegate_->OnNativeWindowDestroying(); RestoreEnabledIfNecessary(); @@ -763,18 +734,6 @@ LRESULT NativeWindowWin::OnSetText(const wchar_t* text) { reinterpret_cast<LPARAM>(text)); } -void NativeWindowWin::OnSettingChange(UINT flags, const wchar_t* section) { - if (!GetParent() && (flags == SPI_SETWORKAREA)) { - // Fire a dummy SetWindowPos() call, so we'll trip the code in - // OnWindowPosChanging() below that notices work area changes. - ::SetWindowPos(GetNativeView(), 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | - SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); - SetMsgHandled(TRUE); - } else { - NativeWidgetWin::OnSettingChange(flags, section); - } -} - void NativeWindowWin::OnSize(UINT size_param, const CSize& new_size) { delegate_->OnNativeWindowBoundsChanged(); RedrawWindow(GetNativeView(), NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); @@ -896,40 +855,6 @@ void NativeWindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) { NativeWidgetWin::OnWindowPosChanging(window_pos); } -void NativeWindowWin::Close() { - NativeWidgetWin::Close(); - - // If the user activates another app after opening us, then comes back and - // closes us, we want our owner to gain activation. But only if the owner - // is visible. If we don't manually force that here, the other app will - // regain activation instead. - // It's tempting to think that this could be done from OnDestroy, but by then - // it's too late - GetForegroundWindow() will return the window that Windows - // has decided to re-activate for us instead of this dialog. It's also - // tempting to think about removing the foreground window check entirely, but - // it's necessary to this code path from being triggered when an inactive - // window is closed. - HWND owner = GetOwner(GetNativeView()); - if (owner && GetNativeView() == GetForegroundWindow() && - IsWindowVisible(owner)) { - SetForegroundWindow(owner); - } -} - -void NativeWindowWin::SetInitialFocus() { - if (!focus_on_creation_) - return; - - View* v = GetWindow()->window_delegate()->GetInitiallyFocusedView(); - if (v) { - v->RequestFocus(); - } else { - // The window does not get keyboard messages unless we focus it, not sure - // why. - SetFocus(GetNativeView()); - } -} - //////////////////////////////////////////////////////////////////////////////// // NativeWindowWin, NativeWindow implementation: @@ -987,36 +912,6 @@ void NativeWindowWin::BecomeModal() { } } -void NativeWindowWin::CenterWindow(const gfx::Size& size) { - HWND parent = GetParent(); - if (!IsWindow()) - parent = GetOwner(GetNativeView()); - ui::CenterAndSizeWindow(parent, GetNativeView(), size, false); -} - -void NativeWindowWin::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const { - WINDOWPLACEMENT wp; - wp.length = sizeof(wp); - const bool succeeded = !!GetWindowPlacement(GetNativeView(), &wp); - DCHECK(succeeded); - - if (bounds != NULL) { - MONITORINFO mi; - mi.cbSize = sizeof(mi); - const bool succeeded = !!GetMonitorInfo( - MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST), &mi); - DCHECK(succeeded); - *bounds = gfx::Rect(wp.rcNormalPosition); - // Convert normal position from workarea coordinates to screen coordinates. - bounds->Offset(mi.rcWork.left - mi.rcMonitor.left, - mi.rcWork.top - mi.rcMonitor.top); - } - - if (maximized != NULL) - *maximized = (wp.showCmd == SW_SHOWMAXIMIZED); -} - void NativeWindowWin::EnableClose(bool 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. @@ -1024,93 +919,6 @@ void NativeWindowWin::EnableClose(bool enable) { SendFrameChanged(GetNativeView()); } -void NativeWindowWin::SetWindowTitle(const std::wstring& title) { - SetWindowText(GetNativeView(), title.c_str()); - SetAccessibleName(title); -} - -void NativeWindowWin::SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) { - if (!window_icon.isNull()) { - HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(window_icon); - // We need to make sure to destroy the previous icon, otherwise we'll leak - // these GDI objects until we crash! - HICON old_icon = reinterpret_cast<HICON>( - SendMessage(GetNativeView(), WM_SETICON, ICON_SMALL, - reinterpret_cast<LPARAM>(windows_icon))); - if (old_icon) - DestroyIcon(old_icon); - } - if (!app_icon.isNull()) { - HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(app_icon); - HICON old_icon = reinterpret_cast<HICON>( - SendMessage(GetNativeView(), WM_SETICON, ICON_BIG, - reinterpret_cast<LPARAM>(windows_icon))); - if (old_icon) - DestroyIcon(old_icon); - } -} - -void NativeWindowWin::SetAccessibleName(const std::wstring& name) { - base::win::ScopedComPtr<IAccPropServices> pAccPropServices; - HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, - IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); - if (SUCCEEDED(hr)) { - VARIANT var; - var.vt = VT_BSTR; - var.bstrVal = SysAllocString(name.c_str()); - hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, - CHILDID_SELF, PROPID_ACC_NAME, var); - } -} - -void NativeWindowWin::SetAccessibleRole(ui::AccessibilityTypes::Role role) { - base::win::ScopedComPtr<IAccPropServices> pAccPropServices; - HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, - IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); - if (SUCCEEDED(hr)) { - VARIANT var; - if (role) { - var.vt = VT_I4; - var.lVal = NativeViewAccessibilityWin::MSAARole(role); - hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, - CHILDID_SELF, PROPID_ACC_ROLE, var); - } - } -} - -void NativeWindowWin::SetAccessibleState(ui::AccessibilityTypes::State state) { - base::win::ScopedComPtr<IAccPropServices> pAccPropServices; - HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, - IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); - if (SUCCEEDED(hr)) { - VARIANT var; - if (state) { - var.lVal = NativeViewAccessibilityWin::MSAAState(state); - hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, - CHILDID_SELF, PROPID_ACC_STATE, var); - } - } -} - -void NativeWindowWin::SetUseDragFrame(bool use_drag_frame) { - if (use_drag_frame) { - // Make the frame slightly transparent during the drag operation. - drag_frame_saved_window_style_ = GetWindowLong(GWL_STYLE); - drag_frame_saved_window_ex_style_ = GetWindowLong(GWL_EXSTYLE); - SetWindowLong(GWL_EXSTYLE, - drag_frame_saved_window_ex_style_ | WS_EX_LAYERED); - // Remove the captions tyle so the window doesn't have window controls for a - // more "transparent" look. - SetWindowLong(GWL_STYLE, drag_frame_saved_window_style_ & ~WS_CAPTION); - SetLayeredWindowAttributes(GetNativeWindow(), RGB(0xFF, 0xFF, 0xFF), - kDragFrameWindowAlpha, LWA_ALPHA); - } else { - SetWindowLong(GWL_STYLE, drag_frame_saved_window_style_); - SetWindowLong(GWL_EXSTYLE, drag_frame_saved_window_ex_style_); - } -} - NonClientFrameView* NativeWindowWin::CreateFrameViewForWindow() { return GetWindow()->ShouldUseNativeFrame() ? new NativeFrameView(GetWindow()) : NULL; diff --git a/views/window/native_window_win.h b/views/window/native_window_win.h index df374d2..d251579 100644 --- a/views/window/native_window_win.h +++ b/views/window/native_window_win.h @@ -50,11 +50,6 @@ class NativeWindowWin : public NativeWidgetWin, // Show the window with the specified show command. void Show(int show_state); - // Accessors and setters for various properties. - void set_focus_on_creation(bool focus_on_creation) { - focus_on_creation_ = focus_on_creation; - } - // Returns the system set window title font. static gfx::Font GetWindowTitleFont(); @@ -80,14 +75,6 @@ class NativeWindowWin : public NativeWidgetWin, // Overridden from NativeWidgetWin: virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; virtual void OnActivateApp(BOOL active, DWORD thread_id) OVERRIDE; - virtual LRESULT OnAppCommand(HWND window, - short app_command, - WORD device, - int keystate) OVERRIDE; - virtual void OnClose() OVERRIDE; - virtual void OnCommand(UINT notification_code, - int command_id, - HWND window) OVERRIDE; virtual void OnDestroy() OVERRIDE; virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, @@ -117,12 +104,9 @@ class NativeWindowWin : public NativeWidgetWin, LPARAM l_param) OVERRIDE; virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) OVERRIDE; virtual LRESULT OnSetText(const wchar_t* text) OVERRIDE; - virtual void OnSettingChange(UINT flags, const wchar_t* section) OVERRIDE; virtual void OnSize(UINT size_param, const CSize& new_size) OVERRIDE; virtual void OnSysCommand(UINT notification_code, CPoint click) OVERRIDE; virtual void OnWindowPosChanging(WINDOWPOS* window_pos) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetInitialFocus() OVERRIDE; // Overridden from NativeWindow: virtual NativeWidget* AsNativeWidget() OVERRIDE; @@ -130,17 +114,7 @@ class NativeWindowWin : public NativeWidgetWin, virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual void ShowNativeWindow(ShowState state) OVERRIDE; virtual void BecomeModal() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; - virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, - bool* maximized) const OVERRIDE; virtual void EnableClose(bool enable) OVERRIDE; - virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; - virtual void SetWindowIcons(const SkBitmap& window_icon, - const SkBitmap& app_icon) OVERRIDE; - virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; - virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; - virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; virtual void UpdateFrameAfterFrameChange() OVERRIDE; virtual bool ShouldUseNativeFrame() const OVERRIDE; @@ -184,10 +158,6 @@ class NativeWindowWin : public NativeWidgetWin, // A delegate implementation that handles events received here. internal::NativeWindowDelegate* delegate_; - // Whether we should SetFocus() on a newly created window after - // Init(). Defaults to true. - bool focus_on_creation_; - // Whether all ancestors have been enabled. This is only used if is_modal_ is // true. bool restored_enabled_; @@ -219,10 +189,6 @@ class NativeWindowWin : public NativeWidgetWin, HMONITOR last_monitor_; gfx::Rect last_monitor_rect_, last_work_area_; - // The window styles before we modified them for the drag frame appearance. - DWORD drag_frame_saved_window_style_; - DWORD drag_frame_saved_window_ex_style_; - DISALLOW_COPY_AND_ASSIGN(NativeWindowWin); }; diff --git a/views/window/window.cc b/views/window/window.cc index 29e482c..b48b196 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -116,10 +116,6 @@ void Window::DisableInactiveRendering() { non_client_view_->DisableInactiveRendering(disable_inactive_rendering_); } -void Window::SetUseDragFrame(bool use_drag_frame) { - native_window_->SetUseDragFrame(use_drag_frame); -} - void Window::EnableClose(bool enable) { non_client_view_->EnableClose(enable); native_window_->EnableClose(enable); @@ -138,13 +134,14 @@ void Window::UpdateWindowTitle() { else window_title = WideToUTF16(window_delegate_->GetWindowTitle()); base::i18n::AdjustStringForLocaleDirection(&window_title); - native_window_->SetWindowTitle(UTF16ToWide(window_title)); + native_window_->AsNativeWidget()->SetWindowTitle(UTF16ToWide(window_title)); } void Window::UpdateWindowIcon() { non_client_view_->UpdateWindowIcon(); - native_window_->SetWindowIcons(window_delegate_->GetWindowIcon(), - window_delegate_->GetWindowAppIcon()); + native_window_->AsNativeWidget()->SetWindowIcons( + window_delegate_->GetWindowIcon(), + window_delegate_->GetWindowAppIcon()); } NonClientFrameView* Window::CreateFrameViewForWindow() { @@ -251,9 +248,9 @@ void Window::OnNativeWindowCreated(const gfx::Rect& bounds) { SetContentsView(non_client_view_); UpdateWindowTitle(); - native_window_->SetAccessibleRole( + native_window_->AsNativeWidget()->SetAccessibleRole( window_delegate_->GetAccessibleWindowRole()); - native_window_->SetAccessibleState( + native_window_->AsNativeWidget()->SetAccessibleState( window_delegate_->GetAccessibleWindowState()); SetInitialBounds(bounds); @@ -336,7 +333,8 @@ void Window::SetInitialBounds(const gfx::Rect& bounds) { if (bounds.IsEmpty()) { // No initial bounds supplied, so size the window to its content and // center over its parent. - native_window_->CenterWindow(non_client_view_->GetPreferredSize()); + native_window_->AsNativeWidget()->CenterWindow( + non_client_view_->GetPreferredSize()); } else { // Use the supplied initial bounds. SetBoundsConstrained(bounds, NULL); @@ -354,7 +352,9 @@ void Window::SaveWindowPosition() { bool maximized; gfx::Rect bounds; - native_window_->GetWindowBoundsAndMaximizedState(&bounds, &maximized); + native_window_->AsNativeWidget()->GetWindowBoundsAndMaximizedState( + &bounds, + &maximized); window_delegate_->SaveWindowPlacement(bounds, maximized); } diff --git a/views/window/window.h b/views/window/window.h index 5bdfcc2..98fc322 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -88,10 +88,6 @@ class Window : public Widget, // leads to sync problems. void DisableInactiveRendering(); - // Sets whether or not the window should show its frame as a "transient drag - // frame" - slightly transparent and without the standard window controls. - void SetUseDragFrame(bool use_drag_frame); - // Toggles the enable state for the Close button (and the Close menu item in // the system menu). void EnableClose(bool enable); |