OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/signin/gaia_auth_fetcher_ios.h" | 5 #include "ios/chrome/browser/signin/gaia_auth_fetcher_ios.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 browser_state_(browser_state) { | 322 browser_state_(browser_state) { |
323 // Account Consistency needs to be disabled for the Logout call. There is a | 323 // Account Consistency needs to be disabled for the Logout call. There is a |
324 // race with the cookie clearing request (handled by | 324 // race with the cookie clearing request (handled by |
325 // AccountConsistencyService), so we invalidate the cookie for the call. | 325 // AccountConsistencyService), so we invalidate the cookie for the call. |
326 SetLogoutHeaders("Cookie: CHROME_CONNECTED=EXPIRED;"); | 326 SetLogoutHeaders("Cookie: CHROME_CONNECTED=EXPIRED;"); |
327 } | 327 } |
328 | 328 |
329 GaiaAuthFetcherIOS::~GaiaAuthFetcherIOS() { | 329 GaiaAuthFetcherIOS::~GaiaAuthFetcherIOS() { |
330 } | 330 } |
331 | 331 |
332 void GaiaAuthFetcherIOS::CreateAndStartGaiaFetcher(const std::string& body, | 332 void GaiaAuthFetcherIOS::CreateAndStartGaiaFetcher( |
333 const std::string& headers, | 333 const std::string& body, |
334 const GURL& gaia_gurl, | 334 const std::string& headers, |
335 int load_flags) { | 335 const GURL& gaia_gurl, |
| 336 int load_flags, |
| 337 const net::NetworkTrafficAnnotationTag& traffic_annotation) { |
336 DCHECK(!HasPendingFetch()) << "Tried to fetch two things at once!"; | 338 DCHECK(!HasPendingFetch()) << "Tried to fetch two things at once!"; |
337 | 339 |
338 bool cookies_required = !(load_flags & (net::LOAD_DO_NOT_SEND_COOKIES | | 340 bool cookies_required = !(load_flags & (net::LOAD_DO_NOT_SEND_COOKIES | |
339 net::LOAD_DO_NOT_SAVE_COOKIES)); | 341 net::LOAD_DO_NOT_SAVE_COOKIES)); |
340 if (!ShouldUseGaiaAuthFetcherIOS() || !cookies_required) { | 342 if (!ShouldUseGaiaAuthFetcherIOS() || !cookies_required) { |
341 GaiaAuthFetcher::CreateAndStartGaiaFetcher(body, headers, gaia_gurl, | 343 GaiaAuthFetcher::CreateAndStartGaiaFetcher(body, headers, gaia_gurl, |
342 load_flags); | 344 load_flags, traffic_annotation); |
343 return; | 345 return; |
344 } | 346 } |
345 | 347 |
346 DVLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec(); | 348 DVLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec(); |
347 DVLOG(2) << "Gaia fetcher headers: " << headers; | 349 DVLOG(2) << "Gaia fetcher headers: " << headers; |
348 DVLOG(2) << "Gaia fetcher body: " << body; | 350 DVLOG(2) << "Gaia fetcher body: " << body; |
349 | 351 |
350 // The fetch requires cookies and WKWebView is being used. The only way to do | 352 // The fetch requires cookies and WKWebView is being used. The only way to do |
351 // a network request with cookies sent and saved is by making it through a | 353 // a network request with cookies sent and saved is by making it through a |
352 // WKWebView. | 354 // WKWebView. |
(...skipping 21 matching lines...) Expand all Loading... |
374 } | 376 } |
375 | 377 |
376 void GaiaAuthFetcherIOS::SetShouldUseGaiaAuthFetcherIOSForTesting( | 378 void GaiaAuthFetcherIOS::SetShouldUseGaiaAuthFetcherIOSForTesting( |
377 bool use_gaia_fetcher_ios) { | 379 bool use_gaia_fetcher_ios) { |
378 g_should_use_gaia_auth_fetcher_ios = use_gaia_fetcher_ios; | 380 g_should_use_gaia_auth_fetcher_ios = use_gaia_fetcher_ios; |
379 } | 381 } |
380 | 382 |
381 bool GaiaAuthFetcherIOS::ShouldUseGaiaAuthFetcherIOS() { | 383 bool GaiaAuthFetcherIOS::ShouldUseGaiaAuthFetcherIOS() { |
382 return g_should_use_gaia_auth_fetcher_ios; | 384 return g_should_use_gaia_auth_fetcher_ios; |
383 } | 385 } |
OLD | NEW |