Chromium Code Reviews| Index: chrome/browser/notifications/balloon_collection_mac.mm |
| diff --git a/chrome/browser/notifications/balloon_collection_mac.mm b/chrome/browser/notifications/balloon_collection_mac.mm |
| index d31bc399ddb5a1c6138e930cfccdbdd87805098a..aba14ce387725f4d7d542d2bf1bf5724b0f0569d 100644 |
| --- a/chrome/browser/notifications/balloon_collection_mac.mm |
| +++ b/chrome/browser/notifications/balloon_collection_mac.mm |
| @@ -35,6 +35,52 @@ int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { |
| return 0; |
| } |
| +gfx::Point BalloonCollectionImpl::Layout::GetLayoutOrigin() const { |
|
jennb
2011/11/10 19:17:13
Comments in the code here make the code hard to re
jianli
2011/11/11 00:38:30
Done.
|
| + const int kVerticalSpacingBetweenBalloonAndPanel = 5; |
| + int x = 0; |
| + int y = 0; |
| + switch (placement_) { |
| + case VERTICALLY_FROM_TOP_LEFT: { |
| + x = work_area_.x() + HorizontalEdgeMargin(); |
| + // For this placement (this corresponds to lower-right alignment due to |
| + // that Mac uses a vertically reversed screen orientation), balloon needs |
| + // to stay on top of left-most panels to avoid overlapping. |
| + int offset = bottom_left_offset_to_move_above_panels_; |
| + // Ensure that we have some sort of margin between the 1st balloon and the |
| + // panel beneath it even the vertical edge margin is set to 0 on Mac. |
| + if (offset && !VerticalEdgeMargin()) |
| + offset += kVerticalSpacingBetweenBalloonAndPanel; |
| + y = work_area_.y() + VerticalEdgeMargin() + offset; |
| + break; |
| + } |
| + case VERTICALLY_FROM_TOP_RIGHT: { |
| + x = work_area_.right() - HorizontalEdgeMargin(); |
| + // For this placement (this corresponds to lower-right alignment due to |
| + // that Mac uses a vertically reversed screen orientation), balloon needs |
| + // to stay on top of right-most panels to avoid overlapping. |
| + int offset = bottom_right_offset_to_move_above_panels_; |
| + // Ensure that we have some sort of margin between the 1st balloon and the |
| + // panel beneath it even the vertical edge margin is set to 0 on Mac. |
| + if (offset && !VerticalEdgeMargin()) |
| + offset += kVerticalSpacingBetweenBalloonAndPanel; |
| + y = work_area_.y() + VerticalEdgeMargin() + offset; |
| + break; |
| + } |
| + case VERTICALLY_FROM_BOTTOM_LEFT: |
| + x = work_area_.x() + HorizontalEdgeMargin(); |
| + y = work_area_.bottom() - VerticalEdgeMargin(); |
| + break; |
| + case VERTICALLY_FROM_BOTTOM_RIGHT: |
| + x = work_area_.right() - HorizontalEdgeMargin(); |
| + y = work_area_.bottom() - VerticalEdgeMargin(); |
| + break; |
| + default: |
| + NOTREACHED(); |
| + break; |
| + } |
| + return gfx::Point(x, y); |
| +} |
| + |
| void BalloonCollectionImpl::PositionBalloons(bool reposition) { |
| // Use an animation context so that all the balloons animate together. |
| [NSAnimationContext beginGrouping]; |