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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// Copyright 2015 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_VIEWS_MUS_PLATFORM_WINDOW_MUS_H_
#define UI_VIEWS_MUS_PLATFORM_WINDOW_MUS_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/macros.h"
#include "components/mus/public/cpp/input_event_handler.h"
#include "components/mus/public/cpp/window_observer.h"
#include "ui/platform_window/platform_window.h"
#include "ui/views/mus/mus_export.h"
namespace bitmap_uploader {
class BitmapUploader;
}
namespace mojo {
class Connector;
}
namespace ui {
class ViewProp;
}
namespace views {
class VIEWS_MUS_EXPORT PlatformWindowMus
: public NON_EXPORTED_BASE(ui::PlatformWindow),
public mus::WindowObserver,
public NON_EXPORTED_BASE(mus::InputEventHandler) {
public:
PlatformWindowMus(ui::PlatformWindowDelegate* delegate,
mojo::Connector* connector,
mus::Window* mus_window);
~PlatformWindowMus() override;
void Activate();
void SetCursorById(mus::mojom::Cursor cursor);
// ui::PlatformWindow:
void Show() override;
void Hide() override;
void Close() override;
void SetBounds(const gfx::Rect& bounds) override;
gfx::Rect GetBounds() override;
void SetTitle(const base::string16& title) override;
void SetCapture() override;
void ReleaseCapture() override;
void ToggleFullscreen() override;
void Maximize() override;
void Minimize() override;
void Restore() override;
void SetCursor(ui::PlatformCursor cursor) override;
void MoveCursorTo(const gfx::Point& location) override;
void ConfineCursorToBounds(const gfx::Rect& bounds) override;
ui::PlatformImeController* GetPlatformImeController() override;
private:
void SetShowState(mus::mojom::ShowState show_state);
// mus::WindowObserver:
void OnWindowDestroyed(mus::Window* window) override;
void OnWindowBoundsChanged(mus::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
void OnWindowFocusChanged(mus::Window* gained_focus,
mus::Window* lost_focus) override;
void OnWindowPredefinedCursorChanged(mus::Window* window,
mus::mojom::Cursor cursor) override;
void OnWindowSharedPropertyChanged(
mus::Window* window,
const std::string& name,
const std::vector<uint8_t>* old_data,
const std::vector<uint8_t>* new_data) override;
void OnRequestClose(mus::Window* window) override;
// mus::InputEventHandler:
void OnWindowInputEvent(
mus::Window* view,
mus::mojom::EventPtr event,
scoped_ptr<base::Callback<void(bool)>>* ack_callback) override;
ui::PlatformWindowDelegate* delegate_;
mus::Window* mus_window_;
mus::mojom::ShowState show_state_;
mus::mojom::Cursor last_cursor_;
// True if OnWindowDestroyed() has been received.
bool mus_window_destroyed_;
scoped_ptr<bitmap_uploader::BitmapUploader> bitmap_uploader_;
scoped_ptr<ui::ViewProp> prop_;
#ifndef NDEBUG
scoped_ptr<base::WeakPtrFactory<PlatformWindowMus>> weak_factory_;
#endif
DISALLOW_COPY_AND_ASSIGN(PlatformWindowMus);
};
} // namespace views
#endif // UI_VIEWS_MUS_PLATFORM_WINDOW_MUS_H_
|