| 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" |
| 11 #include "chrome/browser/ui/base_window.h" | 11 #include "chrome/browser/ui/base_window.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "content/public/common/console_message_level.h" | 16 #include "content/public/common/console_message_level.h" |
| 17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 | 18 |
| 19 class ExtensionWindowController; | |
| 20 class GURL; | 19 class GURL; |
| 21 class Profile; | 20 class Profile; |
| 22 class TabContents; | 21 class TabContents; |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 class WebContents; | 24 class WebContents; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace extensions { | 27 namespace extensions { |
| 29 class Extension; | 28 class Extension; |
| 29 class WindowController; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // ShellWindow is the type of window used by platform apps. Shell windows | 32 // ShellWindow is the type of window used by platform apps. Shell windows |
| 33 // have a WebContents but none of the chrome of normal browser windows. | 33 // have a WebContents but none of the chrome of normal browser windows. |
| 34 class ShellWindow : public content::NotificationObserver, | 34 class ShellWindow : public content::NotificationObserver, |
| 35 public content::WebContentsDelegate, | 35 public content::WebContentsDelegate, |
| 36 public content::WebContentsObserver, | 36 public content::WebContentsObserver, |
| 37 public ExtensionFunctionDispatcher::Delegate, | 37 public ExtensionFunctionDispatcher::Delegate, |
| 38 public BaseWindow { | 38 public BaseWindow { |
| 39 public: | 39 public: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 WindowOpenDisposition disposition, | 127 WindowOpenDisposition disposition, |
| 128 const gfx::Rect& initial_pos, | 128 const gfx::Rect& initial_pos, |
| 129 bool user_gesture) OVERRIDE; | 129 bool user_gesture) OVERRIDE; |
| 130 | 130 |
| 131 // content::NotificationObserver implementation. | 131 // content::NotificationObserver implementation. |
| 132 virtual void Observe(int type, | 132 virtual void Observe(int type, |
| 133 const content::NotificationSource& source, | 133 const content::NotificationSource& source, |
| 134 const content::NotificationDetails& details) OVERRIDE; | 134 const content::NotificationDetails& details) OVERRIDE; |
| 135 | 135 |
| 136 // ExtensionFunctionDispatcher::Delegate implementation. | 136 // ExtensionFunctionDispatcher::Delegate implementation. |
| 137 virtual ExtensionWindowController* GetExtensionWindowController() const | 137 virtual extensions::WindowController* GetExtensionWindowController() const |
| 138 OVERRIDE; | 138 OVERRIDE; |
| 139 | 139 |
| 140 // Message handlers. | 140 // Message handlers. |
| 141 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 141 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 142 | 142 |
| 143 // Helper method to add a message to the renderer's DevTools console. | 143 // Helper method to add a message to the renderer's DevTools console. |
| 144 void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, | 144 void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, |
| 145 const std::string& message); | 145 const std::string& message); |
| 146 | 146 |
| 147 Profile* profile_; // weak pointer - owned by ProfileManager. | 147 Profile* profile_; // weak pointer - owned by ProfileManager. |
| 148 // weak pointer - owned by ExtensionService. | 148 // weak pointer - owned by ExtensionService. |
| 149 const extensions::Extension* extension_; | 149 const extensions::Extension* extension_; |
| 150 | 150 |
| 151 const SessionID session_id_; | 151 const SessionID session_id_; |
| 152 scoped_ptr<TabContents> contents_; | 152 scoped_ptr<TabContents> contents_; |
| 153 // web_contents_ is owned by contents_. | 153 // web_contents_ is owned by contents_. |
| 154 content::WebContents* web_contents_; | 154 content::WebContents* web_contents_; |
| 155 content::NotificationRegistrar registrar_; | 155 content::NotificationRegistrar registrar_; |
| 156 ExtensionFunctionDispatcher extension_function_dispatcher_; | 156 ExtensionFunctionDispatcher extension_function_dispatcher_; |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 158 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 161 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
| OLD | NEW |