| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // the map, someone failed to update |unloaded_extension_paths_|. | 399 // the map, someone failed to update |unloaded_extension_paths_|. |
| 400 CHECK(!path.empty()); | 400 CHECK(!path.empty()); |
| 401 LoadExtension(path); | 401 LoadExtension(path); |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 void ExtensionsService::UninstallExtension(const std::string& extension_id, | 405 void ExtensionsService::UninstallExtension(const std::string& extension_id, |
| 406 bool external_uninstall) { | 406 bool external_uninstall) { |
| 407 Extension* extension = GetExtensionByIdInternal(extension_id, true, true); | 407 Extension* extension = GetExtensionByIdInternal(extension_id, true, true); |
| 408 | 408 |
| 409 // Callers should not send us nonexistant extensions. | 409 // Callers should not send us nonexistent extensions. |
| 410 DCHECK(extension); | 410 DCHECK(extension); |
| 411 | 411 |
| 412 // Notify interested parties that we're uninstalling this extension. | 412 // Notify interested parties that we're uninstalling this extension. |
| 413 NotificationService::current()->Notify( | 413 NotificationService::current()->Notify( |
| 414 NotificationType::EXTENSION_UNINSTALLED, | 414 NotificationType::EXTENSION_UNINSTALLED, |
| 415 Source<Profile>(profile_), | 415 Source<Profile>(profile_), |
| 416 Details<Extension>(extension)); | 416 Details<Extension>(extension)); |
| 417 | 417 |
| 418 // Get hold of information we need after unloading, since the extension | 418 // Get hold of information we need after unloading, since the extension |
| 419 // pointer will be invalid then. | 419 // pointer will be invalid then. |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 NewRunnableMethod( | 894 NewRunnableMethod( |
| 895 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates, | 895 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates, |
| 896 killed_extensions, scoped_refptr<ExtensionsService>(this))); | 896 killed_extensions, scoped_refptr<ExtensionsService>(this))); |
| 897 } | 897 } |
| 898 | 898 |
| 899 void ExtensionsService::UnloadExtension(const std::string& extension_id) { | 899 void ExtensionsService::UnloadExtension(const std::string& extension_id) { |
| 900 // Make sure the extension gets deleted after we return from this function. | 900 // Make sure the extension gets deleted after we return from this function. |
| 901 scoped_ptr<Extension> extension( | 901 scoped_ptr<Extension> extension( |
| 902 GetExtensionByIdInternal(extension_id, true, true)); | 902 GetExtensionByIdInternal(extension_id, true, true)); |
| 903 | 903 |
| 904 // Callers should not send us nonexistant extensions. | 904 // Callers should not send us nonexistent extensions. |
| 905 CHECK(extension.get()); | 905 CHECK(extension.get()); |
| 906 | 906 |
| 907 // Keep information about the extension so that we can reload it later | 907 // Keep information about the extension so that we can reload it later |
| 908 // even if it's not permanently installed. | 908 // even if it's not permanently installed. |
| 909 unloaded_extension_paths_[extension->id()] = extension->path(); | 909 unloaded_extension_paths_[extension->id()] = extension->path(); |
| 910 | 910 |
| 911 // Clean up if the extension is meant to be enabled after a reload. | 911 // Clean up if the extension is meant to be enabled after a reload. |
| 912 disabled_extension_paths_.erase(extension->id()); | 912 disabled_extension_paths_.erase(extension->id()); |
| 913 | 913 |
| 914 ExtensionDOMUI::UnregisterChromeURLOverrides(profile_, | 914 ExtensionDOMUI::UnregisterChromeURLOverrides(profile_, |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 // Finish installing on UI thread. | 1590 // Finish installing on UI thread. |
| 1591 ChromeThread::PostTask( | 1591 ChromeThread::PostTask( |
| 1592 ChromeThread::UI, FROM_HERE, | 1592 ChromeThread::UI, FROM_HERE, |
| 1593 NewRunnableMethod( | 1593 NewRunnableMethod( |
| 1594 frontend_, | 1594 frontend_, |
| 1595 &ExtensionsService::ContinueLoadAllExtensions, | 1595 &ExtensionsService::ContinueLoadAllExtensions, |
| 1596 extensions_to_reload, | 1596 extensions_to_reload, |
| 1597 start_time, | 1597 start_time, |
| 1598 true)); | 1598 true)); |
| 1599 } | 1599 } |
| OLD | NEW |