| 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/settings/tray_settings.h" | 21 #include "ash/system/settings/tray_settings.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/tray/system_tray_delegate.h" | 24 #include "ash/system/tray/system_tray_delegate.h" |
| 24 #include "ash/system/tray/system_tray.h" | 25 #include "ash/system/tray/system_tray.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 296 |
| 296 internal::WorkspaceController* Shell::TestApi::workspace_controller() { | 297 internal::WorkspaceController* Shell::TestApi::workspace_controller() { |
| 297 return shell_->workspace_controller_.get(); | 298 return shell_->workspace_controller_.get(); |
| 298 } | 299 } |
| 299 | 300 |
| 300 //////////////////////////////////////////////////////////////////////////////// | 301 //////////////////////////////////////////////////////////////////////////////// |
| 301 // Shell, public: | 302 // Shell, public: |
| 302 | 303 |
| 303 Shell::Shell(ShellDelegate* delegate) | 304 Shell::Shell(ShellDelegate* delegate) |
| 304 : root_window_(new aura::RootWindow), | 305 : root_window_(new aura::RootWindow), |
| 306 screen_(new ScreenAsh(root_window_.get())), |
| 305 root_filter_(NULL), | 307 root_filter_(NULL), |
| 306 delegate_(delegate), | 308 delegate_(delegate), |
| 307 audio_controller_(NULL), | 309 audio_controller_(NULL), |
| 308 brightness_controller_(NULL), | 310 brightness_controller_(NULL), |
| 309 power_status_controller_(NULL), | 311 power_status_controller_(NULL), |
| 310 shelf_(NULL), | 312 shelf_(NULL), |
| 311 desktop_background_mode_(BACKGROUND_IMAGE), | 313 desktop_background_mode_(BACKGROUND_IMAGE), |
| 312 root_window_layout_(NULL), | 314 root_window_layout_(NULL), |
| 313 status_widget_(NULL) { | 315 status_widget_(NULL) { |
| 316 gfx::Screen::SetInstance(screen_); |
| 314 } | 317 } |
| 315 | 318 |
| 316 Shell::~Shell() { | 319 Shell::~Shell() { |
| 317 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 320 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 318 RemoveRootWindowEventFilter(input_method_filter_.get()); | 321 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| 319 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 322 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
| 320 #if !defined(OS_MACOSX) | 323 #if !defined(OS_MACOSX) |
| 321 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 324 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
| 322 #endif | 325 #endif |
| 323 | 326 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 frame_view->Init(widget); | 585 frame_view->Init(widget); |
| 583 return frame_view; | 586 return frame_view; |
| 584 } | 587 } |
| 585 | 588 |
| 586 void Shell::RotateFocus(Direction direction) { | 589 void Shell::RotateFocus(Direction direction) { |
| 587 focus_cycler_->RotateFocus( | 590 focus_cycler_->RotateFocus( |
| 588 direction == FORWARD ? internal::FocusCycler::FORWARD : | 591 direction == FORWARD ? internal::FocusCycler::FORWARD : |
| 589 internal::FocusCycler::BACKWARD); | 592 internal::FocusCycler::BACKWARD); |
| 590 } | 593 } |
| 591 | 594 |
| 595 void Shell::SetScreenWorkAreaInsets(const gfx::Insets& insets) { |
| 596 if (screen_->work_area_insets() == insets) |
| 597 return; |
| 598 screen_->set_work_area_insets(insets); |
| 599 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 600 OnScreenWorkAreaInsetsChanged()); |
| 601 } |
| 602 |
| 603 void Shell::AddShellObserver(ShellObserver* observer) { |
| 604 observers_.AddObserver(observer); |
| 605 } |
| 606 |
| 607 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 608 observers_.RemoveObserver(observer); |
| 609 } |
| 610 |
| 592 //////////////////////////////////////////////////////////////////////////////// | 611 //////////////////////////////////////////////////////////////////////////////// |
| 593 // Shell, private: | 612 // Shell, private: |
| 594 | 613 |
| 595 void Shell::InitLayoutManagers() { | 614 void Shell::InitLayoutManagers() { |
| 596 DCHECK(root_window_layout_); | 615 DCHECK(root_window_layout_); |
| 597 DCHECK(status_widget_); | 616 DCHECK(status_widget_); |
| 598 | 617 |
| 599 internal::ShelfLayoutManager* shelf_layout_manager = | 618 internal::ShelfLayoutManager* shelf_layout_manager = |
| 600 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); | 619 new internal::ShelfLayoutManager(launcher_->widget(), status_widget_); |
| 601 GetContainer(internal::kShellWindowId_LauncherContainer)-> | 620 GetContainer(internal::kShellWindowId_LauncherContainer)-> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 620 // Create the desktop background image. | 639 // Create the desktop background image. |
| 621 SetDesktopBackgroundMode(BACKGROUND_IMAGE); | 640 SetDesktopBackgroundMode(BACKGROUND_IMAGE); |
| 622 } | 641 } |
| 623 | 642 |
| 624 void Shell::DisableWorkspaceGridLayout() { | 643 void Shell::DisableWorkspaceGridLayout() { |
| 625 if (workspace_controller_.get()) | 644 if (workspace_controller_.get()) |
| 626 workspace_controller_->workspace_manager()->set_grid_size(0); | 645 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 627 } | 646 } |
| 628 | 647 |
| 629 } // namespace ash | 648 } // namespace ash |
| OLD | NEW |