OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 506 matching lines...) Loading... |
517 | 517 |
518 return (referrer_valid && download_valid); | 518 return (referrer_valid && download_valid); |
519 } | 519 } |
520 | 520 |
521 bool ExtensionsService::IsDownloadFromMiniGallery(const GURL& download_url) { | 521 bool ExtensionsService::IsDownloadFromMiniGallery(const GURL& download_url) { |
522 return StartsWithASCII(download_url.spec(), | 522 return StartsWithASCII(download_url.spec(), |
523 extension_urls::kMiniGalleryDownloadPrefix, | 523 extension_urls::kMiniGalleryDownloadPrefix, |
524 false); // case_sensitive | 524 false); // case_sensitive |
525 } | 525 } |
526 | 526 |
| 527 bool ExtensionsService::IsInstalledApp(const GURL& url) { |
| 528 // Check for hosted app. |
| 529 if (GetExtensionByWebExtent(url) != NULL) |
| 530 return true; |
| 531 |
| 532 // Check for packaged app. |
| 533 const Extension* extension = GetExtensionByURL(url); |
| 534 return extension != NULL && extension->is_app(); |
| 535 } |
| 536 |
527 // static | 537 // static |
528 bool ExtensionsService::UninstallExtensionHelper( | 538 bool ExtensionsService::UninstallExtensionHelper( |
529 ExtensionsService* extensions_service, | 539 ExtensionsService* extensions_service, |
530 const std::string& extension_id) { | 540 const std::string& extension_id) { |
531 DCHECK(extensions_service); | 541 DCHECK(extensions_service); |
532 | 542 |
533 // We can't call UninstallExtension with an invalid extension ID, so check it | 543 // We can't call UninstallExtension with an invalid extension ID, so check it |
534 // first. | 544 // first. |
535 if (extensions_service->GetExtensionById(extension_id, true)) { | 545 if (extensions_service->GetExtensionById(extension_id, true)) { |
536 extensions_service->UninstallExtension(extension_id, false); | 546 extensions_service->UninstallExtension(extension_id, false); |
(...skipping 1517 matching lines...) Loading... |
2054 } | 2064 } |
2055 | 2065 |
2056 void ExtensionsService::SetBeingUpgraded(const Extension* extension, | 2066 void ExtensionsService::SetBeingUpgraded(const Extension* extension, |
2057 bool value) { | 2067 bool value) { |
2058 extension_runtime_data_[extension->id()].being_upgraded = value; | 2068 extension_runtime_data_[extension->id()].being_upgraded = value; |
2059 } | 2069 } |
2060 | 2070 |
2061 PropertyBag* ExtensionsService::GetPropertyBag(const Extension* extension) { | 2071 PropertyBag* ExtensionsService::GetPropertyBag(const Extension* extension) { |
2062 return &extension_runtime_data_[extension->id()].property_bag; | 2072 return &extension_runtime_data_[extension->id()].property_bag; |
2063 } | 2073 } |
OLD | NEW |