| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // are browser tabs. | 21 // are browser tabs. |
| 22 class JavaScriptDialogViews : public JavaScriptDialog, | 22 class JavaScriptDialogViews : public JavaScriptDialog, |
| 23 public views::DialogDelegate { | 23 public views::DialogDelegate { |
| 24 public: | 24 public: |
| 25 ~JavaScriptDialogViews() override; | 25 ~JavaScriptDialogViews() override; |
| 26 | 26 |
| 27 static base::WeakPtr<JavaScriptDialogViews> Create( | 27 static base::WeakPtr<JavaScriptDialogViews> Create( |
| 28 content::WebContents* parent_web_contents, | 28 content::WebContents* parent_web_contents, |
| 29 content::WebContents* alerting_web_contents, | 29 content::WebContents* alerting_web_contents, |
| 30 const base::string16& title, | 30 const base::string16& title, |
| 31 content::JavaScriptMessageType message_type, | 31 content::JavaScriptDialogType dialog_type, |
| 32 const base::string16& message_text, | 32 const base::string16& message_text, |
| 33 const base::string16& default_prompt_text, | 33 const base::string16& default_prompt_text, |
| 34 const content::JavaScriptDialogManager::DialogClosedCallback& | 34 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 35 dialog_callback); | 35 dialog_callback); |
| 36 | 36 |
| 37 // JavaScriptDialog: | 37 // JavaScriptDialog: |
| 38 void CloseDialogWithoutCallback() override; | 38 void CloseDialogWithoutCallback() override; |
| 39 | 39 |
| 40 // views::DialogDelegate: | 40 // views::DialogDelegate: |
| 41 int GetDefaultDialogButton() const override; | 41 int GetDefaultDialogButton() const override; |
| 42 int GetDialogButtons() const override; | 42 int GetDialogButtons() const override; |
| 43 base::string16 GetWindowTitle() const override; | 43 base::string16 GetWindowTitle() const override; |
| 44 bool Cancel() override; | 44 bool Cancel() override; |
| 45 bool Accept() override; | 45 bool Accept() override; |
| 46 bool Close() override; | 46 bool Close() override; |
| 47 void DeleteDelegate() override; | 47 void DeleteDelegate() override; |
| 48 | 48 |
| 49 // views::WidgetDelegate: | 49 // views::WidgetDelegate: |
| 50 views::View* GetContentsView() override; | 50 views::View* GetContentsView() override; |
| 51 views::View* GetInitiallyFocusedView() override; | 51 views::View* GetInitiallyFocusedView() override; |
| 52 views::Widget* GetWidget() override; | 52 views::Widget* GetWidget() override; |
| 53 const views::Widget* GetWidget() const override; | 53 const views::Widget* GetWidget() const override; |
| 54 ui::ModalType GetModalType() const override; | 54 ui::ModalType GetModalType() const override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 JavaScriptDialogViews( | 57 JavaScriptDialogViews( |
| 58 content::WebContents* parent_web_contents, | 58 content::WebContents* parent_web_contents, |
| 59 content::WebContents* alerting_web_contents, | 59 content::WebContents* alerting_web_contents, |
| 60 const base::string16& title, | 60 const base::string16& title, |
| 61 content::JavaScriptMessageType message_type, | 61 content::JavaScriptDialogType dialog_type, |
| 62 const base::string16& message_text, | 62 const base::string16& message_text, |
| 63 const base::string16& default_prompt_text, | 63 const base::string16& default_prompt_text, |
| 64 const content::JavaScriptDialogManager::DialogClosedCallback& | 64 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 65 dialog_callback); | 65 dialog_callback); |
| 66 | 66 |
| 67 base::string16 title_; | 67 base::string16 title_; |
| 68 content::JavaScriptMessageType message_type_; | 68 content::JavaScriptDialogType dialog_type_; |
| 69 base::string16 message_text_; | 69 base::string16 message_text_; |
| 70 base::string16 default_prompt_text_; | 70 base::string16 default_prompt_text_; |
| 71 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | 71 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
| 72 | 72 |
| 73 // The message box view whose commands we handle. | 73 // The message box view whose commands we handle. |
| 74 views::MessageBoxView* message_box_view_; | 74 views::MessageBoxView* message_box_view_; |
| 75 | 75 |
| 76 base::WeakPtrFactory<JavaScriptDialogViews> weak_factory_; | 76 base::WeakPtrFactory<JavaScriptDialogViews> weak_factory_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogViews); | 78 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogViews); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | 81 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ |
| OLD | NEW |