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 "chrome/browser/apps/app_load_service.h" | 5 #include "chrome/browser/apps/app_load_service.h" |
6 | 6 |
7 #include "apps/app_restore_service.h" | 7 #include "apps/app_restore_service.h" |
8 #include "apps/launcher.h" | 8 #include "apps/launcher.h" |
9 #include "chrome/browser/apps/app_load_service_factory.h" | 9 #include "chrome/browser/apps/app_load_service_factory.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 default: | 123 default: |
124 NOTREACHED(); | 124 NOTREACHED(); |
125 } | 125 } |
126 | 126 |
127 post_reload_actions_.erase(it); | 127 post_reload_actions_.erase(it); |
128 } | 128 } |
129 | 129 |
130 void AppLoadService::OnExtensionUnloaded( | 130 void AppLoadService::OnExtensionUnloaded( |
131 content::BrowserContext* browser_context, | 131 content::BrowserContext* browser_context, |
132 const Extension* extension, | 132 const Extension* extension, |
133 extensions::UnloadedExtensionInfo::Reason reason) { | 133 extensions::UnloadedExtensionReason reason) { |
134 if (!extension->is_platform_app()) | 134 if (!extension->is_platform_app()) |
135 return; | 135 return; |
136 | 136 |
137 extensions::ExtensionPrefs* extension_prefs = | 137 extensions::ExtensionPrefs* extension_prefs = |
138 extensions::ExtensionPrefs::Get(browser_context); | 138 extensions::ExtensionPrefs::Get(browser_context); |
139 if (WasUnloadedForReload(extension->id(), reason) && | 139 if (WasUnloadedForReload(extension->id(), reason) && |
140 extension_prefs->IsActive(extension->id()) && | 140 extension_prefs->IsActive(extension->id()) && |
141 !HasPostReloadAction(extension->id())) { | 141 !HasPostReloadAction(extension->id())) { |
142 post_reload_actions_[extension->id()].action_type = LAUNCH_FOR_RELOAD; | 142 post_reload_actions_[extension->id()].action_type = LAUNCH_FOR_RELOAD; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 bool AppLoadService::WasUnloadedForReload( | 146 bool AppLoadService::WasUnloadedForReload( |
147 const extensions::ExtensionId& extension_id, | 147 const extensions::ExtensionId& extension_id, |
148 const extensions::UnloadedExtensionInfo::Reason reason) { | 148 const extensions::UnloadedExtensionReason reason) { |
149 if (reason == extensions::UnloadedExtensionInfo::REASON_DISABLE) { | 149 if (reason == extensions::UnloadedExtensionReason::REASON_DISABLE) { |
150 ExtensionPrefs* prefs = ExtensionPrefs::Get(context_); | 150 ExtensionPrefs* prefs = ExtensionPrefs::Get(context_); |
151 return (prefs->GetDisableReasons(extension_id) & | 151 return (prefs->GetDisableReasons(extension_id) & |
152 Extension::DISABLE_RELOAD) != 0; | 152 Extension::DISABLE_RELOAD) != 0; |
153 } | 153 } |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { | 157 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { |
158 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); | 158 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); |
159 } | 159 } |
160 | 160 |
161 } // namespace apps | 161 } // namespace apps |
OLD | NEW |