| 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/extensions/extension_keybinding_registry.h" | 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // ShellWindow is the type of window used by platform apps. Shell windows | 38 // ShellWindow is the type of window used by platform apps. Shell windows |
| 39 // have a WebContents but none of the chrome of normal browser windows. | 39 // have a WebContents but none of the chrome of normal browser windows. |
| 40 class ShellWindow : public content::NotificationObserver, | 40 class ShellWindow : public content::NotificationObserver, |
| 41 public content::WebContentsDelegate, | 41 public content::WebContentsDelegate, |
| 42 public content::WebContentsObserver, | 42 public content::WebContentsObserver, |
| 43 public ExtensionFunctionDispatcher::Delegate, | 43 public ExtensionFunctionDispatcher::Delegate, |
| 44 public ImageLoadingTracker::Observer, | 44 public ImageLoadingTracker::Observer, |
| 45 public extensions::ExtensionKeybindingRegistry::Delegate { | 45 public extensions::ExtensionKeybindingRegistry::Delegate { |
| 46 public: | 46 public: |
| 47 enum WindowType { |
| 48 WINDOW_TYPE_DEFAULT, // Default shell window |
| 49 WINDOW_TYPE_PANEL, // OS controlled panel window (Ash only) |
| 50 }; |
| 51 |
| 52 enum Frame { |
| 53 FRAME_CHROME, // Chrome-style window frame. |
| 54 FRAME_NONE, // Frameless window. |
| 55 }; |
| 56 |
| 47 struct CreateParams { | 57 struct CreateParams { |
| 48 enum Frame { | |
| 49 FRAME_CHROME, // Chrome-style window frame. | |
| 50 FRAME_NONE, // Frameless window. | |
| 51 }; | |
| 52 | |
| 53 CreateParams(); | 58 CreateParams(); |
| 54 ~CreateParams(); | 59 ~CreateParams(); |
| 55 | 60 |
| 61 WindowType window_type; |
| 56 Frame frame; | 62 Frame frame; |
| 63 |
| 57 // Specify the initial bounds of the window. INT_MIN designates | 64 // Specify the initial bounds of the window. INT_MIN designates |
| 58 // 'unspecified' for any coordinate, and should be replaced with a default | 65 // 'unspecified' for any coordinate, and should be replaced with a default |
| 59 // value. | 66 // value. |
| 60 gfx::Rect bounds; | 67 gfx::Rect bounds; |
| 61 | 68 |
| 62 gfx::Size minimum_size; | 69 gfx::Size minimum_size; |
| 63 gfx::Size maximum_size; | 70 gfx::Size maximum_size; |
| 64 | 71 |
| 65 std::string window_key; | 72 std::string window_key; |
| 66 | 73 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 78 | 85 |
| 79 // Convert draggable regions in raw format to SkRegion format. Caller is | 86 // Convert draggable regions in raw format to SkRegion format. Caller is |
| 80 // responsible for deleting the returned SkRegion instance. | 87 // responsible for deleting the returned SkRegion instance. |
| 81 static SkRegion* RawDraggableRegionsToSkRegion( | 88 static SkRegion* RawDraggableRegionsToSkRegion( |
| 82 const std::vector<extensions::DraggableRegion>& regions); | 89 const std::vector<extensions::DraggableRegion>& regions); |
| 83 | 90 |
| 84 const std::string& window_key() const { return window_key_; } | 91 const std::string& window_key() const { return window_key_; } |
| 85 const SessionID& session_id() const { return session_id_; } | 92 const SessionID& session_id() const { return session_id_; } |
| 86 const extensions::Extension* extension() const { return extension_; } | 93 const extensions::Extension* extension() const { return extension_; } |
| 87 content::WebContents* web_contents() const { return web_contents_.get(); } | 94 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 95 WindowType window_type() const { return window_type_; } |
| 88 Profile* profile() const { return profile_; } | 96 Profile* profile() const { return profile_; } |
| 89 const gfx::Image& app_icon() const { return app_icon_; } | 97 const gfx::Image& app_icon() const { return app_icon_; } |
| 90 | 98 |
| 91 BaseWindow* GetBaseWindow(); | 99 BaseWindow* GetBaseWindow(); |
| 92 gfx::NativeWindow GetNativeWindow() { | 100 gfx::NativeWindow GetNativeWindow() { |
| 93 return GetBaseWindow()->GetNativeWindow(); | 101 return GetBaseWindow()->GetNativeWindow(); |
| 94 } | 102 } |
| 95 | 103 |
| 96 // NativeAppWindows should call this to determine what the window's title | 104 // NativeAppWindows should call this to determine what the window's title |
| 97 // is on startup and from within UpdateWindowTitle(). | 105 // is on startup and from within UpdateWindowTitle(). |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 Profile* profile_; // weak pointer - owned by ProfileManager. | 203 Profile* profile_; // weak pointer - owned by ProfileManager. |
| 196 // weak pointer - owned by ExtensionService. | 204 // weak pointer - owned by ExtensionService. |
| 197 const extensions::Extension* extension_; | 205 const extensions::Extension* extension_; |
| 198 | 206 |
| 199 // Identifier that is used when saving and restoring geometry for this | 207 // Identifier that is used when saving and restoring geometry for this |
| 200 // window. | 208 // window. |
| 201 std::string window_key_; | 209 std::string window_key_; |
| 202 | 210 |
| 203 const SessionID session_id_; | 211 const SessionID session_id_; |
| 204 scoped_ptr<content::WebContents> web_contents_; | 212 scoped_ptr<content::WebContents> web_contents_; |
| 213 WindowType window_type_; |
| 205 content::NotificationRegistrar registrar_; | 214 content::NotificationRegistrar registrar_; |
| 206 ExtensionFunctionDispatcher extension_function_dispatcher_; | 215 ExtensionFunctionDispatcher extension_function_dispatcher_; |
| 207 | 216 |
| 208 // Icon showed in the task bar. | 217 // Icon showed in the task bar. |
| 209 gfx::Image app_icon_; | 218 gfx::Image app_icon_; |
| 210 | 219 |
| 211 // Used for loading app_icon_. | 220 // Used for loading app_icon_. |
| 212 scoped_ptr<ImageLoadingTracker> app_icon_loader_; | 221 scoped_ptr<ImageLoadingTracker> app_icon_loader_; |
| 213 | 222 |
| 214 scoped_ptr<NativeAppWindow> native_app_window_; | 223 scoped_ptr<NativeAppWindow> native_app_window_; |
| 215 | 224 |
| 216 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 225 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| 217 }; | 226 }; |
| 218 | 227 |
| 219 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 228 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| OLD | NEW |