OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 ExtensionDOMUI::RegisterChromeURLOverrides(profile_, | 270 ExtensionDOMUI::RegisterChromeURLOverrides(profile_, |
271 extension->GetChromeURLOverrides()); | 271 extension->GetChromeURLOverrides()); |
272 | 272 |
273 NotifyExtensionLoaded(extension); | 273 NotifyExtensionLoaded(extension); |
274 UpdateActiveExtensionsInCrashReporter(); | 274 UpdateActiveExtensionsInCrashReporter(); |
275 } | 275 } |
276 | 276 |
277 void ExtensionsService::DisableExtension(const std::string& extension_id) { | 277 void ExtensionsService::DisableExtension(const std::string& extension_id) { |
278 Extension* extension = GetExtensionByIdInternal(extension_id, true, false); | 278 Extension* extension = GetExtensionByIdInternal(extension_id, true, false); |
279 if (!extension) { | 279 // The extension may have been disabled already. |
280 NOTREACHED() << "Trying to disable an extension that isn't enabled."; | 280 if (!extension) |
281 return; | 281 return; |
282 } | |
283 | 282 |
284 // Remember that we disabled it, unless it's temporary. | 283 // Remember that we disabled it, unless it's temporary. |
285 if (extension->location() != Extension::LOAD) | 284 if (extension->location() != Extension::LOAD) |
286 extension_prefs_->SetExtensionState(extension, Extension::DISABLED); | 285 extension_prefs_->SetExtensionState(extension, Extension::DISABLED); |
287 | 286 |
288 // Move it over to the disabled list. | 287 // Move it over to the disabled list. |
289 disabled_extensions_.push_back(extension); | 288 disabled_extensions_.push_back(extension); |
290 ExtensionList::iterator iter = std::find(extensions_.begin(), | 289 ExtensionList::iterator iter = std::find(extensions_.begin(), |
291 extensions_.end(), | 290 extensions_.end(), |
292 extension); | 291 extension); |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 | 1003 |
1005 void ExtensionsServiceBackend::OnExternalExtensionFound( | 1004 void ExtensionsServiceBackend::OnExternalExtensionFound( |
1006 const std::string& id, const Version* version, const FilePath& path, | 1005 const std::string& id, const Version* version, const FilePath& path, |
1007 Extension::Location location) { | 1006 Extension::Location location) { |
1008 ChromeThread::PostTask( | 1007 ChromeThread::PostTask( |
1009 ChromeThread::UI, FROM_HERE, | 1008 ChromeThread::UI, FROM_HERE, |
1010 NewRunnableMethod( | 1009 NewRunnableMethod( |
1011 frontend_, &ExtensionsService::OnExternalExtensionFound, id, | 1010 frontend_, &ExtensionsService::OnExternalExtensionFound, id, |
1012 version->GetString(), path, location)); | 1011 version->GetString(), path, location)); |
1013 } | 1012 } |
OLD | NEW |