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

Side by Side Diff: ash/mus/keyboard_ui_mus.cc

Issue 1684823004: Refactors keyboard related code so mash can use a keyboard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk 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 | « ash/mus/keyboard_ui_mus.h ('k') | ash/mus/sysui_application.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/mus/keyboard_ui_mus.h"
6
7 #include "ash/keyboard/keyboard_ui_observer.h"
8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h"
10 #include "mojo/shell/public/cpp/shell.h"
11
12 namespace ash {
13
14 KeyboardUIMus::KeyboardUIMus(mojo::Shell* mojo_shell)
15 : is_enabled_(false), observer_binding_(this) {
16 // TODO(sky): should be something like mojo://keyboard, but need mapping.
17 mojo_shell->ConnectToInterface("exe://chrome", &keyboard_);
18 keyboard_->AddObserver(observer_binding_.CreateInterfacePtrAndBind());
19 }
20
21 KeyboardUIMus::~KeyboardUIMus() {}
22
23 // static
24 scoped_ptr<KeyboardUI> KeyboardUIMus::Create(mojo::Shell* mojo_shell) {
25 return make_scoped_ptr(new KeyboardUIMus(mojo_shell));
26 }
27
28 void KeyboardUIMus::Hide() {
29 keyboard_->Hide();
30 }
31
32 void KeyboardUIMus::Show() {
33 keyboard_->Show();
34 }
35
36 bool KeyboardUIMus::IsEnabled() {
37 return is_enabled_;
38 }
39
40 void KeyboardUIMus::OnKeyboardStateChanged(bool is_enabled,
41 bool is_visible,
42 uint64_t display_id,
43 mojo::RectPtr bounds) {
44 if (is_enabled_ == is_enabled)
45 return;
46
47 is_enabled_ = is_enabled;
48 FOR_EACH_OBSERVER(KeyboardUIObserver, *observers(),
49 OnKeyboardEnabledStateChanged(is_enabled));
50 }
51
52 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/keyboard_ui_mus.h ('k') | ash/mus/sysui_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698