| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_VIEWS_WINDOW_DELEGATE_H_ | 5 #ifndef CHROME_VIEWS_WINDOW_DELEGATE_H_ |
| 6 #define CHROME_VIEWS_WINDOW_DELEGATE_H_ | 6 #define CHROME_VIEWS_WINDOW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 | 11 |
| 12 class SkBitmap; | 12 class SkBitmap; |
| 13 | 13 |
| 14 namespace gfx { |
| 15 class Rect; |
| 16 } |
| 14 // TODO(maruel): Remove once gfx::Rect is used instead. | 17 // TODO(maruel): Remove once gfx::Rect is used instead. |
| 15 namespace WTL { | 18 namespace WTL { |
| 16 class CRect; | 19 class CRect; |
| 17 } | 20 } |
| 18 using WTL::CRect; | 21 using WTL::CRect; |
| 19 | 22 |
| 20 namespace views { | 23 namespace views { |
| 21 | 24 |
| 22 class ClientView; | 25 class ClientView; |
| 23 class DialogDelegate; | 26 class DialogDelegate; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 92 |
| 90 // Returns true if a window icon should be shown. | 93 // Returns true if a window icon should be shown. |
| 91 virtual bool ShouldShowWindowIcon() const { | 94 virtual bool ShouldShowWindowIcon() const { |
| 92 return false; | 95 return false; |
| 93 } | 96 } |
| 94 | 97 |
| 95 // Execute a command in the window's controller. Returns true if the command | 98 // Execute a command in the window's controller. Returns true if the command |
| 96 // was handled, false if it was not. | 99 // was handled, false if it was not. |
| 97 virtual bool ExecuteWindowsCommand(int command_id) { return false; } | 100 virtual bool ExecuteWindowsCommand(int command_id) { return false; } |
| 98 | 101 |
| 99 // Saves the specified bounds, maximized and always on top state as the | 102 // Returns the window's name identifier. Used to identify this window for |
| 100 // window's position to/ be restored the next time it is shown. | 103 // state restoration. |
| 101 virtual void SaveWindowPosition(const CRect& bounds, | 104 virtual std::wstring GetWindowName() const { |
| 102 bool maximized, | 105 return std::wstring(); |
| 103 bool always_on_top) { } | |
| 104 | |
| 105 // returns true if there was a saved position, false if there was none and | |
| 106 // the default should be used. | |
| 107 virtual bool RestoreWindowPosition(CRect* bounds, | |
| 108 bool* maximized, | |
| 109 bool* always_on_top) { | |
| 110 return false; | |
| 111 } | 106 } |
| 112 | 107 |
| 108 // Saves the window's bounds, maximized and always-on-top states. By default |
| 109 // this uses the process' local state keyed by window name (See GetWindowName |
| 110 // above). This behavior can be overridden to provide additional |
| 111 // functionality. |
| 112 virtual void SaveWindowPlacement(const gfx::Rect& bounds, |
| 113 bool maximized, |
| 114 bool always_on_top); |
| 115 |
| 116 // Retreives the window's bounds, maximized and always-on-top states. By |
| 117 // default, this uses the process' local state keyed by window name (See |
| 118 // GetWindowName above). This behavior can be overridden to provide |
| 119 // additional functionality. |
| 120 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const; |
| 121 virtual bool GetSavedMaximizedState(bool* maximized) const; |
| 122 virtual bool GetSavedAlwaysOnTopState(bool* always_on_top) const; |
| 123 |
| 113 // Called when the window closes. | 124 // Called when the window closes. |
| 114 virtual void WindowClosing() { } | 125 virtual void WindowClosing() { } |
| 115 | 126 |
| 116 // Returns the View that is contained within this Window. | 127 // Returns the View that is contained within this Window. |
| 117 virtual View* GetContentsView() { | 128 virtual View* GetContentsView() { |
| 118 return NULL; | 129 return NULL; |
| 119 } | 130 } |
| 120 | 131 |
| 121 // Called by the Window to create the Client View used to host the contents | 132 // Called by the Window to create the Client View used to host the contents |
| 122 // of the window. | 133 // of the window. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 138 // people using this helper to not have to call a ctor on this object. | 149 // people using this helper to not have to call a ctor on this object. |
| 139 // Instead we just release the owning ref this pointer has when we are | 150 // Instead we just release the owning ref this pointer has when we are |
| 140 // destroyed. | 151 // destroyed. |
| 141 scoped_ptr<Window> window_; | 152 scoped_ptr<Window> window_; |
| 142 }; | 153 }; |
| 143 | 154 |
| 144 } // namespace views | 155 } // namespace views |
| 145 | 156 |
| 146 #endif // CHROME_VIEWS_WINDOW_DELEGATE_H_ | 157 #endif // CHROME_VIEWS_WINDOW_DELEGATE_H_ |
| 147 | 158 |
| OLD | NEW |