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

Unified Diff: mash/wm/window_manager_impl.cc

Issue 1567623003: Adds remainder of support for multiple roots to WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mash/wm/window_manager_impl.h ('k') | ui/views/mus/window_manager_connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/window_manager_impl.cc
diff --git a/mash/wm/window_manager_impl.cc b/mash/wm/window_manager_impl.cc
index bc664a9bd55b02823decfa7503088f60d90a17f8..49ccf36f0b11f11d6de3df8c497dc5c1c9366e3b 100644
--- a/mash/wm/window_manager_impl.cc
+++ b/mash/wm/window_manager_impl.cc
@@ -84,6 +84,39 @@ gfx::Rect WindowManagerImpl::GetMaximizedWindowBounds() const {
return gfx::Rect(state_->root()->bounds().size());
}
+mus::Window* WindowManagerImpl::NewTopLevelWindow(
+ std::map<std::string, std::vector<uint8_t>>* properties,
+ mus::mojom::WindowTreeClientPtr client) {
+ DCHECK(state_);
+ mus::Window* root = state_->root();
+ DCHECK(root);
+
+ const bool provide_non_client_frame =
+ GetWindowType(*properties) == mus::mojom::WINDOW_TYPE_WINDOW;
+ if (provide_non_client_frame)
+ (*properties)[mus::mojom::kWaitForUnderlay_Property].clear();
+
+ // TODO(sky): constrain and validate properties before passing to server.
+ mus::Window* window = root->connection()->NewWindow(properties);
+ window->SetBounds(CalculateDefaultBounds(window));
+
+ mojom::Container container = GetRequestedContainer(window);
+ state_->GetWindowForContainer(container)->AddChild(window);
+
+ if (client)
+ window->Embed(std::move(client));
+
+ if (provide_non_client_frame) {
+ // NonClientFrameController deletes itself when |window| is destroyed.
+ new NonClientFrameController(state_->app()->shell(), window,
+ state_->window_tree_host());
+ }
+
+ state_->IncrementWindowCount();
+
+ return window;
+}
+
void WindowManagerImpl::OnTreeChanging(const TreeChangeParams& params) {
DCHECK(state_);
if (state_->WindowIsContainer(params.old_parent))
@@ -99,32 +132,9 @@ void WindowManagerImpl::OnWindowEmbeddedAppDisconnected(mus::Window* window) {
void WindowManagerImpl::OpenWindow(
mus::mojom::WindowTreeClientPtr client,
mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
- DCHECK(state_);
- mus::Window* root = state_->root();
- DCHECK(root);
-
mus::Window::SharedProperties properties =
transport_properties.To<mus::Window::SharedProperties>();
- const bool provide_non_client_frame =
- GetWindowType(properties) == mus::mojom::WINDOW_TYPE_WINDOW;
- if (provide_non_client_frame)
- properties[mus::mojom::kWaitForUnderlay_Property].clear();
-
- // TODO(sky): constrain and validate properties before passing to server.
- mus::Window* child_window = root->connection()->NewWindow(&properties);
- child_window->SetBounds(CalculateDefaultBounds(child_window));
-
- mojom::Container container = GetRequestedContainer(child_window);
- state_->GetWindowForContainer(container)->AddChild(child_window);
- child_window->Embed(std::move(client));
-
- if (provide_non_client_frame) {
- // NonClientFrameController deletes itself when |child_window| is destroyed.
- new NonClientFrameController(state_->app()->shell(), child_window,
- state_->window_tree_host());
- }
-
- state_->IncrementWindowCount();
+ NewTopLevelWindow(&properties, std::move(client));
}
void WindowManagerImpl::GetConfig(const GetConfigCallback& callback) {
@@ -174,5 +184,10 @@ bool WindowManagerImpl::OnWmSetProperty(
name == mus::mojom::WindowManager::kWindowTitle_Property;
}
+mus::Window* WindowManagerImpl::OnWmCreateTopLevelWindow(
+ std::map<std::string, std::vector<uint8_t>>* properties) {
+ return NewTopLevelWindow(properties, nullptr);
+}
+
} // namespace wm
} // namespace mash
« no previous file with comments | « mash/wm/window_manager_impl.h ('k') | ui/views/mus/window_manager_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698