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

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: Windows tests fixed 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 14c9ece19c78f06e6fc2920ce06a6d1f97a475d2..3b74ab0b169df1064455e3bd281c71e8d006c331 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"
@@ -121,4 +123,27 @@ void AppEventRouter::DispatchOnLaunchedEvent(
extension->id(), kOnLaunchedEvent, "[]", NULL, GURL());
}
+// static.
+void AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
+ Profile* profile, const Extension* extension, const string16& action,
+ const std::string& file_system_id, const FilePath& base_name) {
+ ListValue args;
+ DictionaryValue* launch_data = new DictionaryValue();
+ DictionaryValue* intent = new DictionaryValue();
+ intent->SetString("action", UTF16ToUTF8(action));
+ launch_data->Set("intent", intent);
+ intent->SetString("type", "chrome-extension://fileentry");
+ args.Append(launch_data);
+ args.Append(Value::CreateStringValue(file_system_id));
+#if defined(OS_WIN)
+ args.Append(Value::CreateStringValue(UTF16ToUTF8(base_name.value())));
+#else
+ args.Append(Value::CreateStringValue(base_name.value()));
+#endif
+ std::string json_args;
+ base::JSONWriter::Write(&args, &json_args);
+ profile->GetExtensionEventRouter()->DispatchEventToExtension(
+ extension->id(), kOnLaunchedEvent, json_args, NULL, GURL());
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/app/app_api.h ('k') | chrome/browser/extensions/app_notification_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698