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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "sync/util/session_utils_android.h" | 23 #include "sync/util/session_utils_android.h" |
24 #endif | 24 #endif |
25 | 25 |
26 namespace syncer { | 26 namespace syncer { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 std::string GetSessionNameSynchronously() { | 30 std::string GetSessionNameSynchronously() { |
31 std::string session_name; | 31 std::string session_name; |
32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
33 // TODO(kochi): This is very ad hoc and fragile. http://crosbug.com/30619. | 33 // TODO(kochi): This is very ad hoc and fragile. http://crbug.com/126732. |
34 std::string board; | 34 std::string board; |
35 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; | 35 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; |
36 chromeos::system::StatisticsProvider* provider = | 36 chromeos::system::StatisticsProvider* provider = |
37 chromeos::system::StatisticsProvider::GetInstance(); | 37 chromeos::system::StatisticsProvider::GetInstance(); |
38 if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) | 38 if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) |
39 LOG(ERROR) << "Failed to get board information"; | 39 LOG(ERROR) << "Failed to get board information"; |
40 // Currently, only "stumpy" type of board is considered Chromebox, and | 40 // Currently, only "stumpy" type of board is considered Chromebox, and |
41 // anything else is Chromebook. | 41 // anything else is Chromebook. On these devices, session_name should look |
42 session_name = (board == "stumpy") ? "Chromebox" : "Chromebook"; | 42 // like "stumpy-signed-mp-v2keys" etc. The information can be checked on |
| 43 // "CHROMEOS_RELEASE_BOARD" line in chrome://system. |
| 44 session_name = board.substr(0, 6) == "stumpy" ? "Chromebox" : "Chromebook"; |
43 #elif defined(OS_LINUX) | 45 #elif defined(OS_LINUX) |
44 session_name = base::GetLinuxDistro(); | 46 session_name = base::GetLinuxDistro(); |
45 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
46 session_name = internal::GetHardwareModelName(); | 48 session_name = internal::GetHardwareModelName(); |
47 #elif defined(OS_WIN) | 49 #elif defined(OS_WIN) |
48 session_name = internal::GetComputerName(); | 50 session_name = internal::GetComputerName(); |
49 #elif defined(OS_ANDROID) | 51 #elif defined(OS_ANDROID) |
50 session_name = internal::GetModel(); | 52 session_name = internal::GetModel(); |
51 #endif | 53 #endif |
52 | 54 |
(...skipping 26 matching lines...) Expand all Loading... |
79 base::Bind(&OnSessionNameFilled, | 81 base::Bind(&OnSessionNameFilled, |
80 done_callback, | 82 done_callback, |
81 base::Owned(session_name))); | 83 base::Owned(session_name))); |
82 } | 84 } |
83 | 85 |
84 std::string GetSessionNameSynchronouslyForTesting() { | 86 std::string GetSessionNameSynchronouslyForTesting() { |
85 return GetSessionNameSynchronously(); | 87 return GetSessionNameSynchronously(); |
86 } | 88 } |
87 | 89 |
88 } // namespace syncer | 90 } // namespace syncer |
OLD | NEW |