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

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

Issue 1817443002: Rename mash_shell to mash_session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « mash/wm/window_manager.h ('k') | mash/wm/window_manager_application.h » ('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 "mash/wm/window_manager.h" 5 #include "mash/wm/window_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "components/mus/common/types.h" 10 #include "components/mus/common/types.h"
(...skipping 21 matching lines...) Expand all
32 if (!root_controller_) 32 if (!root_controller_)
33 return; 33 return;
34 for (auto container : root_controller_->root()->children()) { 34 for (auto container : root_controller_->root()->children()) {
35 container->RemoveObserver(this); 35 container->RemoveObserver(this);
36 for (auto child : container->children()) 36 for (auto child : container->children())
37 child->RemoveObserver(this); 37 child->RemoveObserver(this);
38 } 38 }
39 } 39 }
40 40
41 void WindowManager::Initialize(RootWindowController* root_controller, 41 void WindowManager::Initialize(RootWindowController* root_controller,
42 mash::shell::mojom::Shell* shell) { 42 session::mojom::Session* session) {
43 DCHECK(root_controller); 43 DCHECK(root_controller);
44 DCHECK(!root_controller_); 44 DCHECK(!root_controller_);
45 root_controller_ = root_controller; 45 root_controller_ = root_controller;
46 // The children of the root are considered containers. 46 // The children of the root are considered containers.
47 for (auto container : root_controller_->root()->children()) { 47 for (auto container : root_controller_->root()->children()) {
48 container->AddObserver(this); 48 container->AddObserver(this);
49 for (auto child : container->children()) 49 for (auto child : container->children())
50 child->AddObserver(this); 50 child->AddObserver(this);
51 } 51 }
52 52
53 // The insets are roughly what is needed by CustomFrameView. The expectation 53 // The insets are roughly what is needed by CustomFrameView. The expectation
54 // is at some point we'll write our own NonClientFrameView and get the insets 54 // is at some point we'll write our own NonClientFrameView and get the insets
55 // from it. 55 // from it.
56 mus::mojom::FrameDecorationValuesPtr frame_decoration_values = 56 mus::mojom::FrameDecorationValuesPtr frame_decoration_values =
57 mus::mojom::FrameDecorationValues::New(); 57 mus::mojom::FrameDecorationValues::New();
58 const gfx::Insets client_area_insets = 58 const gfx::Insets client_area_insets =
59 NonClientFrameController::GetPreferredClientAreaInsets(); 59 NonClientFrameController::GetPreferredClientAreaInsets();
60 frame_decoration_values->normal_client_area_insets = 60 frame_decoration_values->normal_client_area_insets =
61 mojo::Insets::From(client_area_insets); 61 mojo::Insets::From(client_area_insets);
62 frame_decoration_values->maximized_client_area_insets = 62 frame_decoration_values->maximized_client_area_insets =
63 mojo::Insets::From(client_area_insets); 63 mojo::Insets::From(client_area_insets);
64 frame_decoration_values->max_title_bar_button_width = 64 frame_decoration_values->max_title_bar_button_width =
65 NonClientFrameController::GetMaxTitleBarButtonWidth(); 65 NonClientFrameController::GetMaxTitleBarButtonWidth();
66 window_manager_client_->SetFrameDecorationValues( 66 window_manager_client_->SetFrameDecorationValues(
67 std::move(frame_decoration_values)); 67 std::move(frame_decoration_values));
68 68
69 if (shell) 69 if (session)
70 shell->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind()); 70 session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind());
71 } 71 }
72 72
73 gfx::Rect WindowManager::CalculateDefaultBounds(mus::Window* window) const { 73 gfx::Rect WindowManager::CalculateDefaultBounds(mus::Window* window) const {
74 DCHECK(root_controller_); 74 DCHECK(root_controller_);
75 int width, height; 75 int width, height;
76 const gfx::Size pref = GetWindowPreferredSize(window); 76 const gfx::Size pref = GetWindowPreferredSize(window);
77 const mus::Window* root = root_controller_->root(); 77 const mus::Window* root = root_controller_->root();
78 if (pref.IsEmpty()) { 78 if (pref.IsEmpty()) {
79 width = root->bounds().width() - 240; 79 width = root->bounds().width() - 240;
80 height = root->bounds().height() - 240; 80 height = root->bounds().height() - 240;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void WindowManager::ScreenlockStateChanged(bool locked) { 168 void WindowManager::ScreenlockStateChanged(bool locked) {
169 // Hide USER_PRIVATE windows when the screen is locked. 169 // Hide USER_PRIVATE windows when the screen is locked.
170 mus::Window* window = root_controller_->GetWindowForContainer( 170 mus::Window* window = root_controller_->GetWindowForContainer(
171 mash::wm::mojom::Container::USER_PRIVATE); 171 mash::wm::mojom::Container::USER_PRIVATE);
172 window->SetVisible(!locked); 172 window->SetVisible(!locked);
173 } 173 }
174 174
175 } // namespace wm 175 } // namespace wm
176 } // namespace mash 176 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/window_manager.h ('k') | mash/wm/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698