| 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 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool BalloonCollectionImpl::Layout::NeedToMoveAboveRightSidePanels() const { | 42 bool BalloonCollectionImpl::Layout::NeedToMoveAboveRightSidePanels() const { |
| 43 return placement_ == VERTICALLY_FROM_BOTTOM_RIGHT; | 43 return placement_ == VERTICALLY_FROM_BOTTOM_RIGHT; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void BalloonCollectionImpl::PositionBalloons(bool reposition) { | 46 void BalloonCollectionImpl::PositionBalloons(bool reposition) { |
| 47 PositionBalloonsInternal(reposition); | 47 PositionBalloonsInternal(reposition); |
| 48 } | 48 } |
| 49 | 49 |
| 50 #if defined(TOUCH_UI) | |
| 51 base::EventStatus BalloonCollectionImpl::WillProcessEvent( | |
| 52 const base::NativeEvent& event) { | |
| 53 return base::EVENT_CONTINUE; | |
| 54 } | |
| 55 | |
| 56 void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) { | |
| 57 NOTIMPLEMENTED(); | |
| 58 } | |
| 59 #else | |
| 60 void BalloonCollectionImpl::WillProcessEvent(GdkEvent* event) { | 50 void BalloonCollectionImpl::WillProcessEvent(GdkEvent* event) { |
| 61 } | 51 } |
| 62 | 52 |
| 63 void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) { | 53 void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) { |
| 64 switch (event->type) { | 54 switch (event->type) { |
| 65 case GDK_MOTION_NOTIFY: | 55 case GDK_MOTION_NOTIFY: |
| 66 case GDK_LEAVE_NOTIFY: | 56 case GDK_LEAVE_NOTIFY: |
| 67 HandleMouseMoveEvent(); | 57 HandleMouseMoveEvent(); |
| 68 break; | 58 break; |
| 69 default: | 59 default: |
| 70 break; | 60 break; |
| 71 } | 61 } |
| 72 } | 62 } |
| 73 #endif | |
| 74 | 63 |
| 75 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { | 64 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { |
| 76 GdkScreen* screen = gdk_screen_get_default(); | 65 GdkScreen* screen = gdk_screen_get_default(); |
| 77 GdkDisplay* display = gdk_screen_get_display(screen); | 66 GdkDisplay* display = gdk_screen_get_display(screen); |
| 78 gint x, y; | 67 gint x, y; |
| 79 gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 68 gdk_display_get_pointer(display, NULL, &x, &y, NULL); |
| 80 gfx::Point cursor(x, y); | 69 gfx::Point cursor(x, y); |
| 81 | 70 |
| 82 return GetBalloonsBoundingBox().Contains(cursor); | 71 return GetBalloonsBoundingBox().Contains(cursor); |
| 83 } | 72 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 NOTREACHED(); | 90 NOTREACHED(); |
| 102 | 91 |
| 103 layout_.ComputeOffsetToMoveAbovePanels(gfx::Rect()); | 92 layout_.ComputeOffsetToMoveAbovePanels(gfx::Rect()); |
| 104 PositionBalloons(true); | 93 PositionBalloons(true); |
| 105 } | 94 } |
| 106 | 95 |
| 107 // static | 96 // static |
| 108 BalloonCollection* BalloonCollection::Create() { | 97 BalloonCollection* BalloonCollection::Create() { |
| 109 return new BalloonCollectionImpl(); | 98 return new BalloonCollectionImpl(); |
| 110 } | 99 } |
| OLD | NEW |