OLD | NEW |
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 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" | 5 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const std::string& body, | 56 const std::string& body, |
57 const std::string& headers, | 57 const std::string& headers, |
58 bool send_cookies, | 58 bool send_cookies, |
59 net::URLFetcherDelegate* delegate) { | 59 net::URLFetcherDelegate* delegate) { |
60 bool empty_body = body.empty(); | 60 bool empty_body = body.empty(); |
61 net::URLFetcher* result = net::URLFetcher::Create( | 61 net::URLFetcher* result = net::URLFetcher::Create( |
62 0, gaia_gurl, | 62 0, gaia_gurl, |
63 empty_body ? net::URLFetcher::GET : net::URLFetcher::POST, | 63 empty_body ? net::URLFetcher::GET : net::URLFetcher::POST, |
64 delegate); | 64 delegate); |
65 result->SetRequestContext(getter); | 65 result->SetRequestContext(getter); |
| 66 // Fetchers are sometimes cancelled because a network change was detected, |
| 67 // especially at startup and after sign-in on ChromeOS. Retrying once should |
| 68 // be enough in those cases; let the fetcher retry up to 3 times just in case. |
| 69 // http://crbug.com/163710 |
| 70 result->SetAutomaticallyRetryOnNetworkChanges(3); |
66 | 71 |
67 // The Gaia/OAuth token exchange requests do not require any cookie-based | 72 // The Gaia/OAuth token exchange requests do not require any cookie-based |
68 // identification as part of requests. We suppress sending any cookies to | 73 // identification as part of requests. We suppress sending any cookies to |
69 // maintain a separation between the user's browsing and Chrome's internal | 74 // maintain a separation between the user's browsing and Chrome's internal |
70 // services. Where such mixing is desired (prelogin, autologin | 75 // services. Where such mixing is desired (prelogin, autologin |
71 // or chromeos login), it will be done explicitly. | 76 // or chromeos login), it will be done explicitly. |
72 if (!send_cookies) | 77 if (!send_cookies) |
73 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); | 78 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); |
74 | 79 |
75 if (!empty_body) | 80 if (!empty_body) |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 break; | 557 break; |
553 case OAUTH2_REVOKE_TOKEN: | 558 case OAUTH2_REVOKE_TOKEN: |
554 OnOAuthRevokeTokenFetched(data, status, response_code); | 559 OnOAuthRevokeTokenFetched(data, status, response_code); |
555 break; | 560 break; |
556 } | 561 } |
557 } | 562 } |
558 | 563 |
559 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) { | 564 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) { |
560 return fetch_step <= auto_fetch_limit_; | 565 return fetch_step <= auto_fetch_limit_; |
561 } | 566 } |
OLD | NEW |