| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
| 29 #include "ui/gfx/image/image_skia_rep.h" | 29 #include "ui/gfx/image/image_skia_rep.h" |
| 30 #include "ui/views/debug_utils.h" | 30 #include "ui/views/debug_utils.h" |
| 31 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
| 32 | 32 |
| 33 namespace ash { | 33 namespace ash { |
| 34 namespace debug { | 34 namespace debug { |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 void HandlePrintLayerHierarchy() { | 37 void HandlePrintLayerHierarchy() { |
| 38 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { | 38 for (aura::Window* root : Shell::Get()->GetAllRootWindows()) { |
| 39 ui::Layer* layer = root->GetLayer(); | 39 ui::Layer* layer = root->layer(); |
| 40 if (layer) | 40 if (layer) |
| 41 ui::PrintLayerHierarchy( | 41 ui::PrintLayerHierarchy( |
| 42 layer, root->GetRootWindowController()->GetLastMouseLocationInRoot()); | 42 layer, |
| 43 RootWindowController::ForWindow(root)->GetLastMouseLocationInRoot()); |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 | 46 |
| 46 void HandlePrintViewHierarchy() { | 47 void HandlePrintViewHierarchy() { |
| 47 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); | 48 aura::Window* active_window = wm::GetActiveWindow(); |
| 48 if (!active_window) | 49 if (!active_window) |
| 49 return; | 50 return; |
| 50 views::Widget* widget = active_window->GetInternalWidget(); | 51 views::Widget* widget = WmWindow::Get(active_window)->GetInternalWidget(); |
| 51 if (!widget) | 52 if (!widget) |
| 52 return; | 53 return; |
| 53 views::PrintViewHierarchy(widget->GetRootView()); | 54 views::PrintViewHierarchy(widget->GetRootView()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void PrintWindowHierarchy(const WmWindow* active_window, | 57 void PrintWindowHierarchy(const aura::Window* active_window, |
| 57 WmWindow* window, | 58 aura::Window* window, |
| 58 int indent, | 59 int indent, |
| 59 std::ostringstream* out) { | 60 std::ostringstream* out) { |
| 60 std::string indent_str(indent, ' '); | 61 std::string indent_str(indent, ' '); |
| 61 std::string name(window->GetName()); | 62 std::string name(window->GetName()); |
| 62 if (name.empty()) | 63 if (name.empty()) |
| 63 name = "\"\""; | 64 name = "\"\""; |
| 64 *out << indent_str << name << " (" << window << ")" | 65 *out << indent_str << name << " (" << window << ")" |
| 65 << " type=" << window->GetType() | 66 << " type=" << window->type() |
| 66 << ((window == active_window) ? " [active] " : " ") | 67 << ((window == active_window) ? " [active] " : " ") |
| 67 << (window->IsVisible() ? " visible " : " ") | 68 << (window->IsVisible() ? " visible " : " ") |
| 68 << window->GetBounds().ToString() | 69 << window->bounds().ToString() |
| 69 << (window->aura_window()->GetProperty(kSnapChildrenToPixelBoundary) | 70 << (window->GetProperty(kSnapChildrenToPixelBoundary) ? " [snapped] " |
| 70 ? " [snapped] " | 71 : "") |
| 71 : "") | |
| 72 << ", subpixel offset=" | 72 << ", subpixel offset=" |
| 73 << window->GetLayer()->subpixel_position_offset().ToString() << '\n'; | 73 << window->layer()->subpixel_position_offset().ToString() << '\n'; |
| 74 | 74 |
| 75 for (WmWindow* child : window->GetChildren()) | 75 for (aura::Window* child : window->children()) |
| 76 PrintWindowHierarchy(active_window, child, indent + 3, out); | 76 PrintWindowHierarchy(active_window, child, indent + 3, out); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void HandlePrintWindowHierarchy() { | 79 void HandlePrintWindowHierarchy() { |
| 80 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); | 80 aura::Window* active_window = wm::GetActiveWindow(); |
| 81 WmWindow::Windows roots = WmShell::Get()->GetAllRootWindows(); | 81 aura::Window::Windows roots = Shell::Get()->GetAllRootWindows(); |
| 82 for (size_t i = 0; i < roots.size(); ++i) { | 82 for (size_t i = 0; i < roots.size(); ++i) { |
| 83 std::ostringstream out; | 83 std::ostringstream out; |
| 84 out << "RootWindow " << i << ":\n"; | 84 out << "RootWindow " << i << ":\n"; |
| 85 PrintWindowHierarchy(active_window, roots[i], 0, &out); | 85 PrintWindowHierarchy(active_window, roots[i], 0, &out); |
| 86 // Error so logs can be collected from end-users. | 86 // Error so logs can be collected from end-users. |
| 87 LOG(ERROR) << out.str(); | 87 LOG(ERROR) << out.str(); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) { | 91 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 case DEBUG_TRIGGER_CRASH: | 211 case DEBUG_TRIGGER_CRASH: |
| 212 HandleTriggerCrash(); | 212 HandleTriggerCrash(); |
| 213 break; | 213 break; |
| 214 default: | 214 default: |
| 215 break; | 215 break; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace debug | 219 } // namespace debug |
| 220 } // namespace ash | 220 } // namespace ash |
| OLD | NEW |