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

Side by Side Diff: apps/app_load_service.cc

Issue 93593003: Make clicking the restart bubble for crashed apps work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
« no previous file with comments | « apps/app_load_service.h ('k') | no next file » | 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 25 matching lines...) Expand all
36 this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 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;
47 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> 46 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->
48 extension_service(); 47 extension_service();
49 DCHECK(service); 48 DCHECK(service);
50 service->ReloadExtension(extension_id); 49 service->ReloadExtension(extension_id);
50 RestartPlatformApp(profile_, service->GetExtensionById(extension_id, false));
tapted 2013/12/12 06:54:52 GetExtensionsById likes to return NULL a lot.. I
koz (OOO until 15th September) 2013/12/13 03:33:56 Ah, good spot! I've tried a different approach in
51 } 51 }
52 52
53 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, 53 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
54 const CommandLine& command_line, 54 const CommandLine& command_line,
55 const base::FilePath& current_dir) { 55 const base::FilePath& current_dir) {
56 ExtensionService* extension_service = 56 ExtensionService* extension_service =
57 ExtensionSystem::GetForBrowserContext(profile_)->extension_service(); 57 ExtensionSystem::GetForBrowserContext(profile_)->extension_service();
58 std::string extension_id; 58 std::string extension_id;
59 if (!extensions::UnpackedInstaller::Create(extension_service)-> 59 if (!extensions::UnpackedInstaller::Create(extension_service)->
60 LoadFromCommandLine(base::FilePath(extension_path), &extension_id)) { 60 LoadFromCommandLine(base::FilePath(extension_path), &extension_id)) {
(...skipping 26 matching lines...) Expand all
87 break; 87 break;
88 std::map<std::string, PostReloadAction>::iterator it = 88 std::map<std::string, PostReloadAction>::iterator it =
89 post_reload_actions_.find(extension->id()); 89 post_reload_actions_.find(extension->id());
90 if (it == post_reload_actions_.end()) 90 if (it == post_reload_actions_.end())
91 break; 91 break;
92 92
93 switch (it->second.action_type) { 93 switch (it->second.action_type) {
94 case LAUNCH: 94 case LAUNCH:
95 LaunchPlatformApp(profile_, extension); 95 LaunchPlatformApp(profile_, extension);
96 break; 96 break;
97 case RESTART:
98 RestartPlatformApp(profile_, extension);
99 break;
100 case LAUNCH_WITH_COMMAND_LINE: 97 case LAUNCH_WITH_COMMAND_LINE:
101 LaunchPlatformAppWithCommandLine( 98 LaunchPlatformAppWithCommandLine(
102 profile_, extension, &it->second.command_line, 99 profile_, extension, &it->second.command_line,
103 it->second.current_dir); 100 it->second.current_dir);
104 break; 101 break;
105 default: 102 default:
106 NOTREACHED(); 103 NOTREACHED();
107 } 104 }
108 105
109 post_reload_actions_.erase(it); 106 post_reload_actions_.erase(it);
(...skipping 30 matching lines...) Expand all
140 Extension::DISABLE_RELOAD) != 0; 137 Extension::DISABLE_RELOAD) != 0;
141 } 138 }
142 return false; 139 return false;
143 } 140 }
144 141
145 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { 142 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) {
146 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); 143 return post_reload_actions_.find(extension_id) != post_reload_actions_.end();
147 } 144 }
148 145
149 } // namespace apps 146 } // namespace apps
OLDNEW
« no previous file with comments | « apps/app_load_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698