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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_view_gtk.h

Issue 8477042: Move Sad Tab implementation out of the TabContentsViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes for jochen and jam Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 6 #define CHROME_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 "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 14 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
15 #include "chrome/browser/ui/gtk/focus_store_gtk.h" 15 #include "chrome/browser/ui/gtk/focus_store_gtk.h"
16 #include "content/browser/tab_contents/tab_contents_view.h" 16 #include "content/browser/tab_contents/tab_contents_view.h"
17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h"
19 #include "ui/base/gtk/gtk_signal.h" 17 #include "ui/base/gtk/gtk_signal.h"
20 #include "ui/base/gtk/owned_widget_gtk.h" 18 #include "ui/base/gtk/owned_widget_gtk.h"
21 19
22 class ConstrainedWindowGtk; 20 class ConstrainedWindowGtk;
23 class RenderViewContextMenuGtk; 21 class RenderViewContextMenuGtk;
24 class SadTabGtk;
25 class WebDragBookmarkHandlerGtk; 22 class WebDragBookmarkHandlerGtk;
26 23
27 namespace content { 24 namespace content {
28 class WebDragDestGtk; 25 class WebDragDestGtk;
29 class WebDragSourceGtk; 26 class WebDragSourceGtk;
30 } 27 }
31 28
32 class TabContentsViewGtk : public TabContentsView, 29 class TabContentsViewGtk : public TabContentsView {
33 public content::NotificationObserver {
34 public: 30 public:
35 // The corresponding TabContents is passed in the constructor, and manages our 31 // The corresponding TabContents is passed in the constructor, and manages our
36 // lifetime. This doesn't need to be the case, but is this way currently 32 // lifetime. This doesn't need to be the case, but is this way currently
37 // because that's what was easiest when they were split. 33 // because that's what was easiest when they were split.
38 explicit TabContentsViewGtk(TabContents* tab_contents); 34 explicit TabContentsViewGtk(TabContents* tab_contents);
39 virtual ~TabContentsViewGtk(); 35 virtual ~TabContentsViewGtk();
40 36
41 // Unlike Windows, ConstrainedWindows need to collaborate with the 37 // Unlike Windows, ConstrainedWindows need to collaborate with the
42 // TabContentsViewGtk to position the dialogs. 38 // TabContentsViewGtk to position the dialogs.
43 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); 39 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window);
(...skipping 20 matching lines...) Expand all
64 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; 60 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
65 virtual void Focus() OVERRIDE; 61 virtual void Focus() OVERRIDE;
66 virtual void SetInitialFocus() OVERRIDE; 62 virtual void SetInitialFocus() OVERRIDE;
67 virtual void StoreFocus() OVERRIDE; 63 virtual void StoreFocus() OVERRIDE;
68 virtual void RestoreFocus() OVERRIDE; 64 virtual void RestoreFocus() OVERRIDE;
69 virtual bool IsDoingDrag() const OVERRIDE; 65 virtual bool IsDoingDrag() const OVERRIDE;
70 virtual void CancelDragAndCloseTab() OVERRIDE; 66 virtual void CancelDragAndCloseTab() OVERRIDE;
71 virtual bool IsEventTracking() const OVERRIDE; 67 virtual bool IsEventTracking() const OVERRIDE;
72 virtual void CloseTabAfterEventTracking() OVERRIDE; 68 virtual void CloseTabAfterEventTracking() OVERRIDE;
73 virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE; 69 virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
70 virtual void InstallOverlayView(gfx::NativeView view) OVERRIDE;
71 virtual void RemoveOverlayView() OVERRIDE;
74 72
75 // Backend implementation of RenderViewHostDelegate::View. 73 // Backend implementation of RenderViewHostDelegate::View.
76 virtual void CreateNewWindow( 74 virtual void CreateNewWindow(
77 int route_id, 75 int route_id,
78 const ViewHostMsg_CreateWindow_Params& params); 76 const ViewHostMsg_CreateWindow_Params& params);
79 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); 77 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
80 virtual void CreateNewFullscreenWidget(int route_id); 78 virtual void CreateNewFullscreenWidget(int route_id);
81 virtual void ShowCreatedWindow(int route_id, 79 virtual void ShowCreatedWindow(int route_id,
82 WindowOpenDisposition disposition, 80 WindowOpenDisposition disposition,
83 const gfx::Rect& initial_pos, 81 const gfx::Rect& initial_pos,
84 bool user_gesture); 82 bool user_gesture);
85 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); 83 virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos);
86 virtual void ShowCreatedFullscreenWidget(int route_id); 84 virtual void ShowCreatedFullscreenWidget(int route_id);
87 virtual void ShowContextMenu(const ContextMenuParams& params); 85 virtual void ShowContextMenu(const ContextMenuParams& params);
88 virtual void ShowPopupMenu(const gfx::Rect& bounds, 86 virtual void ShowPopupMenu(const gfx::Rect& bounds,
89 int item_height, 87 int item_height,
90 double item_font_size, 88 double item_font_size,
91 int selected_item, 89 int selected_item,
92 const std::vector<WebMenuItem>& items, 90 const std::vector<WebMenuItem>& items,
93 bool right_aligned); 91 bool right_aligned);
94 virtual void StartDragging(const WebDropData& drop_data, 92 virtual void StartDragging(const WebDropData& drop_data,
95 WebKit::WebDragOperationsMask allowed_ops, 93 WebKit::WebDragOperationsMask allowed_ops,
96 const SkBitmap& image, 94 const SkBitmap& image,
97 const gfx::Point& image_offset); 95 const gfx::Point& image_offset);
98 virtual void UpdateDragCursor(WebKit::WebDragOperation operation); 96 virtual void UpdateDragCursor(WebKit::WebDragOperation operation);
99 virtual void GotFocus(); 97 virtual void GotFocus();
100 virtual void TakeFocus(bool reverse); 98 virtual void TakeFocus(bool reverse);
101 99
102 // content::NotificationObserver implementation ------------------------------
103
104 virtual void Observe(int type,
105 const content::NotificationSource& source,
106 const content::NotificationDetails& details);
107
108 private: 100 private:
109 // Insert the given widget into the content area. Should only be used for 101 // Insert the given widget into the content area. Should only be used for
110 // web pages and the like (including interstitials and sad tab). Note that 102 // web pages and the like (including interstitials and sad tab). Note that
111 // this will be perfectly happy to insert overlapping render views, so care 103 // this will be perfectly happy to insert overlapping render views, so care
112 // should be taken that the correct one is hidden/shown. 104 // should be taken that the correct one is hidden/shown.
113 void InsertIntoContentArea(GtkWidget* widget); 105 void InsertIntoContentArea(GtkWidget* widget);
114 106
115 void CancelDragIfAny(); 107 void CancelDragIfAny();
116 108
117 // Handle focus traversal on the render widget native view. 109 // Handle focus traversal on the render widget native view.
(...skipping 11 matching lines...) Expand all
129 121
130 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSetFloatingPosition, 122 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSetFloatingPosition,
131 GtkAllocation*); 123 GtkAllocation*);
132 124
133 // The TabContents whose contents we display. 125 // The TabContents whose contents we display.
134 TabContents* tab_contents_; 126 TabContents* tab_contents_;
135 127
136 // Common implementations of some RenderViewHostDelegate::View methods. 128 // Common implementations of some RenderViewHostDelegate::View methods.
137 RenderViewHostDelegateViewHelper delegate_view_helper_; 129 RenderViewHostDelegateViewHelper delegate_view_helper_;
138 130
139
140 // Contains |expanded_| as its GtkBin member. 131 // Contains |expanded_| as its GtkBin member.
141 ui::OwnedWidgetGtk floating_; 132 ui::OwnedWidgetGtk floating_;
142 133
143 // This container holds the tab's web page views. It is a GtkExpandedContainer 134 // This container holds the tab's web page views. It is a GtkExpandedContainer
144 // so that we can control the size of the web pages. 135 // so that we can control the size of the web pages.
145 GtkWidget* expanded_; 136 GtkWidget* expanded_;
146 137
147 // The context menu is reset every time we show it, but we keep a pointer to 138 // The context menu is reset every time we show it, but we keep a pointer to
148 // between uses so that it won't go out of scope before we're done with it. 139 // between uses so that it won't go out of scope before we're done with it.
149 scoped_ptr<RenderViewContextMenuGtk> context_menu_; 140 scoped_ptr<RenderViewContextMenuGtk> context_menu_;
150 141
151 // Used to get notifications about renderers coming and going.
152 content::NotificationRegistrar registrar_;
153
154 scoped_ptr<SadTabGtk> sad_tab_;
155
156 FocusStoreGtk focus_store_; 142 FocusStoreGtk focus_store_;
157 143
158 // The UI for the constrained dialog currently displayed. This is owned by 144 // The UI for the constrained dialog currently displayed. This is owned by
159 // TabContents, not the view. 145 // TabContents, not the view.
160 ConstrainedWindowGtk* constrained_window_; 146 ConstrainedWindowGtk* constrained_window_;
161 147
162 // The helper object that handles drag destination related interactions with 148 // The helper object that handles drag destination related interactions with
163 // GTK. 149 // GTK.
164 scoped_ptr<content::WebDragDestGtk> drag_dest_; 150 scoped_ptr<content::WebDragDestGtk> drag_dest_;
165 151
166 // The chrome specific delegate that receives events from WebDragDestGtk. 152 // The chrome specific delegate that receives events from WebDragDestGtk.
167 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; 153 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_;
168 154
169 // Object responsible for handling drags from the page for us. 155 // Object responsible for handling drags from the page for us.
170 scoped_ptr<content::WebDragSourceGtk> drag_source_; 156 scoped_ptr<content::WebDragSourceGtk> drag_source_;
171 157
172 // The size we want the tab contents view to be. We keep this in a separate 158 // The size we want the tab contents view to be. We keep this in a separate
173 // variable because resizing in GTK+ is async. 159 // variable because resizing in GTK+ is async.
174 gfx::Size requested_size_; 160 gfx::Size requested_size_;
175 161
162 // The overlaid view. Owned by the caller of |InstallOverlayView|; this is a
163 // weak reference.
164 GtkWidget* overlaid_view_;
165
176 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); 166 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk);
177 }; 167 };
178 168
179 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ 169 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/background_contents.cc ('k') | chrome/browser/tab_contents/tab_contents_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698