| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "ui/views/mus/platform_window_mus.h" | |
| 6 | |
| 7 #include "build/build_config.h" | |
| 8 #include "components/bitmap_uploader/bitmap_uploader.h" | |
| 9 #include "components/mus/public/cpp/property_type_converters.h" | |
| 10 #include "components/mus/public/cpp/window_property.h" | |
| 11 #include "components/mus/public/interfaces/window_manager.mojom.h" | |
| 12 #include "mojo/converters/input_events/input_events_type_converters.h" | |
| 13 #include "ui/base/view_prop.h" | |
| 14 #include "ui/platform_window/platform_window_delegate.h" | |
| 15 #include "ui/views/mus/window_manager_connection.h" | |
| 16 | |
| 17 using mus::mojom::EventResult; | |
| 18 | |
| 19 namespace views { | |
| 20 | |
| 21 namespace { | |
| 22 | |
| 23 static uint32_t accelerated_widget_count = 1; | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 27 PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, | |
| 28 shell::Connector* connector, | |
| 29 mus::Window* mus_window) | |
| 30 : delegate_(delegate), | |
| 31 mus_window_(mus_window), | |
| 32 mus_window_destroyed_(false) { | |
| 33 DCHECK(delegate_); | |
| 34 DCHECK(mus_window_); | |
| 35 | |
| 36 // We need accelerated widget numbers to be different for each | |
| 37 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t | |
| 38 // has this property. | |
| 39 #if defined(OS_WIN) || defined(OS_ANDROID) | |
| 40 gfx::AcceleratedWidget accelerated_widget = | |
| 41 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | |
| 42 #else | |
| 43 gfx::AcceleratedWidget accelerated_widget = | |
| 44 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | |
| 45 #endif | |
| 46 delegate_->OnAcceleratedWidgetAvailable( | |
| 47 accelerated_widget, mus_window_->viewport_metrics().device_pixel_ratio); | |
| 48 | |
| 49 if (connector) { | |
| 50 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(mus_window_)); | |
| 51 bitmap_uploader_->Init(connector); | |
| 52 prop_.reset( | |
| 53 new ui::ViewProp(accelerated_widget, | |
| 54 bitmap_uploader::kBitmapUploaderForAcceleratedWidget, | |
| 55 bitmap_uploader_.get())); | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 PlatformWindowMus::~PlatformWindowMus() {} | |
| 60 | |
| 61 void PlatformWindowMus::Show() {} | |
| 62 | |
| 63 void PlatformWindowMus::Hide() {} | |
| 64 | |
| 65 void PlatformWindowMus::Close() { | |
| 66 NOTIMPLEMENTED(); | |
| 67 } | |
| 68 | |
| 69 void PlatformWindowMus::SetBounds(const gfx::Rect& bounds) {} | |
| 70 | |
| 71 gfx::Rect PlatformWindowMus::GetBounds() { | |
| 72 return mus_window_->bounds(); | |
| 73 } | |
| 74 | |
| 75 void PlatformWindowMus::SetTitle(const base::string16& title) { | |
| 76 NOTIMPLEMENTED(); | |
| 77 } | |
| 78 | |
| 79 void PlatformWindowMus::SetCapture() {} | |
| 80 | |
| 81 void PlatformWindowMus::ReleaseCapture() {} | |
| 82 | |
| 83 void PlatformWindowMus::ToggleFullscreen() { | |
| 84 NOTIMPLEMENTED(); | |
| 85 } | |
| 86 | |
| 87 void PlatformWindowMus::Maximize() {} | |
| 88 | |
| 89 void PlatformWindowMus::Minimize() {} | |
| 90 | |
| 91 void PlatformWindowMus::Restore() {} | |
| 92 | |
| 93 void PlatformWindowMus::SetCursor(ui::PlatformCursor cursor) { | |
| 94 NOTIMPLEMENTED(); | |
| 95 } | |
| 96 | |
| 97 void PlatformWindowMus::MoveCursorTo(const gfx::Point& location) { | |
| 98 NOTIMPLEMENTED(); | |
| 99 } | |
| 100 | |
| 101 void PlatformWindowMus::ConfineCursorToBounds(const gfx::Rect& bounds) { | |
| 102 NOTIMPLEMENTED(); | |
| 103 } | |
| 104 | |
| 105 ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() { | |
| 106 return nullptr; | |
| 107 } | |
| 108 | |
| 109 } // namespace views | |
| OLD | NEW |