| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/shelf/shelf_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/app_list_button.h" |
| 10 #include "ash/common/shelf/shelf_background_animator_observer.h" | 11 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 11 #include "ash/common/shelf/shelf_constants.h" | 12 #include "ash/common/shelf/shelf_constants.h" |
| 12 #include "ash/common/shelf/shelf_delegate.h" | 13 #include "ash/common/shelf/shelf_delegate.h" |
| 13 #include "ash/common/shelf/shelf_layout_manager.h" | 14 #include "ash/common/shelf/shelf_layout_manager.h" |
| 14 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 15 #include "ash/common/shelf/wm_dimmer_view.h" | 16 #include "ash/common/shelf/wm_dimmer_view.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" | 17 #include "ash/common/shelf/wm_shelf.h" |
| 17 #include "ash/common/shelf/wm_shelf_util.h" | 18 #include "ash/common/shelf/wm_shelf_util.h" |
| 18 #include "ash/common/system/status_area_layout_manager.h" | 19 #include "ash/common/system/status_area_layout_manager.h" |
| 19 #include "ash/common/system/status_area_widget.h" | 20 #include "ash/common/system/status_area_widget.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 427 |
| 427 bool ShelfWidget::IsShelfVisible() const { | 428 bool ShelfWidget::IsShelfVisible() const { |
| 428 return shelf_view_ && shelf_view_->visible(); | 429 return shelf_view_ && shelf_view_->visible(); |
| 429 } | 430 } |
| 430 | 431 |
| 431 void ShelfWidget::SetShelfVisibility(bool visible) { | 432 void ShelfWidget::SetShelfVisibility(bool visible) { |
| 432 if (shelf_view_) | 433 if (shelf_view_) |
| 433 shelf_view_->SetVisible(visible); | 434 shelf_view_->SetVisible(visible); |
| 434 } | 435 } |
| 435 | 436 |
| 437 bool ShelfWidget::IsShowingAppList() const { |
| 438 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); |
| 439 } |
| 440 |
| 436 bool ShelfWidget::IsShowingContextMenu() const { | 441 bool ShelfWidget::IsShowingContextMenu() const { |
| 437 return shelf_view_ && shelf_view_->IsShowingMenu(); | 442 return shelf_view_ && shelf_view_->IsShowingMenu(); |
| 438 } | 443 } |
| 439 | 444 |
| 440 bool ShelfWidget::IsShowingOverflowBubble() const { | 445 bool ShelfWidget::IsShowingOverflowBubble() const { |
| 441 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); | 446 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); |
| 442 } | 447 } |
| 443 | 448 |
| 444 void ShelfWidget::SetFocusCycler(FocusCycler* focus_cycler) { | 449 void ShelfWidget::SetFocusCycler(FocusCycler* focus_cycler) { |
| 445 delegate_view_->set_focus_cycler(focus_cycler); | 450 delegate_view_->set_focus_cycler(focus_cycler); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 ShelfID id = window->GetIntProperty(WmWindowProperty::SHELF_ID); | 494 ShelfID id = window->GetIntProperty(WmWindowProperty::SHELF_ID); |
| 490 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); | 495 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); |
| 491 gfx::Point screen_origin; | 496 gfx::Point screen_origin; |
| 492 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 497 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| 493 return gfx::Rect(screen_origin.x() + bounds.x(), | 498 return gfx::Rect(screen_origin.x() + bounds.x(), |
| 494 screen_origin.y() + bounds.y(), bounds.width(), | 499 screen_origin.y() + bounds.y(), bounds.width(), |
| 495 bounds.height()); | 500 bounds.height()); |
| 496 } | 501 } |
| 497 | 502 |
| 498 AppListButton* ShelfWidget::GetAppListButton() const { | 503 AppListButton* ShelfWidget::GetAppListButton() const { |
| 499 return shelf_view_->GetAppListButton(); | 504 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; |
| 500 } | 505 } |
| 501 | 506 |
| 502 app_list::ApplicationDragAndDropHost* | 507 app_list::ApplicationDragAndDropHost* |
| 503 ShelfWidget::GetDragAndDropHostForAppList() { | 508 ShelfWidget::GetDragAndDropHostForAppList() { |
| 504 return shelf_view_; | 509 return shelf_view_; |
| 505 } | 510 } |
| 506 | 511 |
| 507 void ShelfWidget::OnWidgetActivationChanged(views::Widget* widget, | 512 void ShelfWidget::OnWidgetActivationChanged(views::Widget* widget, |
| 508 bool active) { | 513 bool active) { |
| 509 activating_as_fallback_ = false; | 514 activating_as_fallback_ = false; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 534 if (shelf_view_) | 539 if (shelf_view_) |
| 535 shelf_view_->UpdateShelfItemBackground(alpha); | 540 shelf_view_->UpdateShelfItemBackground(alpha); |
| 536 } | 541 } |
| 537 | 542 |
| 538 void ShelfWidget::WillDeleteShelfLayoutManager() { | 543 void ShelfWidget::WillDeleteShelfLayoutManager() { |
| 539 shelf_layout_manager_->RemoveObserver(this); | 544 shelf_layout_manager_->RemoveObserver(this); |
| 540 shelf_layout_manager_ = nullptr; | 545 shelf_layout_manager_ = nullptr; |
| 541 } | 546 } |
| 542 | 547 |
| 543 } // namespace ash | 548 } // namespace ash |
| OLD | NEW |