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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: 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 unified diff | Download patch
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_application.h" 5 #include "mash/wm/window_manager_application.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 bool WindowManagerApplication::WindowIsContainer( 58 bool WindowManagerApplication::WindowIsContainer(
59 const mus::Window* window) const { 59 const mus::Window* window) const {
60 return window && window->parent() == root_; 60 return window && window->parent() == root_;
61 } 61 }
62 62
63 void WindowManagerApplication::AddAccelerators() { 63 void WindowManagerApplication::AddAccelerators() {
64 window_tree_host_->AddAccelerator( 64 window_tree_host_->AddAccelerator(
65 kWindowSwitchCmd, 65 kWindowSwitchCmd,
66 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_TAB, 66 mus::CreateKeyMatcher(mus::mojom::KeyboardCode::TAB,
67 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), 67 mus::mojom::kEventFlagControlDown),
68 base::Bind(&AssertTrue)); 68 base::Bind(&AssertTrue));
69 } 69 }
70 70
71 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( 71 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed(
72 AcceleratorRegistrarImpl* registrar) { 72 AcceleratorRegistrarImpl* registrar) {
73 accelerator_registrars_.erase(registrar); 73 accelerator_registrars_.erase(registrar);
74 } 74 }
75 75
76 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) { 76 void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) {
77 app_ = app; 77 app_ = app;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 void WindowManagerApplication::OnEmbed(mus::Window* root) { 114 void WindowManagerApplication::OnEmbed(mus::Window* root) {
115 root_ = root; 115 root_ = root;
116 root_->AddObserver(this); 116 root_->AddObserver(this);
117 CreateContainers(); 117 CreateContainers();
118 background_layout_.reset(new BackgroundLayout( 118 background_layout_.reset(new BackgroundLayout(
119 GetWindowForContainer(mojom::CONTAINER_USER_BACKGROUND))); 119 GetWindowForContainer(mojom::Container::USER_BACKGROUND)));
120 shelf_layout_.reset( 120 shelf_layout_.reset(
121 new ShelfLayout(GetWindowForContainer(mojom::CONTAINER_USER_SHELF))); 121 new ShelfLayout(GetWindowForContainer(mojom::Container::USER_SHELF)));
122 122
123 mus::Window* window = GetWindowForContainer(mojom::CONTAINER_USER_WINDOWS); 123 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS);
124 window_layout_.reset( 124 window_layout_.reset(
125 new WindowLayout(GetWindowForContainer(mojom::CONTAINER_USER_WINDOWS))); 125 new WindowLayout(GetWindowForContainer(mojom::Container::USER_WINDOWS)));
126 window_tree_host_->AddActivationParent(window->id()); 126 window_tree_host_->AddActivationParent(window->id());
127 window_tree_host_->SetTitle("Mash"); 127 window_tree_host_->SetTitle("Mash");
128 128
129 AddAccelerators(); 129 AddAccelerators();
130 130
131 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); 131 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root)));
132 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak")); 132 aura_init_.reset(new views::AuraInit(app_, "mash_wm_resources.pak"));
133 window_manager_->Initialize(this); 133 window_manager_->Initialize(this);
134 134
135 for (auto request : requests_) 135 for (auto request : requests_)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 DCHECK_EQ(window, root_); 182 DCHECK_EQ(window, root_);
183 root_->RemoveObserver(this); 183 root_->RemoveObserver(this);
184 // Delete the |window_manager_| here so that WindowManager doesn't have to 184 // Delete the |window_manager_| here so that WindowManager doesn't have to
185 // worry about the possibility of |root_| being null. 185 // worry about the possibility of |root_| being null.
186 window_manager_.reset(); 186 window_manager_.reset();
187 root_ = nullptr; 187 root_ = nullptr;
188 } 188 }
189 189
190 void WindowManagerApplication::CreateContainers() { 190 void WindowManagerApplication::CreateContainers() {
191 for (uint16_t container = 191 for (uint16_t container =
192 static_cast<uint16_t>(mojom::CONTAINER_ALL_USER_BACKGROUND); 192 static_cast<uint16_t>(mojom::Container::ALL_USER_BACKGROUND);
193 container < static_cast<uint16_t>(mojom::CONTAINER_COUNT); ++container) { 193 container < static_cast<uint16_t>(mojom::Container::COUNT);
194 ++container) {
194 mus::Window* window = root_->connection()->NewWindow(); 195 mus::Window* window = root_->connection()->NewWindow();
195 DCHECK_EQ(mus::LoWord(window->id()), container) 196 DCHECK_EQ(mus::LoWord(window->id()), container)
196 << "Containers must be created before other windows!"; 197 << "Containers must be created before other windows!";
197 window->SetBounds(root_->bounds()); 198 window->SetBounds(root_->bounds());
198 window->SetVisible(true); 199 window->SetVisible(true);
199 root_->AddChild(window); 200 root_->AddChild(window);
200 } 201 }
201 } 202 }
202 203
203 } // namespace wm 204 } // namespace wm
204 } // namespace mash 205 } // namespace mash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698