| 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); | 429 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void RootWindowController::ShowShelf() { | 432 void RootWindowController::ShowShelf() { |
| 433 if (!shelf_widget_->shelf()) | 433 if (!shelf_widget_->shelf()) |
| 434 return; | 434 return; |
| 435 shelf_widget_->shelf()->SetVisible(true); | 435 shelf_widget_->shelf()->SetVisible(true); |
| 436 shelf_widget_->status_area_widget()->Show(); | 436 shelf_widget_->status_area_widget()->Show(); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void RootWindowController::OnShelfCreated() { | 439 void RootWindowController::CreateShelf() { |
| 440 if (shelf_widget_->shelf()) |
| 441 return; |
| 442 shelf_widget_->CreateShelf(); |
| 443 |
| 440 if (panel_layout_manager_) | 444 if (panel_layout_manager_) |
| 441 panel_layout_manager_->SetShelf(shelf_widget_->shelf()->wm_shelf()); | 445 panel_layout_manager_->SetShelf(shelf_widget_->shelf()->wm_shelf()); |
| 442 if (docked_layout_manager_) { | 446 if (docked_layout_manager_) { |
| 443 docked_layout_manager_->SetShelf(shelf_widget_->shelf()->wm_shelf()); | 447 docked_layout_manager_->SetShelf(shelf_widget_->shelf()->wm_shelf()); |
| 444 if (shelf_widget_->shelf_layout_manager()) | 448 if (shelf_widget_->shelf_layout_manager()) |
| 445 docked_layout_manager_->AddObserver( | 449 docked_layout_manager_->AddObserver( |
| 446 shelf_widget_->shelf_layout_manager()); | 450 shelf_widget_->shelf_layout_manager()); |
| 447 } | 451 } |
| 448 | 452 |
| 449 // Notify shell observers that the shelf has been created. | 453 // Notify shell observers that the shelf has been created. |
| 450 Shell::GetInstance()->OnShelfCreatedForRootWindow(GetRootWindow()); | 454 Shell::GetInstance()->OnShelfCreatedForRootWindow(GetRootWindow()); |
| 455 |
| 456 shelf_widget_->PostCreateShelf(); |
| 451 } | 457 } |
| 452 | 458 |
| 453 void RootWindowController::UpdateAfterLoginStatusChange( | 459 void RootWindowController::UpdateAfterLoginStatusChange( |
| 454 user::LoginStatus status) { | 460 user::LoginStatus status) { |
| 455 if (status != user::LOGGED_IN_NONE) | 461 if (status != user::LOGGED_IN_NONE) |
| 456 mouse_event_target_.reset(); | 462 mouse_event_target_.reset(); |
| 457 if (shelf_widget_->status_area_widget()) | 463 if (shelf_widget_->status_area_widget()) |
| 458 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); | 464 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
| 459 } | 465 } |
| 460 | 466 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 721 |
| 716 if (root_window_type == PRIMARY) { | 722 if (root_window_type == PRIMARY) { |
| 717 root_window_layout()->OnWindowResized(); | 723 root_window_layout()->OnWindowResized(); |
| 718 shell->InitKeyboard(); | 724 shell->InitKeyboard(); |
| 719 } else { | 725 } else { |
| 720 root_window_layout()->OnWindowResized(); | 726 root_window_layout()->OnWindowResized(); |
| 721 ash_host_->AsWindowTreeHost()->Show(); | 727 ash_host_->AsWindowTreeHost()->Show(); |
| 722 | 728 |
| 723 // Create a shelf if a user is already logged in. | 729 // Create a shelf if a user is already logged in. |
| 724 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 730 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
| 725 shelf_widget()->CreateShelf(); | 731 CreateShelf(); |
| 726 | 732 |
| 727 // Notify shell observers about new root window. | 733 // Notify shell observers about new root window. |
| 728 shell->OnRootWindowAdded(root_window); | 734 shell->OnRootWindowAdded(root_window); |
| 729 } | 735 } |
| 730 | 736 |
| 731 #if defined(OS_CHROMEOS) | 737 #if defined(OS_CHROMEOS) |
| 732 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 738 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 733 switches::kAshDisableTouchExplorationMode)) { | 739 switches::kAshDisableTouchExplorationMode)) { |
| 734 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); | 740 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); |
| 735 } | 741 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 749 new WorkspaceLayoutManagerDelegateImpl(root_window); | 755 new WorkspaceLayoutManagerDelegateImpl(root_window); |
| 750 workspace_controller_.reset(new WorkspaceController( | 756 workspace_controller_.reset(new WorkspaceController( |
| 751 default_container, base::WrapUnique(workspace_layout_manager_delegate))); | 757 default_container, base::WrapUnique(workspace_layout_manager_delegate))); |
| 752 | 758 |
| 753 wm::WmWindow* always_on_top_container = | 759 wm::WmWindow* always_on_top_container = |
| 754 wm::WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer)); | 760 wm::WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer)); |
| 755 always_on_top_controller_.reset( | 761 always_on_top_controller_.reset( |
| 756 new AlwaysOnTopController(always_on_top_container)); | 762 new AlwaysOnTopController(always_on_top_container)); |
| 757 | 763 |
| 758 DCHECK(!shelf_widget_.get()); | 764 DCHECK(!shelf_widget_.get()); |
| 759 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); | 765 wm::WmWindow* shelf_container = |
| 760 // TODO(harrym): Remove when status area is view. | 766 wm::WmWindowAura::Get(GetContainer(kShellWindowId_ShelfContainer)); |
| 761 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); | 767 wm::WmWindow* status_container = |
| 768 wm::WmWindowAura::Get(GetContainer(kShellWindowId_StatusContainer)); |
| 762 shelf_widget_.reset(new ShelfWidget(shelf_container, status_container, | 769 shelf_widget_.reset(new ShelfWidget(shelf_container, status_container, |
| 763 workspace_controller())); | 770 workspace_controller())); |
| 764 workspace_layout_manager_delegate->set_shelf( | 771 workspace_layout_manager_delegate->set_shelf( |
| 765 shelf_widget_->shelf_layout_manager()); | 772 shelf_widget_->shelf_layout_manager()); |
| 766 | 773 |
| 767 if (!Shell::GetInstance()->session_state_delegate()-> | 774 if (!Shell::GetInstance()->session_state_delegate()-> |
| 768 IsActiveUserSessionStarted()) { | 775 IsActiveUserSessionStarted()) { |
| 769 // This window exists only to be a event target on login screen. | 776 // This window exists only to be a event target on login screen. |
| 770 // It does not have to handle events, nor be visible. | 777 // It does not have to handle events, nor be visible. |
| 771 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate)); | 778 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate)); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 aura::Window* primary_root_window = Shell::GetInstance() | 1083 aura::Window* primary_root_window = Shell::GetInstance() |
| 1077 ->window_tree_host_manager() | 1084 ->window_tree_host_manager() |
| 1078 ->GetPrimaryRootWindow(); | 1085 ->GetPrimaryRootWindow(); |
| 1079 return GetRootWindowSettings(primary_root_window)->controller; | 1086 return GetRootWindowSettings(primary_root_window)->controller; |
| 1080 } | 1087 } |
| 1081 | 1088 |
| 1082 return GetRootWindowSettings(root_window)->controller; | 1089 return GetRootWindowSettings(root_window)->controller; |
| 1083 } | 1090 } |
| 1084 | 1091 |
| 1085 } // namespace ash | 1092 } // namespace ash |
| OLD | NEW |