| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/shell_window.h" |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 13 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h" | 14 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h" |
| 14 #include "chrome/browser/ui/extensions/shell_window.h" | |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 | 16 |
| 17 class AshPanelWindowController; | 17 class AshPanelWindowController; |
| 18 class GURL; | 18 class GURL; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class RenderViewHost; | 21 class RenderViewHost; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 struct DraggableRegion; | 25 struct DraggableRegion; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // ShellWindowContents class specific to panel windows created by v1 | 28 // apps::ShellWindowContents class specific to panel windows created by v1 |
| 29 // extenstions. This class maintains a WebContents instance and observes it for | 29 // extenstions. This class maintains a WebContents instance and observes it for |
| 30 // the purpose of passing messages to the extensions system. It also creates | 30 // the purpose of passing messages to the extensions system. It also creates |
| 31 // an extensions::WindowController instance for interfacing with the v1 | 31 // an extensions::WindowController instance for interfacing with the v1 |
| 32 // extensions API. | 32 // extensions API. |
| 33 class AshPanelContents : public ShellWindowContents, | 33 class AshPanelContents : public apps::ShellWindowContents, |
| 34 public content::WebContentsObserver, | 34 public content::WebContentsObserver, |
| 35 public LauncherFaviconLoader::Delegate, | 35 public LauncherFaviconLoader::Delegate, |
| 36 public ExtensionFunctionDispatcher::Delegate { | 36 public ExtensionFunctionDispatcher::Delegate { |
| 37 public: | 37 public: |
| 38 explicit AshPanelContents(ShellWindow* host); | 38 explicit AshPanelContents(apps::ShellWindow* host); |
| 39 virtual ~AshPanelContents(); | 39 virtual ~AshPanelContents(); |
| 40 | 40 |
| 41 // ShellWindowContents | 41 // apps::ShellWindowContents |
| 42 virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE; | 42 virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE; |
| 43 virtual void LoadContents(int32 creator_process_id) OVERRIDE; | 43 virtual void LoadContents(int32 creator_process_id) OVERRIDE; |
| 44 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE; | 44 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE; |
| 45 virtual void NativeWindowClosed() OVERRIDE; | 45 virtual void NativeWindowClosed() OVERRIDE; |
| 46 virtual content::WebContents* GetWebContents() const OVERRIDE; | 46 virtual content::WebContents* GetWebContents() const OVERRIDE; |
| 47 | 47 |
| 48 // LauncherFaviconLoader::Delegate overrides: | 48 // LauncherFaviconLoader::Delegate overrides: |
| 49 virtual void FaviconUpdated() OVERRIDE; | 49 virtual void FaviconUpdated() OVERRIDE; |
| 50 | 50 |
| 51 // ExtensionFunctionDispatcher::Delegate | 51 // ExtensionFunctionDispatcher::Delegate |
| 52 virtual extensions::WindowController* GetExtensionWindowController() const | 52 virtual extensions::WindowController* GetExtensionWindowController() const |
| 53 OVERRIDE; | 53 OVERRIDE; |
| 54 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 54 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 55 | 55 |
| 56 LauncherFaviconLoader* launcher_favicon_loader_for_test() { | 56 LauncherFaviconLoader* launcher_favicon_loader_for_test() { |
| 57 return launcher_favicon_loader_.get(); | 57 return launcher_favicon_loader_.get(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // content::WebContentsObserver | 61 // content::WebContentsObserver |
| 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 63 | 63 |
| 64 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 64 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 65 | 65 |
| 66 ShellWindow* host_; | 66 apps::ShellWindow* host_; |
| 67 GURL url_; | 67 GURL url_; |
| 68 scoped_ptr<content::WebContents> web_contents_; | 68 scoped_ptr<content::WebContents> web_contents_; |
| 69 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 69 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 70 scoped_ptr<AshPanelWindowController> window_controller_; | 70 scoped_ptr<AshPanelWindowController> window_controller_; |
| 71 scoped_ptr<LauncherFaviconLoader> launcher_favicon_loader_; | 71 scoped_ptr<LauncherFaviconLoader> launcher_favicon_loader_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(AshPanelContents); | 73 DISALLOW_COPY_AND_ASSIGN(AshPanelContents); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ | 76 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_ |
| OLD | NEW |