| Index: ui/views/controls/textfield/textfield.cc
|
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
|
| index 66291060b17b615696ef37256aa8b715e2df19f2..8b3a254f2d301325b478749aa621b2fdcc0ac18d 100644
|
| --- a/ui/views/controls/textfield/textfield.cc
|
| +++ b/ui/views/controls/textfield/textfield.cc
|
| @@ -6,15 +6,18 @@
|
|
|
| #include <string>
|
|
|
| +#include "base/command_line.h"
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "ui/base/accessibility/accessible_view_state.h"
|
| #include "ui/base/ime/text_input_type.h"
|
| #include "ui/base/keycodes/keyboard_codes.h"
|
| #include "ui/base/range/range.h"
|
| +#include "ui/base/ui_base_switches.h"
|
| #include "ui/gfx/insets.h"
|
| #include "ui/gfx/selection_model.h"
|
| #include "ui/views/controls/native/native_view_host.h"
|
| +#include "ui/views/controls/textfield/native_textfield_views.h"
|
| #include "ui/views/controls/textfield/native_textfield_wrapper.h"
|
| #include "ui/views/controls/textfield/textfield_controller.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -23,7 +26,6 @@
|
| #include "base/win/win_util.h"
|
| // TODO(beng): this should be removed when the OS_WIN hack from
|
| // ViewHierarchyChanged is removed.
|
| -#include "ui/views/controls/textfield/native_textfield_views.h"
|
| #include "ui/views/controls/textfield/native_textfield_win.h"
|
| #endif
|
|
|
| @@ -32,6 +34,13 @@ namespace {
|
| // Default placeholder text color.
|
| const SkColor kDefaultPlaceholderTextColor = SK_ColorLTGRAY;
|
|
|
| +#if defined(OS_WIN) && !defined(USE_AURA)
|
| +bool UseNativeTextfieldViews() {
|
| + CommandLine* command_line = CommandLine::ForCurrentProcess();
|
| + return command_line->HasSwitch(switches::kEnableViewsTextfield);
|
| +}
|
| +#endif
|
| +
|
| } // namespace
|
|
|
| namespace views {
|
| @@ -454,12 +463,13 @@ void Textfield::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
|
| UpdateAllProperties();
|
|
|
| #if defined(OS_WIN) && !defined(USE_AURA)
|
| - // TODO(beng): remove this once NativeTextfieldWin subclasses
|
| + // TODO(beng): Remove this once NativeTextfieldWin subclasses
|
| // NativeControlWin. This is currently called to perform post-AddChildView
|
| // initialization for the wrapper.
|
| //
|
| // Remove the include for native_textfield_win.h above when you fix this.
|
| - static_cast<NativeTextfieldWin*>(native_wrapper_)->AttachHack();
|
| + if (!UseNativeTextfieldViews())
|
| + static_cast<NativeTextfieldWin*>(native_wrapper_)->AttachHack();
|
| #endif
|
| }
|
| }
|
| @@ -468,4 +478,17 @@ std::string Textfield::GetClassName() const {
|
| return kViewClassName;
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// NativeTextfieldWrapper, public:
|
| +
|
| +// static
|
| +NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper(
|
| + Textfield* field) {
|
| +#if defined(OS_WIN) && !defined(USE_AURA)
|
| + if (!UseNativeTextfieldViews())
|
| + return new NativeTextfieldWin(field);
|
| +#endif
|
| + return new NativeTextfieldViews(field);
|
| +}
|
| +
|
| } // namespace views
|
|
|