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

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

Issue 50603005: Add cross-platform API to get the form factor of the device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small formatting changes Created 7 years, 1 month 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 (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 "chrome/browser/sync/glue/device_info.h" 5 #include "chrome/browser/sync/glue/device_info.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/chrome_version_info.h" 10 #include "chrome/common/chrome_version_info.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "sync/util/get_session_name.h" 13 #include "sync/util/get_session_name.h"
14 #include "ui/base/device_form_factor.h"
14 15
15 namespace browser_sync { 16 namespace browser_sync {
16 17
17 namespace { 18 namespace {
18 19
19 #if defined(OS_ANDROID) 20 #if defined(OS_ANDROID)
20 bool IsTabletUI() { 21 bool IsTabletUI() {
21 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI); 22 return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET;
22 } 23 }
23 #endif 24 #endif
24 25
25 // Converts VersionInfo::Channel to string for user-agent string. 26 // Converts VersionInfo::Channel to string for user-agent string.
26 std::string ChannelToString(chrome::VersionInfo::Channel channel) { 27 std::string ChannelToString(chrome::VersionInfo::Channel channel) {
27 switch (channel) { 28 switch (channel) {
28 case chrome::VersionInfo::CHANNEL_UNKNOWN: 29 case chrome::VersionInfo::CHANNEL_UNKNOWN:
29 return "unknown"; 30 return "unknown";
30 case chrome::VersionInfo::CHANNEL_CANARY: 31 case chrome::VersionInfo::CHANNEL_CANARY:
31 return "canary"; 32 return "canary";
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 guid, 235 guid,
235 session_name, 236 session_name,
236 version_info.CreateVersionString(), 237 version_info.CreateVersionString(),
237 MakeUserAgentForSyncApi(version_info), 238 MakeUserAgentForSyncApi(version_info),
238 GetLocalDeviceType()); 239 GetLocalDeviceType());
239 240
240 callback.Run(local_info); 241 callback.Run(local_info);
241 } 242 }
242 243
243 } // namespace browser_sync 244 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698