| 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/drag_drop/drag_drop_controller.h" | 11 #include "ash/drag_drop/drag_drop_controller.h" |
| 12 #include "ash/focus_cycler.h" | 12 #include "ash/focus_cycler.h" |
| 13 #include "ash/ime/input_method_event_filter.h" | 13 #include "ash/ime/input_method_event_filter.h" |
| 14 #include "ash/launcher/launcher.h" | 14 #include "ash/launcher/launcher.h" |
| 15 #include "ash/screen_ash.h" |
| 15 #include "ash/shell_delegate.h" | 16 #include "ash/shell_delegate.h" |
| 16 #include "ash/shell_factory.h" | 17 #include "ash/shell_factory.h" |
| 17 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 18 #include "ash/system/audio/tray_volume.h" | 19 #include "ash/system/audio/tray_volume.h" |
| 19 #include "ash/system/brightness/tray_brightness.h" | 20 #include "ash/system/brightness/tray_brightness.h" |
| 20 #include "ash/system/network/tray_network.h" | 21 #include "ash/system/network/tray_network.h" |
| 21 #include "ash/system/power/power_status_controller.h" | 22 #include "ash/system/power/power_status_controller.h" |
| 22 #include "ash/system/power/tray_power_date.h" | 23 #include "ash/system/power/tray_power_date.h" |
| 23 #include "ash/system/settings/tray_settings.h" | 24 #include "ash/system/settings/tray_settings.h" |
| 24 #include "ash/system/tray/system_tray_delegate.h" | 25 #include "ash/system/tray/system_tray_delegate.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 internal::WorkspaceController* Shell::TestApi::workspace_controller() { | 301 internal::WorkspaceController* Shell::TestApi::workspace_controller() { |
| 301 return shell_->workspace_controller_.get(); | 302 return shell_->workspace_controller_.get(); |
| 302 } | 303 } |
| 303 | 304 |
| 304 //////////////////////////////////////////////////////////////////////////////// | 305 //////////////////////////////////////////////////////////////////////////////// |
| 305 // Shell, public: | 306 // Shell, public: |
| 306 | 307 |
| 307 Shell::Shell(ShellDelegate* delegate) | 308 Shell::Shell(ShellDelegate* delegate) |
| 308 : root_window_(new aura::RootWindow), | 309 : root_window_(new aura::RootWindow), |
| 310 screen_(new ScreenAsh(root_window_.get())), |
| 309 root_filter_(NULL), | 311 root_filter_(NULL), |
| 310 delegate_(delegate), | 312 delegate_(delegate), |
| 311 audio_controller_(NULL), | 313 audio_controller_(NULL), |
| 312 brightness_controller_(NULL), | 314 brightness_controller_(NULL), |
| 313 network_controller_(NULL), | 315 network_controller_(NULL), |
| 314 power_status_controller_(NULL), | 316 power_status_controller_(NULL), |
| 315 shelf_(NULL), | 317 shelf_(NULL), |
| 316 desktop_background_mode_(BACKGROUND_IMAGE), | 318 desktop_background_mode_(BACKGROUND_IMAGE), |
| 317 root_window_layout_(NULL), | 319 root_window_layout_(NULL), |
| 318 status_widget_(NULL) { | 320 status_widget_(NULL) { |
| 321 gfx::Screen::SetInstance(screen_); |
| 319 } | 322 } |
| 320 | 323 |
| 321 Shell::~Shell() { | 324 Shell::~Shell() { |
| 322 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 325 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 323 RemoveRootWindowEventFilter(input_method_filter_.get()); | 326 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| 324 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 327 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
| 325 #if !defined(OS_MACOSX) | 328 #if !defined(OS_MACOSX) |
| 326 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 329 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
| 327 #endif | 330 #endif |
| 328 | 331 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 frame_view->Init(widget); | 593 frame_view->Init(widget); |
| 591 return frame_view; | 594 return frame_view; |
| 592 } | 595 } |
| 593 | 596 |
| 594 void Shell::RotateFocus(Direction direction) { | 597 void Shell::RotateFocus(Direction direction) { |
| 595 focus_cycler_->RotateFocus( | 598 focus_cycler_->RotateFocus( |
| 596 direction == FORWARD ? internal::FocusCycler::FORWARD : | 599 direction == FORWARD ? internal::FocusCycler::FORWARD : |
| 597 internal::FocusCycler::BACKWARD); | 600 internal::FocusCycler::BACKWARD); |
| 598 } | 601 } |
| 599 | 602 |
| 603 void Shell::SetScreenWorkAreaInsets(const gfx::Insets& insets) { |
| 604 if (screen_->work_area_insets() == insets) |
| 605 return; |
| 606 screen_->set_work_area_insets(insets); |
| 607 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 608 OnScreenWorkAreaInsetsChanged()); |
| 609 } |
| 610 |
| 611 void Shell::AddShellObserver(ShellObserver* observer) { |
| 612 observers_.AddObserver(observer); |
| 613 } |
| 614 |
| 615 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 616 observers_.RemoveObserver(observer); |
| 617 } |
| 618 |
| 600 //////////////////////////////////////////////////////////////////////////////// | 619 //////////////////////////////////////////////////////////////////////////////// |
| 601 // Shell, private: | 620 // Shell, private: |
| 602 | 621 |
| 603 void Shell::InitLayoutManagers() { | 622 void Shell::InitLayoutManagers() { |
| 604 DCHECK(root_window_layout_); | 623 DCHECK(root_window_layout_); |
| 605 DCHECK(status_widget_); | 624 DCHECK(status_widget_); |
| 606 | 625 |
| 607 internal::ShelfLayoutManager* shelf_layout_manager = | 626 internal::ShelfLayoutManager* shelf_layout_manager = |
| 608 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); | 627 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); |
| 609 GetContainer(internal::kShellWindowId_LauncherContainer)-> | 628 GetContainer(internal::kShellWindowId_LauncherContainer)-> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 628 // Create the desktop background image. | 647 // Create the desktop background image. |
| 629 SetDesktopBackgroundMode(BACKGROUND_IMAGE); | 648 SetDesktopBackgroundMode(BACKGROUND_IMAGE); |
| 630 } | 649 } |
| 631 | 650 |
| 632 void Shell::DisableWorkspaceGridLayout() { | 651 void Shell::DisableWorkspaceGridLayout() { |
| 633 if (workspace_controller_.get()) | 652 if (workspace_controller_.get()) |
| 634 workspace_controller_->workspace_manager()->set_grid_size(0); | 653 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 635 } | 654 } |
| 636 | 655 |
| 637 } // namespace ash | 656 } // namespace ash |
| OLD | NEW |