Revert 99759 - Add two new valgrind suppressions.
[chromium-blink-merge.git] / content / browser / javascript_dialogs.h
blobcc17a714a747b29bd86f69b316c83ade67ff6f1a
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_
6 #define CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_
7 #pragma once
9 #include "base/string16.h"
10 #include "ui/gfx/native_widget_types.h"
12 class GURL;
13 class TabContents;
15 namespace IPC {
16 class Message;
19 namespace content {
21 class DialogDelegate {
22 public:
23 // Returns the root native window with which to associate the dialog.
24 virtual gfx::NativeWindow GetDialogRootWindow() = 0;
26 // Called right before the dialog is shown.
27 virtual void OnDialogShown() {}
29 protected:
30 virtual ~DialogDelegate() {}
33 // A class that invokes a JavaScript dialog must implement this interface to
34 // allow the dialog implementation to get needed information and return results.
35 class JavaScriptDialogDelegate : public DialogDelegate {
36 public:
37 // This callback is invoked when the dialog is closed.
38 virtual void OnDialogClosed(IPC::Message* reply_msg,
39 bool success,
40 const string16& user_input) = 0;
42 protected:
43 virtual ~JavaScriptDialogDelegate() {}
46 // An interface consisting of methods that can be called to produce JavaScript
47 // dialogs.
48 class JavaScriptDialogCreator {
49 public:
50 enum TitleType {
51 DIALOG_TITLE_NONE,
52 DIALOG_TITLE_PLAIN_STRING,
53 DIALOG_TITLE_FORMATTED_URL
56 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if
57 // |true| is returned in it, the caller will handle faking the reply.
58 virtual void RunJavaScriptDialog(JavaScriptDialogDelegate* delegate,
59 TitleType title_type,
60 const string16& title,
61 int dialog_flags,
62 const string16& message_text,
63 const string16& default_prompt_text,
64 IPC::Message* reply_message,
65 bool* did_suppress_message) = 0;
67 // Displays a dialog asking the user if they want to leave a page.
68 virtual void RunBeforeUnloadDialog(JavaScriptDialogDelegate* delegate,
69 const string16& message_text,
70 IPC::Message* reply_message) = 0;
72 // Cancels all pending dialogs and resets any saved JavaScript dialog state
73 // for the delegate.
74 virtual void ResetJavaScriptState(JavaScriptDialogDelegate* delegate) = 0;
76 protected:
77 virtual ~JavaScriptDialogCreator() {}
80 } // namespace content
82 #endif // CONTENT_BROWSER_JAVASCRIPT_DIALOG_DELEGATE_H_