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

Side by Side Diff: chrome/browser/sync/glue/local_device_info_provider_impl.cc

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" 6 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
7 #include "chrome/common/chrome_version_info.h" 7 #include "chrome/common/channel_info.h"
8 #include "chrome/common/sync_util.h" 8 #include "chrome/common/sync_util.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "sync/util/get_session_name.h" 10 #include "sync/util/get_session_name.h"
11 #include "ui/base/device_form_factor.h" 11 #include "ui/base/device_form_factor.h"
12 12
13 namespace browser_sync { 13 namespace browser_sync {
14 14
15 namespace { 15 namespace {
16 16
17 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
(...skipping 22 matching lines...) Expand all
40 } // namespace 40 } // namespace
41 41
42 LocalDeviceInfoProviderImpl::LocalDeviceInfoProviderImpl() 42 LocalDeviceInfoProviderImpl::LocalDeviceInfoProviderImpl()
43 : weak_factory_(this) { 43 : weak_factory_(this) {
44 } 44 }
45 45
46 LocalDeviceInfoProviderImpl::~LocalDeviceInfoProviderImpl() { 46 LocalDeviceInfoProviderImpl::~LocalDeviceInfoProviderImpl() {
47 } 47 }
48 48
49 // static. 49 // static.
50 std::string LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( 50 std::string LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi() {
51 const chrome::VersionInfo& version_info) {
52 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 51 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
53 return MakeDesktopUserAgentForSync(version_info); 52 return MakeDesktopUserAgentForSync();
54 #elif defined(OS_CHROMEOS) 53 #elif defined(OS_CHROMEOS)
55 return MakeUserAgentForSync(version_info, "CROS "); 54 return MakeUserAgentForSync("CROS ");
56 #elif defined(OS_ANDROID) 55 #elif defined(OS_ANDROID)
57 if (IsTabletUI()) 56 if (IsTabletUI())
58 return MakeUserAgentForSync(version_info, "ANDROID-TABLET "); 57 return MakeUserAgentForSync("ANDROID-TABLET ");
59 else 58 else
60 return MakeUserAgentForSync(version_info, "ANDROID-PHONE "); 59 return MakeUserAgentForSync("ANDROID-PHONE ");
61 #endif 60 #endif
62 } 61 }
63 62
64 const sync_driver::DeviceInfo* 63 const sync_driver::DeviceInfo*
65 LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const { 64 LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const {
66 return local_device_info_.get(); 65 return local_device_info_.get();
67 } 66 }
68 67
69 std::string LocalDeviceInfoProviderImpl::GetLocalSyncCacheGUID() const { 68 std::string LocalDeviceInfoProviderImpl::GetLocalSyncCacheGUID() const {
70 return cache_guid_; 69 return cache_guid_;
(...skipping 16 matching lines...) Expand all
87 base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation, 86 base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation,
88 weak_factory_.GetWeakPtr(), 87 weak_factory_.GetWeakPtr(),
89 cache_guid, 88 cache_guid,
90 signin_scoped_device_id)); 89 signin_scoped_device_id));
91 } 90 }
92 91
93 void LocalDeviceInfoProviderImpl::InitializeContinuation( 92 void LocalDeviceInfoProviderImpl::InitializeContinuation(
94 const std::string& guid, 93 const std::string& guid,
95 const std::string& signin_scoped_device_id, 94 const std::string& signin_scoped_device_id,
96 const std::string& session_name) { 95 const std::string& session_name) {
97 chrome::VersionInfo version_info;
98
99 local_device_info_.reset( 96 local_device_info_.reset(
100 new sync_driver::DeviceInfo(guid, 97 new sync_driver::DeviceInfo(guid,
101 session_name, 98 session_name,
102 version_info.CreateVersionString(), 99 chrome::GetVersionString(),
103 MakeUserAgentForSyncApi(version_info), 100 MakeUserAgentForSyncApi(),
104 GetLocalDeviceType(), 101 GetLocalDeviceType(),
105 signin_scoped_device_id)); 102 signin_scoped_device_id));
106 103
107 // Notify observers. 104 // Notify observers.
108 callback_list_.Notify(); 105 callback_list_.Notify();
109 } 106 }
110 107
111 } // namespace browser_sync 108 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698