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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 return (referrer_valid && download_valid); | 506 return (referrer_valid && download_valid); |
507 } | 507 } |
508 | 508 |
509 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { | 509 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { |
510 return StartsWithASCII(download_url.spec(), | 510 return StartsWithASCII(download_url.spec(), |
511 extension_urls::kMiniGalleryDownloadPrefix, | 511 extension_urls::kMiniGalleryDownloadPrefix, |
512 false); // case_sensitive | 512 false); // case_sensitive |
513 } | 513 } |
514 | 514 |
515 bool ExtensionService::IsInstalledApp(const GURL& url) { | 515 const Extension* ExtensionService::GetInstalledApp(const GURL& url) { |
516 // Check for hosted app. | 516 // Check for hosted app. |
517 if (GetExtensionByWebExtent(url) != NULL) | 517 const Extension* app = GetExtensionByWebExtent(url); |
518 return true; | 518 if (app != NULL) |
| 519 return app; |
519 | 520 |
520 // Check for packaged app. | 521 // Check for packaged app. |
521 const Extension* extension = GetExtensionByURL(url); | 522 app = GetExtensionByURL(url); |
522 return extension != NULL && extension->is_app(); | 523 if (app != NULL && app->is_app()) |
| 524 return app; |
| 525 |
| 526 return NULL; |
| 527 } |
| 528 |
| 529 bool ExtensionService::IsInstalledApp(const GURL& url) { |
| 530 return GetInstalledApp(url) != NULL; |
523 } | 531 } |
524 | 532 |
525 // static | 533 // static |
526 bool ExtensionService::UninstallExtensionHelper( | 534 bool ExtensionService::UninstallExtensionHelper( |
527 ExtensionService* extensions_service, | 535 ExtensionService* extensions_service, |
528 const std::string& extension_id) { | 536 const std::string& extension_id) { |
529 DCHECK(extensions_service); | 537 DCHECK(extensions_service); |
530 | 538 |
531 // We can't call UninstallExtension with an invalid extension ID, so check it | 539 // We can't call UninstallExtension with an invalid extension ID, so check it |
532 // first. | 540 // first. |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 } | 2074 } |
2067 | 2075 |
2068 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 2076 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
2069 bool value) { | 2077 bool value) { |
2070 extension_runtime_data_[extension->id()].being_upgraded = value; | 2078 extension_runtime_data_[extension->id()].being_upgraded = value; |
2071 } | 2079 } |
2072 | 2080 |
2073 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 2081 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
2074 return &extension_runtime_data_[extension->id()].property_bag; | 2082 return &extension_runtime_data_[extension->id()].property_bag; |
2075 } | 2083 } |
OLD | NEW |