Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: components/quirks/quirks_client.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/quirks/quirks_client.h ('k') | components/quirks/quirks_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 VLOG(1) << "Schedule next Quirks download attempt in " << delay.InSecondsF() 147 VLOG(1) << "Schedule next Quirks download attempt in " << delay.InSecondsF()
148 << " seconds (retry = " << backoff_entry_.failure_count() << ")."; 148 << " seconds (retry = " << backoff_entry_.failure_count() << ").";
149 request_scheduled_.Start(FROM_HERE, delay, this, 149 request_scheduled_.Start(FROM_HERE, delay, this,
150 &QuirksClient::StartDownload); 150 &QuirksClient::StartDownload);
151 } 151 }
152 152
153 bool QuirksClient::ParseResult(const std::string& result, std::string* data) { 153 bool QuirksClient::ParseResult(const std::string& result, std::string* data) {
154 std::string data64; 154 std::string data64;
155 const base::DictionaryValue* dict; 155 const base::DictionaryValue* dict;
156 scoped_ptr<base::Value> json = base::JSONReader::Read(result); 156 std::unique_ptr<base::Value> json = base::JSONReader::Read(result);
157 if (!json || !json->GetAsDictionary(&dict) || 157 if (!json || !json->GetAsDictionary(&dict) ||
158 !dict->GetString("icc", &data64)) { 158 !dict->GetString("icc", &data64)) {
159 VLOG(1) << "Failed to parse JSON icc data"; 159 VLOG(1) << "Failed to parse JSON icc data";
160 return false; 160 return false;
161 } 161 }
162 162
163 if (!base::Base64Decode(data64, data)) { 163 if (!base::Base64Decode(data64, data)) {
164 VLOG(1) << "Failed to decode Base64 icc data"; 164 VLOG(1) << "Failed to decode Base64 icc data";
165 return false; 165 return false;
166 } 166 }
167 167
168 return true; 168 return true;
169 } 169 }
170 170
171 } // namespace quirks 171 } // namespace quirks
OLDNEW
« no previous file with comments | « components/quirks/quirks_client.h ('k') | components/quirks/quirks_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698