| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const { | 24 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const { |
| 25 return 2; | 25 return 2; |
| 26 } | 26 } |
| 27 | 27 |
| 28 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { | 28 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { |
| 29 return 0; | 29 return 0; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void BalloonCollectionImpl::DidProcessMessage(const MSG& msg) { |
| 33 switch (msg.message) { |
| 34 case WM_MOUSEMOVE: |
| 35 case WM_MOUSELEAVE: |
| 36 case WM_NCMOUSELEAVE: |
| 37 HandleMouseMoveEvent(); |
| 38 break; |
| 39 } |
| 40 } |
| 41 |
| 42 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const { |
| 43 if (balloons_.empty()) |
| 44 return false; |
| 45 |
| 46 gfx::Point upper_left = balloons_[balloons_.size() - 1]->GetPosition(); |
| 47 gfx::Point lower_right = layout_.GetLayoutOrigin(); |
| 48 |
| 49 gfx::Rect bounds = gfx::Rect(upper_left.x(), |
| 50 upper_left.y(), |
| 51 lower_right.x() - upper_left.x(), |
| 52 lower_right.y() - upper_left.y()); |
| 53 |
| 54 DWORD pos = GetMessagePos(); |
| 55 gfx::Point cursor(pos); |
| 56 |
| 57 return bounds.Contains(cursor); |
| 58 } |
| 59 |
| 32 // static | 60 // static |
| 33 BalloonCollection* BalloonCollection::Create() { | 61 BalloonCollection* BalloonCollection::Create() { |
| 34 return new BalloonCollectionImpl(); | 62 return new BalloonCollectionImpl(); |
| 35 } | 63 } |
| OLD | NEW |