| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/quirks/quirks_manager.h" | 5 #include "components/quirks/quirks_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 for (const std::unique_ptr<QuirksClient>& client : clients_) | 131 for (const std::unique_ptr<QuirksClient>& client : clients_) |
| 132 client->StartDownload(); | 132 client->StartDownload(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void QuirksManager::RequestIccProfilePath( | 135 void QuirksManager::RequestIccProfilePath( |
| 136 int64_t product_id, | 136 int64_t product_id, |
| 137 const RequestFinishedCallback& on_request_finished) { | 137 const RequestFinishedCallback& on_request_finished) { |
| 138 DCHECK(thread_checker_.CalledOnValidThread()); | 138 DCHECK(thread_checker_.CalledOnValidThread()); |
| 139 | 139 |
| 140 if (!product_id) { |
| 141 VLOG(1) << "Could not determine display information (product id = 0)"; |
| 142 on_request_finished.Run(base::FilePath(), false); |
| 143 return; |
| 144 } |
| 145 |
| 140 std::string name = IdToFileName(product_id); | 146 std::string name = IdToFileName(product_id); |
| 141 base::PostTaskAndReplyWithResult( | 147 base::PostTaskAndReplyWithResult( |
| 142 blocking_pool_.get(), FROM_HERE, | 148 blocking_pool_.get(), FROM_HERE, |
| 143 base::Bind(&CheckForIccFile, | 149 base::Bind(&CheckForIccFile, |
| 144 delegate_->GetBuiltInDisplayProfileDirectory().Append(name), | 150 delegate_->GetBuiltInDisplayProfileDirectory().Append(name), |
| 145 delegate_->GetDownloadDisplayProfileDirectory().Append(name), | 151 delegate_->GetDownloadDisplayProfileDirectory().Append(name), |
| 146 QuirksEnabled()), | 152 QuirksEnabled()), |
| 147 base::Bind(&QuirksManager::OnIccFilePathRequestCompleted, | 153 base::Bind(&QuirksManager::OnIccFilePathRequestCompleted, |
| 148 weak_ptr_factory_.GetWeakPtr(), product_id, | 154 weak_ptr_factory_.GetWeakPtr(), product_id, |
| 149 on_request_finished)); | 155 on_request_finished)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 224 } |
| 219 | 225 |
| 220 void QuirksManager::SetLastServerCheck(int64_t product_id, | 226 void QuirksManager::SetLastServerCheck(int64_t product_id, |
| 221 const base::Time& last_check) { | 227 const base::Time& last_check) { |
| 222 DCHECK(thread_checker_.CalledOnValidThread()); | 228 DCHECK(thread_checker_.CalledOnValidThread()); |
| 223 DictionaryPrefUpdate dict(local_state_, prefs::kQuirksClientLastServerCheck); | 229 DictionaryPrefUpdate dict(local_state_, prefs::kQuirksClientLastServerCheck); |
| 224 dict->SetDouble(IdToHexString(product_id), last_check.ToDoubleT()); | 230 dict->SetDouble(IdToHexString(product_id), last_check.ToDoubleT()); |
| 225 } | 231 } |
| 226 | 232 |
| 227 } // namespace quirks | 233 } // namespace quirks |
| OLD | NEW |