Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / web_dialog_gtk.h
blob075801c33dfba3d21ede0c6059bad58476113a58
1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_GTK_WEB_DIALOG_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_WEB_DIALOG_GTK_H_
8 #include <string>
9 #include <vector>
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/base/gtk/gtk_signal.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/size.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h"
17 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
19 typedef struct _GtkWidget GtkWidget;
21 namespace content {
22 class BrowserContext;
23 class WebContents;
26 class WebDialogGtk : public ui::WebDialogWebContentsDelegate,
27 public ui::WebDialogDelegate {
28 public:
29 WebDialogGtk(content::BrowserContext* context,
30 ui::WebDialogDelegate* delegate,
31 gfx::NativeWindow parent_window);
32 virtual ~WebDialogGtk();
34 // Initializes the contents of the dialog (the DOMView and the callbacks).
35 gfx::NativeWindow InitDialog();
37 // Overridden from ui::WebDialogDelegate:
38 virtual ui::ModalType GetDialogModalType() const OVERRIDE;
39 virtual base::string16 GetDialogTitle() const OVERRIDE;
40 virtual GURL GetDialogContentURL() const OVERRIDE;
41 virtual void GetWebUIMessageHandlers(
42 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
44 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE;
45 virtual std::string GetDialogArgs() const OVERRIDE;
46 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
47 virtual void OnCloseContents(content::WebContents* source,
48 bool* out_close_dialog) OVERRIDE;
49 virtual bool ShouldShowDialogTitle() const OVERRIDE;
51 // Overridden from content::WebContentsDelegate:
52 virtual void HandleKeyboardEvent(
53 content::WebContents* source,
54 const content::NativeWebKeyboardEvent& event) OVERRIDE;
55 virtual void CloseContents(content::WebContents* source) OVERRIDE;
56 virtual content::WebContents* OpenURLFromTab(
57 content::WebContents* source,
58 const content::OpenURLParams& params) OVERRIDE;
59 virtual void AddNewContents(content::WebContents* source,
60 content::WebContents* new_contents,
61 WindowOpenDisposition disposition,
62 const gfx::Rect& initial_pos,
63 bool user_gesture,
64 bool* was_blocked) OVERRIDE;
65 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
67 private:
68 CHROMEGTK_CALLBACK_1(WebDialogGtk, void, OnResponse, int);
70 // This view is a delegate to the HTML content since it needs to get notified
71 // about when the dialog is closing. For all other actions (besides dialog
72 // closing) we delegate to the creator of this view, which we keep track of
73 // using this variable.
74 ui::WebDialogDelegate* delegate_;
76 gfx::NativeWindow parent_window_;
78 GtkWidget* dialog_;
80 scoped_ptr<content::WebContents> web_contents_;
82 DISALLOW_COPY_AND_ASSIGN(WebDialogGtk);
85 #endif // CHROME_BROWSER_UI_GTK_WEB_DIALOG_GTK_H_