| 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 "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/gtk/gtk_util.h" | 10 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 11 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
| 12 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 | 13 |
| 14 #if defined(TOUCH_UI) | 14 #if defined(TOUCH_UI) |
| 15 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" | 15 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
| 16 #elif defined(TOOLKIT_VIEWS) |
| 17 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" |
| 18 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 16 #else | 19 #else |
| 17 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 20 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 18 #endif | 21 #endif |
| 19 | 22 |
| 20 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { | 23 ConstrainedWindowGtkDelegate::~ConstrainedWindowGtkDelegate() { |
| 21 } | 24 } |
| 22 | 25 |
| 23 bool ConstrainedWindowGtkDelegate::GetBackgroundColor(GdkColor* color) { | 26 bool ConstrainedWindowGtkDelegate::GetBackgroundColor(GdkColor* color) { |
| 24 return false; | 27 return false; |
| 25 } | 28 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // should not be used on linux/views. | 116 // should not be used on linux/views. |
| 114 #if defined(TOOLKIT_GTK) | 117 #if defined(TOOLKIT_GTK) |
| 115 static_cast<TabContentsViewGtk*>(owner_->view())-> | 118 static_cast<TabContentsViewGtk*>(owner_->view())-> |
| 116 SetFocusedWidget(focus_widget); | 119 SetFocusedWidget(focus_widget); |
| 117 #endif | 120 #endif |
| 118 } | 121 } |
| 119 } | 122 } |
| 120 | 123 |
| 121 ConstrainedWindowGtk::TabContentsViewType* | 124 ConstrainedWindowGtk::TabContentsViewType* |
| 122 ConstrainedWindowGtk::ContainingView() { | 125 ConstrainedWindowGtk::ContainingView() { |
| 126 #if defined(TOOLKIT_VIEWS) |
| 127 return static_cast<NativeTabContentsViewGtk*>( |
| 128 static_cast<TabContentsViewViews*>(owner_->view())-> |
| 129 native_tab_contents_view()); |
| 130 #else |
| 123 return static_cast<TabContentsViewType*>(owner_->view()); | 131 return static_cast<TabContentsViewType*>(owner_->view()); |
| 132 #endif |
| 124 } | 133 } |
| 125 | 134 |
| 126 gboolean ConstrainedWindowGtk::OnKeyPress(GtkWidget* sender, | 135 gboolean ConstrainedWindowGtk::OnKeyPress(GtkWidget* sender, |
| 127 GdkEventKey* key) { | 136 GdkEventKey* key) { |
| 128 if (key->keyval == GDK_Escape) { | 137 if (key->keyval == GDK_Escape) { |
| 129 // Let the stack unwind so the event handler can release its ref | 138 // Let the stack unwind so the event handler can release its ref |
| 130 // on widget(). | 139 // on widget(). |
| 131 MessageLoop::current()->PostTask(FROM_HERE, | 140 MessageLoop::current()->PostTask(FROM_HERE, |
| 132 factory_.NewRunnableMethod( | 141 factory_.NewRunnableMethod( |
| 133 &ConstrainedWindowGtk::CloseConstrainedWindow)); | 142 &ConstrainedWindowGtk::CloseConstrainedWindow)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 145 | 154 |
| 146 FocusConstrainedWindow(); | 155 FocusConstrainedWindow(); |
| 147 } | 156 } |
| 148 | 157 |
| 149 // static | 158 // static |
| 150 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 159 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
| 151 TabContents* parent, | 160 TabContents* parent, |
| 152 ConstrainedWindowGtkDelegate* delegate) { | 161 ConstrainedWindowGtkDelegate* delegate) { |
| 153 return new ConstrainedWindowGtk(parent, delegate); | 162 return new ConstrainedWindowGtk(parent, delegate); |
| 154 } | 163 } |
| OLD | NEW |