OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/shelf/wm_shelf.h" | 5 #include "ash/common/shelf/wm_shelf.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_controller.h" | 7 #include "ash/common/shelf/shelf_controller.h" |
8 #include "ash/common/shelf/shelf_delegate.h" | 8 #include "ash/common/shelf/shelf_delegate.h" |
9 #include "ash/common/shelf/shelf_item_delegate.h" | 9 #include "ash/common/shelf/shelf_item_delegate.h" |
10 #include "ash/common/shelf/shelf_layout_manager.h" | 10 #include "ash/common/shelf/shelf_layout_manager.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 161 |
162 int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const { | 162 int WmShelf::PrimaryAxisValue(int horizontal, int vertical) const { |
163 return IsHorizontalAlignment() ? horizontal : vertical; | 163 return IsHorizontalAlignment() ? horizontal : vertical; |
164 } | 164 } |
165 | 165 |
166 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) { | 166 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) { |
167 DCHECK(shelf_layout_manager_); | 167 DCHECK(shelf_layout_manager_); |
168 | 168 |
169 // Force a stack dump when this method is invoked too frequently. | 169 // Force a stack dump when this method is invoked too frequently. |
170 // This block is here temporary to help investigate http://crbug.com/665093 . | 170 // This block is here temporary to help investigate http://crbug.com/665093 . |
171 constexpr int kAutoHideRepeatInterval = 10000; | 171 constexpr int kAutoHideRepeatInterval = 15000; |
172 constexpr int kMaxAutoHideChangesIn10Seconds = 100; | 172 constexpr int kMaxAutoHideChanges = 15; |
173 if ((base::TimeTicks::Now() - time_last_auto_hide_change_).InMilliseconds() < | 173 if ((base::TimeTicks::Now() - time_last_auto_hide_change_).InMilliseconds() < |
174 kAutoHideRepeatInterval) { | 174 kAutoHideRepeatInterval) { |
varkha
2016/12/14 16:50:54
This actually feels wrong. My intention was to CHE
varkha
2016/12/19 21:48:50
Done.
| |
175 if (++count_auto_hide_changes_ > kMaxAutoHideChangesIn10Seconds) | 175 if (++count_auto_hide_changes_ > kMaxAutoHideChanges) |
176 CHECK(false); | 176 CHECK(false); |
177 } else { | 177 } else { |
178 count_auto_hide_changes_ = 0; | 178 count_auto_hide_changes_ = 0; |
179 } | 179 } |
180 time_last_auto_hide_change_ = base::TimeTicks::Now(); | 180 time_last_auto_hide_change_ = base::TimeTicks::Now(); |
181 | 181 |
182 if (auto_hide_behavior_ == auto_hide_behavior) | 182 if (auto_hide_behavior_ == auto_hide_behavior) |
183 return; | 183 return; |
184 | 184 |
185 auto_hide_behavior_ = auto_hide_behavior; | 185 auto_hide_behavior_ = auto_hide_behavior; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 | 339 |
340 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 340 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
341 BackgroundAnimatorChangeType change_type) { | 341 BackgroundAnimatorChangeType change_type) { |
342 if (background_type == GetBackgroundType()) | 342 if (background_type == GetBackgroundType()) |
343 return; | 343 return; |
344 for (auto& observer : observers_) | 344 for (auto& observer : observers_) |
345 observer.OnBackgroundTypeChanged(background_type, change_type); | 345 observer.OnBackgroundTypeChanged(background_type, change_type); |
346 } | 346 } |
347 | 347 |
348 } // namespace ash | 348 } // namespace ash |
OLD | NEW |