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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 472 } |
473 | 473 |
474 void Window::AddObserver(WindowObserver* observer) { | 474 void Window::AddObserver(WindowObserver* observer) { |
475 observers_.AddObserver(observer); | 475 observers_.AddObserver(observer); |
476 } | 476 } |
477 | 477 |
478 void Window::RemoveObserver(WindowObserver* observer) { | 478 void Window::RemoveObserver(WindowObserver* observer) { |
479 observers_.RemoveObserver(observer); | 479 observers_.RemoveObserver(observer); |
480 } | 480 } |
481 | 481 |
482 bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) { | 482 bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) const { |
483 Window* root_window = GetRootWindow(); | 483 const Window* root_window = GetRootWindow(); |
484 if (!root_window) | 484 if (!root_window) |
485 return false; | 485 return false; |
486 gfx::Point local_point(point_in_root); | 486 gfx::Point local_point(point_in_root); |
487 ConvertPointToWindow(root_window, this, &local_point); | 487 ConvertPointToWindow(root_window, this, &local_point); |
488 return gfx::Rect(GetTargetBounds().size()).Contains(local_point); | 488 return gfx::Rect(GetTargetBounds().size()).Contains(local_point); |
489 } | 489 } |
490 | 490 |
491 bool Window::ContainsPoint(const gfx::Point& local_point) { | 491 bool Window::ContainsPoint(const gfx::Point& local_point) const { |
492 return gfx::Rect(bounds().size()).Contains(local_point); | 492 return gfx::Rect(bounds().size()).Contains(local_point); |
493 } | 493 } |
494 | 494 |
495 bool Window::HitTest(const gfx::Point& local_point) { | 495 bool Window::HitTest(const gfx::Point& local_point) { |
496 // Expand my bounds for hit testing (override is usually zero but it's | 496 // Expand my bounds for hit testing (override is usually zero but it's |
497 // probably cheaper to do the math every time than to branch). | 497 // probably cheaper to do the math every time than to branch). |
498 gfx::Rect local_bounds(gfx::Point(), bounds().size()); | 498 gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
499 local_bounds.Inset(hit_test_bounds_override_outer_); | 499 local_bounds.Inset(hit_test_bounds_override_outer_); |
500 | 500 |
501 if (!delegate_ || !delegate_->HasHitTestMask()) | 501 if (!delegate_ || !delegate_->HasHitTestMask()) |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 for (Windows::const_reverse_iterator it = children_.rbegin(), | 942 for (Windows::const_reverse_iterator it = children_.rbegin(), |
943 rend = children_.rend(); | 943 rend = children_.rend(); |
944 it != rend; ++it) { | 944 it != rend; ++it) { |
945 Window* child = *it; | 945 Window* child = *it; |
946 child->PrintWindowHierarchy(depth + 1); | 946 child->PrintWindowHierarchy(depth + 1); |
947 } | 947 } |
948 } | 948 } |
949 #endif | 949 #endif |
950 | 950 |
951 } // namespace aura | 951 } // namespace aura |
OLD | NEW |