window_tree_host.cc revision f2477e01787aa58f445919b809d89e252beef54f
1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ui/aura/window_tree_host.h"
6
7#include "ui/aura/root_window.h"
8#include "ui/aura/window_tree_host_delegate.h"
9#include "ui/gfx/point.h"
10
11namespace aura {
12
13////////////////////////////////////////////////////////////////////////////////
14// RootWindowHost, public:
15
16RootWindowHost::~RootWindowHost() {
17}
18
19void RootWindowHost::ConvertPointToNativeScreen(gfx::Point* point) const {
20  delegate_->AsRootWindow()->ConvertPointToHost(point);
21  gfx::Point location = GetLocationOnNativeScreen();
22  point->Offset(location.x(), location.y());
23}
24
25void RootWindowHost::ConvertPointFromNativeScreen(gfx::Point* point) const {
26  gfx::Point location = GetLocationOnNativeScreen();
27  point->Offset(-location.x(), -location.y());
28  delegate_->AsRootWindow()->ConvertPointFromHost(point);
29}
30
31////////////////////////////////////////////////////////////////////////////////
32// RootWindowHost, protected:
33
34RootWindowHost::RootWindowHost()
35    : delegate_(NULL) {
36}
37
38
39}  // namespace aura
40