| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 location, | 260 location, |
| 261 creation_flags, | 261 creation_flags, |
| 262 mark_acknowledged)) { | 262 mark_acknowledged)) { |
| 263 return false; | 263 return false; |
| 264 } | 264 } |
| 265 | 265 |
| 266 update_once_all_providers_are_ready_ = true; | 266 update_once_all_providers_are_ready_ = true; |
| 267 return true; | 267 return true; |
| 268 } | 268 } |
| 269 | 269 |
| 270 const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { | |
| 271 const Extension* extension = | |
| 272 registry_->enabled_extensions().GetExtensionOrAppByURL(url); | |
| 273 return (extension && extension->is_app()) ? extension : NULL; | |
| 274 } | |
| 275 | |
| 276 bool ExtensionService::IsInstalledApp(const GURL& url) const { | |
| 277 return !!GetInstalledApp(url); | |
| 278 } | |
| 279 | |
| 280 // static | 270 // static |
| 281 // This function is used to implement the command-line switch | 271 // This function is used to implement the command-line switch |
| 282 // --uninstall-extension, and to uninstall an extension via sync. The LOG | 272 // --uninstall-extension, and to uninstall an extension via sync. The LOG |
| 283 // statements within this function are used to inform the user if the uninstall | 273 // statements within this function are used to inform the user if the uninstall |
| 284 // cannot be done. | 274 // cannot be done. |
| 285 bool ExtensionService::UninstallExtensionHelper( | 275 bool ExtensionService::UninstallExtensionHelper( |
| 286 ExtensionService* extensions_service, | 276 ExtensionService* extensions_service, |
| 287 const std::string& extension_id) { | 277 const std::string& extension_id) { |
| 288 // We can't call UninstallExtension with an invalid extension ID. | 278 // We can't call UninstallExtension with an invalid extension ID. |
| 289 if (!extensions_service->GetInstalledExtension(extension_id)) { | 279 if (!extensions_service->GetInstalledExtension(extension_id)) { |
| (...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 void ExtensionService::UnloadAllExtensionsInternal() { | 2472 void ExtensionService::UnloadAllExtensionsInternal() { |
| 2483 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2473 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
| 2484 | 2474 |
| 2485 registry_->ClearAll(); | 2475 registry_->ClearAll(); |
| 2486 system_->runtime_data()->ClearAll(); | 2476 system_->runtime_data()->ClearAll(); |
| 2487 | 2477 |
| 2488 // TODO(erikkay) should there be a notification for this? We can't use | 2478 // TODO(erikkay) should there be a notification for this? We can't use |
| 2489 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2479 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
| 2490 // or uninstalled. | 2480 // or uninstalled. |
| 2491 } | 2481 } |
| OLD | NEW |