diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 20:08:27 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 20:08:27 +0000 |
commit | 3e1a05ab9d6496e84879518d974320fbc561465c (patch) | |
tree | d814a827227ae6da31f9190382d91fae6c858668 /views/window | |
parent | f01338eeb06ed685095be2b39cedb664692feda0 (diff) | |
download | chromium_src-3e1a05ab9d6496e84879518d974320fbc561465c.zip chromium_src-3e1a05ab9d6496e84879518d974320fbc561465c.tar.gz chromium_src-3e1a05ab9d6496e84879518d974320fbc561465c.tar.bz2 |
Move methods from WindowDelegate onto WidgetDelegate.
BUG=72040
TEST=none
TBR=sky
Review URL: http://codereview.chromium.org/7078008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/window_delegate.cc | 112 | ||||
-rw-r--r-- | views/window/window_delegate.h | 110 |
2 files changed, 2 insertions, 220 deletions
diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc index 30ad955..d75f881 100644 --- a/views/window/window_delegate.cc +++ b/views/window/window_delegate.cc @@ -3,123 +3,13 @@ // found in the LICENSE file. #include "views/window/window_delegate.h" -#include "views/views_delegate.h" -#include "views/window/client_view.h" -#include "views/window/window.h" -#include "third_party/skia/include/core/SkBitmap.h" namespace views { -WindowDelegate::WindowDelegate() : window_(NULL) { +WindowDelegate::WindowDelegate() { } WindowDelegate::~WindowDelegate() { } -DialogDelegate* WindowDelegate::AsDialogDelegate() { - return NULL; -} - -bool WindowDelegate::CanResize() const { - return false; -} - -bool WindowDelegate::CanMaximize() const { - return false; -} - -bool WindowDelegate::CanActivate() const { - return true; -} - -bool WindowDelegate::IsModal() const { - return false; -} - -ui::AccessibilityTypes::Role WindowDelegate::GetAccessibleWindowRole() const { - return ui::AccessibilityTypes::ROLE_WINDOW; -} - -ui::AccessibilityTypes::State WindowDelegate::GetAccessibleWindowState() const { - return 0; -} - -std::wstring WindowDelegate::GetAccessibleWindowTitle() const { - return GetWindowTitle(); -} - -std::wstring WindowDelegate::GetWindowTitle() const { - return L""; -} - -bool WindowDelegate::ShouldShowWindowTitle() const { - return true; -} - -bool WindowDelegate::ShouldShowClientEdge() const { - return true; -} - -SkBitmap WindowDelegate::GetWindowAppIcon() { - // Use the window icon as app icon by default. - return GetWindowIcon(); -} - -// Returns the icon to be displayed in the window. -SkBitmap WindowDelegate::GetWindowIcon() { - return SkBitmap(); -} - -bool WindowDelegate::ShouldShowWindowIcon() const { - return false; -} - -bool WindowDelegate::ExecuteWindowsCommand(int command_id) { - return false; -} - -std::wstring WindowDelegate::GetWindowName() const { - return std::wstring(); -} - -void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds, - bool maximized) { - std::wstring window_name = GetWindowName(); - if (!ViewsDelegate::views_delegate || window_name.empty()) - return; - - ViewsDelegate::views_delegate->SaveWindowPlacement( - window_, window_name, bounds, maximized); -} - -bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const { - std::wstring window_name = GetWindowName(); - if (!ViewsDelegate::views_delegate || window_name.empty()) - return false; - - return ViewsDelegate::views_delegate->GetSavedWindowBounds( - window_, window_name, bounds); -} - -bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const { - std::wstring window_name = GetWindowName(); - if (!ViewsDelegate::views_delegate || window_name.empty()) - return false; - - return ViewsDelegate::views_delegate->GetSavedMaximizedState( - window_, window_name, maximized); -} - -bool WindowDelegate::ShouldRestoreWindowSize() const { - return true; -} - -View* WindowDelegate::GetContentsView() { - return NULL; -} - -ClientView* WindowDelegate::CreateClientView(Window* window) { - return new ClientView(window, GetContentsView()); -} - } // namespace views diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h index e6b3ac0..a7715ab 100644 --- a/views/window/window_delegate.h +++ b/views/window/window_delegate.h @@ -6,25 +6,10 @@ #define VIEWS_WINDOW_WINDOW_DELEGATE_H_ #pragma once -#include <string> - -#include "base/memory/scoped_ptr.h" -#include "ui/base/accessibility/accessibility_types.h" #include "views/widget/widget_delegate.h" -class SkBitmap; - -namespace gfx { -class Rect; -} - namespace views { -class ClientView; -class DialogDelegate; -class View; -class Window; - /////////////////////////////////////////////////////////////////////////////// // // WindowDelegate @@ -33,106 +18,13 @@ class Window; // Window. The window that is displayed uses this interface to determine how // it should be displayed and notify the delegate object of certain events. // -/////////////////////////////////////////////////////////////////////////////// class WindowDelegate : public WidgetDelegate { public: WindowDelegate(); virtual ~WindowDelegate(); - virtual DialogDelegate* AsDialogDelegate(); - - // Returns true if the window can ever be resized. - virtual bool CanResize() const; - - // Returns true if the window can ever be maximized. - virtual bool CanMaximize() const; - - // Returns true if the window can be activated. - virtual bool CanActivate() const; - - // Returns true if the dialog should be displayed modally to the window that - // opened it. Only windows with WindowType == DIALOG can be modal. - virtual bool IsModal() const; - - virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const; - - virtual ui::AccessibilityTypes::State GetAccessibleWindowState() const; - - // Returns the title to be read with screen readers. - virtual std::wstring GetAccessibleWindowTitle() const; - - // Returns the text to be displayed in the window title. - virtual std::wstring GetWindowTitle() const; - - // Returns true if the window should show a title in the title bar. - virtual bool ShouldShowWindowTitle() const; - - // Returns true if the window's client view wants a client edge. - virtual bool ShouldShowClientEdge() const; - - // Returns the app icon for the window. On Windows, this is the ICON_BIG used - // in Alt-Tab list and Win7's taskbar. - virtual SkBitmap GetWindowAppIcon(); - - // Returns the icon to be displayed in the window. - virtual SkBitmap GetWindowIcon(); - - // Returns true if a window icon should be shown. - virtual bool ShouldShowWindowIcon() const; - - // Execute a command in the window's controller. Returns true if the command - // was handled, false if it was not. - virtual bool ExecuteWindowsCommand(int command_id); - - // Returns the window's name identifier. Used to identify this window for - // state restoration. - virtual std::wstring GetWindowName() const; - - // Saves the window's bounds and maximized states. By default this uses the - // process' local state keyed by window name (See GetWindowName above). This - // behavior can be overridden to provide additional functionality. - virtual void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); - - // Retrieves the window's bounds and maximized states. - // This behavior can be overridden to provide additional functionality. - virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const; - virtual bool GetSavedMaximizedState(bool* maximized) const; - - // Returns true if the window's size should be restored. If this is false, - // only the window's origin is restored and the window is given its - // preferred size. - // Default is true. - virtual bool ShouldRestoreWindowSize() const; - - // Called when the window closes. The delegate MUST NOT delete itself during - // this call, since it can be called afterwards. See DeleteDelegate(). - virtual void WindowClosing() {} - - // Called when the window is destroyed. No events must be sent or received - // after this point. The delegate can use this opportunity to delete itself at - // this time if necessary. - virtual void DeleteDelegate() {} - - // Called when the window's activation state changes. - virtual void OnWindowActivationChanged(bool active) {} - - // Called when the user begins/ends to change the bounds of the window. - virtual void OnWindowBeginUserBoundsChange() {} - virtual void OnWindowEndUserBoundsChange() {} - - // Returns the View that is contained within this Window. - virtual View* GetContentsView(); - - // Called by the Window to create the Client View used to host the contents - // of the window. - virtual ClientView* CreateClientView(Window* window); - - Window* window() const { return window_; } - private: - friend class Window; - // The Window this delegate is bound to. Weak reference. - Window* window_; + DISALLOW_COPY_AND_ASSIGN(WindowDelegate); }; } // namespace views |