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