Index: athena/main/debug/debug_window.cc |
diff --git a/athena/main/debug/debug_window.cc b/athena/main/debug/debug_window.cc |
index abd3517be104c1c814789e27b425c0d348c0d9cc..8fd1b9f3579fac8cc937ece2ae619566ab56c3f7 100644 |
--- a/athena/main/debug/debug_window.cc |
+++ b/athena/main/debug/debug_window.cc |
@@ -5,6 +5,7 @@ |
#include "athena/main/debug/debug_window.h" |
#include "athena/common/container_priorities.h" |
+#include "athena/main/debug/network_selector.h" |
#include "athena/resources/athena_resources.h" |
#include "athena/screen/public/screen_manager.h" |
#include "base/bind.h" |
@@ -153,6 +154,32 @@ class NetworkStatus : public chromeos::NetworkStateHandlerObserver { |
base::Closure closure_; |
}; |
+class X : public ui::EventHandler { |
+ public: |
+ explicit X(aura::Window* container) : container_(container) {} |
+ virtual ~X() {} |
+ |
+ private: |
+ // ui::EventHandler: |
+ virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
+ if (event->type() == ui::ET_MOUSE_PRESSED) { |
+ debug::CreateNetworkSelector(container_); |
+ event->SetHandled(); |
+ } |
+ } |
+ |
+ virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
+ if (event->type() == ui::ET_GESTURE_TAP) { |
+ debug::CreateNetworkSelector(container_); |
+ event->SetHandled(); |
+ } |
+ } |
+ |
+ aura::Window* container_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(X); |
+}; |
+ |
class DebugWidget { |
public: |
DebugWidget() : container_(NULL), widget_(NULL) { |
@@ -171,6 +198,7 @@ class DebugWidget { |
void CreateContainer() { |
athena::ScreenManager::ContainerParams params("DebugContainer", |
athena::CP_DEBUG); |
+ params.can_activate_children = true; |
container_ = athena::ScreenManager::Get()->CreateContainer(params); |
} |
@@ -179,12 +207,14 @@ class DebugWidget { |
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; |
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
- params.accept_events = false; |
+ params.accept_events = true; |
params.bounds = gfx::Rect(200, 0, 100, 105); |
params.parent = container_; |
widget_ = new views::Widget(); |
widget_->Init(params); |
+ event_handler_.reset(new X(container_)); |
+ |
const int kHorizontalSpacing = 10; |
const int kBorderVerticalSpacing = 3; |
const int kBetweenChildSpacing = 10; |
@@ -198,6 +228,7 @@ class DebugWidget { |
container->set_background( |
views::Background::CreateSolidBackground(kBackgroundColor)); |
container->SetBorder(views::Border::CreateSolidBorder(1, kBackgroundColor)); |
+ container->set_target_handler(event_handler_.get()); |
widget_->SetContentsView(container); |
widget_->StackAtTop(); |
widget_->Show(); |
@@ -244,6 +275,7 @@ class DebugWidget { |
views::Widget* widget_; |
scoped_ptr<PowerStatus> power_status_; |
scoped_ptr<NetworkStatus> network_status_; |
+ scoped_ptr<ui::EventHandler> event_handler_; |
DISALLOW_COPY_AND_ASSIGN(DebugWidget); |
}; |