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