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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 void Window::SchedulePaintInRect(const gfx::Rect& rect) { | 485 void Window::SchedulePaintInRect(const gfx::Rect& rect) { |
486 if (!layer() && parent_) { | 486 if (!layer() && parent_) { |
487 // Notification of paint scheduled happens for the window with a layer. | 487 // Notification of paint scheduled happens for the window with a layer. |
488 gfx::Rect parent_rect(bounds().size()); | 488 gfx::Rect parent_rect(bounds().size()); |
489 parent_rect.Intersect(rect); | 489 parent_rect.Intersect(rect); |
490 if (!parent_rect.IsEmpty()) { | 490 if (!parent_rect.IsEmpty()) { |
491 parent_rect.Offset(bounds().origin().OffsetFromOrigin()); | 491 parent_rect.Offset(bounds().origin().OffsetFromOrigin()); |
492 parent_->SchedulePaintInRect(parent_rect); | 492 parent_->SchedulePaintInRect(parent_rect); |
493 } | 493 } |
494 } else if (layer() && layer()->SchedulePaint(rect)) { | 494 } else if (layer()) { |
495 FOR_EACH_OBSERVER( | 495 layer()->SchedulePaint(rect); |
496 WindowObserver, observers_, OnWindowPaintScheduled(this, rect)); | |
497 } | 496 } |
498 } | 497 } |
499 | 498 |
500 void Window::StackChildAtTop(Window* child) { | 499 void Window::StackChildAtTop(Window* child) { |
501 if (children_.size() <= 1 || child == children_.back()) | 500 if (children_.size() <= 1 || child == children_.back()) |
502 return; // In the front already. | 501 return; // In the front already. |
503 StackChildAbove(child, children_.back()); | 502 StackChildAbove(child, children_.back()); |
504 } | 503 } |
505 | 504 |
506 void Window::StackChildAbove(Window* child, Window* target) { | 505 void Window::StackChildAbove(Window* child, Window* target) { |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 ++iter) { | 1348 ++iter) { |
1350 state_modified |= (*iter)->CleanupGestureState(); | 1349 state_modified |= (*iter)->CleanupGestureState(); |
1351 } | 1350 } |
1352 return state_modified; | 1351 return state_modified; |
1353 } | 1352 } |
1354 | 1353 |
1355 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 1354 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
1356 Paint(canvas); | 1355 Paint(canvas); |
1357 } | 1356 } |
1358 | 1357 |
| 1358 void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { |
| 1359 DCHECK(layer()); |
| 1360 FOR_EACH_OBSERVER(WindowObserver, |
| 1361 observers_, |
| 1362 OnDelegatedFrameDamage(this, damage_rect_in_dip)); |
| 1363 } |
| 1364 |
1359 base::Closure Window::PrepareForLayerBoundsChange() { | 1365 base::Closure Window::PrepareForLayerBoundsChange() { |
1360 return base::Bind(&Window::OnWindowBoundsChanged, base::Unretained(this), | 1366 return base::Bind(&Window::OnWindowBoundsChanged, base::Unretained(this), |
1361 bounds()); | 1367 bounds()); |
1362 } | 1368 } |
1363 | 1369 |
1364 bool Window::CanAcceptEvent(const ui::Event& event) { | 1370 bool Window::CanAcceptEvent(const ui::Event& event) { |
1365 // The client may forbid certain windows from receiving events at a given | 1371 // The client may forbid certain windows from receiving events at a given |
1366 // point in time. | 1372 // point in time. |
1367 client::EventClient* client = client::GetEventClient(GetRootWindow()); | 1373 client::EventClient* client = client::GetEventClient(GetRootWindow()); |
1368 if (client && !client->CanProcessEventsWithinSubtree(this)) | 1374 if (client && !client->CanProcessEventsWithinSubtree(this)) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 return window; | 1449 return window; |
1444 if (offset) | 1450 if (offset) |
1445 *offset += window->bounds().OffsetFromOrigin(); | 1451 *offset += window->bounds().OffsetFromOrigin(); |
1446 } | 1452 } |
1447 if (offset) | 1453 if (offset) |
1448 *offset = gfx::Vector2d(); | 1454 *offset = gfx::Vector2d(); |
1449 return NULL; | 1455 return NULL; |
1450 } | 1456 } |
1451 | 1457 |
1452 } // namespace aura | 1458 } // namespace aura |
OLD | NEW |