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

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

Issue 2041783002: Preset variation parameters for NTPSnippets feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@about-flags-parameters
Patch Set: Removing unittests that test non-default behaviour Created 4 years, 6 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 | « chrome/browser/about_flags.cc ('k') | components/ntp_snippets/ntp_snippets_fetcher_unittest.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 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/ntp_snippets/ntp_snippets_fetcher.h" 5 #include "components/ntp_snippets/ntp_snippets_fetcher.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } else { 166 } else {
167 personalization_ = Personalization::kBoth; 167 personalization_ = Personalization::kBoth;
168 LOG_IF(WARNING, !personalization.empty() && 168 LOG_IF(WARNING, !personalization.empty() &&
169 personalization != kPersonalizationBothString) 169 personalization != kPersonalizationBothString)
170 << "Unknown value for " << kPersonalizationName << ": " 170 << "Unknown value for " << kPersonalizationName << ": "
171 << personalization; 171 << personalization;
172 } 172 }
173 173
174 std::string host_restriction = variations::GetVariationParamValue( 174 std::string host_restriction = variations::GetVariationParamValue(
175 ntp_snippets::kStudyName, kHostRestrictionName); 175 ntp_snippets::kStudyName, kHostRestrictionName);
176 if (host_restriction == kHostRestrictionOffString) { 176 if (host_restriction == kHostRestrictionOnString) {
177 use_host_restriction_ = true;
178 } else {
177 use_host_restriction_ = false; 179 use_host_restriction_ = false;
178 } else {
179 use_host_restriction_ = true;
180 LOG_IF(WARNING, !host_restriction.empty() && 180 LOG_IF(WARNING, !host_restriction.empty() &&
181 host_restriction != kHostRestrictionOnString) 181 host_restriction != kHostRestrictionOffString)
182 << "Unknown value for " << kHostRestrictionName << ": " 182 << "Unknown value for " << kHostRestrictionName << ": "
183 << host_restriction; 183 << host_restriction;
184 } 184 }
185 } 185 }
186 186
187 NTPSnippetsFetcher::~NTPSnippetsFetcher() { 187 NTPSnippetsFetcher::~NTPSnippetsFetcher() {
188 if (waiting_for_refresh_token_) 188 if (waiting_for_refresh_token_)
189 token_service_->RemoveObserver(this); 189 token_service_->RemoveObserver(this);
190 } 190 }
191 191
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 tick_clock_->NowTicks() - fetch_start_time_); 433 tick_clock_->NowTicks() - fetch_start_time_);
434 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", 434 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult",
435 static_cast<int>(result), 435 static_cast<int>(result),
436 static_cast<int>(FetchResult::RESULT_MAX)); 436 static_cast<int>(FetchResult::RESULT_MAX));
437 437
438 if (!snippets_available_callback_.is_null()) 438 if (!snippets_available_callback_.is_null())
439 snippets_available_callback_.Run(std::move(snippets)); 439 snippets_available_callback_.Run(std::move(snippets));
440 } 440 }
441 441
442 } // namespace ntp_snippets 442 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/ntp_snippets/ntp_snippets_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698