| 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 "components/exo/display.h" | 5 #include "components/exo/display.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/wm/common/wm_shell_window_ids.h" | 10 #include "ash/wm/common/wm_shell_window_ids.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) { | 97 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) { |
| 98 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface", | 98 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface", |
| 99 surface->AsTracedValue()); | 99 surface->AsTracedValue()); |
| 100 | 100 |
| 101 if (surface->HasSurfaceDelegate()) { | 101 if (surface->HasSurfaceDelegate()) { |
| 102 DLOG(ERROR) << "Surface has already been assigned a role"; | 102 DLOG(ERROR) << "Surface has already been assigned a role"; |
| 103 return nullptr; | 103 return nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 return base::WrapUnique( | 106 return base::WrapUnique(new ShellSurface( |
| 107 new ShellSurface(surface, nullptr, gfx::Rect(), true, true, | 107 surface, nullptr, gfx::Rect(), true /* activatable */, |
| 108 ash::kShellWindowId_DefaultContainer)); | 108 true /* resizeable */, ash::kShellWindowId_DefaultContainer)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface( | 111 std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface( |
| 112 Surface* surface, | 112 Surface* surface, |
| 113 ShellSurface* parent, | 113 ShellSurface* parent, |
| 114 const gfx::Point& position) { | 114 const gfx::Point& position) { |
| 115 TRACE_EVENT2("exo", "Display::CreatePopupShellSurface", "surface", | 115 TRACE_EVENT2("exo", "Display::CreatePopupShellSurface", "surface", |
| 116 surface->AsTracedValue(), "parent", parent->AsTracedValue()); | 116 surface->AsTracedValue(), "parent", parent->AsTracedValue()); |
| 117 | 117 |
| 118 if (surface->Contains(parent->GetWidget()->GetNativeWindow())) { | 118 if (surface->Contains(parent->GetWidget()->GetNativeWindow())) { |
| 119 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; | 119 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; |
| 120 return nullptr; | 120 return nullptr; |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (surface->HasSurfaceDelegate()) { | 123 if (surface->HasSurfaceDelegate()) { |
| 124 DLOG(ERROR) << "Surface has already been assigned a role"; | 124 DLOG(ERROR) << "Surface has already been assigned a role"; |
| 125 return nullptr; | 125 return nullptr; |
| 126 } | 126 } |
| 127 | 127 |
| 128 return base::WrapUnique( | 128 return base::WrapUnique( |
| 129 new ShellSurface(surface, parent, gfx::Rect(position, gfx::Size(1, 1)), | 129 new ShellSurface(surface, parent, gfx::Rect(position, gfx::Size(1, 1)), |
| 130 false, true, ash::kShellWindowId_DefaultContainer)); | 130 false /* activatable */, true /* resizeable */, |
| 131 ash::kShellWindowId_DefaultContainer)); |
| 131 } | 132 } |
| 132 | 133 |
| 133 std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface( | 134 std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface( |
| 134 Surface* surface, | 135 Surface* surface, |
| 135 int container) { | 136 int container) { |
| 136 TRACE_EVENT2("exo", "Display::CreateRemoteShellSurface", "surface", | 137 TRACE_EVENT2("exo", "Display::CreateRemoteShellSurface", "surface", |
| 137 surface->AsTracedValue(), "container", container); | 138 surface->AsTracedValue(), "container", container); |
| 138 | 139 |
| 139 if (surface->HasSurfaceDelegate()) { | 140 if (surface->HasSurfaceDelegate()) { |
| 140 DLOG(ERROR) << "Surface has already been assigned a role"; | 141 DLOG(ERROR) << "Surface has already been assigned a role"; |
| 141 return nullptr; | 142 return nullptr; |
| 142 } | 143 } |
| 143 | 144 |
| 144 return base::WrapUnique(new ShellSurface(surface, nullptr, gfx::Rect(1, 1), | 145 return base::WrapUnique(new ShellSurface(surface, nullptr, gfx::Rect(1, 1), |
| 145 true, true, container)); | 146 true /* activatable */, |
| 147 false /* resizeable */, container)); |
| 146 } | 148 } |
| 147 | 149 |
| 148 std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface, | 150 std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface, |
| 149 Surface* parent) { | 151 Surface* parent) { |
| 150 TRACE_EVENT2("exo", "Display::CreateSubSurface", "surface", | 152 TRACE_EVENT2("exo", "Display::CreateSubSurface", "surface", |
| 151 surface->AsTracedValue(), "parent", parent->AsTracedValue()); | 153 surface->AsTracedValue(), "parent", parent->AsTracedValue()); |
| 152 | 154 |
| 153 if (surface->Contains(parent)) { | 155 if (surface->Contains(parent)) { |
| 154 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; | 156 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; |
| 155 return nullptr; | 157 return nullptr; |
| 156 } | 158 } |
| 157 | 159 |
| 158 if (surface->HasSurfaceDelegate()) { | 160 if (surface->HasSurfaceDelegate()) { |
| 159 DLOG(ERROR) << "Surface has already been assigned a role"; | 161 DLOG(ERROR) << "Surface has already been assigned a role"; |
| 160 return nullptr; | 162 return nullptr; |
| 161 } | 163 } |
| 162 | 164 |
| 163 return base::WrapUnique(new SubSurface(surface, parent)); | 165 return base::WrapUnique(new SubSurface(surface, parent)); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace exo | 168 } // namespace exo |
| OLD | NEW |