| 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 #include "extensions/browser/guest_view/app_view/app_view_guest.h" | 5 #include "extensions/browser/guest_view/app_view/app_view_guest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/common/renderer_preferences.h" | 9 #include "content/public/common/renderer_preferences.h" |
| 10 #include "extensions/browser/api/app_runtime/app_runtime_api.h" | 10 #include "extensions/browser/api/app_runtime/app_runtime_api.h" |
| 11 #include "extensions/browser/api/extensions_api_client.h" | 11 #include "extensions/browser/api/extensions_api_client.h" |
| 12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
| 13 #include "extensions/browser/extension_host.h" | 13 #include "extensions/browser/extension_host.h" |
| 14 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
| 16 #include "extensions/browser/guest_view/app_view/app_view_constants.h" | 16 #include "extensions/browser/guest_view/app_view/app_view_constants.h" |
| 17 #include "extensions/browser/guest_view/guest_view_manager.h" | 17 #include "extensions/browser/guest_view/guest_view_manager.h" |
| 18 #include "extensions/browser/lazy_background_task_queue.h" | 18 #include "extensions/browser/lazy_background_task_queue.h" |
| 19 #include "extensions/browser/process_manager.h" | 19 #include "extensions/browser/process_manager.h" |
| 20 #include "extensions/browser/view_type_utils.h" | 20 #include "extensions/browser/view_type_utils.h" |
| 21 #include "extensions/common/api/app_runtime.h" | 21 #include "extensions/common/api/app_runtime.h" |
| 22 #include "extensions/common/extension_messages.h" | 22 #include "extensions/common/extension_messages.h" |
| 23 #include "extensions/common/switches.h" | 23 #include "extensions/common/switches.h" |
| 24 #include "extensions/strings/grit/extensions_strings.h" |
| 24 #include "ipc/ipc_message_macros.h" | 25 #include "ipc/ipc_message_macros.h" |
| 25 | 26 |
| 26 namespace app_runtime = extensions::core_api::app_runtime; | 27 namespace app_runtime = extensions::core_api::app_runtime; |
| 27 | 28 |
| 28 using content::RenderFrameHost; | 29 using content::RenderFrameHost; |
| 29 using content::WebContents; | 30 using content::WebContents; |
| 30 using extensions::ExtensionHost; | 31 using extensions::ExtensionHost; |
| 31 | 32 |
| 32 namespace extensions { | 33 namespace extensions { |
| 33 | 34 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 128 } |
| 128 | 129 |
| 129 bool AppViewGuest::HandleContextMenu(const content::ContextMenuParams& params) { | 130 bool AppViewGuest::HandleContextMenu(const content::ContextMenuParams& params) { |
| 130 if (app_view_guest_delegate_) { | 131 if (app_view_guest_delegate_) { |
| 131 return app_view_guest_delegate_->HandleContextMenu(guest_web_contents(), | 132 return app_view_guest_delegate_->HandleContextMenu(guest_web_contents(), |
| 132 params); | 133 params); |
| 133 } | 134 } |
| 134 return false; | 135 return false; |
| 135 } | 136 } |
| 136 | 137 |
| 137 const char* AppViewGuest::GetAPINamespace() { | 138 const char* AppViewGuest::GetAPINamespace() const { |
| 138 return appview::kEmbedderAPINamespace; | 139 return appview::kEmbedderAPINamespace; |
| 139 } | 140 } |
| 140 | 141 |
| 142 int AppViewGuest::GetTaskPrefix() const { |
| 143 return IDS_EXTENSION_TASK_MANAGER_APPVIEW_TAG_PREFIX; |
| 144 } |
| 145 |
| 141 void AppViewGuest::CreateWebContents( | 146 void AppViewGuest::CreateWebContents( |
| 142 const std::string& embedder_extension_id, | 147 const std::string& embedder_extension_id, |
| 143 int embedder_render_process_id, | 148 int embedder_render_process_id, |
| 144 const base::DictionaryValue& create_params, | 149 const base::DictionaryValue& create_params, |
| 145 const WebContentsCreatedCallback& callback) { | 150 const WebContentsCreatedCallback& callback) { |
| 146 std::string app_id; | 151 std::string app_id; |
| 147 if (!create_params.GetString(appview::kAppID, &app_id)) { | 152 if (!create_params.GetString(appview::kAppID, &app_id)) { |
| 148 callback.Run(NULL); | 153 callback.Run(NULL); |
| 149 return; | 154 return; |
| 150 } | 155 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 253 |
| 249 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); | 254 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); |
| 250 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); | 255 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); |
| 251 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); | 256 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); |
| 252 embed_request->Set(appview::kData, data.release()); | 257 embed_request->Set(appview::kData, data.release()); |
| 253 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( | 258 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( |
| 254 browser_context(), embed_request.Pass(), extension_host->extension()); | 259 browser_context(), embed_request.Pass(), extension_host->extension()); |
| 255 } | 260 } |
| 256 | 261 |
| 257 } // namespace extensions | 262 } // namespace extensions |
| OLD | NEW |