| 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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_table.h" | 9 #include "ash/accelerators/accelerator_table.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "ui/aura/event.h" | 36 #include "ui/aura/event.h" |
| 37 #include "ui/aura/root_window.h" | 37 #include "ui/aura/root_window.h" |
| 38 #include "ui/base/accelerators/accelerator.h" | 38 #include "ui/base/accelerators/accelerator.h" |
| 39 #include "ui/base/accelerators/accelerator_manager.h" | 39 #include "ui/base/accelerators/accelerator_manager.h" |
| 40 #include "ui/base/keycodes/keyboard_codes.h" | 40 #include "ui/base/keycodes/keyboard_codes.h" |
| 41 #include "ui/compositor/debug_utils.h" | 41 #include "ui/compositor/debug_utils.h" |
| 42 #include "ui/compositor/layer.h" | 42 #include "ui/compositor/layer.h" |
| 43 #include "ui/compositor/layer_animation_sequence.h" | 43 #include "ui/compositor/layer_animation_sequence.h" |
| 44 #include "ui/compositor/layer_animator.h" | 44 #include "ui/compositor/layer_animator.h" |
| 45 #include "ui/oak/oak.h" | 45 #include "ui/oak/oak.h" |
| 46 #include "ui/views/debug_utils.h" |
| 47 #include "ui/views/widget/widget.h" |
| 46 | 48 |
| 47 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 48 #include "chromeos/display/output_configurator.h" | 50 #include "chromeos/display/output_configurator.h" |
| 49 #endif // defined(OS_CHROMEOS) | 51 #endif // defined(OS_CHROMEOS) |
| 50 | 52 |
| 51 namespace ash { | 53 namespace ash { |
| 52 namespace { | 54 namespace { |
| 53 | 55 |
| 54 // Factor of magnification scale. For example, when this value is 1.189, scale | 56 // Factor of magnification scale. For example, when this value is 1.189, scale |
| 55 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... | 57 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 242 } |
| 241 | 243 |
| 242 #if !defined(NDEBUG) | 244 #if !defined(NDEBUG) |
| 243 bool HandlePrintLayerHierarchy() { | 245 bool HandlePrintLayerHierarchy() { |
| 244 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 246 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); |
| 245 ui::PrintLayerHierarchy(root_window->layer(), | 247 ui::PrintLayerHierarchy(root_window->layer(), |
| 246 root_window->last_mouse_location()); | 248 root_window->last_mouse_location()); |
| 247 return true; | 249 return true; |
| 248 } | 250 } |
| 249 | 251 |
| 252 bool HandlePrintViewHierarchy() { |
| 253 aura::Window* default_container = |
| 254 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 255 internal::kShellWindowId_DefaultContainer); |
| 256 if (default_container->children().empty()) |
| 257 return true; |
| 258 aura::Window* browser_frame = default_container->children()[0]; |
| 259 views::Widget* browser_widget = |
| 260 views::Widget::GetWidgetForNativeWindow(browser_frame); |
| 261 views::PrintViewHierarchy(browser_widget->GetRootView()); |
| 262 return true; |
| 263 } |
| 264 |
| 250 void PrintWindowHierarchy(aura::Window* window, int indent) { | 265 void PrintWindowHierarchy(aura::Window* window, int indent) { |
| 251 std::string indent_str(indent, ' '); | 266 std::string indent_str(indent, ' '); |
| 252 DLOG(INFO) << indent_str << window->name() << " type " << window->type() | 267 DLOG(INFO) << indent_str << window->name() << " type " << window->type() |
| 253 << (wm::IsActiveWindow(window) ? "active" : ""); | 268 << (wm::IsActiveWindow(window) ? "active" : ""); |
| 254 for (size_t i = 0; i < window->children().size(); ++i) | 269 for (size_t i = 0; i < window->children().size(); ++i) |
| 255 PrintWindowHierarchy(window->children()[i], indent + 3); | 270 PrintWindowHierarchy(window->children()[i], indent + 3); |
| 256 } | 271 } |
| 257 | 272 |
| 258 bool HandlePrintWindowHierarchy() { | 273 bool HandlePrintWindowHierarchy() { |
| 259 DLOG(INFO) << "Window hierarchy:"; | 274 DLOG(INFO) << "Window hierarchy:"; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 if (DebugShortcutsEnabled()) | 625 if (DebugShortcutsEnabled()) |
| 611 internal::MultiDisplayManager::ToggleDisplayScale(); | 626 internal::MultiDisplayManager::ToggleDisplayScale(); |
| 612 return true; | 627 return true; |
| 613 case MAGNIFY_SCREEN_ZOOM_IN: | 628 case MAGNIFY_SCREEN_ZOOM_IN: |
| 614 return HandleMagnifyScreen(1); | 629 return HandleMagnifyScreen(1); |
| 615 case MAGNIFY_SCREEN_ZOOM_OUT: | 630 case MAGNIFY_SCREEN_ZOOM_OUT: |
| 616 return HandleMagnifyScreen(-1); | 631 return HandleMagnifyScreen(-1); |
| 617 #if !defined(NDEBUG) | 632 #if !defined(NDEBUG) |
| 618 case PRINT_LAYER_HIERARCHY: | 633 case PRINT_LAYER_HIERARCHY: |
| 619 return HandlePrintLayerHierarchy(); | 634 return HandlePrintLayerHierarchy(); |
| 635 case PRINT_VIEW_HIERARCHY: |
| 636 return HandlePrintViewHierarchy(); |
| 620 case PRINT_WINDOW_HIERARCHY: | 637 case PRINT_WINDOW_HIERARCHY: |
| 621 return HandlePrintWindowHierarchy(); | 638 return HandlePrintWindowHierarchy(); |
| 622 #endif | 639 #endif |
| 623 default: | 640 default: |
| 624 NOTREACHED() << "Unhandled action " << action; | 641 NOTREACHED() << "Unhandled action " << action; |
| 625 } | 642 } |
| 626 return false; | 643 return false; |
| 627 } | 644 } |
| 628 | 645 |
| 629 void AcceleratorController::SetBrightnessControlDelegate( | 646 void AcceleratorController::SetBrightnessControlDelegate( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // Then set this one as active. | 712 // Then set this one as active. |
| 696 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 713 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
| 697 } | 714 } |
| 698 } | 715 } |
| 699 | 716 |
| 700 bool AcceleratorController::CanHandleAccelerators() const { | 717 bool AcceleratorController::CanHandleAccelerators() const { |
| 701 return true; | 718 return true; |
| 702 } | 719 } |
| 703 | 720 |
| 704 } // namespace ash | 721 } // namespace ash |
| OLD | NEW |