OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/dri/dri_window.h" | 5 #include "ui/ozone/platform/dri/dri_window.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 8 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
9 #include "ui/events/platform/platform_event_source.h" | 9 #include "ui/events/platform/platform_event_source.h" |
10 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 10 #include "ui/ozone/platform/dri/dri_window_delegate.h" |
11 #include "ui/ozone/public/cursor_factory_ozone.h" | 11 #include "ui/ozone/public/cursor_factory_ozone.h" |
12 #include "ui/ozone/public/surface_factory_ozone.h" | |
13 #include "ui/platform_window/platform_window_delegate.h" | 12 #include "ui/platform_window/platform_window_delegate.h" |
14 | 13 |
15 namespace ui { | 14 namespace ui { |
16 | 15 |
17 DriWindow::DriWindow(PlatformWindowDelegate* delegate, | 16 DriWindow::DriWindow(PlatformWindowDelegate* delegate, |
18 const gfx::Rect& bounds, | 17 const gfx::Rect& bounds, |
19 DriSurfaceFactory* surface_factory, | 18 scoped_ptr<DriWindowDelegate> dri_window_delegate, |
20 EventFactoryEvdev* event_factory) | 19 EventFactoryEvdev* event_factory) |
21 : delegate_(delegate), bounds_(bounds), event_factory_(event_factory) { | 20 : delegate_(delegate), |
22 widget_ = surface_factory->GetAcceleratedWidget(); | 21 bounds_(bounds), |
22 widget_(dri_window_delegate->GetAcceleratedWidget()), | |
23 dri_window_delegate_(dri_window_delegate.Pass()), | |
24 event_factory_(event_factory) { | |
25 dri_window_delegate_->Initialize(); | |
alexst (slow to review)
2014/08/20 21:51:09
My enemy, constructor workload is back! :)
Can we
dnicoara
2014/08/21 20:54:17
I no longer care and I just want this to go in so
| |
26 dri_window_delegate_->OnBoundsChanged(bounds); | |
23 delegate_->OnAcceleratedWidgetAvailable(widget_); | 27 delegate_->OnAcceleratedWidgetAvailable(widget_); |
24 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 28 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
25 } | 29 } |
26 | 30 |
27 DriWindow::~DriWindow() { | 31 DriWindow::~DriWindow() { |
28 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 32 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
33 dri_window_delegate_->Shutdown(); | |
29 } | 34 } |
30 | 35 |
31 void DriWindow::Show() {} | 36 void DriWindow::Show() {} |
32 | 37 |
33 void DriWindow::Hide() {} | 38 void DriWindow::Hide() {} |
34 | 39 |
35 void DriWindow::Close() {} | 40 void DriWindow::Close() {} |
36 | 41 |
37 void DriWindow::SetBounds(const gfx::Rect& bounds) { | 42 void DriWindow::SetBounds(const gfx::Rect& bounds) { |
38 bounds_ = bounds; | 43 bounds_ = bounds; |
39 delegate_->OnBoundsChanged(bounds); | 44 delegate_->OnBoundsChanged(bounds); |
45 dri_window_delegate_->OnBoundsChanged(bounds); | |
40 } | 46 } |
41 | 47 |
42 gfx::Rect DriWindow::GetBounds() { | 48 gfx::Rect DriWindow::GetBounds() { |
43 return bounds_; | 49 return bounds_; |
44 } | 50 } |
45 | 51 |
46 void DriWindow::SetCapture() {} | 52 void DriWindow::SetCapture() {} |
47 | 53 |
48 void DriWindow::ReleaseCapture() {} | 54 void DriWindow::ReleaseCapture() {} |
49 | 55 |
(...skipping 22 matching lines...) Expand all Loading... | |
72 return true; | 78 return true; |
73 } | 79 } |
74 | 80 |
75 uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) { | 81 uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) { |
76 Event* event = static_cast<Event*>(ne); | 82 Event* event = static_cast<Event*>(ne); |
77 delegate_->DispatchEvent(event); | 83 delegate_->DispatchEvent(event); |
78 return POST_DISPATCH_STOP_PROPAGATION; | 84 return POST_DISPATCH_STOP_PROPAGATION; |
79 } | 85 } |
80 | 86 |
81 } // namespace ui | 87 } // namespace ui |
OLD | NEW |