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/views/constrained_window_views.h" | 5 #include "chrome/browser/ui/views/constrained_window_views.h" |
6 #include "chrome/grit/generated_resources.h" | 6 #include "chrome/grit/generated_resources.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 virtual ~PDFPasswordDialogViews(); |
25 | 25 |
26 // views::DialogDelegate: | 26 // views::DialogDelegate: |
27 virtual base::string16 GetWindowTitle() const OVERRIDE; | 27 virtual base::string16 GetWindowTitle() const override; |
28 virtual base::string16 GetDialogButtonLabel( | 28 virtual base::string16 GetDialogButtonLabel( |
29 ui::DialogButton button) const OVERRIDE; | 29 ui::DialogButton button) const override; |
30 virtual bool Cancel() OVERRIDE; | 30 virtual bool Cancel() override; |
31 virtual bool Accept() OVERRIDE; | 31 virtual bool Accept() override; |
32 | 32 |
33 // views::WidgetDelegate: | 33 // views::WidgetDelegate: |
34 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 34 virtual views::View* GetInitiallyFocusedView() override; |
35 virtual views::View* GetContentsView() OVERRIDE; | 35 virtual views::View* GetContentsView() override; |
36 virtual views::Widget* GetWidget() OVERRIDE; | 36 virtual views::Widget* GetWidget() override; |
37 virtual const views::Widget* GetWidget() const OVERRIDE; | 37 virtual const views::Widget* GetWidget() const override; |
38 virtual void DeleteDelegate() OVERRIDE; | 38 virtual void DeleteDelegate() override; |
39 virtual ui::ModalType GetModalType() const OVERRIDE; | 39 virtual ui::ModalType GetModalType() const override; |
40 | 40 |
41 private: | 41 private: |
42 // The message box view whose commands we handle. | 42 // The message box view whose commands we handle. |
43 views::MessageBoxView* message_box_view_; | 43 views::MessageBoxView* message_box_view_; |
44 | 44 |
45 pdf::PasswordDialogClosedCallback callback_; | 45 pdf::PasswordDialogClosedCallback callback_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(PDFPasswordDialogViews); | 47 DISALLOW_COPY_AND_ASSIGN(PDFPasswordDialogViews); |
48 }; | 48 }; |
49 | 49 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return ui::MODAL_TYPE_CHILD; | 124 return ui::MODAL_TYPE_CHILD; |
125 } | 125 } |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 | 128 |
129 void ShowPDFPasswordDialog(content::WebContents* web_contents, | 129 void ShowPDFPasswordDialog(content::WebContents* web_contents, |
130 const base::string16& prompt, | 130 const base::string16& prompt, |
131 const pdf::PasswordDialogClosedCallback& callback) { | 131 const pdf::PasswordDialogClosedCallback& callback) { |
132 new PDFPasswordDialogViews(web_contents, prompt, callback); | 132 new PDFPasswordDialogViews(web_contents, prompt, callback); |
133 } | 133 } |
OLD | NEW |