OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_JSMESSAGE_BOX_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ |
6 #define CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ | 6 #define CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ |
7 | 7 |
| 8 #include "chrome/browser/js_modal_dialog.h" |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "chrome/browser/app_modal_dialog.h" | 12 #include "app/message_box_flags.h" |
11 #include "views/window/dialog_delegate.h" | 13 #include "chrome/browser/jsmessage_box_client.h" |
| 14 #include "chrome/browser/views/modal_dialog_delegate.h" |
12 | 15 |
13 class MessageBoxView; | 16 class MessageBoxView; |
14 class JavaScriptMessageBoxClient; | 17 class JavaScriptMessageBoxClient; |
15 namespace views { | |
16 class Window; | |
17 } | |
18 | 18 |
19 class JavascriptMessageBoxDialog : public views::DialogDelegate { | 19 class JavaScriptMessageBoxDialog : public ModalDialogDelegate { |
20 public: | 20 public: |
21 JavascriptMessageBoxDialog(AppModalDialog* parent, | 21 JavaScriptMessageBoxDialog(JavaScriptAppModalDialog* parent, |
22 const std::wstring& message_text, | 22 const std::wstring& message_text, |
23 const std::wstring& default_prompt_text, | 23 const std::wstring& default_prompt_text, |
24 bool display_suppress_checkbox); | 24 bool display_suppress_checkbox); |
25 | 25 |
26 virtual ~JavascriptMessageBoxDialog(); | 26 virtual ~JavaScriptMessageBoxDialog(); |
27 | 27 |
28 // Methods called from AppModalDialog. | 28 // ModalDialogDelegate overrides. |
29 void ShowModalDialog(); | 29 virtual gfx::NativeWindow GetDialogRootWindow(); |
30 void ActivateModalDialog(); | |
31 void CloseModalDialog(); | |
32 | 30 |
33 // views::DialogDelegate Methods: | 31 // views::DialogDelegate Methods: |
34 virtual int GetDialogButtons() const; | 32 virtual int GetDialogButtons() const; |
35 virtual std::wstring GetWindowTitle() const; | 33 virtual std::wstring GetWindowTitle() const; |
36 virtual void WindowClosing(); | 34 virtual void WindowClosing(); |
37 virtual void DeleteDelegate(); | 35 virtual void DeleteDelegate(); |
38 virtual bool Cancel(); | 36 virtual bool Cancel(); |
39 virtual bool Accept(); | 37 virtual bool Accept(); |
40 virtual std::wstring GetDialogButtonLabel( | 38 virtual std::wstring GetDialogButtonLabel( |
41 MessageBoxFlags::DialogButton button) const; | 39 MessageBoxFlags::DialogButton button) const; |
42 | 40 |
43 // views::WindowDelegate Methods: | 41 // views::WindowDelegate Methods: |
44 virtual bool IsModal() const { return true; } | 42 virtual bool IsModal() const { return true; } |
45 virtual views::View* GetContentsView(); | 43 virtual views::View* GetContentsView(); |
46 virtual views::View* GetInitiallyFocusedView(); | 44 virtual views::View* GetInitiallyFocusedView(); |
47 virtual void OnClose(); | 45 virtual void OnClose(); |
48 | 46 |
49 private: | 47 private: |
50 JavaScriptMessageBoxClient* client() { | 48 JavaScriptMessageBoxClient* client() { |
51 return parent_->client(); | 49 return parent_->client(); |
52 } | 50 } |
53 | 51 |
54 // A pointer to the AppModalDialog that owns us. | 52 // A pointer to the AppModalDialog that owns us. |
55 AppModalDialog* parent_; | 53 JavaScriptAppModalDialog* parent_; |
56 | 54 |
57 // The message box view whose commands we handle. | 55 // The message box view whose commands we handle. |
58 MessageBoxView* message_box_view_; | 56 MessageBoxView* message_box_view_; |
59 | 57 |
60 // The dialog if it is currently visible. | 58 DISALLOW_COPY_AND_ASSIGN(JavaScriptMessageBoxDialog); |
61 views::Window* dialog_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxDialog); | |
64 }; | 59 }; |
65 | 60 |
66 #endif // CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ | 61 #endif // CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ |
OLD | NEW |