| 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 "chrome/browser/ui/views/constrained_window_views.h" | 7 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 8 #include "components/web_modal/web_contents_modal_dialog_host.h" | 8 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const PasswordDialogClosedCallback& callback) | 63 const PasswordDialogClosedCallback& callback) |
| 64 : message_box_view_(NULL), | 64 : message_box_view_(NULL), |
| 65 dialog_(NULL), | 65 dialog_(NULL), |
| 66 browser_context_(web_contents->GetBrowserContext()), | 66 browser_context_(web_contents->GetBrowserContext()), |
| 67 callback_(callback) { | 67 callback_(callback) { |
| 68 views::MessageBoxView::InitParams init_params(prompt); | 68 views::MessageBoxView::InitParams init_params(prompt); |
| 69 init_params.options = views::MessageBoxView::HAS_PROMPT_FIELD; | 69 init_params.options = views::MessageBoxView::HAS_PROMPT_FIELD; |
| 70 init_params.inter_row_vertical_spacing = | 70 init_params.inter_row_vertical_spacing = |
| 71 views::kUnrelatedControlVerticalSpacing; | 71 views::kUnrelatedControlVerticalSpacing; |
| 72 message_box_view_ = new views::MessageBoxView(init_params); | 72 message_box_view_ = new views::MessageBoxView(init_params); |
| 73 | 73 message_box_view_->text_box()->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 74 message_box_view_->text_box()->SetObscured(true); | |
| 75 | 74 |
| 76 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 75 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 77 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); | 76 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 78 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = | 77 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = |
| 79 web_contents_modal_dialog_manager->delegate(); | 78 web_contents_modal_dialog_manager->delegate(); |
| 80 DCHECK(modal_delegate); | 79 DCHECK(modal_delegate); |
| 81 dialog_ = views::Widget::CreateWindowAsFramelessChild( | 80 dialog_ = views::Widget::CreateWindowAsFramelessChild( |
| 82 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 81 this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); |
| 83 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); | 82 web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); |
| 84 } | 83 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 #endif | 156 #endif |
| 158 } | 157 } |
| 159 | 158 |
| 160 } // namespace | 159 } // namespace |
| 161 | 160 |
| 162 void ShowPDFPasswordDialog(content::WebContents* web_contents, | 161 void ShowPDFPasswordDialog(content::WebContents* web_contents, |
| 163 const base::string16& prompt, | 162 const base::string16& prompt, |
| 164 const PasswordDialogClosedCallback& callback) { | 163 const PasswordDialogClosedCallback& callback) { |
| 165 new PDFPasswordDialogViews(web_contents, prompt, callback); | 164 new PDFPasswordDialogViews(web_contents, prompt, callback); |
| 166 } | 165 } |
| OLD | NEW |