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 TabContentsViewWrapperGtk; | 23 class WebContentsViewGtkDelegate; |
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 explicit TabContentsViewGtk(content::WebContents* web_contents, | 36 TabContentsViewGtk(content::WebContents* web_contents, |
37 TabContentsViewWrapperGtk* wrapper); | 37 WebContentsViewGtkDelegate* 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 TabContentsViewWrapperGtk* wrapper() const { return view_wrapper_.get(); } | 44 WebContentsViewGtkDelegate* 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. | 49 // Allows our embeder to intercept incoming drag messages. |
50 void SetDragDestDelegate(WebDragDestDelegate* delegate); | 50 void SetDragDestDelegate(WebDragDestDelegate* delegate); |
51 | 51 |
52 // WebContentsView implementation -------------------------------------------- | 52 // WebContentsView implementation -------------------------------------------- |
53 | 53 |
54 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 54 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // The helper object that handles drag destination related interactions with | 142 // The helper object that handles drag destination related interactions with |
143 // GTK. | 143 // GTK. |
144 scoped_ptr<WebDragDestGtk> drag_dest_; | 144 scoped_ptr<WebDragDestGtk> drag_dest_; |
145 | 145 |
146 // Object responsible for handling drags from the page for us. | 146 // Object responsible for handling drags from the page for us. |
147 scoped_ptr<WebDragSourceGtk> drag_source_; | 147 scoped_ptr<WebDragSourceGtk> drag_source_; |
148 | 148 |
149 // Our optional views wrapper. If non-NULL, we return this widget as our | 149 // Our optional views wrapper. If non-NULL, we return this widget as our |
150 // GetNativeView() and insert |expanded_| as its child in the GtkWidget | 150 // GetNativeView() and insert |expanded_| as its child in the GtkWidget |
151 // hierarchy. | 151 // hierarchy. |
152 scoped_ptr<TabContentsViewWrapperGtk> view_wrapper_; | 152 scoped_ptr<WebContentsViewGtkDelegate> delegate_; |
153 | 153 |
154 // The size we want the tab contents view to be. We keep this in a separate | 154 // The size we want the tab contents view to be. We keep this in a separate |
155 // variable because resizing in GTK+ is async. | 155 // variable because resizing in GTK+ is async. |
156 gfx::Size requested_size_; | 156 gfx::Size requested_size_; |
157 | 157 |
158 // The overlaid view. Owned by the caller of |InstallOverlayView|; this is a | 158 // The overlaid view. Owned by the caller of |InstallOverlayView|; this is a |
159 // weak reference. | 159 // weak reference. |
160 GtkWidget* overlaid_view_; | 160 GtkWidget* overlaid_view_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); | 162 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
163 }; | 163 }; |
164 | 164 |
165 } // namespace content | 165 } // namespace content |
166 | 166 |
167 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 167 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
OLD | NEW |