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