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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 ExternalExtensionProviderInterface* test_provider) { | 304 ExternalExtensionProviderInterface* test_provider) { |
305 DCHECK(test_provider); | 305 DCHECK(test_provider); |
306 external_extension_providers_.push_back( | 306 external_extension_providers_.push_back( |
307 linked_ptr<ExternalExtensionProviderInterface>(test_provider)); | 307 linked_ptr<ExternalExtensionProviderInterface>(test_provider)); |
308 } | 308 } |
309 | 309 |
310 void ExtensionService::OnExternalExtensionUpdateUrlFound( | 310 void ExtensionService::OnExternalExtensionUpdateUrlFound( |
311 const std::string& id, | 311 const std::string& id, |
312 const GURL& update_url, | 312 const GURL& update_url, |
313 Extension::Location location) { | 313 Extension::Location location) { |
314 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 314 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 315 CHECK(Extension::IdIsValid(id)); |
315 | 316 |
316 if (GetExtensionById(id, true)) { | 317 if (GetExtensionById(id, true)) { |
317 // Already installed. Do not change the update URL that the extension set. | 318 // Already installed. Do not change the update URL that the extension set. |
318 return; | 319 return; |
319 } | 320 } |
320 AddPendingExtensionFromExternalUpdateUrl(id, update_url, location); | 321 AddPendingExtensionFromExternalUpdateUrl(id, update_url, location); |
321 external_extension_added_ |= true; | 322 external_extension_added_ |= true; |
322 } | 323 } |
323 | 324 |
324 bool ExtensionService::IsDownloadFromGallery(const GURL& download_url, | 325 bool ExtensionService::IsDownloadFromGallery(const GURL& download_url, |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 const SkBitmap& ExtensionService::GetOmniboxPopupIcon( | 1817 const SkBitmap& ExtensionService::GetOmniboxPopupIcon( |
1817 const std::string& extension_id) { | 1818 const std::string& extension_id) { |
1818 return omnibox_popup_icon_manager_.GetIcon(extension_id); | 1819 return omnibox_popup_icon_manager_.GetIcon(extension_id); |
1819 } | 1820 } |
1820 | 1821 |
1821 void ExtensionService::OnExternalExtensionFileFound( | 1822 void ExtensionService::OnExternalExtensionFileFound( |
1822 const std::string& id, | 1823 const std::string& id, |
1823 const Version* version, | 1824 const Version* version, |
1824 const FilePath& path, | 1825 const FilePath& path, |
1825 Extension::Location location) { | 1826 Extension::Location location) { |
1826 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1827 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1828 CHECK(Extension::IdIsValid(id)); |
1827 if (extension_prefs_->IsExtensionKilled(id)) | 1829 if (extension_prefs_->IsExtensionKilled(id)) |
1828 return; | 1830 return; |
1829 | 1831 |
1830 DCHECK(version); | 1832 DCHECK(version); |
1831 | 1833 |
1832 // Before even bothering to unpack, check and see if we already have this | 1834 // Before even bothering to unpack, check and see if we already have this |
1833 // version. This is important because these extensions are going to get | 1835 // version. This is important because these extensions are going to get |
1834 // installed on every startup. | 1836 // installed on every startup. |
1835 const Extension* existing = GetExtensionById(id, true); | 1837 const Extension* existing = GetExtensionById(id, true); |
1836 if (existing) { | 1838 if (existing) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 } | 1975 } |
1974 | 1976 |
1975 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 1977 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
1976 bool value) { | 1978 bool value) { |
1977 extension_runtime_data_[extension->id()].being_upgraded = value; | 1979 extension_runtime_data_[extension->id()].being_upgraded = value; |
1978 } | 1980 } |
1979 | 1981 |
1980 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 1982 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
1981 return &extension_runtime_data_[extension->id()].property_bag; | 1983 return &extension_runtime_data_[extension->id()].property_bag; |
1982 } | 1984 } |
OLD | NEW |