Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: extensions/browser/guest_view/app_view/app_view_guest.cc

Issue 618823002: GuestView: Move lifetime management out of content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 process_manager->GetBackgroundHostForExtension(guest_extension->id()); 196 process_manager->GetBackgroundHostForExtension(guest_extension->id());
197 DCHECK(host); 197 DCHECK(host);
198 LaunchAppAndFireEvent(make_scoped_ptr(data->DeepCopy()), callback, host); 198 LaunchAppAndFireEvent(make_scoped_ptr(data->DeepCopy()), callback, host);
199 } 199 }
200 200
201 void AppViewGuest::DidAttachToEmbedder() { 201 void AppViewGuest::DidAttachToEmbedder() {
202 // This is called after the guest process has been attached to a host 202 // This is called after the guest process has been attached to a host
203 // element. This means that the host element knows how to route input 203 // element. This means that the host element knows how to route input
204 // events to the guest, and the guest knows how to get frames to the 204 // events to the guest, and the guest knows how to get frames to the
205 // embedder. 205 // embedder.
206 if (!url_.is_valid())
207 return;
208
206 web_contents()->GetController().LoadURL( 209 web_contents()->GetController().LoadURL(
207 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); 210 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
211 url_ = GURL();
208 } 212 }
209 213
210 void AppViewGuest::DidInitialize() { 214 void AppViewGuest::DidInitialize() {
211 extension_function_dispatcher_.reset( 215 extension_function_dispatcher_.reset(
212 new ExtensionFunctionDispatcher(browser_context(), this)); 216 new ExtensionFunctionDispatcher(browser_context(), this));
213 } 217 }
214 218
215 void AppViewGuest::OnRequest(const ExtensionHostMsg_Request_Params& params) { 219 void AppViewGuest::OnRequest(const ExtensionHostMsg_Request_Params& params) {
216 extension_function_dispatcher_->Dispatch(params, 220 extension_function_dispatcher_->Dispatch(params,
217 web_contents()->GetRenderViewHost()); 221 web_contents()->GetRenderViewHost());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 255
252 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue()); 256 scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue());
253 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id()); 257 embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id());
254 embed_request->SetString(appview::kEmbedderID, embedder_extension_id()); 258 embed_request->SetString(appview::kEmbedderID, embedder_extension_id());
255 embed_request->Set(appview::kData, data.release()); 259 embed_request->Set(appview::kData, data.release());
256 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( 260 AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent(
257 browser_context(), embed_request.Pass(), extension_host->extension()); 261 browser_context(), embed_request.Pass(), extension_host->extension());
258 } 262 }
259 263
260 } // namespace extensions 264 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698