| 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/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
| 10 #include "chrome/browser/ui/views/login_view.h" | 10 #include "chrome/browser/ui/views/login_view.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // browser window, so the view may be destroyed after the password | 135 // browser window, so the view may be destroyed after the password |
| 136 // manager. The view listens for model destruction and unobserves | 136 // manager. The view listens for model destruction and unobserves |
| 137 // accordingly. | 137 // accordingly. |
| 138 login_view_ = new LoginView(explanation, manager); | 138 login_view_ = new LoginView(explanation, manager); |
| 139 | 139 |
| 140 // Scary thread safety note: This can potentially be called *after* SetAuth | 140 // Scary thread safety note: This can potentially be called *after* SetAuth |
| 141 // or CancelAuth (say, if the request was cancelled before the UI thread got | 141 // or CancelAuth (say, if the request was cancelled before the UI thread got |
| 142 // control). However, that's OK since any UI interaction in those functions | 142 // control). However, that's OK since any UI interaction in those functions |
| 143 // will occur via an InvokeLater on the UI thread, which is guaranteed | 143 // will occur via an InvokeLater on the UI thread, which is guaranteed |
| 144 // to happen after this is called (since this was InvokeLater'd first). | 144 // to happen after this is called (since this was InvokeLater'd first). |
| 145 // TODO(gbillock): Use PopupManager here. |
| 145 WebContents* requesting_contents = GetWebContentsForLogin(); | 146 WebContents* requesting_contents = GetWebContentsForLogin(); |
| 146 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 147 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 147 WebContentsModalDialogManager::FromWebContents(requesting_contents); | 148 WebContentsModalDialogManager::FromWebContents(requesting_contents); |
| 148 WebContentsModalDialogManagerDelegate* modal_delegate = | 149 WebContentsModalDialogManagerDelegate* modal_delegate = |
| 149 web_contents_modal_dialog_manager->delegate(); | 150 web_contents_modal_dialog_manager->delegate(); |
| 150 CHECK(modal_delegate); | 151 CHECK(modal_delegate); |
| 151 dialog_ = views::Widget::CreateWindowAsFramelessChild( | 152 dialog_ = views::Widget::CreateWindowAsFramelessChild( |
| 152 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 153 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 153 web_contents_modal_dialog_manager->ShowModalDialog( | 154 web_contents_modal_dialog_manager->ShowModalDialog( |
| 154 dialog_->GetNativeView()); | 155 dialog_->GetNativeView()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 173 views::Widget* dialog_; | 174 views::Widget* dialog_; |
| 174 | 175 |
| 175 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); | 176 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 // static | 179 // static |
| 179 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 180 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 180 net::URLRequest* request) { | 181 net::URLRequest* request) { |
| 181 return new LoginHandlerViews(auth_info, request); | 182 return new LoginHandlerViews(auth_info, request); |
| 182 } | 183 } |
| OLD | NEW |