| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 void Shell::UpdateShelfVisibility() { | 503 void Shell::UpdateShelfVisibility() { |
| 504 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 504 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 505 for (RootWindowControllerList::iterator iter = controllers.begin(); | 505 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 506 iter != controllers.end(); ++iter) | 506 iter != controllers.end(); ++iter) |
| 507 if ((*iter)->shelf()) | 507 if ((*iter)->shelf()) |
| 508 (*iter)->UpdateShelfVisibility(); | 508 (*iter)->UpdateShelfVisibility(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, | 511 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, |
| 512 aura::Window* root_window) { | 512 aura::Window* root_window) { |
| 513 ash::ShelfLayoutManager::ForShelf(root_window)->SetAutoHideBehavior(behavior); | 513 ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf(); |
| 514 shelf_widget->shelf_layout_manager()->SetAutoHideBehavior(behavior); |
| 514 } | 515 } |
| 515 | 516 |
| 516 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( | 517 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( |
| 517 aura::Window* root_window) const { | 518 aura::Window* root_window) const { |
| 518 return ash::ShelfLayoutManager::ForShelf(root_window)->auto_hide_behavior(); | 519 ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf(); |
| 520 return shelf_widget->shelf_layout_manager()->auto_hide_behavior(); |
| 519 } | 521 } |
| 520 | 522 |
| 521 void Shell::SetShelfAlignment(ShelfAlignment alignment, | 523 void Shell::SetShelfAlignment(ShelfAlignment alignment, |
| 522 aura::Window* root_window) { | 524 aura::Window* root_window) { |
| 523 if (ash::ShelfLayoutManager::ForShelf(root_window)->SetAlignment(alignment)) { | 525 ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf(); |
| 526 if (shelf_widget->shelf_layout_manager()->SetAlignment(alignment)) { |
| 524 FOR_EACH_OBSERVER( | 527 FOR_EACH_OBSERVER( |
| 525 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); | 528 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); |
| 526 } | 529 } |
| 527 } | 530 } |
| 528 | 531 |
| 529 ShelfAlignment Shell::GetShelfAlignment(const aura::Window* root_window) { | 532 ShelfAlignment Shell::GetShelfAlignment(const aura::Window* root_window) { |
| 530 return GetRootWindowController(root_window) | 533 ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf(); |
| 531 ->GetShelfLayoutManager() | 534 return shelf_widget->shelf_layout_manager()->GetAlignment(); |
| 532 ->GetAlignment(); | |
| 533 } | 535 } |
| 534 | 536 |
| 535 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, | 537 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, |
| 536 aura::Window* root_window) { | 538 aura::Window* root_window) { |
| 537 FOR_EACH_OBSERVER(ShellObserver, observers_, OnFullscreenStateChanged( | 539 FOR_EACH_OBSERVER(ShellObserver, observers_, OnFullscreenStateChanged( |
| 538 is_fullscreen, root_window)); | 540 is_fullscreen, root_window)); |
| 539 } | 541 } |
| 540 | 542 |
| 541 void Shell::CreateModalBackground(aura::Window* window) { | 543 void Shell::CreateModalBackground(aura::Window* window) { |
| 542 if (!modality_filter_) { | 544 if (!modality_filter_) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 609 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 608 if (is_touch_hud_projection_enabled_ == enabled) | 610 if (is_touch_hud_projection_enabled_ == enabled) |
| 609 return; | 611 return; |
| 610 | 612 |
| 611 is_touch_hud_projection_enabled_ = enabled; | 613 is_touch_hud_projection_enabled_ = enabled; |
| 612 FOR_EACH_OBSERVER(ShellObserver, observers_, | 614 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 613 OnTouchHudProjectionToggled(enabled)); | 615 OnTouchHudProjectionToggled(enabled)); |
| 614 } | 616 } |
| 615 | 617 |
| 616 #if defined(OS_CHROMEOS) | 618 #if defined(OS_CHROMEOS) |
| 617 ash::FirstRunHelper* Shell::CreateFirstRunHelper() { | 619 FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 618 return new ash::FirstRunHelperImpl; | 620 return new FirstRunHelperImpl; |
| 619 } | 621 } |
| 620 | 622 |
| 621 void Shell::SetCursorCompositingEnabled(bool enabled) { | 623 void Shell::SetCursorCompositingEnabled(bool enabled) { |
| 622 window_tree_host_manager_->cursor_window_controller() | 624 window_tree_host_manager_->cursor_window_controller() |
| 623 ->SetCursorCompositingEnabled(enabled); | 625 ->SetCursorCompositingEnabled(enabled); |
| 624 native_cursor_manager_->SetNativeCursorEnabled(!enabled); | 626 native_cursor_manager_->SetNativeCursorEnabled(!enabled); |
| 625 } | 627 } |
| 626 #endif // defined(OS_CHROMEOS) | 628 #endif // defined(OS_CHROMEOS) |
| 627 | 629 |
| 628 void Shell::DoInitialWorkspaceAnimation() { | 630 void Shell::DoInitialWorkspaceAnimation() { |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); | 1033 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); |
| 1032 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); | 1034 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); |
| 1033 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); | 1035 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); |
| 1034 media_delegate_.reset(delegate_->CreateMediaDelegate()); | 1036 media_delegate_.reset(delegate_->CreateMediaDelegate()); |
| 1035 | 1037 |
| 1036 resize_shadow_controller_.reset(new ResizeShadowController()); | 1038 resize_shadow_controller_.reset(new ResizeShadowController()); |
| 1037 shadow_controller_.reset( | 1039 shadow_controller_.reset( |
| 1038 new ::wm::ShadowController(activation_client_)); | 1040 new ::wm::ShadowController(activation_client_)); |
| 1039 | 1041 |
| 1040 // Create system_tray_notifier_ before the delegate. | 1042 // Create system_tray_notifier_ before the delegate. |
| 1041 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); | 1043 system_tray_notifier_.reset(new SystemTrayNotifier()); |
| 1042 | 1044 |
| 1043 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. | 1045 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. |
| 1044 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); | 1046 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); |
| 1045 DCHECK(system_tray_delegate_.get()); | 1047 DCHECK(system_tray_delegate_.get()); |
| 1046 | 1048 |
| 1047 locale_notification_controller_.reset(new LocaleNotificationController); | 1049 locale_notification_controller_.reset(new LocaleNotificationController); |
| 1048 | 1050 |
| 1049 // Initialize system_tray_delegate_ after StatusAreaWidget is created. | 1051 // Initialize system_tray_delegate_ after StatusAreaWidget is created. |
| 1050 system_tray_delegate_->Initialize(); | 1052 system_tray_delegate_->Initialize(); |
| 1051 | 1053 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 | 1085 |
| 1084 if (cursor_manager_) { | 1086 if (cursor_manager_) { |
| 1085 if (initially_hide_cursor_) | 1087 if (initially_hide_cursor_) |
| 1086 cursor_manager_->HideCursor(); | 1088 cursor_manager_->HideCursor(); |
| 1087 cursor_manager_->SetCursor(ui::kCursorPointer); | 1089 cursor_manager_->SetCursor(ui::kCursorPointer); |
| 1088 } | 1090 } |
| 1089 | 1091 |
| 1090 #if defined(OS_CHROMEOS) | 1092 #if defined(OS_CHROMEOS) |
| 1091 // Set accelerator controller delegates. | 1093 // Set accelerator controller delegates. |
| 1092 accelerator_controller_->SetBrightnessControlDelegate( | 1094 accelerator_controller_->SetBrightnessControlDelegate( |
| 1093 scoped_ptr<ash::BrightnessControlDelegate>( | 1095 scoped_ptr<BrightnessControlDelegate>( |
| 1094 new ash::system::BrightnessControllerChromeos)); | 1096 new system::BrightnessControllerChromeos)); |
| 1095 | 1097 |
| 1096 power_event_observer_.reset(new PowerEventObserver()); | 1098 power_event_observer_.reset(new PowerEventObserver()); |
| 1097 user_activity_notifier_.reset( | 1099 user_activity_notifier_.reset( |
| 1098 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1100 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
| 1099 video_activity_notifier_.reset( | 1101 video_activity_notifier_.reset( |
| 1100 new VideoActivityNotifier(video_detector_.get())); | 1102 new VideoActivityNotifier(video_detector_.get())); |
| 1101 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1103 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| 1102 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); | 1104 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); |
| 1103 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1105 screen_orientation_controller_.reset(new ScreenOrientationController()); |
| 1104 #endif | 1106 #endif |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 | 1198 |
| 1197 void Shell::OnWindowActivated( | 1199 void Shell::OnWindowActivated( |
| 1198 aura::client::ActivationChangeObserver::ActivationReason reason, | 1200 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1199 aura::Window* gained_active, | 1201 aura::Window* gained_active, |
| 1200 aura::Window* lost_active) { | 1202 aura::Window* lost_active) { |
| 1201 if (gained_active) | 1203 if (gained_active) |
| 1202 target_root_window_ = gained_active->GetRootWindow(); | 1204 target_root_window_ = gained_active->GetRootWindow(); |
| 1203 } | 1205 } |
| 1204 | 1206 |
| 1205 } // namespace ash | 1207 } // namespace ash |
| OLD | NEW |