OLD | NEW |
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 "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/ui/views/login_view.h" | 9 #include "chrome/browser/ui/views/login_view.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return login_view_->GetInitiallyFocusedView(); | 93 return login_view_->GetInitiallyFocusedView(); |
94 } | 94 } |
95 | 95 |
96 views::View* GetContentsView() override { return login_view_; } | 96 views::View* GetContentsView() override { return login_view_; } |
97 views::Widget* GetWidget() override { return login_view_->GetWidget(); } | 97 views::Widget* GetWidget() override { return login_view_->GetWidget(); } |
98 const views::Widget* GetWidget() const override { | 98 const views::Widget* GetWidget() const override { |
99 return login_view_->GetWidget(); | 99 return login_view_->GetWidget(); |
100 } | 100 } |
101 | 101 |
102 // LoginHandler: | 102 // LoginHandler: |
103 void BuildViewImpl(const base::string16& explanation, | 103 void BuildViewImpl(const base::string16& authority, |
| 104 const base::string16& explanation, |
104 LoginModelData* login_model_data) override { | 105 LoginModelData* login_model_data) override { |
105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
106 | 107 |
107 // Create a new LoginView and set the model for it. The model (password | 108 // Create a new LoginView and set the model for it. The model (password |
108 // manager) is owned by the WebContents, but the view is parented to the | 109 // manager) is owned by the WebContents, but the view is parented to the |
109 // browser window, so the view may be destroyed after the password | 110 // browser window, so the view may be destroyed after the password |
110 // manager. The view listens for model destruction and unobserves | 111 // manager. The view listens for model destruction and unobserves |
111 // accordingly. | 112 // accordingly. |
112 login_view_ = new LoginView(explanation, login_model_data); | 113 login_view_ = new LoginView(authority, explanation, login_model_data); |
113 | 114 |
114 // Scary thread safety note: This can potentially be called *after* SetAuth | 115 // Scary thread safety note: This can potentially be called *after* SetAuth |
115 // or CancelAuth (say, if the request was cancelled before the UI thread got | 116 // or CancelAuth (say, if the request was cancelled before the UI thread got |
116 // control). However, that's OK since any UI interaction in those functions | 117 // control). However, that's OK since any UI interaction in those functions |
117 // will occur via an InvokeLater on the UI thread, which is guaranteed | 118 // will occur via an InvokeLater on the UI thread, which is guaranteed |
118 // to happen after this is called (since this was InvokeLater'd first). | 119 // to happen after this is called (since this was InvokeLater'd first). |
119 dialog_ = constrained_window::ShowWebModalDialogViews( | 120 dialog_ = constrained_window::ShowWebModalDialogViews( |
120 this, GetWebContentsForLogin()); | 121 this, GetWebContentsForLogin()); |
121 NotifyAuthNeeded(); | 122 NotifyAuthNeeded(); |
122 } | 123 } |
(...skipping 19 matching lines...) Expand all Loading... |
142 }; | 143 }; |
143 | 144 |
144 namespace chrome { | 145 namespace chrome { |
145 | 146 |
146 LoginHandler* CreateLoginHandlerViews(net::AuthChallengeInfo* auth_info, | 147 LoginHandler* CreateLoginHandlerViews(net::AuthChallengeInfo* auth_info, |
147 net::URLRequest* request) { | 148 net::URLRequest* request) { |
148 return new LoginHandlerViews(auth_info, request); | 149 return new LoginHandlerViews(auth_info, request); |
149 } | 150 } |
150 | 151 |
151 } // namespace chrome | 152 } // namespace chrome |
OLD | NEW |