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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 bool HandlePrintLayerHierarchy() { | 272 bool HandlePrintLayerHierarchy() { |
273 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 273 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
274 for (size_t i = 0; i < root_windows.size(); ++i) { | 274 for (size_t i = 0; i < root_windows.size(); ++i) { |
275 ui::PrintLayerHierarchy(root_windows[i]->layer(), | 275 ui::PrintLayerHierarchy(root_windows[i]->layer(), |
276 root_windows[i]->GetLastMouseLocationInRoot()); | 276 root_windows[i]->GetLastMouseLocationInRoot()); |
277 } | 277 } |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 bool HandlePrintViewHierarchy() { | 281 bool HandlePrintViewHierarchy() { |
282 aura::Window* default_container = | 282 aura::Window* active_window = ash::wm::GetActiveWindow(); |
283 Shell::GetPrimaryRootWindowController()->GetContainer( | 283 if (!active_window) |
284 internal::kShellWindowId_DefaultContainer); | |
285 if (default_container->children().empty()) | |
286 return true; | 284 return true; |
287 aura::Window* browser_frame = default_container->children()[0]; | |
288 views::Widget* browser_widget = | 285 views::Widget* browser_widget = |
289 views::Widget::GetWidgetForNativeWindow(browser_frame); | 286 views::Widget::GetWidgetForNativeWindow(active_window); |
290 views::PrintViewHierarchy(browser_widget->GetRootView()); | 287 if (browser_widget) |
| 288 views::PrintViewHierarchy(browser_widget->GetRootView()); |
291 return true; | 289 return true; |
292 } | 290 } |
293 | 291 |
294 void PrintWindowHierarchy(aura::Window* window, int indent) { | 292 void PrintWindowHierarchy(aura::Window* window, int indent) { |
295 std::string indent_str(indent, ' '); | 293 std::string indent_str(indent, ' '); |
296 DLOG(INFO) << indent_str << window->name() << " type " << window->type() | 294 DLOG(INFO) << indent_str << window->name() << " type " << window->type() |
297 << (wm::IsActiveWindow(window) ? "active" : ""); | 295 << (wm::IsActiveWindow(window) ? "active" : ""); |
298 for (size_t i = 0; i < window->children().size(); ++i) | 296 for (size_t i = 0; i < window->children().size(); ++i) |
299 PrintWindowHierarchy(window->children()[i], indent + 3); | 297 PrintWindowHierarchy(window->children()[i], indent + 3); |
300 } | 298 } |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 keyboard_brightness_control_delegate) { | 875 keyboard_brightness_control_delegate) { |
878 keyboard_brightness_control_delegate_ = | 876 keyboard_brightness_control_delegate_ = |
879 keyboard_brightness_control_delegate.Pass(); | 877 keyboard_brightness_control_delegate.Pass(); |
880 } | 878 } |
881 | 879 |
882 bool AcceleratorController::CanHandleAccelerators() const { | 880 bool AcceleratorController::CanHandleAccelerators() const { |
883 return true; | 881 return true; |
884 } | 882 } |
885 | 883 |
886 } // namespace ash | 884 } // namespace ash |
OLD | NEW |