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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 | 371 |
372 return (referrer_valid && download_valid); | 372 return (referrer_valid && download_valid); |
373 } | 373 } |
374 | 374 |
375 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { | 375 bool ExtensionService::IsDownloadFromMiniGallery(const GURL& download_url) { |
376 return StartsWithASCII(download_url.spec(), | 376 return StartsWithASCII(download_url.spec(), |
377 extension_urls::kMiniGalleryDownloadPrefix, | 377 extension_urls::kMiniGalleryDownloadPrefix, |
378 false); // case_sensitive | 378 false); // case_sensitive |
379 } | 379 } |
380 | 380 |
381 bool ExtensionService::IsInstalledApp(const GURL& url) { | 381 const Extension* ExtensionService::GetInstalledApp(const GURL& url) { |
382 // Check for hosted app. | 382 // Check for hosted app. |
383 if (GetExtensionByWebExtent(url) != NULL) | 383 const Extension* app = GetExtensionByWebExtent(url); |
384 return true; | 384 if (app != NULL) |
Matt Perry
2011/01/26 20:09:23
nit: chrome style is to drop the "!= NULL"
Charlie Reis
2011/03/01 21:33:11
Done.
| |
385 return app; | |
385 | 386 |
386 // Check for packaged app. | 387 // Check for packaged app. |
387 const Extension* extension = GetExtensionByURL(url); | 388 app = GetExtensionByURL(url); |
388 return extension != NULL && extension->is_app(); | 389 if (app != NULL && app->is_app()) |
390 return app; | |
391 | |
392 return NULL; | |
393 } | |
394 | |
395 bool ExtensionService::IsInstalledApp(const GURL& url) { | |
396 return GetInstalledApp(url) != NULL; | |
389 } | 397 } |
390 | 398 |
391 // static | 399 // static |
392 bool ExtensionService::UninstallExtensionHelper( | 400 bool ExtensionService::UninstallExtensionHelper( |
393 ExtensionService* extensions_service, | 401 ExtensionService* extensions_service, |
394 const std::string& extension_id) { | 402 const std::string& extension_id) { |
395 DCHECK(extensions_service); | 403 DCHECK(extensions_service); |
396 | 404 |
397 // We can't call UninstallExtension with an invalid extension ID, so check it | 405 // We can't call UninstallExtension with an invalid extension ID, so check it |
398 // first. | 406 // first. |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1978 } | 1986 } |
1979 | 1987 |
1980 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 1988 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
1981 bool value) { | 1989 bool value) { |
1982 extension_runtime_data_[extension->id()].being_upgraded = value; | 1990 extension_runtime_data_[extension->id()].being_upgraded = value; |
1983 } | 1991 } |
1984 | 1992 |
1985 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 1993 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
1986 return &extension_runtime_data_[extension->id()].property_bag; | 1994 return &extension_runtime_data_[extension->id()].property_bag; |
1987 } | 1995 } |
OLD | NEW |