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

Side by Side Diff: rlz/lib/financial_ping.cc

Issue 2730263003: Network traffic annotation added to rlz/lib. (Closed)
Patch Set: 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 | « 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Library functions related to the Financial Server ping. 5 // Library functions related to the Financial Server ping.
6 6
7 #include "rlz/lib/financial_ping.h" 7 #include "rlz/lib/financial_ping.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 } // namespace 52 } // namespace
53 53
54 #else 54 #else
55 55
56 #include "base/bind.h" 56 #include "base/bind.h"
57 #include "base/message_loop/message_loop.h" 57 #include "base/message_loop/message_loop.h"
58 #include "base/run_loop.h" 58 #include "base/run_loop.h"
59 #include "base/time/time.h" 59 #include "base/time/time.h"
60 #include "net/base/load_flags.h" 60 #include "net/base/load_flags.h"
61 #include "net/traffic_annotation/network_traffic_annotation.h"
61 #include "net/url_request/url_fetcher.h" 62 #include "net/url_request/url_fetcher.h"
62 #include "net/url_request/url_fetcher_delegate.h" 63 #include "net/url_request/url_fetcher_delegate.h"
63 #include "net/url_request/url_request_context.h" 64 #include "net/url_request/url_request_context.h"
64 #include "net/url_request/url_request_context_getter.h" 65 #include "net/url_request/url_request_context_getter.h"
65 #include "url/gurl.h" 66 #include "url/gurl.h"
66 67
67 #endif 68 #endif
68 69
69 namespace { 70 namespace {
70 71
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Ensure that we have a MessageLoop. 312 // Ensure that we have a MessageLoop.
312 if (!base::MessageLoop::current()) 313 if (!base::MessageLoop::current())
313 message_loop.reset(new base::MessageLoop); 314 message_loop.reset(new base::MessageLoop);
314 base::RunLoop loop; 315 base::RunLoop loop;
315 FinancialPingUrlFetcherDelegate delegate(loop.QuitClosure()); 316 FinancialPingUrlFetcherDelegate delegate(loop.QuitClosure());
316 317
317 std::string url = base::StringPrintf("http://%s:%d%s", 318 std::string url = base::StringPrintf("http://%s:%d%s",
318 kFinancialServer, kFinancialPort, 319 kFinancialServer, kFinancialPort,
319 request); 320 request);
320 321
321 std::unique_ptr<net::URLFetcher> fetcher = 322 net::NetworkTrafficAnnotationTag traffic_annotation =
322 net::URLFetcher::Create(GURL(url), net::URLFetcher::GET, &delegate); 323 net::DefineNetworkTrafficAnnotation("...", R"(
324 semantics {
325 sender: "..."
326 description: "..."
327 trigger: "..."
328 data: "..."
329 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
330 }
331 policy {
332 cookies_allowed: false/true
333 cookies_store: "..."
334 setting: "..."
335 policy {
336 [POLICY_NAME] {
337 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
338 [POLICY_NAME]: ... //(value to disable it)
339 }
340 }
341 policy_exception_justification: "..."
342 })");
343 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(
344 GURL(url), net::URLFetcher::GET, &delegate, traffic_annotation);
Roger Tawa OOO till Jul 10th 2017/03/06 16:06:02 net::NetworkTrafficAnnotationTag traffic_annotatio
323 345
324 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE | 346 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE |
325 net::LOAD_DO_NOT_SEND_AUTH_DATA | 347 net::LOAD_DO_NOT_SEND_AUTH_DATA |
326 net::LOAD_DO_NOT_SEND_COOKIES | 348 net::LOAD_DO_NOT_SEND_COOKIES |
327 net::LOAD_DO_NOT_SAVE_COOKIES); 349 net::LOAD_DO_NOT_SAVE_COOKIES);
328 350
329 // Ensure rlz_lib::SetURLRequestContext() has been called before sending 351 // Ensure rlz_lib::SetURLRequestContext() has been called before sending
330 // pings. 352 // pings.
331 fetcher->SetRequestContext(context); 353 fetcher->SetRequestContext(context);
332 354
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 429 }
408 430
409 bool WasSendFinancialPingInterrupted() { 431 bool WasSendFinancialPingInterrupted() {
410 return send_financial_ping_interrupted_for_test; 432 return send_financial_ping_interrupted_for_test;
411 } 433 }
412 434
413 } // namespace test 435 } // namespace test
414 #endif 436 #endif
415 437
416 } // namespace rlz_lib 438 } // namespace rlz_lib
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