summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd13
-rw-r--r--chrome/browser/about_flags.cc19
-rw-r--r--chrome/browser/chrome_browser_main_win.cc4
-rw-r--r--chrome/browser/resources/shared/js/cr.js3
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.cc3
-rw-r--r--chrome/browser/ui/webui/shared_resources_data_source.cc9
-rw-r--r--content/browser/webui/web_ui_impl.cc12
-rw-r--r--ui/base/layout.cc69
-rw-r--r--ui/base/touch/touch_factory.cc102
-rw-r--r--ui/base/touch/touch_factory.h11
-rw-r--r--ui/base/touch/touch_mode_support.cc16
-rw-r--r--ui/base/touch/touch_mode_support.h21
-rw-r--r--ui/base/ui_base_switches.cc14
-rw-r--r--ui/base/ui_base_switches.h3
-rw-r--r--ui/ui.gyp2
-rw-r--r--ui/views/controls/menu/menu_config.cc6
16 files changed, 167 insertions, 140 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 9f3ea95..0534245 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5113,12 +5113,21 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_CRXLESS_WEB_APPS_DESCRIPTION" desc="Description of the CRX-less web apps lab">
Enables support for installing Chrome apps that are deployed using a manifest file on a webpage, rather than by packaging the manifest and icons into a crx file.
</message>
- <message name="IDS_TOUCH_OPTIMIZED_UI_NAME" desc="Title of the touch-optimized UI flag." >
+ <message name="IDS_FLAGS_TOUCH_OPTIMIZED_UI_NAME" desc="Title of the touch-optimized UI flag." >
Touch Optimized UI
</message>
- <message name="IDS_TOUCH_OPTIMIZED_UI_DESCRIPTION" desc="Description of the touch-optimized UI flag.">
+ <message name="IDS_FLAGS_TOUCH_OPTIMIZED_UI_DESCRIPTION" desc="Description of the touch-optimized UI flag.">
Enables experimental layout refinements to improve user experience with touch screens.
</message>
+ <message name="IDS_FLAGS_TOUCH_OPTIMIZED_UI_AUTOMATIC" desc="Option name for automatic selection of touch optimized UI mode.">
+ Automatic
+ </message>
+ <message name="IDS_FLAGS_TOUCH_OPTIMIZED_UI_ENABLED" desc="Option name for always enabling touch optimized UI mode.">
+ Enabled
+ </message>
+ <message name="IDS_FLAGS_TOUCH_OPTIMIZED_UI_DISABLED" desc="Option name for always disabling touch optimized UI mode.">
+ Disabled
+ </message>
<message name="IDS_ENABLE_TOUCH_EVENTS_NAME" desc="Title of the enable touch-events flag." >
Enable touch events
</message>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 629daa9..e7317f3 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -90,6 +90,17 @@ const Experiment::Choice kThreadedCompositingModeChoices[] = {
switches::kEnableThreadedCompositing, ""}
};
+const Experiment::Choice kTouchOptimizedUIChoices[] = {
+ { IDS_FLAGS_TOUCH_OPTIMIZED_UI_AUTOMATIC, "", "" },
+ { IDS_FLAGS_TOUCH_OPTIMIZED_UI_ENABLED,
+ switches::kTouchOptimizedUI,
+ switches::kTouchOptimizedUIEnabled },
+ { IDS_FLAGS_TOUCH_OPTIMIZED_UI_DISABLED,
+ switches::kTouchOptimizedUI,
+ switches::kTouchOptimizedUIDisabled }
+};
+
+
// RECORDING USER METRICS FOR FLAGS:
// -----------------------------------------------------------------------------
// The first line of the experiment is the internal name. If you'd like to
@@ -626,10 +637,10 @@ const Experiment kExperiments[] = {
#endif
{
"touch-optimized-ui",
- IDS_TOUCH_OPTIMIZED_UI_NAME,
- IDS_TOUCH_OPTIMIZED_UI_DESCRIPTION,
- kOsAll,
- SINGLE_VALUE_TYPE(switches::kTouchOptimizedUI)
+ IDS_FLAGS_TOUCH_OPTIMIZED_UI_NAME,
+ IDS_FLAGS_TOUCH_OPTIMIZED_UI_DESCRIPTION,
+ kOsWin | kOsCrOS,
+ MULTI_VALUE_TYPE(kTouchOptimizedUIChoices)
},
{
"enable-touch-events",
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index f62d616..fc5c130 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -154,10 +154,6 @@ int DoUninstallTasks(bool chrome_still_running) {
ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin(
const content::MainFunctionParams& parameters)
: ChromeBrowserMainParts(parameters) {
- if (base::win::GetMetroModule()) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kTouchOptimizedUI);
- }
}
ChromeBrowserMainPartsWin::~ChromeBrowserMainPartsWin() {
diff --git a/chrome/browser/resources/shared/js/cr.js b/chrome/browser/resources/shared/js/cr.js
index b9798bb..059e8ef 100644
--- a/chrome/browser/resources/shared/js/cr.js
+++ b/chrome/browser/resources/shared/js/cr.js
@@ -16,7 +16,8 @@ this.cr = (function() {
/**
* Tags the html element with an attribute that allows touch-specific css
* rules.
- * TODO(rbyers): make Chrome always touch-optimized. http://crbug.com/105380
+ * TODO(rbyers): Switch to a touch-screen media query once we have one.
+ * http://crbug.com/123062
*/
function enableTouchOptimizedCss() {
if (cr.isTouchOptimized)
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 284c259..1ca5064 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -35,7 +35,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/touch/touch_mode_support.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/path.h"
#include "ui/gfx/screen.h"
@@ -1230,7 +1229,7 @@ void TabStrip::Init() {
drop_indicator_width = drop_image->width();
drop_indicator_height = drop_image->height();
}
- if (TouchModeSupport::IsTouchOptimized() ||
+ if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStackedTabStrip)) {
touch_layout_.reset(new TouchTabStripLayout(
diff --git a/chrome/browser/ui/webui/shared_resources_data_source.cc b/chrome/browser/ui/webui/shared_resources_data_source.cc
index 1cb3585..378b8e3 100644
--- a/chrome/browser/ui/webui/shared_resources_data_source.cc
+++ b/chrome/browser/ui/webui/shared_resources_data_source.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "base/command_line.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/singleton.h"
#include "base/threading/thread_restrictions.h"
@@ -19,8 +18,8 @@
#include "grit/theme_resources.h"
#include "grit/ui_resources.h"
#include "net/base/mime_util.h"
+#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_switches.h"
namespace {
@@ -49,9 +48,11 @@ int PathToIDR(const std::string& path) {
}
}
+ // In touch layout use some alternate CSS rules.
+ // Ideally we'd expose a touch-screen media query operator to the web
+ // at large, and then just use that for WebUI instead. crbug.com/123062
if (idr == IDR_SHARED_CSS_CHROME2 &&
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kTouchOptimizedUI)) {
+ ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) {
idr = IDR_SHARED_CSS_CHROME2_TOUCH;
}
}
diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc
index 455f038..43f8086 100644
--- a/content/browser/webui/web_ui_impl.cc
+++ b/content/browser/webui/web_ui_impl.cc
@@ -4,7 +4,6 @@
#include "content/browser/webui/web_ui_impl.h"
-#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/stl_util.h"
#include "base/utf_string_conversions.h"
@@ -18,7 +17,7 @@
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/common/bindings_policy.h"
-#include "ui/base/ui_base_switches.h"
+#include "ui/base/layout.h"
using content::RenderViewHostImpl;
using content::WebContents;
@@ -102,11 +101,10 @@ void WebUIImpl::RenderViewCreated(content::RenderViewHost* render_view_host) {
render_view_host->SetWebUIProperty("toolkit", "GTK");
#endif // defined(TOOLKIT_VIEWS)
- // Let the WebUI know that we're looking for UI that's optimized for touch
- // input.
- // TODO(rbyers) Figure out the right model for enabling touch-optimized UI
- // (http://crbug.com/105380).
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTouchOptimizedUI))
+ // Let the WebUI know if we're looking for UI that's optimized for touch
+ // input. Note that ideally we'd expose an API through the web platform
+ // indicating this information and use that instead. See crbug.com/123692.
+ if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH)
render_view_host->SetWebUIProperty("touchOptimized", "true");
}
diff --git a/ui/base/layout.cc b/ui/base/layout.cc
index 8da1fcb..e0e6471 100644
--- a/ui/base/layout.cc
+++ b/ui/base/layout.cc
@@ -5,41 +5,74 @@
#include "ui/base/layout.h"
#include "base/basictypes.h"
-#include "build/build_config.h"
-
-#if defined(USE_ASH)
#include "base/command_line.h"
+#include "base/logging.h"
+#include "build/build_config.h"
#include "ui/base/ui_base_switches.h"
-#endif
+
+#if defined(USE_AURA) && defined(USE_X11)
+#include "ui/base/touch/touch_factory.h"
+#endif // defined(USE_AURA) && defined(USE_X11)
#if defined(OS_WIN)
#include "base/win/metro.h"
#include <Windows.h>
#endif // defined(OS_WIN)
+namespace {
+// Helper function that determines whether we want to optimize the UI for touch.
+bool UseTouchOptimizedUI() {
+ // If --touch-optimized-ui is specified and not set to "auto", then override
+ // the hardware-determined setting (eg. for testing purposes).
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kTouchOptimizedUI)) {
+ const std::string switch_value = CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(switches::kTouchOptimizedUI);
+
+ // Note that simply specifying the switch is the same as enabled.
+ if (switch_value.empty() ||
+ switch_value == switches::kTouchOptimizedUIEnabled) {
+ return true;
+ } else if (switch_value == switches::kTouchOptimizedUIDisabled) {
+ return false;
+ } else if (switch_value != switches::kTouchOptimizedUIAuto) {
+ LOG(ERROR) << "Invalid --touch-optimized-ui option: " << switch_value;
+ }
+ }
+
+#if defined(ENABLE_METRO)
+ return base::win::GetMetroModule() != NULL;
+#elif defined(OS_WIN)
+ // No touch support on Win outside Metro yet (even with Aura).
+ return false;
+#elif defined(USE_AURA) && defined(USE_X11)
+ // Determine whether touch-screen hardware is currently available.
+ // For now we assume this won't change over the life of the process, but
+ // we'll probably want to support that. crbug.com/124399
+ return ui::TouchFactory::GetInstance()->IsTouchDevicePresent();
+#else
+ return false;
+#endif
+}
+}
+
namespace ui {
// Note that this function should be extended to select
// LAYOUT_TOUCH when appropriate on more platforms than just
-// Windows.
+// Windows and Ash.
DisplayLayout GetDisplayLayout() {
#if defined(USE_ASH)
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTouchOptimizedUI))
+ if (UseTouchOptimizedUI())
return LAYOUT_TOUCH;
return LAYOUT_ASH;
-#elif !defined(OS_WIN)
- return LAYOUT_DESKTOP;
-#else // On Windows.
- bool use_touch = false;
-#if defined(ENABLE_METRO)
- use_touch = base::win::GetMetroModule() != NULL;
-#endif // defined(ENABLE_METRO)
- if (use_touch) {
+#elif defined(OS_WIN)
+ if (UseTouchOptimizedUI())
return LAYOUT_TOUCH;
- } else {
- return LAYOUT_DESKTOP;
- }
-#endif // On Windows.
+ return LAYOUT_DESKTOP;
+#else
+ return LAYOUT_DESKTOP;
+#endif
}
} // namespace ui
diff --git a/ui/base/touch/touch_factory.cc b/ui/base/touch/touch_factory.cc
index ef7b710..b3c254c 100644
--- a/ui/base/touch/touch_factory.cc
+++ b/ui/base/touch/touch_factory.cc
@@ -79,11 +79,6 @@ XIValuatorClassInfo* FindTPValuator(Display* display,
namespace ui {
-// static
-TouchFactory* TouchFactory::GetInstance() {
- return Singleton<TouchFactory>::get();
-}
-
TouchFactory::TouchFactory()
: is_cursor_visible_(true),
touch_events_allowed_(false),
@@ -148,6 +143,11 @@ TouchFactory::~TouchFactory() {
}
}
+// static
+TouchFactory* TouchFactory::GetInstance() {
+ return Singleton<TouchFactory>::get();
+}
+
void TouchFactory::UpdateDeviceList(Display* display) {
// Detect touch devices.
// NOTE: The new API for retrieving the list of devices (XIQueryDevice) does
@@ -427,50 +427,6 @@ void TouchFactory::SetCursorVisible(bool show, bool start_timer) {
XDefineCursor(display, window, invisible_cursor_);
}
-void TouchFactory::SetupValuator() {
- memset(valuator_lookup_, -1, sizeof(valuator_lookup_));
- memset(touch_param_min_, 0, sizeof(touch_param_min_));
- memset(touch_param_max_, 0, sizeof(touch_param_max_));
-
- Display* display = ui::GetXDisplay();
- int ndevice;
- XIDeviceInfo* info_list = XIQueryDevice(display, XIAllDevices, &ndevice);
-
- for (int i = 0; i < ndevice; i++) {
- XIDeviceInfo* info = info_list + i;
-
- if (!IsTouchDevice(info->deviceid))
- continue;
-
- for (int j = 0; j < TP_LAST_ENTRY; j++) {
- TouchParam tp = static_cast<TouchParam>(j);
- XIValuatorClassInfo* valuator = FindTPValuator(display, info, tp);
- if (valuator) {
- valuator_lookup_[info->deviceid][j] = valuator->number;
- touch_param_min_[info->deviceid][j] = valuator->min;
- touch_param_max_[info->deviceid][j] = valuator->max;
- }
- }
-
-#if !defined(USE_XI2_MT)
- // In order to support multi-touch with XI2.0, we need both a slot_id and
- // tracking_id valuator. Without these we'll treat the device as a
- // single-touch device (like a mouse).
- // TODO(rbyers): Multi-touch is disabled: http://crbug.com/112329
- //if (valuator_lookup_[info->deviceid][TP_SLOT_ID] == -1 ||
- // valuator_lookup_[info->deviceid][TP_TRACKING_ID] == -1) {
- DVLOG(1) << "Touch device " << info->deviceid <<
- " does not provide enough information for multi-touch, treating as "
- "a single-touch device.";
- touch_device_list_[info->deviceid] = false;
- //}
-#endif
- }
-
- if (info_list)
- XIFreeDeviceInfo(info_list);
-}
-
bool TouchFactory::ExtractTouchParam(const XEvent& xev,
TouchParam tp,
float* value) {
@@ -519,4 +475,52 @@ bool TouchFactory::GetTouchParamRange(unsigned int deviceid,
return false;
}
+bool TouchFactory::IsTouchDevicePresent() {
+ return (touch_device_available_ && touch_events_allowed_);
+}
+
+void TouchFactory::SetupValuator() {
+ memset(valuator_lookup_, -1, sizeof(valuator_lookup_));
+ memset(touch_param_min_, 0, sizeof(touch_param_min_));
+ memset(touch_param_max_, 0, sizeof(touch_param_max_));
+
+ Display* display = ui::GetXDisplay();
+ int ndevice;
+ XIDeviceInfo* info_list = XIQueryDevice(display, XIAllDevices, &ndevice);
+
+ for (int i = 0; i < ndevice; i++) {
+ XIDeviceInfo* info = info_list + i;
+
+ if (!IsTouchDevice(info->deviceid))
+ continue;
+
+ for (int j = 0; j < TP_LAST_ENTRY; j++) {
+ TouchParam tp = static_cast<TouchParam>(j);
+ XIValuatorClassInfo* valuator = FindTPValuator(display, info, tp);
+ if (valuator) {
+ valuator_lookup_[info->deviceid][j] = valuator->number;
+ touch_param_min_[info->deviceid][j] = valuator->min;
+ touch_param_max_[info->deviceid][j] = valuator->max;
+ }
+ }
+
+#if !defined(USE_XI2_MT)
+ // In order to support multi-touch with XI2.0, we need both a slot_id and
+ // tracking_id valuator. Without these we'll treat the device as a
+ // single-touch device (like a mouse).
+ // TODO(rbyers): Multi-touch is disabled: http://crbug.com/112329
+ //if (valuator_lookup_[info->deviceid][TP_SLOT_ID] == -1 ||
+ // valuator_lookup_[info->deviceid][TP_TRACKING_ID] == -1) {
+ DVLOG(1) << "Touch device " << info->deviceid <<
+ " does not provide enough information for multi-touch, treating as "
+ "a single-touch device.";
+ touch_device_list_[info->deviceid] = false;
+ //}
+#endif
+ }
+
+ if (info_list)
+ XIFreeDeviceInfo(info_list);
+}
+
} // namespace ui
diff --git a/ui/base/touch/touch_factory.h b/ui/base/touch/touch_factory.h
index cb05460..407cca3 100644
--- a/ui/base/touch/touch_factory.h
+++ b/ui/base/touch/touch_factory.h
@@ -24,6 +24,10 @@ namespace ui {
// Functions related to determining touch devices.
class UI_EXPORT TouchFactory {
+ private:
+ TouchFactory();
+ ~TouchFactory();
+
public:
// Define the touch params following the Multi-touch Protocol.
enum TouchParam {
@@ -134,11 +138,10 @@ class UI_EXPORT TouchFactory {
float* min,
float* max);
- private:
- TouchFactory();
-
- ~TouchFactory();
+ // Whether any touch device is currently present and enabled.
+ bool IsTouchDevicePresent();
+ private:
void HideCursorForInactivity() {
SetCursorVisible(false, false);
}
diff --git a/ui/base/touch/touch_mode_support.cc b/ui/base/touch/touch_mode_support.cc
deleted file mode 100644
index bfd3d1d..0000000
--- a/ui/base/touch/touch_mode_support.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2012 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 "ui/base/touch/touch_mode_support.h"
-
-#include "ui/base/ui_base_switches.h"
-#include "base/command_line.h"
-
-// static
-bool TouchModeSupport::IsTouchOptimized() {
- // TODO: Enable based on GetSystemMetrics(SM_DIGITIZER) returning NID_READY
- // and NID_INTEGRATED_TOUCH once code is ready (Only for WIN).
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kTouchOptimizedUI);
-}
diff --git a/ui/base/touch/touch_mode_support.h b/ui/base/touch/touch_mode_support.h
deleted file mode 100644
index 0e7edeff..0000000
--- a/ui/base/touch/touch_mode_support.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef UI_BASE_TOUCH_TOUCH_MODE_SUPPORT_H_
-#define UI_BASE_TOUCH_TOUCH_MODE_SUPPORT_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "ui/base/ui_export.h"
-
-class UI_EXPORT TouchModeSupport {
- public:
- // Returns whether we should be operating in touch-friendly mode.
- static bool IsTouchOptimized();
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(TouchModeSupport);
-};
-
-#endif // UI_BASE_TOUCH_TOUCH_MODE_SUPPORT_H_
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc
index 773c441..93601f4 100644
--- a/ui/base/ui_base_switches.cc
+++ b/ui/base/ui_base_switches.cc
@@ -33,8 +33,18 @@ const char kLocalePak[] = "locale_pak";
const char kNoMessageBox[] = "no-message-box";
// Enables UI changes that make it easier to use with a touchscreen.
-const char kTouchOptimizedUI[] = "touch-optimized-ui";
-
+// WARNING: Do not check this flag directly when deciding what UI to draw,
+// instead you must call ui::GetDisplayLayout
+const char kTouchOptimizedUI[] = "touch-optimized-ui";
+
+// The values the kTouchOptimizedUI switch may have, as in
+// "--touch-optimized-ui=disabled".
+// auto: Enabled on monitors which have touchscreen support (default).
+const char kTouchOptimizedUIAuto[] = "auto";
+// enabled: always optimized for touch (even if no touch support).
+const char kTouchOptimizedUIEnabled[] = "enabled";
+// disabled: never optimized for touch.
+const char kTouchOptimizedUIDisabled[] = "disabled";
#if defined(OS_MACOSX)
const char kDisableCompositedCoreAnimationPlugins[] =
diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h
index 61f978f..3d4bda8 100644
--- a/ui/base/ui_base_switches.h
+++ b/ui/base/ui_base_switches.h
@@ -21,6 +21,9 @@ UI_EXPORT extern const char kLang[];
UI_EXPORT extern const char kLocalePak[];
UI_EXPORT extern const char kNoMessageBox[];
UI_EXPORT extern const char kTouchOptimizedUI[];
+UI_EXPORT extern const char kTouchOptimizedUIAuto[];
+UI_EXPORT extern const char kTouchOptimizedUIDisabled[];
+UI_EXPORT extern const char kTouchOptimizedUIEnabled[];
#if defined(OS_MACOSX)
// TODO(kbr): remove this and the associated old code path:
diff --git a/ui/ui.gyp b/ui/ui.gyp
index 5eca3fa..ed5b79a 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -240,8 +240,6 @@
'base/theme_provider.h',
'base/touch/touch_factory.cc',
'base/touch/touch_factory.h',
- 'base/touch/touch_mode_support.cc',
- 'base/touch/touch_mode_support.h',
'base/ui_base_exports.cc',
'base/ui_base_paths.cc',
'base/ui_base_paths.h',
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
index bc097ce..49be189 100644
--- a/ui/views/controls/menu/menu_config.cc
+++ b/ui/views/controls/menu/menu_config.cc
@@ -4,9 +4,8 @@
#include "ui/views/controls/menu/menu_config.h"
-#include "base/command_line.h"
#include "build/build_config.h"
-#include "ui/base/ui_base_switches.h"
+#include "ui/base/layout.h"
namespace views {
@@ -43,8 +42,7 @@ MenuConfig::MenuConfig()
always_use_icon_to_label_padding(false),
align_arrow_and_shortcut(false) {
// Use 40px tall menu items when running in touch optimized mode.
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kTouchOptimizedUI)) {
+ if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) {
item_top_margin = item_no_icon_top_margin = 12;
item_bottom_margin = item_no_icon_bottom_margin = 13;
}