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

Side by Side Diff: chrome/browser/ui/login/login_prompt.cc

Issue 9580002: Add ResourceRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/ui/login/login_prompt.h" 5 #include "chrome/browser/ui/login/login_prompt.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/password_manager/password_manager.h" 13 #include "chrome/browser/password_manager/password_manager.h"
14 #include "chrome/browser/tab_contents/tab_util.h" 14 #include "chrome/browser/tab_contents/tab_util.h"
15 #include "chrome/browser/ui/constrained_window.h" 15 #include "chrome/browser/ui/constrained_window.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
18 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/renderer_host/resource_dispatcher_host.h" 19 #include "content/browser/renderer_host/resource_dispatcher_host.h"
20 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 20 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/render_view_host_delegate.h" 24 #include "content/public/browser/render_view_host_delegate.h"
25 #include "content/public/browser/resource_request_info.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
27 #include "net/base/auth.h" 28 #include "net/base/auth.h"
28 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
29 #include "net/http/http_transaction_factory.h" 30 #include "net/http/http_transaction_factory.h"
30 #include "net/url_request/url_request.h" 31 #include "net/url_request/url_request.h"
31 #include "net/url_request/url_request_context.h" 32 #include "net/url_request/url_request_context.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/text/text_elider.h" 34 #include "ui/base/text/text_elider.h"
34 35
35 using content::BrowserThread; 36 using content::BrowserThread;
36 using content::NavigationController; 37 using content::NavigationController;
37 using content::RenderViewHostDelegate; 38 using content::RenderViewHostDelegate;
39 using content::ResourceRequestInfo;
38 using content::WebContents; 40 using content::WebContents;
39 using webkit::forms::PasswordForm; 41 using webkit::forms::PasswordForm;
40 42
41 class LoginHandlerImpl; 43 class LoginHandlerImpl;
42 44
43 // Helper to remove the ref from an net::URLRequest to the LoginHandler. 45 // Helper to remove the ref from an net::URLRequest to the LoginHandler.
44 // Should only be called from the IO thread, since it accesses an 46 // Should only be called from the IO thread, since it accesses an
45 // net::URLRequest. 47 // net::URLRequest.
46 void ResetLoginHandlerForRequest(net::URLRequest* request) { 48 void ResetLoginHandlerForRequest(net::URLRequest* request) {
47 ResourceDispatcherHostRequestInfo* info = 49 ResourceDispatcherHostRequestInfo* info =
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // later, so wait with loading the nib until then. 96 // later, so wait with loading the nib until then.
95 DCHECK(request_) << "LoginHandler constructed with NULL request"; 97 DCHECK(request_) << "LoginHandler constructed with NULL request";
96 DCHECK(auth_info_) << "LoginHandler constructed with NULL auth info"; 98 DCHECK(auth_info_) << "LoginHandler constructed with NULL auth info";
97 99
98 AddRef(); // matched by LoginHandler::ReleaseSoon(). 100 AddRef(); // matched by LoginHandler::ReleaseSoon().
99 101
100 BrowserThread::PostTask( 102 BrowserThread::PostTask(
101 BrowserThread::UI, FROM_HERE, 103 BrowserThread::UI, FROM_HERE,
102 base::Bind(&LoginHandler::AddObservers, this)); 104 base::Bind(&LoginHandler::AddObservers, this));
103 105
104 if (!ResourceDispatcherHost::RenderViewForRequest( 106 if (!ResourceRequestInfo::ForRequest(request_)->GetAssociatedRenderView(
105 request_, &render_process_host_id_, &tab_contents_id_)) { 107 &render_process_host_id_, &tab_contents_id_)) {
106 NOTREACHED(); 108 NOTREACHED();
107 } 109 }
108 } 110 }
109 111
110 LoginHandler::~LoginHandler() { 112 LoginHandler::~LoginHandler() {
111 SetModel(NULL); 113 SetModel(NULL);
112 } 114 }
113 115
114 void LoginHandler::SetPasswordForm(const webkit::forms::PasswordForm& form) { 116 void LoginHandler::SetPasswordForm(const webkit::forms::PasswordForm& form) {
115 password_form_ = form; 117 password_form_ = form;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 481
480 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 482 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
481 net::URLRequest* request) { 483 net::URLRequest* request) {
482 LoginHandler* handler = LoginHandler::Create(auth_info, request); 484 LoginHandler* handler = LoginHandler::Create(auth_info, request);
483 BrowserThread::PostTask( 485 BrowserThread::PostTask(
484 BrowserThread::UI, FROM_HERE, 486 BrowserThread::UI, FROM_HERE,
485 base::Bind(&LoginDialogCallback, request->url(), 487 base::Bind(&LoginDialogCallback, request->url(),
486 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); 488 make_scoped_refptr(auth_info), make_scoped_refptr(handler)));
487 return handler; 489 return handler;
488 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698