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

Unified Diff: chrome/browser/extensions/platform_app_launcher.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: 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
Index: chrome/browser/extensions/platform_app_launcher.cc
diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc
index 66466ff4130a45e8650dac77673ee1e231c8fe20..4ab888ec57ba4ac946d785157e3a85876bd2e0b9 100644
--- a/chrome/browser/extensions/platform_app_launcher.cc
+++ b/chrome/browser/extensions/platform_app_launcher.cc
@@ -14,6 +14,8 @@
#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
#include "chrome/browser/extensions/api/file_system/file_system_api.h"
+#include "chrome/browser/extensions/event_names.h"
+#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_process_manager.h"
@@ -415,9 +417,18 @@ void RestartPlatformAppWithFileEntries(
Profile* profile,
const Extension* extension,
const std::vector<SavedFileEntry>& file_entries) {
- scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher(
- profile, extension, file_entries);
- launcher->Launch();
+ bool listening_to_restart = ExtensionSystem::Get(profile)->event_router()->
+ ExtensionHasEventListener(extension->id(),
+ event_names::kOnRestarted);
+
+ if (listening_to_restart) {
+ scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher(
+ profile, extension, file_entries);
+ launcher->Launch();
+ } else {
+ // If the app isn't listening to onRestarted just launch the app.
+ LaunchPlatformApp(profile, extension, NULL, base::FilePath());
not at google - send to devlin 2013/04/19 14:16:52 Should this be LaunchPlatformAppWithNoData?
koz (OOO until 15th September) 2013/04/21 23:33:03 Done.
+ }
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698