diff options
-rw-r--r-- | chrome/browser/about_flags.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/chrome_restart_request.cc | 4 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 6 | ||||
-rw-r--r-- | content/browser/web_contents/touch_editable_impl_aura.cc | 8 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 6 | ||||
-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 |
13 files changed, 84 insertions, 27 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 826f55b..584b900 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1255,14 +1255,16 @@ const Experiment kExperiments[] = { IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_NAME, IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_DESCRIPTION, kOsWin | kOsCrOS, - SINGLE_VALUE_TYPE(switches::kEnableTouchDragDrop) + ENABLE_DISABLE_VALUE_TYPE(switches::kEnableTouchDragDrop, + switches::kDisableTouchDragDrop) }, { "enable-touch-editing", IDS_FLAGS_ENABLE_TOUCH_EDITING_NAME, IDS_FLAGS_ENABLE_TOUCH_EDITING_DESCRIPTION, kOsCrOS, - SINGLE_VALUE_TYPE(switches::kEnableTouchEditing) + ENABLE_DISABLE_VALUE_TYPE(switches::kEnableTouchEditing, + switches::kDisableTouchEditing) }, #if defined(ENABLE_MESSAGE_CENTER) { diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc index 4afd36a..c6d6370 100644 --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc @@ -84,6 +84,8 @@ std::string DeriveCommandLine(const GURL& start_url, ::switches::kDisableSeccompFilterSandbox, ::switches::kDisableSeccompSandbox, ::switches::kDisableThreadedCompositing, + ::switches::kDisableTouchDragDrop, + ::switches::kDisableTouchEditing, ::switches::kEnableAcceleratedOverflowScroll, ::switches::kEnableCompositingForFixedPosition, ::switches::kEnableGestureTapHighlight, @@ -93,6 +95,8 @@ std::string DeriveCommandLine(const GURL& start_url, ::switches::kEnableLogging, ::switches::kEnablePinch, ::switches::kEnableThreadedCompositing, + ::switches::kEnableTouchDragDrop, + ::switches::kEnableTouchEditing, ::switches::kEnableViewport, ::switches::kEnableVsyncNotification, ::switches::kForceDeviceScaleFactor, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 53976d2..4fdd872 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -820,6 +820,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableSessionStorage, switches::kDisableSharedWorkers, switches::kDisableSpeechInput, + switches::kDisableTouchDragDrop, + switches::kDisableTouchEditing, #if defined(OS_ANDROID) switches::kEnableWebAudio, switches::kDisableWebRTC, @@ -843,6 +845,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kEnableGpuBenchmarking, switches::kEnableMemoryBenchmarking, switches::kEnableLogging, + switches::kEnableTouchDragDrop, + switches::kEnableTouchEditing, switches::kEnableVsyncNotification, switches::kEnableWebPInAcceptHeader, switches::kDisableMediaSource, @@ -870,8 +874,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kEnableHighDpiCompositingForFixedPosition, switches::kDisableCompositingForFixedPosition, switches::kEnableAcceleratedPainting, - switches::kEnableTouchDragDrop, - switches::kEnableTouchEditing, switches::kDisableThreadedCompositing, switches::kDisableTouchAdjustment, switches::kDefaultTileWidth, diff --git a/content/browser/web_contents/touch_editable_impl_aura.cc b/content/browser/web_contents/touch_editable_impl_aura.cc index d6b3ed9..d782b8c 100644 --- a/content/browser/web_contents/touch_editable_impl_aura.cc +++ b/content/browser/web_contents/touch_editable_impl_aura.cc @@ -4,7 +4,6 @@ #include "content/browser/web_contents/touch_editable_impl_aura.h" -#include "base/command_line.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_aura.h" #include "content/common/view_messages.h" @@ -16,7 +15,7 @@ #include "ui/aura/window.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/range/range.h" -#include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_switches_util.h" namespace content { @@ -29,11 +28,8 @@ TouchEditableImplAura::~TouchEditableImplAura() { // static TouchEditableImplAura* TouchEditableImplAura::Create() { -#if defined(OS_CHROMEOS) - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTouchEditing)) + if (switches::IsTouchEditingEnabled()) return new TouchEditableImplAura(); -#endif return NULL; } diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 6f1b764..c8e67ec 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -181,7 +181,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" #include "third_party/WebKit/Source/WebKit/chromium/public/default/WebRenderTheme.h" -#include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -746,10 +746,10 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) { webkit_preferences_.Apply(webview()); webview()->initializeMainFrame(this); - if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) + if (switches::IsTouchDragDropEnabled()) webview()->settings()->setTouchDragDropEnabled(true); - if (command_line.HasSwitch(switches::kEnableTouchEditing)) + if (switches::IsTouchEditingEnabled()) webview()->settings()->setTouchEditingEnabled(true); if (!params->frame_name.empty()) 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_ @@ -298,6 +298,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 a57b208..32f7886 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() {} |