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 EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "extensions/browser/extension_function_dispatcher.h" | 9 #include "extensions/browser/extension_function_dispatcher.h" |
10 #include "extensions/browser/guest_view/app_view/app_view_guest_delegate.h" | 10 #include "extensions/browser/guest_view/app_view/app_view_guest_delegate.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // ExtensionFunctionDispatcher::Delegate implementation. | 38 // ExtensionFunctionDispatcher::Delegate implementation. |
39 WindowController* GetExtensionWindowController() const override; | 39 WindowController* GetExtensionWindowController() const override; |
40 content::WebContents* GetAssociatedWebContents() const override; | 40 content::WebContents* GetAssociatedWebContents() const override; |
41 | 41 |
42 // content::WebContentsObserver implementation. | 42 // content::WebContentsObserver implementation. |
43 bool OnMessageReceived(const IPC::Message& message) override; | 43 bool OnMessageReceived(const IPC::Message& message) override; |
44 | 44 |
45 // content::WebContentsDelegate implementation. | 45 // content::WebContentsDelegate implementation. |
46 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 46 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 47 void RequestMediaAccessPermission( |
| 48 content::WebContents* web_contents, |
| 49 const content::MediaStreamRequest& request, |
| 50 const content::MediaResponseCallback& callback) override; |
| 51 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
| 52 const GURL& security_origin, |
| 53 content::MediaStreamType type) override; |
47 | 54 |
48 // GuestViewBase implementation. | 55 // GuestViewBase implementation. |
49 const char* GetAPINamespace() const override; | 56 const char* GetAPINamespace() const override; |
50 int GetTaskPrefix() const override; | 57 int GetTaskPrefix() const override; |
51 void CreateWebContents(const base::DictionaryValue& create_params, | 58 void CreateWebContents(const base::DictionaryValue& create_params, |
52 const WebContentsCreatedCallback& callback) override; | 59 const WebContentsCreatedCallback& callback) override; |
53 void DidAttachToEmbedder() override; | 60 void DidAttachToEmbedder() override; |
54 void DidInitialize() override; | 61 void DidInitialize() override; |
55 | 62 |
| 63 // Sets the AppDelegate for this guest. |
| 64 void SetAppDelegateForTest(AppDelegate* delegate); |
| 65 |
56 private: | 66 private: |
57 AppViewGuest(content::BrowserContext* browser_context, | 67 AppViewGuest(content::BrowserContext* browser_context, |
58 content::WebContents* owner_web_contents, | 68 content::WebContents* owner_web_contents, |
59 int guest_instance_id); | 69 int guest_instance_id); |
60 | 70 |
61 ~AppViewGuest() override; | 71 ~AppViewGuest() override; |
62 | 72 |
63 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 73 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
64 | 74 |
65 void CompleteCreateWebContents(const GURL& url, | 75 void CompleteCreateWebContents(const GURL& url, |
66 const Extension* guest_extension, | 76 const Extension* guest_extension, |
67 const WebContentsCreatedCallback& callback); | 77 const WebContentsCreatedCallback& callback); |
68 | 78 |
69 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, | 79 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, |
70 const WebContentsCreatedCallback& callback, | 80 const WebContentsCreatedCallback& callback, |
71 ExtensionHost* extension_host); | 81 ExtensionHost* extension_host); |
72 | 82 |
73 GURL url_; | 83 GURL url_; |
74 std::string guest_extension_id_; | 84 std::string guest_extension_id_; |
75 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 85 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
76 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; | 86 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; |
| 87 scoped_ptr<AppDelegate> app_delegate_; |
77 | 88 |
78 // This is used to ensure pending tasks will not fire after this object is | 89 // This is used to ensure pending tasks will not fire after this object is |
79 // destroyed. | 90 // destroyed. |
80 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; | 91 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; |
81 | 92 |
82 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); | 93 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); |
83 }; | 94 }; |
84 | 95 |
85 } // namespace extensions | 96 } // namespace extensions |
86 | 97 |
87 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 98 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
OLD | NEW |