Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/json/json_value_serializer.h" | |
|
Yoyo Zhou
2012/02/10 00:45:28
This looks unused.
Aaron Boodman
2012/02/10 20:35:16
don't forget to remove this
rkc
2012/02/10 20:51:17
Done.
| |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 20 #include "base/string16.h" | 21 #include "base/string16.h" |
| 21 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 22 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 23 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
| 24 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 orphaned_dev_tools_[extension_id] = devtools_cookie; | 710 orphaned_dev_tools_[extension_id] = devtools_cookie; |
| 710 } | 711 } |
| 711 | 712 |
| 712 path = current_extension->path(); | 713 path = current_extension->path(); |
| 713 DisableExtension(extension_id); | 714 DisableExtension(extension_id); |
| 714 disabled_extension_paths_[extension_id] = path; | 715 disabled_extension_paths_[extension_id] = path; |
| 715 } else { | 716 } else { |
| 716 path = unloaded_extension_paths_[extension_id]; | 717 path = unloaded_extension_paths_[extension_id]; |
| 717 } | 718 } |
| 718 | 719 |
| 720 // If we're reloading a component extension, use the component extension | |
| 721 // loader's reloader. | |
| 722 if (component_loader_->Exists(extension_id)) { | |
| 723 component_loader_->Reload(extension_id); | |
| 724 return; | |
| 725 } | |
| 726 | |
| 719 // Check the installed extensions to see if what we're reloading was already | 727 // Check the installed extensions to see if what we're reloading was already |
| 720 // installed. | 728 // installed. |
| 721 scoped_ptr<ExtensionInfo> installed_extension( | 729 scoped_ptr<ExtensionInfo> installed_extension( |
| 722 extension_prefs_->GetInstalledExtensionInfo(extension_id)); | 730 extension_prefs_->GetInstalledExtensionInfo(extension_id)); |
| 723 if (installed_extension.get() && | 731 if (installed_extension.get() && |
| 724 installed_extension->extension_manifest.get()) { | 732 installed_extension->extension_manifest.get()) { |
| 725 extensions::InstalledLoader(this).Load(*installed_extension, false); | 733 extensions::InstalledLoader(this).Load(*installed_extension, false); |
| 726 } else { | 734 } else { |
| 727 // Otherwise, the extension is unpacked (location LOAD). | 735 // Otherwise, the extension is unpacked (location LOAD). |
| 728 // We should always be able to remember the extension's path. If it's not in | 736 // We should always be able to remember the extension's path. If it's not in |
| (...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2692 // | 2700 // |
| 2693 // To coexist with certain unit tests that don't have an IO thread message | 2701 // To coexist with certain unit tests that don't have an IO thread message |
| 2694 // loop available at ExtensionService shutdown, we lazy-initialize this | 2702 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2695 // object so that those cases neither create nor destroy a SocketController. | 2703 // object so that those cases neither create nor destroy a SocketController. |
| 2696 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2704 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2697 if (!socket_controller_) { | 2705 if (!socket_controller_) { |
| 2698 socket_controller_ = new extensions::SocketController(); | 2706 socket_controller_ = new extensions::SocketController(); |
| 2699 } | 2707 } |
| 2700 return socket_controller_; | 2708 return socket_controller_; |
| 2701 } | 2709 } |
| OLD | NEW |