| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/accelerators/debug_commands.h" | 5 #include "ash/common/accelerators/debug_commands.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_commands.h" | 7 #include "ash/common/accelerators/accelerator_commands.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/shell_delegate.h" | 9 #include "ash/common/shell_delegate.h" |
| 10 #include "ash/common/system/toast/toast_data.h" | 10 #include "ash/common/system/toast/toast_data.h" |
| 11 #include "ash/common/system/toast/toast_manager.h" | 11 #include "ash/common/system/toast/toast_manager.h" |
| 12 #include "ash/common/wallpaper/wallpaper_controller.h" | 12 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 13 #include "ash/common/wallpaper/wallpaper_delegate.h" | 13 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
| 17 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
| 20 #include "ash/wm/window_util.h" |
| 20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 21 #include "base/metrics/user_metrics.h" | 22 #include "base/metrics/user_metrics.h" |
| 22 #include "base/metrics/user_metrics_action.h" | 23 #include "base/metrics/user_metrics_action.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "ui/compositor/debug_utils.h" | 25 #include "ui/compositor/debug_utils.h" |
| 25 #include "ui/compositor/layer.h" | 26 #include "ui/compositor/layer.h" |
| 26 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
| 28 #include "ui/gfx/image/image_skia_rep.h" | 29 #include "ui/gfx/image/image_skia_rep.h" |
| 29 #include "ui/views/debug_utils.h" | 30 #include "ui/views/debug_utils.h" |
| 30 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
| 31 | 32 |
| 32 namespace ash { | 33 namespace ash { |
| 33 namespace debug { | 34 namespace debug { |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 void HandlePrintLayerHierarchy() { | 37 void HandlePrintLayerHierarchy() { |
| 37 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { | 38 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { |
| 38 ui::Layer* layer = root->GetLayer(); | 39 ui::Layer* layer = root->GetLayer(); |
| 39 if (layer) | 40 if (layer) |
| 40 ui::PrintLayerHierarchy( | 41 ui::PrintLayerHierarchy( |
| 41 layer, root->GetRootWindowController()->GetLastMouseLocationInRoot()); | 42 layer, root->GetRootWindowController()->GetLastMouseLocationInRoot()); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 void HandlePrintViewHierarchy() { | 46 void HandlePrintViewHierarchy() { |
| 46 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); | 47 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); |
| 47 if (!active_window) | 48 if (!active_window) |
| 48 return; | 49 return; |
| 49 views::Widget* widget = active_window->GetInternalWidget(); | 50 views::Widget* widget = active_window->GetInternalWidget(); |
| 50 if (!widget) | 51 if (!widget) |
| 51 return; | 52 return; |
| 52 views::PrintViewHierarchy(widget->GetRootView()); | 53 views::PrintViewHierarchy(widget->GetRootView()); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void PrintWindowHierarchy(const WmWindow* active_window, | 56 void PrintWindowHierarchy(const WmWindow* active_window, |
| 56 WmWindow* window, | 57 WmWindow* window, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 ? " [snapped] " | 70 ? " [snapped] " |
| 70 : "") | 71 : "") |
| 71 << ", subpixel offset=" | 72 << ", subpixel offset=" |
| 72 << window->GetLayer()->subpixel_position_offset().ToString() << '\n'; | 73 << window->GetLayer()->subpixel_position_offset().ToString() << '\n'; |
| 73 | 74 |
| 74 for (WmWindow* child : window->GetChildren()) | 75 for (WmWindow* child : window->GetChildren()) |
| 75 PrintWindowHierarchy(active_window, child, indent + 3, out); | 76 PrintWindowHierarchy(active_window, child, indent + 3, out); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void HandlePrintWindowHierarchy() { | 79 void HandlePrintWindowHierarchy() { |
| 79 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); | 80 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); |
| 80 WmWindow::Windows roots = WmShell::Get()->GetAllRootWindows(); | 81 WmWindow::Windows roots = WmShell::Get()->GetAllRootWindows(); |
| 81 for (size_t i = 0; i < roots.size(); ++i) { | 82 for (size_t i = 0; i < roots.size(); ++i) { |
| 82 std::ostringstream out; | 83 std::ostringstream out; |
| 83 out << "RootWindow " << i << ":\n"; | 84 out << "RootWindow " << i << ":\n"; |
| 84 PrintWindowHierarchy(active_window, roots[i], 0, &out); | 85 PrintWindowHierarchy(active_window, roots[i], 0, &out); |
| 85 // Error so logs can be collected from end-users. | 86 // Error so logs can be collected from end-users. |
| 86 LOG(ERROR) << out.str(); | 87 LOG(ERROR) << out.str(); |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 | 90 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 case DEBUG_TRIGGER_CRASH: | 211 case DEBUG_TRIGGER_CRASH: |
| 211 HandleTriggerCrash(); | 212 HandleTriggerCrash(); |
| 212 break; | 213 break; |
| 213 default: | 214 default: |
| 214 break; | 215 break; |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 } // namespace debug | 219 } // namespace debug |
| 219 } // namespace ash | 220 } // namespace ash |
| OLD | NEW |