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 #include "ash/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/focus_cycler.h" | 7 #include "ash/focus_cycler.h" |
8 #include "ash/launcher/launcher_delegate.h" | 8 #include "ash/launcher/launcher_delegate.h" |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_navigator.h" | 10 #include "ash/launcher/launcher_navigator.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // BackgroundAnimatorDelegate overrides: | 270 // BackgroundAnimatorDelegate overrides: |
271 virtual void UpdateBackground(int alpha) OVERRIDE; | 271 virtual void UpdateBackground(int alpha) OVERRIDE; |
272 | 272 |
273 // Force the shelf to be presented in an undimmed state. | 273 // Force the shelf to be presented in an undimmed state. |
274 void ForceUndimming(bool force); | 274 void ForceUndimming(bool force); |
275 | 275 |
276 // A function to test the current alpha used by the dimming bar. If there is | 276 // A function to test the current alpha used by the dimming bar. If there is |
277 // no dimmer active, the function will return -1. | 277 // no dimmer active, the function will return -1. |
278 int GetDimmingAlphaForTest(); | 278 int GetDimmingAlphaForTest(); |
279 | 279 |
| 280 // A function to test the bounds of the dimming bar. Returns gfx::Rect() if |
| 281 // the dimmer is inactive. |
| 282 gfx::Rect GetDimmerBoundsForTest(); |
| 283 |
280 // Disable dimming animations for running tests. This needs to be called | 284 // Disable dimming animations for running tests. This needs to be called |
281 // prior to the creation of of the |dimmer_|. | 285 // prior to the creation of of the |dimmer_|. |
282 void disable_dimming_animations_for_test() { | 286 void disable_dimming_animations_for_test() { |
283 disable_dimming_animations_for_test_ = true; | 287 disable_dimming_animations_for_test_ = true; |
284 } | 288 } |
285 | 289 |
286 private: | 290 private: |
287 ShelfWidget* shelf_; | 291 ShelfWidget* shelf_; |
288 scoped_ptr<views::Widget> dimmer_; | 292 scoped_ptr<views::Widget> dimmer_; |
289 internal::FocusCycler* focus_cycler_; | 293 internal::FocusCycler* focus_cycler_; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (GetDimmed()) | 409 if (GetDimmed()) |
406 dimmer_view_->ForceUndimming(force); | 410 dimmer_view_->ForceUndimming(force); |
407 } | 411 } |
408 | 412 |
409 int ShelfWidget::DelegateView::GetDimmingAlphaForTest() { | 413 int ShelfWidget::DelegateView::GetDimmingAlphaForTest() { |
410 if (GetDimmed()) | 414 if (GetDimmed()) |
411 return dimmer_view_->get_dimming_alpha_for_test(); | 415 return dimmer_view_->get_dimming_alpha_for_test(); |
412 return -1; | 416 return -1; |
413 } | 417 } |
414 | 418 |
| 419 gfx::Rect ShelfWidget::DelegateView::GetDimmerBoundsForTest() { |
| 420 if (GetDimmed()) |
| 421 return dimmer_view_->GetBoundsInScreen(); |
| 422 return gfx::Rect(); |
| 423 } |
| 424 |
415 void ShelfWidget::DelegateView::UpdateBackground(int alpha) { | 425 void ShelfWidget::DelegateView::UpdateBackground(int alpha) { |
416 alpha_ = alpha; | 426 alpha_ = alpha; |
417 SchedulePaint(); | 427 SchedulePaint(); |
418 } | 428 } |
419 | 429 |
420 ShelfWidget::ShelfWidget( | 430 ShelfWidget::ShelfWidget( |
421 aura::Window* shelf_container, | 431 aura::Window* shelf_container, |
422 aura::Window* status_container, | 432 aura::Window* status_container, |
423 internal::WorkspaceController* workspace_controller) : | 433 internal::WorkspaceController* workspace_controller) : |
424 launcher_(NULL), | 434 launcher_(NULL), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 else | 558 else |
549 delegate_view_->GetFocusManager()->ClearFocus(); | 559 delegate_view_->GetFocusManager()->ClearFocus(); |
550 } | 560 } |
551 | 561 |
552 int ShelfWidget::GetDimmingAlphaForTest() { | 562 int ShelfWidget::GetDimmingAlphaForTest() { |
553 if (delegate_view_) | 563 if (delegate_view_) |
554 return delegate_view_->GetDimmingAlphaForTest(); | 564 return delegate_view_->GetDimmingAlphaForTest(); |
555 return -1; | 565 return -1; |
556 } | 566 } |
557 | 567 |
| 568 gfx::Rect ShelfWidget::GetDimmerBoundsForTest() { |
| 569 if (delegate_view_) |
| 570 return delegate_view_->GetDimmerBoundsForTest(); |
| 571 return gfx::Rect(); |
| 572 } |
| 573 |
558 void ShelfWidget::DisableDimmingAnimationsForTest() { | 574 void ShelfWidget::DisableDimmingAnimationsForTest() { |
559 DCHECK(delegate_view_); | 575 DCHECK(delegate_view_); |
560 return delegate_view_->disable_dimming_animations_for_test(); | 576 return delegate_view_->disable_dimming_animations_for_test(); |
561 } | 577 } |
562 | 578 |
563 } // namespace ash | 579 } // namespace ash |
564 | 580 |
OLD | NEW |