| 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 | 8 |
| 9 #include "ash/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 | 671 |
| 672 CreateSpecialContainers(root_window); | 672 CreateSpecialContainers(root_window); |
| 673 | 673 |
| 674 stacking_controller_.reset(new internal::StackingController); | 674 stacking_controller_.reset(new internal::StackingController); |
| 675 | 675 |
| 676 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 676 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 677 root_window->SetLayoutManager(root_window_layout_); | 677 root_window->SetLayoutManager(root_window_layout_); |
| 678 | 678 |
| 679 event_client_.reset(new internal::EventClientImpl(root_window)); | 679 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 680 | 680 |
| 681 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 682 |
| 683 // TODO(sad): All of these initialization should happen in SystemTray. |
| 684 tray_.reset(new SystemTray()); |
| 681 if (delegate_.get()) | 685 if (delegate_.get()) |
| 682 status_widget_ = delegate_->CreateStatusArea(); | 686 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
| 687 if (!tray_delegate_.get()) |
| 688 tray_delegate_.reset(new DummySystemTrayDelegate()); |
| 683 | 689 |
| 684 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 690 internal::TrayVolume* tray_volume = new internal::TrayVolume(); |
| 685 if (!command_line->HasSwitch(switches::kDisableAshUberTray)) { | 691 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(); |
| 686 // TODO(sad): This is rather ugly at the moment. This is because we are | 692 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); |
| 687 // supporting both the old and the new status bar at the same time. This | 693 internal::TrayDate* tray_date = new internal::TrayDate(); |
| 688 // will soon get better once the new one is ready and the old one goes out | 694 internal::TrayPower* tray_power = new internal::TrayPower(); |
| 689 // the door. | 695 internal::TrayNetwork* tray_network = new internal::TrayNetwork; |
| 690 tray_.reset(new SystemTray()); | 696 internal::TrayUser* tray_user = new internal::TrayUser; |
| 691 if (status_widget_) { | 697 internal::TrayAccessibility* tray_accessibility = |
| 692 status_widget_->GetContentsView()->RemoveAllChildViews(false); | 698 new internal::TrayAccessibility; |
| 693 status_widget_->GetContentsView()->AddChildView(tray_.get()); | 699 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; |
| 694 } | 700 internal::TrayIME* tray_ime = new internal::TrayIME; |
| 701 internal::TrayUpdate* tray_update = new internal::TrayUpdate; |
| 695 | 702 |
| 696 if (delegate_.get()) | 703 tray_->accessibility_observer_ = tray_accessibility; |
| 697 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | 704 tray_->audio_observer_ = tray_volume; |
| 698 if (!tray_delegate_.get()) | 705 tray_->bluetooth_observer_ = tray_bluetooth; |
| 699 tray_delegate_.reset(new DummySystemTrayDelegate()); | 706 tray_->brightness_observer_ = tray_brightness; |
| 707 tray_->caps_lock_observer_ = tray_caps_lock; |
| 708 tray_->clock_observer_ = tray_date; |
| 709 tray_->ime_observer_ = tray_ime; |
| 710 tray_->network_observer_ = tray_network; |
| 711 tray_->power_status_observer_ = tray_power; |
| 712 tray_->update_observer_ = tray_update; |
| 713 tray_->user_observer_ = tray_user; |
| 700 | 714 |
| 701 internal::TrayVolume* tray_volume = new internal::TrayVolume(); | 715 tray_->AddTrayItem(tray_user); |
| 702 internal::TrayBluetooth* tray_bluetooth = new internal::TrayBluetooth(); | 716 tray_->AddTrayItem(new internal::TrayEmpty()); |
| 703 internal::TrayBrightness* tray_brightness = new internal::TrayBrightness(); | 717 tray_->AddTrayItem(tray_power); |
| 704 internal::TrayDate* tray_date = new internal::TrayDate(); | 718 tray_->AddTrayItem(tray_network); |
| 705 internal::TrayPower* tray_power = new internal::TrayPower(); | 719 tray_->AddTrayItem(tray_bluetooth); |
| 706 internal::TrayNetwork* tray_network = new internal::TrayNetwork; | 720 tray_->AddTrayItem(tray_ime); |
| 707 internal::TrayUser* tray_user = new internal::TrayUser; | 721 tray_->AddTrayItem(tray_volume); |
| 708 internal::TrayAccessibility* tray_accessibility = | 722 tray_->AddTrayItem(tray_brightness); |
| 709 new internal::TrayAccessibility; | 723 tray_->AddTrayItem(tray_update); |
| 710 internal::TrayCapsLock* tray_caps_lock = new internal::TrayCapsLock; | 724 tray_->AddTrayItem(new internal::TraySettings()); |
| 711 internal::TrayIME* tray_ime = new internal::TrayIME; | 725 tray_->AddTrayItem(tray_accessibility); |
| 712 internal::TrayUpdate* tray_update = new internal::TrayUpdate; | 726 tray_->AddTrayItem(tray_caps_lock); |
| 727 tray_->AddTrayItem(tray_date); |
| 728 tray_->SetVisible(tray_delegate_->GetTrayVisibilityOnStartup()); |
| 713 | 729 |
| 714 tray_->accessibility_observer_ = tray_accessibility; | 730 // TODO(sad): Replace uses of status_widget_ with tray_->GetWidget(). |
| 715 tray_->audio_observer_ = tray_volume; | 731 status_widget_ = internal::CreateStatusArea(tray_.get()); |
| 716 tray_->bluetooth_observer_ = tray_bluetooth; | |
| 717 tray_->brightness_observer_ = tray_brightness; | |
| 718 tray_->caps_lock_observer_ = tray_caps_lock; | |
| 719 tray_->clock_observer_ = tray_date; | |
| 720 tray_->ime_observer_ = tray_ime; | |
| 721 tray_->network_observer_ = tray_network; | |
| 722 tray_->power_status_observer_ = tray_power; | |
| 723 tray_->update_observer_ = tray_update; | |
| 724 tray_->user_observer_ = tray_user; | |
| 725 | |
| 726 tray_->AddTrayItem(tray_user); | |
| 727 tray_->AddTrayItem(new internal::TrayEmpty()); | |
| 728 tray_->AddTrayItem(tray_power); | |
| 729 tray_->AddTrayItem(tray_network); | |
| 730 tray_->AddTrayItem(tray_bluetooth); | |
| 731 tray_->AddTrayItem(tray_ime); | |
| 732 tray_->AddTrayItem(tray_volume); | |
| 733 tray_->AddTrayItem(tray_brightness); | |
| 734 tray_->AddTrayItem(tray_update); | |
| 735 tray_->AddTrayItem(new internal::TraySettings()); | |
| 736 tray_->AddTrayItem(tray_accessibility); | |
| 737 tray_->AddTrayItem(tray_caps_lock); | |
| 738 tray_->AddTrayItem(tray_date); | |
| 739 | |
| 740 tray_->SetVisible(tray_delegate_->GetTrayVisibilityOnStartup()); | |
| 741 } | |
| 742 if (!status_widget_) | |
| 743 status_widget_ = internal::CreateStatusArea(tray_.get()); | |
| 744 | 732 |
| 745 // This controller needs to be set before SetupManagedWindowMode. | 733 // This controller needs to be set before SetupManagedWindowMode. |
| 746 desktop_background_controller_.reset(new DesktopBackgroundController); | 734 desktop_background_controller_.reset(new DesktopBackgroundController); |
| 747 if (delegate_.get()) | 735 if (delegate_.get()) |
| 748 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 736 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
| 749 if (!user_wallpaper_delegate_.get()) | 737 if (!user_wallpaper_delegate_.get()) |
| 750 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 738 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
| 751 | 739 |
| 752 InitLayoutManagers(); | 740 InitLayoutManagers(); |
| 753 | 741 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 // Create desktop background widget. | 925 // Create desktop background widget. |
| 938 desktop_background_controller_->SetDesktopBackgroundImageMode(); | 926 desktop_background_controller_->SetDesktopBackgroundImageMode(); |
| 939 } | 927 } |
| 940 | 928 |
| 941 void Shell::DisableWorkspaceGridLayout() { | 929 void Shell::DisableWorkspaceGridLayout() { |
| 942 if (workspace_controller_.get()) | 930 if (workspace_controller_.get()) |
| 943 workspace_controller_->workspace_manager()->set_grid_size(0); | 931 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 944 } | 932 } |
| 945 | 933 |
| 946 } // namespace ash | 934 } // namespace ash |
| OLD | NEW |