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

Side by Side Diff: mash/wm/window_manager_impl.cc

Issue 1474543002: Makes NewWindow() take set of properties for window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke shadow_style changes Created 5 years, 1 month 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 | « mash/wm/window_manager_impl.h ('k') | no next file » | 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 "mash/wm/window_manager_impl.h" 5 #include "mash/wm/window_manager_impl.h"
6 6
7 #include "components/mus/common/types.h" 7 #include "components/mus/common/types.h"
8 #include "components/mus/public/cpp/property_type_converters.h" 8 #include "components/mus/public/cpp/property_type_converters.h"
9 #include "components/mus/public/cpp/window.h" 9 #include "components/mus/public/cpp/window.h"
10 #include "components/mus/public/cpp/window_property.h" 10 #include "components/mus/public/cpp/window_property.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return gfx::Rect(40 + (state_->window_count() % 4) * 40, 57 return gfx::Rect(40 + (state_->window_count() % 4) * 40,
58 40 + (state_->window_count() % 4) * 40, width, height); 58 40 + (state_->window_count() % 4) * 40, width, height);
59 } 59 }
60 60
61 gfx::Rect WindowManagerImpl::GetMaximizedWindowBounds() const { 61 gfx::Rect WindowManagerImpl::GetMaximizedWindowBounds() const {
62 return gfx::Rect(state_->root()->bounds().size()); 62 return gfx::Rect(state_->root()->bounds().size());
63 } 63 }
64 64
65 void WindowManagerImpl::OpenWindow( 65 void WindowManagerImpl::OpenWindow(
66 mus::mojom::WindowTreeClientPtr client, 66 mus::mojom::WindowTreeClientPtr client,
67 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) { 67 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
68 mus::Window* root = state_->root(); 68 mus::Window* root = state_->root();
69 DCHECK(root); 69 DCHECK(root);
70 70
71 mus::Window* child_window = root->connection()->NewWindow(); 71 mus::Window::SharedProperties properties =
72 // TODO(beng): mus::Window should have a "SetSharedProperties" method that 72 transport_properties.To<mus::Window::SharedProperties>();
73 // joins the supplied map onto the internal one. 73 // TODO(sky): constrain to valid properties here.
74 for (auto prop : properties) 74 mus::Window* child_window = root->connection()->NewWindow(&properties);
75 child_window->SetSharedProperty(prop.GetKey(), prop.GetValue());
76
77 child_window->SetBounds(CalculateDefaultBounds(child_window)); 75 child_window->SetBounds(CalculateDefaultBounds(child_window));
78 GetContainerForChild(child_window)->AddChild(child_window); 76 GetContainerForChild(child_window)->AddChild(child_window);
79 child_window->Embed(client.Pass()); 77 child_window->Embed(client.Pass());
80 78
81 // NonClientFrameController deletes itself when the window is destroyed. 79 // NonClientFrameController deletes itself when the window is destroyed.
82 new NonClientFrameController(state_->app()->shell(), child_window); 80 new NonClientFrameController(state_->app()->shell(), child_window);
83 81
84 state_->IncrementWindowCount(); 82 state_->IncrementWindowCount();
85 } 83 }
86 84
(...skipping 20 matching lines...) Expand all
107 105
108 config->maximized_client_area_insets = mojo::Insets::From(client_area_insets); 106 config->maximized_client_area_insets = mojo::Insets::From(client_area_insets);
109 107
110 callback.Run(config.Pass()); 108 callback.Run(config.Pass());
111 } 109 }
112 110
113 mus::Window* WindowManagerImpl::GetContainerForChild(mus::Window* child) { 111 mus::Window* WindowManagerImpl::GetContainerForChild(mus::Window* child) {
114 mash::wm::mojom::Container container = GetRequestedContainer(child); 112 mash::wm::mojom::Container container = GetRequestedContainer(child);
115 return state_->GetWindowForContainer(container); 113 return state_->GetWindowForContainer(container);
116 } 114 }
OLDNEW
« no previous file with comments | « mash/wm/window_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698