OLD | NEW |
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/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 "base/utf_string_conversions.h" |
8 #include "chrome/browser/password_manager/password_manager.h" | 8 #include "chrome/browser/password_manager/password_manager.h" |
9 #include "chrome/browser/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "chrome/browser/ui/views/constrained_window_views.h" | 11 #include "chrome/browser/ui/views/constrained_window_views.h" |
11 #include "chrome/browser/ui/views/login_view.h" | 12 #include "chrome/browser/ui/views/login_view.h" |
12 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
13 #include "content/browser/renderer_host/render_process_host.h" | 14 #include "content/browser/renderer_host/render_process_host.h" |
14 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
15 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 16 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // so natural destruction order means we don't have to worry about | 117 // so natural destruction order means we don't have to worry about |
117 // disassociating the model from the view, because the view will | 118 // disassociating the model from the view, because the view will |
118 // be deleted before the password manager. | 119 // be deleted before the password manager. |
119 login_view_ = new LoginView(UTF16ToWideHack(explanation), manager); | 120 login_view_ = new LoginView(UTF16ToWideHack(explanation), manager); |
120 | 121 |
121 // Scary thread safety note: This can potentially be called *after* SetAuth | 122 // Scary thread safety note: This can potentially be called *after* SetAuth |
122 // or CancelAuth (say, if the request was cancelled before the UI thread got | 123 // or CancelAuth (say, if the request was cancelled before the UI thread got |
123 // control). However, that's OK since any UI interaction in those functions | 124 // control). However, that's OK since any UI interaction in those functions |
124 // will occur via an InvokeLater on the UI thread, which is guaranteed | 125 // will occur via an InvokeLater on the UI thread, which is guaranteed |
125 // to happen after this is called (since this was InvokeLater'd first). | 126 // to happen after this is called (since this was InvokeLater'd first). |
126 SetDialog(new ConstrainedWindowViews(GetTabContentsForLogin(), this)); | 127 TabContents* requesting_contents = GetTabContentsForLogin(); |
| 128 TabContentsWrapper* wrapper = |
| 129 TabContentsWrapper::GetCurrentWrapperForContents(requesting_contents); |
| 130 SetDialog(new ConstrainedWindowViews(wrapper, this)); |
127 NotifyAuthNeeded(); | 131 NotifyAuthNeeded(); |
128 } | 132 } |
129 | 133 |
130 private: | 134 private: |
131 friend class base::RefCountedThreadSafe<LoginHandlerWin>; | 135 friend class base::RefCountedThreadSafe<LoginHandlerWin>; |
132 friend class LoginPrompt; | 136 friend class LoginPrompt; |
133 | 137 |
134 ~LoginHandlerWin() {} | 138 ~LoginHandlerWin() {} |
135 | 139 |
136 // The LoginView that contains the user's login information | 140 // The LoginView that contains the user's login information |
137 LoginView* login_view_; | 141 LoginView* login_view_; |
138 | 142 |
139 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); | 143 DISALLOW_COPY_AND_ASSIGN(LoginHandlerWin); |
140 }; | 144 }; |
141 | 145 |
142 // static | 146 // static |
143 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 147 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
144 net::URLRequest* request) { | 148 net::URLRequest* request) { |
145 return new LoginHandlerWin(auth_info, request); | 149 return new LoginHandlerWin(auth_info, request); |
146 } | 150 } |
OLD | NEW |