OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "app/gtk_signal.h" |
| 13 #include "base/scoped_ptr.h" |
| 14 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 15 #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" |
| 16 #include "gfx/native_widget_types.h" |
| 17 #include "gfx/size.h" |
| 18 |
| 19 typedef struct _GtkWidget GtkWidget; |
| 20 |
| 21 class Browser; |
| 22 class Profile; |
| 23 class TabContents; |
| 24 class TabContentsContainerGtk; |
| 25 |
| 26 class HtmlDialogGtk : public HtmlDialogTabContentsDelegate, |
| 27 public HtmlDialogUIDelegate { |
| 28 public: |
| 29 HtmlDialogGtk(Profile* profile, HtmlDialogUIDelegate* delegate, |
| 30 gfx::NativeWindow parent_window); |
| 31 virtual ~HtmlDialogGtk(); |
| 32 |
| 33 static void ShowHtmlDialogGtk(Browser* browser, |
| 34 HtmlDialogUIDelegate* delegate, |
| 35 gfx::NativeWindow parent_window); |
| 36 // Initializes the contents of the dialog (the DOMView and the callbacks). |
| 37 void InitDialog(); |
| 38 |
| 39 // Overridden from HtmlDialogUI::Delegate: |
| 40 virtual bool IsDialogModal() const; |
| 41 virtual std::wstring GetDialogTitle() const; |
| 42 virtual GURL GetDialogContentURL() const; |
| 43 virtual void GetDOMMessageHandlers( |
| 44 std::vector<DOMMessageHandler*>* handlers) const; |
| 45 virtual void GetDialogSize(gfx::Size* size) const; |
| 46 virtual std::string GetDialogArgs() const; |
| 47 virtual void OnDialogClosed(const std::string& json_retval); |
| 48 virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { } |
| 49 virtual bool ShouldShowDialogTitle() const; |
| 50 |
| 51 // Overridden from TabContentsDelegate: |
| 52 virtual void MoveContents(TabContents* source, const gfx::Rect& pos); |
| 53 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating); |
| 54 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 55 |
| 56 private: |
| 57 CHROMEGTK_CALLBACK_1(HtmlDialogGtk, void, OnResponse, int); |
| 58 |
| 59 // This view is a delegate to the HTML content since it needs to get notified |
| 60 // about when the dialog is closing. For all other actions (besides dialog |
| 61 // closing) we delegate to the creator of this view, which we keep track of |
| 62 // using this variable. |
| 63 HtmlDialogUIDelegate* delegate_; |
| 64 |
| 65 gfx::NativeWindow parent_window_; |
| 66 |
| 67 GtkWidget* dialog_; |
| 68 |
| 69 scoped_ptr<TabContents> tab_contents_; |
| 70 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(HtmlDialogGtk); |
| 73 }; |
| 74 |
| 75 #endif // CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_ |
OLD | NEW |