| 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 CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
| 6 #define CHROME_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/guest_view.h" | 11 #include "extensions/browser/guest_view/guest_view.h" |
| 11 | 12 |
| 12 namespace extensions { | 13 namespace extensions { |
| 13 class Extension; | 14 class Extension; |
| 14 class ExtensionHost; | 15 class ExtensionHost; |
| 15 | 16 |
| 16 // An AppViewGuest provides the browser-side implementation of <appview> API. | 17 // An AppViewGuest provides the browser-side implementation of <appview> API. |
| 17 // AppViewGuest is created on attachment. That is, when a guest WebContents is | 18 // AppViewGuest is created on attachment. That is, when a guest WebContents is |
| 18 // associated with a particular embedder WebContents. This happens on calls to | 19 // associated with a particular embedder WebContents. This happens on calls to |
| 19 // the connect API. | 20 // the connect API. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 virtual const char* GetAPINamespace() OVERRIDE; | 49 virtual const char* GetAPINamespace() OVERRIDE; |
| 49 virtual void CreateWebContents( | 50 virtual void CreateWebContents( |
| 50 const std::string& embedder_extension_id, | 51 const std::string& embedder_extension_id, |
| 51 int embedder_render_process_id, | 52 int embedder_render_process_id, |
| 52 const base::DictionaryValue& create_params, | 53 const base::DictionaryValue& create_params, |
| 53 const WebContentsCreatedCallback& callback) OVERRIDE; | 54 const WebContentsCreatedCallback& callback) OVERRIDE; |
| 54 virtual void DidAttachToEmbedder() OVERRIDE; | 55 virtual void DidAttachToEmbedder() OVERRIDE; |
| 55 virtual void DidInitialize() OVERRIDE; | 56 virtual void DidInitialize() OVERRIDE; |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 AppViewGuest(content::BrowserContext* browser_context, | 59 AppViewGuest(content::BrowserContext* browser_context, int guest_instance_id); |
| 59 int guest_instance_id); | |
| 60 | 60 |
| 61 virtual ~AppViewGuest(); | 61 virtual ~AppViewGuest(); |
| 62 | 62 |
| 63 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 63 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 64 | 64 |
| 65 void CompleteCreateWebContents(const GURL& url, | 65 void CompleteCreateWebContents(const GURL& url, |
| 66 const Extension* guest_extension, | 66 const Extension* guest_extension, |
| 67 const WebContentsCreatedCallback& callback); | 67 const WebContentsCreatedCallback& callback); |
| 68 | 68 |
| 69 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, | 69 void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data, |
| 70 const WebContentsCreatedCallback& callback, | 70 const WebContentsCreatedCallback& callback, |
| 71 ExtensionHost* extension_host); | 71 ExtensionHost* extension_host); |
| 72 | 72 |
| 73 GURL url_; | 73 GURL url_; |
| 74 std::string guest_extension_id_; | 74 std::string guest_extension_id_; |
| 75 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 75 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 76 scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_; |
| 76 | 77 |
| 77 // 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 |
| 78 // destroyed. | 79 // destroyed. |
| 79 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; | 80 base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); | 82 DISALLOW_COPY_AND_ASSIGN(AppViewGuest); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace extensions | 85 } // namespace extensions |
| 85 | 86 |
| 86 #endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ | 87 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ |
| OLD | NEW |