Commit cfea5058 authored by Yuta Hijikata's avatar Yuta Hijikata Committed by Chromium LUCI CQ

LaCrOS: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_CHROMEOS_ASH)

The change is mostly mechanical replacing defined(OS_CHROMEOS) with
BUILDFLAG(IS_CHROMEOS_ASH) and GN variable is_chromeos with is_ash
with some special cases (For those cases please refer to
https://chromium.googlesource.com/chromium/src.git/+/master/docs/lacros.md#gn-var-and-c_macros-for-lacros).

The patch is made in preparation to switching lacros build from
target_os=linux to target_os=chromeos. This will prevent lacros from
changing behaviour after the switch.

Bug: 1052397
Change-Id: I17c77521ce2902225352e425cc4a6dfb94a939b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536429Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835022}
parent 0976b66f
...@@ -146,6 +146,7 @@ component("events_base") { ...@@ -146,6 +146,7 @@ component("events_base") {
deps = [ deps = [
":dom_keycode_converter", ":dom_keycode_converter",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",
"//build:chromeos_buildflags",
] ]
public_deps = [ public_deps = [
...@@ -346,6 +347,8 @@ component("events") { ...@@ -346,6 +347,8 @@ component("events") {
"gestures/gesture_recognizer_impl.cc", "gestures/gesture_recognizer_impl.cc",
"gestures/motion_event_aura.cc", "gestures/motion_event_aura.cc",
] ]
deps += [ "//build:chromeos_buildflags" ]
} }
if (is_win || is_mac || use_x11 || use_ozone) { if (is_win || is_mac || use_x11 || use_ozone) {
...@@ -437,6 +440,7 @@ component("gesture_detection") { ...@@ -437,6 +440,7 @@ component("gesture_detection") {
":events_base", ":events_base",
"//base", "//base",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",
"//build:chromeos_buildflags",
"//ui/display", "//ui/display",
"//ui/gfx", "//ui/gfx",
"//ui/gfx/geometry", "//ui/gfx/geometry",
...@@ -503,6 +507,7 @@ static_library("test_support") { ...@@ -503,6 +507,7 @@ static_library("test_support") {
] ]
deps = [ deps = [
"//base", "//base",
"//build:chromeos_buildflags",
"//skia", "//skia",
"//ui/events/platform", "//ui/events/platform",
"//ui/gfx", "//ui/gfx",
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/events/event_switches.h" #include "ui/events/event_switches.h"
...@@ -17,14 +18,14 @@ namespace ui { ...@@ -17,14 +18,14 @@ namespace ui {
namespace { namespace {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN; const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN;
#elif defined(OS_APPLE) #elif defined(OS_APPLE)
// Alt modifier is used to input extended characters on Mac. // Alt modifier is used to input extended characters on Mac.
const int kSystemKeyModifierMask = EF_COMMAND_DOWN; const int kSystemKeyModifierMask = EF_COMMAND_DOWN;
#else #else
const int kSystemKeyModifierMask = EF_ALT_DOWN; const int kSystemKeyModifierMask = EF_ALT_DOWN;
#endif // !defined(OS_CHROMEOS) && !defined(OS_APPLE) #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_APPLE)
bool IsValidTimebase(base::TimeTicks now, base::TimeTicks timestamp) { bool IsValidTimebase(base::TimeTicks now, base::TimeTicks timestamp) {
int64_t delta = (now - timestamp).InMilliseconds(); int64_t delta = (now - timestamp).InMilliseconds();
......
...@@ -26,6 +26,7 @@ component("x11") { ...@@ -26,6 +26,7 @@ component("x11") {
deps = [ deps = [
"//base", "//base",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",
"//build:chromeos_buildflags",
"//skia", "//skia",
"//ui/display", "//ui/display",
"//ui/events:events_base", "//ui/events:events_base",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/system/sys_info.h" #include "base/system/sys_info.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/base_event_utils.h" #include "ui/events/base_event_utils.h"
#include "ui/events/devices/x11/device_data_manager_x11.h" #include "ui/events/devices/x11/device_data_manager_x11.h"
#include "ui/events/devices/x11/device_list_cache_x11.h" #include "ui/events/devices/x11/device_list_cache_x11.h"
...@@ -222,7 +223,7 @@ void TouchFactory::SetupXI2ForXWindow(x11::Window window) { ...@@ -222,7 +223,7 @@ void TouchFactory::SetupXI2ForXWindow(x11::Window window) {
// these events. // these events.
SetXinputMask(mask_data, x11::Input::HierarchyEvent::opcode); SetXinputMask(mask_data, x11::Input::HierarchyEvent::opcode);
SetXinputMask(mask_data, x11::Input::DeviceChangedEvent::opcode); SetXinputMask(mask_data, x11::Input::DeviceChangedEvent::opcode);
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (base::SysInfo::IsRunningOnChromeOS()) { if (base::SysInfo::IsRunningOnChromeOS()) {
SetXinputMask(mask_data, x11::Input::DeviceEvent::KeyPress); SetXinputMask(mask_data, x11::Input::DeviceEvent::KeyPress);
SetXinputMask(mask_data, x11::Input::DeviceEvent::KeyRelease); SetXinputMask(mask_data, x11::Input::DeviceEvent::KeyRelease);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/events/gesture_detection/gesture_configuration.h" #include "ui/events/gesture_detection/gesture_configuration.h"
#include "build/chromeos_buildflags.h"
namespace ui { namespace ui {
namespace { namespace {
...@@ -49,16 +51,16 @@ GestureConfiguration::GestureConfiguration() ...@@ -49,16 +51,16 @@ GestureConfiguration::GestureConfiguration()
// See crbug.com/357237 for details. // See crbug.com/357237 for details.
min_scaling_span_in_pixels_(125), min_scaling_span_in_pixels_(125),
min_swipe_velocity_(20), min_swipe_velocity_(20),
// TODO(jdduke): Disable and remove entirely when issues with intermittent // TODO(jdduke): Disable and remove entirely when issues with intermittent
// scroll end detection on the Pixel are resolved, crbug.com/353702. // scroll end detection on the Pixel are resolved, crbug.com/353702.
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
scroll_debounce_interval_in_ms_(30), scroll_debounce_interval_in_ms_(30),
#else #else
scroll_debounce_interval_in_ms_(0), scroll_debounce_interval_in_ms_(0),
#endif #endif
semi_long_press_time_in_ms_(400), semi_long_press_time_in_ms_(400),
show_press_delay_in_ms_(150), show_press_delay_in_ms_(150),
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
single_pointer_cancel_enabled_(true), single_pointer_cancel_enabled_(true),
#else #else
single_pointer_cancel_enabled_(false), single_pointer_cancel_enabled_(false),
......
...@@ -7,16 +7,17 @@ ...@@ -7,16 +7,17 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event_switches.h" #include "ui/events/event_switches.h"
namespace ui { namespace ui {
namespace { namespace {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr bool kDoubleTapAuraSupport = true; constexpr bool kDoubleTapAuraSupport = true;
#else #else
constexpr bool kDoubleTapAuraSupport = false; constexpr bool kDoubleTapAuraSupport = false;
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
class GestureConfigurationAura : public GestureConfiguration { class GestureConfigurationAura : public GestureConfiguration {
public: public:
...@@ -29,7 +30,7 @@ class GestureConfigurationAura : public GestureConfiguration { ...@@ -29,7 +30,7 @@ class GestureConfigurationAura : public GestureConfiguration {
private: private:
GestureConfigurationAura() : GestureConfiguration() { GestureConfigurationAura() : GestureConfiguration() {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// On ChromeOS, use 6 which is derived from the android's default(8), // On ChromeOS, use 6 which is derived from the android's default(8),
// multiplied by base dpi ratio(0.75). See crbug.com/1083120 for more // multiplied by base dpi ratio(0.75). See crbug.com/1083120 for more
// details. // details.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/events/gesture_detection/gesture_listeners.h" #include "ui/events/gesture_detection/gesture_listeners.h"
#include "ui/events/gesture_detection/motion_event.h" #include "ui/events/gesture_detection/motion_event.h"
...@@ -52,7 +53,7 @@ GestureDetector::Config::Config() ...@@ -52,7 +53,7 @@ GestureDetector::Config::Config()
two_finger_tap_max_separation(300), two_finger_tap_max_separation(300),
two_finger_tap_timeout(base::TimeDelta::FromMilliseconds(700)), two_finger_tap_timeout(base::TimeDelta::FromMilliseconds(700)),
single_tap_repeat_interval(1), single_tap_repeat_interval(1),
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
stylus_button_accelerated_longpress_enabled(true), stylus_button_accelerated_longpress_enabled(true),
#else #else
stylus_button_accelerated_longpress_enabled(false), stylus_button_accelerated_longpress_enabled(false),
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "base/check.h" #include "base/check.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/gesture_detection/gesture_configuration.h" #include "ui/events/gesture_detection/gesture_configuration.h"
...@@ -18,11 +19,11 @@ namespace ui { ...@@ -18,11 +19,11 @@ namespace ui {
namespace { namespace {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr bool kDoubleTapPlatformSupport = true; constexpr bool kDoubleTapPlatformSupport = true;
#else #else
constexpr bool kDoubleTapPlatformSupport = false; constexpr bool kDoubleTapPlatformSupport = false;
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
} // namespace } // namespace
......
...@@ -21,6 +21,7 @@ source_set("xkb") { ...@@ -21,6 +21,7 @@ source_set("xkb") {
deps = [ deps = [
"//base", "//base",
"//build:chromeos_buildflags",
"//ui/events:dom_keycode_converter", "//ui/events:dom_keycode_converter",
] ]
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ui/events/keycodes/keyboard_code_conversion_xkb.h" #include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/keycodes/dom/dom_key.h" #include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/keyboard_code_conversion_xkb.h" #include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "ui/gfx/x/keysyms/keysyms.h" #include "ui/gfx/x/keysyms/keysyms.h"
...@@ -202,7 +203,7 @@ DomKey NonPrintableXKeySymToDomKey(xkb_keysym_t keysym) { ...@@ -202,7 +203,7 @@ DomKey NonPrintableXKeySymToDomKey(xkb_keysym_t keysym) {
return DomKey::CONTROL; return DomKey::CONTROL;
case XKB_KEY_Caps_Lock: case XKB_KEY_Caps_Lock:
return DomKey::CAPS_LOCK; return DomKey::CAPS_LOCK;
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
case XKB_KEY_Meta_L: case XKB_KEY_Meta_L:
case XKB_KEY_Meta_R: case XKB_KEY_Meta_R:
case XKB_KEY_Alt_L: case XKB_KEY_Alt_L:
...@@ -217,7 +218,7 @@ DomKey NonPrintableXKeySymToDomKey(xkb_keysym_t keysym) { ...@@ -217,7 +218,7 @@ DomKey NonPrintableXKeySymToDomKey(xkb_keysym_t keysym) {
case XKB_KEY_Alt_L: case XKB_KEY_Alt_L:
case XKB_KEY_Alt_R: case XKB_KEY_Alt_R:
return DomKey::ALT; return DomKey::ALT;
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
case XKB_KEY_Super_L: case XKB_KEY_Super_L:
case XKB_KEY_Super_R: case XKB_KEY_Super_R:
return DomKey::META; return DomKey::META;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
...@@ -41,7 +42,7 @@ component("ozone") { ...@@ -41,7 +42,7 @@ component("ozone") {
defines = [ "IS_EVENTS_OZONE_IMPL" ] defines = [ "IS_EVENTS_OZONE_IMPL" ]
if (is_chromeos) { if (is_chromeos_ash) {
sources += [ sources += [
"chromeos/cursor_controller.cc", "chromeos/cursor_controller.cc",
"chromeos/cursor_controller.h", "chromeos/cursor_controller.h",
...@@ -72,7 +73,7 @@ source_set("unittests") { ...@@ -72,7 +73,7 @@ source_set("unittests") {
"//ui/gfx/geometry", "//ui/gfx/geometry",
] ]
if (is_chromeos) { if (is_chromeos_ash) {
sources += [ "chromeos/cursor_controller_unittest.cc" ] sources += [ "chromeos/cursor_controller_unittest.cc" ]
} }
......
...@@ -107,6 +107,7 @@ component("evdev") { ...@@ -107,6 +107,7 @@ component("evdev") {
deps = [ deps = [
"//base", "//base",
"//build:chromeos_buildflags",
"//ui/display", "//ui/display",
"//ui/events", "//ui/events",
"//ui/events:dom_keycode_converter", "//ui/events:dom_keycode_converter",
...@@ -186,6 +187,7 @@ source_set("unittests") { ...@@ -186,6 +187,7 @@ source_set("unittests") {
":evdev", ":evdev",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//build:chromeos_buildflags",
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
"//ui/events", "//ui/events",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h"
namespace ui { namespace ui {
...@@ -226,13 +227,13 @@ void DumpTouchEventLog( ...@@ -226,13 +227,13 @@ void DumpTouchEventLog(
if (converter->HasTouchscreen()) { if (converter->HasTouchscreen()) {
std::string touch_evdev_log_filename = GenerateEventLogName( std::string touch_evdev_log_filename = GenerateEventLogName(
out_dir, "evdev_input_events_", now, converter->id()); out_dir, "evdev_input_events_", now, converter->id());
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
converter->DumpTouchEventLog(touch_evdev_log_filename.c_str()); converter->DumpTouchEventLog(touch_evdev_log_filename.c_str());
#else #else
converter->DumpTouchEventLog(kInputEventsLogFile); converter->DumpTouchEventLog(kInputEventsLogFile);
base::Move(base::FilePath(kInputEventsLogFile), base::Move(base::FilePath(kInputEventsLogFile),
base::FilePath(touch_evdev_log_filename)); base::FilePath(touch_evdev_log_filename));
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
log_paths.push_back(base::FilePath(touch_evdev_log_filename)); log_paths.push_back(base::FilePath(touch_evdev_log_filename));
} }
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/system/sys_info.h" #include "base/system/sys_info.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/ozone/evdev/event_device_info.h" #include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter.h" #include "ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.h" #include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.h"
...@@ -62,7 +63,7 @@ std::string FetchNeuralPalmRadiusPolynomial(const EventDeviceInfo& devinfo, ...@@ -62,7 +63,7 @@ std::string FetchNeuralPalmRadiusPolynomial(const EventDeviceInfo& devinfo,
} }
// TODO(robsc): Remove this when comfortable. // TODO(robsc): Remove this when comfortable.
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// We should really only be running in chromeos anyway; We do a check here // We should really only be running in chromeos anyway; We do a check here
// temporarily for hatch and reef. These numbers should live in config on // temporarily for hatch and reef. These numbers should live in config on
// chromeos side but for now during experiment are hard-coded here. // chromeos side but for now during experiment are hard-coded here.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/test/scoped_chromeos_version_info.h" #include "base/test/scoped_chromeos_version_info.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/ozone/evdev/event_device_info.h" #include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/event_device_test_util.h" #include "ui/events/ozone/evdev/event_device_test_util.h"
...@@ -51,7 +52,7 @@ class PalmDetectionFilterFactoryTest : public testing::Test { ...@@ -51,7 +52,7 @@ class PalmDetectionFilterFactoryTest : public testing::Test {
class PalmDetectionFilterFactoryDeathTest class PalmDetectionFilterFactoryDeathTest
: public PalmDetectionFilterFactoryTest {}; : public PalmDetectionFilterFactoryTest {};
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(PalmDetectionFilterFactoryTest, RadiusesFromLSBRelease) { TEST_F(PalmDetectionFilterFactoryTest, RadiusesFromLSBRelease) {
{ {
base::test::ScopedChromeOSVersionInfo version( base::test::ScopedChromeOSVersionInfo version(
......
...@@ -48,7 +48,10 @@ component("layout") { ...@@ -48,7 +48,10 @@ component("layout") {
"xkb/xkb_keyboard_layout_engine.h", "xkb/xkb_keyboard_layout_engine.h",
] ]
deps += [ "//ui/events/keycodes:xkb" ] deps += [
"//build:chromeos_buildflags",
"//ui/events/keycodes:xkb",
]
} }
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "base/task_runner.h" #include "base/task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/dom_key.h" #include "ui/events/keycodes/dom/dom_key.h"
...@@ -610,7 +611,7 @@ const PrintableSimpleEntry kSimpleMap[] = { ...@@ -610,7 +611,7 @@ const PrintableSimpleEntry kSimpleMap[] = {
{0x0259, VKEY_OEM_3}, // schwa {0x0259, VKEY_OEM_3}, // schwa
}; };
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
void LoadKeymap(const std::string& layout_name, void LoadKeymap(const std::string& layout_name,
scoped_refptr<base::SingleThreadTaskRunner> reply_runner, scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
LoadKeymapCallback reply_callback) { LoadKeymapCallback reply_callback) {
...@@ -669,7 +670,7 @@ XkbKeyboardLayoutEngine::~XkbKeyboardLayoutEngine() { ...@@ -669,7 +670,7 @@ XkbKeyboardLayoutEngine::~XkbKeyboardLayoutEngine() {
} }
bool XkbKeyboardLayoutEngine::CanSetCurrentLayout() const { bool XkbKeyboardLayoutEngine::CanSetCurrentLayout() const {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
return true; return true;
#else #else
return false; return false;
...@@ -678,7 +679,7 @@ bool XkbKeyboardLayoutEngine::CanSetCurrentLayout() const { ...@@ -678,7 +679,7 @@ bool XkbKeyboardLayoutEngine::CanSetCurrentLayout() const {
bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName( bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName(
const std::string& layout_name) { const std::string& layout_name) {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
current_layout_name_ = layout_name; current_layout_name_ = layout_name;
for (const auto& entry : xkb_keymaps_) { for (const auto& entry : xkb_keymaps_) {
if (entry.layout_name == layout_name) { if (entry.layout_name == layout_name) {
...@@ -696,7 +697,7 @@ bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName( ...@@ -696,7 +697,7 @@ bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName(
std::move(reply_callback))); std::move(reply_callback)));
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
return true; return true;
} }
...@@ -877,7 +878,7 @@ void XkbKeyboardLayoutEngine::SetKeymap(xkb_keymap* keymap) { ...@@ -877,7 +878,7 @@ void XkbKeyboardLayoutEngine::SetKeymap(xkb_keymap* keymap) {
} }
layout_index_ = 0; layout_index_ = 0;
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// Update num lock mask. // Update num lock mask.
num_lock_mod_mask_ = num_lock_mask; num_lock_mod_mask_ = num_lock_mask;
#endif #endif
...@@ -892,7 +893,7 @@ xkb_mod_mask_t XkbKeyboardLayoutEngine::EventFlagsToXkbFlags( ...@@ -892,7 +893,7 @@ xkb_mod_mask_t XkbKeyboardLayoutEngine::EventFlagsToXkbFlags(
if (ui_flags & entry.ui_flag) if (ui_flags & entry.ui_flag)
xkb_flags |= entry.xkb_flag; xkb_flags |= entry.xkb_flag;
} }
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// In ChromeOS NumLock is always on. // In ChromeOS NumLock is always on.
xkb_flags |= num_lock_mod_mask_; xkb_flags |= num_lock_mod_mask_;
#endif #endif
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/task_runner.h" #include "base/task_runner.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/keycodes/scoped_xkb.h" #include "ui/events/keycodes/scoped_xkb.h"
#include "ui/events/ozone/layout/keyboard_layout_engine.h" #include "ui/events/ozone/layout/keyboard_layout_engine.h"
#include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h" #include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h"
...@@ -75,7 +76,7 @@ class COMPONENT_EXPORT(EVENTS_OZONE_LAYOUT) XkbKeyboardLayoutEngine ...@@ -75,7 +76,7 @@ class COMPONENT_EXPORT(EVENTS_OZONE_LAYOUT) XkbKeyboardLayoutEngine
// kept. // kept.
base::flat_map<uint32_t, uint32_t> xkb_keysym_map_; base::flat_map<uint32_t, uint32_t> xkb_keysym_map_;
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// Flag mask for num lock, which is always considered enabled in ChromeOS. // Flag mask for num lock, which is always considered enabled in ChromeOS.
xkb_mod_mask_t num_lock_mod_mask_ = 0; xkb_mod_mask_t num_lock_mod_mask_ = 0;
#endif #endif
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/ozone.gni") import("//build/config/ozone.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
...@@ -33,11 +34,12 @@ component("x11") { ...@@ -33,11 +34,12 @@ component("x11") {
deps = [ deps = [
"//base", "//base",
"//build:chromeos_buildflags",
"//ui/base:features", "//ui/base:features",
"//ui/events/keycodes:x11", "//ui/events/keycodes:x11",
] ]
if (is_chromeos) { if (is_chromeos_ash) {
deps += [ "//ui/events/ozone" ] deps += [ "//ui/events/ozone" ]
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/memory/free_deleter.h" #include "base/memory/free_deleter.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/devices/x11/device_data_manager_x11.h" #include "ui/events/devices/x11/device_data_manager_x11.h"
#include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/devices/x11/touch_factory_x11.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
#include "ui/events/platform/x11/x11_event_watcher_fdwatch.h" #include "ui/events/platform/x11/x11_event_watcher_fdwatch.h"
#endif #endif
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/events/ozone/chromeos/cursor_controller.h" #include "ui/events/ozone/chromeos/cursor_controller.h"
#endif #endif
...@@ -323,7 +324,7 @@ void X11EventSource::ProcessXEvent(x11::Event* xevent) { ...@@ -323,7 +324,7 @@ void X11EventSource::ProcessXEvent(x11::Event* xevent) {
return; return;
} }
if (translated_event && translated_event->type() != ET_UNKNOWN) { if (translated_event && translated_event->type() != ET_UNKNOWN) {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (translated_event->IsLocatedEvent()) { if (translated_event->IsLocatedEvent()) {
ui::CursorController::GetInstance()->SetCursorLocation( ui::CursorController::GetInstance()->SetCursorLocation(
translated_event->AsLocatedEvent()->location_f()); translated_event->AsLocatedEvent()->location_f());
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/tick_clock.h" #include "base/time/tick_clock.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_source.h" #include "ui/events/event_source.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
...@@ -177,7 +178,7 @@ void EventGenerator::SendMouseExit() { ...@@ -177,7 +178,7 @@ void EventGenerator::SendMouseExit() {
Dispatch(&mouseev); Dispatch(&mouseev);
} }
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
void EventGenerator::MoveMouseToWithNative(const gfx::Point& point_in_host, void EventGenerator::MoveMouseToWithNative(const gfx::Point& point_in_host,
const gfx::Point& point_for_native) { const gfx::Point& point_for_native) {
// Ozone uses the location in native event as a system location. // Ozone uses the location in native event as a system location.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_dispatcher.h" #include "ui/events/event_dispatcher.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
...@@ -224,7 +225,7 @@ class EventGenerator { ...@@ -224,7 +225,7 @@ class EventGenerator {
MoveMouseToInHost(gfx::Point(x, y)); MoveMouseToInHost(gfx::Point(x, y));
} }
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// Generates a mouse move event at the point given in the host // Generates a mouse move event at the point given in the host
// coordinates, with a native event with |point_for_natve|. // coordinates, with a native event with |point_for_natve|.
void MoveMouseToWithNative(const gfx::Point& point_in_host, void MoveMouseToWithNative(const gfx::Point& point_in_host,
......
...@@ -19,6 +19,7 @@ component("x") { ...@@ -19,6 +19,7 @@ component("x") {
defines = [ "EVENTS_X_IMPLEMENTATION" ] defines = [ "EVENTS_X_IMPLEMENTATION" ]
deps = [ deps = [
"//base", "//base",
"//build:chromeos_buildflags",
"//skia", "//skia",
"//ui/base:features", "//ui/base:features",
"//ui/display", "//ui/display",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/events/base_event_utils.h" #include "ui/events/base_event_utils.h"
...@@ -161,7 +162,7 @@ int GetEventFlagsFromXKeyEvent(const x11::Event& xev) { ...@@ -161,7 +162,7 @@ int GetEventFlagsFromXKeyEvent(const x11::Event& xev) {
DCHECK(key); DCHECK(key);
const auto state = static_cast<int>(key->state); const auto state = static_cast<int>(key->state);
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
const int ime_fabricated_flag = 0; const int ime_fabricated_flag = 0;
#else #else
// XIM fabricates key events for the character compositions by XK_Multi_key. // XIM fabricates key events for the character compositions by XK_Multi_key.
...@@ -563,7 +564,7 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) { ...@@ -563,7 +564,7 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) {
if (auto* xievent = xev.As<x11::Input::DeviceEvent>()) { if (auto* xievent = xev.As<x11::Input::DeviceEvent>()) {
float x = Fp1616ToDouble(xievent->event_x); float x = Fp1616ToDouble(xievent->event_x);
float y = Fp1616ToDouble(xievent->event_y); float y = Fp1616ToDouble(xievent->event_y);
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
switch (xievent->opcode) { switch (xievent->opcode) {
case x11::Input::DeviceEvent::TouchBegin: case x11::Input::DeviceEvent::TouchBegin:
case x11::Input::DeviceEvent::TouchUpdate: case x11::Input::DeviceEvent::TouchUpdate:
...@@ -574,7 +575,7 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) { ...@@ -574,7 +575,7 @@ gfx::Point EventLocationFromXEvent(const x11::Event& xev) {
default: default:
break; break;
} }
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
return gfx::Point(static_cast<int>(x), static_cast<int>(y)); return gfx::Point(static_cast<int>(x), static_cast<int>(y));
} }
return gfx::Point(); return gfx::Point();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment