| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/views/notifications/balloon_view.h" | 8 #include "chrome/browser/views/notifications/balloon_view.h" | 
| 9 #include "gfx/size.h" | 9 #include "gfx/size.h" | 
| 10 | 10 | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 39     case GDK_MOTION_NOTIFY: | 39     case GDK_MOTION_NOTIFY: | 
| 40     case GDK_LEAVE_NOTIFY: | 40     case GDK_LEAVE_NOTIFY: | 
| 41       HandleMouseMoveEvent(); | 41       HandleMouseMoveEvent(); | 
| 42       break; | 42       break; | 
| 43     default: | 43     default: | 
| 44       break; | 44       break; | 
| 45   } | 45   } | 
| 46 } | 46 } | 
| 47 | 47 | 
| 48 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { | 48 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { | 
| 49   if (balloons_.empty()) | 49   const Balloons& balloons = base_.balloons(); | 
|  | 50   if (balloons.empty()) | 
| 50     return false; | 51     return false; | 
| 51 | 52 | 
| 52   gfx::Point upper_left = balloons_[balloons_.size() - 1]->GetPosition(); | 53   gfx::Point upper_left = balloons[balloons.size() - 1]->GetPosition(); | 
| 53   gfx::Point lower_right = layout_.GetLayoutOrigin(); | 54   gfx::Point lower_right = layout_.GetLayoutOrigin(); | 
| 54 | 55 | 
| 55   gfx::Rect bounds = gfx::Rect(upper_left.x(), | 56   gfx::Rect bounds = gfx::Rect(upper_left.x(), | 
| 56                                upper_left.y(), | 57                                upper_left.y(), | 
| 57                                lower_right.x() - upper_left.x(), | 58                                lower_right.x() - upper_left.x(), | 
| 58                                lower_right.y() - upper_left.y()); | 59                                lower_right.y() - upper_left.y()); | 
| 59 | 60 | 
| 60   GdkScreen* screen = gdk_screen_get_default(); | 61   GdkScreen* screen = gdk_screen_get_default(); | 
| 61   GdkDisplay* display = gdk_screen_get_display(screen); | 62   GdkDisplay* display = gdk_screen_get_display(screen); | 
| 62   gint x, y; | 63   gint x, y; | 
| 63   gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 64   gdk_display_get_pointer(display, NULL, &x, &y, NULL); | 
| 64   gfx::Point cursor(x, y); | 65   gfx::Point cursor(x, y); | 
| 65 | 66 | 
| 66   return bounds.Contains(cursor); | 67   return bounds.Contains(cursor); | 
| 67 } | 68 } | 
| 68 | 69 | 
| 69 // static | 70 // static | 
| 70 BalloonCollection* BalloonCollection::Create() { | 71 BalloonCollection* BalloonCollection::Create() { | 
| 71   return new BalloonCollectionImpl(); | 72   return new BalloonCollectionImpl(); | 
| 72 } | 73 } | 
| OLD | NEW | 
|---|