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

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

Issue 1656123002: Moves accelerator registration to WindowManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mandoline Created 4 years, 10 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/root_window_controller.h ('k') | mash/wm/root_windows_observer.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/root_window_controller.h" 5 #include "mash/wm/root_window_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "components/mus/common/util.h" 10 #include "components/mus/common/util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 mus::Window* RootWindowController::GetWindowById(mus::Id id) { 82 mus::Window* RootWindowController::GetWindowById(mus::Id id) {
83 return root_->GetChildById(id); 83 return root_->GetChildById(id);
84 } 84 }
85 85
86 bool RootWindowController::WindowIsContainer(const mus::Window* window) const { 86 bool RootWindowController::WindowIsContainer(const mus::Window* window) const {
87 return window && window->parent() == root_; 87 return window && window->parent() == root_;
88 } 88 }
89 89
90 void RootWindowController::OnAccelerator(uint32_t id,
91 mus::mojom::EventPtr event) {
92 switch (id) {
93 case kWindowSwitchAccelerator:
94 window_tree_host_->ActivateNextWindow();
95 break;
96 default:
97 app_->OnAccelerator(id, std::move(event));
98 break;
99 }
100 }
101
90 RootWindowController::RootWindowController(WindowManagerApplication* app) 102 RootWindowController::RootWindowController(WindowManagerApplication* app)
91 : app_(app), root_(nullptr), window_count_(0), host_client_binding_(this) { 103 : app_(app), root_(nullptr), window_count_(0), host_client_binding_(this) {
92 window_manager_.reset(new WindowManager); 104 window_manager_.reset(new WindowManager);
93 } 105 }
94 106
95 RootWindowController::~RootWindowController() {} 107 RootWindowController::~RootWindowController() {}
96 108
97 void RootWindowController::AddAccelerators() { 109 void RootWindowController::AddAccelerators() {
98 window_tree_host_->AddAccelerator( 110 window_manager_->window_manager_client()->AddAccelerator(
99 kWindowSwitchAccelerator, 111 kWindowSwitchAccelerator,
100 mus::CreateKeyMatcher(mus::mojom::KeyboardCode::TAB, 112 mus::CreateKeyMatcher(mus::mojom::KeyboardCode::TAB,
101 mus::mojom::kEventFlagControlDown), 113 mus::mojom::kEventFlagControlDown),
102 base::Bind(&AssertTrue)); 114 base::Bind(&AssertTrue));
103 } 115 }
104 116
105 void RootWindowController::OnAccelerator(uint32_t id,
106 mus::mojom::EventPtr event) {
107 switch (id) {
108 case kWindowSwitchAccelerator:
109 window_tree_host_->ActivateNextWindow();
110 break;
111 default:
112 app_->OnAccelerator(id, std::move(event));
113 break;
114 }
115 }
116
117 void RootWindowController::OnEmbed(mus::Window* root) { 117 void RootWindowController::OnEmbed(mus::Window* root) {
118 root_ = root; 118 root_ = root;
119 root_->AddObserver(this); 119 root_->AddObserver(this);
120 120
121 app_->OnRootWindowControllerGotRoot(this); 121 app_->OnRootWindowControllerGotRoot(this);
122 122
123 CreateContainers(); 123 CreateContainers();
124 background_layout_.reset(new BackgroundLayout( 124 background_layout_.reset(new BackgroundLayout(
125 GetWindowForContainer(mojom::Container::USER_BACKGROUND))); 125 GetWindowForContainer(mojom::Container::USER_BACKGROUND)));
126 screenlock_layout_.reset(new ScreenlockLayout( 126 screenlock_layout_.reset(new ScreenlockLayout(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 DCHECK_EQ(mus::LoWord(window->id()), container) 168 DCHECK_EQ(mus::LoWord(window->id()), container)
169 << "Containers must be created before other windows!"; 169 << "Containers must be created before other windows!";
170 window->SetBounds(root_->bounds()); 170 window->SetBounds(root_->bounds());
171 window->SetVisible(true); 171 window->SetVisible(true);
172 root_->AddChild(window); 172 root_->AddChild(window);
173 } 173 }
174 } 174 }
175 175
176 } // namespace wm 176 } // namespace wm
177 } // namespace mash 177 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/root_window_controller.h ('k') | mash/wm/root_windows_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698