OLD | NEW |
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 "sync/util/get_session_name.h" | 5 #include "sync/util/get_session_name.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
13 | 13 |
14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "chromeos/chromeos_switches.h" | 16 #include "chromeos/chromeos_switches.h" |
17 #elif defined(OS_LINUX) | 17 #elif defined(OS_LINUX) |
18 #include "base/linux_util.h" | 18 #include "sync/util/get_session_name_linux.h" |
19 #elif defined(OS_IOS) | 19 #elif defined(OS_IOS) |
20 #include "sync/util/get_session_name_ios.h" | 20 #include "sync/util/get_session_name_ios.h" |
21 #elif defined(OS_MACOSX) | 21 #elif defined(OS_MACOSX) |
22 #include "sync/util/get_session_name_mac.h" | 22 #include "sync/util/get_session_name_mac.h" |
23 #elif defined(OS_WIN) | 23 #elif defined(OS_WIN) |
24 #include "sync/util/get_session_name_win.h" | 24 #include "sync/util/get_session_name_win.h" |
25 #elif defined(OS_ANDROID) | 25 #elif defined(OS_ANDROID) |
26 #include "base/android/build_info.h" | 26 #include "base/android/build_info.h" |
27 #endif | 27 #endif |
28 | 28 |
(...skipping 24 matching lines...) Expand all Loading... |
53 } else { | 53 } else { |
54 LOG(ERROR) << "Failed to get board information"; | 54 LOG(ERROR) << "Failed to get board information"; |
55 } | 55 } |
56 | 56 |
57 // Currently, only "stumpy" type of board is considered Chromebox, and | 57 // Currently, only "stumpy" type of board is considered Chromebox, and |
58 // anything else is Chromebook. On these devices, session_name should look | 58 // anything else is Chromebook. On these devices, session_name should look |
59 // like "stumpy-signed-mp-v2keys" etc. The information can be checked on | 59 // like "stumpy-signed-mp-v2keys" etc. The information can be checked on |
60 // "CHROMEOS_RELEASE_BOARD" line in chrome://system. | 60 // "CHROMEOS_RELEASE_BOARD" line in chrome://system. |
61 session_name = board.substr(0, 6) == "stumpy" ? "Chromebox" : "Chromebook"; | 61 session_name = board.substr(0, 6) == "stumpy" ? "Chromebox" : "Chromebook"; |
62 #elif defined(OS_LINUX) | 62 #elif defined(OS_LINUX) |
63 session_name = base::GetLinuxDistro(); | 63 session_name = internal::GetHostname(); |
64 #elif defined(OS_IOS) | 64 #elif defined(OS_IOS) |
65 session_name = internal::GetComputerName(); | 65 session_name = internal::GetComputerName(); |
66 #elif defined(OS_MACOSX) | 66 #elif defined(OS_MACOSX) |
67 session_name = internal::GetHardwareModelName(); | 67 session_name = internal::GetHardwareModelName(); |
68 #elif defined(OS_WIN) | 68 #elif defined(OS_WIN) |
69 session_name = internal::GetComputerName(); | 69 session_name = internal::GetComputerName(); |
70 #elif defined(OS_ANDROID) | 70 #elif defined(OS_ANDROID) |
71 base::android::BuildInfo* android_build_info = | 71 base::android::BuildInfo* android_build_info = |
72 base::android::BuildInfo::GetInstance(); | 72 base::android::BuildInfo::GetInstance(); |
73 session_name = android_build_info->model(); | 73 session_name = android_build_info->model(); |
(...skipping 28 matching lines...) Expand all Loading... |
102 base::Bind(&OnSessionNameFilled, | 102 base::Bind(&OnSessionNameFilled, |
103 done_callback, | 103 done_callback, |
104 base::Owned(session_name))); | 104 base::Owned(session_name))); |
105 } | 105 } |
106 | 106 |
107 std::string GetSessionNameSynchronouslyForTesting() { | 107 std::string GetSessionNameSynchronouslyForTesting() { |
108 return GetSessionNameSynchronously(); | 108 return GetSessionNameSynchronously(); |
109 } | 109 } |
110 | 110 |
111 } // namespace syncer | 111 } // namespace syncer |
OLD | NEW |