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

Unified Diff: chrome/browser/web_resource/notification_promo.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: make functions under namespace ui 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_resource/notification_promo.cc
diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc
index 101643f7817cdee1906bcc8cd6bcee0746b4dc10..e2c7cb5821e7fa99f2c4e77f87fe5a8a5ccad313 100644
--- a/chrome/browser/web_resource/notification_promo.cc
+++ b/chrome/browser/web_resource/notification_promo.cc
@@ -24,13 +24,9 @@
#include "components/user_prefs/pref_registry_syncable.h"
#include "content/public/browser/user_metrics.h"
#include "net/base/url_util.h"
+#include "ui/base/device_form_factor.h"
#include "url/gurl.h"
-#if defined(OS_ANDROID)
-#include "base/command_line.h"
-#include "chrome/common/chrome_switches.h"
-#endif // defined(OS_ANDROID)
-
using content::UserMetricsAction;
namespace {
@@ -62,9 +58,9 @@ std::string PlatformString() {
#if defined(OS_WIN)
return "win";
#elif defined(OS_IOS)
- // TODO(noyau): add iOS-specific implementation
- const bool isTablet = false;
- return std::string("ios-") + (isTablet ? "tablet" : "phone");
+ ui::DeviceFormFactor form_factor = ui::GetDeviceFormFactor();
+ return std::string("ios-") +
+ (form_factor == ui::DEVICE_FORM_FACTOR_TABLET ? "tablet" : "phone");
#elif defined(OS_MACOSX)
return "mac";
#elif defined(OS_CHROMEOS)
@@ -72,9 +68,9 @@ std::string PlatformString() {
#elif defined(OS_LINUX)
return "linux";
#elif defined(OS_ANDROID)
Alexei Svitkine (slow) 2013/11/04 16:08:51 Can you move this block next to OS_IOS (how about
yao 2013/11/04 19:38:29 Done.
- const bool isTablet =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI);
- return std::string("android-") + (isTablet ? "tablet" : "phone");
+ ui::DeviceFormFactor form_factor = ui::GetDeviceFormFactor();
+ return (std::string("android-") +
Alexei Svitkine (slow) 2013/11/04 16:08:51 Nit: remove ( before std::string (and at the end),
yao 2013/11/04 19:38:29 Done.
+ (form_factor == ui::DEVICE_FORM_FACTOR_TABLET ? "tablet" : "phone"));
#else
return "none";
#endif

Powered by Google App Engine
This is Rietveld 408576698