Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: sync/util/get_session_name.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/util/get_session_name.h ('k') | sync/util/get_session_name_ios.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/util/get_session_name.cc
diff --git a/sync/util/get_session_name.cc b/sync/util/get_session_name.cc
deleted file mode 100644
index 1d4ba42988b0776d19ffd3d7651279bef3d8bb0a..0000000000000000000000000000000000000000
--- a/sync/util/get_session_name.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) 2012 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 "sync/util/get_session_name.h"
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/location.h"
-#include "base/strings/string_util.h"
-#include "base/sys_info.h"
-#include "base/task_runner.h"
-#include "build/build_config.h"
-
-#if defined(OS_CHROMEOS)
-#include "chromeos/system/devicetype.h"
-#elif defined(OS_LINUX)
-#include "sync/util/get_session_name_linux.h"
-#elif defined(OS_IOS)
-#include "sync/util/get_session_name_ios.h"
-#elif defined(OS_MACOSX)
-#include "sync/util/get_session_name_mac.h"
-#elif defined(OS_WIN)
-#include "sync/util/get_session_name_win.h"
-#elif defined(OS_ANDROID)
-#include "base/android/build_info.h"
-#endif
-
-namespace syncer {
-
-namespace {
-
-std::string GetSessionNameSynchronously() {
- std::string session_name;
-#if defined(OS_CHROMEOS)
- switch (chromeos::GetDeviceType()) {
- case chromeos::DeviceType::kChromebase:
- session_name = "Chromebase";
- break;
- case chromeos::DeviceType::kChromebit:
- session_name = "Chromebit";
- break;
- case chromeos::DeviceType::kChromebook:
- session_name = "Chromebook";
- break;
- case chromeos::DeviceType::kChromebox:
- session_name = "Chromebox";
- break;
- case chromeos::DeviceType::kUnknown:
- session_name = "Chromebook";
- break;
- }
-#elif defined(OS_LINUX)
- session_name = internal::GetHostname();
-#elif defined(OS_IOS)
- session_name = internal::GetComputerName();
-#elif defined(OS_MACOSX)
- session_name = internal::GetHardwareModelName();
-#elif defined(OS_WIN)
- session_name = internal::GetComputerName();
-#elif defined(OS_ANDROID)
- base::android::BuildInfo* android_build_info =
- base::android::BuildInfo::GetInstance();
- session_name = android_build_info->model();
-#endif
-
- if (session_name == "Unknown" || session_name.empty())
- session_name = base::SysInfo::OperatingSystemName();
-
- DCHECK(base::IsStringUTF8(session_name));
- return session_name;
-}
-
-void FillSessionName(std::string* session_name) {
- *session_name = GetSessionNameSynchronously();
-}
-
-void OnSessionNameFilled(
- const base::Callback<void(const std::string&)>& done_callback,
- std::string* session_name) {
- done_callback.Run(*session_name);
-}
-
-} // namespace
-
-void GetSessionName(
- const scoped_refptr<base::TaskRunner>& task_runner,
- const base::Callback<void(const std::string&)>& done_callback) {
- std::string* session_name = new std::string();
- task_runner->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&FillSessionName,
- base::Unretained(session_name)),
- base::Bind(&OnSessionNameFilled,
- done_callback,
- base::Owned(session_name)));
-}
-
-std::string GetSessionNameSynchronouslyForTesting() {
- return GetSessionNameSynchronously();
-}
-
-} // namespace syncer
« no previous file with comments | « sync/util/get_session_name.h ('k') | sync/util/get_session_name_ios.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698