| 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" |
| 11 #include "base/stl_util-inl.h" |
| 11 #include "base/string16.h" | 12 #include "base/string16.h" |
| 12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "base/version.h" | 16 #include "base/version.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_thread.h" | 18 #include "chrome/browser/chrome_thread.h" |
| 18 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
| 19 #include "chrome/browser/extensions/crx_installer.h" | 20 #include "chrome/browser/extensions/crx_installer.h" |
| 20 #include "chrome/browser/extensions/extension_accessibility_api.h" | 21 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 iter = std::find(extensions_.begin(), extensions_.end(), extension.get()); | 773 iter = std::find(extensions_.begin(), extensions_.end(), extension.get()); |
| 773 | 774 |
| 774 // Remove the extension from our list. | 775 // Remove the extension from our list. |
| 775 extensions_.erase(iter); | 776 extensions_.erase(iter); |
| 776 | 777 |
| 777 NotifyExtensionUnloaded(extension.get()); | 778 NotifyExtensionUnloaded(extension.get()); |
| 778 UpdateActiveExtensionsInCrashReporter(); | 779 UpdateActiveExtensionsInCrashReporter(); |
| 779 } | 780 } |
| 780 | 781 |
| 781 void ExtensionsService::UnloadAllExtensions() { | 782 void ExtensionsService::UnloadAllExtensions() { |
| 782 ExtensionList::iterator iter; | 783 STLDeleteContainerPointers(extensions_.begin(), extensions_.end()); |
| 783 for (iter = extensions_.begin(); iter != extensions_.end(); ++iter) | |
| 784 delete *iter; | |
| 785 extensions_.clear(); | 784 extensions_.clear(); |
| 786 | 785 |
| 786 STLDeleteContainerPointers(disabled_extensions_.begin(), |
| 787 disabled_extensions_.end()); |
| 788 disabled_extensions_.clear(); |
| 789 |
| 787 // TODO(erikkay) should there be a notification for this? We can't use | 790 // TODO(erikkay) should there be a notification for this? We can't use |
| 788 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 791 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
| 789 // or uninstalled, and UnloadAll is just part of shutdown. | 792 // or uninstalled, and UnloadAll is just part of shutdown. |
| 790 } | 793 } |
| 791 | 794 |
| 792 void ExtensionsService::ReloadExtensions() { | 795 void ExtensionsService::ReloadExtensions() { |
| 793 UnloadAllExtensions(); | 796 UnloadAllExtensions(); |
| 794 LoadAllExtensions(); | 797 LoadAllExtensions(); |
| 795 } | 798 } |
| 796 | 799 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 // Finish installing on UI thread. | 1278 // Finish installing on UI thread. |
| 1276 ChromeThread::PostTask( | 1279 ChromeThread::PostTask( |
| 1277 ChromeThread::UI, FROM_HERE, | 1280 ChromeThread::UI, FROM_HERE, |
| 1278 NewRunnableMethod( | 1281 NewRunnableMethod( |
| 1279 frontend_, | 1282 frontend_, |
| 1280 &ExtensionsService::ContinueLoadAllExtensions, | 1283 &ExtensionsService::ContinueLoadAllExtensions, |
| 1281 extensions_to_reload, | 1284 extensions_to_reload, |
| 1282 start_time, | 1285 start_time, |
| 1283 true)); | 1286 true)); |
| 1284 } | 1287 } |
| OLD | NEW |