Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / mandoline / ui / aura / window_tree_host_mojo.h
blob77f4bf0c64891b0dcb9f4a1ecbc5d958deb592d0
1 // Copyright 2015 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 MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_
6 #define MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_
8 #include "base/macros.h"
9 #include "components/view_manager/public/cpp/view_observer.h"
10 #include "ui/aura/window_tree_host.h"
11 #include "ui/events/event_source.h"
12 #include "ui/gfx/geometry/rect.h"
14 class SkBitmap;
16 namespace ui {
17 class Compositor;
20 namespace mojo {
21 class Shell;
24 namespace mandoline {
26 class InputMethodMandoline;
27 class SurfaceContextFactory;
29 class WindowTreeHostMojo : public aura::WindowTreeHost,
30 public mojo::ViewObserver {
31 public:
32 WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view);
33 ~WindowTreeHostMojo() override;
35 const gfx::Rect& bounds() const { return bounds_; }
37 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) {
38 return ui::EventSource::SendEventToProcessor(event);
41 private:
42 // WindowTreeHost:
43 ui::EventSource* GetEventSource() override;
44 gfx::AcceleratedWidget GetAcceleratedWidget() override;
45 void ShowImpl() override;
46 void HideImpl() override;
47 gfx::Rect GetBounds() const override;
48 void SetBounds(const gfx::Rect& bounds) override;
49 gfx::Point GetLocationOnNativeScreen() const override;
50 void SetCapture() override;
51 void ReleaseCapture() override;
52 void SetCursorNative(gfx::NativeCursor cursor) override;
53 void MoveCursorToNative(const gfx::Point& location) override;
54 void OnCursorVisibilityChangedNative(bool show) override;
56 // mojo::ViewObserver:
57 void OnViewBoundsChanged(mojo::View* view,
58 const mojo::Rect& old_bounds,
59 const mojo::Rect& new_bounds) override;
61 mojo::View* view_;
63 gfx::Rect bounds_;
65 scoped_ptr<InputMethodMandoline> input_method_;
67 scoped_ptr<SurfaceContextFactory> context_factory_;
69 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
72 } // namespace mandoline
74 #endif // MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_