Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/ui/gtk/constrained_window_gtk.h

Issue 11111022: Remove TabContents from constrained windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unrelated gtk code Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CONSTRAINED_WINDOW_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/constrained_window.h" 13 #include "chrome/browser/ui/constrained_window.h"
14 #include "ui/base/gtk/gtk_signal.h" 14 #include "ui/base/gtk/gtk_signal.h"
15 #include "ui/base/gtk/owned_widget_gtk.h" 15 #include "ui/base/gtk/owned_widget_gtk.h"
16 16
17 class TabContents;
18 typedef struct _GdkColor GdkColor; 17 typedef struct _GdkColor GdkColor;
19 class ChromeWebContentsViewDelegateGtk; 18 class ChromeWebContentsViewDelegateGtk;
20 19
20 namespace content {
21 class WebContents;
22 }
23
21 class ConstrainedWindowGtkDelegate { 24 class ConstrainedWindowGtkDelegate {
22 public: 25 public:
23 // Returns the widget that will be put in the constrained window's container. 26 // Returns the widget that will be put in the constrained window's container.
24 virtual GtkWidget* GetWidgetRoot() = 0; 27 virtual GtkWidget* GetWidgetRoot() = 0;
25 28
26 // Returns the widget that should get focus when ConstrainedWindow is focused. 29 // Returns the widget that should get focus when ConstrainedWindow is focused.
27 virtual GtkWidget* GetFocusWidget() = 0; 30 virtual GtkWidget* GetFocusWidget() = 0;
28 31
29 // 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
30 // itself later. 33 // itself later.
31 virtual void DeleteDelegate() = 0; 34 virtual void DeleteDelegate() = 0;
32 35
33 virtual bool GetBackgroundColor(GdkColor* color); 36 virtual bool GetBackgroundColor(GdkColor* color);
34 37
35 // Returns true if hosting ConstrainedWindowGtk should apply default padding. 38 // Returns true if hosting ConstrainedWindowGtk should apply default padding.
36 virtual bool ShouldHaveBorderPadding() const; 39 virtual bool ShouldHaveBorderPadding() const;
37 40
38 protected: 41 protected:
39 virtual ~ConstrainedWindowGtkDelegate(); 42 virtual ~ConstrainedWindowGtkDelegate();
40 }; 43 };
41 44
42 // Constrained window implementation for the GTK port. Unlike the Win32 system, 45 // Constrained window implementation for the GTK port. Unlike the Win32 system,
43 // ConstrainedWindowGtk doesn't draw draggable fake windows and instead just 46 // ConstrainedWindowGtk doesn't draw draggable fake windows and instead just
44 // centers the dialog. It is thus an order of magnitude simpler. 47 // centers the dialog. It is thus an order of magnitude simpler.
45 class ConstrainedWindowGtk : public ConstrainedWindow { 48 class ConstrainedWindowGtk : public ConstrainedWindow {
46 public: 49 public:
47 typedef ChromeWebContentsViewDelegateGtk TabContentsViewType; 50 typedef ChromeWebContentsViewDelegateGtk TabContentsViewType;
48 51
49 ConstrainedWindowGtk(TabContents* tab_contents, 52 ConstrainedWindowGtk(content::WebContents* web_contents,
50 ConstrainedWindowGtkDelegate* delegate); 53 ConstrainedWindowGtkDelegate* delegate);
51 virtual ~ConstrainedWindowGtk(); 54 virtual ~ConstrainedWindowGtk();
52 55
53 // Overridden from ConstrainedWindow: 56 // Overridden from ConstrainedWindow:
54 virtual void ShowConstrainedWindow() OVERRIDE; 57 virtual void ShowConstrainedWindow() OVERRIDE;
55 virtual void CloseConstrainedWindow() OVERRIDE; 58 virtual void CloseConstrainedWindow() OVERRIDE;
56 virtual void FocusConstrainedWindow() OVERRIDE; 59 virtual void FocusConstrainedWindow() OVERRIDE;
57 60
58 // Returns the TabContents that constrains this Constrained Window. 61 // Returns the WebContents that constrains this Constrained Window.
59 TabContents* owner() const { return tab_contents_; } 62 content::WebContents* owner() const { return web_contents_; }
60 63
61 // Returns the toplevel widget that displays this "window". 64 // Returns the toplevel widget that displays this "window".
62 GtkWidget* widget() { return border_.get(); } 65 GtkWidget* widget() { return border_.get(); }
63 66
64 // Returns the View that we collaborate with to position ourselves. 67 // Returns the View that we collaborate with to position ourselves.
65 TabContentsViewType* ContainingView(); 68 TabContentsViewType* ContainingView();
66 69
67 private: 70 private:
68 friend class ConstrainedWindow; 71 friend class ConstrainedWindow;
69 72
70 // Signal callbacks. 73 // Signal callbacks.
71 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress, 74 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress,
72 GdkEventKey*); 75 GdkEventKey*);
73 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, void, OnHierarchyChanged, 76 CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, void, OnHierarchyChanged,
74 GtkWidget*); 77 GtkWidget*);
75 78
76 // The TabContents that owns and constrains this ConstrainedWindow. 79 // The WebContents that owns and constrains this ConstrainedWindow.
77 TabContents* tab_contents_; 80 content::WebContents* web_contents_;
78 81
79 // The top level widget container that exports to our WebContentsView. 82 // The top level widget container that exports to our WebContentsView.
80 ui::OwnedWidgetGtk border_; 83 ui::OwnedWidgetGtk border_;
81 84
82 // Delegate that provides the contents of this constrained window. 85 // Delegate that provides the contents of this constrained window.
83 ConstrainedWindowGtkDelegate* delegate_; 86 ConstrainedWindowGtkDelegate* delegate_;
84 87
85 // Stores if |ShowConstrainedWindow()| has been called. 88 // Stores if |ShowConstrainedWindow()| has been called.
86 bool visible_; 89 bool visible_;
87 90
88 base::WeakPtrFactory<ConstrainedWindowGtk> weak_factory_; 91 base::WeakPtrFactory<ConstrainedWindowGtk> weak_factory_;
89 92
90 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk); 93 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowGtk);
91 }; 94 };
92 95
93 #endif // CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_ 96 #endif // CHROME_BROWSER_UI_GTK_CONSTRAINED_WINDOW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc ('k') | chrome/browser/ui/gtk/constrained_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698