Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| 6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 10 #include "chrome/browser/sessions/session_id.h" | 10 #include "chrome/browser/sessions/session_id.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 FRAME_CHROME, // Chrome-style window frame. | 45 FRAME_CHROME, // Chrome-style window frame. |
| 46 FRAME_NONE, // Frameless window. | 46 FRAME_NONE, // Frameless window. |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 CreateParams(); | 49 CreateParams(); |
| 50 | 50 |
| 51 Frame frame; | 51 Frame frame; |
| 52 // Specify the initial bounds of the window. If empty, the window will be a | 52 // Specify the initial bounds of the window. If empty, the window will be a |
| 53 // default size. | 53 // default size. |
| 54 gfx::Rect bounds; | 54 gfx::Rect bounds; |
| 55 // Specify if bounds should be restored from a previous time | |
|
asargent_no_longer_on_chrome
2012/08/28 18:49:41
nit: period at end of sentence
Marijn Kruisselbrink
2012/08/28 22:14:58
Done.
| |
| 56 bool restorePosition; | |
| 57 bool restoreSize; | |
| 58 | |
| 55 gfx::Size minimum_size; | 59 gfx::Size minimum_size; |
| 56 gfx::Size maximum_size; | 60 gfx::Size maximum_size; |
| 61 | |
| 62 std::string window_key; | |
| 57 }; | 63 }; |
| 58 | 64 |
| 59 static ShellWindow* Create(Profile* profile, | 65 static ShellWindow* Create(Profile* profile, |
| 60 const extensions::Extension* extension, | 66 const extensions::Extension* extension, |
| 61 const GURL& url, | 67 const GURL& url, |
| 62 const CreateParams& params); | 68 const CreateParams& params); |
| 63 | 69 |
| 64 const SessionID& session_id() const { return session_id_; } | 70 const SessionID& session_id() const { return session_id_; } |
| 65 const extensions::Extension* extension() const { return extension_; } | 71 const extensions::Extension* extension() const { return extension_; } |
| 66 const TabContents* tab_contents() const { return contents_.get(); } | 72 const TabContents* tab_contents() const { return contents_.get(); } |
| 67 content::WebContents* web_contents() const { return web_contents_; } | 73 content::WebContents* web_contents() const { return web_contents_; } |
| 68 Profile* profile() const { return profile_; } | 74 Profile* profile() const { return profile_; } |
| 69 | 75 |
| 70 BaseWindow* GetBaseWindow(); | 76 BaseWindow* GetBaseWindow(); |
| 71 gfx::NativeWindow GetNativeWindow() { | 77 gfx::NativeWindow GetNativeWindow() { |
| 72 return GetBaseWindow()->GetNativeWindow(); | 78 return GetBaseWindow()->GetNativeWindow(); |
| 73 } | 79 } |
| 74 | 80 |
| 75 // NativeShellWindows should call this to determine what the window's title | 81 // NativeShellWindows should call this to determine what the window's title |
| 76 // is on startup and from within UpdateWindowTitle(). | 82 // is on startup and from within UpdateWindowTitle(). |
| 77 virtual string16 GetTitle() const; | 83 virtual string16 GetTitle() const; |
| 78 | 84 |
| 79 // Call to notify ShellRegistry and delete the window. Subclasses should | 85 // Call to notify ShellRegistry and delete the window. Subclasses should |
| 80 // invoke this method instead of using "delete this". | 86 // invoke this method instead of using "delete this". |
| 81 void OnNativeClose(); | 87 void OnNativeClose(); |
| 82 | 88 |
| 89 // Save the window position in the prefs. | |
| 90 virtual void SaveWindowPosition(); | |
| 83 protected: | 91 protected: |
| 84 ShellWindow(Profile* profile, | 92 ShellWindow(Profile* profile, |
| 85 const extensions::Extension* extension); | 93 const extensions::Extension* extension); |
| 86 virtual ~ShellWindow(); | 94 virtual ~ShellWindow(); |
| 87 | 95 |
| 88 private: | 96 private: |
| 89 // PlatformAppBrowserTest needs access to web_contents() | 97 // PlatformAppBrowserTest needs access to web_contents() |
| 90 friend class extensions::PlatformAppBrowserTest; | 98 friend class extensions::PlatformAppBrowserTest; |
| 91 | 99 |
| 92 // Instantiates a platform-specific ShellWindow subclass (one implementation | 100 // Instantiates a platform-specific ShellWindow subclass (one implementation |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // Message handlers. | 148 // Message handlers. |
| 141 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 149 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 142 | 150 |
| 143 // Helper method to add a message to the renderer's DevTools console. | 151 // Helper method to add a message to the renderer's DevTools console. |
| 144 void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, | 152 void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, |
| 145 const std::string& message); | 153 const std::string& message); |
| 146 | 154 |
| 147 virtual void UpdateDraggableRegions( | 155 virtual void UpdateDraggableRegions( |
| 148 const std::vector<extensions::DraggableRegion>& regions); | 156 const std::vector<extensions::DraggableRegion>& regions); |
| 149 | 157 |
| 158 // Read window geometry from storage | |
|
asargent_no_longer_on_chrome
2012/08/28 18:49:41
nit: period at end of sentence
Marijn Kruisselbrink
2012/08/28 22:14:58
oops, that entire method here is just a leftover f
| |
| 159 void GeometryFromStorage(bool restorePosition, | |
| 160 bool restoreSize, | |
| 161 scoped_ptr<base::Value> value); | |
| 162 | |
| 150 Profile* profile_; // weak pointer - owned by ProfileManager. | 163 Profile* profile_; // weak pointer - owned by ProfileManager. |
| 151 // weak pointer - owned by ExtensionService. | 164 // weak pointer - owned by ExtensionService. |
| 152 const extensions::Extension* extension_; | 165 const extensions::Extension* extension_; |
| 153 | 166 |
| 167 // used for saving/restoring window geometry | |
|
asargent_no_longer_on_chrome
2012/08/28 18:49:41
nit: make full sentence, with period at end
Marijn Kruisselbrink
2012/08/28 22:14:58
Done.
| |
| 168 std::string window_key_; | |
| 169 | |
| 154 const SessionID session_id_; | 170 const SessionID session_id_; |
| 155 scoped_ptr<TabContents> contents_; | 171 scoped_ptr<TabContents> contents_; |
| 156 // web_contents_ is owned by contents_. | 172 // web_contents_ is owned by contents_. |
| 157 content::WebContents* web_contents_; | 173 content::WebContents* web_contents_; |
| 158 content::NotificationRegistrar registrar_; | 174 content::NotificationRegistrar registrar_; |
| 159 ExtensionFunctionDispatcher extension_function_dispatcher_; | 175 ExtensionFunctionDispatcher extension_function_dispatcher_; |
| 160 | 176 |
| 161 scoped_ptr<NativeShellWindow> native_window_; | 177 scoped_ptr<NativeShellWindow> native_window_; |
| 162 | 178 |
| 163 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 179 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| 164 }; | 180 }; |
| 165 | 181 |
| 166 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 182 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| OLD | NEW |