| OLD | NEW |
| 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 #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 "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 11 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_util.h" | 12 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "ui/base/gtk/gtk_compat.h" | 16 #include "ui/base/gtk/gtk_compat.h" |
| 17 #include "ui/base/gtk/gtk_hig_constants.h" | 17 #include "ui/base/gtk/gtk_hig_constants.h" |
| 18 | 18 |
| 19 #if defined(TOUCH_UI) | 19 #if defined(TOOLKIT_VIEWS) |
| 20 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | |
| 21 #elif defined(TOOLKIT_VIEWS) | |
| 22 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" | 20 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" |
| 23 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | 21 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 24 #else | 22 #else |
| 25 #include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" | 23 #include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" |
| 26 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 24 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 27 #endif | 25 #endif |
| 28 | 26 |
| 29 using content::BrowserThread; | 27 using content::BrowserThread; |
| 30 | 28 |
| 31 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { | 29 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // should not be used on linux/views. | 126 // should not be used on linux/views. |
| 129 #if defined(TOOLKIT_GTK) | 127 #if defined(TOOLKIT_GTK) |
| 130 static_cast<TabContentsViewGtk*>(wrapper_->view())-> | 128 static_cast<TabContentsViewGtk*>(wrapper_->view())-> |
| 131 SetFocusedWidget(focus_widget); | 129 SetFocusedWidget(focus_widget); |
| 132 #endif | 130 #endif |
| 133 } | 131 } |
| 134 } | 132 } |
| 135 | 133 |
| 136 ConstrainedWindowGtk::TabContentsViewType* | 134 ConstrainedWindowGtk::TabContentsViewType* |
| 137 ConstrainedWindowGtk::ContainingView() { | 135 ConstrainedWindowGtk::ContainingView() { |
| 138 #if defined(TOOLKIT_VIEWS) && !defined(TOUCH_UI) | 136 #if defined(TOOLKIT_VIEWS) |
| 139 return static_cast<NativeTabContentsViewGtk*>( | 137 return static_cast<NativeTabContentsViewGtk*>( |
| 140 static_cast<TabContentsViewViews*>(wrapper_->view())-> | 138 static_cast<TabContentsViewViews*>(wrapper_->view())-> |
| 141 native_tab_contents_view()); | 139 native_tab_contents_view()); |
| 142 #else | 140 #else |
| 143 return static_cast<TabContentsViewType*>( | 141 return static_cast<TabContentsViewType*>( |
| 144 static_cast<TabContentsViewGtk*>(wrapper_->view())-> | 142 static_cast<TabContentsViewGtk*>(wrapper_->view())-> |
| 145 wrapper()); | 143 wrapper()); |
| 146 #endif | 144 #endif |
| 147 } | 145 } |
| 148 | 146 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 162 } | 160 } |
| 163 | 161 |
| 164 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender, | 162 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender, |
| 165 GtkWidget* previous_toplevel) { | 163 GtkWidget* previous_toplevel) { |
| 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 167 if (!gtk_widget_is_toplevel(gtk_widget_get_toplevel(widget()))) | 165 if (!gtk_widget_is_toplevel(gtk_widget_get_toplevel(widget()))) |
| 168 return; | 166 return; |
| 169 | 167 |
| 170 FocusConstrainedWindow(); | 168 FocusConstrainedWindow(); |
| 171 } | 169 } |
| OLD | NEW |