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

Side by Side Diff: ash/common/keyboard/keyboard_observer_register.cc

Issue 2747543002: ash: Start/stop observing KeyboardController via ShellObserver (Closed)
Patch Set: update LockLayoutManager to use similar logic Created 3 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/common/keyboard/keyboard_observer_register.h"
6
7 #include "ui/keyboard/keyboard_controller.h"
8
9 namespace ash {
10
11 void UpdateKeyboardObserverFromStateChanged(
12 bool keyboard_activated,
13 WmWindow* keyboard_root_window,
14 WmWindow* observer_root_window,
15 ScopedObserver<keyboard::KeyboardController,
16 keyboard::KeyboardControllerObserver>* keyboard_observer) {
17 if (keyboard_root_window != observer_root_window)
18 return;
19
20 keyboard::KeyboardController* const keyboard_controller =
21 keyboard::KeyboardController::GetInstance();
22 if (keyboard_activated &&
23 !keyboard_observer->IsObserving(keyboard_controller)) {
24 keyboard_observer->Add(keyboard_controller);
25 } else if (!keyboard_activated &&
26 keyboard_observer->IsObserving(keyboard_controller)) {
27 keyboard_observer->Remove(keyboard_controller);
28 }
29 }
30
31 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/keyboard/keyboard_observer_register.h ('k') | ash/common/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698