Chromium Code Reviews| Index: ui/views/mus/window_tree_host_mus.cc |
| diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc |
| index e360eb05b46ba0ed6769758e0e49a248ecd6b3d9..e07179736c92d02a6b43d291f30c84fb29cb808b 100644 |
| --- a/ui/views/mus/window_tree_host_mus.cc |
| +++ b/ui/views/mus/window_tree_host_mus.cc |
| @@ -5,15 +5,22 @@ |
| #include "ui/views/mus/window_tree_host_mus.h" |
| #include "base/memory/ptr_util.h" |
| +#include "components/bitmap_uploader/bitmap_uploader.h" |
| +#include "components/mus/public/cpp/window.h" |
| #include "ui/aura/window.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| +#include "ui/base/view_prop.h" |
| #include "ui/events/event.h" |
| +#include "ui/platform_window/stub/stub_window.h" |
| #include "ui/views/mus/input_method_mus.h" |
| #include "ui/views/mus/native_widget_mus.h" |
| -#include "ui/views/mus/platform_window_mus.h" |
| namespace views { |
| +namespace { |
| +static uint32_t accelerated_widget_count = 1; |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // WindowTreeHostMus, public: |
| @@ -21,8 +28,33 @@ WindowTreeHostMus::WindowTreeHostMus(shell::Connector* connector, |
| NativeWidgetMus* native_widget, |
| mus::Window* window) |
| : native_widget_(native_widget) { |
| - SetPlatformWindow( |
| - base::WrapUnique(new PlatformWindowMus(this, connector, window))); |
| + // We need accelerated widget numbers to be different for each |
| + // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t |
| + // has this property. |
| +#if defined(OS_WIN) || defined(OS_ANDROID) |
| + gfx::AcceleratedWidget accelerated_widget = |
| + reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| +#else |
| + gfx::AcceleratedWidget accelerated_widget = |
| + static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| +#endif |
| + OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); |
|
sadrul
2016/05/30 14:42:11
Add a TODO here to find the correct device-scale-f
sadrul
2016/05/30 14:42:11
Since we are doing OnAcceleratedWidgetAvailable()
Mark Dittmer
2016/05/30 15:24:28
Done.
Mark Dittmer
2016/05/30 15:24:28
Done.
|
| + |
| + // If no connector was passed, then it's entirely possible that mojo has not |
| + // been initialized and BitmapUploader will not work. This occurs, for |
| + // example, in some unit test contexts. |
| + if (connector) { |
| + bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); |
| + bitmap_uploader_->Init(connector); |
| + prop_.reset(new ui::ViewProp( |
| + accelerated_widget, |
| + bitmap_uploader::kBitmapUploaderForAcceleratedWidget, |
| + bitmap_uploader_.get())); |
| + } |
| + |
| + SetPlatformWindow(base::WrapUnique( |
| + new ui::StubWindow(nullptr, accelerated_widget))); |
| + |
| // The location of events is already transformed, and there is no way to |
| // correctly determine the reverse transform. So, don't attempt to transform |
| // event locations, else the root location is wrong. |
| @@ -39,11 +71,6 @@ WindowTreeHostMus::~WindowTreeHostMus() { |
| DestroyDispatcher(); |
| } |
| -PlatformWindowMus* WindowTreeHostMus::platform_window() { |
| - return static_cast<PlatformWindowMus*>( |
| - WindowTreeHostPlatform::platform_window()); |
| -} |
| - |
| void WindowTreeHostMus::DispatchEvent(ui::Event* event) { |
| if (event->IsKeyEvent() && GetInputMethod()) { |
| GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent()); |