| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/pdf/pdf_tab_helper.h" | 5 #include "chrome/browser/ui/pdf/pdf_tab_helper.h" |
| 6 | 6 |
| 7 #include "components/web_modal/web_contents_modal_dialog_host.h" | 7 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 8 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 8 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 9 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 message_box_view_ = new views::MessageBoxView(init_params); | 67 message_box_view_ = new views::MessageBoxView(init_params); |
| 68 message_box_view_->text_box()->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 68 message_box_view_->text_box()->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 69 | 69 |
| 70 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 70 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 71 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); | 71 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 72 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = | 72 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = |
| 73 web_contents_modal_dialog_manager->delegate(); | 73 web_contents_modal_dialog_manager->delegate(); |
| 74 DCHECK(modal_delegate); | 74 DCHECK(modal_delegate); |
| 75 dialog_ = views::Widget::CreateWindowAsFramelessChild( | 75 dialog_ = views::Widget::CreateWindowAsFramelessChild( |
| 76 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 76 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 77 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); | 77 web_contents_modal_dialog_manager->ShowWebModalDialog( |
| 78 dialog_->GetNativeView()); |
| 78 } | 79 } |
| 79 | 80 |
| 80 PDFPasswordDialogViews::~PDFPasswordDialogViews() { | 81 PDFPasswordDialogViews::~PDFPasswordDialogViews() { |
| 81 if (!callback_.is_null()) { | 82 if (!callback_.is_null()) { |
| 82 // This dialog was torn down without either OK or cancel being clicked; be | 83 // This dialog was torn down without either OK or cancel being clicked; be |
| 83 // considerate and at least do the callback. | 84 // considerate and at least do the callback. |
| 84 callback_.Run(false, base::string16()); | 85 callback_.Run(false, base::string16()); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 #endif | 145 #endif |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace | 148 } // namespace |
| 148 | 149 |
| 149 void ShowPDFPasswordDialog(content::WebContents* web_contents, | 150 void ShowPDFPasswordDialog(content::WebContents* web_contents, |
| 150 const base::string16& prompt, | 151 const base::string16& prompt, |
| 151 const PasswordDialogClosedCallback& callback) { | 152 const PasswordDialogClosedCallback& callback) { |
| 152 new PDFPasswordDialogViews(web_contents, prompt, callback); | 153 new PDFPasswordDialogViews(web_contents, prompt, callback); |
| 153 } | 154 } |
| OLD | NEW |