OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return false; | 67 return false; |
68 if (!installer_traits_->OnCustomInstall(manifest, install_path)) | 68 if (!installer_traits_->OnCustomInstall(manifest, install_path)) |
69 return false; | 69 return false; |
70 if (!installer_traits_->VerifyInstallation(install_path)) | 70 if (!installer_traits_->VerifyInstallation(install_path)) |
71 return false; | 71 return false; |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest, | 75 bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest, |
76 const base::FilePath& unpack_path) { | 76 const base::FilePath& unpack_path) { |
77 DCHECK(task_runner_); | |
78 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | |
79 std::string manifest_version; | 77 std::string manifest_version; |
80 manifest.GetStringASCII("version", &manifest_version); | 78 manifest.GetStringASCII("version", &manifest_version); |
81 base::Version version(manifest_version.c_str()); | 79 base::Version version(manifest_version.c_str()); |
82 if (!version.IsValid()) | 80 if (!version.IsValid()) |
83 return false; | 81 return false; |
84 if (current_version_.CompareTo(version) > 0) | 82 if (current_version_.CompareTo(version) > 0) |
85 return false; | 83 return false; |
86 base::FilePath install_path = | 84 base::FilePath install_path = |
87 installer_traits_->GetBaseDirectory().AppendASCII(version.GetString()); | 85 installer_traits_->GetBaseDirectory().AppendASCII(version.GetString()); |
88 if (base::PathExists(install_path)) { | 86 if (base::PathExists(install_path)) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 219 |
222 if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) { | 220 if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) { |
223 scoped_ptr<base::DictionaryValue> manifest_copy( | 221 scoped_ptr<base::DictionaryValue> manifest_copy( |
224 current_manifest_->DeepCopy()); | 222 current_manifest_->DeepCopy()); |
225 installer_traits_->ComponentReady( | 223 installer_traits_->ComponentReady( |
226 current_version_, GetInstallDirectory(), manifest_copy.Pass()); | 224 current_version_, GetInstallDirectory(), manifest_copy.Pass()); |
227 } | 225 } |
228 } | 226 } |
229 | 227 |
230 } // namespace component_updater | 228 } // namespace component_updater |
OLD | NEW |