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

Side by Side Diff: chrome/browser/views/tab_contents/tab_contents_view_gtk.cc

Issue 392007: gtk: Hide the status bubble when the mouse nears it. (Closed)
Patch Set: merge again Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // 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 "app/gfx/canvas_paint.h" 10 #include "app/gfx/canvas_paint.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/gfx/point.h" 12 #include "base/gfx/point.h"
13 #include "base/gfx/rect.h" 13 #include "base/gfx/rect.h"
14 #include "base/gfx/size.h" 14 #include "base/gfx/size.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/download/download_shelf.h" 16 #include "chrome/browser/download/download_shelf.h"
17 #include "chrome/browser/gtk/constrained_window_gtk.h" 17 #include "chrome/browser/gtk/constrained_window_gtk.h"
18 #include "chrome/browser/gtk/tab_contents_drag_source.h" 18 #include "chrome/browser/gtk/tab_contents_drag_source.h"
19 #include "chrome/browser/renderer_host/render_view_host.h" 19 #include "chrome/browser/renderer_host/render_view_host.h"
20 #include "chrome/browser/renderer_host/render_view_host_factory.h" 20 #include "chrome/browser/renderer_host/render_view_host_factory.h"
21 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 21 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
22 #include "chrome/browser/tab_contents/interstitial_page.h" 22 #include "chrome/browser/tab_contents/interstitial_page.h"
23 #include "chrome/browser/tab_contents/tab_contents.h" 23 #include "chrome/browser/tab_contents/tab_contents.h"
24 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 24 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
25 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h" 25 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h"
26 #include "chrome/browser/views/blocked_popup_container_view_views.h" 26 #include "chrome/browser/views/blocked_popup_container_view_views.h"
27 #include "chrome/browser/views/sad_tab_view.h" 27 #include "chrome/browser/views/sad_tab_view.h"
28 #include "chrome/browser/views/tab_contents/render_view_context_menu_win.h" 28 #include "chrome/browser/views/tab_contents/render_view_context_menu_win.h"
29 #include "views/controls/native/native_view_host.h"
29 #include "views/focus/view_storage.h" 30 #include "views/focus/view_storage.h"
30 #include "views/controls/native/native_view_host.h" 31 #include "views/screen.h"
31 #include "views/widget/root_view.h" 32 #include "views/widget/root_view.h"
32 33
33 using WebKit::WebDragOperation; 34 using WebKit::WebDragOperation;
34 using WebKit::WebDragOperationsMask; 35 using WebKit::WebDragOperationsMask;
35 using WebKit::WebInputEvent; 36 using WebKit::WebInputEvent;
36 37
37 38
38 namespace { 39 namespace {
39 40
40 // Called when the content view gtk widget is tabbed to, or after the call to 41 // Called when the content view gtk widget is tabbed to, or after the call to
(...skipping 14 matching lines...) Expand all
55 tab_contents->FocusThroughTabTraversal(reverse); 56 tab_contents->FocusThroughTabTraversal(reverse);
56 return TRUE; 57 return TRUE;
57 } 58 }
58 59
59 // Called when the mouse leaves the widget. We notify our delegate. 60 // Called when the mouse leaves the widget. We notify our delegate.
60 // WidgetGtk also defines OnLeaveNotify, so we use the name OnLeaveNotify2 61 // WidgetGtk also defines OnLeaveNotify, so we use the name OnLeaveNotify2
61 // here. 62 // here.
62 gboolean OnLeaveNotify2(GtkWidget* widget, GdkEventCrossing* event, 63 gboolean OnLeaveNotify2(GtkWidget* widget, GdkEventCrossing* event,
63 TabContents* tab_contents) { 64 TabContents* tab_contents) {
64 if (tab_contents->delegate()) 65 if (tab_contents->delegate())
65 tab_contents->delegate()->ContentsMouseEvent(tab_contents, false); 66 tab_contents->delegate()->ContentsMouseEvent(
67 tab_contents, views::Screen::GetCursorScreenPoint(), false);
66 return FALSE; 68 return FALSE;
67 } 69 }
68 70
69 // Called when the mouse moves within the widget. We notify our delegate. 71 // Called when the mouse moves within the widget. We notify our delegate.
70 gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event, 72 gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event,
71 TabContents* tab_contents) { 73 TabContents* tab_contents) {
72 if (tab_contents->delegate()) 74 if (tab_contents->delegate())
73 tab_contents->delegate()->ContentsMouseEvent(tab_contents, true); 75 tab_contents->delegate()->ContentsMouseEvent(
76 tab_contents, views::Screen::GetCursorScreenPoint(), true);
74 return FALSE; 77 return FALSE;
75 } 78 }
76 79
77 // See tab_contents_view_win.cc for discussion of mouse scroll zooming. 80 // See tab_contents_view_win.cc for discussion of mouse scroll zooming.
78 gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, 81 gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event,
79 TabContents* tab_contents) { 82 TabContents* tab_contents) {
80 if ((event->state & gtk_accelerator_get_default_mod_mask()) == 83 if ((event->state & gtk_accelerator_get_default_mod_mask()) ==
81 GDK_CONTROL_MASK) { 84 GDK_CONTROL_MASK) {
82 if (event->direction == GDK_SCROLL_DOWN) { 85 if (event->direction == GDK_SCROLL_DOWN) {
83 tab_contents->delegate()->ContentsZoomChange(false); 86 tab_contents->delegate()->ContentsZoomChange(false);
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 l = constrained_windows_.end(); f != l; ++f) { 419 l = constrained_windows_.end(); f != l; ++f) {
417 GtkWidget* widget = (*f)->widget(); 420 GtkWidget* widget = (*f)->widget();
418 421
419 GtkRequisition requisition; 422 GtkRequisition requisition;
420 gtk_widget_size_request(widget, &requisition); 423 gtk_widget_size_request(widget, &requisition);
421 424
422 int child_x = std::max(half_view_width - (requisition.width / 2), 0); 425 int child_x = std::max(half_view_width - (requisition.width / 2), 0);
423 PositionChild(widget, child_x, 0, requisition.width, requisition.height); 426 PositionChild(widget, child_x, 0, requisition.width, requisition.height);
424 } 427 }
425 } 428 }
426
OLDNEW
« no previous file with comments | « chrome/browser/views/status_bubble_views.cc ('k') | chrome/browser/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698