| 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 content::BrowserContext* browser_context, | 34 content::BrowserContext* browser_context, |
| 35 const GURL& url, | 35 const GURL& url, |
| 36 int guest_instance_id, | 36 int guest_instance_id, |
| 37 const std::string& guest_extension_id, | 37 const std::string& guest_extension_id, |
| 38 content::RenderProcessHost* guest_render_process_host); | 38 content::RenderProcessHost* guest_render_process_host); |
| 39 | 39 |
| 40 static GuestViewBase* Create(content::WebContents* owner_web_contents); | 40 static GuestViewBase* Create(content::WebContents* owner_web_contents); |
| 41 | 41 |
| 42 static std::vector<int> GetAllRegisteredInstanceIdsForTesting(); | 42 static std::vector<int> GetAllRegisteredInstanceIdsForTesting(); |
| 43 | 43 |
| 44 // content::WebContentsDelegate implementation. | |
| 45 bool HandleContextMenu(const content::ContextMenuParams& params) override; | |
| 46 void RequestMediaAccessPermission( | |
| 47 content::WebContents* web_contents, | |
| 48 const content::MediaStreamRequest& request, | |
| 49 const content::MediaResponseCallback& callback) override; | |
| 50 bool CheckMediaAccessPermission(content::WebContents* web_contents, | |
| 51 const GURL& security_origin, | |
| 52 content::MediaStreamType type) override; | |
| 53 | |
| 54 // GuestViewBase implementation. | |
| 55 bool CanRunInDetachedState() const override; | |
| 56 void CreateWebContents(const base::DictionaryValue& create_params, | |
| 57 const WebContentsCreatedCallback& callback) override; | |
| 58 void DidInitialize(const base::DictionaryValue& create_params) override; | |
| 59 const char* GetAPINamespace() const override; | |
| 60 int GetTaskPrefix() const override; | |
| 61 | |
| 62 // Sets the AppDelegate for this guest. | 44 // Sets the AppDelegate for this guest. |
| 63 void SetAppDelegateForTest(AppDelegate* delegate); | 45 void SetAppDelegateForTest(AppDelegate* delegate); |
| 64 | 46 |
| 65 private: | 47 private: |
| 66 explicit AppViewGuest(content::WebContents* owner_web_contents); | 48 explicit AppViewGuest(content::WebContents* owner_web_contents); |
| 67 | 49 |
| 68 ~AppViewGuest() override; | 50 ~AppViewGuest() override; |
| 69 | 51 |
| 52 // GuestViewBase implementation. |
| 53 bool CanRunInDetachedState() const final; |
| 54 void CreateWebContents(const base::DictionaryValue& create_params, |
| 55 const WebContentsCreatedCallback& callback) final; |
| 56 void DidInitialize(const base::DictionaryValue& create_params) final; |
| 57 const char* GetAPINamespace() const final; |
| 58 int GetTaskPrefix() const final; |
| 59 |
| 60 // content::WebContentsDelegate implementation. |
| 61 bool HandleContextMenu(const content::ContextMenuParams& params) final; |
| 62 void RequestMediaAccessPermission( |
| 63 content::WebContents* web_contents, |
| 64 const content::MediaStreamRequest& request, |
| 65 const content::MediaResponseCallback& callback) final; |
| 66 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
| 67 const GURL& security_origin, |
| 68 content::MediaStreamType type) final; |
| 69 |
| 70 void CompleteCreateWebContents(const GURL& url, | 70 void CompleteCreateWebContents(const GURL& url, |
| 71 const Extension* guest_extension, | 71 const Extension* guest_extension, |
| 72 const WebContentsCreatedCallback& callback); | 72 const WebContentsCreatedCallback& callback); |
| 73 | 73 |
| 74 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, | 74 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, |
| 75 const WebContentsCreatedCallback& callback, | 75 const WebContentsCreatedCallback& callback, |
| 76 ExtensionHost* extension_host); | 76 ExtensionHost* extension_host); |
| 77 | 77 |
| 78 GURL url_; | 78 GURL url_; |
| 79 std::string guest_extension_id_; | 79 std::string guest_extension_id_; |
| 80 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; | 80 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; |
| 81 scoped_ptr<AppDelegate> app_delegate_; | 81 scoped_ptr<AppDelegate> app_delegate_; |
| 82 | 82 |
| 83 // This is used to ensure pending tasks will not fire after this object is | 83 // This is used to ensure pending tasks will not fire after this object is |
| 84 // destroyed. | 84 // destroyed. |
| 85 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; | 85 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); | 87 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace extensions | 90 } // namespace extensions |
| 91 | 91 |
| 92 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 92 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
| OLD | NEW |