| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_JSMESSAGE_BOX_CLIENT_H_ |
| 6 #define CHROME_BROWSER_JSMESSAGE_BOX_CLIENT_H_ | 6 #define CHROME_BROWSER_JSMESSAGE_BOX_CLIENT_H_ |
| 7 | 7 |
| 8 // JavaScriptMessageBoxClient | 8 // JavaScriptMessageBoxClient |
| 9 // | 9 // |
| 10 // An interface implemented by an object that receives results from JavaScript | 10 // An interface implemented by an object that receives results from JavaScript |
| 11 // message boxes (alert, confirm, and prompt). | 11 // message boxes (alert, confirm, and prompt). |
| 12 // | 12 // |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "app/gfx/native_widget_types.h" | 16 #include "app/gfx/native_widget_types.h" |
| 17 | 17 |
| 18 class ExtensionHost; |
| 18 class GURL; | 19 class GURL; |
| 19 class Profile; | 20 class Profile; |
| 20 class TabContents; | 21 class TabContents; |
| 21 namespace IPC { | 22 namespace IPC { |
| 22 class Message; | 23 class Message; |
| 23 } | 24 } |
| 24 | 25 |
| 25 class JavaScriptMessageBoxClient { | 26 class JavaScriptMessageBoxClient { |
| 26 public: | 27 public: |
| 27 virtual ~JavaScriptMessageBoxClient() {} | 28 virtual ~JavaScriptMessageBoxClient() {} |
| 28 | 29 |
| 29 // Returns the title to use for the message box. | 30 // Returns the title to use for the message box. |
| 30 virtual std::wstring GetMessageBoxTitle(const GURL& frame_url, | 31 virtual std::wstring GetMessageBoxTitle(const GURL& frame_url, |
| 31 bool is_alert) = 0; | 32 bool is_alert) = 0; |
| 32 | 33 |
| 33 // Returns the root native window with which the message box is associated. | 34 // Returns the root native window with which the message box is associated. |
| 34 virtual gfx::NativeWindow GetMessageBoxRootWindow() = 0; | 35 virtual gfx::NativeWindow GetMessageBoxRootWindow() = 0; |
| 35 | 36 |
| 36 // AppModalDialog calls this when the dialog is closed. | 37 // AppModalDialog calls this when the dialog is closed. |
| 37 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, | 38 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, |
| 38 bool success, | 39 bool success, |
| 39 const std::wstring& prompt) = 0; | 40 const std::wstring& prompt) = 0; |
| 40 | 41 |
| 41 // Indicates whether additional message boxes should be suppressed. | 42 // Indicates whether additional message boxes should be suppressed. |
| 42 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) = 0; | 43 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) = 0; |
| 43 | 44 |
| 44 // Returns the TabContents associated with this message box -- in practice, | 45 // Returns the TabContents or ExtensionHost associated with this message |
| 45 // the TabContents implementing this interface -- or NULL if it has no | 46 // box -- in practice, the object implementing this interface. Exactly one of |
| 46 // TabContents (e.g., it's an ExtensionHost). | 47 // these must be non-NULL; behavior is undefined (read: it'll probably crash) |
| 48 // if that is not the case. |
| 47 virtual TabContents* AsTabContents() = 0; | 49 virtual TabContents* AsTabContents() = 0; |
| 50 virtual ExtensionHost* AsExtensionHost() = 0; |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 #endif // CHROME_BROWSER_JSMESSAGE_BOX_CLIENT_H_ | 53 #endif // CHROME_BROWSER_JSMESSAGE_BOX_CLIENT_H_ |
| OLD | NEW |