Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | |
| 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "content/public/browser/javascript_dialog_manager.h" | |
| 13 #include "ui/views/window/dialog_delegate.h" | |
| 14 | |
| 15 namespace views { | |
| 16 class MessageBoxView; | |
| 17 } | |
| 18 | |
| 19 class JavaScriptDialogViews : public views::DialogDelegate { | |
|
Peter Kasting
2016/10/17 20:16:05
Nit: Add description of what this class is and why
Avi (use Gerrit)
2016/10/18 02:46:42
Done.
| |
| 20 public: | |
| 21 static base::WeakPtr<JavaScriptDialogViews> Create( | |
|
Peter Kasting
2016/10/17 20:16:05
Nit: Per https://google.github.io/styleguide/cppgu
Avi (use Gerrit)
2016/10/18 02:46:42
Done.
| |
| 22 content::WebContents* parent_web_contents, | |
| 23 content::WebContents* alerting_web_contents, | |
| 24 const base::string16& title, | |
| 25 content::JavaScriptMessageType message_type, | |
| 26 const base::string16& message_text, | |
| 27 const base::string16& default_prompt_text, | |
| 28 const content::JavaScriptDialogManager::DialogClosedCallback& | |
| 29 dialog_callback); | |
| 30 ~JavaScriptDialogViews() override; | |
| 31 | |
| 32 void CloseJavaScriptDialog(); | |
| 33 | |
| 34 // views::DialogDelegate: | |
| 35 int GetDefaultDialogButton() const override; | |
| 36 int GetDialogButtons() const override; | |
| 37 base::string16 GetWindowTitle() const override; | |
| 38 bool Cancel() override; | |
| 39 bool Accept() override; | |
| 40 bool Close() override; | |
| 41 void DeleteDelegate() override; | |
| 42 | |
| 43 // views::WidgetDelegate: | |
| 44 views::View* GetContentsView() override; | |
| 45 views::View* GetInitiallyFocusedView() override; | |
| 46 views::Widget* GetWidget() override; | |
| 47 const views::Widget* GetWidget() const override; | |
| 48 ui::ModalType GetModalType() const override; | |
| 49 | |
| 50 private: | |
| 51 JavaScriptDialogViews( | |
| 52 content::WebContents* parent_web_contents, | |
| 53 content::WebContents* alerting_web_contents, | |
| 54 const base::string16& title, | |
| 55 content::JavaScriptMessageType message_type, | |
| 56 const base::string16& message_text, | |
| 57 const base::string16& default_prompt_text, | |
| 58 const content::JavaScriptDialogManager::DialogClosedCallback& | |
| 59 dialog_callback); | |
| 60 | |
| 61 base::string16 title_; | |
| 62 content::JavaScriptMessageType message_type_; | |
| 63 base::string16 message_text_; | |
| 64 base::string16 default_prompt_text_; | |
| 65 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | |
| 66 | |
| 67 // The message box view whose commands we handle. | |
| 68 views::MessageBoxView* message_box_view_; | |
| 69 | |
| 70 base::WeakPtrFactory<JavaScriptDialogViews> weak_factory_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogViews); | |
| 73 }; | |
| 74 | |
| 75 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_VIEWS_H_ | |
| OLD | NEW |