Commit 7c714036 authored by benm@chromium.org's avatar benm@chromium.org

Tidy up Android's is-tablet functionality.

Remove the code in sync/ that checks if the device is a tablet
and perform the check in the chrome/ layer based upon a
command line switch.

Additionally, rather than looking for a tablet when (not) setting
the Mobile specific user agent, look for --use-mobile-user-agent. The
embedder should set these command line switches as appropriate, so
remove the code that used to set them in the generic process startup.


Review URL: https://chromiumcodereview.appspot.com/10808052

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148091 0039d316-1c4b-4281-b951-d872f2087c98
parent d1ef81d1
......@@ -28,11 +28,6 @@ void SetCommandLineSwitchASCII(const std::string& switch_string,
command_line->AppendSwitchASCII(switch_string, value);
}
bool IsTabletUi() {
NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this";
return false;
}
} // namespace
void SetChromeSpecificCommandLineFlags() {
......@@ -45,10 +40,6 @@ void SetChromeSpecificCommandLineFlags() {
// Turn on autologin.
SetCommandLineSwitch(switches::kEnableAutologin);
// Tablet UI switch (used for using correct version of NTP HTML).
if (IsTabletUi())
SetCommandLineSwitch(switches::kTabletUi);
// Enable prerender for the omnibox.
SetCommandLineSwitchASCII(
switches::kPrerenderMode, switches::kPrerenderModeSwitchValueEnabled);
......
......@@ -68,6 +68,12 @@ static const int kMaxSyncNavigationCount = 6;
// stale and becomes a candidate for garbage collection.
static const size_t kDefaultStaleSessionThresholdDays = 14; // 2 weeks.
#if defined(OS_ANDROID)
bool IsTabletUI() {
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI);
}
#endif
sync_pb::SessionHeader::DeviceType GetLocalDeviceType() {
// TODO(yfriedman): Refactor/combine with "DeviceInformation" code in
// sync_manager.cc[1060]
......@@ -80,7 +86,7 @@ sync_pb::SessionHeader::DeviceType GetLocalDeviceType() {
#elif defined(OS_WIN)
return sync_pb::SessionHeader_DeviceType_TYPE_WIN;
#elif defined(OS_ANDROID)
return syncer::internal::IsTabletUi() ?
return IsTabletUI() ?
sync_pb::SessionHeader_DeviceType_TYPE_TABLET :
sync_pb::SessionHeader_DeviceType_TYPE_PHONE;
#else
......
......@@ -80,7 +80,7 @@ void NTPResourceCache::CreateNewTabHTML() {
ui::SCALE_FACTOR_NONE));
localized_strings.SetString(
"device",
CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUi) ?
CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ?
"tablet" : "phone");
const char* new_tab_link = kLearnMoreIncognitoUrl;
string16 learnMoreLink = ASCIIToUTF16(
......
......@@ -75,7 +75,7 @@ std::string PlatformString() {
return "linux";
#elif defined(OS_ANDROID)
const bool isTablet =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUi);
CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI);
return std::string("android-") + (isTablet ? "tablet" : "phone");
#else
return "none";
......
......@@ -438,7 +438,7 @@ std::string ChromeContentClient::GetUserAgent() const {
product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
#if defined(OS_ANDROID)
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kTabletUi)) {
if (!command_line->HasSwitch(switches::kUseMobileUserAgent)) {
product += " Mobile";
}
#endif
......
......@@ -1337,7 +1337,7 @@ const char kWinHttpProxyResolver[] = "winhttp-proxy-resolver";
#if defined(OS_ANDROID)
// Use the tablet specific UI components when available.
const char kTabletUi[] = "tablet-ui";
const char kTabletUI[] = "tablet-ui";
#endif
#if defined(OS_CHROMEOS)
......
......@@ -359,7 +359,7 @@ extern const char kWindowSize[];
extern const char kWinHttpProxyResolver[];
#if defined(OS_ANDROID)
extern const char kTabletUi[];
extern const char kTabletUI[];
#endif
#if defined(OS_CHROMEOS)
......
......@@ -43,6 +43,9 @@ public abstract class CommandLine {
// Dump frames-per-second to the log
public static final String LOG_FPS = "log-fps";
// Whether Chromium should use a mobile user agent.
public static final String USE_MOBILE_UA = "use-mobile-user-agent";
// Public abstract interface, implemented in derived classes.
// All these methods reflect their native-side counterparts.
/**
......
......@@ -631,6 +631,11 @@ const char kZygoteProcess[] = "zygote";
// Enables moving cursor by word in visual order.
const char kEnableVisualWordMovement[] = "enable-visual-word-movement";
#if defined(OS_ANDROID)
// Set when Chromium should use a mobile user agent.
const char kUseMobileUserAgent[] = "use-mobile-user-agent";
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Specify the amount the trackpad should scroll by.
const char kScrollPixels[] = "scroll-pixels";
......
......@@ -197,6 +197,10 @@ CONTENT_EXPORT extern const char kFixedPositionCreatesStackingContext[];
extern const char kEnableVisualWordMovement[];
#if defined(OS_ANDROID)
extern const char kUseMobileUserAgent[];
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
extern const char kScrollPixels[];
#endif
......
......@@ -67,10 +67,5 @@ std::string GetModel() {
return model;
}
bool IsTabletUi() {
NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this";
return true;
}
} // namespace internal
} // namespace syncer
......@@ -16,9 +16,6 @@ std::string GetAndroidId();
// Return the end-user-visible name for this device.
std::string GetModel();
// Return if the device is a tablet.
bool IsTabletUi();
} // namespace internal
} // namespace syncer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment