| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/views/mus/window_tree_host_mus.h" | 5 #include "ui/views/mus/window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "services/ui/public/cpp/window.h" | 8 #include "services/ui/public/cpp/window.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/aura/window_event_dispatcher.h" | 11 #include "ui/aura/window_event_dispatcher.h" |
| 12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
| 13 #include "ui/gfx/geometry/dip_util.h" |
| 13 #include "ui/platform_window/stub/stub_window.h" | 14 #include "ui/platform_window/stub/stub_window.h" |
| 14 #include "ui/views/mus/input_method_mus.h" | 15 #include "ui/views/mus/input_method_mus.h" |
| 15 #include "ui/views/mus/native_widget_mus.h" | 16 #include "ui/views/mus/native_widget_mus.h" |
| 16 | 17 |
| 17 namespace views { | 18 namespace views { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 static uint32_t accelerated_widget_count = 1; | 21 static uint32_t accelerated_widget_count = 1; |
| 21 | 22 |
| 22 bool IsUsingTestContext() { | 23 bool IsUsingTestContext() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 // TODO(markdittmer): Use correct device-scale-factor from |window|. | 51 // TODO(markdittmer): Use correct device-scale-factor from |window|. |
| 51 OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); | 52 OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); |
| 52 | 53 |
| 53 SetPlatformWindow(base::MakeUnique<ui::StubWindow>( | 54 SetPlatformWindow(base::MakeUnique<ui::StubWindow>( |
| 54 this, | 55 this, |
| 55 false)); // Do not advertise accelerated widget; already set manually. | 56 false)); // Do not advertise accelerated widget; already set manually. |
| 56 | 57 |
| 57 compositor()->SetWindow(window); | 58 compositor()->SetWindow(window); |
| 58 | 59 |
| 59 // Initialize the stub platform window bounds to those of the ui::Window. | 60 // Initialize the stub platform window bounds to those of the ui::Window. |
| 60 platform_window()->SetBounds(window->bounds()); | 61 platform_window()->SetBounds(gfx::ConvertRectToPixel( |
| 62 compositor()->device_scale_factor(), window->bounds())); |
| 61 | 63 |
| 62 compositor()->SetHostHasTransparentBackground(true); | 64 compositor()->SetHostHasTransparentBackground(true); |
| 63 } | 65 } |
| 64 | 66 |
| 65 WindowTreeHostMus::~WindowTreeHostMus() { | 67 WindowTreeHostMus::~WindowTreeHostMus() { |
| 66 DestroyCompositor(); | 68 DestroyCompositor(); |
| 67 DestroyDispatcher(); | 69 DestroyDispatcher(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { | 72 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 91 void WindowTreeHostMus::OnCloseRequest() { | 93 void WindowTreeHostMus::OnCloseRequest() { |
| 92 OnHostCloseRequested(); | 94 OnHostCloseRequested(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { | 97 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { |
| 96 // TODO: This should read the profile from mus. crbug.com/647510 | 98 // TODO: This should read the profile from mus. crbug.com/647510 |
| 97 return gfx::ICCProfile(); | 99 return gfx::ICCProfile(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 } // namespace views | 102 } // namespace views |
| OLD | NEW |