summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 21:54:00 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 21:54:00 +0000
commit4fc08c08f72dfe451e1bf587db6bfad0c7137656 (patch)
tree168162d28104400421bfa47a3db2c01379e39f91 /views
parentc244ca0d673ded317c2a44837d53700b46b28781 (diff)
downloadchromium_src-4fc08c08f72dfe451e1bf587db6bfad0c7137656.zip
chromium_src-4fc08c08f72dfe451e1bf587db6bfad0c7137656.tar.gz
chromium_src-4fc08c08f72dfe451e1bf587db6bfad0c7137656.tar.bz2
Use single command line flag for all pure Views situations,
rather than enabling case by case BUG=none TEST=none Review URL: http://codereview.chromium.org/6911018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/combobox/native_combobox_views.cc7
-rw-r--r--views/controls/textfield/native_textfield_views.cc7
-rw-r--r--views/examples/examples_main.cc7
-rw-r--r--views/widget/root_view.cc17
-rw-r--r--views/widget/root_view.h5
5 files changed, 32 insertions, 11 deletions
diff --git a/views/controls/combobox/native_combobox_views.cc b/views/controls/combobox/native_combobox_views.cc
index 4a77f7a..0de6b5fe9 100644
--- a/views/controls/combobox/native_combobox_views.cc
+++ b/views/controls/combobox/native_combobox_views.cc
@@ -18,6 +18,7 @@
#include "views/controls/combobox/combobox.h"
#include "views/controls/focusable_border.h"
#include "views/controls/menu/menu_2.h"
+#include "views/widget/root_view.h"
#if defined(OS_LINUX)
#include "ui/gfx/gtk_util.h"
@@ -48,8 +49,6 @@ const int kComboboxArrowMargin = 12;
const SkColor kDefaultBorderColor = SK_ColorGRAY;
const SkColor kTextColor = SK_ColorBLACK;
-// A switch to enable NativeTextfieldViews;
-const char kEnableComboboxViewsSwitch[] = "enable-combobox-views";
} // namespace
namespace views {
@@ -208,9 +207,7 @@ bool NativeComboboxViews::IsComboboxViewsEnabled() {
#if defined(TOUCH_UI)
return true;
#else
- return combobox_view_enabled ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- kEnableComboboxViewsSwitch);
+ return combobox_view_enabled || RootView::IsPureViews();
#endif
}
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index 77b8098..4b6c2fd 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -27,6 +27,7 @@
#include "views/ime/input_method.h"
#include "views/metrics.h"
#include "views/views_delegate.h"
+#include "views/widget/root_view.h"
#if defined(OS_LINUX)
#include "ui/gfx/gtk_util.h"
@@ -50,8 +51,6 @@ const SkColor kCursorColor = SK_ColorBLACK;
const int kCursorVisibleTimeMs = 800;
const int kCursorInvisibleTimeMs = 500;
-// A switch to enable NativeTextfieldViews;
-const char kEnableViewsBasedTextfieldSwitch[] = "enable-textfield-views";
} // namespace
namespace views {
@@ -393,9 +392,7 @@ bool NativeTextfieldViews::IsTextfieldViewsEnabled() {
#if defined(TOUCH_UI)
return true;
#else
- return textfield_view_enabled ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- kEnableViewsBasedTextfieldSwitch);
+ return textfield_view_enabled || RootView::IsPureViews();
#endif
}
diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc
index 8b2b647..94c30cf 100644
--- a/views/examples/examples_main.cc
+++ b/views/examples/examples_main.cc
@@ -31,6 +31,7 @@
#include "views/examples/widget_example.h"
#include "views/focus/accelerator_handler.h"
#include "views/layout/grid_layout.h"
+#include "views/widget/root_view.h"
#include "views/window/window.h"
#if defined(OS_WIN)
@@ -184,6 +185,12 @@ int main(int argc, char** argv) {
#endif
CommandLine::Init(argc, argv);
+
+ // We do not this header: chrome/common/chrome_switches.h
+ // because that would create a dependency back on Chrome
+ views::RootView::SetPureViews(
+ CommandLine::ForCurrentProcess()->HasSwitch("use-pure-views"));
+
examples::ExamplesMain main;
main.Run();
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index ad1666b..a91843b 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -397,8 +397,10 @@ void RootView::GetAccessibleState(ui::AccessibleViewState* state) {
}
#if defined(TOUCH_UI)
+namespace {
// Always show the mouse cursor, useful when debugging touch builds
-static bool keep_mouse_cursor;
+bool keep_mouse_cursor;
+}
void RootView::SetKeepMouseCursor(bool keep) {
keep_mouse_cursor = keep;
@@ -410,6 +412,19 @@ bool RootView::GetKeepMouseCursor() {
#endif
+namespace {
+// Set to true if a pure Views implementation is preferred
+bool use_pure_views;
+}
+
+void RootView::SetPureViews(bool pure) {
+ use_pure_views = pure;
+}
+
+bool RootView::IsPureViews() {
+ return use_pure_views;
+}
+
////////////////////////////////////////////////////////////////////////////////
// RootView, protected:
diff --git a/views/widget/root_view.h b/views/widget/root_view.h
index 8660d4e..12212e0 100644
--- a/views/widget/root_view.h
+++ b/views/widget/root_view.h
@@ -118,6 +118,11 @@ class RootView : public View,
static bool GetKeepMouseCursor();
#endif
+ // SetPureViews and IsPureViews update and return the state of a global
+ // setting that tracks whether to use available pure Views implementations
+ static void SetPureViews(bool pure);
+ static bool IsPureViews();
+
protected:
// Overridden from View:
virtual void ViewHierarchyChanged(bool is_add, View* parent,