Chromium Code Reviews| 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..163c1dcd0ecfa01f04d08410050bf4be646207ed 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: Use the same way of creating an event (using the generated |
|
not at google - send to devlin
2013/08/29 17:35:56
TODO(sergeygs)
sergeygs
2013/08/30 00:39:44
Done.
not at google - send to devlin
2013/08/30 17:07:58
Sorry to be further nitpicky, but:
# airguitar ~/
sergeygs
2013/09/02 07:36:21
Done.
|
| + // boilerplate) in methods above. |
| + extensions::api::app_runtime::LaunchData launch_data; |
|
not at google - send to devlin
2013/08/29 17:35:56
this file is already in extensions::, don't need h
sergeygs
2013/08/30 00:39:44
Done.
|
| + 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 |