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" |
11 #include "ash/launcher/launcher_view.h" | 11 #include "ash/launcher/launcher_view.h" |
12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
13 #include "ash/session_state_delegate.h" | |
14 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
15 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
16 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_delegate.h" |
17 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
18 #include "ash/wm/property_util.h" | 18 #include "ash/wm/property_util.h" |
19 #include "ash/wm/status_area_layout_manager.h" | 19 #include "ash/wm/status_area_layout_manager.h" |
20 #include "ash/wm/window_properties.h" | 20 #include "ash/wm/window_properties.h" |
21 #include "ash/wm/workspace_controller.h" | 21 #include "ash/wm/workspace_controller.h" |
22 #include "grit/ash_resources.h" | 22 #include "grit/ash_resources.h" |
23 #include "ui/aura/client/activation_client.h" | 23 #include "ui/aura/client/activation_client.h" |
24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
25 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
26 #include "ui/aura/window_observer.h" | 26 #include "ui/aura/window_observer.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 params.parent = shelf_container; | 433 params.parent = shelf_container; |
434 params.delegate = delegate_view_; | 434 params.delegate = delegate_view_; |
435 Init(params); | 435 Init(params); |
436 | 436 |
437 // The shelf should not take focus when initially shown. | 437 // The shelf should not take focus when initially shown. |
438 set_focus_on_creation(false); | 438 set_focus_on_creation(false); |
439 SetContentsView(delegate_view_); | 439 SetContentsView(delegate_view_); |
440 | 440 |
441 status_area_widget_ = new internal::StatusAreaWidget(status_container); | 441 status_area_widget_ = new internal::StatusAreaWidget(status_container); |
442 status_area_widget_->CreateTrayViews(); | 442 status_area_widget_->CreateTrayViews(); |
443 if (Shell::GetInstance()->session_state_delegate()-> | 443 if (Shell::GetInstance()->delegate()->IsSessionStarted()) |
444 IsActiveUserSessionStarted()) { | |
445 status_area_widget_->Show(); | 444 status_area_widget_->Show(); |
446 } | |
447 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); | 445 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_); |
448 | 446 |
449 shelf_layout_manager_ = new internal::ShelfLayoutManager(this); | 447 shelf_layout_manager_ = new internal::ShelfLayoutManager(this); |
450 shelf_container->SetLayoutManager(shelf_layout_manager_); | 448 shelf_container->SetLayoutManager(shelf_layout_manager_); |
451 shelf_layout_manager_->set_workspace_controller(workspace_controller); | 449 shelf_layout_manager_->set_workspace_controller(workspace_controller); |
452 workspace_controller->SetShelf(shelf_layout_manager_); | 450 workspace_controller->SetShelf(shelf_layout_manager_); |
453 | 451 |
454 status_container->SetLayoutManager( | 452 status_container->SetLayoutManager( |
455 new internal::StatusAreaLayoutManager(this)); | 453 new internal::StatusAreaLayoutManager(this)); |
456 | 454 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 launcher_.reset(new Launcher(shell->launcher_model(), | 491 launcher_.reset(new Launcher(shell->launcher_model(), |
494 shell->GetLauncherDelegate(), | 492 shell->GetLauncherDelegate(), |
495 this)); | 493 this)); |
496 | 494 |
497 SetFocusCycler(shell->focus_cycler()); | 495 SetFocusCycler(shell->focus_cycler()); |
498 | 496 |
499 // Inform the root window controller. | 497 // Inform the root window controller. |
500 internal::RootWindowController::ForWindow(window_container_)-> | 498 internal::RootWindowController::ForWindow(window_container_)-> |
501 OnLauncherCreated(); | 499 OnLauncherCreated(); |
502 | 500 |
503 launcher_->SetVisible( | 501 ShellDelegate* delegate = shell->delegate(); |
504 shell->session_state_delegate()->IsActiveUserSessionStarted()); | 502 if (delegate) |
| 503 launcher_->SetVisible(delegate->IsSessionStarted()); |
505 | 504 |
506 Show(); | 505 Show(); |
507 } | 506 } |
508 } | 507 } |
509 | 508 |
510 bool ShelfWidget::IsLauncherVisible() const { | 509 bool ShelfWidget::IsLauncherVisible() const { |
511 return launcher_.get() && launcher_->IsVisible(); | 510 return launcher_.get() && launcher_->IsVisible(); |
512 } | 511 } |
513 | 512 |
514 void ShelfWidget::SetLauncherVisibility(bool visible) { | 513 void ShelfWidget::SetLauncherVisibility(bool visible) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 return -1; | 555 return -1; |
557 } | 556 } |
558 | 557 |
559 void ShelfWidget::DisableDimmingAnimationsForTest() { | 558 void ShelfWidget::DisableDimmingAnimationsForTest() { |
560 DCHECK(delegate_view_); | 559 DCHECK(delegate_view_); |
561 return delegate_view_->disable_dimming_animations_for_test(); | 560 return delegate_view_->disable_dimming_animations_for_test(); |
562 } | 561 } |
563 | 562 |
564 } // namespace ash | 563 } // namespace ash |
565 | 564 |
OLD | NEW |