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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_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/tab_contents/tab_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 WebContentsViewGtkDelegate; | 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 TabContentsViewGtk : 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 // TODO(jam): make this take a WebContents once it's created from content. | 35 // TODO(jam): make this take a WebContents once it's created from content. |
36 TabContentsViewGtk(content::WebContents* web_contents, | 36 TabContentsViewGtk(content::WebContents* web_contents, |
37 WebContentsViewGtkDelegate* delegate); | 37 WebContentsViewDelegate* delegate); |
38 virtual ~TabContentsViewGtk(); | 38 virtual ~TabContentsViewGtk(); |
39 | 39 |
40 // Override the stored focus widget. This call only makes sense when the | 40 // Override the stored focus widget. This call only makes sense when the |
41 // tab contents is not focused. | 41 // tab contents is not focused. |
42 void SetFocusedWidget(GtkWidget* widget); | 42 void SetFocusedWidget(GtkWidget* widget); |
43 | 43 |
44 WebContentsViewGtkDelegate* delegate() const { return delegate_.get(); } | 44 WebContentsViewDelegate* delegate() const { return delegate_.get(); } |
45 TabContents* tab_contents() { return tab_contents_; } | 45 TabContents* tab_contents() { return tab_contents_; } |
46 GtkWidget* expanded_container() { return expanded_.get(); } | 46 GtkWidget* expanded_container() { return expanded_.get(); } |
47 WebContents* web_contents(); | 47 WebContents* web_contents(); |
48 | 48 |
49 // Allows our embeder to intercept incoming drag messages. | |
50 void SetDragDestDelegate(WebDragDestDelegate* delegate); | |
51 | |
52 // WebContentsView implementation -------------------------------------------- | 49 // WebContentsView implementation -------------------------------------------- |
53 | 50 |
54 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 51 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
55 virtual content::RenderWidgetHostView* CreateViewForWidget( | 52 virtual content::RenderWidgetHostView* CreateViewForWidget( |
56 content::RenderWidgetHost* render_widget_host) OVERRIDE; | 53 content::RenderWidgetHost* render_widget_host) OVERRIDE; |
57 | 54 |
58 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 55 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
59 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; | 56 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
60 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; | 57 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; |
61 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; | 58 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // The helper object that handles drag destination related interactions with | 137 // The helper object that handles drag destination related interactions with |
141 // GTK. | 138 // GTK. |
142 scoped_ptr<WebDragDestGtk> drag_dest_; | 139 scoped_ptr<WebDragDestGtk> drag_dest_; |
143 | 140 |
144 // Object responsible for handling drags from the page for us. | 141 // Object responsible for handling drags from the page for us. |
145 scoped_ptr<WebDragSourceGtk> drag_source_; | 142 scoped_ptr<WebDragSourceGtk> drag_source_; |
146 | 143 |
147 // Our optional views wrapper. If non-NULL, we return this widget as our | 144 // Our optional views wrapper. If non-NULL, we return this widget as our |
148 // GetNativeView() and insert |expanded_| as its child in the GtkWidget | 145 // GetNativeView() and insert |expanded_| as its child in the GtkWidget |
149 // hierarchy. | 146 // hierarchy. |
150 scoped_ptr<WebContentsViewGtkDelegate> delegate_; | 147 scoped_ptr<WebContentsViewDelegate> delegate_; |
151 | 148 |
152 // The size we want the tab contents view to be. We keep this in a separate | 149 // The size we want the tab contents view to be. We keep this in a separate |
153 // variable because resizing in GTK+ is async. | 150 // variable because resizing in GTK+ is async. |
154 gfx::Size requested_size_; | 151 gfx::Size requested_size_; |
155 | 152 |
156 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); | 153 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
157 }; | 154 }; |
158 | 155 |
159 } // namespace content | 156 } // namespace content |
160 | 157 |
161 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 158 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
OLD | NEW |