summaryrefslogtreecommitdiffstats
path: root/ui/aura/test/window_test_api.cc
blob: 86b3370b1126ddfa27973e22af16987e7f574f8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/aura/test/window_test_api.h"

#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"

namespace aura {
namespace test {

WindowTestApi::WindowTestApi(Window* window) : window_(window) {
}

bool WindowTestApi::OwnsLayer() const {
  return window_->OwnsLayer();
}

bool WindowTestApi::ContainsMouse() const {
  if (!window_->IsVisible())
    return false;
  WindowTreeHost* host = window_->GetHost();
  return host &&
         window_->ContainsPointInRoot(
             host->dispatcher()->GetLastMouseLocationInRoot());
}

}  // namespace test
}  // namespace aura