| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 865 |
| 866 const Extension* extension = | 866 const Extension* extension = |
| 867 GetExtensionByIdInternal(extension_id, false, true); | 867 GetExtensionByIdInternal(extension_id, false, true); |
| 868 if (!extension) { | 868 if (!extension) { |
| 869 return; | 869 return; |
| 870 } | 870 } |
| 871 | 871 |
| 872 extension_prefs_->SetExtensionState(extension, Extension::ENABLED); | 872 extension_prefs_->SetExtensionState(extension, Extension::ENABLED); |
| 873 | 873 |
| 874 // Move it over to the enabled list. | 874 // Move it over to the enabled list. |
| 875 extensions_.push_back(extension); | 875 extensions_.push_back(make_scoped_refptr(extension)); |
| 876 ExtensionList::iterator iter = std::find(disabled_extensions_.begin(), | 876 ExtensionList::iterator iter = std::find(disabled_extensions_.begin(), |
| 877 disabled_extensions_.end(), | 877 disabled_extensions_.end(), |
| 878 extension); | 878 extension); |
| 879 disabled_extensions_.erase(iter); | 879 disabled_extensions_.erase(iter); |
| 880 | 880 |
| 881 ExtensionDOMUI::RegisterChromeURLOverrides(profile_, | 881 ExtensionDOMUI::RegisterChromeURLOverrides(profile_, |
| 882 extension->GetChromeURLOverrides()); | 882 extension->GetChromeURLOverrides()); |
| 883 | 883 |
| 884 NotifyExtensionLoaded(extension); | 884 NotifyExtensionLoaded(extension); |
| 885 UpdateActiveExtensionsInCrashReporter(); | 885 UpdateActiveExtensionsInCrashReporter(); |
| 886 } | 886 } |
| 887 | 887 |
| 888 void ExtensionsService::DisableExtension(const std::string& extension_id) { | 888 void ExtensionsService::DisableExtension(const std::string& extension_id) { |
| 889 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 889 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 890 | 890 |
| 891 const Extension* extension = | 891 const Extension* extension = |
| 892 GetExtensionByIdInternal(extension_id, true, false); | 892 GetExtensionByIdInternal(extension_id, true, false); |
| 893 // The extension may have been disabled already. | 893 // The extension may have been disabled already. |
| 894 if (!extension) | 894 if (!extension) |
| 895 return; | 895 return; |
| 896 | 896 |
| 897 extension_prefs_->SetExtensionState(extension, Extension::DISABLED); | 897 extension_prefs_->SetExtensionState(extension, Extension::DISABLED); |
| 898 | 898 |
| 899 // Move it over to the disabled list. | 899 // Move it over to the disabled list. |
| 900 disabled_extensions_.push_back(extension); | 900 disabled_extensions_.push_back(make_scoped_refptr(extension)); |
| 901 ExtensionList::iterator iter = std::find(extensions_.begin(), | 901 ExtensionList::iterator iter = std::find(extensions_.begin(), |
| 902 extensions_.end(), | 902 extensions_.end(), |
| 903 extension); | 903 extension); |
| 904 extensions_.erase(iter); | 904 extensions_.erase(iter); |
| 905 | 905 |
| 906 ExtensionDOMUI::UnregisterChromeURLOverrides(profile_, | 906 ExtensionDOMUI::UnregisterChromeURLOverrides(profile_, |
| 907 extension->GetChromeURLOverrides()); | 907 extension->GetChromeURLOverrides()); |
| 908 | 908 |
| 909 NotifyExtensionUnloaded(extension); | 909 NotifyExtensionUnloaded(extension); |
| 910 UpdateActiveExtensionsInCrashReporter(); | 910 UpdateActiveExtensionsInCrashReporter(); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 ExtensionIdSet ExtensionsService::GetAppIds() const { | 1871 ExtensionIdSet ExtensionsService::GetAppIds() const { |
| 1872 ExtensionIdSet result; | 1872 ExtensionIdSet result; |
| 1873 for (ExtensionList::const_iterator it = extensions_.begin(); | 1873 for (ExtensionList::const_iterator it = extensions_.begin(); |
| 1874 it != extensions_.end(); ++it) { | 1874 it != extensions_.end(); ++it) { |
| 1875 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) | 1875 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) |
| 1876 result.insert((*it)->id()); | 1876 result.insert((*it)->id()); |
| 1877 } | 1877 } |
| 1878 | 1878 |
| 1879 return result; | 1879 return result; |
| 1880 } | 1880 } |
| OLD | NEW |