| 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/password_manager/password_manager.h" | 9 #include "chrome/browser/password_manager/password_manager.h" |
| 10 #include "chrome/browser/tab_contents/tab_util.h" | 10 #include "chrome/browser/tab_contents/tab_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 156 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 157 WebContentsModalDialogManager::FromWebContents(requesting_contents); | 157 WebContentsModalDialogManager::FromWebContents(requesting_contents); |
| 158 WebContentsModalDialogManagerDelegate* modal_delegate = | 158 WebContentsModalDialogManagerDelegate* modal_delegate = |
| 159 web_contents_modal_dialog_manager->delegate(); | 159 web_contents_modal_dialog_manager->delegate(); |
| 160 DCHECK(modal_delegate); | 160 DCHECK(modal_delegate); |
| 161 dialog_ = views::Widget::CreateWindowAsFramelessChild( | 161 dialog_ = views::Widget::CreateWindowAsFramelessChild( |
| 162 this, | 162 this, |
| 163 requesting_contents->GetView()->GetNativeView(), | 163 requesting_contents->GetView()->GetNativeView(), |
| 164 modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 164 modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 165 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); | 165 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); |
| 166 web_contents_modal_dialog_manager->SetCloseOnInterstitialWebUI( |
| 167 dialog_->GetNativeView(), true); |
| 166 NotifyAuthNeeded(); | 168 NotifyAuthNeeded(); |
| 167 } | 169 } |
| 168 | 170 |
| 169 virtual void CloseDialog() OVERRIDE { | 171 virtual void CloseDialog() OVERRIDE { |
| 170 // The hosting widget may have been freed. | 172 // The hosting widget may have been freed. |
| 171 if (dialog_) | 173 if (dialog_) |
| 172 dialog_->Close(); | 174 dialog_->Close(); |
| 173 } | 175 } |
| 174 | 176 |
| 175 private: | 177 private: |
| 176 friend class base::RefCountedThreadSafe<LoginHandlerViews>; | 178 friend class base::RefCountedThreadSafe<LoginHandlerViews>; |
| 177 friend class LoginPrompt; | 179 friend class LoginPrompt; |
| 178 | 180 |
| 179 virtual ~LoginHandlerViews() {} | 181 virtual ~LoginHandlerViews() {} |
| 180 | 182 |
| 181 // The LoginView that contains the user's login information | 183 // The LoginView that contains the user's login information |
| 182 LoginView* login_view_; | 184 LoginView* login_view_; |
| 183 | 185 |
| 184 views::Widget* dialog_; | 186 views::Widget* dialog_; |
| 185 | 187 |
| 186 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); | 188 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); |
| 187 }; | 189 }; |
| 188 | 190 |
| 189 // static | 191 // static |
| 190 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 192 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 191 net::URLRequest* request) { | 193 net::URLRequest* request) { |
| 192 return new LoginHandlerViews(auth_info, request); | 194 return new LoginHandlerViews(auth_info, request); |
| 193 } | 195 } |
| OLD | NEW |