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

Side by Side Diff: chrome/browser/login_prompt.h

Issue 345037: Fifth patch in getting rid of caching MessageLoop pointers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_LOGIN_PROMPT_H_ 5 #ifndef CHROME_BROWSER_LOGIN_PROMPT_H_
6 #define CHROME_BROWSER_LOGIN_PROMPT_H_ 6 #define CHROME_BROWSER_LOGIN_PROMPT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 11
12 namespace net { 12 namespace net {
13 class AuthChallengeInfo; 13 class AuthChallengeInfo;
14 } 14 }
15 15
16 namespace webkit_glue { 16 namespace webkit_glue {
17 struct PasswordForm; 17 struct PasswordForm;
18 } 18 }
19 19
20 class ConstrainedWindow; 20 class ConstrainedWindow;
21 class GURL; 21 class GURL;
22 class MessageLoop;
23 class PasswordManager; 22 class PasswordManager;
24 class TabContents; 23 class TabContents;
25 class URLRequest; 24 class URLRequest;
26 25
27 // This is the interface for the class that routes authentication info to 26 // This is the interface for the class that routes authentication info to
28 // the URLRequest that needs it. Used by the automation proxy for testing. 27 // the URLRequest that needs it. Used by the automation proxy for testing.
29 // These functions should be (and are, in LoginHandlerImpl) implemented in 28 // These functions should be (and are, in LoginHandlerImpl) implemented in
30 // a thread safe manner. 29 // a thread safe manner.
31 // 30 //
32 // TODO(erg): Refactor the common code from all LoginHandler subclasses into a 31 // TODO(erg): Refactor the common code from all LoginHandler subclasses into a
33 // common controller class. All the methods below have the same copy/pasted 32 // common controller class. All the methods below have the same copy/pasted
34 // implementation. This is more difficult then it should be because all these 33 // implementation. This is more difficult then it should be because all these
35 // subclasses are also base::RefCountedThreadSafe<> and I'm not sure how to get 34 // subclasses are also base::RefCountedThreadSafe<> and I'm not sure how to get
36 // ownership correct. http://crbug.com/14909 35 // ownership correct. http://crbug.com/14909
37 class LoginHandler { 36 class LoginHandler {
38 public: 37 public:
39 // Builds the platform specific LoginHandler. Used from within 38 // Builds the platform specific LoginHandler. Used from within
40 // CreateLoginPrompt() which creates tasks. 39 // CreateLoginPrompt() which creates tasks.
41 static LoginHandler* Create(URLRequest* request, MessageLoop* ui_loop); 40 static LoginHandler* Create(URLRequest* request);
42 41
43 // Initializes the underlying platform specific view. 42 // Initializes the underlying platform specific view.
44 virtual void BuildViewForPasswordManager(PasswordManager* manager, 43 virtual void BuildViewForPasswordManager(PasswordManager* manager,
45 std::wstring explanation) = 0; 44 std::wstring explanation) = 0;
46 45
47 // Sets information about the authentication type (|form|) and the 46 // Sets information about the authentication type (|form|) and the
48 // |password_manager| for this profile. 47 // |password_manager| for this profile.
49 virtual void SetPasswordForm(const webkit_glue::PasswordForm& form) = 0; 48 virtual void SetPasswordForm(const webkit_glue::PasswordForm& form) = 0;
50 virtual void SetPasswordManager(PasswordManager* password_manager) = 0; 49 virtual void SetPasswordManager(PasswordManager* password_manager) = 0;
51 50
(...skipping 25 matching lines...) Expand all
77 LoginNotificationDetails() {} 76 LoginNotificationDetails() {}
78 77
79 LoginHandler* handler_; // Where to send the response. 78 LoginHandler* handler_; // Where to send the response.
80 79
81 DISALLOW_COPY_AND_ASSIGN(LoginNotificationDetails); 80 DISALLOW_COPY_AND_ASSIGN(LoginNotificationDetails);
82 }; 81 };
83 82
84 // Prompts the user for their username and password. This is designed to 83 // Prompts the user for their username and password. This is designed to
85 // be called on the background (I/O) thread, in response to 84 // be called on the background (I/O) thread, in response to
86 // URLRequest::Delegate::OnAuthRequired. The prompt will be created 85 // URLRequest::Delegate::OnAuthRequired. The prompt will be created
87 // on the main UI thread via a call to ui_loop's InvokeLater, and will send the 86 // on the main UI thread via a call to UI loop's InvokeLater, and will send the
88 // credentials back to the URLRequest on the calling thread. 87 // credentials back to the URLRequest on the calling thread.
89 // A LoginHandler object (which lives on the calling thread) is returned, 88 // A LoginHandler object (which lives on the calling thread) is returned,
90 // which can be used to set or cancel authentication programmatically. The 89 // which can be used to set or cancel authentication programmatically. The
91 // caller must invoke OnRequestCancelled() on this LoginHandler before 90 // caller must invoke OnRequestCancelled() on this LoginHandler before
92 // destroying the URLRequest. 91 // destroying the URLRequest.
93 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 92 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
94 URLRequest* request, 93 URLRequest* request);
95 MessageLoop* ui_loop);
96 94
97 // Helper to remove the ref from an URLRequest to the LoginHandler. 95 // Helper to remove the ref from an URLRequest to the LoginHandler.
98 // Should only be called from the IO thread, since it accesses an URLRequest. 96 // Should only be called from the IO thread, since it accesses an URLRequest.
99 void ResetLoginHandlerForRequest(URLRequest* request); 97 void ResetLoginHandlerForRequest(URLRequest* request);
100 98
101 // Get the signon_realm under which the identity should be saved. 99 // Get the signon_realm under which the identity should be saved.
102 std::string GetSignonRealm(const GURL& url, 100 std::string GetSignonRealm(const GURL& url,
103 const net::AuthChallengeInfo& auth_info); 101 const net::AuthChallengeInfo& auth_info);
104 102
105 #endif // CHROME_BROWSER_LOGIN_PROMPT_H_ 103 #endif // CHROME_BROWSER_LOGIN_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698