OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/utf_string_conversions.h" |
7 #include "chrome/browser/browser_thread.h" | 8 #include "chrome/browser/browser_thread.h" |
8 #include "chrome/browser/password_manager/password_manager.h" | 9 #include "chrome/browser/password_manager/password_manager.h" |
9 #include "chrome/browser/renderer_host/render_process_host.h" | 10 #include "chrome/browser/renderer_host/render_process_host.h" |
10 #include "chrome/browser/renderer_host/render_view_host.h" | 11 #include "chrome/browser/renderer_host/render_view_host.h" |
11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 12 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
12 #include "chrome/browser/tab_contents/navigation_controller.h" | 13 #include "chrome/browser/tab_contents/navigation_controller.h" |
13 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
14 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
15 #include "chrome/browser/tab_contents/tab_util.h" | 16 #include "chrome/browser/tab_contents/tab_util.h" |
16 #include "chrome/browser/ui/views/login_view.h" | 17 #include "chrome/browser/ui/views/login_view.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return true; | 95 return true; |
95 } | 96 } |
96 | 97 |
97 virtual views::View* GetContentsView() { | 98 virtual views::View* GetContentsView() { |
98 return login_view_; | 99 return login_view_; |
99 } | 100 } |
100 | 101 |
101 // LoginHandler: | 102 // LoginHandler: |
102 | 103 |
103 virtual void BuildViewForPasswordManager(PasswordManager* manager, | 104 virtual void BuildViewForPasswordManager(PasswordManager* manager, |
104 std::wstring explanation) { | 105 const string16& explanation) { |
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
106 | 107 |
107 TabContents* tab_contents = GetTabContentsForLogin(); | 108 TabContents* tab_contents = GetTabContentsForLogin(); |
108 bool should_focus_view = !tab_contents->delegate() || | 109 bool should_focus_view = !tab_contents->delegate() || |
109 tab_contents->delegate()->ShouldFocusConstrainedWindow(); | 110 tab_contents->delegate()->ShouldFocusConstrainedWindow(); |
110 | 111 |
111 LoginView* view = new LoginView(explanation, should_focus_view); | 112 LoginView* view = new LoginView(UTF16ToWideHack(explanation), |
| 113 should_focus_view); |
112 | 114 |
113 // Set the model for the login view. The model (password manager) is owned | 115 // Set the model for the login view. The model (password manager) is owned |
114 // by the view's parent TabContents, so natural destruction order means we | 116 // by the view's parent TabContents, so natural destruction order means we |
115 // don't have to worry about calling SetModel(NULL), because the view will | 117 // don't have to worry about calling SetModel(NULL), because the view will |
116 // be deleted before the password manager. | 118 // be deleted before the password manager. |
117 view->SetModel(manager); | 119 view->SetModel(manager); |
118 | 120 |
119 set_login_view(view); | 121 set_login_view(view); |
120 | 122 |
121 // Scary thread safety note: This can potentially be called *after* SetAuth | 123 // Scary thread safety note: This can potentially be called *after* SetAuth |
(...skipping 15 matching lines...) Expand all Loading... |
137 LoginView* login_view_; | 139 LoginView* login_view_; |
138 | 140 |
139 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); | 141 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); |
140 }; | 142 }; |
141 | 143 |
142 // static | 144 // static |
143 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 145 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
144 net::URLRequest* request) { | 146 net::URLRequest* request) { |
145 return new LoginHandlerWin(auth_info, request); | 147 return new LoginHandlerWin(auth_info, request); |
146 } | 148 } |
OLD | NEW |