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

Side by Side Diff: ui/base/ime/chromeos/ime_keyboard_x11.h

Issue 750353004: Revert of Moves code from chromeos/ime to ui/base/ime/chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « ui/base/ime/chromeos/ime_keyboard_ozone.cc ('k') | ui/base/ime/chromeos/ime_keyboard_x11.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 2014 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 #ifndef UI_BASE_IME_CHROMEOS_IME_KEYBOARD_X11_H_
6 #define UI_BASE_IME_CHROMEOS_IME_KEYBOARD_X11_H_
7
8 #include "ui/base/ime/chromeos/ime_keyboard.h"
9
10 #include <cstdlib>
11 #include <cstring>
12 #include <queue>
13 #include <set>
14 #include <utility>
15
16 #include "base/bind.h"
17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/message_loop/message_loop.h"
20 #include "base/process/kill.h"
21 #include "base/process/launch.h"
22 #include "base/process/process_handle.h"
23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h"
25 #include "base/sys_info.h"
26 #include "base/threading/thread_checker.h"
27 #include "ui/base/ui_base_export.h"
28
29 namespace chromeos {
30 namespace input_method {
31
32 class UI_BASE_EXPORT ImeKeyboardX11 : public ImeKeyboard {
33 public:
34 ImeKeyboardX11();
35 virtual ~ImeKeyboardX11();
36
37 // ImeKeyboard:
38 virtual bool SetCurrentKeyboardLayoutByName(
39 const std::string& layout_name) override;
40 virtual bool ReapplyCurrentKeyboardLayout() override;
41 virtual void ReapplyCurrentModifierLockStatus() override;
42 virtual void DisableNumLock() override;
43 virtual void SetCapsLockEnabled(bool enable_caps_lock) override;
44 virtual bool CapsLockIsEnabled() override;
45 virtual bool SetAutoRepeatEnabled(bool enabled) override;
46 virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) override;
47
48 private:
49 // Returns a mask for Num Lock (e.g. 1U << 4). Returns 0 on error.
50 unsigned int GetNumLockMask();
51
52 // Sets the caps-lock status. Note that calling this function always disables
53 // the num-lock.
54 void SetLockedModifiers();
55
56 // This function is used by SetLayout() and RemapModifierKeys(). Calls
57 // setxkbmap command if needed, and updates the last_full_layout_name_ cache.
58 bool SetLayoutInternal(const std::string& layout_name, bool force);
59
60 // Executes 'setxkbmap -layout ...' command asynchronously using a layout name
61 // in the |execute_queue_|. Do nothing if the queue is empty.
62 // TODO(yusukes): Use libxkbfile.so instead of the command (crosbug.com/13105)
63 void MaybeExecuteSetLayoutCommand();
64
65 // Polls to see setxkbmap process exits.
66 void PollUntilChildFinish(const base::ProcessHandle handle);
67
68 // Called when execve'd setxkbmap process exits.
69 void OnSetLayoutFinish();
70
71 const bool is_running_on_chrome_os_;
72 unsigned int num_lock_mask_;
73
74 // A queue for executing setxkbmap one by one.
75 std::queue<std::string> execute_queue_;
76
77 base::ThreadChecker thread_checker_;
78
79 base::WeakPtrFactory<ImeKeyboardX11> weak_factory_;
80
81 DISALLOW_COPY_AND_ASSIGN(ImeKeyboardX11);
82 };
83
84
85 } // namespace input_method
86 } // namespace chromeos
87
88 #endif // UI_BASE_IME_CHROMEOS_IME_KEYBOARD_X11_H_
OLDNEW
« no previous file with comments | « ui/base/ime/chromeos/ime_keyboard_ozone.cc ('k') | ui/base/ime/chromeos/ime_keyboard_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698