| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |