| 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/rect.h" | 9 #include "gfx/rect.h" |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 switch (msg.message) { | 37 switch (msg.message) { |
| 38 case WM_MOUSEMOVE: | 38 case WM_MOUSEMOVE: |
| 39 case WM_MOUSELEAVE: | 39 case WM_MOUSELEAVE: |
| 40 case WM_NCMOUSELEAVE: | 40 case WM_NCMOUSELEAVE: |
| 41 HandleMouseMoveEvent(); | 41 HandleMouseMoveEvent(); |
| 42 break; | 42 break; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { | 46 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { |
| 47 if (balloons_.empty()) | 47 const Balloons& balloons = base_.balloons(); |
| 48 if (balloons.empty()) |
| 48 return false; | 49 return false; |
| 49 | 50 |
| 50 gfx::Point upper_left = balloons_[balloons_.size() - 1]->GetPosition(); | 51 gfx::Point upper_left = balloons[balloons.size() - 1]->GetPosition(); |
| 51 gfx::Point lower_right = layout_.GetLayoutOrigin(); | 52 gfx::Point lower_right = layout_.GetLayoutOrigin(); |
| 52 | 53 |
| 53 gfx::Rect bounds = gfx::Rect(upper_left.x(), | 54 gfx::Rect bounds = gfx::Rect(upper_left.x(), |
| 54 upper_left.y(), | 55 upper_left.y(), |
| 55 lower_right.x() - upper_left.x(), | 56 lower_right.x() - upper_left.x(), |
| 56 lower_right.y() - upper_left.y()); | 57 lower_right.y() - upper_left.y()); |
| 57 | 58 |
| 58 DWORD pos = GetMessagePos(); | 59 DWORD pos = GetMessagePos(); |
| 59 gfx::Point cursor(pos); | 60 gfx::Point cursor(pos); |
| 60 | 61 |
| 61 return bounds.Contains(cursor); | 62 return bounds.Contains(cursor); |
| 62 } | 63 } |
| 63 | 64 |
| 64 // static | 65 // static |
| 65 BalloonCollection* BalloonCollection::Create() { | 66 BalloonCollection* BalloonCollection::Create() { |
| 66 return new BalloonCollectionImpl(); | 67 return new BalloonCollectionImpl(); |
| 67 } | 68 } |
| OLD | NEW |