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

Unified Diff: chrome/browser/extensions/api/app/app_api.cc

Issue 10332071: Pass command line arguments onto platform apps which provide the right intent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bad merge Created 8 years, 7 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/extensions/api/app/app_api.cc
diff --git a/chrome/browser/extensions/api/app/app_api.cc b/chrome/browser/extensions/api/app/app_api.cc
index d429710f0fb7355c0a083c9e8da9509cbc7178bc..ae230a2ce018f79bf5ffb8f15dd4a5e0864ea745 100644
--- a/chrome/browser/extensions/api/app/app_api.cc
+++ b/chrome/browser/extensions/api/app/app_api.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/extensions/api/app/app_api.h"
+#include "base/json/json_writer.h"
#include "base/values.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/app_notification_manager.h"
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -120,4 +122,24 @@ void AppEventRouter::DispatchOnLaunchedEvent(
extension->id(), kOnLaunchedEvent, "[]", NULL, GURL());
}
+// static.
+void AppEventRouter::DispatchOnLaunchedEventWithUrl(
+ Profile* profile, const Extension* extension, const string16& action,
+ const std::string& mime_type, const GURL& url) {
+ ListValue args;
+ DictionaryValue* launch_data = new DictionaryValue();
+ DictionaryValue* intent = new DictionaryValue();
+ intent->SetString("action", UTF16ToUTF8(action));
+ intent->SetString("type", mime_type);
+ DictionaryValue* extra_data = new DictionaryValue();
+ extra_data->SetString("url", url.spec());
+ intent->Set("extra_data", extra_data);
+ launch_data->Set("intent", intent);
+ args.Append(launch_data);
+ std::string json_args;
+ base::JSONWriter::Write(&args, &json_args);
+ profile->GetExtensionEventRouter()->DispatchEventToExtension(
+ extension->id(), kOnLaunchedEvent, json_args, NULL, GURL());
Mihai Parparita -not on Chrome 2012/05/15 00:39:28 Seems like you would also need to update experimen
Greg Billock 2012/05/15 00:54:59 If we're using an idl value, we could put "action"
benwells 2012/05/16 01:35:29 My understanding is that the IDL or JSON provides
benwells 2012/05/18 03:36:02 I've added the launchData field into the json, but
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698