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

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

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 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/tabs/tab_strip_model.h" 16 #include "chrome/browser/tabs/tab_strip_model.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 19 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
20 #include "chrome/common/net/gaia/gaia_constants.h" 20 #include "chrome/common/net/gaia/gaia_constants.h"
21 #include "chrome/common/net/gaia/gaia_urls.h" 21 #include "chrome/common/net/gaia/gaia_urls.h"
22 #include "chrome/common/net/gaia/google_service_auth_error.h" 22 #include "chrome/common/net/gaia/google_service_auth_error.h"
23 #include "chrome/common/net/gaia/oauth_request_signer.h" 23 #include "chrome/common/net/gaia/oauth_request_signer.h"
24 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
25 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
26 #include "content/public/common/content_url_request_user_data.h"
26 #include "content/public/common/url_fetcher.h" 27 #include "content/public/common/url_fetcher.h"
27 #include "grit/chromium_strings.h" 28 #include "grit/chromium_strings.h"
28 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
29 #include "net/http/http_status_code.h" 30 #include "net/http/http_status_code.h"
30 #include "net/url_request/url_request_context_getter.h" 31 #include "net/url_request/url_request_context_getter.h"
31 #include "net/url_request/url_request_status.h" 32 #include "net/url_request/url_request_status.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 34
34 static const char kOAuthTokenCookie[] = "oauth_token"; 35 static const char kOAuthTokenCookie[] = "oauth_token";
35 36
(...skipping 27 matching lines...) Expand all
63 const std::string& body, 64 const std::string& body,
64 const std::string& headers, 65 const std::string& headers,
65 bool send_cookies, 66 bool send_cookies,
66 content::URLFetcherDelegate* delegate) { 67 content::URLFetcherDelegate* delegate) {
67 bool empty_body = body.empty(); 68 bool empty_body = body.empty();
68 content::URLFetcher* result = content::URLFetcher::Create( 69 content::URLFetcher* result = content::URLFetcher::Create(
69 0, gaia_gurl, 70 0, gaia_gurl,
70 empty_body ? content::URLFetcher::GET : content::URLFetcher::POST, 71 empty_body ? content::URLFetcher::GET : content::URLFetcher::POST,
71 delegate); 72 delegate);
72 result->SetRequestContext(getter); 73 result->SetRequestContext(getter);
74 // TODO(jochen): Do cookie audit.
75 result->SetContentURLRequestUserData(
76 new content::ContentURLRequestUserData());
73 77
74 // The Gaia/OAuth token exchange requests do not require any cookie-based 78 // The Gaia/OAuth token exchange requests do not require any cookie-based
75 // identification as part of requests. We suppress sending any cookies to 79 // identification as part of requests. We suppress sending any cookies to
76 // maintain a separation between the user's browsing and Chrome's internal 80 // maintain a separation between the user's browsing and Chrome's internal
77 // services. Where such mixing is desired (prelogin, autologin 81 // services. Where such mixing is desired (prelogin, autologin
78 // or chromeos login), it will be done explicitly. 82 // or chromeos login), it will be done explicitly.
79 if (!send_cookies) 83 if (!send_cookies)
80 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); 84 result->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
81 85
82 if (!empty_body) 86 if (!empty_body)
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 true)) { 690 true)) {
687 OnOAuthRevokeTokenFetched(data, status, response_code); 691 OnOAuthRevokeTokenFetched(data, status, response_code);
688 } else { 692 } else {
689 NOTREACHED(); 693 NOTREACHED();
690 } 694 }
691 } 695 }
692 696
693 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { 697 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) {
694 return fetch_step <= auto_fetch_limit_; 698 return fetch_step <= auto_fetch_limit_;
695 } 699 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698