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 "components/guest_view/browser/guest_view.h" | 9 #include "components/guest_view/browser/guest_view.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" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 class Extension; | 13 class Extension; |
14 class ExtensionHost; | 14 class ExtensionHost; |
15 | 15 |
16 // An AppViewGuest provides the browser-side implementation of <appview> API. | 16 // An AppViewGuest provides the browser-side implementation of <appview> API. |
17 // AppViewGuest is created on attachment. That is, when a guest WebContents is | 17 // AppViewGuest is created on attachment. That is, when a guest WebContents is |
18 // associated with a particular embedder WebContents. This happens on calls to | 18 // associated with a particular embedder WebContents. This happens on calls to |
19 // the connect API. | 19 // the connect API. |
20 class AppViewGuest : public guest_view::GuestView<AppViewGuest> { | 20 class AppViewGuest : public guest_view::GuestView<AppViewGuest> { |
21 public: | 21 public: |
22 static const char Type[]; | 22 static const char Type[]; |
23 | 23 |
24 // Completes the creation of a WebContents associated with the provided | 24 // Completes the creation of a WebContents associated with the provided |
25 // |guest_extensions_id|. | 25 // |guest_extensions_id|. |
26 static bool CompletePendingRequest( | 26 static bool CompletePendingRequest(content::BrowserContext* browser_context, |
27 content::BrowserContext* browser_context, | 27 const GURL& url, |
28 const GURL& url, | 28 int guest_instance_id, |
29 int guest_instance_id, | 29 const std::string& guest_extension_id, |
30 const std::string& guest_extension_id); | 30 int guest_render_process_host_id); |
31 | 31 |
32 static GuestViewBase* Create(content::WebContents* owner_web_contents); | 32 static GuestViewBase* Create(content::WebContents* owner_web_contents); |
33 | 33 |
| 34 static base::WeakPtr<AppViewGuest> GetAppViewGuestFromExtensionIdForTesting( |
| 35 const std::string& extension_id); |
| 36 static void SetAppViewGuestForExtensionIdForTesting( |
| 37 const std::string& extension_id, |
| 38 base::WeakPtr<AppViewGuest> weak_ptr); |
| 39 static std::vector<int> GetAllRegisteredInstanceIdsForTesting(); |
| 40 |
34 // content::WebContentsDelegate implementation. | 41 // content::WebContentsDelegate implementation. |
35 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 42 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
36 void RequestMediaAccessPermission( | 43 void RequestMediaAccessPermission( |
37 content::WebContents* web_contents, | 44 content::WebContents* web_contents, |
38 const content::MediaStreamRequest& request, | 45 const content::MediaStreamRequest& request, |
39 const content::MediaResponseCallback& callback) override; | 46 const content::MediaResponseCallback& callback) override; |
40 bool CheckMediaAccessPermission(content::WebContents* web_contents, | 47 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
41 const GURL& security_origin, | 48 const GURL& security_origin, |
42 content::MediaStreamType type) override; | 49 content::MediaStreamType type) override; |
43 | 50 |
(...skipping 29 matching lines...) Expand all Loading... |
73 // This is used to ensure pending tasks will not fire after this object is | 80 // This is used to ensure pending tasks will not fire after this object is |
74 // destroyed. | 81 // destroyed. |
75 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; | 82 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; |
76 | 83 |
77 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); | 84 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); |
78 }; | 85 }; |
79 | 86 |
80 } // namespace extensions | 87 } // namespace extensions |
81 | 88 |
82 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 89 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
OLD | NEW |