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_APP_WINDOW_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_WINDOW_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/extensions/shell_window.h" | |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class RenderViewHost; | 20 class RenderViewHost; |
21 } | 21 } |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 struct DraggableRegion; | 24 struct DraggableRegion; |
25 } | 25 } |
26 | 26 |
27 // ShellWindowContents class specific to app windows. It maintains a | 27 // apps::ShellWindowContents class specific to app windows. It maintains a |
28 // WebContents instance and observes it for the purpose of passing | 28 // WebContents instance and observes it for the purpose of passing |
29 // messages to the extensions system. | 29 // messages to the extensions system. |
30 class AppWindowContents : public ShellWindowContents, | 30 class AppWindowContents : public apps::ShellWindowContents, |
31 public content::NotificationObserver, | 31 public content::NotificationObserver, |
32 public content::WebContentsObserver, | 32 public content::WebContentsObserver, |
33 public ExtensionFunctionDispatcher::Delegate { | 33 public ExtensionFunctionDispatcher::Delegate { |
34 public: | 34 public: |
35 explicit AppWindowContents(ShellWindow* host); | 35 explicit AppWindowContents(apps::ShellWindow* host); |
36 virtual ~AppWindowContents(); | 36 virtual ~AppWindowContents(); |
37 | 37 |
38 // ShellWindowContents | 38 // apps::ShellWindowContents |
39 virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE; | 39 virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE; |
40 virtual void LoadContents(int32 creator_process_id) OVERRIDE; | 40 virtual void LoadContents(int32 creator_process_id) OVERRIDE; |
41 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE; | 41 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE; |
42 virtual void NativeWindowClosed() OVERRIDE; | 42 virtual void NativeWindowClosed() OVERRIDE; |
43 virtual content::WebContents* GetWebContents() const OVERRIDE; | 43 virtual content::WebContents* GetWebContents() const OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 // content::NotificationObserver | 46 // content::NotificationObserver |
47 virtual void Observe(int type, | 47 virtual void Observe(int type, |
48 const content::NotificationSource& source, | 48 const content::NotificationSource& source, |
49 const content::NotificationDetails& details) OVERRIDE; | 49 const content::NotificationDetails& details) OVERRIDE; |
50 | 50 |
51 // content::WebContentsObserver | 51 // content::WebContentsObserver |
52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
53 | 53 |
54 // ExtensionFunctionDispatcher::Delegate | 54 // ExtensionFunctionDispatcher::Delegate |
55 virtual extensions::WindowController* GetExtensionWindowController() const | 55 virtual extensions::WindowController* GetExtensionWindowController() const |
56 OVERRIDE; | 56 OVERRIDE; |
57 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 57 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
58 | 58 |
59 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 59 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
60 void UpdateDraggableRegions( | 60 void UpdateDraggableRegions( |
61 const std::vector<extensions::DraggableRegion>& regions); | 61 const std::vector<extensions::DraggableRegion>& regions); |
62 void SuspendRenderViewHost(content::RenderViewHost* rvh); | 62 void SuspendRenderViewHost(content::RenderViewHost* rvh); |
63 | 63 |
64 ShellWindow* host_; // This class is owned by |host_| | 64 apps::ShellWindow* host_; // This class is owned by |host_| |
65 GURL url_; | 65 GURL url_; |
66 content::NotificationRegistrar registrar_; | 66 content::NotificationRegistrar registrar_; |
67 scoped_ptr<content::WebContents> web_contents_; | 67 scoped_ptr<content::WebContents> web_contents_; |
68 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 68 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(AppWindowContents); | 70 DISALLOW_COPY_AND_ASSIGN(AppWindowContents); |
71 }; | 71 }; |
72 | 72 |
73 #endif // CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_ |
OLD | NEW |