OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Handles the visible notification (or balloons). | 5 // Handles the visible notification (or balloons). |
6 | 6 |
7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ | 7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ |
8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ | 8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 gfx::Point OffScreenLocation() const; | 136 gfx::Point OffScreenLocation() const; |
137 | 137 |
138 // Returns true if the layout requires offsetting for keeping the close | 138 // Returns true if the layout requires offsetting for keeping the close |
139 // buttons under the cursor during rapid-close interaction. | 139 // buttons under the cursor during rapid-close interaction. |
140 bool RequiresOffsets() const; | 140 bool RequiresOffsets() const; |
141 | 141 |
142 // Returns true if there is change to the offset that requires the balloons | 142 // Returns true if there is change to the offset that requires the balloons |
143 // to be repositioned. | 143 // to be repositioned. |
144 bool ComputeOffsetToMoveAbovePanels(const gfx::Rect& panel_bounds); | 144 bool ComputeOffsetToMoveAbovePanels(const gfx::Rect& panel_bounds); |
145 | 145 |
146 void enable_panel_offset() { panel_offset_enabled_ = true; } | |
147 | |
146 private: | 148 private: |
147 // Layout parameters | 149 // Layout parameters |
148 int VerticalEdgeMargin() const; | 150 int VerticalEdgeMargin() const; |
149 int HorizontalEdgeMargin() const; | 151 int HorizontalEdgeMargin() const; |
150 int InterBalloonMargin() const; | 152 int InterBalloonMargin() const; |
151 | 153 |
152 bool NeedToMoveAboveLeftSidePanels() const; | 154 bool NeedToMoveAboveLeftSidePanels() const; |
153 bool NeedToMoveAboveRightSidePanels() const; | 155 bool NeedToMoveAboveRightSidePanels() const; |
154 | 156 |
155 // Minimum and maximum size of balloon content. | 157 // Minimum and maximum size of balloon content. |
156 static const int kBalloonMinWidth = 300; | 158 static const int kBalloonMinWidth = 300; |
157 static const int kBalloonMaxWidth = 300; | 159 static const int kBalloonMaxWidth = 300; |
158 static const int kBalloonMinHeight = 24; | 160 static const int kBalloonMinHeight = 24; |
159 static const int kBalloonMaxHeight = 160; | 161 static const int kBalloonMaxHeight = 160; |
160 | 162 |
161 Placement placement_; | 163 Placement placement_; |
162 gfx::Rect work_area_; | 164 gfx::Rect work_area_; |
163 | 165 |
166 // The flag that indicates that the panel offset computation should be | |
167 // performed. | |
168 bool panel_offset_enabled_; | |
jennb
2012/03/08 04:34:18
panel_offset_enabled_ is rather vague. How about n
jianli
2012/03/08 18:26:45
Done.
| |
169 | |
164 // The offset that guarantees that the notificaitions shown in the | 170 // The offset that guarantees that the notificaitions shown in the |
165 // lower-right or lower-left corner of the screen will go above currently | 171 // lower-right or lower-left corner of the screen will go above currently |
166 // shown panels and will not be obscured by them. | 172 // shown panels and will not be obscured by them. |
167 int offset_to_move_above_panels_; | 173 int offset_to_move_above_panels_; |
168 | 174 |
169 DISALLOW_COPY_AND_ASSIGN(Layout); | 175 DISALLOW_COPY_AND_ASSIGN(Layout); |
170 }; | 176 }; |
171 | 177 |
172 // Creates a new balloon. Overridable by derived classes and unit tests. | 178 // Creates a new balloon. Overridable by derived classes and unit tests. |
173 // The caller is responsible for freeing the pointer returned. | 179 // The caller is responsible for freeing the pointer returned. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 base::WeakPtrFactory<BalloonCollectionImpl> reposition_factory_; | 231 base::WeakPtrFactory<BalloonCollectionImpl> reposition_factory_; |
226 | 232 |
227 // Is the balloon collection currently listening for UI events? | 233 // Is the balloon collection currently listening for UI events? |
228 bool added_as_message_loop_observer_; | 234 bool added_as_message_loop_observer_; |
229 #endif | 235 #endif |
230 | 236 |
231 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl); | 237 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl); |
232 }; | 238 }; |
233 | 239 |
234 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ | 240 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ |
OLD | NEW |