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

Side by Side Diff: chrome/browser/ui/ash/event_rewriter.cc

Issue 23904025: Move IsRunningOnChromeOS to SysInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge fix Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/ash/event_rewriter.h" 5 #include "chrome/browser/ui/ash/event_rewriter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 #include "ui/events/event_utils.h" 16 #include "ui/events/event_utils.h"
17 #include "ui/events/keycodes/keyboard_code_conversion.h" 17 #include "ui/events/keycodes/keyboard_code_conversion.h"
18 18
19 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
20 #include <X11/extensions/XInput2.h> 20 #include <X11/extensions/XInput2.h>
21 #include <X11/keysym.h> 21 #include <X11/keysym.h>
22 #include <X11/XF86keysym.h> 22 #include <X11/XF86keysym.h>
23 #include <X11/Xlib.h> 23 #include <X11/Xlib.h>
24 24
25 // Get rid of a macro from Xlib.h that conflicts with OwnershipService class. 25 // Get rid of a macro from Xlib.h that conflicts with OwnershipService class.
26 #undef Status 26 #undef Status
27 27
28 #include "base/chromeos/chromeos_version.h"
29 #include "base/command_line.h" 28 #include "base/command_line.h"
29 #include "base/sys_info.h"
30 #include "chrome/browser/chromeos/keyboard_driven_event_rewriter.h" 30 #include "chrome/browser/chromeos/keyboard_driven_event_rewriter.h"
31 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 31 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
32 #include "chrome/browser/chromeos/login/user_manager.h" 32 #include "chrome/browser/chromeos/login/user_manager.h"
33 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" 33 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
34 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
35 #include "chromeos/chromeos_switches.h" 35 #include "chromeos/chromeos_switches.h"
36 #include "chromeos/ime/input_method_manager.h" 36 #include "chromeos/ime/input_method_manager.h"
37 #include "chromeos/ime/xkeyboard.h" 37 #include "chromeos/ime/xkeyboard.h"
38 #include "ui/base/x/x11_util.h" 38 #include "ui/base/x/x11_util.h"
39 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 39 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #if defined(OS_CHROMEOS) 149 #if defined(OS_CHROMEOS)
150 xkeyboard_(NULL), 150 xkeyboard_(NULL),
151 keyboard_driven_event_rewritter_( 151 keyboard_driven_event_rewritter_(
152 new chromeos::KeyboardDrivenEventRewriter), 152 new chromeos::KeyboardDrivenEventRewriter),
153 #endif 153 #endif
154 pref_service_(NULL) { 154 pref_service_(NULL) {
155 // The ash shell isn't instantiated for our unit tests. 155 // The ash shell isn't instantiated for our unit tests.
156 if (ash::Shell::HasInstance()) 156 if (ash::Shell::HasInstance())
157 ash::Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); 157 ash::Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this);
158 #if defined(OS_CHROMEOS) 158 #if defined(OS_CHROMEOS)
159 if (base::chromeos::IsRunningOnChromeOS()) { 159 if (base::SysInfo::IsRunningOnChromeOS()) {
160 chromeos::XInputHierarchyChangedEventListener::GetInstance() 160 chromeos::XInputHierarchyChangedEventListener::GetInstance()
161 ->AddObserver(this); 161 ->AddObserver(this);
162 } 162 }
163 RefreshKeycodes(); 163 RefreshKeycodes();
164 #endif 164 #endif
165 } 165 }
166 166
167 EventRewriter::~EventRewriter() { 167 EventRewriter::~EventRewriter() {
168 if (ash::Shell::HasInstance()) 168 if (ash::Shell::HasInstance())
169 ash::Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); 169 ash::Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this);
170 #if defined(OS_CHROMEOS) 170 #if defined(OS_CHROMEOS)
171 if (base::chromeos::IsRunningOnChromeOS()) { 171 if (base::SysInfo::IsRunningOnChromeOS()) {
172 chromeos::XInputHierarchyChangedEventListener::GetInstance() 172 chromeos::XInputHierarchyChangedEventListener::GetInstance()
173 ->RemoveObserver(this); 173 ->RemoveObserver(this);
174 } 174 }
175 #endif 175 #endif
176 } 176 }
177 177
178 EventRewriter::DeviceType EventRewriter::DeviceAddedForTesting( 178 EventRewriter::DeviceType EventRewriter::DeviceAddedForTesting(
179 int device_id, 179 int device_id,
180 const std::string& device_name) { 180 const std::string& device_name) {
181 return DeviceAddedInternal(device_id, device_name); 181 return DeviceAddedInternal(device_id, device_name);
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 const DeviceType type = EventRewriter::GetDeviceType(device_name); 1011 const DeviceType type = EventRewriter::GetDeviceType(device_name);
1012 if (type == kDeviceAppleKeyboard) { 1012 if (type == kDeviceAppleKeyboard) {
1013 VLOG(1) << "Apple keyboard '" << device_name << "' connected: " 1013 VLOG(1) << "Apple keyboard '" << device_name << "' connected: "
1014 << "id=" << device_id; 1014 << "id=" << device_id;
1015 } 1015 }
1016 // Always overwrite the existing device_id since the X server may reuse a 1016 // Always overwrite the existing device_id since the X server may reuse a
1017 // device id for an unattached device. 1017 // device id for an unattached device.
1018 device_id_to_type_[device_id] = type; 1018 device_id_to_type_[device_id] = type;
1019 return type; 1019 return type;
1020 } 1020 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/caps_lock_delegate_chromeos.cc ('k') | chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698