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

Side by Side Diff: components/password_manager/core/browser/affiliation_fetcher.cc

Issue 2710583003: Network traffic annotation added to affiliation_fetcher. (Closed)
Patch Set: Created 3 years, 10 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/password_manager/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/password_manager/core/browser/affiliation_fetcher.h" 5 #include "components/password_manager/core/browser/affiliation_fetcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "components/password_manager/core/browser/affiliation_api.pb.h" 12 #include "components/password_manager/core/browser/affiliation_api.pb.h"
13 #include "components/password_manager/core/browser/affiliation_utils.h" 13 #include "components/password_manager/core/browser/affiliation_utils.h"
14 #include "components/password_manager/core/browser/test_affiliation_fetcher_fact ory.h" 14 #include "components/password_manager/core/browser/test_affiliation_fetcher_fact ory.h"
15 #include "google_apis/google_api_keys.h" 15 #include "google_apis/google_api_keys.h"
16 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
17 #include "net/base/url_util.h" 17 #include "net/base/url_util.h"
18 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
19 #include "net/traffic_annotation/network_traffic_annotation.h"
19 #include "net/url_request/url_fetcher.h" 20 #include "net/url_request/url_fetcher.h"
20 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 namespace password_manager { 24 namespace password_manager {
24 25
25 namespace { 26 namespace {
26 27
27 // Enumeration listing the possible outcomes of fetching affiliation information 28 // Enumeration listing the possible outcomes of fetching affiliation information
28 // from the Affiliation API. This is used in UMA histograms, so do not change 29 // from the Affiliation API. This is used in UMA histograms, so do not change
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 85
85 // static 86 // static
86 void AffiliationFetcher::SetFactoryForTesting( 87 void AffiliationFetcher::SetFactoryForTesting(
87 TestAffiliationFetcherFactory* factory) { 88 TestAffiliationFetcherFactory* factory) {
88 g_testing_factory = factory; 89 g_testing_factory = factory;
89 } 90 }
90 91
91 void AffiliationFetcher::StartRequest() { 92 void AffiliationFetcher::StartRequest() {
92 DCHECK(!fetcher_); 93 DCHECK(!fetcher_);
93 94
94 fetcher_ = 95 net::NetworkTrafficAnnotationTag traffic_annotation =
95 net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST, this); 96 net::DefineNetworkTrafficAnnotation("...", R"(
vasilii 2017/02/21 10:37:58 android_affiliation
Ramin Halavati 2017/02/21 11:59:10 Done.
97 semantics {
98 sender: "..."
vasilii 2017/02/21 10:37:58 affiliation_fetcher
Ramin Halavati 2017/02/21 11:59:10 Done. Can it be "Android Affiliation Fetcher"?
vasilii 2017/02/21 12:03:20 I think it's confusing because it's running on des
engedy 2017/02/21 12:39:18 +1.
Ramin Halavati 2017/02/21 13:12:02 Done.
99 description: "..."
vasilii 2017/02/21 10:37:58 For the users syncing their passwords to Google wi
Ramin Halavati 2017/02/21 11:59:10 Done.
100 trigger: "..."
vasilii 2017/02/21 10:37:58 On startup.
Ramin Halavati 2017/02/21 11:59:10 Done.
101 data: "..."
vasilii 2017/02/21 10:37:58 List of the Android apps the user has credentials
Ramin Halavati 2017/02/21 11:59:10 Done.
102 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
vasilii 2017/02/21 10:37:58 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/02/21 11:59:10 Done.
103 }
104 policy {
105 cookies_allowed: false
106 setting: "..."
vasilii 2017/02/21 10:37:58 One can either stop syncing the passwords to Googl
Ramin Halavati 2017/02/21 11:59:10 Done.
107 policy {
108 [POLICY_NAME] {
vasilii 2017/02/21 10:37:58 SyncDisabled
Ramin Halavati 2017/02/21 11:59:10 Done.
109 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
vasilii 2017/02/21 10:37:58 MANDATORY
Ramin Halavati 2017/02/21 11:59:10 Done.
110 value: ...
vasilii 2017/02/21 10:37:58 True
Ramin Halavati 2017/02/21 11:59:10 Done.
111 }
112 }
113 policy_exception_justification: "..."
114 })");
115 fetcher_ = net::URLFetcher::Create(BuildQueryURL(), net::URLFetcher::POST,
116 this, traffic_annotation);
96 fetcher_->SetRequestContext(request_context_getter_.get()); 117 fetcher_->SetRequestContext(request_context_getter_.get());
97 fetcher_->SetUploadData("application/x-protobuf", PreparePayload()); 118 fetcher_->SetUploadData("application/x-protobuf", PreparePayload());
98 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 119 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
99 net::LOAD_DO_NOT_SEND_COOKIES | 120 net::LOAD_DO_NOT_SEND_COOKIES |
100 net::LOAD_DO_NOT_SEND_AUTH_DATA | 121 net::LOAD_DO_NOT_SEND_AUTH_DATA |
101 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE); 122 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE);
102 fetcher_->SetAutomaticallyRetryOn5xx(false); 123 fetcher_->SetAutomaticallyRetryOn5xx(false);
103 fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); 124 fetcher_->SetAutomaticallyRetryOnNetworkChanges(0);
104 fetcher_->Start(); 125 fetcher_->Start();
105 } 126 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); 231 ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr);
211 delegate_->OnMalformedResponse(); 232 delegate_->OnMalformedResponse();
212 } 233 }
213 } else { 234 } else {
214 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get()); 235 ReportStatistics(AFFILIATION_FETCH_RESULT_FAILURE, fetcher_.get());
215 delegate_->OnFetchFailed(); 236 delegate_->OnFetchFailed();
216 } 237 }
217 } 238 }
218 239
219 } // namespace password_manager 240 } // namespace password_manager
OLDNEW
« no previous file with comments | « components/password_manager/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698