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/notifications/balloon_collection_impl.h" | 5 #include "chrome/browser/notifications/balloon_collection_impl.h" |
6 | 6 |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "ui/gfx/size.h" | 8 #include "ui/gfx/size.h" |
9 | 9 |
10 #if defined(TOOLKIT_VIEWS) | 10 #if defined(TOOLKIT_VIEWS) |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { | 34 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { |
35 return 5; | 35 return 5; |
36 } | 36 } |
37 | 37 |
38 void BalloonCollectionImpl::PositionBalloons(bool reposition) { | 38 void BalloonCollectionImpl::PositionBalloons(bool reposition) { |
39 PositionBalloonsInternal(reposition); | 39 PositionBalloonsInternal(reposition); |
40 } | 40 } |
41 | 41 |
| 42 #if defined(TOUCH_UI) |
| 43 base::EventStatus BalloonCollectionImpl::WillProcessEvent( |
| 44 const base::NativeEvent& event) { |
| 45 return base::EVENT_CONTINUE; |
| 46 } |
| 47 |
| 48 void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) { |
| 49 NOTIMPLEMENTED(); |
| 50 } |
| 51 #else |
| 52 void BalloonCollectionImpl::WillProcessEvent(GdkEvent* event) { |
| 53 } |
| 54 |
42 void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) { | 55 void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) { |
43 switch (event->type) { | 56 switch (event->type) { |
44 case GDK_MOTION_NOTIFY: | 57 case GDK_MOTION_NOTIFY: |
45 case GDK_LEAVE_NOTIFY: | 58 case GDK_LEAVE_NOTIFY: |
46 HandleMouseMoveEvent(); | 59 HandleMouseMoveEvent(); |
47 break; | 60 break; |
48 default: | 61 default: |
49 break; | 62 break; |
50 } | 63 } |
51 } | 64 } |
| 65 #endif |
52 | 66 |
53 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { | 67 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { |
54 GdkScreen* screen = gdk_screen_get_default(); | 68 GdkScreen* screen = gdk_screen_get_default(); |
55 GdkDisplay* display = gdk_screen_get_display(screen); | 69 GdkDisplay* display = gdk_screen_get_display(screen); |
56 gint x, y; | 70 gint x, y; |
57 gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 71 gdk_display_get_pointer(display, NULL, &x, &y, NULL); |
58 gfx::Point cursor(x, y); | 72 gfx::Point cursor(x, y); |
59 | 73 |
60 return GetBalloonsBoundingBox().Contains(cursor); | 74 return GetBalloonsBoundingBox().Contains(cursor); |
61 } | 75 } |
(...skipping 16 matching lines...) Expand all Loading... |
78 else | 92 else |
79 NOTREACHED(); | 93 NOTREACHED(); |
80 | 94 |
81 PositionBalloons(true); | 95 PositionBalloons(true); |
82 } | 96 } |
83 | 97 |
84 // static | 98 // static |
85 BalloonCollection* BalloonCollection::Create() { | 99 BalloonCollection* BalloonCollection::Create() { |
86 return new BalloonCollectionImpl(); | 100 return new BalloonCollectionImpl(); |
87 } | 101 } |
OLD | NEW |