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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 return bottom; | 159 return bottom; |
160 } | 160 } |
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. | |
170 // This block is here temporary to help investigate http://crbug.com/665093 . | |
171 const int kAutoHideRepeatInterval = 10000; | |
172 const int kMaxAutoHideChangesIn10Seconds = 100; | |
oshima
2016/12/05 20:28:54
nit: constexpr
varkha
2016/12/05 20:41:21
Done.
| |
173 if ((base::TimeTicks::Now() - time_last_auto_hide_change_).InMilliseconds() < | |
174 kAutoHideRepeatInterval) { | |
175 if (++count_auto_hide_changes_ > kMaxAutoHideChangesIn10Seconds) | |
176 CHECK(false); | |
177 } else { | |
178 count_auto_hide_changes_ = 0; | |
179 } | |
180 time_last_auto_hide_change_ = base::TimeTicks::Now(); | |
181 | |
169 if (auto_hide_behavior_ == auto_hide_behavior) | 182 if (auto_hide_behavior_ == auto_hide_behavior) |
170 return; | 183 return; |
171 | 184 |
172 auto_hide_behavior_ = auto_hide_behavior; | 185 auto_hide_behavior_ = auto_hide_behavior; |
173 WmShell::Get()->shelf_controller()->NotifyShelfAutoHideBehaviorChanged(this); | 186 WmShell::Get()->shelf_controller()->NotifyShelfAutoHideBehaviorChanged(this); |
174 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged( | 187 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged( |
175 GetWindow()->GetRootWindow()); | 188 GetWindow()->GetRootWindow()); |
176 } | 189 } |
177 | 190 |
178 ShelfAutoHideState WmShelf::GetAutoHideState() const { | 191 ShelfAutoHideState WmShelf::GetAutoHideState() const { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 | 339 |
327 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 340 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
328 BackgroundAnimatorChangeType change_type) { | 341 BackgroundAnimatorChangeType change_type) { |
329 if (background_type == GetBackgroundType()) | 342 if (background_type == GetBackgroundType()) |
330 return; | 343 return; |
331 for (auto& observer : observers_) | 344 for (auto& observer : observers_) |
332 observer.OnBackgroundTypeChanged(background_type, change_type); | 345 observer.OnBackgroundTypeChanged(background_type, change_type); |
333 } | 346 } |
334 | 347 |
335 } // namespace ash | 348 } // namespace ash |
OLD | NEW |