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_client.h" | 5 #include "components/quirks/quirks_client.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 //////////////////////////////////////////////////////////////////////////////// | 52 //////////////////////////////////////////////////////////////////////////////// |
53 // QuirksClient | 53 // QuirksClient |
54 | 54 |
55 QuirksClient::QuirksClient(int64_t product_id, | 55 QuirksClient::QuirksClient(int64_t product_id, |
56 const RequestFinishedCallback& on_request_finished, | 56 const RequestFinishedCallback& on_request_finished, |
57 QuirksManager* manager) | 57 QuirksManager* manager) |
58 : product_id_(product_id), | 58 : product_id_(product_id), |
59 on_request_finished_(on_request_finished), | 59 on_request_finished_(on_request_finished), |
60 manager_(manager), | 60 manager_(manager), |
61 icc_path_( | 61 icc_path_(manager->delegate()->GetDisplayProfileDirectory().Append( |
62 manager->delegate()->GetDownloadDisplayProfileDirectory().Append( | 62 IdToFileName(product_id))), |
63 IdToFileName(product_id))), | |
64 backoff_entry_(&kDefaultBackoffPolicy), | 63 backoff_entry_(&kDefaultBackoffPolicy), |
65 weak_ptr_factory_(this) {} | 64 weak_ptr_factory_(this) {} |
66 | 65 |
67 QuirksClient::~QuirksClient() {} | 66 QuirksClient::~QuirksClient() {} |
68 | 67 |
69 void QuirksClient::StartDownload() { | 68 void QuirksClient::StartDownload() { |
70 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
71 | 70 |
72 // URL of icc file on Quirks Server. | 71 // URL of icc file on Quirks Server. |
73 int major_version = atoi(version_info::GetVersionNumber().c_str()); | 72 int major_version = atoi(version_info::GetVersionNumber().c_str()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 169 |
171 if (!base::Base64Decode(data64, data)) { | 170 if (!base::Base64Decode(data64, data)) { |
172 VLOG(1) << "Failed to decode Base64 icc data"; | 171 VLOG(1) << "Failed to decode Base64 icc data"; |
173 return false; | 172 return false; |
174 } | 173 } |
175 | 174 |
176 return true; | 175 return true; |
177 } | 176 } |
178 | 177 |
179 } // namespace quirks | 178 } // namespace quirks |
OLD | NEW |