| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "ash/wm/window_util.h" | 50 #include "ash/wm/window_util.h" |
| 51 #include "ash/wm/workspace_controller.h" | 51 #include "ash/wm/workspace_controller.h" |
| 52 #include "ash/wm/workspace/workspace_event_filter.h" | 52 #include "ash/wm/workspace/workspace_event_filter.h" |
| 53 #include "ash/wm/workspace/workspace_layout_manager.h" | 53 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 54 #include "ash/wm/workspace/workspace_manager.h" | 54 #include "ash/wm/workspace/workspace_manager.h" |
| 55 #include "base/bind.h" | 55 #include "base/bind.h" |
| 56 #include "base/command_line.h" | 56 #include "base/command_line.h" |
| 57 #include "grit/ui_resources.h" | 57 #include "grit/ui_resources.h" |
| 58 #include "third_party/skia/include/core/SkBitmap.h" | 58 #include "third_party/skia/include/core/SkBitmap.h" |
| 59 #include "ui/aura/client/aura_constants.h" | 59 #include "ui/aura/client/aura_constants.h" |
| 60 #include "ui/aura/env.h" |
| 60 #include "ui/aura/layout_manager.h" | 61 #include "ui/aura/layout_manager.h" |
| 62 #include "ui/aura/monitor.h" |
| 63 #include "ui/aura/monitor_manager.h" |
| 61 #include "ui/aura/root_window.h" | 64 #include "ui/aura/root_window.h" |
| 62 #include "ui/aura/window.h" | 65 #include "ui/aura/window.h" |
| 63 #include "ui/gfx/compositor/layer.h" | 66 #include "ui/gfx/compositor/layer.h" |
| 64 #include "ui/gfx/compositor/layer_animator.h" | 67 #include "ui/gfx/compositor/layer_animator.h" |
| 65 #include "ui/gfx/screen.h" | |
| 66 #include "ui/gfx/size.h" | 68 #include "ui/gfx/size.h" |
| 67 #include "ui/views/widget/native_widget_aura.h" | 69 #include "ui/views/widget/native_widget_aura.h" |
| 68 #include "ui/views/widget/widget.h" | 70 #include "ui/views/widget/widget.h" |
| 69 | 71 |
| 70 #if !defined(OS_MACOSX) | 72 #if !defined(OS_MACOSX) |
| 71 #include "ash/accelerators/accelerator_controller.h" | 73 #include "ash/accelerators/accelerator_controller.h" |
| 72 #include "ash/accelerators/accelerator_filter.h" | 74 #include "ash/accelerators/accelerator_filter.h" |
| 73 #include "ash/accelerators/nested_dispatcher_controller.h" | 75 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 74 #endif | 76 #endif |
| 75 | 77 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 delegate_(delegate), | 323 delegate_(delegate), |
| 322 audio_controller_(NULL), | 324 audio_controller_(NULL), |
| 323 brightness_controller_(NULL), | 325 brightness_controller_(NULL), |
| 324 network_controller_(NULL), | 326 network_controller_(NULL), |
| 325 power_status_controller_(NULL), | 327 power_status_controller_(NULL), |
| 326 update_controller_(NULL), | 328 update_controller_(NULL), |
| 327 shelf_(NULL), | 329 shelf_(NULL), |
| 328 desktop_background_mode_(BACKGROUND_IMAGE), | 330 desktop_background_mode_(BACKGROUND_IMAGE), |
| 329 root_window_layout_(NULL), | 331 root_window_layout_(NULL), |
| 330 status_widget_(NULL) { | 332 status_widget_(NULL) { |
| 333 aura::Env::GetInstance()->SetMonitorManager( |
| 334 aura::CreateSingleMonitorManager(root_window_.get())); |
| 331 gfx::Screen::SetInstance(screen_); | 335 gfx::Screen::SetInstance(screen_); |
| 332 } | 336 } |
| 333 | 337 |
| 334 Shell::~Shell() { | 338 Shell::~Shell() { |
| 335 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 339 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 336 RemoveRootWindowEventFilter(input_method_filter_.get()); | 340 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| 337 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 341 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
| 338 #if !defined(OS_MACOSX) | 342 #if !defined(OS_MACOSX) |
| 339 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 343 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
| 340 #endif | 344 #endif |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 frame_view->Init(widget); | 609 frame_view->Init(widget); |
| 606 return frame_view; | 610 return frame_view; |
| 607 } | 611 } |
| 608 | 612 |
| 609 void Shell::RotateFocus(Direction direction) { | 613 void Shell::RotateFocus(Direction direction) { |
| 610 focus_cycler_->RotateFocus( | 614 focus_cycler_->RotateFocus( |
| 611 direction == FORWARD ? internal::FocusCycler::FORWARD : | 615 direction == FORWARD ? internal::FocusCycler::FORWARD : |
| 612 internal::FocusCycler::BACKWARD); | 616 internal::FocusCycler::BACKWARD); |
| 613 } | 617 } |
| 614 | 618 |
| 615 void Shell::SetScreenWorkAreaInsets(const gfx::Insets& insets) { | 619 void Shell::SetMonitorWorkAreaInsets(Window* contains, |
| 616 if (screen_->work_area_insets() == insets) | 620 const gfx::Insets& insets) { |
| 621 aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()-> |
| 622 GetMonitorNearestWindow(contains); |
| 623 if (monitor->work_area_insets() == insets) |
| 617 return; | 624 return; |
| 618 screen_->set_work_area_insets(insets); | 625 monitor->set_work_area_insets(insets); |
| 619 FOR_EACH_OBSERVER(ShellObserver, observers_, | 626 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 620 OnScreenWorkAreaInsetsChanged()); | 627 OnMonitorWorkAreaInsetsChanged()); |
| 621 } | 628 } |
| 622 | 629 |
| 623 void Shell::AddShellObserver(ShellObserver* observer) { | 630 void Shell::AddShellObserver(ShellObserver* observer) { |
| 624 observers_.AddObserver(observer); | 631 observers_.AddObserver(observer); |
| 625 } | 632 } |
| 626 | 633 |
| 627 void Shell::RemoveShellObserver(ShellObserver* observer) { | 634 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 628 observers_.RemoveObserver(observer); | 635 observers_.RemoveObserver(observer); |
| 629 } | 636 } |
| 630 | 637 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 659 // Create the desktop background image. | 666 // Create the desktop background image. |
| 660 SetDesktopBackgroundMode(BACKGROUND_IMAGE); | 667 SetDesktopBackgroundMode(BACKGROUND_IMAGE); |
| 661 } | 668 } |
| 662 | 669 |
| 663 void Shell::DisableWorkspaceGridLayout() { | 670 void Shell::DisableWorkspaceGridLayout() { |
| 664 if (workspace_controller_.get()) | 671 if (workspace_controller_.get()) |
| 665 workspace_controller_->workspace_manager()->set_grid_size(0); | 672 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 666 } | 673 } |
| 667 | 674 |
| 668 } // namespace ash | 675 } // namespace ash |
| OLD | NEW |