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

Unified Diff: chrome/common/sync_util.cc

Issue 1308313003: Componentize chrome/common/sync_util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 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 | « chrome/common/sync_util.h ('k') | chrome/common/sync_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/sync_util.cc
diff --git a/chrome/common/sync_util.cc b/chrome/common/sync_util.cc
deleted file mode 100644
index cd2f7e26ff76c7ec98b5bb3ba4db4ae33db26dba..0000000000000000000000000000000000000000
--- a/chrome/common/sync_util.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2015 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 "chrome/common/sync_util.h"
-
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "chrome/common/channel_info.h"
-#include "chrome/common/chrome_switches.h"
-#include "components/version_info/version_info.h"
-#include "url/gurl.h"
-
-namespace {
-
-// Converts version_info::Channel to string for user-agent string.
-std::string ChannelToString(version_info::Channel channel) {
- switch (channel) {
- case version_info::Channel::UNKNOWN:
- return "unknown";
- case version_info::Channel::CANARY:
- return "canary";
- case version_info::Channel::DEV:
- return "dev";
- case version_info::Channel::BETA:
- return "beta";
- case version_info::Channel::STABLE:
- return "stable";
- default:
- NOTREACHED();
- return "unknown";
- }
-}
-} // namespace
-
-namespace internal {
-const char* kSyncServerUrl = "https://clients4.google.com/chrome-sync";
-
-const char* kSyncDevServerUrl = "https://clients4.google.com/chrome-sync/dev";
-} // namespace internal
-
-GURL GetSyncServiceURL(const base::CommandLine& command_line) {
- // By default, dev, canary, and unbranded Chromium users will go to the
- // development servers. Development servers have more features than standard
- // sync servers. Users with officially-branded Chrome stable and beta builds
- // will go to the standard sync servers.
- GURL result(internal::kSyncDevServerUrl);
-
- version_info::Channel channel = chrome::GetChannel();
- if (channel == version_info::Channel::STABLE ||
- channel == version_info::Channel::BETA) {
- result = GURL(internal::kSyncServerUrl);
- }
-
- // Override the sync server URL from the command-line, if sync server
- // command-line argument exists.
- if (command_line.HasSwitch(switches::kSyncServiceURL)) {
- std::string value(
- command_line.GetSwitchValueASCII(switches::kSyncServiceURL));
- if (!value.empty()) {
- GURL custom_sync_url(value);
- if (custom_sync_url.is_valid()) {
- result = custom_sync_url;
- } else {
- LOG(WARNING) << "The following sync URL specified at the command-line "
- << "is invalid: " << value;
- }
- }
- }
- return result;
-}
-
-std::string MakeDesktopUserAgentForSync() {
- std::string system = "";
-#if defined(OS_WIN)
- system = "WIN ";
-#elif defined(OS_LINUX)
- system = "LINUX ";
-#elif defined(OS_FREEBSD)
- system = "FREEBSD ";
-#elif defined(OS_OPENBSD)
- system = "OPENBSD ";
-#elif defined(OS_MACOSX)
- system = "MAC ";
-#endif
- return MakeUserAgentForSync(system);
-}
-
-std::string MakeUserAgentForSync(const std::string& system) {
- std::string user_agent;
- user_agent = "Chrome ";
- user_agent += system;
- user_agent += version_info::GetVersionNumber();
- user_agent += " (" + version_info::GetLastChange() + ")";
- if (!version_info::IsOfficialBuild()) {
- user_agent += "-devel";
- } else {
- user_agent += " channel(" + ChannelToString(chrome::GetChannel()) + ")";
- }
- return user_agent;
-}
« no previous file with comments | « chrome/common/sync_util.h ('k') | chrome/common/sync_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698