| 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/platform_window/stub/stub_window.h" | 13 #include "ui/platform_window/stub/stub_window.h" |
| 14 #include "ui/views/mus/input_method_mus.h" | 14 #include "ui/views/mus/input_method_mus.h" |
| 15 #include "ui/views/mus/native_widget_mus.h" | 15 #include "ui/views/mus/native_widget_mus.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 static uint32_t accelerated_widget_count = 1; | 20 static uint32_t accelerated_widget_count = 1; |
| 21 | 21 |
| 22 bool IsUsingTestContext() { | 22 bool IsUsingTestContext() { |
| 23 return aura::Env::GetInstance()->context_factory()->DoesCreateTestContexts(); | 23 return aura::Env::GetInstance()->context_factory()->DoesCreateTestContexts(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 } | 26 } // namespace |
| 27 | 27 |
| 28 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
| 29 // WindowTreeHostMus, public: | 29 // WindowTreeHostMus, public: |
| 30 | 30 |
| 31 WindowTreeHostMus::WindowTreeHostMus(NativeWidgetMus* native_widget, | 31 WindowTreeHostMus::WindowTreeHostMus(NativeWidgetMus* native_widget, |
| 32 ui::Window* window) | 32 ui::Window* window) |
| 33 : native_widget_(native_widget) { | 33 : native_widget_(native_widget) { |
| 34 CreateCompositor(); |
| 34 gfx::AcceleratedWidget accelerated_widget; | 35 gfx::AcceleratedWidget accelerated_widget; |
| 35 if (IsUsingTestContext()) { | 36 if (IsUsingTestContext()) { |
| 36 accelerated_widget = gfx::kNullAcceleratedWidget; | 37 accelerated_widget = gfx::kNullAcceleratedWidget; |
| 37 } else { | 38 } else { |
| 38 // We need accelerated widget numbers to be different for each | 39 // We need accelerated widget numbers to be different for each |
| 39 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t | 40 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t |
| 40 // has this property. | 41 // has this property. |
| 41 #if defined(OS_WIN) || defined(OS_ANDROID) | 42 #if defined(OS_WIN) || defined(OS_ANDROID) |
| 42 accelerated_widget = | 43 accelerated_widget = |
| 43 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | 44 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void WindowTreeHostMus::OnCloseRequest() { | 91 void WindowTreeHostMus::OnCloseRequest() { |
| 91 OnHostCloseRequested(); | 92 OnHostCloseRequested(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { | 95 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { |
| 95 // TODO: This should read the profile from mus. crbug.com/647510 | 96 // TODO: This should read the profile from mus. crbug.com/647510 |
| 96 return gfx::ICCProfile(); | 97 return gfx::ICCProfile(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace views | 100 } // namespace views |
| OLD | NEW |