Index: athena/main/debug_accelerator_handler.cc |
diff --git a/athena/screen/screen_accelerator_handler.cc b/athena/main/debug_accelerator_handler.cc |
similarity index 65% |
copy from athena/screen/screen_accelerator_handler.cc |
copy to athena/main/debug_accelerator_handler.cc |
index 97c08ec4aa38e45c366222eff2ead6c27cba45c3..1a223ab9a6877f2194b91d5593d62d66afbd049b 100644 |
--- a/athena/screen/screen_accelerator_handler.cc |
+++ b/athena/main/debug_accelerator_handler.cc |
@@ -2,16 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "athena/screen/screen_accelerator_handler.h" |
+#include "athena/main/debug_accelerator_handler.h" |
+#include "athena/activity/public/activity.h" |
+#include "athena/activity/public/activity_manager.h" |
#include "athena/input/public/accelerator_manager.h" |
-#include "athena/screen/public/screen_manager.h" |
#include "ui/aura/window.h" |
#include "ui/aura/window_event_dispatcher.h" |
#include "ui/aura/window_tree_host.h" |
#include "ui/compositor/debug_utils.h" |
-#include "ui/gfx/display.h" |
-#include "ui/gfx/screen.h" |
#include "ui/wm/public/activation_client.h" |
namespace athena { |
@@ -20,7 +19,6 @@ namespace { |
enum Command { |
CMD_PRINT_LAYER_HIERARCHY, |
CMD_PRINT_WINDOW_HIERARCHY, |
- CMD_ROTATE_SCREEN, |
}; |
const int EF_ALL_DOWN = |
@@ -31,9 +29,6 @@ const AcceleratorData accelerator_data[] = { |
AF_DEBUG}, |
{TRIGGER_ON_PRESS, ui::VKEY_W, EF_ALL_DOWN, CMD_PRINT_WINDOW_HIERARCHY, |
AF_DEBUG}, |
- {TRIGGER_ON_PRESS, ui::VKEY_F3, |
- ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, |
- CMD_ROTATE_SCREEN, AF_NONE}, |
}; |
void PrintLayerHierarchy(aura::Window* root_window) { |
@@ -54,7 +49,16 @@ void PrintWindowHierarchy(aura::Window* window, |
<< " type=" << window->type() |
<< ((window == active) ? " [active] " : " ") |
<< (window->IsVisible() ? " visible " : " ") |
- << window->bounds().ToString() << '\n'; |
+ << window->bounds().ToString(); |
+ Activity* activity = ActivityManager::Get()->GetActivityForWindow(window); |
+ if (activity) { |
+ *out << " <activity:" |
+ << " state=" << activity->GetCurrentState() |
+ << " visible=" << activity->IsVisible() |
+ << " media_state=" << activity->GetMediaState() |
+ << ">"; |
+ } |
+ *out << '\n'; |
for (size_t i = 0; i < window->children().size(); ++i) |
PrintWindowHierarchy(window->children()[i], active, indent + 3, out); |
@@ -70,37 +74,22 @@ void HandlePrintWindowHierarchy(aura::Window* root_window) { |
LOG(ERROR) << out.str(); |
} |
-void HandleRotateScreen() { |
- ScreenManager* screen_manager = ScreenManager::Get(); |
- gfx::Display::Rotation current_rotation = |
- gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().rotation(); |
- if (current_rotation == gfx::Display::ROTATE_0) |
- screen_manager->SetRotation(gfx::Display::ROTATE_90); |
- else if (current_rotation == gfx::Display::ROTATE_90) |
- screen_manager->SetRotation(gfx::Display::ROTATE_180); |
- else if (current_rotation == gfx::Display::ROTATE_180) |
- screen_manager->SetRotation(gfx::Display::ROTATE_270); |
- else if (current_rotation == gfx::Display::ROTATE_270) |
- screen_manager->SetRotation(gfx::Display::ROTATE_0); |
-} |
- |
} // namespace |
-// static |
-ScreenAcceleratorHandler::ScreenAcceleratorHandler(aura::Window* root_window) |
+DebugAcceleratorHandler::DebugAcceleratorHandler(aura::Window* root_window) |
: root_window_(root_window) { |
AcceleratorManager::Get()->RegisterAccelerators( |
accelerator_data, arraysize(accelerator_data), this); |
} |
-ScreenAcceleratorHandler::~ScreenAcceleratorHandler() { |
+DebugAcceleratorHandler::~DebugAcceleratorHandler() { |
} |
-bool ScreenAcceleratorHandler::IsCommandEnabled(int command_id) const { |
+bool DebugAcceleratorHandler::IsCommandEnabled(int command_id) const { |
return true; |
} |
-bool ScreenAcceleratorHandler::OnAcceleratorFired( |
+bool DebugAcceleratorHandler::OnAcceleratorFired( |
int command_id, |
const ui::Accelerator& accelerator) { |
switch (command_id) { |
@@ -110,9 +99,6 @@ bool ScreenAcceleratorHandler::OnAcceleratorFired( |
case CMD_PRINT_WINDOW_HIERARCHY: |
HandlePrintWindowHierarchy(root_window_); |
return true; |
- case CMD_ROTATE_SCREEN: |
- HandleRotateScreen(); |
- return true; |
} |
return false; |
} |