summaryrefslogtreecommitdiffstats
path: root/ui/aura/root_window_host.h
blob: 1c7756500d9cda0f294a4bd5ad934f44ce0e3e58 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2011 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.

#ifndef UI_AURA_ROOT_WINDOW_HOST_H_
#define UI_AURA_ROOT_WINDOW_HOST_H_
#pragma once

#include "base/message_loop.h"
#include "ui/aura/cursor.h"
#include "ui/gfx/native_widget_types.h"

namespace gfx {
class Point;
class Rect;
class Size;
}

namespace aura {

class RootWindow;

// RootWindowHost bridges between a native window and the embedded RootWindow.
// It provides the accelerated widget and maps events from the native os to
// aura.
class RootWindowHost : public MessageLoop::Dispatcher {
 public:
  virtual ~RootWindowHost() {}

  // Creates a new RootWindowHost. The caller owns the returned value.
  static RootWindowHost* Create(const gfx::Rect& bounds);

  // Returns the actual size of the screen.
  // (gfx::Screen only reports on the virtual desktop exposed by Aura.)
  static gfx::Size GetNativeScreenSize();

  // Sets the RootWindow this RootWindowHost is hosting. RootWindowHost does not
  // own the RootWindow.
  virtual void SetRootWindow(RootWindow* root_window) = 0;

  // Returns the accelerated widget.
  virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;

  // Shows the RootWindowHost.
  virtual void Show() = 0;

  // Toggles the host's full screen state.
  virtual void ToggleFullScreen() = 0;

  // Gets/Sets the size of the RootWindowHost.
  virtual gfx::Size GetSize() const = 0;
  virtual void SetSize(const gfx::Size& size) = 0;

  // Returns the location of the RootWindow on native screen.
  virtual gfx::Point GetLocationOnNativeScreen() const = 0;

  // Sets the currently displayed cursor. Shows the cursor by default.
  // If you want to update hidden cursor, should call ShowCursor(false)
  // after this function.
  virtual void SetCursor(gfx::NativeCursor cursor) = 0;

  // Sets current cursor visibility to |show|.
  virtual void ShowCursor(bool show) = 0;

  // Queries the mouse's current position relative to the host window.
  // The position is constrained within the host window.
  // You should probably call RootWindow::last_mouse_location() instead; this
  // method can be expensive.
  virtual gfx::Point QueryMouseLocation() = 0;

  // Posts |native_event| to the platform's event queue.
  virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0;
};

}  // namespace aura

#endif  // UI_AURA_ROOT_WINDOW_HOST_H_