Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: ui/aura/window.cc

Issue 602043006: aura: Move Window::ContainsMouse() implementation into the test API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 if (layer_name.empty()) 1436 if (layer_name.empty())
1437 layer_name = "Unnamed Window"; 1437 layer_name = "Unnamed Window";
1438 1438
1439 if (id_ != -1) 1439 if (id_ != -1)
1440 layer_name += " " + base::IntToString(id_); 1440 layer_name += " " + base::IntToString(id_);
1441 1441
1442 layer()->set_name(layer_name); 1442 layer()->set_name(layer_name);
1443 #endif 1443 #endif
1444 } 1444 }
1445 1445
1446 bool Window::ContainsMouse() {
1447 bool contains_mouse = false;
1448 if (IsVisible()) {
1449 WindowTreeHost* host = GetHost();
1450 contains_mouse = host &&
1451 ContainsPointInRoot(host->dispatcher()->GetLastMouseLocationInRoot());
1452 }
1453 return contains_mouse;
1454 }
1455
1456 const Window* Window::GetAncestorWithLayer(gfx::Vector2d* offset) const { 1446 const Window* Window::GetAncestorWithLayer(gfx::Vector2d* offset) const {
1457 for (const aura::Window* window = this; window; window = window->parent()) { 1447 for (const aura::Window* window = this; window; window = window->parent()) {
1458 if (window->layer()) 1448 if (window->layer())
1459 return window; 1449 return window;
1460 if (offset) 1450 if (offset)
1461 *offset += window->bounds().OffsetFromOrigin(); 1451 *offset += window->bounds().OffsetFromOrigin();
1462 } 1452 }
1463 if (offset) 1453 if (offset)
1464 *offset = gfx::Vector2d(); 1454 *offset = gfx::Vector2d();
1465 return NULL; 1455 return NULL;
1466 } 1456 }
1467 1457
1468 } // namespace aura 1458 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698