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

Side by Side Diff: components/ntp_snippets/ntp_snippet.cc

Issue 2110663002: components: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+one fix Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ntp_snippets/ntp_snippet.h" 5 #include "components/ntp_snippets/ntp_snippet.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const base::DictionaryValue& dict) { 141 const base::DictionaryValue& dict) {
142 const base::ListValue* id_list; 142 const base::ListValue* id_list;
143 std::string id; 143 std::string id;
144 if (!(dict.GetList("id", &id_list) && 144 if (!(dict.GetList("id", &id_list) &&
145 id_list->GetString(0, &id))) { // TODO(sfiera): multiple IDs 145 id_list->GetString(0, &id))) { // TODO(sfiera): multiple IDs
146 return nullptr; 146 return nullptr;
147 } 147 }
148 148
149 auto snippet = base::MakeUnique<NTPSnippet>(id); 149 auto snippet = base::MakeUnique<NTPSnippet>(id);
150 snippet->sources_.emplace_back(GURL(), std::string(), GURL()); 150 snippet->sources_.emplace_back(GURL(), std::string(), GURL());
151 auto source = &snippet->sources_.back(); 151 auto* source = &snippet->sources_.back();
152 snippet->best_source_index_ = 0; 152 snippet->best_source_index_ = 0;
153 153
154 if (!(dict.GetString("title", &snippet->title_) && 154 if (!(dict.GetString("title", &snippet->title_) &&
155 dict.GetString("summaryText", &snippet->snippet_) && 155 dict.GetString("summaryText", &snippet->snippet_) &&
156 GetTimeValue(dict, "publishTime", &snippet->publish_date_) && 156 GetTimeValue(dict, "publishTime", &snippet->publish_date_) &&
157 GetTimeValue(dict, "expirationTime", &snippet->expiry_date_) && 157 GetTimeValue(dict, "expirationTime", &snippet->expiry_date_) &&
158 GetURLValue(dict, "imageUrl", &snippet->salient_image_url_) && 158 GetURLValue(dict, "imageUrl", &snippet->salient_image_url_) &&
159 dict.GetString("publisherName", &source->publisher_name) && 159 dict.GetString("publisherName", &source->publisher_name) &&
160 GetURLValue(dict, "fullPageUrl", &source->url))) { 160 GetURLValue(dict, "fullPageUrl", &source->url))) {
161 return nullptr; 161 return nullptr;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 best_source_index_ = i; 276 best_source_index_ = i;
277 if (!source.amp_url.is_empty()) { 277 if (!source.amp_url.is_empty()) {
278 // This is the best possible source, stop looking. 278 // This is the best possible source, stop looking.
279 break; 279 break;
280 } 280 }
281 } 281 }
282 } 282 }
283 } 283 }
284 284
285 } // namespace ntp_snippets 285 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/metrics/profiler/tracking_synchronizer_unittest.cc ('k') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698