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

Side by Side Diff: components/ntp_tiles/popular_sites_impl.cc

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: rebase Created 3 years, 9 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/ntp_snippets/user_classifier.cc ('k') | components/ntp_tiles/switches.cc » ('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 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_tiles/popular_sites_impl.h" 5 #include "components/ntp_tiles/popular_sites_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 std::unique_ptr<net::URLFetcher> free_fetcher = std::move(fetcher_); 373 std::unique_ptr<net::URLFetcher> free_fetcher = std::move(fetcher_);
374 374
375 std::string json_string; 375 std::string json_string;
376 if (!(source->GetStatus().is_success() && 376 if (!(source->GetStatus().is_success() &&
377 source->GetResponseCode() == net::HTTP_OK && 377 source->GetResponseCode() == net::HTTP_OK &&
378 source->GetResponseAsString(&json_string))) { 378 source->GetResponseAsString(&json_string))) {
379 OnDownloadFailed(); 379 OnDownloadFailed();
380 return; 380 return;
381 } 381 }
382 382
383 parse_json_.Run(json_string, base::Bind(&PopularSitesImpl::OnJsonParsed, 383 parse_json_.Run(json_string,
384 weak_ptr_factory_.GetWeakPtr()), 384 base::Bind(&PopularSitesImpl::OnJsonParsed,
385 weak_ptr_factory_.GetWeakPtr()),
385 base::Bind(&PopularSitesImpl::OnJsonParseFailed, 386 base::Bind(&PopularSitesImpl::OnJsonParseFailed,
386 weak_ptr_factory_.GetWeakPtr())); 387 weak_ptr_factory_.GetWeakPtr()));
387 } 388 }
388 389
389 void PopularSitesImpl::OnJsonParsed(std::unique_ptr<base::Value> json) { 390 void PopularSitesImpl::OnJsonParsed(std::unique_ptr<base::Value> json) {
390 std::unique_ptr<base::ListValue> list = 391 std::unique_ptr<base::ListValue> list =
391 base::ListValue::From(std::move(json)); 392 base::ListValue::From(std::move(json));
392 if (!list) { 393 if (!list) {
393 DLOG(WARNING) << "JSON is not a list"; 394 DLOG(WARNING) << "JSON is not a list";
394 OnDownloadFailed(); 395 OnDownloadFailed();
(...skipping 21 matching lines...) Expand all
416 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, 417 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode,
417 kPopularSitesDefaultVersion); 418 kPopularSitesDefaultVersion);
418 FetchPopularSites(); 419 FetchPopularSites();
419 } else { 420 } else {
420 DLOG(WARNING) << "Download fallback site list failed"; 421 DLOG(WARNING) << "Download fallback site list failed";
421 callback_.Run(false); 422 callback_.Run(false);
422 } 423 }
423 } 424 }
424 425
425 } // namespace ntp_tiles 426 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « components/ntp_snippets/user_classifier.cc ('k') | components/ntp_tiles/switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698