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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 DCHECK(root_window); | 629 DCHECK(root_window); |
630 gfx::Point point_in_root(point_in_window); | 630 gfx::Point point_in_root(point_in_window); |
631 ConvertPointToTarget(this, root_window, &point_in_root); | 631 ConvertPointToTarget(this, root_window, &point_in_root); |
632 root_window->GetHost()->MoveCursorTo(point_in_root); | 632 root_window->GetHost()->MoveCursorTo(point_in_root); |
633 } | 633 } |
634 | 634 |
635 gfx::NativeCursor Window::GetCursor(const gfx::Point& point) const { | 635 gfx::NativeCursor Window::GetCursor(const gfx::Point& point) const { |
636 return delegate_ ? delegate_->GetCursor(point) : gfx::kNullCursor; | 636 return delegate_ ? delegate_->GetCursor(point) : gfx::kNullCursor; |
637 } | 637 } |
638 | 638 |
639 void Window::SetEventFilter(ui::EventHandler* event_filter) { | |
640 if (event_filter_) | |
641 RemovePreTargetHandler(event_filter_.get()); | |
642 event_filter_.reset(event_filter); | |
643 if (event_filter) | |
644 AddPreTargetHandler(event_filter); | |
645 } | |
646 | |
647 void Window::AddObserver(WindowObserver* observer) { | 639 void Window::AddObserver(WindowObserver* observer) { |
648 observers_.AddObserver(observer); | 640 observers_.AddObserver(observer); |
649 } | 641 } |
650 | 642 |
651 void Window::RemoveObserver(WindowObserver* observer) { | 643 void Window::RemoveObserver(WindowObserver* observer) { |
652 observers_.RemoveObserver(observer); | 644 observers_.RemoveObserver(observer); |
653 } | 645 } |
654 | 646 |
655 bool Window::HasObserver(WindowObserver* observer) { | 647 bool Window::HasObserver(WindowObserver* observer) { |
656 return observers_.HasObserver(observer); | 648 return observers_.HasObserver(observer); |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 return window; | 1429 return window; |
1438 if (offset) | 1430 if (offset) |
1439 *offset += window->bounds().OffsetFromOrigin(); | 1431 *offset += window->bounds().OffsetFromOrigin(); |
1440 } | 1432 } |
1441 if (offset) | 1433 if (offset) |
1442 *offset = gfx::Vector2d(); | 1434 *offset = gfx::Vector2d(); |
1443 return NULL; | 1435 return NULL; |
1444 } | 1436 } |
1445 | 1437 |
1446 } // namespace aura | 1438 } // namespace aura |
OLD | NEW |