Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 10535046: Add Windows commandline switch --enable-views-textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/textfield/native_textfield_win.cc ('k') | ui/views/events/event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/views/controls/textfield/native_textfield_win.cc ('k') | ui/views/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698