| 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/aura/mus/window_tree_host_mus.h" | 5 #include "ui/aura/mus/window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/mus/input_method_mus.h" | 9 #include "ui/aura/mus/input_method_mus.h" |
| 10 #include "ui/aura/mus/window_port_mus.h" | 10 #include "ui/aura/mus/window_port_mus.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t | 58 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t |
| 59 // has this property. | 59 // has this property. |
| 60 #if defined(OS_WIN) || defined(OS_ANDROID) | 60 #if defined(OS_WIN) || defined(OS_ANDROID) |
| 61 accelerated_widget = | 61 accelerated_widget = |
| 62 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | 62 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| 63 #else | 63 #else |
| 64 accelerated_widget = | 64 accelerated_widget = |
| 65 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | 65 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| 66 #endif | 66 #endif |
| 67 } | 67 } |
| 68 // TODO(markdittmer): Use correct device-scale-factor from |window|. | 68 OnAcceleratedWidgetAvailable(accelerated_widget, |
| 69 OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); | 69 GetDisplay().device_scale_factor()); |
| 70 | 70 |
| 71 delegate_->OnWindowTreeHostCreated(this); | 71 delegate_->OnWindowTreeHostCreated(this); |
| 72 | 72 |
| 73 SetPlatformWindow(base::MakeUnique<ui::StubWindow>( | 73 SetPlatformWindow(base::MakeUnique<ui::StubWindow>( |
| 74 this, | 74 this, |
| 75 false)); // Do not advertise accelerated widget; already set manually. | 75 false)); // Do not advertise accelerated widget; already set manually. |
| 76 | 76 |
| 77 input_method_ = base::MakeUnique<InputMethodMus>(this, window()); | 77 input_method_ = base::MakeUnique<InputMethodMus>(this, window()); |
| 78 input_method_->Init(window_tree_client->connector()); | 78 input_method_->Init(window_tree_client->connector()); |
| 79 SetSharedInputMethod(input_method_.get()); | 79 SetSharedInputMethod(input_method_.get()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 ->CreateWindowPortForTopLevel(properties), | 96 ->CreateWindowPortForTopLevel(properties), |
| 97 window_tree_client, | 97 window_tree_client, |
| 98 display::Screen::GetScreen()->GetPrimaryDisplay().id(), | 98 display::Screen::GetScreen()->GetPrimaryDisplay().id(), |
| 99 properties) {} | 99 properties) {} |
| 100 | 100 |
| 101 WindowTreeHostMus::~WindowTreeHostMus() { | 101 WindowTreeHostMus::~WindowTreeHostMus() { |
| 102 DestroyCompositor(); | 102 DestroyCompositor(); |
| 103 DestroyDispatcher(); | 103 DestroyDispatcher(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WindowTreeHostMus::SetBoundsFromServer(const gfx::Rect& bounds) { | 106 void WindowTreeHostMus::SetBoundsFromServer(const gfx::Rect& bounds_in_pixels) { |
| 107 base::AutoReset<bool> resetter(&in_set_bounds_from_server_, true); | 107 base::AutoReset<bool> resetter(&in_set_bounds_from_server_, true); |
| 108 SetBoundsInPixels(bounds); | 108 SetBoundsInPixels(bounds_in_pixels); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void WindowTreeHostMus::SetClientArea( | 111 void WindowTreeHostMus::SetClientArea( |
| 112 const gfx::Insets& insets, | 112 const gfx::Insets& insets, |
| 113 const std::vector<gfx::Rect>& additional_client_area) { | 113 const std::vector<gfx::Rect>& additional_client_area) { |
| 114 delegate_->OnWindowTreeHostClientAreaWillChange(this, insets, | 114 delegate_->OnWindowTreeHostClientAreaWillChange(this, insets, |
| 115 additional_client_area); | 115 additional_client_area); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void WindowTreeHostMus::SetHitTestMask(const base::Optional<gfx::Rect>& rect) { | 118 void WindowTreeHostMus::SetHitTestMask(const base::Optional<gfx::Rect>& rect) { |
| 119 delegate_->OnWindowTreeHostHitTestMaskWillChange(this, rect); | 119 delegate_->OnWindowTreeHostHitTestMaskWillChange(this, rect); |
| 120 } | 120 } |
| 121 | 121 |
| 122 display::Display WindowTreeHostMus::GetDisplay() const { | 122 display::Display WindowTreeHostMus::GetDisplay() const { |
| 123 for (const display::Display& display : | 123 display::Display display; |
| 124 display::Screen::GetScreen()->GetAllDisplays()) { | 124 display::Screen::GetScreen()->GetDisplayWithDisplayId(display_id_, &display); |
| 125 if (display.id() == display_id_) | 125 return display; |
| 126 return display; | |
| 127 } | |
| 128 return display::Display(); | |
| 129 } | 126 } |
| 130 | 127 |
| 131 void WindowTreeHostMus::HideImpl() { | 128 void WindowTreeHostMus::HideImpl() { |
| 132 WindowTreeHostPlatform::HideImpl(); | 129 WindowTreeHostPlatform::HideImpl(); |
| 133 window()->Hide(); | 130 window()->Hide(); |
| 134 } | 131 } |
| 135 | 132 |
| 136 void WindowTreeHostMus::SetBoundsInPixels(const gfx::Rect& bounds) { | 133 void WindowTreeHostMus::SetBoundsInPixels(const gfx::Rect& bounds) { |
| 137 if (!in_set_bounds_from_server_) | 134 if (!in_set_bounds_from_server_) |
| 138 delegate_->OnWindowTreeHostBoundsWillChange(this, bounds); | 135 delegate_->OnWindowTreeHostBoundsWillChange(this, bounds); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 158 void WindowTreeHostMus::OnCloseRequest() { | 155 void WindowTreeHostMus::OnCloseRequest() { |
| 159 OnHostCloseRequested(); | 156 OnHostCloseRequested(); |
| 160 } | 157 } |
| 161 | 158 |
| 162 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { | 159 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { |
| 163 // TODO: This should read the profile from mus. crbug.com/647510 | 160 // TODO: This should read the profile from mus. crbug.com/647510 |
| 164 return gfx::ICCProfile(); | 161 return gfx::ICCProfile(); |
| 165 } | 162 } |
| 166 | 163 |
| 167 } // namespace aura | 164 } // namespace aura |
| OLD | NEW |