diff options
-rw-r--r-- | sync/DEPS | 3 | ||||
-rw-r--r-- | sync/sync.gyp | 7 | ||||
-rw-r--r-- | sync/util/get_session_name.cc | 15 |
3 files changed, 23 insertions, 2 deletions
@@ -7,6 +7,9 @@ include_rules = [ "+base", "+build", "+testing", + # TODO(kochi): Remove this hack after "Chromebox" hack in get_session_name.cc + # is gone. + "+chrome/browser/chromeos/system", # Force subdirectories to explicitly define DEPS. "-sync", diff --git a/sync/sync.gyp b/sync/sync.gyp index bc6c263..97d493e 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -612,6 +612,13 @@ '../base/allocator/allocator.gyp:allocator', ], }], + ['OS=="linux" and chromeos==1', { + # TODO(kochi): Remove this once we get rid of dependency from + # get_session_name.cc. + 'dependencies': [ + '../chrome/chrome.gyp:browser', + ], + }], ], }, diff --git a/sync/util/get_session_name.cc b/sync/util/get_session_name.cc index a447b3e..5917191 100644 --- a/sync/util/get_session_name.cc +++ b/sync/util/get_session_name.cc @@ -11,7 +11,9 @@ #include "base/sys_info.h" #include "base/task_runner.h" -#if defined(OS_LINUX) +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/system/statistics_provider.h" +#elif defined(OS_LINUX) #include "base/linux_util.h" #elif defined(OS_MACOSX) #include "sync/util/get_session_name_mac.h" @@ -28,7 +30,16 @@ namespace { std::string GetSessionNameSynchronously() { std::string session_name; #if defined(OS_CHROMEOS) - session_name = "Chromebook"; + // TODO(kochi): This is very ad hoc and fragile. http://crosbug.com/30619. + std::string board; + const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; + chromeos::system::StatisticsProvider* provider = + chromeos::system::StatisticsProvider::GetInstance(); + if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) + LOG(ERROR) << "Failed to get board information"; + // Currently, only "stumpy" type of board is considered Chromebox, and + // anything else is Chromebook. + session_name = (board == "stumpy") ? "Chromebox" : "Chromebook"; #elif defined(OS_LINUX) session_name = base::GetLinuxDistro(); #elif defined(OS_MACOSX) |