OLD | NEW |
---|---|
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/signin/core/browser/refresh_token_annotation_request.h" | 5 #include "components/signin/core/browser/refresh_token_annotation_request.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
15 #include "components/signin/core/browser/signin_client.h" | 15 #include "components/signin/core/browser/signin_client.h" |
16 #include "components/signin/core/common/signin_pref_names.h" | 16 #include "components/signin/core/common/signin_pref_names.h" |
17 #include "google_apis/gaia/gaia_constants.h" | 17 #include "google_apis/gaia/gaia_constants.h" |
18 #include "google_apis/gaia/gaia_urls.h" | 18 #include "google_apis/gaia/gaia_urls.h" |
19 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
20 #include "net/traffic_annotation/network_traffic_annotation.h" | |
20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 void RecordRequestStatusHistogram(bool success) { | 25 void RecordRequestStatusHistogram(bool success) { |
25 UMA_HISTOGRAM_BOOLEAN("Signin.RefreshTokenAnnotationRequest", success); | 26 UMA_HISTOGRAM_BOOLEAN("Signin.RefreshTokenAnnotationRequest", success); |
26 } | 27 } |
27 } | 28 } |
28 | 29 |
29 RefreshTokenAnnotationRequest::RefreshTokenAnnotationRequest( | 30 RefreshTokenAnnotationRequest::RefreshTokenAnnotationRequest( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 } | 165 } |
165 | 166 |
166 void RefreshTokenAnnotationRequest::ProcessApiCallFailure( | 167 void RefreshTokenAnnotationRequest::ProcessApiCallFailure( |
167 const net::URLFetcher* source) { | 168 const net::URLFetcher* source) { |
168 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 169 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
169 DVLOG(2) << "Request failed"; | 170 DVLOG(2) << "Request failed"; |
170 RecordRequestStatusHistogram(false); | 171 RecordRequestStatusHistogram(false); |
171 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, request_callback_); | 172 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, request_callback_); |
172 request_callback_.Reset(); | 173 request_callback_.Reset(); |
173 } | 174 } |
175 | |
176 net::PartialNetworkTrafficAnnotationTag | |
177 RefreshTokenAnnotationRequest::GetNetworkTrafficAnnotationTag() { | |
178 return net::DefinePartialNetworkTrafficAnnotation( | |
179 "refresh_token_annotation_request", "oauth2_api_call_flow", R"( | |
180 semantics { | |
181 sender: "Account Fetcher Service" | |
182 description: | |
183 "Sends request to /IssueToken endpoint with device_id to backfill " | |
msramek
2017/06/28 08:40:55
What is exactly is a device ID?
sacomoto
2017/06/30 10:09:54
I think this is a randomly generated ID scoped to
Ramin Halavati
2017/06/30 11:51:36
Done.
| |
184 "device info for refresh tokens issued pre-M38." | |
185 trigger: | |
186 "When refreshing account information in AccountFetcherService. On " | |
187 "chrome startup and at most once per day." | |
188 data: | |
189 "Oauth2 access token for user, device_id for chrome profile, " | |
190 "chrome's client id, chrome version number." | |
191 destination: GOOGLE_OWNED_SERVICE | |
192 } | |
193 policy { | |
194 setting: | |
195 "This feature cannot be disabled by settings, however the request is " | |
196 "made only for signed-in users." | |
197 chrome_policy { | |
198 SigninAllowed { | |
199 policy_options {mode: MANDATORY} | |
200 SigninAllowed: false | |
201 } | |
202 } | |
203 })"); | |
204 } | |
OLD | NEW |