| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 WebContents* requesting_contents = GetWebContentsForLogin(); | 145 WebContents* requesting_contents = GetWebContentsForLogin(); |
| 146 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 146 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 147 WebContentsModalDialogManager::FromWebContents(requesting_contents); | 147 WebContentsModalDialogManager::FromWebContents(requesting_contents); |
| 148 WebContentsModalDialogManagerDelegate* modal_delegate = | 148 WebContentsModalDialogManagerDelegate* modal_delegate = |
| 149 web_contents_modal_dialog_manager->delegate(); | 149 web_contents_modal_dialog_manager->delegate(); |
| 150 CHECK(modal_delegate); | 150 CHECK(modal_delegate); |
| 151 dialog_ = views::Widget::CreateWindowAsFramelessChild( | 151 dialog_ = views::Widget::CreateWindowAsFramelessChild( |
| 152 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 152 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 153 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); | 153 web_contents_modal_dialog_manager->ShowWebModalDialog( |
| 154 dialog_->GetNativeView()); |
| 154 NotifyAuthNeeded(); | 155 NotifyAuthNeeded(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 virtual void CloseDialog() OVERRIDE { | 158 virtual void CloseDialog() OVERRIDE { |
| 158 // The hosting widget may have been freed. | 159 // The hosting widget may have been freed. |
| 159 if (dialog_) | 160 if (dialog_) |
| 160 dialog_->Close(); | 161 dialog_->Close(); |
| 161 } | 162 } |
| 162 | 163 |
| 163 private: | 164 private: |
| 164 friend class base::RefCountedThreadSafe<LoginHandlerViews>; | 165 friend class base::RefCountedThreadSafe<LoginHandlerViews>; |
| 165 friend class LoginPrompt; | 166 friend class LoginPrompt; |
| 166 | 167 |
| 167 virtual ~LoginHandlerViews() {} | 168 virtual ~LoginHandlerViews() {} |
| 168 | 169 |
| 169 // The LoginView that contains the user's login information | 170 // The LoginView that contains the user's login information |
| 170 LoginView* login_view_; | 171 LoginView* login_view_; |
| 171 | 172 |
| 172 views::Widget* dialog_; | 173 views::Widget* dialog_; |
| 173 | 174 |
| 174 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); | 175 DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews); |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 // static | 178 // static |
| 178 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 179 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 179 net::URLRequest* request) { | 180 net::URLRequest* request) { |
| 180 return new LoginHandlerViews(auth_info, request); | 181 return new LoginHandlerViews(auth_info, request); |
| 181 } | 182 } |
| OLD | NEW |