| 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/image_loading_tracker.h" | 11 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 11 #include "chrome/browser/sessions/session_id.h" | 12 #include "chrome/browser/sessions/session_id.h" |
| 12 #include "chrome/browser/ui/base_window.h" | 13 #include "chrome/browser/ui/base_window.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 15 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/common/console_message_level.h" | 18 #include "content/public/common/console_message_level.h" |
| 18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 struct DraggableRegion; | 36 struct DraggableRegion; |
| 36 } | 37 } |
| 37 | 38 |
| 38 // ShellWindow is the type of window used by platform apps. Shell windows | 39 // 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. | 40 // have a WebContents but none of the chrome of normal browser windows. |
| 40 class ShellWindow : public content::NotificationObserver, | 41 class ShellWindow : public content::NotificationObserver, |
| 41 public content::WebContentsDelegate, | 42 public content::WebContentsDelegate, |
| 42 public content::WebContentsObserver, | 43 public content::WebContentsObserver, |
| 43 public ExtensionFunctionDispatcher::Delegate, | 44 public ExtensionFunctionDispatcher::Delegate, |
| 44 public ImageLoadingTracker::Observer { | 45 public ImageLoadingTracker::Observer, |
| 46 public extensions::ExtensionKeybindingRegistry::Delegate { |
| 45 public: | 47 public: |
| 46 struct CreateParams { | 48 struct CreateParams { |
| 47 enum Frame { | 49 enum Frame { |
| 48 FRAME_CHROME, // Chrome-style window frame. | 50 FRAME_CHROME, // Chrome-style window frame. |
| 49 FRAME_NONE, // Frameless window. | 51 FRAME_NONE, // Frameless window. |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 CreateParams(); | 54 CreateParams(); |
| 53 ~CreateParams(); | 55 ~CreateParams(); |
| 54 | 56 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const std::vector<extensions::DraggableRegion>& regions); | 168 const std::vector<extensions::DraggableRegion>& regions); |
| 167 | 169 |
| 168 // Load the app's image, firing a load state change when loaded. | 170 // Load the app's image, firing a load state change when loaded. |
| 169 void UpdateExtensionAppIcon(); | 171 void UpdateExtensionAppIcon(); |
| 170 | 172 |
| 171 // ImageLoadingTracker::Observer implementation. | 173 // ImageLoadingTracker::Observer implementation. |
| 172 virtual void OnImageLoaded(const gfx::Image& image, | 174 virtual void OnImageLoaded(const gfx::Image& image, |
| 173 const std::string& extension_id, | 175 const std::string& extension_id, |
| 174 int index) OVERRIDE; | 176 int index) OVERRIDE; |
| 175 | 177 |
| 178 // extensions::ExtensionKeybindingRegistry::Delegate implementation. |
| 179 virtual extensions::ActiveTabPermissionGranter* |
| 180 GetActiveTabPermissionGranter() OVERRIDE; |
| 181 |
| 176 Profile* profile_; // weak pointer - owned by ProfileManager. | 182 Profile* profile_; // weak pointer - owned by ProfileManager. |
| 177 // weak pointer - owned by ExtensionService. | 183 // weak pointer - owned by ExtensionService. |
| 178 const extensions::Extension* extension_; | 184 const extensions::Extension* extension_; |
| 179 | 185 |
| 180 // Identifier that is used when saving and restoring geometry for this | 186 // Identifier that is used when saving and restoring geometry for this |
| 181 // window. | 187 // window. |
| 182 std::string window_key_; | 188 std::string window_key_; |
| 183 | 189 |
| 184 const SessionID session_id_; | 190 const SessionID session_id_; |
| 185 scoped_ptr<TabContents> contents_; | 191 scoped_ptr<TabContents> contents_; |
| 186 // web_contents_ is owned by contents_. | 192 // web_contents_ is owned by contents_. |
| 187 content::WebContents* web_contents_; | 193 content::WebContents* web_contents_; |
| 188 content::NotificationRegistrar registrar_; | 194 content::NotificationRegistrar registrar_; |
| 189 ExtensionFunctionDispatcher extension_function_dispatcher_; | 195 ExtensionFunctionDispatcher extension_function_dispatcher_; |
| 190 | 196 |
| 191 // Icon showed in the task bar. | 197 // Icon showed in the task bar. |
| 192 gfx::Image app_icon_; | 198 gfx::Image app_icon_; |
| 193 | 199 |
| 194 // Used for loading app_icon_. | 200 // Used for loading app_icon_. |
| 195 scoped_ptr<ImageLoadingTracker> app_icon_loader_; | 201 scoped_ptr<ImageLoadingTracker> app_icon_loader_; |
| 196 | 202 |
| 197 scoped_ptr<NativeShellWindow> native_window_; | 203 scoped_ptr<NativeShellWindow> native_window_; |
| 198 | 204 |
| 199 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 205 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| 200 }; | 206 }; |
| 201 | 207 |
| 202 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 208 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| OLD | NEW |