| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "components/sync/device_info/local_device_info_util.h" |
| |
| #include "build/build_config.h" |
| #include "ui/base/device_form_factor.h" |
| |
| namespace syncer { |
| |
| sync_pb::SyncEnums::DeviceType GetLocalDeviceType() { |
| #if defined(OS_CHROMEOS) |
| return sync_pb::SyncEnums_DeviceType_TYPE_CROS; |
| #elif defined(OS_LINUX) |
| return sync_pb::SyncEnums_DeviceType_TYPE_LINUX; |
| #elif defined(OS_ANDROID) || defined(OS_IOS) |
| return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET |
| ? sync_pb::SyncEnums_DeviceType_TYPE_TABLET |
| : sync_pb::SyncEnums_DeviceType_TYPE_PHONE; |
| #elif defined(OS_MACOSX) |
| return sync_pb::SyncEnums_DeviceType_TYPE_MAC; |
| #elif defined(OS_WIN) |
| return sync_pb::SyncEnums_DeviceType_TYPE_WIN; |
| #else |
| return sync_pb::SyncEnums_DeviceType_TYPE_OTHER; |
| #endif |
| } |
| |
| } // namespace syncer |