| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 if (current_version_.Equals(base::Version(kNullVersion))) | 113 if (current_version_.Equals(base::Version(kNullVersion))) |
| 114 return false; // No component has been installed yet. | 114 return false; // No component has been installed yet. |
| 115 | 115 |
| 116 *installed_file = installer_traits_->GetBaseDirectory() | 116 *installed_file = installer_traits_->GetBaseDirectory() |
| 117 .AppendASCII(current_version_.GetString()) | 117 .AppendASCII(current_version_.GetString()) |
| 118 .AppendASCII(file); | 118 .AppendASCII(file); |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { | 122 void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { |
| 123 DCHECK(task_runner_); | 123 DCHECK(task_runner_.get()); |
| 124 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 124 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 125 base::FilePath base_dir = installer_traits_->GetBaseDirectory(); | 125 base::FilePath base_dir = installer_traits_->GetBaseDirectory(); |
| 126 if (!base::PathExists(base_dir) && !base::CreateDirectory(base_dir)) { | 126 if (!base::PathExists(base_dir) && !base::CreateDirectory(base_dir)) { |
| 127 NOTREACHED() << "Could not create the base directory for " | 127 NOTREACHED() << "Could not create the base directory for " |
| 128 << installer_traits_->GetName() << " (" | 128 << installer_traits_->GetName() << " (" |
| 129 << base_dir.MaybeAsASCII() << ")."; | 129 << base_dir.MaybeAsASCII() << ")."; |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 base::FilePath latest_dir; | 133 base::FilePath latest_dir; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) { | 223 if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) { |
| 224 scoped_ptr<base::DictionaryValue> manifest_copy( | 224 scoped_ptr<base::DictionaryValue> manifest_copy( |
| 225 current_manifest_->DeepCopy()); | 225 current_manifest_->DeepCopy()); |
| 226 installer_traits_->ComponentReady( | 226 installer_traits_->ComponentReady( |
| 227 current_version_, GetInstallDirectory(), manifest_copy.Pass()); | 227 current_version_, GetInstallDirectory(), manifest_copy.Pass()); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace component_updater | 231 } // namespace component_updater |
| OLD | NEW |