summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_views.cc3
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_views.h9
-rw-r--r--chrome/browser/chromeos/login/captcha_view.cc1
-rw-r--r--chrome/browser/chromeos/login/captcha_view.h22
-rw-r--r--chrome/browser/chromeos/login/existing_user_view.cc3
-rw-r--r--chrome/browser/chromeos/login/existing_user_view.h13
-rw-r--r--chrome/browser/chromeos/login/new_user_view.cc3
-rw-r--r--chrome/browser/chromeos/login/new_user_view.h20
-rw-r--r--chrome/browser/chromeos/login/password_changed_view.cc1
-rw-r--r--chrome/browser/chromeos/login/password_changed_view.h18
-rw-r--r--chrome/browser/chromeos/login/screen_lock_view.cc1
-rw-r--r--chrome/browser/chromeos/login/screen_lock_view.h12
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc1
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.h14
-rw-r--r--chrome/browser/ui/input_window_dialog_win.cc14
-rw-r--r--chrome/browser/ui/views/autofill_profiles_view_win.cc3
-rw-r--r--chrome/browser/ui/views/autofill_profiles_view_win.h15
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc1
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.h16
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.cc3
-rw-r--r--chrome/browser/ui/views/edit_search_engine_dialog.h14
-rw-r--r--chrome/browser/ui/views/find_bar_view.cc3
-rw-r--r--chrome/browser/ui/views/find_bar_view.h9
-rw-r--r--chrome/browser/ui/views/options/cookies_view.cc18
-rw-r--r--chrome/browser/ui/views/options/cookies_view.h31
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.cc1
-rw-r--r--chrome/browser/ui/views/options/exception_editor_view.h16
-rw-r--r--chrome/browser/ui/views/options/general_page_view.cc2
-rw-r--r--chrome/browser/ui/views/options/general_page_view.h15
-rw-r--r--chrome/browser/ui/views/url_picker.h17
-rw-r--r--views/controls/textfield/native_textfield_gtk.cc8
-rw-r--r--views/controls/textfield/native_textfield_gtk.h2
-rw-r--r--views/controls/textfield/native_textfield_views.cc10
-rw-r--r--views/controls/textfield/native_textfield_views.h3
-rw-r--r--views/controls/textfield/native_textfield_views_unittest.cc9
-rw-r--r--views/controls/textfield/native_textfield_win.cc8
-rw-r--r--views/controls/textfield/text_range.h67
-rw-r--r--views/controls/textfield/textfield.cc29
-rw-r--r--views/controls/textfield/textfield.h88
-rw-r--r--views/controls/textfield/textfield_controller.h33
-rw-r--r--views/controls/textfield/textfield_views_model.cc3
-rw-r--r--views/controls/textfield/textfield_views_model_unittest.cc1
-rw-r--r--views/examples/textfield_example.cc1
-rw-r--r--views/examples/textfield_example.h10
-rw-r--r--views/views.gyp2
45 files changed, 313 insertions, 260 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
index 36011ce..0600bde 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
@@ -24,6 +24,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/font.h"
#include "views/border.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/fill_layout.h"
namespace {
@@ -574,7 +575,7 @@ void AutocompleteEditViewViews::Observe(NotificationType type,
}
////////////////////////////////////////////////////////////////////////////////
-// AutocompleteEditViewViews, Textfield::Controller implementation:
+// AutocompleteEditViewViews, views::TextfieldController implementation:
void AutocompleteEditViewViews::ContentsChanged(views::Textfield* sender,
const string16& new_contents) {
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_views.h b/chrome/browser/autocomplete/autocomplete_edit_view_views.h
index e1b28a7..931313d 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_views.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_views.h
@@ -14,7 +14,8 @@
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "chrome/common/page_transition_types.h"
#include "content/common/notification_observer.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/text_range.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
#include "webkit/glue/window_open_disposition.h"
@@ -38,7 +39,7 @@ class TabContents;
class AutocompleteEditViewViews : public views::View,
public AutocompleteEditView,
public NotificationObserver,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
AutocompleteEditViewViews(AutocompleteEditController* controller,
ToolbarModel* toolbar_model,
@@ -119,12 +120,12 @@ class AutocompleteEditViewViews : public views::View,
virtual views::View* AddToView(views::View* parent);
virtual int OnPerformDrop(const views::DropTargetEvent& event);
- // Overridden from NotificationObserver:
+ // NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
- // Overridden from Textfield::Controller
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc
index 142c97b..4600d5a 100644
--- a/chrome/browser/chromeos/login/captcha_view.cc
+++ b/chrome/browser/chromeos/login/captcha_view.cc
@@ -19,6 +19,7 @@
#include "views/controls/button/text_button.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/widget/widget_gtk.h"
diff --git a/chrome/browser/chromeos/login/captcha_view.h b/chrome/browser/chromeos/login/captcha_view.h
index 65682e0..978a20f 100644
--- a/chrome/browser/chromeos/login/captcha_view.h
+++ b/chrome/browser/chromeos/login/captcha_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -11,7 +11,7 @@
#include "chrome/browser/chromeos/login/image_decoder.h"
#include "googleurl/src/gurl.h"
#include "views/controls/button/button.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/window/dialog_delegate.h"
namespace views {
@@ -26,7 +26,7 @@ namespace chromeos {
// A dialog box that shows a CAPTCHA image and allows user to input response.
class CaptchaView : public views::View,
public views::DialogDelegate,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public ImageDecoder::Delegate,
public views::ButtonListener {
public:
@@ -44,26 +44,22 @@ class CaptchaView : public views::View,
CaptchaView(const GURL& captcha_url, bool is_standalone);
virtual ~CaptchaView() {}
- // views::DialogDelegate overrides:
+ // views::DialogDelegate:
virtual bool Accept();
-
- // views::WindowDelegate overrides:
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView() { return this; }
-
- // views::View overrides:
virtual std::wstring GetWindowTitle() const;
- // views::Textfield::Controller implementation:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
- const string16& new_contents) {}
+ const string16& new_contents) {}
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& key_event);
- // Overriden from ImageDownloader::Delegate:
+ // ImageDownloader::Delegate:
virtual void OnImageDecoded(const SkBitmap& decoded_image);
- // Overridden from views::ButtonListener.
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
// Initializes UI.
@@ -78,7 +74,7 @@ class CaptchaView : public views::View,
void SetCaptchaURL(const GURL& captcha_url);
protected:
- // views::View overrides:
+ // views::View:
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
diff --git a/chrome/browser/chromeos/login/existing_user_view.cc b/chrome/browser/chromeos/login/existing_user_view.cc
index 352c51b..b91d639 100644
--- a/chrome/browser/chromeos/login/existing_user_view.cc
+++ b/chrome/browser/chromeos/login/existing_user_view.cc
@@ -5,12 +5,13 @@
#include "chrome/browser/chromeos/login/existing_user_view.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/login/user_controller.h"
#include "chrome/browser/chromeos/login/textfield_with_margin.h"
+#include "chrome/browser/chromeos/login/user_controller.h"
#include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/background.h"
+#include "views/controls/textfield/textfield.h"
#include "views/focus/focus_manager.h"
#include "views/layout/fill_layout.h"
diff --git a/chrome/browser/chromeos/login/existing_user_view.h b/chrome/browser/chromeos/login/existing_user_view.h
index 08c4eea..be5c5ce 100644
--- a/chrome/browser/chromeos/login/existing_user_view.h
+++ b/chrome/browser/chromeos/login/existing_user_view.h
@@ -10,7 +10,7 @@
#include "chrome/browser/chromeos/login/user_input.h"
#include "views/accelerator.h"
#include "views/controls/button/native_button.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
namespace chromeos {
@@ -19,7 +19,7 @@ class UserController;
class ExistingUserView : public ThrobberHostView,
public UserInput,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
explicit ExistingUserView(UserController* user_controller);
@@ -27,23 +27,24 @@ class ExistingUserView : public ThrobberHostView,
void FocusPasswordField();
- // Overridden from views::View:
+ // views::View:
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
- // Overriden from Textfield::Controller:
+
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& keystroke);
virtual void RequestFocus();
- // Overriden from UserInput:
+ // UserInput:
virtual void EnableInputControls(bool enabled);
virtual void ClearAndFocusControls();
virtual void ClearAndFocusPassword();
virtual gfx::Rect GetMainInputScreenBounds() const;
protected:
- // Overridden from views::View:
+ // views::View:
virtual void OnLocaleChanged();
private:
diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
index 4e2f338..3945cf6 100644
--- a/chrome/browser/chromeos/login/new_user_view.cc
+++ b/chrome/browser/chromeos/login/new_user_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -34,6 +34,7 @@
#include "ui/gfx/font.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/controls/throbber.h"
#include "views/widget/widget_gtk.h"
diff --git a/chrome/browser/chromeos/login/new_user_view.h b/chrome/browser/chromeos/login/new_user_view.h
index 9762f94..3d3010b 100644
--- a/chrome/browser/chromeos/login/new_user_view.h
+++ b/chrome/browser/chromeos/login/new_user_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -15,7 +15,7 @@
#include "views/accelerator.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
namespace views {
@@ -30,7 +30,7 @@ namespace chromeos {
// allows to specify language preferences or initiate new account creation.
class NewUserView : public ThrobberHostView,
public UserInput,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::LinkController,
public views::ButtonListener {
public:
@@ -75,7 +75,7 @@ class NewUserView : public ThrobberHostView,
// Returns bounds of username field in screen coordinates.
gfx::Rect GetUsernameBounds() const;
- // Overridden from views::View:
+ // views::View:
virtual gfx::Size GetPreferredSize();
virtual void Layout();
virtual void RequestFocus();
@@ -87,24 +87,24 @@ class NewUserView : public ThrobberHostView,
// Attempt to login with the current field values.
void Login();
- // Overridden from views::Textfield::Controller
+ // views::TextfieldController:
// Not thread-safe, by virtue of using SetupSession().
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& keystroke);
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
- // Overridden from views::ButtonListener.
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // Overridden from views::LinkController.
+ // views::LinkController:
virtual void LinkActivated(views::Link* source, int event_flags);
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
- // Overridden from ThrobberHostView:
+ // ThrobberHostView:
virtual gfx::Rect CalculateThrobberBounds(views::Throbber* throbber);
- // Overridden from UserInput:
+ // UserInput:
virtual void EnableInputControls(bool enabled);
virtual void ClearAndFocusControls();
virtual void ClearAndFocusPassword();
@@ -115,7 +115,7 @@ class NewUserView : public ThrobberHostView,
bool NavigateAway();
protected:
- // views::View overrides:
+ // views::View:
virtual void ViewHierarchyChanged(bool is_add,
views::View *parent,
views::View *child);
diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc
index c25ef55..4f4de01 100644
--- a/chrome/browser/chromeos/login/password_changed_view.cc
+++ b/chrome/browser/chromeos/login/password_changed_view.cc
@@ -15,6 +15,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/button/radio_button.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
diff --git a/chrome/browser/chromeos/login/password_changed_view.h b/chrome/browser/chromeos/login/password_changed_view.h
index 32de8fa..34971d4 100644
--- a/chrome/browser/chromeos/login/password_changed_view.h
+++ b/chrome/browser/chromeos/login/password_changed_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,7 +9,7 @@
#include <string>
#include "views/controls/button/button.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
@@ -28,7 +28,7 @@ namespace chromeos {
class PasswordChangedView : public views::View,
public views::DialogDelegate,
public views::ButtonListener,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
// Delegate class to get notifications from the view.
class Delegate {
@@ -45,23 +45,23 @@ class PasswordChangedView : public views::View,
PasswordChangedView(Delegate* delegate, bool full_sync_disabled);
virtual ~PasswordChangedView() {}
- // views::DialogDelegate overrides:
+ // views::DialogDelegate:
virtual bool Accept();
virtual int GetDialogButtons() const;
- // views::WindowDelegate overrides:
+ // views::WindowDelegate:
virtual View* GetInitiallyFocusedView();
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView() { return this; }
- // views::View overrides:
+ // views::View:
virtual std::wstring GetWindowTitle() const;
- // views::ButtonListener overrides:
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
- // views::Textfield::Controller overrides:
+ // views::TextfieldController:
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& keystroke) {
return false;
@@ -70,7 +70,7 @@ class PasswordChangedView : public views::View,
const string16& new_contents) {}
protected:
- // views::View overrides:
+ // views::View:
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc
index 47edc02..ac39b7b 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.cc
+++ b/chrome/browser/chromeos/login/screen_lock_view.cc
@@ -23,6 +23,7 @@
#include "views/border.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/screen_lock_view.h b/chrome/browser/chromeos/login/screen_lock_view.h
index 6c1907a..7e05892 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.h
+++ b/chrome/browser/chromeos/login/screen_lock_view.h
@@ -10,7 +10,7 @@
#include "chrome/browser/chromeos/login/user_view.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
namespace views {
@@ -29,7 +29,7 @@ class ScreenLockerTester;
// ScreenLockView creates view components necessary to authenticate
// a user to unlock the screen.
class ScreenLockView : public ThrobberHostView,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public NotificationObserver,
public UserView::Delegate {
public:
@@ -47,23 +47,23 @@ class ScreenLockView : public ThrobberHostView,
// Returns the bounds of the password field in ScreenLocker's coordinate.
gfx::Rect GetPasswordBoundsRelativeTo(const views::View* view);
- // views::View implementation:
+ // views::View:
virtual void SetEnabled(bool enabled);
virtual void Layout();
virtual gfx::Size GetPreferredSize();
- // NotificationObserver implementation:
+ // NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
- // views::Textfield::Controller implementation:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& keystroke);
- // UserView::Delegate implementation:
+ // UserView::Delegate:
virtual void OnSignout();
virtual bool IsUserSelected() const { return true; }
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index b6aa775..8fd59fc 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -18,6 +18,7 @@
#include "views/controls/button/image_button.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
diff --git a/chrome/browser/chromeos/options/wifi_config_view.h b/chrome/browser/chromeos/options/wifi_config_view.h
index 74d973e..3761e84 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.h
+++ b/chrome/browser/chromeos/options/wifi_config_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -18,7 +18,7 @@
#include "views/controls/button/image_button.h"
#include "views/controls/button/native_button.h"
#include "views/controls/combobox/combobox.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
class FilePath;
@@ -29,7 +29,7 @@ class NetworkConfigView;
// A dialog box for showing a password textfield.
class WifiConfigView : public views::View,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::ButtonListener,
public views::Combobox::Listener,
public SelectFileDialog::Listener {
@@ -40,20 +40,20 @@ class WifiConfigView : public views::View,
explicit WifiConfigView(NetworkConfigView* parent);
virtual ~WifiConfigView();
- // views::Textfield::Controller methods.
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& key_event);
- // views::ButtonListener
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::Combobox::Listener
+ // views::Combobox::Listener:
virtual void ItemChanged(views::Combobox* combo_box,
int prev_index, int new_index);
- // SelectFileDialog::Listener implementation.
+ // SelectFileDialog::Listener:
virtual void FileSelected(const FilePath& path, int index, void* params);
// Login to network. Returns false if the dialog should remain open.
diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc
index 268fa7b..7012d10 100644
--- a/chrome/browser/ui/input_window_dialog_win.cc
+++ b/chrome/browser/ui/input_window_dialog_win.cc
@@ -10,6 +10,7 @@
#include "grit/generated_resources.h"
#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/dialog_delegate.h"
@@ -56,7 +57,7 @@ class WinInputWindowDialog : public InputWindowDialog {
// It registers accelerators that accept/cancel the input.
class ContentView : public views::View,
public views::DialogDelegate,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
explicit ContentView(WinInputWindowDialog* delegate)
: delegate_(delegate),
@@ -64,7 +65,7 @@ class ContentView : public views::View,
DCHECK(delegate_);
}
- // views::DialogDelegate overrides:
+ // views::DialogDelegate:
virtual bool IsDialogButtonEnabled(
MessageBoxFlags::DialogButton button) const;
virtual bool Accept();
@@ -74,7 +75,7 @@ class ContentView : public views::View,
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView();
- // views::Textfield::Controller overrides:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield*,
@@ -83,8 +84,9 @@ class ContentView : public views::View,
}
protected:
- // views::View overrides:
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ // views::View:
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
views::View* child);
private:
@@ -142,7 +144,7 @@ views::View* ContentView::GetContentsView() {
}
///////////////////////////////////////////////////////////////////////////////
-// ContentView, views::Textfield::Controller implementation:
+// ContentView, views::TextfieldController implementation:
void ContentView::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc
index e4d7943..3677c11 100644
--- a/chrome/browser/ui/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc
@@ -42,6 +42,7 @@
#include "views/controls/scroll_view.h"
#include "views/controls/separator.h"
#include "views/controls/table/table_view.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
@@ -841,7 +842,7 @@ void AutoFillProfilesView::EditableSetViewContents::ButtonPressed(
/////////////////////////////////////////////////////////////////////////////
// AutoFillProfilesView::EditableSetViewContents,
-// views::Textfield::Controller implementations
+// views::TextfieldController implementations:
void AutoFillProfilesView::EditableSetViewContents::ContentsChanged(
views::Textfield* sender, const string16& new_contents) {
if (temporary_info_.is_address) {
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.h b/chrome/browser/ui/views/autofill_profiles_view_win.h
index 46cf027..9e4d776 100644
--- a/chrome/browser/ui/views/autofill_profiles_view_win.h
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.h
@@ -22,7 +22,7 @@
#include "views/controls/combobox/combobox.h"
#include "views/controls/link.h"
#include "views/controls/table/table_view_observer.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/focus/focus_manager.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
@@ -249,7 +249,7 @@ class AutoFillProfilesView : public views::View,
class EditableSetViewContents : public views::View,
public views::DialogDelegate,
public views::ButtonListener,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::Combobox::Listener {
public:
EditableSetViewContents(AutoFillProfilesView* observer,
@@ -258,13 +258,14 @@ class AutoFillProfilesView : public views::View,
virtual ~EditableSetViewContents() {}
protected:
- // views::View methods:
+ // views::View:
virtual void Layout();
virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
views::View* child);
- // views::DialogDelegate methods:
+ // views::DialogDelegate:
virtual int GetDialogButtons() const;
virtual std::wstring GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const;
@@ -280,11 +281,11 @@ class AutoFillProfilesView : public views::View,
virtual bool Cancel();
virtual bool Accept();
- // views::ButtonListener methods:
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event);
- // views::Textfield::Controller methods:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
index 54f1ed5..3522049 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
@@ -25,6 +25,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
#include "views/controls/menu/menu_2.h"
+#include "views/controls/textfield/textfield.h"
#include "views/focus/focus_manager.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
index 0bdfbca..861805f 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h
@@ -14,6 +14,7 @@
#include "ui/base/models/tree_node_model.h"
#include "views/controls/button/button.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/controls/tree/tree_view.h"
#include "views/window/dialog_delegate.h"
@@ -44,7 +45,7 @@ class BookmarkEditorView : public BookmarkEditor,
public views::ButtonListener,
public views::TreeViewController,
public views::DialogDelegate,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::ContextMenuController,
public ui::SimpleMenuModel::Delegate,
public BookmarkModelObserver {
@@ -86,17 +87,18 @@ class BookmarkEditorView : public BookmarkEditor,
virtual bool AreAcceleratorsEnabled(MessageBoxFlags::DialogButton button);
virtual views::View* GetContentsView();
- // View methods.
+ // views::View.
virtual void Layout();
virtual gfx::Size GetPreferredSize();
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ virtual void ViewHierarchyChanged(bool is_add,
+ views::View* parent,
views::View* child);
- // TreeViewObserver methods.
+ // views::TreeViewObserver.
virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
virtual bool CanEdit(views::TreeView* tree_view, ui::TreeModelNode* node);
- // Textfield::Controller methods.
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
@@ -104,10 +106,10 @@ class BookmarkEditorView : public BookmarkEditor,
return false;
}
- // NativeButton.
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // ui::SimpleMenuModel::Delegate.
+ // ui::SimpleMenuModel::Delegate:
virtual bool IsCommandIdChecked(int command_id) const;
virtual bool IsCommandIdEnabled(int command_id) const;
virtual bool GetAcceleratorForCommandId(int command_id,
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc
index 5bae7f1..a727fdb 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.cc
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc
@@ -15,9 +15,10 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "views/controls/label.h"
#include "views/controls/image_view.h"
+#include "views/controls/label.h"
#include "views/controls/table/table_view.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.h b/chrome/browser/ui/views/edit_search_engine_dialog.h
index cdc9e81..12ae190 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.h
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -13,7 +13,7 @@
#include <windows.h>
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/window/dialog_delegate.h"
namespace views {
@@ -29,7 +29,7 @@ class TemplateURL;
class TemplateURLModel;
class EditSearchEngineDialog : public views::View,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::DialogDelegate {
public:
// The |template_url| and/or |delegate| may be NULL.
@@ -44,7 +44,7 @@ class EditSearchEngineDialog : public views::View,
EditSearchEngineControllerDelegate* delegate,
Profile* profile);
- // views::DialogDelegate overrides.
+ // views::DialogDelegate:
virtual bool IsModal() const;
virtual std::wstring GetWindowTitle() const;
virtual bool IsDialogButtonEnabled(
@@ -53,9 +53,9 @@ class EditSearchEngineDialog : public views::View,
virtual bool Accept();
virtual views::View* GetContentsView();
- // views::Textfield::Controller overrides. Updates whether the user can
- // accept the dialog as well as updating image views showing whether value is
- // valid.
+ // views::TextfieldController:
+ // Updates whether the user can accept the dialog as well as updating image
+ // views showing whether value is valid.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index c5f481a..109cc2c 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -28,6 +28,7 @@
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/focus/focus_manager.h"
#include "views/widget/widget.h"
@@ -464,7 +465,7 @@ void FindBarView::ButtonPressed(
}
////////////////////////////////////////////////////////////////////////////////
-// FindBarView, views::Textfield::Controller implementation:
+// FindBarView, views::TextfieldController implementation:
void FindBarView::ContentsChanged(views::Textfield* sender,
const string16& new_contents) {
diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h
index 646f138..55d103d 100644
--- a/chrome/browser/ui/views/find_bar_view.h
+++ b/chrome/browser/ui/views/find_bar_view.h
@@ -12,6 +12,7 @@
#include "ui/gfx/size.h"
#include "views/controls/button/button.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
class FindBarHost;
@@ -31,7 +32,7 @@ class View;
////////////////////////////////////////////////////////////////////////////////
class FindBarView : public DropdownBarView,
public views::ButtonListener,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
// A tag denoting which button the user pressed.
enum ButtonTag {
@@ -64,7 +65,7 @@ class FindBarView : public DropdownBarView,
// Claims focus for the text field and selects its contents.
virtual void SetFocusAndSelection(bool select_all);
- // Overridden from views::View:
+ // views::View:
virtual void OnPaint(gfx::Canvas* canvas);
virtual void Layout();
virtual gfx::Size GetPreferredSize();
@@ -72,10 +73,10 @@ class FindBarView : public DropdownBarView,
views::View* parent,
views::View* child);
- // Overridden from views::ButtonListener:
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // Overridden from views::Textfield::Controller:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
diff --git a/chrome/browser/ui/views/options/cookies_view.cc b/chrome/browser/ui/views/options/cookies_view.cc
index 5079266..05439cc 100644
--- a/chrome/browser/ui/views/options/cookies_view.cc
+++ b/chrome/browser/ui/views/options/cookies_view.cc
@@ -21,10 +21,10 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "views/border.h"
-#include "views/controls/label.h"
#include "views/controls/button/native_button.h"
-#include "views/controls/tree/tree_view.h"
+#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/tree/tree_view.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
@@ -132,7 +132,7 @@ void CookiesView::ButtonPressed(
}
///////////////////////////////////////////////////////////////////////////////
-// CookiesView, views::Textfield::Controller implementation:
+// CookiesView, views::TextfieldController implementation:
void CookiesView::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
@@ -157,6 +157,18 @@ bool CookiesView::HandleKeyEvent(views::Textfield* sender,
///////////////////////////////////////////////////////////////////////////////
// CookiesView, views::DialogDelegate implementation:
+int CookiesView::GetDialogButtons() const {
+ return MessageBoxFlags::DIALOGBUTTON_CANCEL;
+}
+
+views::View* CookiesView::GetInitiallyFocusedView() {
+ return search_field_;
+}
+
+bool CookiesView::CanResize() const {
+ return true;
+}
+
std::wstring CookiesView::GetWindowTitle() const {
return UTF16ToWide(
l10n_util::GetStringUTF16(IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE));
diff --git a/chrome/browser/ui/views/options/cookies_view.h b/chrome/browser/ui/views/options/cookies_view.h
index 0b05fc1..52fca4e 100644
--- a/chrome/browser/ui/views/options/cookies_view.h
+++ b/chrome/browser/ui/views/options/cookies_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -12,8 +12,8 @@
#include "chrome/browser/cookies_tree_model.h"
#include "net/base/cookie_monster.h"
#include "views/controls/button/button.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/controls/tree/tree_view.h"
-#include "views/controls/textfield/textfield.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
@@ -42,7 +42,7 @@ class CookiesView : public CookiesTreeModel::Observer,
public views::DialogDelegate,
public views::ButtonListener,
public views::TreeViewController,
- public views::Textfield::Controller {
+ public views::TextfieldController {
public:
// Show the Cookies Window, creating one if necessary.
static void ShowCookiesWindow(Profile* profile);
@@ -64,40 +64,33 @@ class CookiesView : public CookiesTreeModel::Observer,
virtual void TreeNodeChanged(ui::TreeModel* model, ui::TreeModelNode* node) {}
// End TreeModelObserver implementation.
- // views::ButtonListener implementation.
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::TreeViewController implementation.
+ // views::TreeViewController:
virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
-
- // views::TreeViewController implementation.
virtual void OnTreeViewKeyDown(ui::KeyboardCode keycode);
- // views::Textfield::Controller implementation.
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& key);
- // views::WindowDelegate implementation.
- virtual int GetDialogButtons() const {
- return MessageBoxFlags::DIALOGBUTTON_CANCEL;
- }
- virtual views::View* GetInitiallyFocusedView() {
- return search_field_;
- }
-
- virtual bool CanResize() const { return true; }
+ // views::WindowDelegate:
+ virtual int GetDialogButtons() const;
+ virtual views::View* GetInitiallyFocusedView();
+ virtual bool CanResize() const;
virtual std::wstring GetWindowTitle() const;
virtual void WindowClosing();
virtual views::View* GetContentsView();
- // views::View overrides:
+ // views::View:
virtual void Layout();
virtual gfx::Size GetPreferredSize();
protected:
- // views::View overrides:
+ // views::View:
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child);
diff --git a/chrome/browser/ui/views/options/exception_editor_view.cc b/chrome/browser/ui/views/options/exception_editor_view.cc
index c4404d3..f027572 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.cc
+++ b/chrome/browser/ui/views/options/exception_editor_view.cc
@@ -15,6 +15,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "views/window/window.h"
diff --git a/chrome/browser/ui/views/options/exception_editor_view.h b/chrome/browser/ui/views/options/exception_editor_view.h
index 8921653..af6d6f5 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.h
+++ b/chrome/browser/ui/views/options/exception_editor_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,14 +8,14 @@
#include <string>
-#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_setting_combo_model.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
-#include "views/window/dialog_delegate.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/combobox/combobox.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
+#include "views/window/dialog_delegate.h"
namespace views {
class ImageView;
@@ -31,7 +31,7 @@ class ContentExceptionsTableModel;
// To use an ExceptionEditorView create one and invoke Show on it.
// ExceptionEditorView is deleted when the dialog closes.
class ExceptionEditorView : public views::View,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::DialogDelegate {
public:
class Delegate {
@@ -71,9 +71,9 @@ class ExceptionEditorView : public views::View,
virtual bool Accept();
virtual views::View* GetContentsView();
- // views::Textfield::Controller overrides. Updates whether the user can
- // accept the dialog as well as updating image views showing whether value is
- // valid.
+ // views::TextfieldController:
+ // Updates whether the user can accept the dialog as well as updating image
+ // views showing whether value is valid.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
diff --git a/chrome/browser/ui/views/options/general_page_view.cc b/chrome/browser/ui/views/options/general_page_view.cc
index 0996b4a..9b618be 100644
--- a/chrome/browser/ui/views/options/general_page_view.cc
+++ b/chrome/browser/ui/views/options/general_page_view.cc
@@ -317,7 +317,7 @@ void GeneralPageView::ItemChanged(views::Combobox* combobox,
}
///////////////////////////////////////////////////////////////////////////////
-// GeneralPageView, views::Textfield::Controller implementation:
+// GeneralPageView, views::Textfield:Controller implementation:
void GeneralPageView::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
diff --git a/chrome/browser/ui/views/options/general_page_view.h b/chrome/browser/ui/views/options/general_page_view.h
index d8f5533..56e4396 100644
--- a/chrome/browser/ui/views/options/general_page_view.h
+++ b/chrome/browser/ui/views/options/general_page_view.h
@@ -11,10 +11,11 @@
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/views/options/options_page_view.h"
#include "chrome/browser/ui/views/url_picker.h"
-#include "views/controls/combobox/combobox.h"
#include "views/controls/button/button.h"
+#include "views/controls/combobox/combobox.h"
#include "views/controls/link.h"
#include "views/controls/table/table_view_observer.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
class CustomHomePagesTableModel;
@@ -37,7 +38,7 @@ class Textfield;
class GeneralPageView : public OptionsPageView,
public views::Combobox::Listener,
public views::ButtonListener,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public UrlPickerDelegate,
public views::TableViewObserver,
public ShellIntegration::DefaultBrowserObserver,
@@ -47,26 +48,26 @@ class GeneralPageView : public OptionsPageView,
virtual ~GeneralPageView();
protected:
- // views::ButtonListener implementation:
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // views::Combobox::Listener implementation:
+ // views::Combobox::Listener:
virtual void ItemChanged(views::Combobox* combobox,
int prev_index,
int new_index);
- // views::Textfield::Controller implementation:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& key_event);
- // OptionsPageView implementation:
+ // OptionsPageView:
virtual void InitControlLayout();
virtual void NotifyPrefChanged(const std::string* pref_name);
virtual void HighlightGroup(OptionsGroup highlight_group);
- // LinkController implementation:
+ // views::LinkController:
virtual void LinkActivated(views::Link* source, int event_flags);
private:
diff --git a/chrome/browser/ui/views/url_picker.h b/chrome/browser/ui/views/url_picker.h
index 42fd747..098876f 100644
--- a/chrome/browser/ui/views/url_picker.h
+++ b/chrome/browser/ui/views/url_picker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,7 +8,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/table/table_view_observer.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
@@ -42,11 +42,10 @@ class UrlPickerDelegate {
////////////////////////////////////////////////////////////////////////////////
class UrlPicker : public views::View,
public views::DialogDelegate,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::TableViewObserver {
public:
- UrlPicker(UrlPickerDelegate* delegate,
- Profile* profile);
+ UrlPicker(UrlPickerDelegate* delegate, Profile* profile);
virtual ~UrlPicker();
// Show the dialog on the provided contents.
@@ -55,7 +54,7 @@ class UrlPicker : public views::View,
// Closes the dialog.
void Close();
- // DialogDelegate.
+ // views::DialogDelegate:
virtual std::wstring GetWindowTitle() const;
virtual bool IsModal() const;
virtual std::wstring GetDialogButtonLabel(
@@ -66,7 +65,7 @@ class UrlPicker : public views::View,
MessageBoxFlags::DialogButton button) const;
virtual views::View* GetContentsView();
- // TextField::Controller.
+ // views::TextFieldController:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
virtual bool HandleKeyEvent(views::Textfield* sender,
@@ -74,11 +73,11 @@ class UrlPicker : public views::View,
return false;
}
- // Overridden from View.
+ // views::View:
virtual gfx::Size GetPreferredSize();
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
- // TableViewObserver.
+ // views::TableViewObserver:
virtual void OnSelectionChanged();
virtual void OnDoubleClick();
diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc
index 4e0b4cc..918b207 100644
--- a/views/controls/textfield/native_textfield_gtk.cc
+++ b/views/controls/textfield/native_textfield_gtk.cc
@@ -15,7 +15,9 @@
#include "views/controls/textfield/gtk_views_entry.h"
#include "views/controls/textfield/gtk_views_textview.h"
#include "views/controls/textfield/native_textfield_views.h"
+#include "views/controls/textfield/text_range.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/widget/widget_gtk.h"
namespace views {
@@ -383,7 +385,7 @@ gboolean NativeTextfieldGtk::OnKeyPressEventHandler(
}
gboolean NativeTextfieldGtk::OnKeyPressEvent(GdkEventKey* event) {
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller) {
KeyEvent key_event(reinterpret_cast<GdkEvent*>(event));
return controller->HandleKeyEvent(textfield_, key_event);
@@ -406,7 +408,7 @@ gboolean NativeTextfieldGtk::OnActivate() {
GdkEventKey* key_event = reinterpret_cast<GdkEventKey*>(event);
gboolean handled = false;
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller) {
KeyEvent views_key_event(event);
handled = controller->HandleKeyEvent(textfield_, views_key_event);
@@ -428,7 +430,7 @@ gboolean NativeTextfieldGtk::OnChangedHandler(
gboolean NativeTextfieldGtk::OnChanged() {
textfield_->SyncText();
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller)
controller->ContentsChanged(textfield_, GetText());
textfield_->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_TEXT_CHANGED);
diff --git a/views/controls/textfield/native_textfield_gtk.h b/views/controls/textfield/native_textfield_gtk.h
index 6f211ad..802d1fb 100644
--- a/views/controls/textfield/native_textfield_gtk.h
+++ b/views/controls/textfield/native_textfield_gtk.h
@@ -14,6 +14,8 @@
namespace views {
+class TextRange;
+
class NativeTextfieldGtk : public NativeControlGtk,
public NativeTextfieldWrapper {
public:
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index 775308a..d6214b2 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -18,7 +18,9 @@
#include "views/background.h"
#include "views/border.h"
#include "views/controls/menu/menu_2.h"
+#include "views/controls/textfield/text_range.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/controls/textfield/textfield_views_model.h"
#include "views/events/event.h"
#include "views/metrics.h"
@@ -162,7 +164,7 @@ void NativeTextfieldViews::UpdateText() {
UpdateCursorBoundsAndTextOffset();
SchedulePaint();
if (changed) {
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller)
controller->ContentsChanged(textfield_, GetText());
}
@@ -175,7 +177,7 @@ void NativeTextfieldViews::AppendText(const string16& text) {
UpdateCursorBoundsAndTextOffset();
SchedulePaint();
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller)
controller->ContentsChanged(textfield_, GetText());
}
@@ -291,7 +293,7 @@ size_t NativeTextfieldViews::GetCursorPosition() const {
}
bool NativeTextfieldViews::HandleKeyPressed(const views::KeyEvent& e) {
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
bool handled = false;
if (controller)
handled = controller->HandleKeyEvent(textfield_, e);
@@ -824,7 +826,7 @@ void NativeTextfieldViews::SetCursorForMouseClick(const views::MouseEvent& e) {
void NativeTextfieldViews::PropagateTextChange() {
textfield_->SyncText();
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
if (controller)
controller->ContentsChanged(textfield_, GetText());
}
diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h
index 5a21596..059e0f9bee 100644
--- a/views/controls/textfield/native_textfield_views.h
+++ b/views/controls/textfield/native_textfield_views.h
@@ -20,13 +20,14 @@ class Time;
namespace gfx {
class Canvas;
-} // namespace
+}
namespace views {
class KeyEvent;
class Menu2;
class TextfieldViewsModel;
+class TextRange;
// A views/skia only implementation of NativeTextfieldWrapper.
// No platform specific code is used.
diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc
index d8e8d1f..b284e6e 100644
--- a/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/views/controls/textfield/native_textfield_views_unittest.cc
@@ -12,13 +12,14 @@
#include "views/controls/menu/menu_2.h"
#include "views/controls/textfield/native_textfield_views.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/controls/textfield/textfield_views_model.h"
#include "views/events/event.h"
#include "views/focus/focus_manager.h"
#include "views/test/test_views_delegate.h"
#include "views/test/views_test_base.h"
-#include "views/widget/widget.h"
#include "views/views_delegate.h"
+#include "views/widget/widget.h"
namespace views {
@@ -33,7 +34,7 @@ namespace views {
// textfield_unittests.cc once we move the test utility functions
// from chrome/browser/automation/ to app/test/.
class NativeTextfieldViewsTest : public ViewsTestBase,
- public Textfield::Controller {
+ public TextfieldController {
public:
NativeTextfieldViewsTest()
: widget_(NULL),
@@ -42,7 +43,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase,
model_(NULL) {
}
- // ::testing::Test overrides.
+ // ::testing::Test:
virtual void SetUp() {
NativeTextfieldViews::SetEnableTextfieldViews(true);
}
@@ -54,7 +55,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase,
ViewsTestBase::TearDown();
}
- // Textfield::Controller implementation:
+ // TextfieldController:
virtual void ContentsChanged(Textfield* sender,
const string16& new_contents){
last_contents_ = new_contents;
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 60c5b56..8296e26 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -14,17 +14,19 @@
#include "skia/ext/skia_utils_win.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
-#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/keycodes/keyboard_code_conversion_win.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/gfx/native_theme_win.h"
#include "views/controls/label.h"
-#include "views/controls/menu/menu_win.h"
#include "views/controls/menu/menu_2.h"
+#include "views/controls/menu/menu_win.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/textfield/native_textfield_views.h"
+#include "views/controls/textfield/text_range.h"
#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/focus/focus_manager.h"
#include "views/focus/focus_util_win.h"
#include "views/metrics.h"
@@ -934,7 +936,7 @@ void NativeTextfieldWin::HandleKeystroke() {
const MSG* msg = GetCurrentMessage();
ScopedFreeze freeze(this, GetTextObjectModel());
- Textfield::Controller* controller = textfield_->GetController();
+ TextfieldController* controller = textfield_->GetController();
bool handled = false;
if (controller) {
KeyEvent event(*msg);
diff --git a/views/controls/textfield/text_range.h b/views/controls/textfield/text_range.h
new file mode 100644
index 0000000..c367444
--- /dev/null
+++ b/views/controls/textfield/text_range.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 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 VIEWS_CONTROLS_TEXTFIELD_TEXT_RANGE_H_
+#define VIEWS_CONTROLS_TEXTFIELD_TEXT_RANGE_H_
+#pragma once
+
+#include <stddef.h>
+
+#include <algorithm>
+
+namespace views {
+
+// TextRange specifies the range of text in the Textfield. This is used to
+// specify selected text and will be used to change the attributes of characters
+// in the textfield. When this is used for selection, the end is caret position,
+// and the start is where selection started. The range preserves the direction,
+// and selecting from the end to the begining is considered "reverse" order.
+// (that is, start > end is reverse)
+class TextRange {
+ public:
+ TextRange() : start_(0), end_(0) {}
+ TextRange(size_t start, size_t end) : start_(start), end_(end) {}
+
+ // Allow copy so that the omnibox can save the view state for each tabs.
+ explicit TextRange(const TextRange& range)
+ : start_(range.start_),
+ end_(range.end_) {}
+
+ // Returns the start position;
+ size_t start() const { return start_; }
+
+ // Returns the end position.
+ size_t end() const { return end_; }
+
+ // Returns true if the selected text is empty.
+ bool is_empty() const { return start_ == end_; }
+
+ // Returns true if the selection is made in reverse order.
+ bool is_reverse() const { return start_ > end_; }
+
+ // Returns the min of selected range.
+ size_t GetMin() const { return std::min(start_, end_); }
+
+ // Returns the max of selected range.
+ size_t GetMax() const { return std::max(start_, end_); }
+
+ // Returns true if the the selection range is same ignoring the direction.
+ bool EqualsIgnoringDirection(const TextRange& range) const {
+ return GetMin() == range.GetMin() && GetMax() == range.GetMax();
+ }
+
+ // Set the range with |start| and |end|.
+ void SetRange(size_t start, size_t end) {
+ start_ = start;
+ end_ = end;
+ }
+
+ private:
+ size_t start_;
+ size_t end_;
+};
+
+} // namespace views
+
+#endif // VIEWS_CONTROLS_TEXTFIELD_TEXT_RANGE_H_
diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc
index 8c1003b..b5ab72a 100644
--- a/views/controls/textfield/textfield.cc
+++ b/views/controls/textfield/textfield.cc
@@ -16,6 +16,8 @@
#include "ui/gfx/insets.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/textfield/native_textfield_wrapper.h"
+#include "views/controls/textfield/text_range.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/widget/widget.h"
#if defined(OS_LINUX)
@@ -24,8 +26,8 @@
#include "base/win/win_util.h"
// TODO(beng): this should be removed when the OS_WIN hack from
// ViewHierarchyChanged is removed.
-#include "views/controls/textfield/native_textfield_win.h"
#include "views/controls/textfield/native_textfield_views.h"
+#include "views/controls/textfield/native_textfield_win.h"
#include "views/events/event_utils_win.h"
#endif
@@ -35,27 +37,6 @@ namespace views {
const char Textfield::kViewClassName[] = "views/Textfield";
/////////////////////////////////////////////////////////////////////////////
-// TextRange
-
-TextRange::TextRange(size_t start, size_t end)
- : start_(start),
- end_(end) {
-}
-
-size_t TextRange::GetMin() const {
- return std::min(start_, end_);
-}
-
-size_t TextRange::GetMax() const {
- return std::max(start_, end_);
-}
-
-void TextRange::SetRange(size_t start, size_t end) {
- start_ = start;
- end_ = end;
-}
-
-/////////////////////////////////////////////////////////////////////////////
// Textfield
Textfield::Textfield()
@@ -97,11 +78,11 @@ Textfield::Textfield(StyleFlags style)
Textfield::~Textfield() {
}
-void Textfield::SetController(Controller* controller) {
+void Textfield::SetController(TextfieldController* controller) {
controller_ = controller;
}
-Textfield::Controller* Textfield::GetController() const {
+TextfieldController* Textfield::GetController() const {
return controller_;
}
diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h
index a4f2aec..23ec627 100644
--- a/views/controls/textfield/textfield.h
+++ b/views/controls/textfield/textfield.h
@@ -15,6 +15,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/string16.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/keycodes/keyboard_codes.h"
@@ -33,94 +34,29 @@ namespace views {
class KeyEvent;
class NativeTextfieldWrapper;
+class TextfieldController;
+class TextRange;
-// TextRange specifies the range of text in the Textfield. This is
-// used to specify selected text and will be used to change the
-// attributes of characters in the textfield. When this is used for
-// selection, the end is caret position, and the start is where
-// selection started. The range preserves the direction, and
-// selecting from the end to the begining is considered "reverse"
-// order. (that is, start > end is reverse)
-class TextRange {
- public:
- TextRange() : start_(0), end_(0) {}
- TextRange(size_t start, size_t end);
-
- // Allow copy so that the omnibox can save the view state
- // for each tabs.
- explicit TextRange(const TextRange& range)
- : start_(range.start_), end_(range.end_) {}
-
- // Returns the start position;
- size_t start() const { return start_; }
-
- // Returns the end position.
- size_t end() const { return end_; }
-
- // Returns true if the selected text is empty.
- bool is_empty() const { return start_ == end_; }
-
- // Returns true if the selection is made in reverse order.
- bool is_reverse() const { return start_ > end_; }
-
- // Returns the min of selected range.
- size_t GetMin() const;
-
- // Returns the max of selected range.
- size_t GetMax() const;
-
- // Returns true if the the selection range is same ignoring the direction.
- bool EqualsIgnoringDirection(const TextRange& range) const {
- return GetMin() == range.GetMin() && GetMax() == range.GetMax();
- }
-
- // Set the range with |start| and |end|.
- void SetRange(size_t start, size_t end);
-
- private:
- size_t start_;
- size_t end_;
-
- // No assign.
- void operator=(const TextRange&);
-};
-
-// This class implements a ChromeView that wraps a native text (edit) field.
+// This class implements a View that wraps a native text (edit) field.
class Textfield : public View {
public:
// The button's class name.
static const char kViewClassName[];
- // This defines the callback interface for other code to be notified of
- // changes in the state of a text field.
- class Controller {
- public:
- // This method is called whenever the text in the field changes.
- virtual void ContentsChanged(Textfield* sender,
- const string16& new_contents) = 0;
-
- // This method is called to get notified about keystrokes in the edit.
- // This method returns true if the message was handled and should not be
- // processed further. If it returns false the processing continues.
- virtual bool HandleKeyEvent(Textfield* sender,
- const KeyEvent& key_event) = 0;
- };
-
enum StyleFlags {
- STYLE_DEFAULT = 0,
- STYLE_PASSWORD = 1<<0,
- STYLE_MULTILINE = 1<<1,
- STYLE_LOWERCASE = 1<<2
+ STYLE_DEFAULT = 0,
+ STYLE_PASSWORD = 1 << 0,
+ STYLE_MULTILINE = 1 << 1,
+ STYLE_LOWERCASE = 1 << 2
};
Textfield();
explicit Textfield(StyleFlags style);
virtual ~Textfield();
-
- // Controller accessors
- void SetController(Controller* controller);
- Controller* GetController() const;
+ // TextfieldController accessors
+ void SetController(TextfieldController* controller);
+ TextfieldController* GetController() const;
// Gets/Sets whether or not the Textfield is read-only.
bool read_only() const { return read_only_; }
@@ -287,7 +223,7 @@ class Textfield : public View {
private:
// This is the current listener for events from this Textfield.
- Controller* controller_;
+ TextfieldController* controller_;
// The mask of style options for this Textfield.
StyleFlags style_;
diff --git a/views/controls/textfield/textfield_controller.h b/views/controls/textfield/textfield_controller.h
new file mode 100644
index 0000000..53fe97c
--- /dev/null
+++ b/views/controls/textfield/textfield_controller.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 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 VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_
+#define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_
+#pragma once
+
+#include "base/string16.h"
+
+namespace views {
+
+class KeyEvent;
+class Textfield;
+
+// This defines the callback interface for other code to be notified of changes
+// in the state of a text field.
+class TextfieldController {
+ public:
+ // This method is called whenever the text in the field changes.
+ virtual void ContentsChanged(Textfield* sender,
+ const string16& new_contents) = 0;
+
+ // This method is called to get notified about keystrokes in the edit.
+ // Returns true if the message was handled and should not be processed
+ // further. If it returns false the processing continues.
+ virtual bool HandleKeyEvent(Textfield* sender,
+ const KeyEvent& key_event) = 0;
+};
+
+} // namespace views
+
+#endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_
diff --git a/views/controls/textfield/textfield_views_model.cc b/views/controls/textfield/textfield_views_model.cc
index e63c28a..4d88ffb 100644
--- a/views/controls/textfield/textfield_views_model.cc
+++ b/views/controls/textfield/textfield_views_model.cc
@@ -12,8 +12,9 @@
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/gfx/font.h"
-#include "views/views_delegate.h"
+#include "views/controls/textfield/text_range.h"
#include "views/controls/textfield/textfield.h"
+#include "views/views_delegate.h"
namespace views {
diff --git a/views/controls/textfield/textfield_views_model_unittest.cc b/views/controls/textfield/textfield_views_model_unittest.cc
index b0a29c4..b44b487 100644
--- a/views/controls/textfield/textfield_views_model_unittest.cc
+++ b/views/controls/textfield/textfield_views_model_unittest.cc
@@ -9,6 +9,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#include "views/controls/textfield/text_range.h"
#include "views/controls/textfield/textfield.h"
#include "views/controls/textfield/textfield_views_model.h"
#include "views/test/test_views_delegate.h"
diff --git a/views/examples/textfield_example.cc b/views/examples/textfield_example.cc
index 3266e56..61a3175 100644
--- a/views/examples/textfield_example.cc
+++ b/views/examples/textfield_example.cc
@@ -6,6 +6,7 @@
#include "base/utf_string_conversions.h"
#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
#include "views/layout/grid_layout.h"
#include "views/view.h"
diff --git a/views/examples/textfield_example.h b/views/examples/textfield_example.h
index a94797b..1535efb 100644
--- a/views/examples/textfield_example.h
+++ b/views/examples/textfield_example.h
@@ -12,31 +12,31 @@
#include "base/compiler_specific.h"
#include "base/string16.h"
#include "views/controls/button/text_button.h"
-#include "views/controls/textfield/textfield.h"
+#include "views/controls/textfield/textfield_controller.h"
#include "views/examples/example_base.h"
namespace examples {
// TextfieldExample mimics login screen.
class TextfieldExample : public ExampleBase,
- public views::Textfield::Controller,
+ public views::TextfieldController,
public views::ButtonListener {
public:
explicit TextfieldExample(ExamplesMain* main);
virtual ~TextfieldExample();
- // Overridden from ExampleBase:
+ // ExampleBase:
virtual std::wstring GetExampleTitle() OVERRIDE;
virtual void CreateExampleView(views::View* container) OVERRIDE;
private:
- // Overridden from views::Textfield::Controller:
+ // views::TextfieldController:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents) OVERRIDE;
virtual bool HandleKeyEvent(views::Textfield* sender,
const views::KeyEvent& key_event) OVERRIDE;
- // Overridden from views::ButtonListener:
+ // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const views::Event& event) OVERRIDE;
diff --git a/views/views.gyp b/views/views.gyp
index 5bb721b..0bda492 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -236,8 +236,10 @@
'controls/textfield/gtk_views_entry.h',
'controls/textfield/gtk_views_textview.cc',
'controls/textfield/gtk_views_textview.h',
+ 'controls/textfield/text_range.h',
'controls/textfield/textfield.cc',
'controls/textfield/textfield.h',
+ 'controls/textfield/textfield_controller.h',
'controls/textfield/textfield_views_model.cc',
'controls/textfield/textfield_views_model.h',
'controls/textfield/native_textfield_gtk.cc',