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

Side by Side Diff: chrome/browser/chromeos/login/cookie_fetcher.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 1 month 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/chromeos/login/auth_response_handler.h" 12 #include "chrome/browser/chromeos/login/auth_response_handler.h"
13 #include "chrome/browser/chromeos/login/client_login_response_handler.h" 13 #include "chrome/browser/chromeos/login/client_login_response_handler.h"
14 #include "chrome/browser/chromeos/login/issue_response_handler.h" 14 #include "chrome/browser/chromeos/login/issue_response_handler.h"
15 #include "content/common/net/url_fetcher.h" 15
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 // Given a SID/LSID pair, this class will attempt to turn them into a 21 // Given a SID/LSID pair, this class will attempt to turn them into a
22 // full-fledged set of Google AuthN cookies. 22 // full-fledged set of Google AuthN cookies.
23 // 23 //
24 // A CookieFetcher manages its own lifecycle. It deletes itself once it's 24 // A CookieFetcher manages its own lifecycle. It deletes itself once it's
25 // done attempting to fetch URLs. 25 // done attempting to fetch URLs.
26 class CookieFetcher : public URLFetcher::Delegate { 26 class CookieFetcher : public content::URLFetcherDelegate {
27 public: 27 public:
28 // |profile| is the Profile whose cookie jar you want the cookies in. 28 // |profile| is the Profile whose cookie jar you want the cookies in.
29 explicit CookieFetcher(Profile* profile); 29 explicit CookieFetcher(Profile* profile);
30 30
31 // |profile| is the Profile whose cookie jar you want the cookies in. 31 // |profile| is the Profile whose cookie jar you want the cookies in.
32 // Takes ownership of |cl_handler|, |i_handler|, and |launcher|. 32 // Takes ownership of |cl_handler|, |i_handler|, and |launcher|.
33 CookieFetcher(Profile* profile, 33 CookieFetcher(Profile* profile,
34 AuthResponseHandler* cl_handler, 34 AuthResponseHandler* cl_handler,
35 AuthResponseHandler* i_handler); 35 AuthResponseHandler* i_handler);
36 36
37 // Given a newline-delineated SID/LSID pair of Google cookies (like 37 // Given a newline-delineated SID/LSID pair of Google cookies (like
38 // those that come back from ClientLogin), try to use them to fetch 38 // those that come back from ClientLogin), try to use them to fetch
39 // a full-fledged set of Google AuthN cookies. These cookies will wind up 39 // a full-fledged set of Google AuthN cookies. These cookies will wind up
40 // stored in the cookie jar associated with |profile_|, if we get them. 40 // stored in the cookie jar associated with |profile_|, if we get them.
41 // Either way, we end up by calling launcher_->DoLaunch() 41 // Either way, we end up by calling launcher_->DoLaunch()
42 void AttemptFetch(const std::string& credentials); 42 void AttemptFetch(const std::string& credentials);
43 43
44 // Overloaded from URLFetcher::Delegate. 44 // Overloaded from content::URLFetcherDelegate.
45 virtual void OnURLFetchComplete(const URLFetcher* source, 45 virtual void OnURLFetchComplete(const URLFetcher* source);
46 const GURL& url,
47 const net::URLRequestStatus& status,
48 int response_code,
49 const net::ResponseCookies& cookies,
50 const std::string& data);
51 46
52 private: 47 private:
53 virtual ~CookieFetcher(); 48 virtual ~CookieFetcher();
54 49
55 scoped_ptr<URLFetcher> fetcher_; 50 scoped_ptr<URLFetcher> fetcher_;
56 Profile* profile_; 51 Profile* profile_;
57 scoped_ptr<AuthResponseHandler> client_login_handler_; 52 scoped_ptr<AuthResponseHandler> client_login_handler_;
58 scoped_ptr<AuthResponseHandler> issue_handler_; 53 scoped_ptr<AuthResponseHandler> issue_handler_;
59 54
60 DISALLOW_COPY_AND_ASSIGN(CookieFetcher); 55 DISALLOW_COPY_AND_ASSIGN(CookieFetcher);
61 }; 56 };
62 57
63 } // namespace chromeos 58 } // namespace chromeos
64 59
65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_ 60 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_COOKIE_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698