Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_CONSTRAINED_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "app/gtk_signal.h" | 11 #include "app/gtk_signal.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "chrome/browser/gtk/owned_widget_gtk.h" | 14 #include "chrome/browser/gtk/owned_widget_gtk.h" |
| 15 #include "chrome/browser/tab_contents/constrained_window.h" | 15 #include "chrome/browser/tab_contents/constrained_window.h" |
| 16 | 16 |
| 17 class TabContents; | 17 class TabContents; |
| 18 typedef struct _GdkColor GdkColor; | |
| 19 #if defined(TOUCH_UI) | |
| 20 class TabContentsViewViews; | |
| 21 typedef TabContentsViewViews TabContentsViewType; | |
|
brettw
2010/11/12 21:55:51
Can you put this typedef inside the class so it's
oshima
2010/11/13 01:36:08
agreed
| |
| 22 #else | |
| 18 class TabContentsViewGtk; | 23 class TabContentsViewGtk; |
| 19 typedef struct _GdkColor GdkColor; | 24 typedef TabContentsViewGtk TabContentsViewType; |
| 25 #endif | |
| 20 | 26 |
| 21 class ConstrainedWindowGtkDelegate { | 27 class ConstrainedWindowGtkDelegate { |
| 22 public: | 28 public: |
| 23 // Returns the widget that will be put in the constrained window's container. | 29 // Returns the widget that will be put in the constrained window's container. |
| 24 virtual GtkWidget* GetWidgetRoot() = 0; | 30 virtual GtkWidget* GetWidgetRoot() = 0; |
| 25 | 31 |
| 26 // Tells the delegate to either delete itself or set up a task to delete | 32 // Tells the delegate to either delete itself or set up a task to delete |
| 27 // itself later. | 33 // itself later. |
| 28 virtual void DeleteDelegate() = 0; | 34 virtual void DeleteDelegate() = 0; |
| 29 | 35 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 44 virtual void ShowConstrainedWindow(); | 50 virtual void ShowConstrainedWindow(); |
| 45 virtual void CloseConstrainedWindow(); | 51 virtual void CloseConstrainedWindow(); |
| 46 | 52 |
| 47 // Returns the TabContents that constrains this Constrained Window. | 53 // Returns the TabContents that constrains this Constrained Window. |
| 48 TabContents* owner() const { return owner_; } | 54 TabContents* owner() const { return owner_; } |
| 49 | 55 |
| 50 // Returns the toplevel widget that displays this "window". | 56 // Returns the toplevel widget that displays this "window". |
| 51 GtkWidget* widget() { return border_.get(); } | 57 GtkWidget* widget() { return border_.get(); } |
| 52 | 58 |
| 53 // Returns the View that we collaborate with to position ourselves. | 59 // Returns the View that we collaborate with to position ourselves. |
| 54 TabContentsViewGtk* ContainingView(); | 60 TabContentsViewType* ContainingView(); |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 friend class ConstrainedWindow; | 63 friend class ConstrainedWindow; |
| 58 | 64 |
| 59 ConstrainedWindowGtk(TabContents* owner, | 65 ConstrainedWindowGtk(TabContents* owner, |
| 60 ConstrainedWindowGtkDelegate* delegate); | 66 ConstrainedWindowGtkDelegate* delegate); |
| 61 | 67 |
| 62 // Handler for Escape. | 68 // Handler for Escape. |
| 63 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress, | 69 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress, |
| 64 GdkEventKey*); | 70 GdkEventKey*); |
| 65 | 71 |
| 66 // The TabContents that owns and constrains this ConstrainedWindow. | 72 // The TabContents that owns and constrains this ConstrainedWindow. |
| 67 TabContents* owner_; | 73 TabContents* owner_; |
| 68 | 74 |
| 69 // The top level widget container that exports to our TabContentsViewGtk. | 75 // The top level widget container that exports to our TabContentsView. |
| 70 OwnedWidgetGtk border_; | 76 OwnedWidgetGtk border_; |
| 71 | 77 |
| 72 // Delegate that provides the contents of this constrained window. | 78 // Delegate that provides the contents of this constrained window. |
| 73 ConstrainedWindowGtkDelegate* delegate_; | 79 ConstrainedWindowGtkDelegate* delegate_; |
| 74 | 80 |
| 75 // Stores if |ShowConstrainedWindow()| has been called. | 81 // Stores if |ShowConstrainedWindow()| has been called. |
| 76 bool visible_; | 82 bool visible_; |
| 77 | 83 |
| 78 ScopedRunnableMethodFactory<ConstrainedWindowGtk> factory_; | 84 ScopedRunnableMethodFactory<ConstrainedWindowGtk> factory_; |
| 79 | 85 |
| 80 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); | 86 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); |
| 81 }; | 87 }; |
| 82 | 88 |
| 83 #endif // CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ | 89 #endif // CHROME_BROWSER_GTK_CONSTRAINED_WINDOW_GTK_H_ |
| OLD | NEW |