| 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" |
| 11 #include "ash/desktop_background/desktop_background_controller.h" | 11 #include "ash/desktop_background/desktop_background_controller.h" |
| 12 #include "ash/desktop_background/desktop_background_resources.h" | 12 #include "ash/desktop_background/desktop_background_resources.h" |
| 13 #include "ash/desktop_background/desktop_background_view.h" | 13 #include "ash/desktop_background/desktop_background_view.h" |
| 14 #include "ash/drag_drop/drag_drop_controller.h" | 14 #include "ash/drag_drop/drag_drop_controller.h" |
| 15 #include "ash/focus_cycler.h" | 15 #include "ash/focus_cycler.h" |
| 16 #include "ash/ime/input_method_event_filter.h" | 16 #include "ash/ime/input_method_event_filter.h" |
| 17 #include "ash/launcher/launcher.h" | 17 #include "ash/launcher/launcher.h" |
| 18 #include "ash/monitor/monitor_controller.h" | 18 #include "ash/monitor/monitor_controller.h" |
| 19 #include "ash/monitor/multi_monitor_manager.h" | 19 #include "ash/monitor/multi_monitor_manager.h" |
| 20 #include "ash/screen_ash.h" | 20 #include "ash/screen_ash.h" |
| 21 #include "ash/shell_context_menu.h" |
| 21 #include "ash/shell_delegate.h" | 22 #include "ash/shell_delegate.h" |
| 22 #include "ash/shell_factory.h" | 23 #include "ash/shell_factory.h" |
| 23 #include "ash/shell_window_ids.h" | 24 #include "ash/shell_window_ids.h" |
| 24 #include "ash/system/audio/tray_volume.h" | 25 #include "ash/system/audio/tray_volume.h" |
| 25 #include "ash/system/bluetooth/tray_bluetooth.h" | 26 #include "ash/system/bluetooth/tray_bluetooth.h" |
| 26 #include "ash/system/brightness/tray_brightness.h" | 27 #include "ash/system/brightness/tray_brightness.h" |
| 27 #include "ash/system/date/tray_date.h" | 28 #include "ash/system/date/tray_date.h" |
| 28 #include "ash/system/ime/tray_ime.h" | 29 #include "ash/system/ime/tray_ime.h" |
| 29 #include "ash/system/network/tray_network.h" | 30 #include "ash/system/network/tray_network.h" |
| 30 #include "ash/system/power/power_status_observer.h" | 31 #include "ash/system/power/power_status_observer.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 247 |
| 247 virtual ~DummyUserWallpaperDelegate() {} | 248 virtual ~DummyUserWallpaperDelegate() {} |
| 248 | 249 |
| 249 virtual const int GetUserWallpaperIndex() OVERRIDE { | 250 virtual const int GetUserWallpaperIndex() OVERRIDE { |
| 250 return 0; | 251 return 0; |
| 251 } | 252 } |
| 252 | 253 |
| 253 virtual void OpenSetWallpaperPage() OVERRIDE { | 254 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 254 } | 255 } |
| 255 | 256 |
| 257 virtual bool IsLoggedInAsGuest() OVERRIDE { |
| 258 return false; |
| 259 } |
| 260 |
| 256 private: | 261 private: |
| 257 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); | 262 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); |
| 258 }; | 263 }; |
| 259 | 264 |
| 260 class DummySystemTrayDelegate : public SystemTrayDelegate { | 265 class DummySystemTrayDelegate : public SystemTrayDelegate { |
| 261 public: | 266 public: |
| 262 DummySystemTrayDelegate() | 267 DummySystemTrayDelegate() |
| 263 : muted_(false), | 268 : muted_(false), |
| 264 wifi_enabled_(true), | 269 wifi_enabled_(true), |
| 265 cellular_enabled_(true), | 270 cellular_enabled_(true), |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 return GetInstance()->root_window_.get(); | 630 return GetInstance()->root_window_.get(); |
| 626 } | 631 } |
| 627 | 632 |
| 628 void Shell::Init() { | 633 void Shell::Init() { |
| 629 aura::RootWindow* root_window = GetRootWindow(); | 634 aura::RootWindow* root_window = GetRootWindow(); |
| 630 root_filter_ = new internal::RootWindowEventFilter(root_window); | 635 root_filter_ = new internal::RootWindowEventFilter(root_window); |
| 631 #if !defined(OS_MACOSX) | 636 #if !defined(OS_MACOSX) |
| 632 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 637 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
| 633 accelerator_controller_.reset(new AcceleratorController); | 638 accelerator_controller_.reset(new AcceleratorController); |
| 634 #endif | 639 #endif |
| 640 shell_context_menu_.reset(new internal::ShellContextMenu); |
| 635 // Pass ownership of the filter to the root window. | 641 // Pass ownership of the filter to the root window. |
| 636 GetRootWindow()->SetEventFilter(root_filter_); | 642 GetRootWindow()->SetEventFilter(root_filter_); |
| 637 | 643 |
| 638 // KeyRewriterEventFilter must be the first one. | 644 // KeyRewriterEventFilter must be the first one. |
| 639 DCHECK(!GetRootWindowEventFilterCount()); | 645 DCHECK(!GetRootWindowEventFilterCount()); |
| 640 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); | 646 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
| 641 AddRootWindowEventFilter(key_rewriter_filter_.get()); | 647 AddRootWindowEventFilter(key_rewriter_filter_.get()); |
| 642 | 648 |
| 643 // PartialScreenshotEventFilter must be the second one to capture key | 649 // PartialScreenshotEventFilter must be the second one to capture key |
| 644 // events when the taking partial screenshot UI is there. | 650 // events when the taking partial screenshot UI is there. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 GetRootWindow()->event_filter())->RemoveFilter(filter); | 802 GetRootWindow()->event_filter())->RemoveFilter(filter); |
| 797 } | 803 } |
| 798 | 804 |
| 799 size_t Shell::GetRootWindowEventFilterCount() const { | 805 size_t Shell::GetRootWindowEventFilterCount() const { |
| 800 return static_cast<internal::RootWindowEventFilter*>( | 806 return static_cast<internal::RootWindowEventFilter*>( |
| 801 GetRootWindow()->event_filter())->GetFilterCount(); | 807 GetRootWindow()->event_filter())->GetFilterCount(); |
| 802 } | 808 } |
| 803 | 809 |
| 804 void Shell::ShowBackgroundMenu(views::Widget* widget, | 810 void Shell::ShowBackgroundMenu(views::Widget* widget, |
| 805 const gfx::Point& location) { | 811 const gfx::Point& location) { |
| 806 if (workspace_controller_.get()) | 812 if (shell_context_menu_.get()) |
| 807 workspace_controller_->ShowMenu(widget, location); | 813 shell_context_menu_->ShowMenu(widget, location); |
| 808 } | 814 } |
| 809 | 815 |
| 810 void Shell::ToggleAppList() { | 816 void Shell::ToggleAppList() { |
| 811 if (!app_list_.get()) | 817 if (!app_list_.get()) |
| 812 app_list_.reset(new internal::AppList); | 818 app_list_.reset(new internal::AppList); |
| 813 app_list_->SetVisible(!app_list_->IsVisible()); | 819 app_list_->SetVisible(!app_list_->IsVisible()); |
| 814 } | 820 } |
| 815 | 821 |
| 816 bool Shell::GetAppListTargetVisibility() const { | 822 bool Shell::GetAppListTargetVisibility() const { |
| 817 return app_list_.get() && app_list_->GetTargetVisibility(); | 823 return app_list_.get() && app_list_->GetTargetVisibility(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 desktop_background_controller_->SetDesktopBackgroundImageMode( | 944 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 939 GetWallpaper(index), GetWallpaperInfo(index).layout); | 945 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 940 } | 946 } |
| 941 | 947 |
| 942 void Shell::DisableWorkspaceGridLayout() { | 948 void Shell::DisableWorkspaceGridLayout() { |
| 943 if (workspace_controller_.get()) | 949 if (workspace_controller_.get()) |
| 944 workspace_controller_->workspace_manager()->set_grid_size(0); | 950 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 945 } | 951 } |
| 946 | 952 |
| 947 } // namespace ash | 953 } // namespace ash |
| OLD | NEW |