[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / ozone / common / window / platform_window_compat.cc
blob57036800ee7c7c863af9a122d67c7204b643398e
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.
5 #include "ui/ozone/common/window/platform_window_compat.h"
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"
14 namespace ui {
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);
24 PlatformWindowCompat::~PlatformWindowCompat() {
25 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
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_;
34 return true;
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;
43 gfx::Rect PlatformWindowCompat::GetBounds() {
44 return bounds_;
47 void PlatformWindowCompat::SetBounds(const gfx::Rect& bounds) {
48 bounds_ = bounds;
49 delegate_->OnBoundsChanged(bounds);
52 void PlatformWindowCompat::Show() {
55 void PlatformWindowCompat::Hide() {
58 void PlatformWindowCompat::Close() {
61 void PlatformWindowCompat::SetCapture() {
64 void PlatformWindowCompat::ReleaseCapture() {
67 void PlatformWindowCompat::ToggleFullscreen() {
70 void PlatformWindowCompat::Maximize() {
73 void PlatformWindowCompat::Minimize() {
76 void PlatformWindowCompat::Restore() {
79 } // namespace ui