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..d34420cc7257a6dbd460592429f6ed760eb363dc 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 DispatchOnAppEmbeddingRequestEventImpl( |
+ 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 = |
+ extensions::ExtensionSystem::Get(context); |
+ scoped_ptr<Event> event( |
+ new Event(app_runtime::OnAppEmbeddingRequest::kEventName, args.Pass())); |
+ event->restrict_to_browser_context = context; |
+ event->can_load_ephemeral_apps = true; |
+ extensions::EventRouter* event_router = system->event_router(); |
+ 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. |
+void AppRuntimeEventRouter::DispatchOnAppEmbeddingRequestEvent( |
+ content::BrowserContext* context, |
+ scoped_ptr<base::DictionaryValue> embed_app_data, |
+ const Extension* extension) { |
+ DispatchOnAppEmbeddingRequestEventImpl( |
+ extension->id(), embed_app_data.Pass(), context); |
+} |
+ |
// static |
void AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
BrowserContext* context, |