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

Side by Side Diff: chrome/browser/chromeos/login/issue_response_handler.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/login/issue_response_handler.h" 5 #include "chrome/browser/chromeos/login/issue_response_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/net/chrome_url_request_context.h" 10 #include "chrome/browser/net/chrome_url_request_context.h"
11 #include "chrome/common/net/gaia/gaia_urls.h" 11 #include "chrome/common/net/gaia/gaia_urls.h"
12 #include "content/public/common/content_url_request_user_data.h"
12 #include "content/public/common/url_fetcher.h" 13 #include "content/public/common/url_fetcher.h"
13 #include "net/base/load_flags.h" 14 #include "net/base/load_flags.h"
14 15
15 namespace chromeos { 16 namespace chromeos {
16 17
17 // Overridden from AuthResponseHandler. 18 // Overridden from AuthResponseHandler.
18 bool IssueResponseHandler::CanHandle(const GURL& url) { 19 bool IssueResponseHandler::CanHandle(const GURL& url) {
19 return (url.spec().find(GaiaUrls::GetInstance()->issue_auth_token_url()) != 20 return (url.spec().find(GaiaUrls::GetInstance()->issue_auth_token_url()) !=
20 std::string::npos); 21 std::string::npos);
21 } 22 }
22 23
23 // Overridden from AuthResponseHandler. 24 // Overridden from AuthResponseHandler.
24 content::URLFetcher* IssueResponseHandler::Handle( 25 content::URLFetcher* IssueResponseHandler::Handle(
25 const std::string& to_process, 26 const std::string& to_process,
26 content::URLFetcherDelegate* catcher) { 27 content::URLFetcherDelegate* catcher) {
27 VLOG(1) << "Handling IssueAuthToken response"; 28 VLOG(1) << "Handling IssueAuthToken response";
28 token_url_.assign(BuildTokenAuthUrlWithToken(to_process)); 29 token_url_.assign(BuildTokenAuthUrlWithToken(to_process));
29 content::URLFetcher* fetcher = content::URLFetcher::Create( 30 content::URLFetcher* fetcher = content::URLFetcher::Create(
30 GURL(token_url_), content::URLFetcher::GET, catcher); 31 GURL(token_url_), content::URLFetcher::GET, catcher);
31 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); 32 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
32 if (getter_) { 33 if (getter_) {
33 VLOG(1) << "Fetching " << GaiaUrls::GetInstance()->token_auth_url(); 34 VLOG(1) << "Fetching " << GaiaUrls::GetInstance()->token_auth_url();
34 fetcher->SetRequestContext(getter_); 35 fetcher->SetRequestContext(getter_);
36 // TODO(jochen): Do cookie audit.
37 fetcher->SetContentURLRequestUserData(
38 new content::ContentURLRequestUserData());
35 fetcher->Start(); 39 fetcher->Start();
36 } 40 }
37 return fetcher; 41 return fetcher;
38 } 42 }
39 43
40 // static 44 // static
41 std::string IssueResponseHandler::BuildTokenAuthUrlWithToken( 45 std::string IssueResponseHandler::BuildTokenAuthUrlWithToken(
42 const std::string& token) { 46 const std::string& token) {
43 const char kUrlFormat[] = "%s?" 47 const char kUrlFormat[] = "%s?"
44 "continue=http://www.google.com/webhp&" 48 "continue=http://www.google.com/webhp&"
45 "source=chromeos&" 49 "source=chromeos&"
46 "auth=%s"; 50 "auth=%s";
47 return base::StringPrintf(kUrlFormat, 51 return base::StringPrintf(kUrlFormat,
48 GaiaUrls::GetInstance()->token_auth_url().c_str(), 52 GaiaUrls::GetInstance()->token_auth_url().c_str(),
49 token.c_str()); 53 token.c_str());
50 } 54 }
51 55
52 } // namespace chromeos 56 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698