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

Side by Side Diff: trunk/src/apps/app_load_service.cc

Issue 127843005: Revert 241162 "Make clicking the restart bubble for crashed apps..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/apps/launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/app_load_service.h" 5 #include "apps/app_load_service.h"
6 6
7 #include "apps/app_load_service_factory.h" 7 #include "apps/app_load_service_factory.h"
8 #include "apps/launcher.h" 8 #include "apps/launcher.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 15 matching lines...) Expand all
26 namespace apps { 26 namespace apps {
27 27
28 AppLoadService::PostReloadAction::PostReloadAction() 28 AppLoadService::PostReloadAction::PostReloadAction()
29 : action_type(LAUNCH), 29 : action_type(LAUNCH),
30 command_line(CommandLine::NO_PROGRAM) { 30 command_line(CommandLine::NO_PROGRAM) {
31 } 31 }
32 32
33 AppLoadService::AppLoadService(Profile* profile) 33 AppLoadService::AppLoadService(Profile* profile)
34 : profile_(profile) { 34 : profile_(profile) {
35 registrar_.Add( 35 registrar_.Add(
36 this, chrome::NOTIFICATION_EXTENSION_LOADED, 36 this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
37 content::NotificationService::AllSources()); 37 content::NotificationService::AllSources());
38 registrar_.Add( 38 registrar_.Add(
39 this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 39 this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
40 content::NotificationService::AllSources()); 40 content::NotificationService::AllSources());
41 } 41 }
42 42
43 AppLoadService::~AppLoadService() {} 43 AppLoadService::~AppLoadService() {}
44 44
45 void AppLoadService::RestartApplication(const std::string& extension_id) { 45 void AppLoadService::RestartApplication(const std::string& extension_id) {
46 post_reload_actions_[extension_id].action_type = RESTART; 46 post_reload_actions_[extension_id].action_type = RESTART;
(...skipping 24 matching lines...) Expand all
71 71
72 // static 72 // static
73 AppLoadService* AppLoadService::Get(Profile* profile) { 73 AppLoadService* AppLoadService::Get(Profile* profile) {
74 return apps::AppLoadServiceFactory::GetForProfile(profile); 74 return apps::AppLoadServiceFactory::GetForProfile(profile);
75 } 75 }
76 76
77 void AppLoadService::Observe(int type, 77 void AppLoadService::Observe(int type,
78 const content::NotificationSource& source, 78 const content::NotificationSource& source,
79 const content::NotificationDetails& details) { 79 const content::NotificationDetails& details) {
80 switch (type) { 80 switch (type) {
81 case chrome::NOTIFICATION_EXTENSION_LOADED: { 81 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: {
82 Extension* extension = content::Details<Extension>(details).ptr(); 82 extensions::ExtensionHost* host =
83 content::Details<extensions::ExtensionHost>(details).ptr();
84 const Extension* extension = host->extension();
85 // It is possible for an extension to be unloaded before it stops loading.
86 if (!extension)
87 break;
83 std::map<std::string, PostReloadAction>::iterator it = 88 std::map<std::string, PostReloadAction>::iterator it =
84 post_reload_actions_.find(extension->id()); 89 post_reload_actions_.find(extension->id());
85 if (it == post_reload_actions_.end()) 90 if (it == post_reload_actions_.end())
86 break; 91 break;
87 92
88 switch (it->second.action_type) { 93 switch (it->second.action_type) {
89 case LAUNCH: 94 case LAUNCH:
90 LaunchPlatformApp(profile_, extension); 95 LaunchPlatformApp(profile_, extension);
91 break; 96 break;
92 case RESTART: 97 case RESTART:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 Extension::DISABLE_RELOAD) != 0; 140 Extension::DISABLE_RELOAD) != 0;
136 } 141 }
137 return false; 142 return false;
138 } 143 }
139 144
140 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { 145 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) {
141 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); 146 return post_reload_actions_.find(extension_id) != post_reload_actions_.end();
142 } 147 }
143 148
144 } // namespace apps 149 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | trunk/src/apps/launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698