| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 return (referrer_valid && download_valid); | 344 return (referrer_valid && download_valid); |
| 345 } | 345 } |
| 346 | 346 |
| 347 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { | 347 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { |
| 348 return StartsWithASCII(download_url.spec(), | 348 return StartsWithASCII(download_url.spec(), |
| 349 extension_urls::kMiniGalleryDownloadPrefix, | 349 extension_urls::kMiniGalleryDownloadPrefix, |
| 350 false); // case_sensitive | 350 false); // case_sensitive |
| 351 } | 351 } |
| 352 | 352 |
| 353 bool ExtensionService::IsInstalledApp(const GURL& url) { | 353 const Extension* ExtensionService::GetInstalledApp(const GURL& url) { |
| 354 // Check for hosted app. | 354 // Check for hosted app. |
| 355 if (GetExtensionByWebExtent(url) != NULL) | 355 const Extension* app = GetExtensionByWebExtent(url); |
| 356 return true; | 356 if (app) |
| 357 return app; |
| 357 | 358 |
| 358 // Check for packaged app. | 359 // Check for packaged app. |
| 359 const Extension* extension = GetExtensionByURL(url); | 360 app = GetExtensionByURL(url); |
| 360 return extension != NULL && extension->is_app(); | 361 if (app && app->is_app()) |
| 362 return app; |
| 363 |
| 364 return NULL; |
| 365 } |
| 366 |
| 367 bool ExtensionService::IsInstalledApp(const GURL& url) { |
| 368 return !!GetInstalledApp(url); |
| 361 } | 369 } |
| 362 | 370 |
| 363 // static | 371 // static |
| 364 bool ExtensionService::UninstallExtensionHelper( | 372 bool ExtensionService::UninstallExtensionHelper( |
| 365 ExtensionService* extensions_service, | 373 ExtensionService* extensions_service, |
| 366 const std::string& extension_id) { | 374 const std::string& extension_id) { |
| 367 | 375 |
| 368 // We can't call UninstallExtension with an invalid extension ID, so check it | 376 // We can't call UninstallExtension with an invalid extension ID, so check it |
| 369 // first. | 377 // first. |
| 370 if (extensions_service->GetExtensionById(extension_id, true) || | 378 if (extensions_service->GetExtensionById(extension_id, true) || |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 } | 1882 } |
| 1875 | 1883 |
| 1876 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 1884 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
| 1877 bool value) { | 1885 bool value) { |
| 1878 extension_runtime_data_[extension->id()].being_upgraded = value; | 1886 extension_runtime_data_[extension->id()].being_upgraded = value; |
| 1879 } | 1887 } |
| 1880 | 1888 |
| 1881 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 1889 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
| 1882 return &extension_runtime_data_[extension->id()].property_bag; | 1890 return &extension_runtime_data_[extension->id()].property_bag; |
| 1883 } | 1891 } |
| OLD | NEW |