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/grit/generated_resources.h" | 5 #include "chrome/grit/generated_resources.h" |
6 #include "components/constrained_window/constrained_window_views.h" | 6 #include "components/constrained_window/constrained_window_views.h" |
7 #include "components/pdf/browser/pdf_web_contents_helper_client.h" | 7 #include "components/pdf/browser/pdf_web_contents_helper_client.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/views/controls/message_box_view.h" | 10 #include "ui/views/controls/message_box_view.h" |
11 #include "ui/views/controls/textfield/textfield.h" | 11 #include "ui/views/controls/textfield/textfield.h" |
12 #include "ui/views/layout/layout_constants.h" | 12 #include "ui/views/layout/layout_constants.h" |
13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
14 #include "ui/views/window/dialog_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Runs a tab-modal dialog that asks the user for a password. | 18 // Runs a tab-modal dialog that asks the user for a password. |
19 class PDFPasswordDialogViews : public views::DialogDelegate { | 19 class PDFPasswordDialogViews : public views::DialogDelegate { |
20 public: | 20 public: |
21 PDFPasswordDialogViews(content::WebContents* web_contents, | 21 PDFPasswordDialogViews(content::WebContents* web_contents, |
22 const base::string16& prompt, | 22 const base::string16& prompt, |
23 const pdf::PasswordDialogClosedCallback& callback); | 23 const pdf::PasswordDialogClosedCallback& callback); |
24 virtual ~PDFPasswordDialogViews(); | 24 ~PDFPasswordDialogViews() override; |
25 | 25 |
26 // views::DialogDelegate: | 26 // views::DialogDelegate: |
27 virtual base::string16 GetWindowTitle() const override; | 27 base::string16 GetWindowTitle() const override; |
28 virtual base::string16 GetDialogButtonLabel( | 28 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
29 ui::DialogButton button) const override; | 29 bool Cancel() override; |
30 virtual bool Cancel() override; | 30 bool Accept() override; |
31 virtual bool Accept() override; | |
32 | 31 |
33 // views::WidgetDelegate: | 32 // views::WidgetDelegate: |
34 virtual views::View* GetInitiallyFocusedView() override; | 33 views::View* GetInitiallyFocusedView() override; |
35 virtual views::View* GetContentsView() override; | 34 views::View* GetContentsView() override; |
36 virtual views::Widget* GetWidget() override; | 35 views::Widget* GetWidget() override; |
37 virtual const views::Widget* GetWidget() const override; | 36 const views::Widget* GetWidget() const override; |
38 virtual void DeleteDelegate() override; | 37 void DeleteDelegate() override; |
39 virtual ui::ModalType GetModalType() const override; | 38 ui::ModalType GetModalType() const override; |
40 | 39 |
41 private: | 40 private: |
42 // The message box view whose commands we handle. | 41 // The message box view whose commands we handle. |
43 views::MessageBoxView* message_box_view_; | 42 views::MessageBoxView* message_box_view_; |
44 | 43 |
45 pdf::PasswordDialogClosedCallback callback_; | 44 pdf::PasswordDialogClosedCallback callback_; |
46 | 45 |
47 DISALLOW_COPY_AND_ASSIGN(PDFPasswordDialogViews); | 46 DISALLOW_COPY_AND_ASSIGN(PDFPasswordDialogViews); |
48 }; | 47 }; |
49 | 48 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return ui::MODAL_TYPE_CHILD; | 123 return ui::MODAL_TYPE_CHILD; |
125 } | 124 } |
126 | 125 |
127 } // namespace | 126 } // namespace |
128 | 127 |
129 void ShowPDFPasswordDialog(content::WebContents* web_contents, | 128 void ShowPDFPasswordDialog(content::WebContents* web_contents, |
130 const base::string16& prompt, | 129 const base::string16& prompt, |
131 const pdf::PasswordDialogClosedCallback& callback) { | 130 const pdf::PasswordDialogClosedCallback& callback) { |
132 new PDFPasswordDialogViews(web_contents, prompt, callback); | 131 new PDFPasswordDialogViews(web_contents, prompt, callback); |
133 } | 132 } |
OLD | NEW |