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

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

Issue 2741413008: Introduce flag to disable static popular sites. (Closed)
Patch Set: Use param instead of new trial 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 site->SetInteger("default_icon_resource", resource_id); 147 site->SetInteger("default_icon_resource", resource_id);
148 } 148 }
149 #endif 149 #endif
150 150
151 // Creates the list of popular sites based on a snapshot available for mobile. 151 // Creates the list of popular sites based on a snapshot available for mobile.
152 std::unique_ptr<base::ListValue> DefaultPopularSites() { 152 std::unique_ptr<base::ListValue> DefaultPopularSites() {
153 #if !defined(OS_ANDROID) && !defined(OS_IOS) 153 #if !defined(OS_ANDROID) && !defined(OS_IOS)
154 return base::MakeUnique<base::ListValue>(); 154 return base::MakeUnique<base::ListValue>();
155 #else 155 #else
156 if (!ShouldUseBakedInSites()) {
157 return base::MakeUnique<base::ListValue>();
158 }
156 std::unique_ptr<base::ListValue> sites = 159 std::unique_ptr<base::ListValue> sites =
157 base::ListValue::From(base::JSONReader::Read( 160 base::ListValue::From(base::JSONReader::Read(
158 ResourceBundle::GetSharedInstance().GetRawDataResource( 161 ResourceBundle::GetSharedInstance().GetRawDataResource(
159 IDR_DEFAULT_POPULAR_SITES_JSON))); 162 IDR_DEFAULT_POPULAR_SITES_JSON)));
160 DCHECK(sites); 163 DCHECK(sites);
161 #if defined(GOOGLE_CHROME_BUILD) 164 #if defined(GOOGLE_CHROME_BUILD)
162 int index = 0; 165 int index = 0;
163 for (int icon_resource : 166 for (int icon_resource :
164 {IDR_DEFAULT_POPULAR_SITES_ICON0, IDR_DEFAULT_POPULAR_SITES_ICON1, 167 {IDR_DEFAULT_POPULAR_SITES_ICON0, IDR_DEFAULT_POPULAR_SITES_ICON1,
165 IDR_DEFAULT_POPULAR_SITES_ICON2, IDR_DEFAULT_POPULAR_SITES_ICON3, 168 IDR_DEFAULT_POPULAR_SITES_ICON2, IDR_DEFAULT_POPULAR_SITES_ICON3,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, 415 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode,
413 kPopularSitesDefaultVersion); 416 kPopularSitesDefaultVersion);
414 FetchPopularSites(); 417 FetchPopularSites();
415 } else { 418 } else {
416 DLOG(WARNING) << "Download fallback site list failed"; 419 DLOG(WARNING) << "Download fallback site list failed";
417 callback_.Run(false); 420 callback_.Run(false);
418 } 421 }
419 } 422 }
420 423
421 } // namespace ntp_tiles 424 } // namespace ntp_tiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698