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

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

Issue 2083933004: Logging the NTP snippets request when verbose. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 data_use_measurement::DataUseUserData::AttachToFetcher( 249 data_use_measurement::DataUseUserData::AttachToFetcher(
250 url_fetcher_.get(), data_use_measurement::DataUseUserData::NTP_SNIPPETS); 250 url_fetcher_.get(), data_use_measurement::DataUseUserData::NTP_SNIPPETS);
251 251
252 HttpRequestHeaders headers; 252 HttpRequestHeaders headers;
253 if (!auth_header.empty()) 253 if (!auth_header.empty())
254 headers.SetHeader("Authorization", auth_header); 254 headers.SetHeader("Authorization", auth_header);
255 headers.SetHeader("Content-Type", "application/json; charset=UTF-8"); 255 headers.SetHeader("Content-Type", "application/json; charset=UTF-8");
256 url_fetcher_->SetExtraRequestHeaders(headers.ToString()); 256 url_fetcher_->SetExtraRequestHeaders(headers.ToString());
257 url_fetcher_->SetUploadData("application/json", request); 257 url_fetcher_->SetUploadData("application/json", request);
258 // Log the request for debugging network issues.
259 VLOG(1) << "Sendind a ntp snippets request to " << url << ":";
Bernhard Bauer 2016/06/21 16:33:05 Nit: "Sending", "NTP".
jkrcal 2016/06/23 08:21:35 Done.
260 VLOG(1) << headers.ToString();
Bernhard Bauer 2016/06/21 16:33:05 You don't need a new VLOG() invocation; just keep
jkrcal 2016/06/23 08:21:35 Done (added some new lines, as well).
261 VLOG(1) << request;
258 // Fetchers are sometimes cancelled because a network change was detected. 262 // Fetchers are sometimes cancelled because a network change was detected.
259 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); 263 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
260 // Try to make fetching the files bit more robust even with poor connection. 264 // Try to make fetching the files bit more robust even with poor connection.
261 url_fetcher_->SetMaxRetriesOn5xx(3); 265 url_fetcher_->SetMaxRetriesOn5xx(3);
262 url_fetcher_->Start(); 266 url_fetcher_->Start();
263 } 267 }
264 268
265 std::string NTPSnippetsFetcher::GetHostRestricts() const { 269 std::string NTPSnippetsFetcher::GetHostRestricts() const {
266 std::string host_restricts; 270 std::string host_restricts;
267 if (UsesHostRestrictions()) { 271 if (UsesHostRestrictions()) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 tick_clock_->NowTicks() - fetch_start_time_); 437 tick_clock_->NowTicks() - fetch_start_time_);
434 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", 438 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult",
435 static_cast<int>(result), 439 static_cast<int>(result),
436 static_cast<int>(FetchResult::RESULT_MAX)); 440 static_cast<int>(FetchResult::RESULT_MAX));
437 441
438 if (!snippets_available_callback_.is_null()) 442 if (!snippets_available_callback_.is_null())
439 snippets_available_callback_.Run(std::move(snippets)); 443 snippets_available_callback_.Run(std::move(snippets));
440 } 444 }
441 445
442 } // namespace ntp_snippets 446 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698