Chromium Code Reviews| Index: extensions/browser/api/app_runtime/app_runtime_api.cc |
| diff --git a/extensions/browser/api/app_runtime/app_runtime_api.cc b/extensions/browser/api/app_runtime/app_runtime_api.cc |
| index cb93a85c27227ae0ffdcc699949544f1da344a46..bd4e67f984afbeab8f7ff173175dc4af4792c0af 100644 |
| --- a/extensions/browser/api/app_runtime/app_runtime_api.cc |
| +++ b/extensions/browser/api/app_runtime/app_runtime_api.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/values.h" |
| #include "extensions/browser/event_router.h" |
| #include "extensions/browser/extension_prefs.h" |
| +#include "extensions/browser/extension_system.h" |
| #include "extensions/browser/extensions_browser_client.h" |
| #include "extensions/browser/granted_file_entry.h" |
| #include "extensions/common/api/app_runtime.h" |
| @@ -21,6 +22,25 @@ namespace app_runtime = core_api::app_runtime; |
| namespace { |
| +void DispatchOnEmbedRequestedEventImpl( |
| + const std::string& extension_id, |
| + scoped_ptr<base::DictionaryValue> app_embedding_request_data, |
| + content::BrowserContext* context) { |
| + scoped_ptr<base::ListValue> args(new base::ListValue()); |
| + args->Append(app_embedding_request_data.release()); |
| + extensions::ExtensionSystem* system = |
|
James Cook
2014/07/11 03:16:01
extensions:: not needed
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + extensions::ExtensionSystem::Get(context); |
| + scoped_ptr<Event> event( |
| + new Event(app_runtime::OnEmbedRequested::kEventName, args.Pass())); |
| + event->restrict_to_browser_context = context; |
| + event->can_load_ephemeral_apps = true; |
| + extensions::EventRouter* event_router = system->event_router(); |
|
James Cook
2014/07/11 03:16:00
ditto
Fady Samuel
2014/07/11 15:28:55
Done.
|
| + event_router->DispatchEventWithLazyListener(extension_id, event.Pass()); |
| + |
| + ExtensionPrefs::Get(context) |
| + ->SetLastLaunchTime(extension_id, base::Time::Now()); |
| +} |
| + |
| void DispatchOnLaunchedEventImpl(const std::string& extension_id, |
| scoped_ptr<base::DictionaryValue> launch_data, |
| BrowserContext* context) { |
| @@ -42,6 +62,15 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, |
| } // namespace |
| +// static. |
|
James Cook
2014/07/11 03:16:01
super nit: no "." after "static" for consistency w
Fady Samuel
2014/07/11 15:28:55
Done.
|
| +void AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( |
| + content::BrowserContext* context, |
| + scoped_ptr<base::DictionaryValue> embed_app_data, |
| + const Extension* extension) { |
| + DispatchOnEmbedRequestedEventImpl( |
| + extension->id(), embed_app_data.Pass(), context); |
| +} |
| + |
| // static |
| void AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
| BrowserContext* context, |