Index: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
diff --git a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
index 10e29f57551c4e5354aee6314c9481470ff96175..9eea50382b1d16294fc0c0c30d2ded0ace4f8173 100644 |
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/browser/extensions/event_router.h" |
#include "chrome/browser/extensions/extension_system.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/extensions/api/app_runtime.h" |
#include "chrome/common/extensions/extension.h" |
#include "content/public/browser/web_contents.h" |
#include "googleurl/src/gurl.h" |
@@ -48,8 +49,8 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, |
// static. |
void AppEventRouter::DispatchOnLaunchedEvent( |
Profile* profile, const Extension* extension) { |
- scoped_ptr<ListValue> arguments(new ListValue()); |
- DispatchOnLaunchedEventImpl(extension->id(), arguments.Pass(), profile); |
+ scoped_ptr<ListValue> args(new ListValue()); |
+ DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
} |
DictionaryValue* DictionaryFromSavedFileEntry( |
@@ -82,9 +83,12 @@ void AppEventRouter::DispatchOnRestartedEvent( |
// static. |
void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
- Profile* profile, const Extension* extension, |
- const std::string& handler_id, const std::string& mime_type, |
- const std::string& file_system_id, const std::string& base_name) { |
+ Profile* profile, |
+ const Extension* extension, |
+ const std::string& handler_id, |
+ const std::string& mime_type, |
+ const std::string& file_system_id, |
+ const std::string& base_name) { |
scoped_ptr<ListValue> args(new ListValue()); |
DictionaryValue* launch_data = new DictionaryValue(); |
launch_data->SetString("id", handler_id); |
@@ -99,4 +103,22 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
} |
+// static. |
+void AppEventRouter::DispatchOnLaunchedEventWithUrl( |
+ Profile* profile, |
+ const Extension* extension, |
+ const std::string& handler_id, |
+ const GURL& url, |
+ const GURL& referrer_url) { |
+ // TODO (sergeygs): Use the same way of creating an event (using the generated |
benwells
2013/08/30 05:41:39
Nit: Move this TODO to the code above where it is
sergeygs
2013/09/02 07:36:22
Done.
|
+ // boilerplate) in methods above. |
+ api::app_runtime::LaunchData launch_data; |
+ launch_data.id.reset(new std::string(handler_id)); |
+ launch_data.url.reset(new std::string(url.spec())); |
+ launch_data.referrer_url.reset(new std::string(referrer_url.spec())); |
+ scoped_ptr<ListValue> args(new ListValue()); |
+ args->Append(launch_data.ToValue().release()); |
+ DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
+} |
+ |
} // namespace extensions |