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_computing_panel_offset() { |
| 147 need_to_compute_panel_offset_ = true; |
| 148 } |
| 149 |
146 private: | 150 private: |
147 // Layout parameters | 151 // Layout parameters |
148 int VerticalEdgeMargin() const; | 152 int VerticalEdgeMargin() const; |
149 int HorizontalEdgeMargin() const; | 153 int HorizontalEdgeMargin() const; |
150 int InterBalloonMargin() const; | 154 int InterBalloonMargin() const; |
151 | 155 |
152 bool NeedToMoveAboveLeftSidePanels() const; | 156 bool NeedToMoveAboveLeftSidePanels() const; |
153 bool NeedToMoveAboveRightSidePanels() const; | 157 bool NeedToMoveAboveRightSidePanels() const; |
154 | 158 |
155 // Minimum and maximum size of balloon content. | 159 // Minimum and maximum size of balloon content. |
156 static const int kBalloonMinWidth = 300; | 160 static const int kBalloonMinWidth = 300; |
157 static const int kBalloonMaxWidth = 300; | 161 static const int kBalloonMaxWidth = 300; |
158 static const int kBalloonMinHeight = 24; | 162 static const int kBalloonMinHeight = 24; |
159 static const int kBalloonMaxHeight = 160; | 163 static const int kBalloonMaxHeight = 160; |
160 | 164 |
161 Placement placement_; | 165 Placement placement_; |
162 gfx::Rect work_area_; | 166 gfx::Rect work_area_; |
163 | 167 |
| 168 // The flag that indicates that the panel offset computation should be |
| 169 // performed. |
| 170 bool need_to_compute_panel_offset_; |
| 171 |
164 // The offset that guarantees that the notificaitions shown in the | 172 // The offset that guarantees that the notificaitions shown in the |
165 // lower-right or lower-left corner of the screen will go above currently | 173 // lower-right or lower-left corner of the screen will go above currently |
166 // shown panels and will not be obscured by them. | 174 // shown panels and will not be obscured by them. |
167 int offset_to_move_above_panels_; | 175 int offset_to_move_above_panels_; |
168 | 176 |
169 DISALLOW_COPY_AND_ASSIGN(Layout); | 177 DISALLOW_COPY_AND_ASSIGN(Layout); |
170 }; | 178 }; |
171 | 179 |
172 // Creates a new balloon. Overridable by derived classes and unit tests. | 180 // Creates a new balloon. Overridable by derived classes and unit tests. |
173 // The caller is responsible for freeing the pointer returned. | 181 // 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_; | 233 base::WeakPtrFactory<BalloonCollectionImpl> reposition_factory_; |
226 | 234 |
227 // Is the balloon collection currently listening for UI events? | 235 // Is the balloon collection currently listening for UI events? |
228 bool added_as_message_loop_observer_; | 236 bool added_as_message_loop_observer_; |
229 #endif | 237 #endif |
230 | 238 |
231 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl); | 239 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImpl); |
232 }; | 240 }; |
233 | 241 |
234 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ | 242 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_COLLECTION_IMPL_H_ |
OLD | NEW |