Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc

Issue 14348015: Send onLaunched to apps that don't listen to onRestarted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/event_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2cbdbd7ae99abb3c101b7dc1fbc272a719db6d1b 100644
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
+#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
@@ -21,8 +22,8 @@ namespace extensions {
namespace {
-const char kOnLaunchedEvent[] = "app.runtime.onLaunched";
-const char kOnRestartedEvent[] = "app.runtime.onRestarted";
+using event_names::kOnLaunched;
+using event_names::kOnRestarted;
void DispatchOnLaunchedEventImpl(const std::string& extension_id,
scoped_ptr<base::ListValue> args,
@@ -35,12 +36,11 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id,
// extension does not actually have a listener, the event will just be
// ignored (but an app that doesn't listen for the onLaunched event doesn't
// make sense anyway).
- system->event_router()->AddLazyEventListener(kOnLaunchedEvent, extension_id);
- scoped_ptr<Event> event(new Event(kOnLaunchedEvent, args.Pass()));
+ system->event_router()->AddLazyEventListener(kOnLaunched, extension_id);
+ scoped_ptr<Event> event(new Event(kOnLaunched, args.Pass()));
event->restrict_to_profile = profile;
system->event_router()->DispatchEventToExtension(extension_id, event.Pass());
- system->event_router()->RemoveLazyEventListener(kOnLaunchedEvent,
- extension_id);
+ system->event_router()->RemoveLazyEventListener(kOnLaunched, extension_id);
}
} // anonymous namespace
@@ -74,7 +74,7 @@ void AppEventRouter::DispatchOnRestartedEvent(
}
scoped_ptr<ListValue> arguments(new ListValue());
arguments->Append(file_entries_list);
- scoped_ptr<Event> event(new Event(kOnRestartedEvent, arguments.Pass()));
+ scoped_ptr<Event> event(new Event(kOnRestarted, arguments.Pass()));
event->restrict_to_profile = profile;
extensions::ExtensionSystem::Get(profile)->event_router()->
DispatchEventToExtension(extension->id(), event.Pass());
« no previous file with comments | « no previous file | chrome/browser/extensions/event_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698