| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 dimmer_view_ = NULL; | 336 dimmer_view_ = NULL; |
| 337 dimmer_.reset(NULL); | 337 dimmer_.reset(NULL); |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool ShelfWidget::DelegateView::GetDimmed() const { | 341 bool ShelfWidget::DelegateView::GetDimmed() const { |
| 342 return dimmer_.get() && dimmer_->IsVisible(); | 342 return dimmer_.get() && dimmer_->IsVisible(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void ShelfWidget::DelegateView::SetWidgetBounds(const gfx::Rect bounds) { | 345 void ShelfWidget::DelegateView::SetWidgetBounds(const gfx::Rect bounds) { |
| 346 if (dimmer_.get()) | 346 if (dimmer_) |
| 347 dimmer_->SetBounds(bounds); | 347 dimmer_->SetBounds(bounds); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { | 350 void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { |
| 351 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 351 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 352 gfx::ImageSkia launcher_background = | 352 gfx::ImageSkia launcher_background = |
| 353 *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND); | 353 *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND); |
| 354 if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment()) | 354 if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment()) |
| 355 launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage( | 355 launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage( |
| 356 launcher_background, | 356 launcher_background, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 void ShelfWidget::SetDimsShelf(bool dimming) { | 478 void ShelfWidget::SetDimsShelf(bool dimming) { |
| 479 delegate_view_->SetDimmed(dimming); | 479 delegate_view_->SetDimmed(dimming); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool ShelfWidget::GetDimsShelf() const { | 482 bool ShelfWidget::GetDimsShelf() const { |
| 483 return delegate_view_->GetDimmed(); | 483 return delegate_view_->GetDimmed(); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void ShelfWidget::CreateLauncher() { | 486 void ShelfWidget::CreateLauncher() { |
| 487 if (!launcher_.get()) { | 487 if (!launcher_) { |
| 488 Shell* shell = Shell::GetInstance(); | 488 Shell* shell = Shell::GetInstance(); |
| 489 // This needs to be called before launcher_model(). | 489 // This needs to be called before launcher_model(). |
| 490 shell->GetLauncherDelegate(); | 490 shell->GetLauncherDelegate(); |
| 491 launcher_.reset(new Launcher(shell->launcher_model(), | 491 launcher_.reset(new Launcher(shell->launcher_model(), |
| 492 shell->GetLauncherDelegate(), | 492 shell->GetLauncherDelegate(), |
| 493 this)); | 493 this)); |
| 494 | 494 |
| 495 SetFocusCycler(shell->focus_cycler()); | 495 SetFocusCycler(shell->focus_cycler()); |
| 496 | 496 |
| 497 // Inform the root window controller. | 497 // Inform the root window controller. |
| 498 internal::RootWindowController::ForWindow(window_container_)-> | 498 internal::RootWindowController::ForWindow(window_container_)-> |
| 499 OnLauncherCreated(); | 499 OnLauncherCreated(); |
| 500 | 500 |
| 501 ShellDelegate* delegate = shell->delegate(); | 501 ShellDelegate* delegate = shell->delegate(); |
| 502 if (delegate) | 502 if (delegate) |
| 503 launcher_->SetVisible(delegate->IsSessionStarted()); | 503 launcher_->SetVisible(delegate->IsSessionStarted()); |
| 504 | 504 |
| 505 Show(); | 505 Show(); |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 | 508 |
| 509 bool ShelfWidget::IsLauncherVisible() const { | 509 bool ShelfWidget::IsLauncherVisible() const { |
| 510 return launcher_.get() && launcher_->IsVisible(); | 510 return launcher_.get() && launcher_->IsVisible(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void ShelfWidget::SetLauncherVisibility(bool visible) { | 513 void ShelfWidget::SetLauncherVisibility(bool visible) { |
| 514 if (launcher_.get()) | 514 if (launcher_) |
| 515 launcher_->SetVisible(visible); | 515 launcher_->SetVisible(visible); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void ShelfWidget::SetFocusCycler(internal::FocusCycler* focus_cycler) { | 518 void ShelfWidget::SetFocusCycler(internal::FocusCycler* focus_cycler) { |
| 519 delegate_view_->set_focus_cycler(focus_cycler); | 519 delegate_view_->set_focus_cycler(focus_cycler); |
| 520 if (focus_cycler) | 520 if (focus_cycler) |
| 521 focus_cycler->AddWidget(this); | 521 focus_cycler->AddWidget(this); |
| 522 } | 522 } |
| 523 | 523 |
| 524 internal::FocusCycler* ShelfWidget::GetFocusCycler() { | 524 internal::FocusCycler* ShelfWidget::GetFocusCycler() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 555 return -1; | 555 return -1; |
| 556 } | 556 } |
| 557 | 557 |
| 558 void ShelfWidget::DisableDimmingAnimationsForTest() { | 558 void ShelfWidget::DisableDimmingAnimationsForTest() { |
| 559 DCHECK(delegate_view_); | 559 DCHECK(delegate_view_); |
| 560 return delegate_view_->disable_dimming_animations_for_test(); | 560 return delegate_view_->disable_dimming_animations_for_test(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace ash | 563 } // namespace ash |
| 564 | 564 |
| OLD | NEW |