| 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 "chrome/browser/component_updater/cld_component_installer.h" | 5 #include "chrome/browser/component_updater/cld_component_installer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 17 #include "components/component_updater/component_updater_paths.h" | 18 #include "components/component_updater/component_updater_paths.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 118 } |
| 118 | 119 |
| 119 // This log line is to help with determining which kind of provider has been | 120 // This log line is to help with determining which kind of provider has been |
| 120 // configured. See also: chrome://translate-internals | 121 // configured. See also: chrome://translate-internals |
| 121 VLOG(1) << "Registering CLD component with the component update service"; | 122 VLOG(1) << "Registering CLD component with the component update service"; |
| 122 | 123 |
| 123 scoped_ptr<ComponentInstallerTraits> traits( | 124 scoped_ptr<ComponentInstallerTraits> traits( |
| 124 new CldComponentInstallerTraits()); | 125 new CldComponentInstallerTraits()); |
| 125 // |cus| will take ownership of |installer| during installer->Register(cus). | 126 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 126 DefaultComponentInstaller* installer = | 127 DefaultComponentInstaller* installer = |
| 127 new DefaultComponentInstaller(traits.Pass()); | 128 new DefaultComponentInstaller(std::move(traits)); |
| 128 installer->Register(cus, base::Closure()); | 129 installer->Register(cus, base::Closure()); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void CldComponentInstallerTraits::SetLatestCldDataFile( | 132 void CldComponentInstallerTraits::SetLatestCldDataFile( |
| 132 const base::FilePath& path) { | 133 const base::FilePath& path) { |
| 133 VLOG(1) << "Setting CLD data file location: " << path.value(); | 134 VLOG(1) << "Setting CLD data file location: " << path.value(); |
| 134 g_latest_cld_data_file.Get() = path; | 135 g_latest_cld_data_file.Get() = path; |
| 135 translate::CldDataSource::Get()->SetCldDataFilePath(path); | 136 translate::CldDataSource::Get()->SetCldDataFilePath(path); |
| 136 } | 137 } |
| 137 | 138 |
| 138 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { | 139 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { |
| 139 return g_latest_cld_data_file.Get(); | 140 return g_latest_cld_data_file.Get(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace component_updater | 143 } // namespace component_updater |
| OLD | NEW |