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

Side by Side Diff: components/feedback/feedback_uploader_chrome.cc

Issue 2708853002: Network traffic annotation added to feedback_uploader_chrome. (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 | « components/feedback/DEPS ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/feedback/feedback_uploader_chrome.h" 5 #include "components/feedback/feedback_uploader_chrome.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/task_runner_util.h" 12 #include "base/task_runner_util.h"
13 #include "base/threading/sequenced_worker_pool.h" 13 #include "base/threading/sequenced_worker_pool.h"
14 #include "components/data_use_measurement/core/data_use_user_data.h" 14 #include "components/data_use_measurement/core/data_use_user_data.h"
15 #include "components/feedback/feedback_report.h" 15 #include "components/feedback/feedback_report.h"
16 #include "components/feedback/feedback_switches.h" 16 #include "components/feedback/feedback_switches.h"
17 #include "components/feedback/feedback_uploader_delegate.h" 17 #include "components/feedback/feedback_uploader_delegate.h"
18 #include "components/variations/net/variations_http_headers.h" 18 #include "components/variations/net/variations_http_headers.h"
19 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/storage_partition.h" 21 #include "content/public/browser/storage_partition.h"
22 #include "net/base/load_flags.h" 22 #include "net/base/load_flags.h"
23 #include "net/traffic_annotation/network_traffic_annotation.h"
23 #include "net/url_request/url_fetcher.h" 24 #include "net/url_request/url_fetcher.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
27 28
28 namespace feedback { 29 namespace feedback {
29 namespace { 30 namespace {
30 31
31 const char kProtoBufMimeType[] = "application/x-protobuf"; 32 const char kProtoBufMimeType[] = "application/x-protobuf";
32 33
33 } // namespace 34 } // namespace
34 35
35 FeedbackUploaderChrome::FeedbackUploaderChrome( 36 FeedbackUploaderChrome::FeedbackUploaderChrome(
36 content::BrowserContext* context) 37 content::BrowserContext* context)
37 : FeedbackUploader(context ? context->GetPath() : base::FilePath(), 38 : FeedbackUploader(context ? context->GetPath() : base::FilePath(),
38 BrowserThread::GetBlockingPool()), 39 BrowserThread::GetBlockingPool()),
39 context_(context) { 40 context_(context) {
40 CHECK(context_); 41 CHECK(context_);
41 const base::CommandLine& command_line = 42 const base::CommandLine& command_line =
42 *base::CommandLine::ForCurrentProcess(); 43 *base::CommandLine::ForCurrentProcess();
43 if (command_line.HasSwitch(switches::kFeedbackServer)) 44 if (command_line.HasSwitch(switches::kFeedbackServer))
44 url_ = command_line.GetSwitchValueASCII(switches::kFeedbackServer); 45 url_ = command_line.GetSwitchValueASCII(switches::kFeedbackServer);
45 } 46 }
46 47
47 void FeedbackUploaderChrome::DispatchReport(const std::string& data) { 48 void FeedbackUploaderChrome::DispatchReport(const std::string& data) {
48 GURL post_url(url_); 49 GURL post_url(url_);
49 50
51 net::NetworkTrafficAnnotationTag traffic_annotation =
52 net::DefineNetworkTrafficAnnotation("chrome_feedback_report_app", R"(
53 semantics {
54 sender: "Chrome Feedback Report App"
55 description:
56 "This uploads the feedback report to Google feedback server."
Ramin Halavati 2017/03/11 09:42:54 May be it would be good if you describe what is th
afakhry 2017/03/14 01:36:42 I'm not sure how to describe it in a simple way. T
Ramin Halavati 2017/03/14 06:31:57 Thank you, I think this description is quite good.
57 trigger: "When the feedback report is being uploaded."
Ramin Halavati 2017/03/11 09:42:54 Is user asked for sending feedback? In which cases
afakhry 2017/03/14 01:36:42 This is a user-generated event, as a result of pre
Ramin Halavati 2017/03/14 06:31:57 Done.
58 data:
59 "Contents of the report, user entered message, and useful "
Ramin Halavati 2017/03/11 09:42:54 Can you add details on content items? Is there any
afakhry 2017/03/14 01:36:42 We anonymize the logs to remove any user-private d
Ramin Halavati 2017/03/14 06:31:57 Done.
60 "debugging logs."
61 destination: GOOGLE_OWNED_SERVICE
62 }
63 policy {
64 cookies_allowed: false
65 setting: "..."
Ramin Halavati 2017/03/11 09:42:54 I didn't find any settings disabling feedback, is
afakhry 2017/03/14 01:36:42 I'm not aware of any setting to disable feedback.
Ramin Halavati 2017/03/14 06:31:57 Acknowledged.
66 policy_exception_justification: "Not implemented."
67 })");
50 // Note: FeedbackUploaderDelegate deletes itself and the fetcher. 68 // Note: FeedbackUploaderDelegate deletes itself and the fetcher.
51 net::URLFetcher* fetcher = 69 net::URLFetcher* fetcher =
52 net::URLFetcher::Create( 70 net::URLFetcher::Create(
53 post_url, net::URLFetcher::POST, 71 post_url, net::URLFetcher::POST,
54 new FeedbackUploaderDelegate( 72 new FeedbackUploaderDelegate(
55 data, base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer, 73 data,
56 AsWeakPtr()), 74 base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer,
57 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr()))) 75 AsWeakPtr()),
76 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr())),
77 traffic_annotation)
58 .release(); 78 .release();
59 data_use_measurement::DataUseUserData::AttachToFetcher( 79 data_use_measurement::DataUseUserData::AttachToFetcher(
60 fetcher, data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER); 80 fetcher, data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER);
61 // Tell feedback server about the variation state of this install. 81 // Tell feedback server about the variation state of this install.
62 net::HttpRequestHeaders headers; 82 net::HttpRequestHeaders headers;
63 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does 83 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does
64 // not affect transmission of experiments coming from the variations server. 84 // not affect transmission of experiments coming from the variations server.
65 bool is_signed_in = false; 85 bool is_signed_in = false;
66 variations::AppendVariationHeaders(fetcher->GetOriginalURL(), 86 variations::AppendVariationHeaders(fetcher->GetOriginalURL(),
67 context_->IsOffTheRecord(), false, 87 context_->IsOffTheRecord(), false,
68 is_signed_in, &headers); 88 is_signed_in, &headers);
69 fetcher->SetExtraRequestHeaders(headers.ToString()); 89 fetcher->SetExtraRequestHeaders(headers.ToString());
70 90
71 fetcher->SetUploadData(kProtoBufMimeType, data); 91 fetcher->SetUploadData(kProtoBufMimeType, data);
72 fetcher->SetRequestContext( 92 fetcher->SetRequestContext(
73 content::BrowserContext::GetDefaultStoragePartition(context_)-> 93 content::BrowserContext::GetDefaultStoragePartition(context_)->
74 GetURLRequestContext()); 94 GetURLRequestContext());
75 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 95 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
76 net::LOAD_DO_NOT_SEND_COOKIES); 96 net::LOAD_DO_NOT_SEND_COOKIES);
77 fetcher->Start(); 97 fetcher->Start();
78 } 98 }
79 99
80 } // namespace feedback 100 } // namespace feedback
OLDNEW
« no previous file with comments | « components/feedback/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698