OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { | 320 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { |
321 drag_dest_->UpdateDragStatus(operation); | 321 drag_dest_->UpdateDragStatus(operation); |
322 } | 322 } |
323 | 323 |
324 void TabContentsViewGtk::GotFocus() { | 324 void TabContentsViewGtk::GotFocus() { |
325 tab_contents()->delegate()->TabContentsFocused(tab_contents()); | 325 tab_contents()->delegate()->TabContentsFocused(tab_contents()); |
326 } | 326 } |
327 | 327 |
328 void TabContentsViewGtk::TakeFocus(bool reverse) { | 328 void TabContentsViewGtk::TakeFocus(bool reverse) { |
329 // This is called when we the renderer asks us to take focus back (i.e., it | 329 if (!tab_contents()->delegate()->TakeFocus(reverse)) { |
330 // has iterated past the last focusable element on the page). | 330 |
331 gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()), | 331 views::FocusManager* focus_manager = |
332 reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD); | 332 views::FocusManager::GetFocusManagerForNativeView(GetNativeView()); |
| 333 |
| 334 // We may not have a focus manager if the tab has been switched before this |
| 335 // message arrived. |
| 336 if (focus_manager) |
| 337 focus_manager->AdvanceFocus(reverse); |
| 338 } |
333 } | 339 } |
334 | 340 |
335 void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { | 341 void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { |
336 // Allow delegates to handle the context menu operation first. | 342 // Allow delegates to handle the context menu operation first. |
337 if (tab_contents()->delegate()->HandleContextMenu(params)) | 343 if (tab_contents()->delegate()->HandleContextMenu(params)) |
338 return; | 344 return; |
339 | 345 |
340 context_menu_.reset(new RenderViewContextMenuGtk(tab_contents(), params)); | 346 context_menu_.reset(new RenderViewContextMenuGtk(tab_contents(), params)); |
341 context_menu_->Init(); | 347 context_menu_->Init(); |
342 | 348 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 // not NULL, else our delegate. | 446 // not NULL, else our delegate. |
441 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 447 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
442 GdkEventMotion* event) { | 448 GdkEventMotion* event) { |
443 if (sad_tab_ != NULL) | 449 if (sad_tab_ != NULL) |
444 WidgetGtk::OnMotionNotify(widget, event); | 450 WidgetGtk::OnMotionNotify(widget, event); |
445 else if (tab_contents()->delegate()) | 451 else if (tab_contents()->delegate()) |
446 tab_contents()->delegate()->ContentsMouseEvent( | 452 tab_contents()->delegate()->ContentsMouseEvent( |
447 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 453 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
448 return FALSE; | 454 return FALSE; |
449 } | 455 } |
OLD | NEW |