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

Unified Diff: chrome/browser/guest_view/app_view/app_view_guest.cc

Issue 460133002: Allow passing parameters within appview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed spacing Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guest_view/app_view/app_view_guest.cc
diff --git a/chrome/browser/guest_view/app_view/app_view_guest.cc b/chrome/browser/guest_view/app_view/app_view_guest.cc
index 6df3c5d4193e1391363e61a5dfcd7dd8c68c1855..1b76ea04e2ff2e4cc29904c9b3359cb71e5a0184 100644
--- a/chrome/browser/guest_view/app_view/app_view_guest.cc
+++ b/chrome/browser/guest_view/app_view/app_view_guest.cc
@@ -150,6 +150,12 @@ void AppViewGuest::CreateWebContents(
return;
}
+ const base::DictionaryValue* params = NULL;
+ if (!create_params.GetDictionary(appview::kParams, &params)) {
+ callback.Run(NULL);
+ return;
+ }
+
ExtensionService* service =
extensions::ExtensionSystem::Get(browser_context())->extension_service();
const extensions::Extension* guest_extension =
@@ -176,9 +182,11 @@ void AppViewGuest::CreateWebContents(
if (queue->ShouldEnqueueTask(browser_context(), guest_extension)) {
queue->AddPendingTask(browser_context(),
guest_extension->id(),
- base::Bind(&AppViewGuest::LaunchAppAndFireEvent,
- weak_ptr_factory_.GetWeakPtr(),
- callback));
+ base::Bind(
+ &AppViewGuest::LaunchAppAndFireEvent,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(make_scoped_ptr(params->DeepCopy())),
+ callback));
return;
}
@@ -187,7 +195,7 @@ void AppViewGuest::CreateWebContents(
ExtensionHost* host =
process_manager->GetBackgroundHostForExtension(guest_extension->id());
DCHECK(host);
- LaunchAppAndFireEvent(callback, host);
+ LaunchAppAndFireEvent(make_scoped_ptr(params->DeepCopy()), callback, host);
}
void AppViewGuest::DidAttachToEmbedder() {
@@ -229,6 +237,7 @@ void AppViewGuest::CompleteCreateWebContents(
}
void AppViewGuest::LaunchAppAndFireEvent(
+ scoped_ptr<base::DictionaryValue> params,
const WebContentsCreatedCallback& callback,
ExtensionHost* extension_host) {
extensions::ExtensionSystem* system =
@@ -244,6 +253,7 @@ void AppViewGuest::LaunchAppAndFireEvent(
scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue());
embed_request->SetInteger(appview::kGuestInstanceID, GetGuestInstanceID());
embed_request->SetString(appview::kEmbedderID, embedder_extension_id());
+ embed_request->Set(appview::kParams, params.release());
extensions::AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent(
browser_context(), embed_request.Pass(), extension_host->extension());
}

Powered by Google App Engine
This is Rietveld 408576698