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

Side by Side Diff: chrome/browser/net/gaia/gaia_oauth_fetcher.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" 14 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 20 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
21 #include "chrome/common/net/gaia/gaia_constants.h" 21 #include "chrome/common/net/gaia/gaia_constants.h"
22 #include "chrome/common/net/gaia/gaia_urls.h" 22 #include "chrome/common/net/gaia/gaia_urls.h"
23 #include "chrome/common/net/gaia/google_service_auth_error.h" 23 #include "chrome/common/net/gaia/google_service_auth_error.h"
24 #include "chrome/common/net/gaia/oauth_request_signer.h" 24 #include "chrome/common/net/gaia/oauth_request_signer.h"
25 #include "chrome/common/net/url_util.h" 25 #include "chrome/common/net/url_util.h"
26 #include "content/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
28 #include "content/public/common/referrer.h" 28 #include "content/public/common/referrer.h"
29 #include "content/public/common/url_fetcher.h"
30 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
31 #include "net/base/load_flags.h" 30 #include "net/base/load_flags.h"
32 #include "net/http/http_status_code.h" 31 #include "net/http/http_status_code.h"
32 #include "net/url_request/url_fetcher.h"
33 #include "net/url_request/url_request_context_getter.h" 33 #include "net/url_request/url_request_context_getter.h"
34 #include "net/url_request/url_request_status.h" 34 #include "net/url_request/url_request_status.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 36
37 static const char kOAuthTokenCookie[] = "oauth_token"; 37 static const char kOAuthTokenCookie[] = "oauth_token";
38 38
39 GaiaOAuthFetcher::GaiaOAuthFetcher(GaiaOAuthConsumer* consumer, 39 GaiaOAuthFetcher::GaiaOAuthFetcher(GaiaOAuthConsumer* consumer,
40 net::URLRequestContextGetter* getter, 40 net::URLRequestContextGetter* getter,
41 Profile* profile, 41 Profile* profile,
42 const std::string& service_scope) 42 const std::string& service_scope)
(...skipping 18 matching lines...) Expand all
61 61
62 // static 62 // static
63 net::URLFetcher* GaiaOAuthFetcher::CreateGaiaFetcher( 63 net::URLFetcher* GaiaOAuthFetcher::CreateGaiaFetcher(
64 net::URLRequestContextGetter* getter, 64 net::URLRequestContextGetter* getter,
65 const GURL& gaia_gurl, 65 const GURL& gaia_gurl,
66 const std::string& body, 66 const std::string& body,
67 const std::string& headers, 67 const std::string& headers,
68 bool send_cookies, 68 bool send_cookies,
69 net::URLFetcherDelegate* delegate) { 69 net::URLFetcherDelegate* delegate) {
70 bool empty_body = body.empty(); 70 bool empty_body = body.empty();
71 net::URLFetcher* result = content::URLFetcher::Create( 71 net::URLFetcher* result = net::URLFetcher::Create(
72 0, gaia_gurl, 72 0, gaia_gurl,
73 empty_body ? net::URLFetcher::GET : net::URLFetcher::POST, 73 empty_body ? net::URLFetcher::GET : net::URLFetcher::POST,
74 delegate); 74 delegate);
75 result->SetRequestContext(getter); 75 result->SetRequestContext(getter);
76 76
77 // The Gaia/OAuth token exchange requests do not require any cookie-based 77 // The Gaia/OAuth token exchange requests do not require any cookie-based
78 // identification as part of requests. We suppress sending any cookies to 78 // identification as part of requests. We suppress sending any cookies to
79 // maintain a separation between the user's browsing and Chrome's internal 79 // maintain a separation between the user's browsing and Chrome's internal
80 // services. Where such mixing is desired (prelogin, autologin 80 // services. Where such mixing is desired (prelogin, autologin
81 // or chromeos login), it will be done explicitly. 81 // or chromeos login), it will be done explicitly.
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 break; 708 break;
709 case OAUTH2_REVOKE_TOKEN: 709 case OAUTH2_REVOKE_TOKEN:
710 OnOAuthRevokeTokenFetched(data, status, response_code); 710 OnOAuthRevokeTokenFetched(data, status, response_code);
711 break; 711 break;
712 } 712 }
713 } 713 }
714 714
715 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) { 715 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) {
716 return fetch_step <= auto_fetch_limit_; 716 return fetch_step <= auto_fetch_limit_;
717 } 717 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/variations_service.cc ('k') | chrome/browser/net/sdch_dictionary_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698