Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chrome/browser/notifications/balloon_collection_mac.mm

Issue 8503037: Fix the problem that notifications and panels overlap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h" 9 #include "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h"
10 10
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const { 30 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const {
31 return 5; 31 return 5;
32 } 32 }
33 33
34 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { 34 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const {
35 return 0; 35 return 0;
36 } 36 }
37 37
38 bool BalloonCollectionImpl::Layout::NeedToMoveAboveLeftSidePanels() const {
39 return placement_ == VERTICALLY_FROM_TOP_LEFT;
40 }
41
42 bool BalloonCollectionImpl::Layout::NeedToMoveAboveRightSidePanels() const {
43 return placement_ == VERTICALLY_FROM_TOP_RIGHT;
44 }
45
38 void BalloonCollectionImpl::PositionBalloons(bool reposition) { 46 void BalloonCollectionImpl::PositionBalloons(bool reposition) {
39 // Use an animation context so that all the balloons animate together. 47 // Use an animation context so that all the balloons animate together.
40 [NSAnimationContext beginGrouping]; 48 [NSAnimationContext beginGrouping];
41 [[NSAnimationContext currentContext] setDuration:0.1f]; 49 [[NSAnimationContext currentContext] setDuration:0.1f];
42 PositionBalloonsInternal(reposition); 50 PositionBalloonsInternal(reposition);
43 [NSAnimationContext endGrouping]; 51 [NSAnimationContext endGrouping];
44 } 52 }
45 53
46 void BalloonCollectionImpl::SetPositionPreference( 54 void BalloonCollectionImpl::SetPositionPreference(
47 PositionPreference position) { 55 PositionPreference position) {
48 if (position == DEFAULT_POSITION) 56 if (position == DEFAULT_POSITION)
49 position = UPPER_RIGHT; 57 position = UPPER_RIGHT;
50 58
51 // All positioning schemes are vertical, but mac 59 // All positioning schemes are vertical, but mac
52 // uses a vertically reversed screen orientation. 60 // uses a vertically reversed screen orientation.
53 if (position == UPPER_RIGHT) 61 if (position == UPPER_RIGHT)
54 layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT); 62 layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
55 else if (position == UPPER_LEFT) 63 else if (position == UPPER_LEFT)
56 layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT); 64 layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
57 else if (position == LOWER_LEFT) 65 else if (position == LOWER_LEFT)
58 layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT); 66 layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
59 else if (position == LOWER_RIGHT) 67 else if (position == LOWER_RIGHT)
60 layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT); 68 layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
61 else 69 else
62 NOTREACHED(); 70 NOTREACHED();
63 71
72 layout_.ComputeOffsetToMoveAbovePanels(gfx::Rect());
64 PositionBalloons(true); 73 PositionBalloons(true);
65 } 74 }
66 75
67 // static 76 // static
68 BalloonCollection* BalloonCollection::Create() { 77 BalloonCollection* BalloonCollection::Create() {
69 return new BalloonCollectionImpl(); 78 return new BalloonCollectionImpl();
70 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698