| OLD | NEW |
| (Empty) |
| 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. | |
| 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 "base/compiler_specific.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" | |
| 15 #include "chrome/browser/ui/webui/html_dialog_ui.h" | |
| 16 #include "ui/base/gtk/gtk_signal.h" | |
| 17 #include "ui/gfx/native_widget_types.h" | |
| 18 #include "ui/gfx/size.h" | |
| 19 | |
| 20 typedef struct _GtkWidget GtkWidget; | |
| 21 | |
| 22 class Browser; | |
| 23 class HtmlDialogController; | |
| 24 class Profile; | |
| 25 class TabContentsContainerGtk; | |
| 26 class TabContentsWrapper; | |
| 27 | |
| 28 class HtmlDialogGtk : public HtmlDialogTabContentsDelegate, | |
| 29 public HtmlDialogUIDelegate { | |
| 30 public: | |
| 31 HtmlDialogGtk(Profile* profile, | |
| 32 Browser* browser, | |
| 33 HtmlDialogUIDelegate* delegate, | |
| 34 gfx::NativeWindow parent_window); | |
| 35 virtual ~HtmlDialogGtk(); | |
| 36 | |
| 37 // Initializes the contents of the dialog (the DOMView and the callbacks). | |
| 38 gfx::NativeWindow InitDialog(); | |
| 39 | |
| 40 // Overridden from HtmlDialogUIDelegate: | |
| 41 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | |
| 42 virtual string16 GetDialogTitle() const OVERRIDE; | |
| 43 virtual GURL GetDialogContentURL() const OVERRIDE; | |
| 44 virtual void GetWebUIMessageHandlers( | |
| 45 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | |
| 46 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | |
| 47 virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE; | |
| 48 virtual std::string GetDialogArgs() const OVERRIDE; | |
| 49 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | |
| 50 virtual void OnCloseContents(content::WebContents* source, | |
| 51 bool* out_close_dialog) OVERRIDE; | |
| 52 virtual bool ShouldShowDialogTitle() const OVERRIDE; | |
| 53 | |
| 54 // Overridden from content::WebContentsDelegate: | |
| 55 virtual void HandleKeyboardEvent( | |
| 56 const NativeWebKeyboardEvent& event) OVERRIDE; | |
| 57 virtual void CloseContents(content::WebContents* source) OVERRIDE; | |
| 58 virtual content::WebContents* OpenURLFromTab( | |
| 59 content::WebContents* source, | |
| 60 const content::OpenURLParams& params) OVERRIDE; | |
| 61 virtual void AddNewContents(content::WebContents* source, | |
| 62 content::WebContents* new_contents, | |
| 63 WindowOpenDisposition disposition, | |
| 64 const gfx::Rect& initial_pos, | |
| 65 bool user_gesture) OVERRIDE; | |
| 66 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | |
| 67 | |
| 68 private: | |
| 69 CHROMEGTK_CALLBACK_1(HtmlDialogGtk, void, OnResponse, int); | |
| 70 | |
| 71 // This view is a delegate to the HTML content since it needs to get notified | |
| 72 // about when the dialog is closing. For all other actions (besides dialog | |
| 73 // closing) we delegate to the creator of this view, which we keep track of | |
| 74 // using this variable. | |
| 75 HtmlDialogUIDelegate* delegate_; | |
| 76 | |
| 77 gfx::NativeWindow parent_window_; | |
| 78 | |
| 79 GtkWidget* dialog_; | |
| 80 | |
| 81 scoped_ptr<HtmlDialogController> dialog_controller_; | |
| 82 scoped_ptr<TabContentsWrapper> tab_; | |
| 83 scoped_ptr<TabContentsContainerGtk> tab_contents_container_; | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(HtmlDialogGtk); | |
| 86 }; | |
| 87 | |
| 88 #endif // CHROME_BROWSER_UI_GTK_HTML_DIALOG_GTK_H_ | |
| OLD | NEW |