OLD | NEW |
| (Empty) |
1 // Copyright 2014 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. | |
4 | |
5 #include "ui/ozone/common/window/platform_window_compat.h" | |
6 | |
7 #include "ui/events/event.h" | |
8 #include "ui/events/platform/platform_event_source.h" | |
9 #include "ui/ozone/public/cursor_factory_ozone.h" | |
10 #include "ui/ozone/public/event_factory_ozone.h" | |
11 #include "ui/ozone/public/surface_factory_ozone.h" | |
12 #include "ui/platform_window/platform_window_delegate.h" | |
13 | |
14 namespace ui { | |
15 | |
16 PlatformWindowCompat::PlatformWindowCompat(PlatformWindowDelegate* delegate, | |
17 const gfx::Rect& bounds) | |
18 : delegate_(delegate), bounds_(bounds) { | |
19 widget_ = SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(); | |
20 delegate_->OnAcceleratedWidgetAvailable(widget_); | |
21 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | |
22 } | |
23 | |
24 PlatformWindowCompat::~PlatformWindowCompat() { | |
25 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | |
26 } | |
27 | |
28 bool PlatformWindowCompat::CanDispatchEvent(const ui::PlatformEvent& ne) { | |
29 CHECK(ne); | |
30 ui::Event* event = static_cast<ui::Event*>(ne); | |
31 if (event->IsMouseEvent() || event->IsScrollEvent()) | |
32 return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_; | |
33 | |
34 return true; | |
35 } | |
36 | |
37 uint32_t PlatformWindowCompat::DispatchEvent(const ui::PlatformEvent& ne) { | |
38 ui::Event* event = static_cast<ui::Event*>(ne); | |
39 delegate_->DispatchEvent(event); | |
40 return ui::POST_DISPATCH_STOP_PROPAGATION; | |
41 } | |
42 | |
43 gfx::Rect PlatformWindowCompat::GetBounds() { | |
44 return bounds_; | |
45 } | |
46 | |
47 void PlatformWindowCompat::SetBounds(const gfx::Rect& bounds) { | |
48 bounds_ = bounds; | |
49 delegate_->OnBoundsChanged(bounds); | |
50 } | |
51 | |
52 void PlatformWindowCompat::Show() { | |
53 } | |
54 | |
55 void PlatformWindowCompat::Hide() { | |
56 } | |
57 | |
58 void PlatformWindowCompat::Close() { | |
59 } | |
60 | |
61 void PlatformWindowCompat::SetCapture() { | |
62 } | |
63 | |
64 void PlatformWindowCompat::ReleaseCapture() { | |
65 } | |
66 | |
67 void PlatformWindowCompat::ToggleFullscreen() { | |
68 } | |
69 | |
70 void PlatformWindowCompat::Maximize() { | |
71 } | |
72 | |
73 void PlatformWindowCompat::Minimize() { | |
74 } | |
75 | |
76 void PlatformWindowCompat::Restore() { | |
77 } | |
78 | |
79 } // namespace ui | |
OLD | NEW |