OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/message_loop/message_loop_proxy.h" | 18 #include "base/message_loop/message_loop_proxy.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/sequenced_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
24 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/component_updater/component_patcher_operation.h" |
26 #include "chrome/browser/component_updater/component_unpacker.h" | 27 #include "chrome/browser/component_updater/component_unpacker.h" |
27 #include "chrome/browser/component_updater/component_updater_configurator.h" | 28 #include "chrome/browser/component_updater/component_updater_configurator.h" |
28 #include "chrome/browser/component_updater/component_updater_ping_manager.h" | 29 #include "chrome/browser/component_updater/component_updater_ping_manager.h" |
29 #include "chrome/browser/component_updater/component_updater_utils.h" | 30 #include "chrome/browser/component_updater/component_updater_utils.h" |
30 #include "chrome/browser/component_updater/crx_downloader.h" | 31 #include "chrome/browser/component_updater/crx_downloader.h" |
31 #include "chrome/browser/component_updater/crx_update_item.h" | 32 #include "chrome/browser/component_updater/crx_update_item.h" |
32 #include "chrome/browser/component_updater/update_checker.h" | 33 #include "chrome/browser/component_updater/update_checker.h" |
33 #include "chrome/browser/component_updater/update_response.h" | 34 #include "chrome/browser/component_updater/update_response.h" |
34 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/resource_controller.h" | 36 #include "content/public/browser/resource_controller.h" |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 // calling the component specific installer. All that is handled by the | 868 // calling the component specific installer. All that is handled by the |
868 // |unpacker_|. If there is an error this function is in charge of deleting | 869 // |unpacker_|. If there is an error this function is in charge of deleting |
869 // the files created. | 870 // the files created. |
870 void CrxUpdateService::Install(scoped_ptr<CRXContext> context, | 871 void CrxUpdateService::Install(scoped_ptr<CRXContext> context, |
871 const base::FilePath& crx_path) { | 872 const base::FilePath& crx_path) { |
872 // This function owns the file at |crx_path| and the |context| object. | 873 // This function owns the file at |crx_path| and the |context| object. |
873 unpacker_ = new ComponentUnpacker(context->pk_hash, | 874 unpacker_ = new ComponentUnpacker(context->pk_hash, |
874 crx_path, | 875 crx_path, |
875 context->fingerprint, | 876 context->fingerprint, |
876 context->installer, | 877 context->installer, |
877 config_->InProcess(), | 878 config_->CreateOutOfProcessPatcher(), |
878 blocking_task_runner_); | 879 blocking_task_runner_); |
879 unpacker_->Unpack(base::Bind(&CrxUpdateService::EndUnpacking, | 880 unpacker_->Unpack(base::Bind(&CrxUpdateService::EndUnpacking, |
880 base::Unretained(this), | 881 base::Unretained(this), |
881 context->id, | 882 context->id, |
882 crx_path)); | 883 crx_path)); |
883 } | 884 } |
884 | 885 |
885 void CrxUpdateService::EndUnpacking(const std::string& component_id, | 886 void CrxUpdateService::EndUnpacking(const std::string& component_id, |
886 const base::FilePath& crx_path, | 887 const base::FilePath& crx_path, |
887 ComponentUnpacker::Error error, | 888 ComponentUnpacker::Error error, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 } | 1100 } |
1100 | 1101 |
1101 // The component update factory. Using the component updater as a singleton | 1102 // The component update factory. Using the component updater as a singleton |
1102 // is the job of the browser process. | 1103 // is the job of the browser process. |
1103 ComponentUpdateService* ComponentUpdateServiceFactory(Configurator* config) { | 1104 ComponentUpdateService* ComponentUpdateServiceFactory(Configurator* config) { |
1104 DCHECK(config); | 1105 DCHECK(config); |
1105 return new CrxUpdateService(config); | 1106 return new CrxUpdateService(config); |
1106 } | 1107 } |
1107 | 1108 |
1108 } // namespace component_updater | 1109 } // namespace component_updater |
OLD | NEW |