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" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 linked_ptr<ResponseInfo> response_info = it->second; | 74 linked_ptr<ResponseInfo> response_info = it->second; |
75 if (!response_info->app_view_guest || | 75 if (!response_info->app_view_guest || |
76 (response_info->guest_extension->id() != guest_extension_id)) { | 76 (response_info->guest_extension->id() != guest_extension_id)) { |
77 // TODO(fsamuel): An app is trying to respond to an <appview> that didn't | 77 // TODO(fsamuel): An app is trying to respond to an <appview> that didn't |
78 // initiate communication with it. We should kill the app here. | 78 // initiate communication with it. We should kill the app here. |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 response_info->app_view_guest-> | 82 response_info->app_view_guest->CompleteCreateWebContents( |
83 CompleteCreateWebContents(url, | 83 url, response_info->guest_extension.get(), response_info->callback); |
84 response_info->guest_extension, | |
85 response_info->callback); | |
86 | 84 |
87 response_map->erase(guest_instance_id); | 85 response_map->erase(guest_instance_id); |
88 return true; | 86 return true; |
89 } | 87 } |
90 | 88 |
91 // static | 89 // static |
92 GuestViewBase* AppViewGuest::Create(content::BrowserContext* browser_context, | 90 GuestViewBase* AppViewGuest::Create(content::BrowserContext* browser_context, |
93 int guest_instance_id) { | 91 int guest_instance_id) { |
94 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 92 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
95 extensions::switches::kEnableAppView)) { | 93 extensions::switches::kEnableAppView)) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 246 |
249 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); | 247 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); |
250 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); | 248 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); |
251 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); | 249 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); |
252 embed_request->Set(appview::kData, data.release()); | 250 embed_request->Set(appview::kData, data.release()); |
253 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( | 251 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( |
254 browser_context(), embed_request.Pass(), extension_host->extension()); | 252 browser_context(), embed_request.Pass(), extension_host->extension()); |
255 } | 253 } |
256 | 254 |
257 } // namespace extensions | 255 } // namespace extensions |
OLD | NEW |