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

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

Issue 9705053: Remove tab_contents_view_gtk.h include from chrome. I tried to find a way to not have to expose the… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" 5 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.h"
12 #include "chrome/browser/ui/constrained_window_tab_helper.h" 12 #include "chrome/browser/ui/constrained_window_tab_helper.h"
13 #include "chrome/browser/ui/gtk/gtk_util.h" 13 #include "chrome/browser/ui/gtk/gtk_util.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "ui/base/gtk/focus_store_gtk.h"
17 #include "ui/base/gtk/gtk_compat.h" 18 #include "ui/base/gtk/gtk_compat.h"
18 #include "ui/base/gtk/gtk_hig_constants.h" 19 #include "ui/base/gtk/gtk_hig_constants.h"
19 20
20 #if defined(TOOLKIT_VIEWS) 21 #if defined(TOOLKIT_VIEWS)
21 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" 22 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h"
22 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" 23 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
23 #else 24 #else
24 #include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_gtk.h" 25 #include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_gtk.h"
25 #include "content/browser/tab_contents/tab_contents_view_gtk.h"
26 #endif 26 #endif
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { 30 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() {
31 } 31 }
32 32
33 bool ConstrainedWindowGtkDelegate::GetBackgroundColor(GdkColor* color) { 33 bool ConstrainedWindowGtkDelegate::GetBackgroundColor(GdkColor* color) {
34 return false; 34 return false;
35 } 35 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ConstrainedWindowTabHelper* helper = 119 ConstrainedWindowTabHelper* helper =
120 wrapper_->constrained_window_tab_helper(); 120 wrapper_->constrained_window_tab_helper();
121 if ((!helper->delegate() || 121 if ((!helper->delegate() ||
122 helper->delegate()->ShouldFocusConstrainedWindow()) && 122 helper->delegate()->ShouldFocusConstrainedWindow()) &&
123 gtk_util::IsWidgetAncestryVisible(focus_widget)) { 123 gtk_util::IsWidgetAncestryVisible(focus_widget)) {
124 gtk_widget_grab_focus(focus_widget); 124 gtk_widget_grab_focus(focus_widget);
125 } else { 125 } else {
126 // TODO(estade): this define should not need to be here because this class 126 // TODO(estade): this define should not need to be here because this class
127 // should not be used on linux/views. 127 // should not be used on linux/views.
128 #if defined(TOOLKIT_GTK) 128 #if defined(TOOLKIT_GTK)
129 static_cast<content::TabContentsViewGtk*>( 129 ContainingView()->focus_store()->SetWidget(focus_widget);
130 wrapper_->web_contents()->GetView())->SetFocusedWidget(focus_widget);
131 #endif 130 #endif
132 } 131 }
133 } 132 }
134 133
135 ConstrainedWindowGtk::TabContentsViewType* 134 ConstrainedWindowGtk::TabContentsViewType*
136 ConstrainedWindowGtk::ContainingView() { 135 ConstrainedWindowGtk::ContainingView() {
137 #if defined(TOOLKIT_VIEWS) 136 #if defined(TOOLKIT_VIEWS)
138 return static_cast<NativeTabContentsViewGtk*>( 137 return static_cast<NativeTabContentsViewGtk*>(
139 static_cast<TabContentsViewViews*>(wrapper_->web_contents()->GetView())-> 138 static_cast<TabContentsViewViews*>(wrapper_->web_contents()->GetView())->
140 native_tab_contents_view()); 139 native_tab_contents_view());
141 #else 140 #else
142 return static_cast<TabContentsViewType*>( 141 return ChromeWebContentsViewDelegateGtk::GetFor(wrapper_->web_contents());
143 static_cast<content::TabContentsViewGtk*>(
144 wrapper_->web_contents()->GetView())->delegate());
145 #endif 142 #endif
146 } 143 }
147 144
148 gboolean ConstrainedWindowGtk::OnKeyPress(GtkWidget* sender, 145 gboolean ConstrainedWindowGtk::OnKeyPress(GtkWidget* sender,
149 GdkEventKey* key) { 146 GdkEventKey* key) {
150 if (key->keyval == GDK_Escape) { 147 if (key->keyval == GDK_Escape) {
151 // Let the stack unwind so the event handler can release its ref 148 // Let the stack unwind so the event handler can release its ref
152 // on widget(). 149 // on widget().
153 MessageLoop::current()->PostTask( 150 MessageLoop::current()->PostTask(
154 FROM_HERE, 151 FROM_HERE,
155 base::Bind(&ConstrainedWindowGtk::CloseConstrainedWindow, 152 base::Bind(&ConstrainedWindowGtk::CloseConstrainedWindow,
156 weak_factory_.GetWeakPtr())); 153 weak_factory_.GetWeakPtr()));
157 return TRUE; 154 return TRUE;
158 } 155 }
159 156
160 return FALSE; 157 return FALSE;
161 } 158 }
162 159
163 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender, 160 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender,
164 GtkWidget* previous_toplevel) { 161 GtkWidget* previous_toplevel) {
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
166 if (!gtk_widget_is_toplevel(gtk_widget_get_toplevel(widget()))) 163 if (!gtk_widget_is_toplevel(gtk_widget_get_toplevel(widget())))
167 return; 164 return;
168 165
169 FocusConstrainedWindow(); 166 FocusConstrainedWindow();
170 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/chrome_web_contents_view_delegate_gtk.cc ('k') | chrome/browser/ui/sad_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698