| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 5 #ifndef CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
| 6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "ui/base/javascript_message_type.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 12 | 13 |
| 13 namespace IPC { | 14 namespace IPC { |
| 14 class Message; | 15 class Message; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class CONTENT_EXPORT DialogDelegate { | 20 class CONTENT_EXPORT DialogDelegate { |
| 20 public: | 21 public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 class JavaScriptDialogCreator { | 47 class JavaScriptDialogCreator { |
| 47 public: | 48 public: |
| 48 enum TitleType { | 49 enum TitleType { |
| 49 DIALOG_TITLE_NONE, | 50 DIALOG_TITLE_NONE, |
| 50 DIALOG_TITLE_PLAIN_STRING, | 51 DIALOG_TITLE_PLAIN_STRING, |
| 51 DIALOG_TITLE_FORMATTED_URL | 52 DIALOG_TITLE_FORMATTED_URL |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if | 55 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if |
| 55 // |true| is returned in it, the caller will handle faking the reply. | 56 // |true| is returned in it, the caller will handle faking the reply. |
| 56 virtual void RunJavaScriptDialog(JavaScriptDialogDelegate* delegate, | 57 virtual void RunJavaScriptDialog( |
| 57 TitleType title_type, | 58 JavaScriptDialogDelegate* delegate, |
| 58 const string16& title, | 59 TitleType title_type, |
| 59 int dialog_flags, | 60 const string16& title, |
| 60 const string16& message_text, | 61 ui::JavascriptMessageType javascript_message_type, |
| 61 const string16& default_prompt_text, | 62 const string16& message_text, |
| 62 IPC::Message* reply_message, | 63 const string16& default_prompt_text, |
| 63 bool* did_suppress_message) = 0; | 64 IPC::Message* reply_message, |
| 65 bool* did_suppress_message) = 0; |
| 64 | 66 |
| 65 // Displays a dialog asking the user if they want to leave a page. | 67 // Displays a dialog asking the user if they want to leave a page. |
| 66 virtual void RunBeforeUnloadDialog(JavaScriptDialogDelegate* delegate, | 68 virtual void RunBeforeUnloadDialog(JavaScriptDialogDelegate* delegate, |
| 67 const string16& message_text, | 69 const string16& message_text, |
| 68 IPC::Message* reply_message) = 0; | 70 IPC::Message* reply_message) = 0; |
| 69 | 71 |
| 70 // Cancels all pending dialogs and resets any saved JavaScript dialog state | 72 // Cancels all pending dialogs and resets any saved JavaScript dialog state |
| 71 // for the delegate. | 73 // for the delegate. |
| 72 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0; | 74 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0; |
| 73 | 75 |
| 74 protected: | 76 protected: |
| 75 virtual ~JavaScriptDialogCreator() {} | 77 virtual ~JavaScriptDialogCreator() {} |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 } // namespace content | 80 } // namespace content |
| 79 | 81 |
| 80 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ | 82 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOGS_H_ |
| OLD | NEW |