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 APPS_APP_WINDOW_CONTENTS_H_ | 5 #ifndef APPS_APP_WINDOW_CONTENTS_H_ |
6 #define APPS_APP_WINDOW_CONTENTS_H_ | 6 #define APPS_APP_WINDOW_CONTENTS_H_ |
7 | 7 |
8 #include "apps/app_window.h" | |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "extensions/browser/app_window/app_window.h" |
13 #include "extensions/browser/extension_function_dispatcher.h" | 13 #include "extensions/browser/extension_function_dispatcher.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class BrowserContext; | 17 class BrowserContext; |
18 } | 18 } |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 struct DraggableRegion; | 21 struct DraggableRegion; |
22 } | 22 } |
23 | 23 |
24 namespace apps { | 24 namespace apps { |
25 | 25 |
26 // AppWindowContents class specific to app windows. It maintains a | 26 // AppWindowContents class specific to app windows. It maintains a |
27 // WebContents instance and observes it for the purpose of passing | 27 // WebContents instance and observes it for the purpose of passing |
28 // messages to the extensions system. | 28 // messages to the extensions system. |
29 class AppWindowContentsImpl | 29 class AppWindowContentsImpl |
30 : public AppWindowContents, | 30 : public extensions::AppWindowContents, |
31 public content::WebContentsObserver, | 31 public content::WebContentsObserver, |
32 public extensions::ExtensionFunctionDispatcher::Delegate { | 32 public extensions::ExtensionFunctionDispatcher::Delegate { |
33 public: | 33 public: |
34 explicit AppWindowContentsImpl(AppWindow* host); | 34 explicit AppWindowContentsImpl(extensions::AppWindow* host); |
35 virtual ~AppWindowContentsImpl(); | 35 virtual ~AppWindowContentsImpl(); |
36 | 36 |
37 // AppWindowContents | 37 // AppWindowContents |
38 virtual void Initialize(content::BrowserContext* context, | 38 virtual void Initialize(content::BrowserContext* context, |
39 const GURL& url) OVERRIDE; | 39 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( | 41 virtual void NativeWindowChanged( |
42 extensions::NativeAppWindow* native_app_window) OVERRIDE; | 42 extensions::NativeAppWindow* native_app_window) OVERRIDE; |
43 virtual void NativeWindowClosed() OVERRIDE; | 43 virtual void NativeWindowClosed() OVERRIDE; |
44 virtual void DispatchWindowShownForTests() const OVERRIDE; | 44 virtual void DispatchWindowShownForTests() const OVERRIDE; |
45 virtual content::WebContents* GetWebContents() const OVERRIDE; | 45 virtual content::WebContents* GetWebContents() const OVERRIDE; |
46 | 46 |
47 private: | 47 private: |
48 // content::WebContentsObserver | 48 // content::WebContentsObserver |
49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
50 | 50 |
51 // extensions::ExtensionFunctionDispatcher::Delegate | 51 // extensions::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 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 56 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
57 void UpdateDraggableRegions( | 57 void UpdateDraggableRegions( |
58 const std::vector<extensions::DraggableRegion>& regions); | 58 const std::vector<extensions::DraggableRegion>& regions); |
59 void SuspendRenderViewHost(content::RenderViewHost* rvh); | 59 void SuspendRenderViewHost(content::RenderViewHost* rvh); |
60 | 60 |
61 AppWindow* host_; // This class is owned by |host_| | 61 extensions::AppWindow* host_; // This class is owned by |host_| |
62 GURL url_; | 62 GURL url_; |
63 scoped_ptr<content::WebContents> web_contents_; | 63 scoped_ptr<content::WebContents> web_contents_; |
64 scoped_ptr<extensions::ExtensionFunctionDispatcher> | 64 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
65 extension_function_dispatcher_; | 65 extension_function_dispatcher_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl); | 67 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace apps | 70 } // namespace apps |
71 | 71 |
72 #endif // APPS_APP_WINDOW_CONTENTS_H_ | 72 #endif // APPS_APP_WINDOW_CONTENTS_H_ |
OLD | NEW |