OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 5 #ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
10 #include "content/public/browser/web_contents_observer.h" | |
11 #include "extensions/browser/extension_function_dispatcher.h" | |
12 | 10 |
13 class GURL; | 11 class GURL; |
14 | 12 |
15 namespace content { | 13 namespace content { |
16 class BrowserContext; | 14 class BrowserContext; |
17 } | 15 } |
18 | 16 |
19 namespace extensions { | 17 namespace extensions { |
20 class AppDelegate; | 18 class AppDelegate; |
21 class AppWebContentsHelper; | 19 class AppWebContentsHelper; |
22 } | 20 } |
23 | 21 |
24 namespace apps { | 22 namespace apps { |
25 | 23 |
26 // Manages the web contents for extension-hosted launcher pages. The | 24 // Manages the web contents for extension-hosted launcher pages. The |
27 // implementation for this class should create and maintain the WebContents for | 25 // implementation for this class should create and maintain the WebContents for |
28 // the page, and handle any message passing between the web contents and the | 26 // the page, and handle any message passing between the web contents and the |
29 // extension system. | 27 // extension system. |
30 class CustomLauncherPageContents | 28 class CustomLauncherPageContents : public content::WebContentsDelegate { |
31 : public content::WebContentsDelegate, | |
32 public content::WebContentsObserver, | |
33 public extensions::ExtensionFunctionDispatcher::Delegate { | |
34 public: | 29 public: |
35 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, | 30 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, |
36 const std::string& extension_id); | 31 const std::string& extension_id); |
37 ~CustomLauncherPageContents() override; | 32 ~CustomLauncherPageContents() override; |
38 | 33 |
39 // Called to initialize and load the WebContents. | 34 // Called to initialize and load the WebContents. |
40 void Initialize(content::BrowserContext* context, const GURL& url); | 35 void Initialize(content::BrowserContext* context, const GURL& url); |
41 | 36 |
42 content::WebContents* web_contents() const { return web_contents_.get(); } | 37 content::WebContents* web_contents() const { return web_contents_.get(); } |
43 | 38 |
(...skipping 22 matching lines...) Expand all Loading... |
66 bool last_unlocked_by_target) override; | 61 bool last_unlocked_by_target) override; |
67 void RequestMediaAccessPermission( | 62 void RequestMediaAccessPermission( |
68 content::WebContents* web_contents, | 63 content::WebContents* web_contents, |
69 const content::MediaStreamRequest& request, | 64 const content::MediaStreamRequest& request, |
70 const content::MediaResponseCallback& callback) override; | 65 const content::MediaResponseCallback& callback) override; |
71 bool CheckMediaAccessPermission(content::WebContents* web_contents, | 66 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
72 const GURL& security_origin, | 67 const GURL& security_origin, |
73 content::MediaStreamType type) override; | 68 content::MediaStreamType type) override; |
74 | 69 |
75 private: | 70 private: |
76 // content::WebContentsObserver overrides: | |
77 bool OnMessageReceived(const IPC::Message& message) override; | |
78 | |
79 // extensions::ExtensionFunctionDispatcher::Delegate overrides: | |
80 extensions::WindowController* GetExtensionWindowController() const override; | |
81 content::WebContents* GetAssociatedWebContents() const override; | |
82 | |
83 void OnRequest(const ExtensionHostMsg_Request_Params& params); | |
84 | |
85 scoped_ptr<content::WebContents> web_contents_; | 71 scoped_ptr<content::WebContents> web_contents_; |
86 scoped_ptr<extensions::ExtensionFunctionDispatcher> | |
87 extension_function_dispatcher_; | |
88 scoped_ptr<extensions::AppDelegate> app_delegate_; | 72 scoped_ptr<extensions::AppDelegate> app_delegate_; |
89 scoped_ptr<extensions::AppWebContentsHelper> helper_; | 73 scoped_ptr<extensions::AppWebContentsHelper> helper_; |
90 | 74 |
91 std::string extension_id_; | 75 std::string extension_id_; |
92 | 76 |
93 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); | 77 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); |
94 }; | 78 }; |
95 | 79 |
96 } // namespace apps | 80 } // namespace apps |
97 | 81 |
98 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 82 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
OLD | NEW |