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..0ba19fb0cd0162c7ccf14aec6f5de0f10e046ae6 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,24 @@ 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()); |
+ ExtensionSystem* system = 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; |
+ system->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) { |
@@ -43,6 +62,15 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, |
} // namespace |
// static |
+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, |
const Extension* extension) { |