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/shelf_background_animator_observer.h" | 10 #include "ash/common/shelf/shelf_background_animator_observer.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 void ShelfWidget::DelegateView::UpdateShelfAssetBackground(int alpha) { | 285 void ShelfWidget::DelegateView::UpdateShelfAssetBackground(int alpha) { |
286 asset_background_alpha_ = alpha; | 286 asset_background_alpha_ = alpha; |
287 SchedulePaint(); | 287 SchedulePaint(); |
288 } | 288 } |
289 | 289 |
290 ShelfWidget::ShelfWidget(WmWindow* shelf_container, | 290 ShelfWidget::ShelfWidget(WmWindow* shelf_container, |
291 WmWindow* status_container, | 291 WmWindow* status_container, |
292 WmShelf* wm_shelf) | 292 WmShelf* wm_shelf) |
293 : wm_shelf_(wm_shelf), | 293 : wm_shelf_(wm_shelf), |
294 shelf_(nullptr), | |
295 delegate_view_(new DelegateView(wm_shelf, this)), | 294 delegate_view_(new DelegateView(wm_shelf, this)), |
296 shelf_view_(nullptr), | 295 shelf_view_(nullptr), |
297 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), | 296 background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_), |
298 activating_as_fallback_(false) { | 297 activating_as_fallback_(false) { |
299 background_animator_.AddObserver(this); | 298 background_animator_.AddObserver(this); |
300 background_animator_.AddObserver(delegate_view_); | 299 background_animator_.AddObserver(delegate_view_); |
301 | 300 |
302 views::Widget::InitParams params( | 301 views::Widget::InitParams params( |
303 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 302 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
304 params.name = "ShelfWidget"; | 303 params.name = "ShelfWidget"; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (shelf_view_) | 420 if (shelf_view_) |
422 shelf_view_->SchedulePaintForAllButtons(); | 421 shelf_view_->SchedulePaintForAllButtons(); |
423 status_area_widget_->SchedulePaint(); | 422 status_area_widget_->SchedulePaint(); |
424 } | 423 } |
425 | 424 |
426 bool ShelfWidget::GetDimsShelf() const { | 425 bool ShelfWidget::GetDimsShelf() const { |
427 return delegate_view_->GetDimmed(); | 426 return delegate_view_->GetDimmed(); |
428 } | 427 } |
429 | 428 |
430 ShelfView* ShelfWidget::CreateShelfView() { | 429 ShelfView* ShelfWidget::CreateShelfView() { |
431 DCHECK(!shelf_); | |
432 DCHECK(!shelf_view_); | 430 DCHECK(!shelf_view_); |
433 | 431 |
434 shelf_view_ = | 432 shelf_view_ = |
435 new ShelfView(WmShell::Get()->shelf_model(), | 433 new ShelfView(WmShell::Get()->shelf_model(), |
436 WmShell::Get()->shelf_delegate(), wm_shelf_, this); | 434 WmShell::Get()->shelf_delegate(), wm_shelf_, this); |
437 shelf_view_->Init(); | 435 shelf_view_->Init(); |
438 GetContentsView()->AddChildView(shelf_view_); | 436 GetContentsView()->AddChildView(shelf_view_); |
439 return shelf_view_; | 437 return shelf_view_; |
440 } | 438 } |
441 | 439 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (shelf_view_) | 558 if (shelf_view_) |
561 shelf_view_->UpdateShelfItemBackground(alpha); | 559 shelf_view_->UpdateShelfItemBackground(alpha); |
562 } | 560 } |
563 | 561 |
564 void ShelfWidget::WillDeleteShelfLayoutManager() { | 562 void ShelfWidget::WillDeleteShelfLayoutManager() { |
565 shelf_layout_manager_->RemoveObserver(this); | 563 shelf_layout_manager_->RemoveObserver(this); |
566 shelf_layout_manager_ = nullptr; | 564 shelf_layout_manager_ = nullptr; |
567 } | 565 } |
568 | 566 |
569 } // namespace ash | 567 } // namespace ash |
OLD | NEW |