Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / mojo / services / view_manager / window_tree_host_impl.h
blobb222d683e6506394ed5bf58d55cdbf1ea9cf2297
1 // Copyright 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.
5 #ifndef MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_
6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_
8 #include "base/bind.h"
9 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
11 #include "ui/aura/window_tree_host.h"
12 #include "ui/events/event_source.h"
13 #include "ui/gfx/rect.h"
15 namespace ui {
16 class ContextFactory;
19 namespace mojo {
20 namespace service {
22 class ContextFactoryImpl;
24 class WindowTreeHostImpl : public aura::WindowTreeHost,
25 public ui::EventSource,
26 public NativeViewportClient {
27 public:
28 WindowTreeHostImpl(NativeViewportPtr viewport,
29 GpuPtr gpu_service,
30 const gfx::Rect& bounds,
31 const Callback<void()>& compositor_created_callback,
32 const Callback<void()>& native_viewport_closed_callback,
33 const Callback<void(EventPtr)>& event_received_callback);
34 virtual ~WindowTreeHostImpl();
36 gfx::Rect bounds() const { return bounds_; }
38 private:
39 // WindowTreeHost:
40 virtual ui::EventSource* GetEventSource() OVERRIDE;
41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
42 virtual void Show() OVERRIDE;
43 virtual void Hide() OVERRIDE;
44 virtual gfx::Rect GetBounds() const OVERRIDE;
45 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
46 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
47 virtual void SetCapture() OVERRIDE;
48 virtual void ReleaseCapture() OVERRIDE;
49 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
50 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
51 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
52 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
54 // ui::EventSource:
55 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
57 // Overridden from NativeViewportClient:
58 virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE;
59 virtual void OnDestroyed() OVERRIDE;
60 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE;
61 virtual void OnEvent(EventPtr event,
62 const mojo::Callback<void()>& callback) OVERRIDE;
64 static ContextFactoryImpl* context_factory_;
66 NativeViewportPtr native_viewport_;
67 GpuPtr gpu_service_;
68 gfx::AcceleratedWidget widget_;
69 Callback<void()> compositor_created_callback_;
70 Callback<void()> native_viewport_closed_callback_;
71 Callback<void(EventPtr)> event_received_callback_;
73 gfx::Rect bounds_;
75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl);
78 } // namespace service
79 } // namespace mojo
81 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_