| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 display::Screen::GetScreen()->GetPrimaryDisplay().id(), | 92 display::Screen::GetScreen()->GetPrimaryDisplay().id(), |
| 93 properties) {} | 93 properties) {} |
| 94 | 94 |
| 95 WindowTreeHostMus::~WindowTreeHostMus() { | 95 WindowTreeHostMus::~WindowTreeHostMus() { |
| 96 DestroyCompositor(); | 96 DestroyCompositor(); |
| 97 DestroyDispatcher(); | 97 DestroyDispatcher(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void WindowTreeHostMus::SetBoundsFromServer(const gfx::Rect& bounds) { | 100 void WindowTreeHostMus::SetBoundsFromServer(const gfx::Rect& bounds) { |
| 101 base::AutoReset<bool> resetter(&in_set_bounds_from_server_, true); | 101 base::AutoReset<bool> resetter(&in_set_bounds_from_server_, true); |
| 102 SetBounds(bounds); | 102 SetBoundsInPixel(bounds); |
| 103 } | 103 } |
| 104 | 104 |
| 105 display::Display WindowTreeHostMus::GetDisplay() const { | 105 display::Display WindowTreeHostMus::GetDisplay() const { |
| 106 for (const display::Display& display : | 106 for (const display::Display& display : |
| 107 display::Screen::GetScreen()->GetAllDisplays()) { | 107 display::Screen::GetScreen()->GetAllDisplays()) { |
| 108 if (display.id() == display_id_) | 108 if (display.id() == display_id_) |
| 109 return display; | 109 return display; |
| 110 } | 110 } |
| 111 return display::Display(); | 111 return display::Display(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void WindowTreeHostMus::ShowImpl() { | 114 void WindowTreeHostMus::ShowImpl() { |
| 115 WindowTreeHostPlatform::ShowImpl(); | 115 WindowTreeHostPlatform::ShowImpl(); |
| 116 window()->Show(); | 116 window()->Show(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void WindowTreeHostMus::HideImpl() { | 119 void WindowTreeHostMus::HideImpl() { |
| 120 WindowTreeHostPlatform::HideImpl(); | 120 WindowTreeHostPlatform::HideImpl(); |
| 121 window()->Hide(); | 121 window()->Hide(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void WindowTreeHostMus::SetBounds(const gfx::Rect& bounds) { | 124 void WindowTreeHostMus::SetBoundsInPixel(const gfx::Rect& bounds) { |
| 125 if (!in_set_bounds_from_server_) | 125 if (!in_set_bounds_from_server_) |
| 126 delegate_->OnWindowTreeHostBoundsWillChange(this, bounds); | 126 delegate_->OnWindowTreeHostBoundsWillChange(this, bounds); |
| 127 WindowTreeHostPlatform::SetBounds(bounds); | 127 WindowTreeHostPlatform::SetBoundsInPixel(bounds); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { | 130 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { |
| 131 DCHECK(!event->IsKeyEvent()); | 131 DCHECK(!event->IsKeyEvent()); |
| 132 WindowTreeHostPlatform::DispatchEvent(event); | 132 WindowTreeHostPlatform::DispatchEvent(event); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void WindowTreeHostMus::OnClosed() { | 135 void WindowTreeHostMus::OnClosed() { |
| 136 } | 136 } |
| 137 | 137 |
| 138 void WindowTreeHostMus::OnActivationChanged(bool active) { | 138 void WindowTreeHostMus::OnActivationChanged(bool active) { |
| 139 if (active) | 139 if (active) |
| 140 GetInputMethod()->OnFocus(); | 140 GetInputMethod()->OnFocus(); |
| 141 else | 141 else |
| 142 GetInputMethod()->OnBlur(); | 142 GetInputMethod()->OnBlur(); |
| 143 WindowTreeHostPlatform::OnActivationChanged(active); | 143 WindowTreeHostPlatform::OnActivationChanged(active); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void WindowTreeHostMus::OnCloseRequest() { | 146 void WindowTreeHostMus::OnCloseRequest() { |
| 147 OnHostCloseRequested(); | 147 OnHostCloseRequested(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { | 150 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { |
| 151 // TODO: This should read the profile from mus. crbug.com/647510 | 151 // TODO: This should read the profile from mus. crbug.com/647510 |
| 152 return gfx::ICCProfile(); | 152 return gfx::ICCProfile(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace aura | 155 } // namespace aura |
| OLD | NEW |