| OLD | NEW |
| 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/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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_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_DEPRECATED, |
| 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; |
| 47 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> | 47 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> |
| 48 extension_service(); | 48 extension_service(); |
| 49 DCHECK(service); | 49 DCHECK(service); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 profile_, extension, it->second.command_line, | 102 profile_, extension, it->second.command_line, |
| 103 it->second.current_dir); | 103 it->second.current_dir); |
| 104 break; | 104 break; |
| 105 default: | 105 default: |
| 106 NOTREACHED(); | 106 NOTREACHED(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 post_reload_actions_.erase(it); | 109 post_reload_actions_.erase(it); |
| 110 break; | 110 break; |
| 111 } | 111 } |
| 112 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 112 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 113 const extensions::UnloadedExtensionInfo* unload_info = | 113 const extensions::UnloadedExtensionInfo* unload_info = |
| 114 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); | 114 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
| 115 if (!unload_info->extension->is_platform_app()) | 115 if (!unload_info->extension->is_platform_app()) |
| 116 break; | 116 break; |
| 117 | 117 |
| 118 if (WasUnloadedForReload(*unload_info) && | 118 if (WasUnloadedForReload(*unload_info) && |
| 119 HasAppWindows(unload_info->extension->id()) && | 119 HasAppWindows(unload_info->extension->id()) && |
| 120 !HasPostReloadAction(unload_info->extension->id())) { | 120 !HasPostReloadAction(unload_info->extension->id())) { |
| 121 post_reload_actions_[unload_info->extension->id()].action_type = LAUNCH; | 121 post_reload_actions_[unload_info->extension->id()].action_type = LAUNCH; |
| 122 } | 122 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 141 Extension::DISABLE_RELOAD) != 0; | 141 Extension::DISABLE_RELOAD) != 0; |
| 142 } | 142 } |
| 143 return false; | 143 return false; |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { | 146 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { |
| 147 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); | 147 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace apps | 150 } // namespace apps |
| OLD | NEW |