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

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

Issue 2730263003: Network traffic annotation added to rlz/lib. (Closed)
Patch Set: Annotation updated. 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("rlz_ping", R"(
324 semantics {
325 sender: "RLZ Ping"
326 description:
327 "Used for measuring effectiveness of a promotion. See Chromium "
msramek 2017/03/07 10:24:49 nit: Not a native speaker, but shouldn't this be "
Ramin Halavati 2017/03/07 12:46:00 Done.
328 "privacy policy for complete details: https://www.google.com/chrome"
msramek 2017/03/07 10:24:49 "See the Chrome Privacy Whitepaper"
Ramin Halavati 2017/03/07 12:46:00 Done.
329 "/browser/privacy/whitepaper.html#measurepromotions"
330 trigger:
331 "1/ At Chromium first run, "
msramek 2017/03/07 10:24:49 Should we add "\n" so it looks good when strings a
Ramin Halavati 2017/03/07 12:46:00 Done.
332 "2/ When Chromium is re-activated by a new promotion, "
333 "3/ Once a week thereafter as long as Chromium is used."
334 data:
335 "1/ Non-unique cohort tag of when Chromium was installed, "
336 "2/ Unique machine id on desktop platforms, "
337 "3/ Whether Google is the default omnibox search, "
338 "4/ Whether google.com is the default home page."
339 destination: GOOGLE_OWNED_SERVICE
340 }
341 policy {
342 cookies_allowed: false
343 setting: "This feature cannot be disabled in settings."
344 policy_exception_justification: "Not implemented."
345 })");
346 std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(
347 GURL(url), net::URLFetcher::GET, &delegate, traffic_annotation);
323 348
324 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE | 349 fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE |
325 net::LOAD_DO_NOT_SEND_AUTH_DATA | 350 net::LOAD_DO_NOT_SEND_AUTH_DATA |
326 net::LOAD_DO_NOT_SEND_COOKIES | 351 net::LOAD_DO_NOT_SEND_COOKIES |
327 net::LOAD_DO_NOT_SAVE_COOKIES); 352 net::LOAD_DO_NOT_SAVE_COOKIES);
328 353
329 // Ensure rlz_lib::SetURLRequestContext() has been called before sending 354 // Ensure rlz_lib::SetURLRequestContext() has been called before sending
330 // pings. 355 // pings.
331 fetcher->SetRequestContext(context); 356 fetcher->SetRequestContext(context);
332 357
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 432 }
408 433
409 bool WasSendFinancialPingInterrupted() { 434 bool WasSendFinancialPingInterrupted() {
410 return send_financial_ping_interrupted_for_test; 435 return send_financial_ping_interrupted_for_test;
411 } 436 }
412 437
413 } // namespace test 438 } // namespace test
414 #endif 439 #endif
415 440
416 } // namespace rlz_lib 441 } // 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