diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-27 02:36:27 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-27 02:36:27 +0000 |
commit | 1400e6dc12c13f62aa300dd4468019a08388daec (patch) | |
tree | 250c21e5168f550b0a7d3bf16323f5a88a4efb11 /ui | |
parent | cd88f791eacd3f59a83af0fe1713db55ed03a352 (diff) | |
download | chromium_src-1400e6dc12c13f62aa300dd4468019a08388daec.zip chromium_src-1400e6dc12c13f62aa300dd4468019a08388daec.tar.gz chromium_src-1400e6dc12c13f62aa300dd4468019a08388daec.tar.bz2 |
Reland https://chromiumcodereview.appspot.com/14286004 which was reverted fue
to linux_chromeos_asan build break. The cause of the break has since been fixed
in https://codereview.chromium.org/14113034/
There are no additional changes from the original CL.
BUG=115237,168162
TBR=sky@chromium.org,avi@chromium.org
Review URL: https://chromiumcodereview.appspot.com/14283013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/ui_base_switches.cc | 7 | ||||
-rw-r--r-- | ui/base/ui_base_switches.h | 2 | ||||
-rw-r--r-- | ui/base/ui_base_switches_util.cc | 32 | ||||
-rw-r--r-- | ui/base/ui_base_switches_util.h | 18 | ||||
-rw-r--r-- | ui/ui.gyp | 2 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 6 | ||||
-rw-r--r-- | ui/views/touchui/touch_selection_controller_impl.cc | 8 | ||||
-rw-r--r-- | ui/views/view.cc | 6 |
8 files changed, 67 insertions, 14 deletions
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc index 80fcb0a..5575f27 100644 --- a/ui/base/ui_base_switches.cc +++ b/ui/base/ui_base_switches.cc @@ -12,6 +12,12 @@ const char kDisableDwmComposition[] = "disable-dwm-composition"; // Disables touch adjustment. const char kDisableTouchAdjustment[] = "disable-touch-adjustment"; +// Disables touch event based drag and drop. +const char kDisableTouchDragDrop[] = "disable-touch-drag-drop"; + +// Disables controls that support touch base text editing. +const char kDisableTouchEditing[] = "disable-touch-editing"; + // Disables the Views textfield on Windows. const char kDisableViewsTextfield[] = "disable-views-textfield"; @@ -21,6 +27,7 @@ const char kEnableBezelTouch[] = "enable-bezel-touch"; // Enables the new dialog style wherever it is available. const char kEnableNewDialogStyle[] = "enable-new-dialog-style"; +// Enables touch event based drag and drop. const char kEnableTouchDragDrop[] = "enable-touch-drag-drop"; // Enables controls that support touch base text editing. diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h index 1319563..da7eca7 100644 --- a/ui/base/ui_base_switches.h +++ b/ui/base/ui_base_switches.h @@ -14,6 +14,8 @@ namespace switches { UI_EXPORT extern const char kDisableDwmComposition[]; UI_EXPORT extern const char kDisableTouchAdjustment[]; +UI_EXPORT extern const char kDisableTouchDragDrop[]; +UI_EXPORT extern const char kDisableTouchEditing[]; UI_EXPORT extern const char kDisableViewsTextfield[]; UI_EXPORT extern const char kEnableBezelTouch[]; UI_EXPORT extern const char kEnableNewDialogStyle[]; diff --git a/ui/base/ui_base_switches_util.cc b/ui/base/ui_base_switches_util.cc new file mode 100644 index 0000000..3089607 --- /dev/null +++ b/ui/base/ui_base_switches_util.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2013 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/ui_base_switches_util.h" + +#include "base/command_line.h" +#include "ui/base/ui_base_switches.h" + +namespace switches { + +bool IsTouchDragDropEnabled() { +#if defined(OS_CHROMEOS) + return !CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableTouchDragDrop); +#else + return CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableTouchDragDrop); +#endif +} + +bool IsTouchEditingEnabled() { +#if defined(OS_CHROMEOS) + return !CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableTouchEditing); +#else + return CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableTouchEditing); +#endif +} + +} // namespace switches diff --git a/ui/base/ui_base_switches_util.h b/ui/base/ui_base_switches_util.h new file mode 100644 index 0000000..c64da8f --- /dev/null +++ b/ui/base/ui_base_switches_util.h @@ -0,0 +1,18 @@ +// Copyright (c) 2013 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_UI_BASE_SWITCHES_UTIL_H_ +#define UI_BASE_UI_BASE_SWITCHES_UTIL_H_ + +#include "base/compiler_specific.h" +#include "ui/base/ui_export.h" + +namespace switches { + +UI_EXPORT bool IsTouchDragDropEnabled(); +UI_EXPORT bool IsTouchEditingEnabled(); + +} // namespace switches + +#endif // UI_BASE_UI_BASE_SWITCHES_UTIL_H_ @@ -299,6 +299,8 @@ 'base/ui_base_paths.h', 'base/ui_base_switches.cc', 'base/ui_base_switches.h', + 'base/ui_base_switches_util.cc', + 'base/ui_base_switches_util.h', 'base/ui_base_types.h', 'base/ui_export.h', 'base/view_prop.cc', diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index f216355..59ea629 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -8,7 +8,6 @@ #include <set> #include "base/bind.h" -#include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/i18n/case_conversion.h" #include "base/logging.h" @@ -24,7 +23,7 @@ #include "ui/base/events/event.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/range/range.h" -#include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/compositor/layer.h" #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" @@ -201,8 +200,7 @@ void NativeTextfieldViews::OnGestureEvent(ui::GestureEvent* event) { OnAfterUserAction(); if (touch_selection_controller_.get()) event->SetHandled(); - } else if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTouchDragDrop)) { + } else if (switches::IsTouchDragDropEnabled()) { touch_selection_controller_.reset(); } else { if (!touch_selection_controller_.get()) diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc index fba8984..e5f3fba 100644 --- a/ui/views/touchui/touch_selection_controller_impl.cc +++ b/ui/views/touchui/touch_selection_controller_impl.cc @@ -4,10 +4,9 @@ #include "ui/views/touchui/touch_selection_controller_impl.h" -#include "base/command_line.h" #include "base/time.h" #include "grit/ui_strings.h" -#include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/rect.h" #include "ui/gfx/screen.h" @@ -420,11 +419,8 @@ ViewsTouchSelectionControllerFactory::ViewsTouchSelectionControllerFactory() { ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( ui::TouchEditable* client_view) { -#if defined(OS_CHROMEOS) - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTouchEditing)) + if (switches::IsTouchEditingEnabled()) return new views::TouchSelectionControllerImpl(client_view); -#endif return NULL; } diff --git a/ui/views/view.cc b/ui/views/view.cc index 758d915..6d721b1 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc @@ -9,7 +9,6 @@ #include <algorithm> #include <cmath> -#include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -19,7 +18,7 @@ #include "third_party/skia/include/core/SkRect.h" #include "ui/base/accessibility/accessibility_types.h" #include "ui/base/dragdrop/drag_drop_types.h" -#include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/compositor/compositor.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -108,8 +107,7 @@ class PostEventDispatchHandler : public ui::EventHandler { public: explicit PostEventDispatchHandler(View* owner) : owner_(owner), - touch_dnd_enabled_(CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTouchDragDrop)) { + touch_dnd_enabled_(switches::IsTouchDragDropEnabled()) { } virtual ~PostEventDispatchHandler() {} |