| 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 | 9 |
| 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/magnifier/magnification_controller.h" | 18 #include "ash/magnifier/magnification_controller.h" |
| 19 #include "ash/monitor/monitor_controller.h" | 19 #include "ash/monitor/monitor_controller.h" |
| 20 #include "ash/monitor/multi_monitor_manager.h" | 20 #include "ash/monitor/multi_monitor_manager.h" |
| 21 #include "ash/screen_ash.h" | 21 #include "ash/screen_ash.h" |
| 22 #include "ash/shell_context_menu.h" | 22 #include "ash/shell_context_menu.h" |
| 23 #include "ash/shell_delegate.h" | 23 #include "ash/shell_delegate.h" |
| 24 #include "ash/shell_factory.h" | 24 #include "ash/shell_factory.h" |
| 25 #include "ash/shell_window_ids.h" | 25 #include "ash/shell_window_ids.h" |
| 26 #include "ash/system/bluetooth/bluetooth_observer.h" | 26 #include "ash/system/bluetooth/bluetooth_observer.h" |
| 27 #include "ash/system/network/network_observer.h" | 27 #include "ash/system/network/network_observer.h" |
| 28 #include "ash/system/tray/system_tray.h" | 28 #include "ash/system/tray/system_tray.h" |
| 29 #include "ash/system/tray/system_tray_delegate.h" | 29 #include "ash/system/tray/system_tray_delegate.h" |
| 30 #include "ash/tooltips/tooltip_controller.h" | 30 #include "ash/tooltips/tooltip_controller.h" |
| 31 #include "ash/wm/activation_controller.h" | 31 #include "ash/wm/activation_controller.h" |
| 32 #include "ash/wm/app_list_controller.h" |
| 32 #include "ash/wm/base_layout_manager.h" | 33 #include "ash/wm/base_layout_manager.h" |
| 33 #include "ash/wm/custom_frame_view_ash.h" | 34 #include "ash/wm/custom_frame_view_ash.h" |
| 34 #include "ash/wm/dialog_frame_view.h" | 35 #include "ash/wm/dialog_frame_view.h" |
| 35 #include "ash/wm/event_client_impl.h" | 36 #include "ash/wm/event_client_impl.h" |
| 36 #include "ash/wm/key_rewriter_event_filter.h" | 37 #include "ash/wm/key_rewriter_event_filter.h" |
| 37 #include "ash/wm/panel_layout_manager.h" | 38 #include "ash/wm/panel_layout_manager.h" |
| 38 #include "ash/wm/panel_window_event_filter.h" | 39 #include "ash/wm/panel_window_event_filter.h" |
| 39 #include "ash/wm/partial_screenshot_event_filter.h" | 40 #include "ash/wm/partial_screenshot_event_filter.h" |
| 40 #include "ash/wm/power_button_controller.h" | 41 #include "ash/wm/power_button_controller.h" |
| 41 #include "ash/wm/resize_shadow_controller.h" | 42 #include "ash/wm/resize_shadow_controller.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 #include "ash/wm/workspace/workspace_manager.h" | 60 #include "ash/wm/workspace/workspace_manager.h" |
| 60 #include "ash/wm/workspace_controller.h" | 61 #include "ash/wm/workspace_controller.h" |
| 61 #include "base/bind.h" | 62 #include "base/bind.h" |
| 62 #include "base/command_line.h" | 63 #include "base/command_line.h" |
| 63 #include "grit/ui_resources.h" | 64 #include "grit/ui_resources.h" |
| 64 #include "third_party/skia/include/core/SkBitmap.h" | 65 #include "third_party/skia/include/core/SkBitmap.h" |
| 65 #include "ui/aura/client/aura_constants.h" | 66 #include "ui/aura/client/aura_constants.h" |
| 66 #include "ui/aura/env.h" | 67 #include "ui/aura/env.h" |
| 67 #include "ui/aura/layout_manager.h" | 68 #include "ui/aura/layout_manager.h" |
| 68 #include "ui/aura/monitor_manager.h" | 69 #include "ui/aura/monitor_manager.h" |
| 69 #include "ui/aura/monitor_manager.h" | |
| 70 #include "ui/aura/root_window.h" | 70 #include "ui/aura/root_window.h" |
| 71 #include "ui/aura/ui_controls_aura.h" | 71 #include "ui/aura/ui_controls_aura.h" |
| 72 #include "ui/aura/window.h" | 72 #include "ui/aura/window.h" |
| 73 #include "ui/compositor/layer.h" | 73 #include "ui/compositor/layer.h" |
| 74 #include "ui/compositor/layer_animator.h" | 74 #include "ui/compositor/layer_animator.h" |
| 75 #include "ui/gfx/monitor.h" | 75 #include "ui/gfx/monitor.h" |
| 76 #include "ui/gfx/screen.h" | 76 #include "ui/gfx/screen.h" |
| 77 #include "ui/gfx/size.h" | 77 #include "ui/gfx/size.h" |
| 78 #include "ui/ui_controls/ui_controls.h" | 78 #include "ui/ui_controls/ui_controls.h" |
| 79 #include "ui/views/widget/native_widget_aura.h" | 79 #include "ui/views/widget/native_widget_aura.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 virtual void OpenSetWallpaperPage() OVERRIDE { | 236 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 237 } | 237 } |
| 238 | 238 |
| 239 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 239 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
| 240 return false; | 240 return false; |
| 241 } | 241 } |
| 242 | 242 |
| 243 private: | 243 private: |
| 244 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); | 244 DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 class DummySystemTrayDelegate : public SystemTrayDelegate { | 247 class DummySystemTrayDelegate : public SystemTrayDelegate { |
| 248 public: | 248 public: |
| 249 DummySystemTrayDelegate() | 249 DummySystemTrayDelegate() |
| 250 : muted_(false), | 250 : muted_(false), |
| 251 wifi_enabled_(true), | 251 wifi_enabled_(true), |
| 252 cellular_enabled_(true), | 252 cellular_enabled_(true), |
| 253 bluetooth_enabled_(true), | 253 bluetooth_enabled_(true), |
| 254 volume_(0.5), | 254 volume_(0.5), |
| 255 caps_lock_enabled_(false) { | 255 caps_lock_enabled_(false) { |
| 256 } | 256 } |
| 257 | 257 |
| 258 virtual ~DummySystemTrayDelegate() {} | 258 virtual ~DummySystemTrayDelegate() {} |
| 259 | 259 |
| 260 private: | 260 private: |
| 261 | |
| 262 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } | 261 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } |
| 263 | 262 |
| 264 // Overridden from SystemTrayDelegate: | 263 // Overridden from SystemTrayDelegate: |
| 265 virtual const std::string GetUserDisplayName() const OVERRIDE { | 264 virtual const std::string GetUserDisplayName() const OVERRIDE { |
| 266 return "Über tray Über tray Über tray Über tray"; | 265 return "Über tray Über tray Über tray Über tray"; |
| 267 } | 266 } |
| 268 | 267 |
| 269 virtual const std::string GetUserEmail() const OVERRIDE { | 268 virtual const std::string GetUserEmail() const OVERRIDE { |
| 270 return "über@tray"; | 269 return "über@tray"; |
| 271 } | 270 } |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 GetRootWindow()->event_filter())->GetFilterCount(); | 766 GetRootWindow()->event_filter())->GetFilterCount(); |
| 768 } | 767 } |
| 769 | 768 |
| 770 void Shell::ShowBackgroundMenu(views::Widget* widget, | 769 void Shell::ShowBackgroundMenu(views::Widget* widget, |
| 771 const gfx::Point& location) { | 770 const gfx::Point& location) { |
| 772 if (shell_context_menu_.get()) | 771 if (shell_context_menu_.get()) |
| 773 shell_context_menu_->ShowMenu(widget, location); | 772 shell_context_menu_->ShowMenu(widget, location); |
| 774 } | 773 } |
| 775 | 774 |
| 776 void Shell::ToggleAppList() { | 775 void Shell::ToggleAppList() { |
| 777 if (!app_list_.get()) | 776 if (!app_list_controller_.get()) |
| 778 app_list_.reset(new internal::AppList); | 777 app_list_controller_.reset(new internal::AppListController); |
| 779 app_list_->SetVisible(!app_list_->IsVisible()); | 778 app_list_controller_->SetVisible(!app_list_controller_->IsVisible()); |
| 780 } | 779 } |
| 781 | 780 |
| 782 bool Shell::GetAppListTargetVisibility() const { | 781 bool Shell::GetAppListTargetVisibility() const { |
| 783 return app_list_.get() && app_list_->GetTargetVisibility(); | 782 return app_list_controller_.get() && |
| 783 app_list_controller_->GetTargetVisibility(); |
| 784 } | 784 } |
| 785 | 785 |
| 786 aura::Window* Shell::GetAppListWindow() { | 786 aura::Window* Shell::GetAppListWindow() { |
| 787 return app_list_.get() ? app_list_->GetWindow() : NULL; | 787 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL; |
| 788 } | 788 } |
| 789 | 789 |
| 790 bool Shell::IsScreenLocked() const { | 790 bool Shell::IsScreenLocked() const { |
| 791 return !delegate_.get() || delegate_->IsScreenLocked(); | 791 return !delegate_.get() || delegate_->IsScreenLocked(); |
| 792 } | 792 } |
| 793 | 793 |
| 794 bool Shell::IsModalWindowOpen() const { | 794 bool Shell::IsModalWindowOpen() const { |
| 795 const aura::Window* modal_container = GetContainer( | 795 const aura::Window* modal_container = GetContainer( |
| 796 internal::kShellWindowId_SystemModalContainer); | 796 internal::kShellWindowId_SystemModalContainer); |
| 797 return !modal_container->children().empty(); | 797 return !modal_container->children().empty(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 panel_container->SetLayoutManager(panel_layout_manager_); | 928 panel_container->SetLayoutManager(panel_layout_manager_); |
| 929 } | 929 } |
| 930 } | 930 } |
| 931 | 931 |
| 932 void Shell::DisableWorkspaceGridLayout() { | 932 void Shell::DisableWorkspaceGridLayout() { |
| 933 if (workspace_controller_.get()) | 933 if (workspace_controller_.get()) |
| 934 workspace_controller_->workspace_manager()->set_grid_size(0); | 934 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 935 } | 935 } |
| 936 | 936 |
| 937 } // namespace ash | 937 } // namespace ash |
| OLD | NEW |