| 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 17 matching lines...) Expand all Loading... |
| 28 static bool CompletePendingRequest( | 28 static bool CompletePendingRequest( |
| 29 content::BrowserContext* browser_context, | 29 content::BrowserContext* browser_context, |
| 30 const GURL& url, | 30 const GURL& url, |
| 31 int guest_instance_id, | 31 int guest_instance_id, |
| 32 const std::string& guest_extension_id); | 32 const std::string& guest_extension_id); |
| 33 | 33 |
| 34 static GuestViewBase* Create(content::BrowserContext* browser_context, | 34 static GuestViewBase* Create(content::BrowserContext* browser_context, |
| 35 int guest_instance_id); | 35 int guest_instance_id); |
| 36 | 36 |
| 37 // ExtensionFunctionDispatcher::Delegate implementation. | 37 // ExtensionFunctionDispatcher::Delegate implementation. |
| 38 virtual WindowController* GetExtensionWindowController() const override; | 38 WindowController* GetExtensionWindowController() const override; |
| 39 virtual content::WebContents* GetAssociatedWebContents() const override; | 39 content::WebContents* GetAssociatedWebContents() const override; |
| 40 | 40 |
| 41 // content::WebContentsObserver implementation. | 41 // content::WebContentsObserver implementation. |
| 42 virtual bool OnMessageReceived(const IPC::Message& message) override; | 42 bool OnMessageReceived(const IPC::Message& message) override; |
| 43 | 43 |
| 44 // content::WebContentsDelegate implementation. | 44 // content::WebContentsDelegate implementation. |
| 45 virtual bool HandleContextMenu( | 45 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 46 const content::ContextMenuParams& params) override; | |
| 47 | 46 |
| 48 // GuestViewBase implementation. | 47 // GuestViewBase implementation. |
| 49 virtual const char* GetAPINamespace() const override; | 48 const char* GetAPINamespace() const override; |
| 50 virtual int GetTaskPrefix() const override; | 49 int GetTaskPrefix() const override; |
| 51 virtual void CreateWebContents( | 50 void CreateWebContents(const std::string& embedder_extension_id, |
| 52 const std::string& embedder_extension_id, | 51 int embedder_render_process_id, |
| 53 int embedder_render_process_id, | 52 const GURL& embedder_site_url, |
| 54 const GURL& embedder_site_url, | 53 const base::DictionaryValue& create_params, |
| 55 const base::DictionaryValue& create_params, | 54 const WebContentsCreatedCallback& callback) override; |
| 56 const WebContentsCreatedCallback& callback) override; | 55 void DidAttachToEmbedder() override; |
| 57 virtual void DidAttachToEmbedder() override; | 56 void DidInitialize() override; |
| 58 virtual void DidInitialize() override; | |
| 59 | 57 |
| 60 private: | 58 private: |
| 61 AppViewGuest(content::BrowserContext* browser_context, int guest_instance_id); | 59 AppViewGuest(content::BrowserContext* browser_context, int guest_instance_id); |
| 62 | 60 |
| 63 virtual ~AppViewGuest(); | 61 ~AppViewGuest() override; |
| 64 | 62 |
| 65 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 63 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 66 | 64 |
| 67 void CompleteCreateWebContents(const GURL& url, | 65 void CompleteCreateWebContents(const GURL& url, |
| 68 const Extension* guest_extension, | 66 const Extension* guest_extension, |
| 69 const WebContentsCreatedCallback& callback); | 67 const WebContentsCreatedCallback& callback); |
| 70 | 68 |
| 71 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, | 69 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, |
| 72 const WebContentsCreatedCallback& callback, | 70 const WebContentsCreatedCallback& callback, |
| 73 ExtensionHost* extension_host); | 71 ExtensionHost* extension_host); |
| 74 | 72 |
| 75 GURL url_; | 73 GURL url_; |
| 76 std::string guest_extension_id_; | 74 std::string guest_extension_id_; |
| 77 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 75 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 78 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; | 76 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; |
| 79 | 77 |
| 80 // This is used to ensure pending tasks will not fire after this object is | 78 // This is used to ensure pending tasks will not fire after this object is |
| 81 // destroyed. | 79 // destroyed. |
| 82 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; | 80 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; |
| 83 | 81 |
| 84 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); | 82 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 } // namespace extensions | 85 } // namespace extensions |
| 88 | 86 |
| 89 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 87 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
| OLD | NEW |