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