Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: components/exo/display.cc

Issue 2548653005: exo: Add initial support for service side decorations. (Closed)
Patch Set: fix typo Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/exo/pointer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) { 107 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
108 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface", 108 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface",
109 surface->AsTracedValue()); 109 surface->AsTracedValue());
110 110
111 if (surface->HasSurfaceDelegate()) { 111 if (surface->HasSurfaceDelegate()) {
112 DLOG(ERROR) << "Surface has already been assigned a role"; 112 DLOG(ERROR) << "Surface has already been assigned a role";
113 return nullptr; 113 return nullptr;
114 } 114 }
115 115
116 return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(), 116 return base::MakeUnique<ShellSurface>(
117 true /* activatable */, 117 surface, nullptr, gfx::Rect(), true /* activatable */,
118 ash::kShellWindowId_DefaultContainer); 118 false /* can_minimize */, ash::kShellWindowId_DefaultContainer);
119 } 119 }
120 120
121 std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface( 121 std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface(
122 Surface* surface, 122 Surface* surface,
123 ShellSurface* parent, 123 ShellSurface* parent,
124 const gfx::Point& position) { 124 const gfx::Point& position) {
125 TRACE_EVENT2("exo", "Display::CreatePopupShellSurface", "surface", 125 TRACE_EVENT2("exo", "Display::CreatePopupShellSurface", "surface",
126 surface->AsTracedValue(), "parent", parent->AsTracedValue()); 126 surface->AsTracedValue(), "parent", parent->AsTracedValue());
127 127
128 if (surface->window()->Contains(parent->GetWidget()->GetNativeWindow())) { 128 if (surface->window()->Contains(parent->GetWidget()->GetNativeWindow())) {
129 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; 129 DLOG(ERROR) << "Parent is contained within surface's hierarchy";
130 return nullptr; 130 return nullptr;
131 } 131 }
132 132
133 if (surface->HasSurfaceDelegate()) { 133 if (surface->HasSurfaceDelegate()) {
134 DLOG(ERROR) << "Surface has already been assigned a role"; 134 DLOG(ERROR) << "Surface has already been assigned a role";
135 return nullptr; 135 return nullptr;
136 } 136 }
137 137
138 // Determine the initial bounds for popup. |position| is relative to the 138 // Determine the initial bounds for popup. |position| is relative to the
139 // parent's main surface origin and initial bounds are in screen coordinates. 139 // parent's main surface origin and initial bounds are in screen coordinates.
140 gfx::Point origin = position; 140 gfx::Point origin = position;
141 wm::ConvertPointToScreen( 141 wm::ConvertPointToScreen(
142 ShellSurface::GetMainSurface(parent->GetWidget()->GetNativeWindow()) 142 ShellSurface::GetMainSurface(parent->GetWidget()->GetNativeWindow())
143 ->window(), 143 ->window(),
144 &origin); 144 &origin);
145 gfx::Rect initial_bounds(origin, gfx::Size(1, 1)); 145 gfx::Rect initial_bounds(origin, gfx::Size(1, 1));
146 146
147 return base::MakeUnique<ShellSurface>(surface, parent, initial_bounds, 147 return base::MakeUnique<ShellSurface>(
148 false /* activatable */, 148 surface, parent, initial_bounds, false /* activatable */,
149 ash::kShellWindowId_DefaultContainer); 149 false /* can_minimize */, ash::kShellWindowId_DefaultContainer);
150 } 150 }
151 151
152 std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface( 152 std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface(
153 Surface* surface, 153 Surface* surface,
154 int container) { 154 int container) {
155 TRACE_EVENT2("exo", "Display::CreateRemoteShellSurface", "surface", 155 TRACE_EVENT2("exo", "Display::CreateRemoteShellSurface", "surface",
156 surface->AsTracedValue(), "container", container); 156 surface->AsTracedValue(), "container", container);
157 157
158 if (surface->HasSurfaceDelegate()) { 158 if (surface->HasSurfaceDelegate()) {
159 DLOG(ERROR) << "Surface has already been assigned a role"; 159 DLOG(ERROR) << "Surface has already been assigned a role";
160 return nullptr; 160 return nullptr;
161 } 161 }
162 162
163 // Remote shell surfaces in system modal container cannot be minimized.
164 bool can_minimize = container != ash::kShellWindowId_SystemModalContainer;
165
163 return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(1, 1), 166 return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(1, 1),
164 true /* activatable */, container); 167 true /* activatable */, can_minimize,
168 container);
165 } 169 }
166 170
167 std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface, 171 std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,
168 Surface* parent) { 172 Surface* parent) {
169 TRACE_EVENT2("exo", "Display::CreateSubSurface", "surface", 173 TRACE_EVENT2("exo", "Display::CreateSubSurface", "surface",
170 surface->AsTracedValue(), "parent", parent->AsTracedValue()); 174 surface->AsTracedValue(), "parent", parent->AsTracedValue());
171 175
172 if (surface->window()->Contains(parent->window())) { 176 if (surface->window()->Contains(parent->window())) {
173 DLOG(ERROR) << "Parent is contained within surface's hierarchy"; 177 DLOG(ERROR) << "Parent is contained within surface's hierarchy";
174 return nullptr; 178 return nullptr;
(...skipping 17 matching lines...) Expand all
192 notification_surface_manager_->GetSurface(notification_id)) { 196 notification_surface_manager_->GetSurface(notification_id)) {
193 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; 197 DLOG(ERROR) << "Invalid notification id, id=" << notification_id;
194 return nullptr; 198 return nullptr;
195 } 199 }
196 200
197 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, 201 return base::MakeUnique<NotificationSurface>(notification_surface_manager_,
198 surface, notification_id); 202 surface, notification_id);
199 } 203 }
200 204
201 } // namespace exo 205 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | components/exo/pointer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698