diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 13:45:11 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 13:45:11 +0000 |
commit | 28aec9a5983496afebebc017ac75aa1dad0bede6 (patch) | |
tree | 27ef3bf92fd8e4641e7c44249fc587fb1a3e962e /views | |
parent | ed2533fe7b6540a235e9df588ebdb5e85a43466c (diff) | |
download | chromium_src-28aec9a5983496afebebc017ac75aa1dad0bede6.zip chromium_src-28aec9a5983496afebebc017ac75aa1dad0bede6.tar.gz chromium_src-28aec9a5983496afebebc017ac75aa1dad0bede6.tar.bz2 |
Store the user's profile as a property of a window in order to access it when saving window data with the ChromeViewsDelegate.
BUG=71804
TEST=PreservedWindowPlacement tests pass on all platforms.
Review URL: http://codereview.chromium.org/6250114
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/test/test_views_delegate.h | 13 | ||||
-rw-r--r-- | views/views_delegate.h | 10 | ||||
-rw-r--r-- | views/window/window.h | 6 | ||||
-rw-r--r-- | views/window/window_delegate.cc | 6 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 8 | ||||
-rw-r--r-- | views/window/window_gtk.h | 2 | ||||
-rw-r--r-- | views/window/window_win.cc | 8 | ||||
-rw-r--r-- | views/window/window_win.h | 2 |
8 files changed, 46 insertions, 9 deletions
diff --git a/views/test/test_views_delegate.h b/views/test/test_views_delegate.h index 7b379f8..cae1a64f 100644 --- a/views/test/test_views_delegate.h +++ b/views/test/test_views_delegate.h @@ -6,6 +6,10 @@ #include "ui/base/clipboard/clipboard.h" #include "views/views_delegate.h" +namespace views { +class Window; +} + class TestViewsDelegate : public views::ViewsDelegate { public: TestViewsDelegate() {} @@ -19,15 +23,18 @@ class TestViewsDelegate : public views::ViewsDelegate { } return clipboard_.get(); } - virtual void SaveWindowPlacement(const std::wstring& window_name, + virtual void SaveWindowPlacement(views::Window* window, + const std::wstring& window_name, const gfx::Rect& bounds, bool maximized) { } - virtual bool GetSavedWindowBounds(const std::wstring& window_name, + virtual bool GetSavedWindowBounds(views::Window* window, + const std::wstring& window_name, gfx::Rect* bounds) const { return false; } - virtual bool GetSavedMaximizedState(const std::wstring& window_name, + virtual bool GetSavedMaximizedState(views::Window* window, + const std::wstring& window_name, bool* maximized) const { return false; } diff --git a/views/views_delegate.h b/views/views_delegate.h index 66d91a7..98b734e 100644 --- a/views/views_delegate.h +++ b/views/views_delegate.h @@ -24,6 +24,7 @@ class Clipboard; namespace views { class View; +class Window; // ViewsDelegate is an interface implemented by an object using the views // framework. It is used to obtain various high level application utilities @@ -40,18 +41,21 @@ class ViewsDelegate { // Saves the position, size and maximized state for the window with the // specified name. - virtual void SaveWindowPlacement(const std::wstring& window_name, + virtual void SaveWindowPlacement(views::Window* window, + const std::wstring& window_name, const gfx::Rect& bounds, bool maximized) = 0; // Retrieves the saved position and size for the window with the specified // name. - virtual bool GetSavedWindowBounds(const std::wstring& window_name, + virtual bool GetSavedWindowBounds(views::Window* window, + const std::wstring& window_name, gfx::Rect* bounds) const = 0; // Retrieves the saved maximized state for the window with the specified // name. - virtual bool GetSavedMaximizedState(const std::wstring& window_name, + virtual bool GetSavedMaximizedState(views::Window* window, + const std::wstring& window_name, bool* maximized) const = 0; // Notify the delegate that an accessibility event has happened in diff --git a/views/window/window.h b/views/window/window.h index 1d5ffea..e8bd7c0 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -75,6 +75,12 @@ class Window { // Push/PopForceHidden. virtual void HideWindow() = 0; + // Sets/Gets a native window property on the underlying native window object. + // Returns NULL if the property does not exist. Setting the property value to + // NULL removes the property. + virtual void SetNativeWindowProperty(const char* name, void* value) = 0; + virtual void* GetNativeWindowProperty(const char* name) = 0; + #if defined(OS_WIN) // Hides the window if it hasn't already been force-hidden. The force hidden // count is tracked, so calling multiple times is allowed, you just have to diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc index 1701da7..69bcc03 100644 --- a/views/window/window_delegate.cc +++ b/views/window/window_delegate.cc @@ -33,7 +33,7 @@ void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds, return; ViewsDelegate::views_delegate->SaveWindowPlacement( - window_name, bounds, maximized); + window_, window_name, bounds, maximized); } bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const { @@ -42,7 +42,7 @@ bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const { return false; return ViewsDelegate::views_delegate->GetSavedWindowBounds( - window_name, bounds); + window_, window_name, bounds); } bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const { @@ -51,7 +51,7 @@ bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const { return false; return ViewsDelegate::views_delegate->GetSavedMaximizedState( - window_name, maximized); + window_, window_name, maximized); } bool WindowDelegate::ShouldRestoreWindowSize() const { diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index adc714c..962331d 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -127,6 +127,14 @@ void WindowGtk::HideWindow() { Hide(); } +void WindowGtk::SetNativeWindowProperty(const char* name, void* value) { + WidgetGtk::SetNativeWindowProperty(name, value); +} + +void* WindowGtk::GetNativeWindowProperty(const char* name) { + return WidgetGtk::GetNativeWindowProperty(name); +} + void WindowGtk::Activate() { gtk_window_present(GTK_WINDOW(GetNativeView())); } diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index 907ab7c..9f1af0d 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -32,6 +32,8 @@ class WindowGtk : public WidgetGtk, public Window { gfx::NativeWindow other_window); virtual void Show(); virtual void HideWindow(); + virtual void SetNativeWindowProperty(const char* name, void* value); + virtual void* GetNativeWindowProperty(const char* name); virtual void Activate(); virtual void Deactivate(); virtual void Close(); diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 64dde6c..adf6946 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -273,6 +273,14 @@ void WindowWin::HideWindow() { Hide(); } +void WindowWin::SetNativeWindowProperty(const char* name, void* value) { + WidgetWin::SetNativeWindowProperty(name, value); +} + +void* WindowWin::GetNativeWindowProperty(const char* name) { + return WidgetWin::GetNativeWindowProperty(name); +} + void WindowWin::PushForceHidden() { if (force_hidden_count_++ == 0) Hide(); diff --git a/views/window/window_win.h b/views/window/window_win.h index 6b20667a..5cd2bdd 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -70,6 +70,8 @@ class WindowWin : public WidgetWin, gfx::NativeWindow other_window); virtual void Show(); virtual void HideWindow(); + virtual void SetNativeWindowProperty(const char* name, void* value); + virtual void* GetNativeWindowProperty(const char* name); virtual void PushForceHidden(); virtual void PopForceHidden(); virtual void Activate(); |