OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura/event_filter.h" | 5 #include "ui/aura/event_filter.h" |
6 | 6 |
| 7 #include "ui/aura/event.h" |
| 8 #include "ui/aura/focus_manager.h" |
| 9 #include "ui/aura/window.h" |
| 10 |
7 namespace aura { | 11 namespace aura { |
8 | 12 |
9 EventFilter::EventFilter(Window* owner) : owner_(owner) { | 13 EventFilter::EventFilter(Window* owner) : owner_(owner) { |
10 } | 14 } |
11 | 15 |
12 EventFilter::~EventFilter() { | 16 EventFilter::~EventFilter() { |
13 } | 17 } |
14 | 18 |
15 bool EventFilter::OnMouseEvent(Window* target, MouseEvent* event) { | 19 bool EventFilter::OnMouseEvent(Window* target, MouseEvent* event) { |
| 20 if (event->type() == ui::ET_MOUSE_PRESSED) { |
| 21 // TODO(beng): some windows (e.g. disabled ones, tooltips, etc) may not be |
| 22 // focusable. |
| 23 target->GetFocusManager()->SetFocusedWindow(target); |
| 24 } |
16 return false; | 25 return false; |
17 } | 26 } |
18 | 27 |
19 } // namespace aura | 28 } // namespace aura |
OLD | NEW |