| 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/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/focus_cycler.h" | 8 #include "ash/focus_cycler.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 620 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 621 params.parent = shelf_container; | 621 params.parent = shelf_container; |
| 622 params.delegate = delegate_view_; | 622 params.delegate = delegate_view_; |
| 623 Init(params); | 623 Init(params); |
| 624 | 624 |
| 625 // The shelf should not take focus when initially shown. | 625 // The shelf should not take focus when initially shown. |
| 626 set_focus_on_creation(false); | 626 set_focus_on_creation(false); |
| 627 SetContentsView(delegate_view_); | 627 SetContentsView(delegate_view_); |
| 628 delegate_view_->SetParentLayer(GetLayer()); | 628 delegate_view_->SetParentLayer(GetLayer()); |
| 629 | 629 |
| 630 status_area_widget_ = new StatusAreaWidget(status_container); | 630 shelf_layout_manager_ = new ShelfLayoutManager(this); |
| 631 shelf_layout_manager_->AddObserver(this); |
| 632 shelf_container->SetLayoutManager(shelf_layout_manager_); |
| 633 shelf_layout_manager_->set_workspace_controller(workspace_controller); |
| 634 workspace_controller->SetShelf(shelf_layout_manager_); |
| 635 |
| 636 status_area_widget_ = new StatusAreaWidget(status_container, this); |
| 631 status_area_widget_->CreateTrayViews(); | 637 status_area_widget_->CreateTrayViews(); |
| 632 if (Shell::GetInstance()->session_state_delegate()-> | 638 if (Shell::GetInstance()->session_state_delegate()-> |
| 633 IsActiveUserSessionStarted()) { | 639 IsActiveUserSessionStarted()) { |
| 634 status_area_widget_->Show(); | 640 status_area_widget_->Show(); |
| 635 } | 641 } |
| 636 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); | 642 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); |
| 637 | 643 |
| 638 shelf_layout_manager_ = new ShelfLayoutManager(this); | |
| 639 shelf_layout_manager_->AddObserver(this); | |
| 640 shelf_container->SetLayoutManager(shelf_layout_manager_); | |
| 641 shelf_layout_manager_->set_workspace_controller(workspace_controller); | |
| 642 workspace_controller->SetShelf(shelf_layout_manager_); | |
| 643 | |
| 644 status_container->SetLayoutManager( | 644 status_container->SetLayoutManager( |
| 645 new StatusAreaLayoutManager(status_container, this)); | 645 new StatusAreaLayoutManager(status_container, this)); |
| 646 | 646 |
| 647 shelf_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new | 647 shelf_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new |
| 648 ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); | 648 ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); |
| 649 status_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new | 649 status_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new |
| 650 ShelfWindowTargeter(status_container, shelf_layout_manager_))); | 650 ShelfWindowTargeter(status_container, shelf_layout_manager_))); |
| 651 | 651 |
| 652 views::Widget::AddObserver(this); | 652 views::Widget::AddObserver(this); |
| 653 } | 653 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 DCHECK(delegate_view_); | 842 DCHECK(delegate_view_); |
| 843 return delegate_view_->disable_dimming_animations_for_test(); | 843 return delegate_view_->disable_dimming_animations_for_test(); |
| 844 } | 844 } |
| 845 | 845 |
| 846 void ShelfWidget::WillDeleteShelf() { | 846 void ShelfWidget::WillDeleteShelf() { |
| 847 shelf_layout_manager_->RemoveObserver(this); | 847 shelf_layout_manager_->RemoveObserver(this); |
| 848 shelf_layout_manager_ = NULL; | 848 shelf_layout_manager_ = NULL; |
| 849 } | 849 } |
| 850 | 850 |
| 851 } // namespace ash | 851 } // namespace ash |
| OLD | NEW |