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_JSMESSAGE_BOX_HANDLER_WIN_H_ | 5 #ifndef CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
6 #define CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ | 6 #define CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
7 | 7 |
8 #include "chrome/browser/jsmessage_box_handler.h" | 8 #include "chrome/browser/jsmessage_box_handler.h" |
9 #include "chrome/common/ipc_message.h" | 9 #include "chrome/common/ipc_message.h" |
10 #include "chrome/common/notification_observer.h" | 10 #include "chrome/common/notification_observer.h" |
11 #include "chrome/common/notification_registrar.h" | 11 #include "chrome/common/notification_registrar.h" |
12 #include "chrome/views/app_modal_dialog_delegate.h" | 12 #include "chrome/views/app_modal_dialog_delegate.h" |
| 13 #include "googleurl/src/gurl.h" |
13 | 14 |
14 class MessageBoxView; | 15 class MessageBoxView; |
15 class WebContents; | 16 class WebContents; |
16 namespace views { | 17 namespace views { |
17 class Window; | 18 class Window; |
18 } | 19 } |
19 | 20 |
20 class JavascriptMessageBoxHandler | 21 class JavascriptMessageBoxHandler |
21 : public views::AppModalDialogDelegate, | 22 : public views::AppModalDialogDelegate, |
22 public NotificationObserver { | 23 public NotificationObserver { |
23 public: | 24 public: |
24 // Cross-platform code should use RunJavaScriptMessageBox. | 25 // Cross-platform code should use RunJavaScriptMessageBox. |
25 JavascriptMessageBoxHandler(WebContents* web_contents, | 26 JavascriptMessageBoxHandler(WebContents* web_contents, |
| 27 const GURL& frame_url, |
26 int dialog_flags, | 28 int dialog_flags, |
27 const std::wstring& message_text, | 29 const std::wstring& message_text, |
28 const std::wstring& default_prompt_text, | 30 const std::wstring& default_prompt_text, |
29 bool display_suppress_checkbox, | 31 bool display_suppress_checkbox, |
30 IPC::Message* reply_msg); | 32 IPC::Message* reply_msg); |
31 virtual ~JavascriptMessageBoxHandler(); | 33 virtual ~JavascriptMessageBoxHandler(); |
32 | 34 |
33 // views::DialogDelegate Methods: | 35 // views::DialogDelegate Methods: |
34 virtual int GetDialogButtons() const; | 36 virtual int GetDialogButtons() const; |
35 virtual std::wstring GetWindowTitle() const; | 37 virtual std::wstring GetWindowTitle() const; |
(...skipping 21 matching lines...) Expand all Loading... |
57 // The message box view whose commands we handle. | 59 // The message box view whose commands we handle. |
58 MessageBoxView* message_box_view_; | 60 MessageBoxView* message_box_view_; |
59 | 61 |
60 // The IPC message used to reply to the renderer when the message box | 62 // The IPC message used to reply to the renderer when the message box |
61 // is dismissed. | 63 // is dismissed. |
62 IPC::Message* reply_msg_; | 64 IPC::Message* reply_msg_; |
63 | 65 |
64 // The associated WebContents. Used to send IPC messages to the renderer. | 66 // The associated WebContents. Used to send IPC messages to the renderer. |
65 WebContents* web_contents_; | 67 WebContents* web_contents_; |
66 | 68 |
| 69 // The URL of the frame originating the dialog. It is important we display |
| 70 // this so the user doesn't blame the enclosing site if a subframe alert()s. |
| 71 GURL frame_url_; |
| 72 |
67 // Stores flags defined in message_box_view.h which describe the dialog box. | 73 // Stores flags defined in message_box_view.h which describe the dialog box. |
68 int dialog_flags_; | 74 int dialog_flags_; |
69 | 75 |
70 // The dialog if it is currently visible. | 76 // The dialog if it is currently visible. |
71 views::Window* dialog_; | 77 views::Window* dialog_; |
72 | 78 |
73 DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxHandler); | 79 DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxHandler); |
74 }; | 80 }; |
75 | 81 |
76 #endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ | 82 #endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
OLD | NEW |