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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 internal::kShellWindowId_SettingBubbleContainer, | 222 internal::kShellWindowId_SettingBubbleContainer, |
223 "SettingBubbleContainer", | 223 "SettingBubbleContainer", |
224 lock_screen_related_containers); | 224 lock_screen_related_containers); |
225 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | 225 SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
226 | 226 |
227 CreateContainer(internal::kShellWindowId_OverlayContainer, | 227 CreateContainer(internal::kShellWindowId_OverlayContainer, |
228 "OverlayContainer", | 228 "OverlayContainer", |
229 lock_screen_related_containers); | 229 lock_screen_related_containers); |
230 } | 230 } |
231 | 231 |
| 232 // This dummy class is used for shell unit tests. We dont have chrome delegate |
| 233 // in these tests. |
| 234 class DummyUserWallpaperDelegate: public UserWallpaperDelegate { |
| 235 public: |
| 236 DummyUserWallpaperDelegate() {} |
| 237 |
| 238 virtual ~DummyUserWallpaperDelegate() {} |
| 239 |
| 240 const int GetUserWallpaperIndex() { |
| 241 return 0; |
| 242 } |
| 243 |
| 244 private: |
| 245 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); |
| 246 }; |
| 247 |
232 class DummySystemTrayDelegate : public SystemTrayDelegate { | 248 class DummySystemTrayDelegate : public SystemTrayDelegate { |
233 public: | 249 public: |
234 DummySystemTrayDelegate() | 250 DummySystemTrayDelegate() |
235 : muted_(false), | 251 : muted_(false), |
236 wifi_enabled_(true), | 252 wifi_enabled_(true), |
237 cellular_enabled_(true), | 253 cellular_enabled_(true), |
238 bluetooth_enabled_(true), | 254 bluetooth_enabled_(true), |
239 volume_(0.5) { | 255 volume_(0.5) { |
240 } | 256 } |
241 | 257 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 tray_->AddTrayItem(new internal::TraySettings()); | 647 tray_->AddTrayItem(new internal::TraySettings()); |
632 tray_->AddTrayItem(tray_date); | 648 tray_->AddTrayItem(tray_date); |
633 tray_->AddTrayItem(tray_accessibility); | 649 tray_->AddTrayItem(tray_accessibility); |
634 tray_->AddTrayItem(tray_caps_lock); | 650 tray_->AddTrayItem(tray_caps_lock); |
635 } | 651 } |
636 if (!status_widget_) | 652 if (!status_widget_) |
637 status_widget_ = internal::CreateStatusArea(tray_.get()); | 653 status_widget_ = internal::CreateStatusArea(tray_.get()); |
638 | 654 |
639 // This controller needs to be set before SetupManagedWindowMode. | 655 // This controller needs to be set before SetupManagedWindowMode. |
640 desktop_background_controller_.reset(new DesktopBackgroundController); | 656 desktop_background_controller_.reset(new DesktopBackgroundController); |
| 657 if (delegate_.get()) |
| 658 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
| 659 if (!user_wallpaper_delegate_.get()) |
| 660 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
641 | 661 |
642 InitLayoutManagers(); | 662 InitLayoutManagers(); |
643 | 663 |
644 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { | 664 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { |
645 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 665 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
646 shadow_controller_.reset(new internal::ShadowController()); | 666 shadow_controller_.reset(new internal::ShadowController()); |
647 } | 667 } |
648 | 668 |
649 focus_cycler_.reset(new internal::FocusCycler()); | 669 focus_cycler_.reset(new internal::FocusCycler()); |
650 focus_cycler_->AddWidget(status_widget_); | 670 focus_cycler_->AddWidget(status_widget_); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 GetContainer(internal::kShellWindowId_StatusContainer)-> | 811 GetContainer(internal::kShellWindowId_StatusContainer)-> |
792 SetLayoutManager(status_area_layout_manager); | 812 SetLayoutManager(status_area_layout_manager); |
793 | 813 |
794 aura::Window* default_container = | 814 aura::Window* default_container = |
795 GetContainer(internal::kShellWindowId_DefaultContainer); | 815 GetContainer(internal::kShellWindowId_DefaultContainer); |
796 // Workspace manager has its own layout managers. | 816 // Workspace manager has its own layout managers. |
797 workspace_controller_.reset( | 817 workspace_controller_.reset( |
798 new internal::WorkspaceController(default_container)); | 818 new internal::WorkspaceController(default_container)); |
799 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); | 819 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); |
800 | 820 |
801 // Create the desktop background image. | 821 // Create desktop background widget. |
802 desktop_background_controller_->SetDefaultDesktopBackgroundImage(); | 822 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function |
| 823 // here after issue 117244 got fixed. |
| 824 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 825 GetWallpaper(user_wallpaper_delegate_->GetUserWallpaperIndex())); |
803 } | 826 } |
804 | 827 |
805 void Shell::DisableWorkspaceGridLayout() { | 828 void Shell::DisableWorkspaceGridLayout() { |
806 if (workspace_controller_.get()) | 829 if (workspace_controller_.get()) |
807 workspace_controller_->workspace_manager()->set_grid_size(0); | 830 workspace_controller_->workspace_manager()->set_grid_size(0); |
808 } | 831 } |
809 | 832 |
810 } // namespace ash | 833 } // namespace ash |
OLD | NEW |