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

Side by Side Diff: content/browser/web_contents/web_contents_view_gtk.h

Issue 10031044: TabContents -> WebContentsImpl, part 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (fixed) Created 8 years, 8 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "content/browser/tab_contents/tab_contents_view_helper.h" 14 #include "content/browser/web_contents/web_contents_view_helper.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/web_contents_view.h" 16 #include "content/public/browser/web_contents_view.h"
17 #include "ui/base/gtk/focus_store_gtk.h" 17 #include "ui/base/gtk/focus_store_gtk.h"
18 #include "ui/base/gtk/gtk_signal.h" 18 #include "ui/base/gtk/gtk_signal.h"
19 #include "ui/base/gtk/owned_widget_gtk.h" 19 #include "ui/base/gtk/owned_widget_gtk.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class WebContentsViewDelegate; 23 class WebContentsViewDelegate;
24 class WebDragDestDelegate; 24 class WebDragDestDelegate;
25 class WebDragDestGtk; 25 class WebDragDestGtk;
26 class WebDragSourceGtk; 26 class WebDragSourceGtk;
27 27
28 class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView { 28 class CONTENT_EXPORT WebContentsViewGtk : public WebContentsView {
29 public: 29 public:
30 // The corresponding TabContents is passed in the constructor, and manages 30 // The corresponding TabContents is passed in the constructor, and manages
31 // our lifetime. This doesn't need to be the case, but is this way currently 31 // our lifetime. This doesn't need to be the case, but is this way currently
32 // because that's what was easiest when they were split. We optionally take 32 // because that's what was easiest when they were split. We optionally take
33 // |wrapper| which creates an intermediary widget layer for features from the 33 // |wrapper| which creates an intermediary widget layer for features from the
34 // Embedding layer that lives with the WebContentsView. 34 // Embedding layer that lives with the WebContentsView.
35 TabContentsViewGtk(WebContentsImpl* web_contents, 35 WebContentsViewGtk(WebContentsImpl* web_contents,
36 WebContentsViewDelegate* delegate); 36 WebContentsViewDelegate* delegate);
37 virtual ~TabContentsViewGtk(); 37 virtual ~WebContentsViewGtk();
38 38
39 WebContentsViewDelegate* delegate() const { return delegate_.get(); } 39 WebContentsViewDelegate* delegate() const { return delegate_.get(); }
40 WebContents* web_contents(); 40 WebContents* web_contents();
41 41
42 // WebContentsView implementation -------------------------------------------- 42 // WebContentsView implementation --------------------------------------------
43 43
44 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; 44 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
45 virtual content::RenderWidgetHostView* CreateViewForWidget( 45 virtual content::RenderWidgetHostView* CreateViewForWidget(
46 content::RenderWidgetHost* render_widget_host) OVERRIDE; 46 content::RenderWidgetHost* render_widget_host) OVERRIDE;
47 47
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 private: 97 private:
98 // Insert the given widget into the content area. Should only be used for 98 // Insert the given widget into the content area. Should only be used for
99 // web pages and the like (including interstitials and sad tab). Note that 99 // web pages and the like (including interstitials and sad tab). Note that
100 // this will be perfectly happy to insert overlapping render views, so care 100 // this will be perfectly happy to insert overlapping render views, so care
101 // should be taken that the correct one is hidden/shown. 101 // should be taken that the correct one is hidden/shown.
102 void InsertIntoContentArea(GtkWidget* widget); 102 void InsertIntoContentArea(GtkWidget* widget);
103 103
104 // Handle focus traversal on the render widget native view. Can be overridden 104 // Handle focus traversal on the render widget native view. Can be overridden
105 // by subclasses. 105 // by subclasses.
106 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, gboolean, OnFocus, GtkDirectionType); 106 CHROMEGTK_CALLBACK_1(WebContentsViewGtk, gboolean, OnFocus, GtkDirectionType);
107 107
108 // Used to adjust the size of its children when the size of |expanded_| is 108 // Used to adjust the size of its children when the size of |expanded_| is
109 // changed. 109 // changed.
110 CHROMEGTK_CALLBACK_2(TabContentsViewGtk, void, OnChildSizeRequest, 110 CHROMEGTK_CALLBACK_2(WebContentsViewGtk, void, OnChildSizeRequest,
111 GtkWidget*, GtkRequisition*); 111 GtkWidget*, GtkRequisition*);
112 112
113 // Used to propagate the size change of |expanded_| to our RWHV to resize the 113 // Used to propagate the size change of |expanded_| to our RWHV to resize the
114 // renderer content. 114 // renderer content.
115 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSizeAllocate, 115 CHROMEGTK_CALLBACK_1(WebContentsViewGtk, void, OnSizeAllocate,
116 GtkAllocation*); 116 GtkAllocation*);
117 117
118 // The WebContentsImpl whose contents we display. 118 // The WebContentsImpl whose contents we display.
119 WebContentsImpl* tab_contents_; 119 WebContentsImpl* tab_contents_;
120 120
121 // Common implementations of some WebContentsView methods. 121 // Common implementations of some WebContentsView methods.
122 TabContentsViewHelper tab_contents_view_helper_; 122 WebContentsViewHelper web_contents_view_helper_;
123 123
124 // This container holds the tab's web page views. It is a GtkExpandedContainer 124 // This container holds the tab's web page views. It is a GtkExpandedContainer
125 // so that we can control the size of the web pages. 125 // so that we can control the size of the web pages.
126 ui::OwnedWidgetGtk expanded_; 126 ui::OwnedWidgetGtk expanded_;
127 127
128 ui::FocusStoreGtk focus_store_; 128 ui::FocusStoreGtk focus_store_;
129 129
130 // The helper object that handles drag destination related interactions with 130 // The helper object that handles drag destination related interactions with
131 // GTK. 131 // GTK.
132 scoped_ptr<WebDragDestGtk> drag_dest_; 132 scoped_ptr<WebDragDestGtk> drag_dest_;
133 133
134 // Object responsible for handling drags from the page for us. 134 // Object responsible for handling drags from the page for us.
135 scoped_ptr<WebDragSourceGtk> drag_source_; 135 scoped_ptr<WebDragSourceGtk> drag_source_;
136 136
137 // Our optional views wrapper. If non-NULL, we return this widget as our 137 // Our optional views wrapper. If non-NULL, we return this widget as our
138 // GetNativeView() and insert |expanded_| as its child in the GtkWidget 138 // GetNativeView() and insert |expanded_| as its child in the GtkWidget
139 // hierarchy. 139 // hierarchy.
140 scoped_ptr<WebContentsViewDelegate> delegate_; 140 scoped_ptr<WebContentsViewDelegate> delegate_;
141 141
142 // The size we want the tab contents view to be. We keep this in a separate 142 // The size we want the tab contents view to be. We keep this in a separate
143 // variable because resizing in GTK+ is async. 143 // variable because resizing in GTK+ is async.
144 gfx::Size requested_size_; 144 gfx::Size requested_size_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); 146 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGtk);
147 }; 147 };
148 148
149 } // namespace content 149 } // namespace content
150 150
151 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 151 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698