diff options
Diffstat (limited to 'chrome/browser/views')
42 files changed, 365 insertions, 413 deletions
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index 3e4db18..632357f 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -16,8 +16,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/controls/button/button.h" -#include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/text_field.h" #include "grit/generated_resources.h" @@ -207,11 +205,10 @@ void BookmarkBubbleView::Init() { remove_link_->SetController(this); edit_button_ = new NativeButton( - l10n_util::GetString(IDS_BOOMARK_BUBBLE_OPTIONS)); - edit_button_->SetListener(this); + this, l10n_util::GetString(IDS_BOOMARK_BUBBLE_OPTIONS)); - close_button_ = new NativeButton(l10n_util::GetString(IDS_CLOSE), true); - close_button_->SetListener(this); + close_button_ = new NativeButton(this, l10n_util::GetString(IDS_CLOSE)); + close_button_->SetIsDefault(true); parent_combobox_ = new ComboBox(&parent_model_); parent_combobox_->SetSelectedItem(parent_model_.node_parent_index()); @@ -291,7 +288,7 @@ std::wstring BookmarkBubbleView::GetTitle() { return std::wstring(); } -void BookmarkBubbleView::ButtonPressed(views::NativeButton* sender) { +void BookmarkBubbleView::ButtonPressed(views::Button* sender) { if (sender == edit_button_) { UserMetrics::RecordAction(L"BookmarkBubble_Edit", profile_); ShowEditor(); diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h index 3109d8e..f94039a 100644 --- a/chrome/browser/views/bookmark_bubble_view.h +++ b/chrome/browser/views/bookmark_bubble_view.h @@ -7,7 +7,7 @@ #include "base/gfx/rect.h" #include "chrome/browser/views/info_bubble.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/link.h" #include "chrome/views/view.h" @@ -19,7 +19,7 @@ class BookmarkModel; class BookmarkNode; namespace views { -class CheckBox; +class NativeButton; class TextField; } @@ -29,7 +29,7 @@ class TextField; // instead use the static Show method. class BookmarkBubbleView : public views::View, public views::LinkController, - public views::NativeButton::Listener, + public views::ButtonListener, public views::ComboBox::Listener, public InfoBubbleDelegate { public: @@ -102,7 +102,7 @@ class BookmarkBubbleView : public views::View, virtual void LinkActivated(views::Link* source, int event_flags); // ButtonListener method, closes the bubble or opens the edit dialog. - virtual void ButtonPressed(views::NativeButton* sender); + virtual void ButtonPressed(views::Button* sender); // ComboBox::Listener method. Changes the parent of the bookmark. virtual void ItemChanged(views::ComboBox* combo_box, diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index d88aa9b7..b5a2f6d 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -15,6 +15,7 @@ #include "chrome/views/background.h" #include "chrome/views/focus/focus_manager.h" #include "chrome/views/grid_layout.h" +#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/label.h" #include "chrome/views/widget/widget.h" #include "chrome/views/window/window.h" @@ -24,6 +25,7 @@ #include "grit/locale_settings.h" using base::Time; +using views::Button; using views::ColumnSet; using views::GridLayout; using views::Label; @@ -168,7 +170,7 @@ void BookmarkEditorView::ContentsChanged(TextField* sender, UserInputChanged(); } -void BookmarkEditorView::ButtonPressed(NativeButton* sender) { +void BookmarkEditorView::ButtonPressed(Button* sender) { DCHECK(sender); switch (sender->GetID()) { case kNewGroupButtonID: @@ -248,13 +250,12 @@ void BookmarkEditorView::Init() { if (show_tree_) { tree_view_ = new views::TreeView(); new_group_button_.reset(new views::NativeButton( - l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))); + this, l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))); new_group_button_->SetParentOwned(false); tree_view_->SetContextMenuController(this); tree_view_->SetRootShown(false); new_group_button_->SetEnabled(false); - new_group_button_->SetListener(this); new_group_button_->SetID(kNewGroupButtonID); } diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h index 932d9b7..ed1b001 100644 --- a/chrome/browser/views/bookmark_editor_view.h +++ b/chrome/browser/views/bookmark_editor_view.h @@ -8,8 +8,7 @@ #include <set> #include "chrome/browser/bookmarks/bookmark_model.h" -#include "chrome/views/controls/button/checkbox.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/menu/menu.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/controls/tree/tree_node_model.h" @@ -17,6 +16,7 @@ #include "chrome/views/window/dialog_delegate.h" namespace views { +class NativeButton; class Window; } @@ -33,7 +33,7 @@ class Profile; // To use BookmarkEditorView invoke the static show method. class BookmarkEditorView : public views::View, - public views::NativeButton::Listener, + public views::ButtonListener, public views::TreeViewController, public views::DialogDelegate, public views::TextField::Controller, @@ -111,8 +111,8 @@ class BookmarkEditorView : public views::View, UINT message, TCHAR key, UINT repeat_count, UINT flags) {} - // NativeButton/CheckBox. - virtual void ButtonPressed(views::NativeButton* sender); + // NativeButton. + virtual void ButtonPressed(views::Button* sender); // Menu::Delegate method. virtual void ExecuteCommand(int id); diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc index 0256758..2ae5afa 100644 --- a/chrome/browser/views/bug_report_view.cc +++ b/chrome/browser/views/bug_report_view.cc @@ -167,12 +167,12 @@ void BugReportView::SetupControl() { new views::TextField(views::TextField::STYLE_MULTILINE); description_text_->SetHeightInLines(kDescriptionLines); - include_page_source_checkbox_ = new views::CheckBox( + include_page_source_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_BUGREPORT_INCLUDE_PAGE_SOURCE_CHKBOX)); - include_page_source_checkbox_->SetIsSelected(true); - include_page_image_checkbox_ = new views::CheckBox( + include_page_source_checkbox_->SetChecked(true); + include_page_image_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_BUGREPORT_INCLUDE_PAGE_IMAGE_CHKBOX)); - include_page_image_checkbox_->SetIsSelected(true); + include_page_image_checkbox_->SetChecked(true); // Arranges controls by using GridLayout. const int column_set_id = 0; @@ -249,9 +249,9 @@ void BugReportView::ItemChanged(views::ComboBox* combo_box, old_report_text_.clear(); } include_page_source_checkbox_->SetEnabled(!is_phishing_report); - include_page_source_checkbox_->SetIsSelected(!is_phishing_report); + include_page_source_checkbox_->SetChecked(!is_phishing_report); include_page_image_checkbox_->SetEnabled(!is_phishing_report); - include_page_image_checkbox_->SetIsSelected(!is_phishing_report); + include_page_image_checkbox_->SetChecked(!is_phishing_report); GetDialogClientView()->UpdateDialogButtons(); } @@ -448,7 +448,7 @@ void BugReportView::SendReport() { } // include the page image if we have one - if (include_page_image_checkbox_->IsSelected() && png_data_.get()) { + if (include_page_image_checkbox_->checked() && png_data_.get()) { post_body.append("--" + mime_boundary + "\r\n"); post_body.append("Content-Disposition: form-data; name=\"screenshot\"; " "filename=\"screenshot.png\"\r\n"); @@ -463,7 +463,7 @@ void BugReportView::SendReport() { } // TODO(awalker): include the page source if we can get it - if (include_page_source_checkbox_->IsSelected()) { + if (include_page_source_checkbox_->checked()) { } // terminate the body diff --git a/chrome/browser/views/bug_report_view.h b/chrome/browser/views/bug_report_view.h index 859f7fe..de3e4b4 100644 --- a/chrome/browser/views/bug_report_view.h +++ b/chrome/browser/views/bug_report_view.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_VIEWS_BUGREPORT_VIEW_H_ #include "chrome/browser/net/url_fetcher.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/view.h" @@ -14,7 +13,7 @@ #include "googleurl/src/gurl.h" namespace views { -class CheckBox; +class Checkbox; class Label; class Throbber; class Window; @@ -99,8 +98,8 @@ class BugReportView : public views::View, views::TextField* page_url_text_; views::Label* description_label_; views::TextField* description_text_; - views::CheckBox* include_page_source_checkbox_; - views::CheckBox* include_page_image_checkbox_; + views::Checkbox* include_page_source_checkbox_; + views::Checkbox* include_page_image_checkbox_; scoped_ptr<BugReportComboBoxModel> bug_type_model_; diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index f57370d..5a0df99 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -10,7 +10,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/checkbox.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/throbber.h" #include "chrome/views/window/window.h" @@ -252,12 +251,12 @@ bool ClearBrowsingDataView::IsDialogButtonEnabled(DialogButton button) const { return false; if (button == DIALOGBUTTON_OK) { - return del_history_checkbox_->IsSelected() || - del_downloads_checkbox_->IsSelected() || - del_cache_checkbox_->IsSelected() || - del_cookies_checkbox_->IsSelected() || - del_passwords_checkbox_->IsSelected() || - del_form_data_checkbox_->IsSelected(); + return del_history_checkbox_->checked() || + del_downloads_checkbox_->checked() || + del_cache_checkbox_->checked() || + del_cookies_checkbox_->checked() || + del_passwords_checkbox_->checked() || + del_form_data_checkbox_->checked(); } return true; @@ -333,25 +332,25 @@ void ClearBrowsingDataView::ItemChanged(views::ComboBox* sender, //////////////////////////////////////////////////////////////////////////////// // ClearBrowsingDataView, views::ButtonListener implementation: -void ClearBrowsingDataView::ButtonPressed(views::NativeButton* sender) { +void ClearBrowsingDataView::ButtonPressed(views::Button* sender) { if (sender == del_history_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory, - del_history_checkbox_->IsSelected() ? true : false); + del_history_checkbox_->checked() ? true : false); else if (sender == del_downloads_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory, - del_downloads_checkbox_->IsSelected() ? true : false); + del_downloads_checkbox_->checked() ? true : false); else if (sender == del_cache_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache, - del_cache_checkbox_->IsSelected() ? true : false); + del_cache_checkbox_->checked() ? true : false); else if (sender == del_cookies_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies, - del_cookies_checkbox_->IsSelected() ? true : false); + del_cookies_checkbox_->checked() ? true : false); else if (sender == del_passwords_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords, - del_passwords_checkbox_->IsSelected() ? true : false); + del_passwords_checkbox_->checked() ? true : false); else if (sender == del_form_data_checkbox_) profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData, - del_form_data_checkbox_->IsSelected() ? true : false); + del_form_data_checkbox_->checked() ? true : false); // When no checkbox is checked we should not have the action button enabled. // This forces the button to evaluate what state they should be in. @@ -361,11 +360,11 @@ void ClearBrowsingDataView::ButtonPressed(views::NativeButton* sender) { //////////////////////////////////////////////////////////////////////////////// // ClearBrowsingDataView, private: -views::CheckBox* ClearBrowsingDataView::AddCheckbox(const std::wstring& text, +views::Checkbox* ClearBrowsingDataView::AddCheckbox(const std::wstring& text, bool checked) { - views::CheckBox* checkbox = new views::CheckBox(text); - checkbox->SetIsSelected(checked); - checkbox->SetListener(this); + views::Checkbox* checkbox = new views::Checkbox(text); + checkbox->SetChecked(checked); + checkbox->set_listener(this); AddChildView(checkbox); return checkbox; } @@ -394,8 +393,8 @@ void ClearBrowsingDataView::UpdateControlEnabledState() { // Convenience method that returns true if the supplied checkbox is selected // and enabled. -static bool IsCheckBoxEnabledAndSelected(views::CheckBox* cb) { - return (cb->IsEnabled() && cb->IsSelected()); +static bool IsCheckBoxEnabledAndSelected(views::Checkbox* cb) { + return (cb->IsEnabled() && cb->checked()); } void ClearBrowsingDataView::OnDelete() { diff --git a/chrome/browser/views/clear_browsing_data.h b/chrome/browser/views/clear_browsing_data.h index 3a387fd..18912fc 100644 --- a/chrome/browser/views/clear_browsing_data.h +++ b/chrome/browser/views/clear_browsing_data.h @@ -6,14 +6,14 @@ #define CHROME_BROWSER_VIEWS_CLEAR_BROWSING_DATA_H__ #include "chrome/browser/browsing_data_remover.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/label.h" #include "chrome/views/view.h" #include "chrome/views/window/dialog_delegate.h" namespace views { -class CheckBox; +class Checkbox; class Label; class Throbber; class Window; @@ -32,7 +32,7 @@ class MessageLoop; class ClearBrowsingDataView : public views::View, public views::DialogDelegate, public views::ComboBox::Model, - public views::NativeButton::Listener, + public views::ButtonListener, public views::ComboBox::Listener, public BrowsingDataRemover::Observer { public: @@ -65,8 +65,8 @@ class ClearBrowsingDataView : public views::View, virtual int GetItemCount(views::ComboBox* source); virtual std::wstring GetItemAt(views::ComboBox* source, int index); - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); // Overridden from views::ComboBox::Listener: virtual void ItemChanged(views::ComboBox* sender, int prev_index, @@ -74,7 +74,7 @@ class ClearBrowsingDataView : public views::View, private: // Adds a new check-box as a child to the view. - views::CheckBox* AddCheckbox(const std::wstring& text, bool checked); + views::Checkbox* AddCheckbox(const std::wstring& text, bool checked); // Sets the controls on the UI to be enabled/disabled depending on whether we // have a delete operation in progress or not. @@ -92,12 +92,12 @@ class ClearBrowsingDataView : public views::View, views::Label status_label_; // Other UI elements. views::Label* delete_all_label_; - views::CheckBox* del_history_checkbox_; - views::CheckBox* del_downloads_checkbox_; - views::CheckBox* del_cache_checkbox_; - views::CheckBox* del_cookies_checkbox_; - views::CheckBox* del_passwords_checkbox_; - views::CheckBox* del_form_data_checkbox_; + views::Checkbox* del_history_checkbox_; + views::Checkbox* del_downloads_checkbox_; + views::Checkbox* del_cache_checkbox_; + views::Checkbox* del_cookies_checkbox_; + views::Checkbox* del_passwords_checkbox_; + views::Checkbox* del_form_data_checkbox_; views::Label* time_period_label_; views::ComboBox* time_period_combobox_; diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index de402da..9865d5d 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -252,13 +252,11 @@ DownloadItemView::DownloadItemView(DownloadItem* download, warning_icon_ = rb.GetBitmapNamed(IDR_WARNING); save_button_ = new views::NativeButton( - l10n_util::GetString(IDS_SAVE_DOWNLOAD)); - save_button_->set_enforce_dlu_min_size(false); - save_button_->SetListener(this); + this, l10n_util::GetString(IDS_SAVE_DOWNLOAD)); + save_button_->set_ignore_minimum_size(true); discard_button_ = new views::NativeButton( - l10n_util::GetString(IDS_DISCARD_DOWNLOAD)); - discard_button_->SetListener(this); - discard_button_->set_enforce_dlu_min_size(false); + this, l10n_util::GetString(IDS_DISCARD_DOWNLOAD)); + discard_button_->set_ignore_minimum_size(true); AddChildView(save_button_); AddChildView(discard_button_); std::wstring file_name = download->original_name().ToWStringHack(); @@ -387,7 +385,7 @@ void DownloadItemView::Layout() { } } -void DownloadItemView::ButtonPressed(views::NativeButton* sender) { +void DownloadItemView::ButtonPressed(views::Button* sender) { if (sender == discard_button_) { if (download_->state() == DownloadItem::IN_PROGRESS) download_->Cancel(true); diff --git a/chrome/browser/views/download_item_view.h b/chrome/browser/views/download_item_view.h index 8f87c04..d266935 100644 --- a/chrome/browser/views/download_item_view.h +++ b/chrome/browser/views/download_item_view.h @@ -21,22 +21,24 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/timer.h" +#include "chrome/common/gfx/chrome_font.h" #include "chrome/common/slide_animation.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/icon_manager.h" #include "chrome/views/event.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/view.h" namespace views { class Label; +class NativeButton; } class BaseDownloadItemModel; class DownloadShelfView; class SkBitmap; -class DownloadItemView : public views::NativeButton::Listener, +class DownloadItemView : public views::ButtonListener, public views::View, public DownloadItem::Observer, public AnimationDelegate { @@ -59,8 +61,8 @@ class DownloadItemView : public views::NativeButton::Listener, virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); virtual bool OnMouseDragged(const views::MouseEvent& event); - // NativeButton::Listener implementation. - virtual void ButtonPressed(views::NativeButton* sender); + // ButtonListener implementation. + virtual void ButtonPressed(views::Button* sender); // AnimationDelegate implementation. virtual void AnimationProgressed(const Animation* animation); diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 4e4f111..6f06973 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -50,7 +50,7 @@ std::wstring GetDefaultSearchEngineName(Profile* profile) { // Implements the client view inside the first run bubble. It is kind of a // dialog-ish view, but is not a true dialog. class FirstRunBubbleView : public views::View, - public views::NativeButton::Listener, + public views::ButtonListener, public views::FocusChangeListener { public: FirstRunBubbleView(FirstRunBubble* bubble_window, Profile* profile) @@ -90,18 +90,17 @@ class FirstRunBubbleView : public views::View, std::wstring keep_str = l10n_util::GetStringF(IDS_FR_BUBBLE_OK, GetDefaultSearchEngineName(profile)); - keep_button_ = new views::NativeButton(keep_str, true); - keep_button_->SetListener(this); + keep_button_ = new views::NativeButton(this, keep_str); + keep_button_->SetIsDefault(true); AddChildView(keep_button_); std::wstring change_str = l10n_util::GetString(IDS_FR_BUBBLE_CHANGE); - change_button_ = new views::NativeButton(change_str); - change_button_->SetListener(this); + change_button_ = new views::NativeButton(this, change_str); AddChildView(change_button_); } - // Overridden from NativeButton::Listener. - virtual void ButtonPressed(views::NativeButton* sender) { + // Overridden from ButtonListener. + virtual void ButtonPressed(views::Button* sender) { bubble_window_->Close(); if (change_button_ == sender) { Browser* browser = BrowserList::GetLastActive(); @@ -171,13 +170,13 @@ class FirstRunBubbleView : public views::View, views::NativeButton::kViewClassName) { views::NativeButton* before = static_cast<views::NativeButton*>(focused_before); - before->SetDefaultButton(false); + before->SetIsDefault(false); } if (focused_now && focused_now->GetClassName() == views::NativeButton::kViewClassName) { views::NativeButton* after = static_cast<views::NativeButton*>(focused_now); - after->SetDefaultButton(true); + after->SetIsDefault(true); } } diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index 1ec7af9..1d0b469 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -41,22 +41,22 @@ FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile, // the customize view, so that the user selection isn't lost when you uncheck // and then open the Customize dialog. Therefore, we propagate the selection // status of the default browser here. - default_browser_->SetIsSelected(default_browser_checked); + default_browser_->SetChecked(default_browser_checked); } FirstRunCustomizeView::~FirstRunCustomizeView() { } -views::CheckBox* FirstRunCustomizeView::MakeCheckBox(int label_id) { - views::CheckBox* cbox = new views::CheckBox(l10n_util::GetString(label_id)); - cbox->SetListener(this); +views::Checkbox* FirstRunCustomizeView::MakeCheckBox(int label_id) { + views::Checkbox* cbox = new views::Checkbox(l10n_util::GetString(label_id)); + cbox->set_listener(this); AddChildView(cbox); return cbox; } void FirstRunCustomizeView::SetupControls() { using views::Label; - using views::CheckBox; + using views::Checkbox; main_label_ = new Label(l10n_util::GetString(IDS_FR_CUSTOMIZE_DLG_TEXT)); main_label_->SetMultiLine(true); @@ -75,10 +75,10 @@ void FirstRunCustomizeView::SetupControls() { // The two check boxes for the different shortcut creation. desktop_shortcut_cbox_ = MakeCheckBox(IDS_FR_CUSTOM_SHORTCUT_DESKTOP); - desktop_shortcut_cbox_->SetIsSelected(true); + desktop_shortcut_cbox_->SetChecked(true); quick_shortcut_cbox_ = MakeCheckBox(IDS_FR_CUSTOM_SHORTCUT_QUICKL); - quick_shortcut_cbox_->SetIsSelected(true); + quick_shortcut_cbox_->SetChecked(true); } gfx::Size FirstRunCustomizeView::GetPreferredSize() { @@ -110,7 +110,7 @@ void FirstRunCustomizeView::Layout() { import_cbox_->SetBounds(kPanelHorizMargin, next_v_space, pref_size.width(), pref_size.height()); - import_cbox_->SetIsSelected(true); + import_cbox_->SetChecked(true); int x_offset = import_cbox_->x() + import_cbox_->width(); @@ -153,10 +153,10 @@ void FirstRunCustomizeView::Layout() { AdjustDialogWidth(quick_shortcut_cbox_); } -void FirstRunCustomizeView::ButtonPressed(views::NativeButton* sender) { +void FirstRunCustomizeView::ButtonPressed(views::Button* sender) { if (import_cbox_ == sender) { // Disable the import combobox if the user unchecks the checkbox. - import_from_combo_->SetEnabled(import_cbox_->IsSelected()); + import_from_combo_->SetEnabled(import_cbox_->checked()); } } @@ -187,15 +187,15 @@ bool FirstRunCustomizeView::Accept() { desktop_shortcut_cbox_->SetEnabled(false); quick_shortcut_cbox_->SetEnabled(false); - if (desktop_shortcut_cbox_->IsSelected()) { + if (desktop_shortcut_cbox_->checked()) { UserMetrics::RecordAction(L"FirstRunCustom_Do_DesktopShortcut", profile_); CreateDesktopShortcut(); } - if (quick_shortcut_cbox_->IsSelected()) { + if (quick_shortcut_cbox_->checked()) { UserMetrics::RecordAction(L"FirstRunCustom_Do_QuickLShortcut", profile_); CreateQuickLaunchShortcut(); } - if (!import_cbox_->IsSelected()) { + if (!import_cbox_->checked()) { UserMetrics::RecordAction(L"FirstRunCustom_No_Import", profile_); } else { int browser_selected = import_from_combo_->GetSelectedItem(); @@ -203,7 +203,7 @@ bool FirstRunCustomizeView::Accept() { GetDefaultImportItems(), window()->GetNativeWindow()); } - if (default_browser_->IsSelected()) + if (default_browser_->checked()) SetDefaultBrowser(); if (customize_observer_) diff --git a/chrome/browser/views/first_run_customize_view.h b/chrome/browser/views/first_run_customize_view.h index 9727bd8..b394254 100644 --- a/chrome/browser/views/first_run_customize_view.h +++ b/chrome/browser/views/first_run_customize_view.h @@ -6,17 +6,18 @@ #define CHROME_BROWSER_VIEWS_FIRST_RUN_CUSTOMIZE_VIEW_H_ #include "chrome/browser/views/first_run_view_base.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/view.h" #include "chrome/views/window/dialog_delegate.h" namespace views { -class Label; -class Window; +class Checkbox; +class ComboBox; class ImageView; +class Label; class Separator; -class ComboBox; +class Window; } class Profile; @@ -24,7 +25,7 @@ class Profile; // FirstRunCustomizeView implements the dialog that allows the user to do // some simple customizations during the first run. class FirstRunCustomizeView : public FirstRunViewBase, - public views::NativeButton::Listener, + public views::ButtonListener, public views::ComboBox::Model { public: class CustomizeViewObserver { @@ -49,8 +50,8 @@ class FirstRunCustomizeView : public FirstRunViewBase, virtual bool Accept(); virtual bool Cancel(); - // Overridden form views::NativeButton::Listener. - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden form views::ButtonListener. + virtual void ButtonPressed(views::Button* sender); // Overridden form views::ComboBox::Model. virtual int GetItemCount(views::ComboBox* source); @@ -68,14 +69,14 @@ class FirstRunCustomizeView : public FirstRunViewBase, // Initializes the controls on the dialog. void SetupControls(); - views::CheckBox* MakeCheckBox(int resource_id); + views::Checkbox* MakeCheckBox(int resource_id); views::Label* main_label_; - views::CheckBox* import_cbox_; + views::Checkbox* import_cbox_; views::ComboBox* import_from_combo_; views::Label* shortcuts_label_; - views::CheckBox* desktop_shortcut_cbox_; - views::CheckBox* quick_shortcut_cbox_; + views::Checkbox* desktop_shortcut_cbox_; + views::Checkbox* quick_shortcut_cbox_; CustomizeViewObserver* customize_observer_; diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index d67f8b1..24f5e11 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -55,7 +55,7 @@ void FirstRunView::SetupControls() { using views::Label; using views::Link; - default_browser_->SetIsSelected(true); + default_browser_->SetChecked(true); welcome_label_ = new Label(l10n_util::GetString(IDS_FIRSTRUN_DLG_TEXT)); welcome_label_->SetMultiLine(true); @@ -155,7 +155,7 @@ void FirstRunView::OpenCustomizeDialog() { new FirstRunCustomizeView(profile_, importer_host_, this, - default_browser_->IsSelected()))->Show(); + default_browser_->checked()))->Show(); } void FirstRunView::LinkActivated(views::Link* source, int event_flags) { @@ -178,7 +178,7 @@ bool FirstRunView::Accept() { customize_link_->SetEnabled(false); CreateDesktopShortcut(); CreateQuickLaunchShortcut(); - if (default_browser_->IsSelected()) + if (default_browser_->checked()) SetDefaultBrowser(); // Index 0 is the default browser. FirstRun::ImportSettings(profile_, 0, GetDefaultImportItems(), diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index 90b04d3..c3df0e2 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -85,7 +85,7 @@ void FirstRunViewBase::SetupControls() { AddChildView(separator_1_); // The "make us default browser" check box. - default_browser_ = new views::CheckBox( + default_browser_ = new views::Checkbox( l10n_util::GetString(IDS_FR_CUSTOMIZE_DEFAULT_BROWSER)); default_browser_->SetMultiLine(true); AddChildView(default_browser_); diff --git a/chrome/browser/views/first_run_view_base.h b/chrome/browser/views/first_run_view_base.h index 0790414..d4a08f7 100644 --- a/chrome/browser/views/first_run_view_base.h +++ b/chrome/browser/views/first_run_view_base.h @@ -10,7 +10,7 @@ #include "chrome/views/window/dialog_delegate.h" namespace views { -class CheckBox; +class Checkbox; class Window; class ImageView; class Separator; @@ -77,7 +77,7 @@ class FirstRunViewBase : public views::View, scoped_refptr<ImporterHost> importer_host_; Profile* profile_; - views::CheckBox* default_browser_; + views::Checkbox* default_browser_; private: // Initializes the controls on the dialog. diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index bf0555a4..9d239e4 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -113,7 +113,7 @@ void HungPagesTableModel::GetGroupRangeForItem(int item, class HungRendererWarningView : public views::View, public views::DialogDelegate, - public views::NativeButton::Listener { + public views::ButtonListener { public: HungRendererWarningView(); ~HungRendererWarningView(); @@ -131,8 +131,8 @@ class HungRendererWarningView : public views::View, virtual bool Accept(bool window_closing); virtual views::View* GetContentsView(); - // views::NativeButton::Listener overrides: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener overrides: + virtual void ButtonPressed(views::Button* sender); protected: // views::View overrides: @@ -303,9 +303,9 @@ views::View* HungRendererWarningView::GetContentsView() { } /////////////////////////////////////////////////////////////////////////////// -// HungRendererWarningView, views::NativeButton::Listener implementation: +// HungRendererWarningView, views::ButtonListener implementation: -void HungRendererWarningView::ButtonPressed(views::NativeButton* sender) { +void HungRendererWarningView::ButtonPressed(views::Button* sender) { if (sender == kill_button_) { // Kill the process. HANDLE process = contents_->process()->process().handle(); @@ -375,8 +375,7 @@ void HungRendererWarningView::Init() { void HungRendererWarningView::CreateKillButtonView() { kill_button_ = new views::NativeButton( - l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_END)); - kill_button_->SetListener(this); + this, l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_END)); kill_button_container_ = new ButtonContainer; diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc index 9dbd9a4..c3dbbf0 100644 --- a/chrome/browser/views/importer_view.cc +++ b/chrome/browser/views/importer_view.cc @@ -186,23 +186,23 @@ void ImporterView::ImportComplete() { window()->Close(); } -views::CheckBox* ImporterView::InitCheckbox(const std::wstring& text, +views::Checkbox* ImporterView::InitCheckbox(const std::wstring& text, bool checked) { - views::CheckBox* checkbox = new views::CheckBox(text); - checkbox->SetIsSelected(checked); + views::Checkbox* checkbox = new views::Checkbox(text); + checkbox->SetChecked(checked); return checkbox; } uint16 ImporterView::GetCheckedItems() { uint16 items = NONE; - if (history_checkbox_->IsEnabled() && history_checkbox_->IsSelected()) + if (history_checkbox_->IsEnabled() && history_checkbox_->checked()) items |= HISTORY; - if (favorites_checkbox_->IsEnabled() && favorites_checkbox_->IsSelected()) + if (favorites_checkbox_->IsEnabled() && favorites_checkbox_->checked()) items |= FAVORITES; - if (passwords_checkbox_->IsEnabled() && passwords_checkbox_->IsSelected()) + if (passwords_checkbox_->IsEnabled() && passwords_checkbox_->checked()) items |= PASSWORDS; if (search_engines_checkbox_->IsEnabled() && - search_engines_checkbox_->IsSelected()) + search_engines_checkbox_->checked()) items |= SEARCH_ENGINES; return items; } @@ -212,58 +212,38 @@ void ImporterView::SetCheckedItemsState(uint16 items) { history_checkbox_->SetEnabled(true); } else { history_checkbox_->SetEnabled(false); - history_checkbox_->SetIsSelected(false); + history_checkbox_->SetChecked(false); } if (items & FAVORITES) { favorites_checkbox_->SetEnabled(true); } else { favorites_checkbox_->SetEnabled(false); - favorites_checkbox_->SetIsSelected(false); + favorites_checkbox_->SetChecked(false); } if (items & PASSWORDS) { passwords_checkbox_->SetEnabled(true); } else { passwords_checkbox_->SetEnabled(false); - passwords_checkbox_->SetIsSelected(false); + passwords_checkbox_->SetChecked(false); } if (items & SEARCH_ENGINES) { search_engines_checkbox_->SetEnabled(true); } else { search_engines_checkbox_->SetEnabled(false); - search_engines_checkbox_->SetIsSelected(false); + search_engines_checkbox_->SetChecked(false); } } void ImporterView::SetCheckedItems(uint16 items) { - if (history_checkbox_->IsEnabled()) { - if (items & HISTORY) { - history_checkbox_->SetIsSelected(true); - } else { - history_checkbox_->SetIsSelected(false); - } - } + if (history_checkbox_->IsEnabled()) + history_checkbox_->SetChecked(!!(items & HISTORY)); - if (favorites_checkbox_->IsEnabled()) { - if (items & FAVORITES) { - favorites_checkbox_->SetIsSelected(true); - } else { - favorites_checkbox_->SetIsSelected(false); - } - } + if (favorites_checkbox_->IsEnabled()) + favorites_checkbox_->SetChecked(!!(items & FAVORITES)); - if (passwords_checkbox_->IsEnabled()) { - if (items & PASSWORDS) { - passwords_checkbox_->SetIsSelected(true); - } else { - passwords_checkbox_->SetIsSelected(false); - } - } + if (passwords_checkbox_->IsEnabled()) + passwords_checkbox_->SetChecked(!!(items & PASSWORDS)); - if (search_engines_checkbox_->IsEnabled()) { - if (items & SEARCH_ENGINES) { - search_engines_checkbox_->SetIsSelected(true); - } else { - search_engines_checkbox_->SetIsSelected(false); - } - } + if (search_engines_checkbox_->IsEnabled()) + search_engines_checkbox_->SetChecked(!!(items & SEARCH_ENGINES)); } diff --git a/chrome/browser/views/importer_view.h b/chrome/browser/views/importer_view.h index ef80f9d..9c6e7a8 100644 --- a/chrome/browser/views/importer_view.h +++ b/chrome/browser/views/importer_view.h @@ -12,7 +12,7 @@ #include "chrome/views/window/dialog_delegate.h" namespace views { -class CheckBox; +class Checkbox; class Label; class Window; } @@ -61,7 +61,7 @@ class ImporterView : public views::View, void SetupControl(); // Creates and initializes a new check-box. - views::CheckBox* InitCheckbox(const std::wstring& text, bool checked); + views::Checkbox* InitCheckbox(const std::wstring& text, bool checked); // Create a bitmap from the checkboxes of the view. uint16 GetCheckedItems(); @@ -75,10 +75,10 @@ class ImporterView : public views::View, views::Label* import_from_label_; views::ComboBox* profile_combobox_; views::Label* import_items_label_; - views::CheckBox* history_checkbox_; - views::CheckBox* favorites_checkbox_; - views::CheckBox* passwords_checkbox_; - views::CheckBox* search_engines_checkbox_; + views::Checkbox* history_checkbox_; + views::Checkbox* favorites_checkbox_; + views::Checkbox* passwords_checkbox_; + views::Checkbox* search_engines_checkbox_; scoped_refptr<ImporterHost> importer_host_; diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index 52af060..91111e0 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -13,6 +13,7 @@ #include "chrome/common/slide_animation.h" #include "chrome/views/background.h" #include "chrome/views/controls/button/image_button.h" +#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/image_view.h" #include "chrome/views/controls/label.h" #include "chrome/views/focus/external_focus_tracker.h" @@ -372,11 +373,9 @@ ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate) initialized_(false), AlertInfoBar(delegate) { ok_button_ = new views::NativeButton( - delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); - ok_button_->SetListener(this); + this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); cancel_button_ = new views::NativeButton( - delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); - cancel_button_->SetListener(this); + this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); } ConfirmInfoBar::~ConfirmInfoBar() { @@ -422,9 +421,10 @@ void ConfirmInfoBar::ViewHierarchyChanged(bool is_add, } } -// ConfirmInfoBar, views::NativeButton::Listener implementation: --------------- +// ConfirmInfoBar, views::ButtonListener implementation: --------------- -void ConfirmInfoBar::ButtonPressed(views::NativeButton* sender) { +void ConfirmInfoBar::ButtonPressed(views::Button* sender) { + InfoBar::ButtonPressed(sender); if (sender == ok_button_) { if (GetDelegate()->Accept()) RemoveInfoBar(); diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h index c8b721dc..85388bd 100644 --- a/chrome/browser/views/infobars/infobars.h +++ b/chrome/browser/views/infobars/infobars.h @@ -8,16 +8,16 @@ #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/common/animation.h" #include "chrome/views/controls/button/button.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/link.h" class InfoBarContainer; class SlideAnimation; namespace views { -class ImageButton; class ExternalFocusTracker; +class ImageButton; class ImageView; class Label; +class NativeButton; } // This file contains implementations for some general purpose InfoBars. See @@ -70,10 +70,10 @@ class InfoBar : public views::View, // (Will lead to this InfoBar being closed). void RemoveInfoBar() const; - private: // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender); + private: // Overridden from AnimationDelegate: virtual void AnimationProgressed(const Animation* animation); virtual void AnimationEnded(const Animation* animation); @@ -158,8 +158,7 @@ class LinkInfoBar : public InfoBar, DISALLOW_COPY_AND_ASSIGN(LinkInfoBar); }; -class ConfirmInfoBar : public AlertInfoBar, - public views::NativeButton::Listener { +class ConfirmInfoBar : public AlertInfoBar { public: explicit ConfirmInfoBar(ConfirmInfoBarDelegate* delegate); virtual ~ConfirmInfoBar(); @@ -173,8 +172,8 @@ class ConfirmInfoBar : public AlertInfoBar, views::View* parent, views::View* child); - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); // Overridden from InfoBar: virtual int GetAvailableWidth() const; diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index b646f10..3018cfa 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -21,8 +21,8 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" #include "chrome/views/background.h" -#include "chrome/views/controls/button/checkbox.h" #include "chrome/views/grid_layout.h" +#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/widget/widget.h" #include "chrome/views/window/dialog_delegate.h" @@ -483,24 +483,21 @@ void KeywordEditorView::Init() { table_view_->SetObserver(this); add_button_ = new views::NativeButton( - l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); + this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); add_button_->SetEnabled(url_model_->loaded()); - add_button_->SetListener(this); - + edit_button_ = new views::NativeButton( - l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); + this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); edit_button_->SetEnabled(false); - edit_button_->SetListener(this); - + remove_button_ = new views::NativeButton( - l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON)); + this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON)); remove_button_->SetEnabled(false); - remove_button_->SetListener(this); - + make_default_button_ = new views::NativeButton( + this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON)); make_default_button_->SetEnabled(false); - make_default_button_->SetListener(this); InitLayoutManager(); } @@ -564,7 +561,7 @@ void KeywordEditorView::OnDoubleClick() { ButtonPressed(edit_button_); } -void KeywordEditorView::ButtonPressed(views::NativeButton* sender) { +void KeywordEditorView::ButtonPressed(views::Button* sender) { if (sender == add_button_) { EditKeywordController* controller = new EditKeywordController(GetWidget()->GetNativeView(), NULL, this, diff --git a/chrome/browser/views/keyword_editor_view.h b/chrome/browser/views/keyword_editor_view.h index a011d61..7d2a95f 100644 --- a/chrome/browser/views/keyword_editor_view.h +++ b/chrome/browser/views/keyword_editor_view.h @@ -9,14 +9,14 @@ #include <map> #include "chrome/browser/search_engines/template_url_model.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/table/table_view.h" #include "chrome/views/view.h" #include "chrome/views/window/dialog_delegate.h" namespace views { -class CheckBox; class Label; +class NativeButton; } namespace { @@ -116,7 +116,7 @@ class TemplateURLTableModel : public views::TableModel { class KeywordEditorView : public views::View, public views::TableViewObserver, - public views::NativeButton::Listener, + public views::ButtonListener, public TemplateURLModelObserver, public views::DialogDelegate { friend class KeywordEditorViewTest; @@ -168,7 +168,7 @@ class KeywordEditorView : public views::View, virtual void OnDoubleClick(); // Button::ButtonListener method. - virtual void ButtonPressed(views::NativeButton* sender); + virtual void ButtonPressed(views::Button* sender); // TemplateURLModelObserver notification. virtual void OnTemplateURLModelChanged(); diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 45e0cc2..1f73219 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -98,7 +98,7 @@ class AdvancedSection : public OptionsPageView { // Convenience helpers for adding controls to specific layouts in an // aesthetically pleasing way. void AddWrappingCheckboxRow(views::GridLayout* layout, - views::CheckBox* checkbox, + views::Checkbox* checkbox, int id, bool related_follows); void AddWrappingLabelRow(views::GridLayout* layout, @@ -172,7 +172,7 @@ void AdvancedSection::AddWrappingColumnSet(views::GridLayout* layout, int id) { void AdvancedSection::AddDependentTwoColumnSet(views::GridLayout* layout, int id) { ColumnSet* column_set = layout->AddColumnSet(id); - column_set->AddPaddingColumn(0, views::CheckBox::GetTextIndent()); + column_set->AddPaddingColumn(0, views::Checkbox::GetTextIndent()); column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); @@ -192,13 +192,13 @@ void AdvancedSection::AddTwoColumnSet(views::GridLayout* layout, int id) { void AdvancedSection::AddIndentedColumnSet(views::GridLayout* layout, int id) { ColumnSet* column_set = layout->AddColumnSet(id); - column_set->AddPaddingColumn(0, views::CheckBox::GetTextIndent()); + column_set->AddPaddingColumn(0, views::Checkbox::GetTextIndent()); column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, GridLayout::USE_PREF, 0, 0); } void AdvancedSection::AddWrappingCheckboxRow(views::GridLayout* layout, - views::CheckBox* checkbox, + views::Checkbox* checkbox, int id, bool related_follows) { checkbox->SetMultiLine(true); @@ -319,15 +319,15 @@ class CookieBehaviorComboModel : public views::ComboBox::Model { }; class PrivacySection : public AdvancedSection, - public views::NativeButton::Listener, + public views::ButtonListener, public views::ComboBox::Listener, public views::LinkController { public: explicit PrivacySection(Profile* profile); virtual ~PrivacySection() {} - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); // Overridden from views::ComboBox::Listener: virtual void ItemChanged(views::ComboBox* sender, @@ -348,11 +348,11 @@ class PrivacySection : public AdvancedSection, private: // Controls for this section: views::Label* section_description_label_; - views::CheckBox* enable_link_doctor_checkbox_; - views::CheckBox* enable_suggest_checkbox_; - views::CheckBox* enable_dns_prefetching_checkbox_; - views::CheckBox* enable_safe_browsing_checkbox_; - views::CheckBox* reporting_enabled_checkbox_; + views::Checkbox* enable_link_doctor_checkbox_; + views::Checkbox* enable_suggest_checkbox_; + views::Checkbox* enable_dns_prefetching_checkbox_; + views::Checkbox* enable_safe_browsing_checkbox_; + views::Checkbox* reporting_enabled_checkbox_; views::Link* learn_more_link_; views::Label* cookie_behavior_label_; views::ComboBox* cookie_behavior_combobox_; @@ -389,23 +389,23 @@ PrivacySection::PrivacySection(Profile* profile) l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)) { } -void PrivacySection::ButtonPressed(views::NativeButton* sender) { +void PrivacySection::ButtonPressed(views::Button* sender) { if (sender == enable_link_doctor_checkbox_) { - bool enabled = enable_link_doctor_checkbox_->IsSelected(); + bool enabled = enable_link_doctor_checkbox_->checked(); UserMetricsRecordAction(enabled ? L"Options_LinkDoctorCheckbox_Enable" : L"Options_LinkDoctorCheckbox_Disable", profile()->GetPrefs()); alternate_error_pages_.SetValue(enabled); } else if (sender == enable_suggest_checkbox_) { - bool enabled = enable_suggest_checkbox_->IsSelected(); + bool enabled = enable_suggest_checkbox_->checked(); UserMetricsRecordAction(enabled ? L"Options_UseSuggestCheckbox_Enable" : L"Options_UseSuggestCheckbox_Disable", profile()->GetPrefs()); use_suggest_.SetValue(enabled); } else if (sender == enable_dns_prefetching_checkbox_) { - bool enabled = enable_dns_prefetching_checkbox_->IsSelected(); + bool enabled = enable_dns_prefetching_checkbox_->checked(); UserMetricsRecordAction(enabled ? L"Options_DnsPrefetchCheckbox_Enable" : L"Options_DnsPrefetchCheckbox_Disable", @@ -413,7 +413,7 @@ void PrivacySection::ButtonPressed(views::NativeButton* sender) { dns_prefetch_enabled_.SetValue(enabled); chrome_browser_net::EnableDnsPrefetch(enabled); } else if (sender == enable_safe_browsing_checkbox_) { - bool enabled = enable_safe_browsing_checkbox_->IsSelected(); + bool enabled = enable_safe_browsing_checkbox_->checked(); UserMetricsRecordAction(enabled ? L"Options_SafeBrowsingCheckbox_Enable" : L"Options_SafeBrowsingCheckbox_Disable", @@ -424,13 +424,13 @@ void PrivacySection::ButtonPressed(views::NativeButton* sender) { MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( safe_browsing_service, &SafeBrowsingService::OnEnable, enabled)); } else if (sender == reporting_enabled_checkbox_) { - bool enabled = reporting_enabled_checkbox_->IsSelected(); + bool enabled = reporting_enabled_checkbox_->checked(); UserMetricsRecordAction(enabled ? L"Options_MetricsReportingCheckbox_Enable" : L"Options_MetricsReportingCheckbox_Disable", profile()->GetPrefs()); ResolveMetricsReportingEnabled(); - if (enabled == reporting_enabled_checkbox_->IsSelected()) + if (enabled == reporting_enabled_checkbox_->checked()) RestartMessageBox::ShowMessageBox(GetRootWindow()); enable_metrics_recording_.SetValue(enabled); } else if (sender == show_cookies_button_) { @@ -485,22 +485,22 @@ void PrivacySection::InitControlLayout() { section_description_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_DISABLE_SERVICES)); - enable_link_doctor_checkbox_ = new views::CheckBox( + enable_link_doctor_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_LINKDOCTOR_PREF)); - enable_link_doctor_checkbox_->SetListener(this); - enable_suggest_checkbox_ = new views::CheckBox( + enable_link_doctor_checkbox_->set_listener(this); + enable_suggest_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SUGGEST_PREF)); - enable_suggest_checkbox_->SetListener(this); - enable_dns_prefetching_checkbox_ = new views::CheckBox( + enable_suggest_checkbox_->set_listener(this); + enable_dns_prefetching_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION)); - enable_dns_prefetching_checkbox_->SetListener(this); - enable_safe_browsing_checkbox_ = new views::CheckBox( + enable_dns_prefetching_checkbox_->set_listener(this); + enable_safe_browsing_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION)); - enable_safe_browsing_checkbox_->SetListener(this); - reporting_enabled_checkbox_ = new views::CheckBox( + enable_safe_browsing_checkbox_->set_listener(this); + reporting_enabled_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_ENABLE_LOGGING)); reporting_enabled_checkbox_->SetMultiLine(true); - reporting_enabled_checkbox_->SetListener(this); + reporting_enabled_checkbox_->set_listener(this); learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE)); learn_more_link_->SetController(this); cookie_behavior_label_ = new views::Label( @@ -510,8 +510,7 @@ void PrivacySection::InitControlLayout() { allow_cookies_model_.get()); cookie_behavior_combobox_->SetListener(this); show_cookies_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_COOKIES_SHOWCOOKIES)); - show_cookies_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_COOKIES_SHOWCOOKIES)); GridLayout* layout = new GridLayout(contents_); contents_->SetLayoutManager(layout); @@ -571,21 +570,21 @@ void PrivacySection::InitControlLayout() { void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name || *pref_name == prefs::kAlternateErrorPagesEnabled) { - enable_link_doctor_checkbox_->SetIsSelected( + enable_link_doctor_checkbox_->SetChecked( alternate_error_pages_.GetValue()); } if (!pref_name || *pref_name == prefs::kSearchSuggestEnabled) { - enable_suggest_checkbox_->SetIsSelected(use_suggest_.GetValue()); + enable_suggest_checkbox_->SetChecked(use_suggest_.GetValue()); } if (!pref_name || *pref_name == prefs::kDnsPrefetchingEnabled) { bool enabled = dns_prefetch_enabled_.GetValue(); - enable_dns_prefetching_checkbox_->SetIsSelected(enabled); + enable_dns_prefetching_checkbox_->SetChecked(enabled); chrome_browser_net::EnableDnsPrefetch(enabled); } if (!pref_name || *pref_name == prefs::kSafeBrowsingEnabled) - enable_safe_browsing_checkbox_->SetIsSelected(safe_browsing_.GetValue()); + enable_safe_browsing_checkbox_->SetChecked(safe_browsing_.GetValue()); if (!pref_name || *pref_name == prefs::kMetricsReportingEnabled) { - reporting_enabled_checkbox_->SetIsSelected( + reporting_enabled_checkbox_->SetChecked( enable_metrics_recording_.GetValue()); ResolveMetricsReportingEnabled(); } @@ -597,7 +596,7 @@ void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { } void PrivacySection::ResolveMetricsReportingEnabled() { - bool enabled = reporting_enabled_checkbox_->IsSelected(); + bool enabled = reporting_enabled_checkbox_->checked(); GoogleUpdateSettings::SetCollectStatsConsent(enabled); bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent(); @@ -622,20 +621,20 @@ void PrivacySection::ResolveMetricsReportingEnabled() { metrics->Stop(); } - reporting_enabled_checkbox_->SetIsSelected(enabled); + reporting_enabled_checkbox_->SetChecked(enabled); } //////////////////////////////////////////////////////////////////////////////// // WebContentSection class WebContentSection : public AdvancedSection, - public views::NativeButton::Listener { + public views::ButtonListener { public: explicit WebContentSection(Profile* profile); virtual ~WebContentSection() {} - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); protected: // OptionsPageView overrides: @@ -644,7 +643,7 @@ class WebContentSection : public AdvancedSection, private: // Controls for this section: - views::CheckBox* popup_blocked_notification_checkbox_; + views::Checkbox* popup_blocked_notification_checkbox_; views::Label* gears_label_; views::NativeButton* gears_settings_button_; @@ -661,10 +660,10 @@ WebContentSection::WebContentSection(Profile* profile) l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT)) { } -void WebContentSection::ButtonPressed(views::NativeButton* sender) { +void WebContentSection::ButtonPressed(views::Button* sender) { if (sender == popup_blocked_notification_checkbox_) { bool notification_disabled = - popup_blocked_notification_checkbox_->IsSelected(); + popup_blocked_notification_checkbox_->checked(); if (notification_disabled) { UserMetricsRecordAction(L"Options_BlockAllPopups_Disable", profile()->GetPrefs()); @@ -682,9 +681,9 @@ void WebContentSection::ButtonPressed(views::NativeButton* sender) { void WebContentSection::InitControlLayout() { AdvancedSection::InitControlLayout(); - popup_blocked_notification_checkbox_ = new views::CheckBox( + popup_blocked_notification_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SHOWPOPUPBLOCKEDNOTIFICATION)); - popup_blocked_notification_checkbox_->SetListener(this); + popup_blocked_notification_checkbox_->set_listener(this); if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) { gears_label_ = new views::Label( @@ -699,8 +698,8 @@ void WebContentSection::InitControlLayout() { gears_label_ = new views::Label(gearssetting_group_name); } gears_settings_button_ = new views::NativeButton( + this, l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON)); - gears_settings_button_->SetListener(this); GridLayout* layout = new GridLayout(contents_); contents_->SetLayoutManager(layout); @@ -722,7 +721,7 @@ void WebContentSection::InitControlLayout() { void WebContentSection::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name || *pref_name == prefs::kBlockPopups) { - popup_blocked_notification_checkbox_->SetIsSelected( + popup_blocked_notification_checkbox_->SetChecked( !disable_popup_blocked_notification_pref_.GetValue()); } } @@ -769,14 +768,14 @@ class MixedContentComboModel : public views::ComboBox::Model { }; class SecuritySection : public AdvancedSection, - public views::NativeButton::Listener, + public views::ButtonListener, public views::ComboBox::Listener { public: explicit SecuritySection(Profile* profile); virtual ~SecuritySection() {} - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); // Overridden from views::ComboBox::Listener: virtual void ItemChanged(views::ComboBox* sender, @@ -793,8 +792,8 @@ class SecuritySection : public AdvancedSection, views::Label* reset_file_handlers_label_; views::NativeButton* reset_file_handlers_button_; views::Label* ssl_info_label_; - views::CheckBox* enable_ssl2_checkbox_; - views::CheckBox* check_for_cert_revocation_checkbox_; + views::Checkbox* enable_ssl2_checkbox_; + views::Checkbox* check_for_cert_revocation_checkbox_; views::Label* mixed_content_info_label_; views::ComboBox* mixed_content_combobox_; views::Label* manage_certificates_label_; @@ -823,13 +822,13 @@ SecuritySection::SecuritySection(Profile* profile) l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY)) { } -void SecuritySection::ButtonPressed(views::NativeButton* sender) { +void SecuritySection::ButtonPressed(views::Button* sender) { if (sender == reset_file_handlers_button_) { profile()->GetDownloadManager()->ResetAutoOpenFiles(); UserMetricsRecordAction(L"Options_ResetAutoOpenFiles", profile()->GetPrefs()); } else if (sender == enable_ssl2_checkbox_) { - bool enabled = enable_ssl2_checkbox_->IsSelected(); + bool enabled = enable_ssl2_checkbox_->checked(); if (enabled) { UserMetricsRecordAction(L"Options_SSL2_Enable", NULL); } else { @@ -837,7 +836,7 @@ void SecuritySection::ButtonPressed(views::NativeButton* sender) { } net::SSLConfigService::SetSSL2Enabled(enabled); } else if (sender == check_for_cert_revocation_checkbox_) { - bool enabled = check_for_cert_revocation_checkbox_->IsSelected(); + bool enabled = check_for_cert_revocation_checkbox_->checked(); if (enabled) { UserMetricsRecordAction(L"Options_CheckCertRevocation_Enable", NULL); } else { @@ -878,16 +877,15 @@ void SecuritySection::InitControlLayout() { reset_file_handlers_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_AUTOOPENFILETYPES_INFO)); reset_file_handlers_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT)); - reset_file_handlers_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT)); ssl_info_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_SSL_GROUP_DESCRIPTION)); - enable_ssl2_checkbox_ = new views::CheckBox( + enable_ssl2_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SSL_USESSL2)); - enable_ssl2_checkbox_->SetListener(this); - check_for_cert_revocation_checkbox_ = new views::CheckBox( + enable_ssl2_checkbox_->set_listener(this); + check_for_cert_revocation_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SSL_CHECKREVOCATION)); - check_for_cert_revocation_checkbox_->SetListener(this); + check_for_cert_revocation_checkbox_->set_listener(this); mixed_content_info_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_MIXED_CONTENT_LABEL)); mixed_content_model_.reset(new MixedContentComboModel); @@ -897,8 +895,7 @@ void SecuritySection::InitControlLayout() { manage_certificates_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_CERTIFICATES_LABEL)); manage_certificates_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON)); - manage_certificates_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON)); GridLayout* layout = new GridLayout(contents_); contents_->SetLayoutManager(layout); @@ -962,8 +959,8 @@ void SecuritySection::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name) { net::SSLConfig config; if (net::SSLConfigService::GetSSLConfigNow(&config)) { - enable_ssl2_checkbox_->SetIsSelected(config.ssl2_enabled); - check_for_cert_revocation_checkbox_->SetIsSelected( + enable_ssl2_checkbox_->SetChecked(config.ssl2_enabled); + check_for_cert_revocation_checkbox_->SetChecked( config.rev_checking_enabled); } else { enable_ssl2_checkbox_->SetEnabled(false); @@ -1014,13 +1011,13 @@ class OpenConnectionDialogTask : public Task { } // namespace class NetworkSection : public AdvancedSection, - public views::NativeButton::Listener { + public views::ButtonListener { public: explicit NetworkSection(Profile* profile); virtual ~NetworkSection() {} - // Overridden from views::NativeButton::Listener: - virtual void ButtonPressed(views::NativeButton* sender); + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender); protected: // OptionsPageView overrides: @@ -1042,7 +1039,7 @@ NetworkSection::NetworkSection(Profile* profile) l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK)) { } -void NetworkSection::ButtonPressed(views::NativeButton* sender) { +void NetworkSection::ButtonPressed(views::Button* sender) { if (sender == change_proxies_button_) { UserMetricsRecordAction(L"Options_ChangeProxies", NULL); base::Thread* thread = g_browser_process->file_thread(); @@ -1057,8 +1054,7 @@ void NetworkSection::InitControlLayout() { change_proxies_label_ = new views::Label( l10n_util::GetString(IDS_OPTIONS_PROXIES_LABEL)); change_proxies_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); - change_proxies_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); GridLayout* layout = new GridLayout(contents_); contents_->SetLayoutManager(layout); diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/views/options/advanced_page_view.cc index 9e9f1e3..fc258f6 100644 --- a/chrome/browser/views/options/advanced_page_view.cc +++ b/chrome/browser/views/options/advanced_page_view.cc @@ -152,9 +152,9 @@ void AdvancedPageView::ResetToDefaults() { } /////////////////////////////////////////////////////////////////////////////// -// AdvancedPageView, views::NativeButton::Listener implementation: +// AdvancedPageView, views::ButtonListener implementation: -void AdvancedPageView::ButtonPressed(views::NativeButton* sender) { +void AdvancedPageView::ButtonPressed(views::Button* sender) { if (sender == reset_to_default_button_) { UserMetricsRecordAction(L"Options_ResetToDefaults", NULL); ResetDefaultsConfirmBox::ShowConfirmBox(GetRootWindow(), this); @@ -166,8 +166,7 @@ void AdvancedPageView::ButtonPressed(views::NativeButton* sender) { void AdvancedPageView::InitControlLayout() { reset_to_default_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_RESET)); - reset_to_default_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_RESET)); advanced_scroll_view_ = new AdvancedScrollViewContainer(profile()); using views::GridLayout; diff --git a/chrome/browser/views/options/advanced_page_view.h b/chrome/browser/views/options/advanced_page_view.h index 54aa8a1..1a9119e 100644 --- a/chrome/browser/views/options/advanced_page_view.h +++ b/chrome/browser/views/options/advanced_page_view.h @@ -6,17 +6,20 @@ #define CHROME_BROWSER_VIEWS_OPTIONS_ADVANCED_PAGE_VIEW_H_ #include "chrome/browser/views/options/options_page_view.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" class AdvancedOptionsListModel; class AdvancedScrollViewContainer; class PrefService; +namespace views { +class NativeButton; +} /////////////////////////////////////////////////////////////////////////////// // AdvancedPageView class AdvancedPageView : public OptionsPageView, - public views::NativeButton::Listener { + public views::ButtonListener { public: explicit AdvancedPageView(Profile* profile); virtual ~AdvancedPageView(); @@ -24,8 +27,8 @@ class AdvancedPageView : public OptionsPageView, // Resets all prefs to their default values. void ResetToDefaults(); - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); protected: // OptionsPageView implementation: diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 18a7550..e6d6e40 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -23,8 +23,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/controls/button/checkbox.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/grid_layout.h" @@ -207,9 +205,9 @@ void ContentPageView::FileSelected(const std::wstring& path, void* params) { } /////////////////////////////////////////////////////////////////////////////// -// ContentPageView, views::NativeButton::Listener implementation: +// ContentPageView, views::ButtonListener implementation: -void ContentPageView::ButtonPressed(views::NativeButton* sender) { +void ContentPageView::ButtonPressed(views::Button* sender) { if (sender == download_browse_button_) { const std::wstring dialog_title = l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE); @@ -221,7 +219,7 @@ void ContentPageView::ButtonPressed(views::NativeButton* sender) { GetRootWindow(), NULL); } else if (sender == download_ask_for_save_location_checkbox_) { - bool enabled = download_ask_for_save_location_checkbox_->IsSelected(); + bool enabled = download_ask_for_save_location_checkbox_->checked(); if (enabled) { UserMetricsRecordAction(L"Options_AskForSaveLocation_Enable", profile()->GetPrefs()); @@ -232,7 +230,7 @@ void ContentPageView::ButtonPressed(views::NativeButton* sender) { ask_for_save_location_.SetValue(enabled); } else if (sender == passwords_asktosave_radio_ || sender == passwords_neversave_radio_) { - bool enabled = passwords_asktosave_radio_->IsSelected(); + bool enabled = passwords_asktosave_radio_->checked(); if (enabled) { UserMetricsRecordAction(L"Options_PasswordManager_Enable", profile()->GetPrefs()); @@ -248,7 +246,7 @@ void ContentPageView::ButtonPressed(views::NativeButton* sender) { UserMetricsRecordAction(L"Options_ShowPasswordManager", NULL); PasswordManagerView::Show(profile()); } else if (sender == form_autofill_checkbox_) { - bool enabled = form_autofill_checkbox_->IsSelected(); + bool enabled = form_autofill_checkbox_->checked(); if (enabled) { UserMetricsRecordAction(L"Options_FormAutofill_Enable", profile()->GetPrefs()); @@ -319,18 +317,18 @@ void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { UpdateDownloadDirectoryDisplay(); if (!pref_name || *pref_name == prefs::kPromptForDownload) { - download_ask_for_save_location_checkbox_->SetIsSelected( + download_ask_for_save_location_checkbox_->SetChecked( ask_for_save_location_.GetValue()); } if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { if (ask_to_save_passwords_.GetValue()) { - passwords_asktosave_radio_->SetIsSelected(true); + passwords_asktosave_radio_->SetChecked(true); } else { - passwords_neversave_radio_->SetIsSelected(true); + passwords_neversave_radio_->SetChecked(true); } } if (!pref_name || *pref_name == prefs::kFormAutofillEnabled) { - form_autofill_checkbox_->SetIsSelected(form_autofill_.GetValue()); + form_autofill_checkbox_->SetChecked(form_autofill_.GetValue()); } } @@ -358,12 +356,11 @@ void ContentPageView::Layout() { void ContentPageView::InitDownloadLocation() { download_default_download_location_display_ = new FileDisplayArea; download_browse_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_BUTTON)); - download_browse_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_BUTTON)); - download_ask_for_save_location_checkbox_ = new views::CheckBox( + download_ask_for_save_location_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION)); - download_ask_for_save_location_checkbox_->SetListener(this); + download_ask_for_save_location_checkbox_->set_listener(this); download_ask_for_save_location_checkbox_->SetMultiLine(true); using views::GridLayout; @@ -407,19 +404,17 @@ void ContentPageView::InitPasswordSavingGroup() { passwords_asktosave_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE), kPasswordSavingRadioGroup); - passwords_asktosave_radio_->SetListener(this); + passwords_asktosave_radio_->set_listener(this); passwords_asktosave_radio_->SetMultiLine(true); passwords_neversave_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE), kPasswordSavingRadioGroup); - passwords_neversave_radio_->SetListener(this); + passwords_neversave_radio_->set_listener(this); passwords_neversave_radio_->SetMultiLine(true); passwords_show_passwords_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)); - passwords_show_passwords_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)); passwords_exceptions_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_PASSWORDS_EXCEPTIONS)); - passwords_exceptions_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_EXCEPTIONS)); using views::GridLayout; using views::ColumnSet; @@ -457,9 +452,9 @@ void ContentPageView::InitPasswordSavingGroup() { } void ContentPageView::InitFormAutofillGroup() { - form_autofill_checkbox_ = new views::CheckBox( + form_autofill_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_AUTOFILL_SAVEFORMS)); - form_autofill_checkbox_->SetListener(this); + form_autofill_checkbox_->set_listener(this); form_autofill_checkbox_->SetMultiLine(true); using views::GridLayout; @@ -488,8 +483,8 @@ void ContentPageView::InitFontsLangGroup() { fonts_and_languages_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); fonts_and_languages_label_->SetMultiLine(true); change_content_fonts_button_ = new views::NativeButton( + this, l10n_util::GetString(IDS_OPTIONS_FONTSETTINGS_CONFIGUREFONTS_BUTTON)); - change_content_fonts_button_->SetListener(this); using views::GridLayout; using views::ColumnSet; diff --git a/chrome/browser/views/options/content_page_view.h b/chrome/browser/views/options/content_page_view.h index 3d68bb5..508b568 100644 --- a/chrome/browser/views/options/content_page_view.h +++ b/chrome/browser/views/options/content_page_view.h @@ -8,11 +8,12 @@ #include "chrome/browser/views/options/options_page_view.h" #include "chrome/browser/shell_dialogs.h" #include "chrome/common/pref_member.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/view.h" namespace views { -class CheckBox; +class Checkbox; +class NativeButton; class RadioButton; } class FileDisplayArea; @@ -23,14 +24,14 @@ class PrefService; // ContentPageView class ContentPageView : public OptionsPageView, - public views::NativeButton::Listener, + public views::ButtonListener, public SelectFileDialog::Listener { public: explicit ContentPageView(Profile* profile); virtual ~ContentPageView(); - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); // SelectFileDialog::Listener implementation: virtual void FileSelected(const std::wstring& path, void* params); @@ -61,7 +62,7 @@ class ContentPageView : public OptionsPageView, OptionsGroupView* download_location_group_; FileDisplayArea* download_default_download_location_display_; views::NativeButton* download_browse_button_; - views::CheckBox* download_ask_for_save_location_checkbox_; + views::Checkbox* download_ask_for_save_location_checkbox_; scoped_refptr<SelectFileDialog> select_file_dialog_; // Controls for the Password Saving group @@ -73,7 +74,7 @@ class ContentPageView : public OptionsPageView, // Controls for the Form Autofill group OptionsGroupView* form_autofill_group_; - views::CheckBox* form_autofill_checkbox_; + views::Checkbox* form_autofill_checkbox_; // Controls for the Popup Blocking group. OptionsGroupView* popups_group_; diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index e31fc1e0..2bdc149 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -18,6 +18,7 @@ #include "chrome/views/border.h" #include "chrome/views/grid_layout.h" #include "chrome/views/controls/label.h" +#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/controls/table/table_view.h" #include "grit/generated_resources.h" @@ -571,9 +572,9 @@ void CookiesView::UpdateSearchResults() { } /////////////////////////////////////////////////////////////////////////////// -// CookiesView, views::NativeButton::listener implementation: +// CookiesView, views::Buttonlistener implementation: -void CookiesView::ButtonPressed(views::NativeButton* sender) { +void CookiesView::ButtonPressed(views::Button* sender) { if (sender == remove_button_) { cookies_table_->RemoveSelectedCookies(); } else if (sender == remove_all_button_) { @@ -704,8 +705,7 @@ void CookiesView::Init() { search_field_ = new views::TextField; search_field_->SetController(this); clear_search_button_ = new views::NativeButton( - l10n_util::GetString(IDS_COOKIES_CLEAR_SEARCH_LABEL)); - clear_search_button_->SetListener(this); + this, l10n_util::GetString(IDS_COOKIES_CLEAR_SEARCH_LABEL)); description_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_INFO_LABEL)); description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); @@ -728,11 +728,9 @@ void CookiesView::Init() { true)); cookies_table_->SetSortDescriptors(sort); remove_button_ = new views::NativeButton( - l10n_util::GetString(IDS_COOKIES_REMOVE_LABEL)); - remove_button_->SetListener(this); + this, l10n_util::GetString(IDS_COOKIES_REMOVE_LABEL)); remove_all_button_ = new views::NativeButton( - l10n_util::GetString(IDS_COOKIES_REMOVE_ALL_LABEL)); - remove_all_button_->SetListener(this); + this, l10n_util::GetString(IDS_COOKIES_REMOVE_ALL_LABEL)); using views::GridLayout; using views::ColumnSet; diff --git a/chrome/browser/views/options/cookies_view.h b/chrome/browser/views/options/cookies_view.h index 1c6aacc..ab8b213 100644 --- a/chrome/browser/views/options/cookies_view.h +++ b/chrome/browser/views/options/cookies_view.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H__ #include "base/task.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/table/table_view.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/view.h" @@ -15,6 +15,7 @@ namespace views { class Label; +class NativeButton; } class CookieInfoView; class CookiesTableModel; @@ -24,7 +25,7 @@ class Timer; class CookiesView : public views::View, public views::DialogDelegate, - public views::NativeButton::Listener, + public views::ButtonListener, public views::TableViewObserver, public views::TextField::Controller { public: @@ -36,8 +37,8 @@ class CookiesView : public views::View, // Updates the display to show only the search results. void UpdateSearchResults(); - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); // views::TableViewObserver implementation: virtual void OnSelectionChanged(); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index d33b23c..7433a65 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -24,9 +24,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/button/native_button.h" -#include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/text_field.h" #include "chrome/views/grid_layout.h" #include "chrome/views/widget/widget.h" @@ -244,7 +242,7 @@ FontsPageView::FontsPageView(Profile* profile) FontsPageView::~FontsPageView() { } -void FontsPageView::ButtonPressed(views::NativeButton* sender) { +void FontsPageView::ButtonPressed(views::Button* sender) { HWND owning_hwnd = GetAncestor(GetWidget()->GetNativeView(), GA_ROOT); std::wstring font_name; int font_size = 0; @@ -375,9 +373,9 @@ void FontsPageView::InitFontLayout() { // Fixed width. fixed_width_font_display_view_ = new FontDisplayView; fixed_width_font_change_page_button_ = new views::NativeButton( + this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)); - fixed_width_font_change_page_button_->SetListener(this); fixed_width_font_label_ = new views::Label( l10n_util::GetString( @@ -388,9 +386,9 @@ void FontsPageView::InitFontLayout() { // Serif font. serif_font_display_view_ = new FontDisplayView; serif_font_change_page_button_ = new views::NativeButton( + this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)); - serif_font_change_page_button_->SetListener(this); serif_font_label_ = new views::Label( l10n_util::GetString( @@ -401,10 +399,10 @@ void FontsPageView::InitFontLayout() { // Sans Serif font. sans_serif_font_display_view_ = new FontDisplayView; sans_serif_font_change_page_button_ = new views::NativeButton( + this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)); - sans_serif_font_change_page_button_->SetListener(this); - + sans_serif_font_label_ = new views::Label( l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL)); diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h index eb348e6..28f5f91 100644 --- a/chrome/browser/views/options/fonts_page_view.h +++ b/chrome/browser/views/options/fonts_page_view.h @@ -9,13 +9,14 @@ #include "chrome/browser/shell_dialogs.h" #include "chrome/common/pref_member.h" #include "chrome/views/controls/combo_box.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/view.h" namespace views { class GroupboxView; class Label; +class NativeButton; class TableModel; class TableView; } @@ -29,13 +30,13 @@ class DefaultEncodingComboboxModel; class FontsPageView : public OptionsPageView, public views::ComboBox::Listener, public SelectFontDialog::Listener, - public views::NativeButton::Listener { + public views::ButtonListener { public: explicit FontsPageView(Profile* profile); virtual ~FontsPageView(); - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); // views::ComboBox::Listener implementation: virtual void ItemChanged(views::ComboBox* combo_box, diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index af3e9bd..564aef1 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -29,7 +29,6 @@ #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/url_constants.h" -#include "chrome/views/controls/button/checkbox.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/table/table_view.h" @@ -536,9 +535,9 @@ GeneralPageView::~GeneralPageView() { } /////////////////////////////////////////////////////////////////////////////// -// GeneralPageView, views::NativeButton::Listener implementation: +// GeneralPageView, views::ButtonListener implementation: -void GeneralPageView::ButtonPressed(views::NativeButton* sender) { +void GeneralPageView::ButtonPressed(views::Button* sender) { if (sender == startup_homepage_radio_ || sender == startup_last_session_radio_ || sender == startup_custom_radio_) { @@ -570,7 +569,7 @@ void GeneralPageView::ButtonPressed(views::NativeButton* sender) { SetHomepage(homepage_use_url_textfield_->GetText()); EnableHomepageURLField(true); } else if (sender == homepage_show_home_button_checkbox_) { - bool show_button = homepage_show_home_button_checkbox_->IsSelected(); + bool show_button = homepage_show_home_button_checkbox_->checked(); if (show_button) { UserMetricsRecordAction(L"Options_Homepage_ShowHomeButton", profile()->GetPrefs()); @@ -673,17 +672,17 @@ void GeneralPageView::NotifyPrefChanged(const std::wstring* pref_name) { SessionStartupPref::GetStartupPref(prefs); switch (startup_pref.type) { case SessionStartupPref::DEFAULT: - startup_homepage_radio_->SetIsSelected(true); + startup_homepage_radio_->SetChecked(true); EnableCustomHomepagesControls(false); break; case SessionStartupPref::LAST: - startup_last_session_radio_->SetIsSelected(true); + startup_last_session_radio_->SetChecked(true); EnableCustomHomepagesControls(false); break; case SessionStartupPref::URLS: - startup_custom_radio_->SetIsSelected(true); + startup_custom_radio_->SetChecked(true); EnableCustomHomepagesControls(true); break; } @@ -704,10 +703,10 @@ void GeneralPageView::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name || *pref_name == prefs::kHomePageIsNewTabPage) { if (new_tab_page_is_home_page_.GetValue()) { - homepage_use_newtab_radio_->SetIsSelected(true); + homepage_use_newtab_radio_->SetChecked(true); EnableHomepageURLField(false); } else { - homepage_use_url_radio_->SetIsSelected(true); + homepage_use_url_radio_->SetChecked(true); EnableHomepageURLField(true); } } @@ -719,7 +718,7 @@ void GeneralPageView::NotifyPrefChanged(const std::wstring* pref_name) { } if (!pref_name || *pref_name == prefs::kShowHomeButton) { - homepage_show_home_button_checkbox_->SetIsSelected( + homepage_show_home_button_checkbox_->SetChecked( show_home_button_.GetValue()); } } @@ -772,26 +771,23 @@ void GeneralPageView::InitStartupGroup() { startup_homepage_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB), kStartupRadioGroup); - startup_homepage_radio_->SetListener(this); + startup_homepage_radio_->set_listener(this); startup_last_session_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION), kStartupRadioGroup); - startup_last_session_radio_->SetListener(this); + startup_last_session_radio_->set_listener(this); startup_last_session_radio_->SetMultiLine(true); startup_custom_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_PAGES), kStartupRadioGroup); - startup_custom_radio_->SetListener(this); + startup_custom_radio_->set_listener(this); startup_add_custom_page_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_STARTUP_ADD_BUTTON)); - startup_add_custom_page_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_STARTUP_ADD_BUTTON)); startup_remove_custom_page_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_STARTUP_REMOVE_BUTTON)); + this, l10n_util::GetString(IDS_OPTIONS_STARTUP_REMOVE_BUTTON)); startup_remove_custom_page_button_->SetEnabled(false); - startup_remove_custom_page_button_->SetListener(this); startup_use_current_page_button_ = new views::NativeButton( - l10n_util::GetString(IDS_OPTIONS_STARTUP_USE_CURRENT)); - startup_use_current_page_button_->SetListener(this); + this, l10n_util::GetString(IDS_OPTIONS_STARTUP_USE_CURRENT)); startup_custom_pages_table_model_.reset( new CustomHomePagesTableModel(profile())); @@ -866,17 +862,17 @@ void GeneralPageView::InitHomepageGroup() { homepage_use_newtab_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB), kHomePageRadioGroup); - homepage_use_newtab_radio_->SetListener(this); + homepage_use_newtab_radio_->set_listener(this); homepage_use_newtab_radio_->SetMultiLine(true); homepage_use_url_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL), kHomePageRadioGroup); - homepage_use_url_radio_->SetListener(this); + homepage_use_url_radio_->set_listener(this); homepage_use_url_textfield_ = new views::TextField; homepage_use_url_textfield_->SetController(this); - homepage_show_home_button_checkbox_ = new views::CheckBox( + homepage_show_home_button_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON)); - homepage_show_home_button_checkbox_->SetListener(this); + homepage_show_home_button_checkbox_->set_listener(this); homepage_show_home_button_checkbox_->SetMultiLine(true); using views::GridLayout; @@ -923,8 +919,8 @@ void GeneralPageView::InitDefaultSearchGroup() { default_search_engine_combobox_->SetListener(this); default_search_manage_engines_button_ = new views::NativeButton( + this, l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK)); - default_search_manage_engines_button_->SetListener(this); using views::GridLayout; using views::ColumnSet; @@ -956,9 +952,9 @@ void GeneralPageView::InitDefaultBrowserGroup() { default_browser_status_label_->SetHorizontalAlignment( views::Label::ALIGN_LEFT); default_browser_use_as_default_button_ = new views::NativeButton( + this, l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, l10n_util::GetString(IDS_PRODUCT_NAME))); - default_browser_use_as_default_button_->SetListener(this); using views::GridLayout; using views::ColumnSet; @@ -988,9 +984,9 @@ void GeneralPageView::InitDefaultBrowserGroup() { void GeneralPageView::SaveStartupPref() { SessionStartupPref pref; - if (startup_last_session_radio_->IsSelected()) { + if (startup_last_session_radio_->checked()) { pref.type = SessionStartupPref::LAST; - } else if (startup_custom_radio_->IsSelected()) { + } else if (startup_custom_radio_->checked()) { pref.type = SessionStartupPref::URLS; } diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h index eea9cf1..2ec7f4e 100644 --- a/chrome/browser/views/options/general_page_view.h +++ b/chrome/browser/views/options/general_page_view.h @@ -9,13 +9,14 @@ #include "chrome/browser/views/shelf_item_dialog.h" #include "chrome/common/pref_member.h" #include "chrome/views/controls/combo_box.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/view.h" namespace views { -class CheckBox; +class Checkbox; class GroupboxView; class Label; +class NativeButton; class RadioButton; class TableModel; class TableView; @@ -30,7 +31,7 @@ class SearchEngineListModel; class GeneralPageView : public OptionsPageView, public views::ComboBox::Listener, - public views::NativeButton::Listener, + public views::ButtonListener, public views::TextField::Controller, public ShelfItemDialogDelegate, public views::TableViewObserver { @@ -39,8 +40,8 @@ class GeneralPageView : public OptionsPageView, virtual ~GeneralPageView(); protected: - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); // views::ComboBox::Listener implementation: virtual void ItemChanged(views::ComboBox* combo_box, @@ -133,7 +134,7 @@ class GeneralPageView : public OptionsPageView, views::RadioButton* homepage_use_newtab_radio_; views::RadioButton* homepage_use_url_radio_; views::TextField* homepage_use_url_textfield_; - views::CheckBox* homepage_show_home_button_checkbox_; + views::Checkbox* homepage_show_home_button_checkbox_; BooleanPrefMember new_tab_page_is_home_page_; StringPrefMember homepage_; BooleanPrefMember show_home_button_; diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index b156523..0ed4f94 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -25,8 +25,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/controls/button/checkbox.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/button/radio_button.h" #include "chrome/views/controls/combo_box.h" #include "chrome/views/controls/tabbed_pane.h" @@ -495,7 +493,7 @@ LanguagesPageView::~LanguagesPageView() { language_order_table_->SetModel(NULL); } -void LanguagesPageView::ButtonPressed(views::NativeButton* sender) { +void LanguagesPageView::ButtonPressed(views::Button* sender) { if (sender == move_up_button_) { OnMoveUpLanguage(); language_table_edited_ = true; @@ -512,7 +510,7 @@ void LanguagesPageView::ButtonPressed(views::NativeButton* sender) { new AddLanguageWindowView(this, profile()))->Show(); language_table_edited_ = true; } else if (sender == enable_spellchecking_checkbox_) { - if (enable_spellchecking_checkbox_->IsSelected()) + if (enable_spellchecking_checkbox_->checked()) enable_spellcheck_.SetValue(true); else enable_spellcheck_.SetValue(false); @@ -527,21 +525,17 @@ void LanguagesPageView::OnAddLanguage(const std::wstring& new_language) { void LanguagesPageView::InitControlLayout() { // Define the buttons. - add_button_ = new views::NativeButton(l10n_util::GetString( + add_button_ = new views::NativeButton(this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_ADD_BUTTON_LABEL)); - add_button_->SetListener(this); - remove_button_ = new views::NativeButton(l10n_util::GetString( + remove_button_ = new views::NativeButton(this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_REMOVE_BUTTON_LABEL)); remove_button_->SetEnabled(false); - remove_button_->SetListener(this); - move_up_button_ = new views::NativeButton(l10n_util::GetString( + move_up_button_ = new views::NativeButton(this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEUP_BUTTON_LABEL)); move_up_button_->SetEnabled(false); - move_up_button_->SetListener(this); - move_down_button_ = new views::NativeButton(l10n_util::GetString( + move_down_button_ = new views::NativeButton(this, l10n_util::GetString( IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEDOWN_BUTTON_LABEL)); move_down_button_->SetEnabled(false); - move_down_button_->SetListener(this); languages_contents_ = new views::View; using views::GridLayout; @@ -630,9 +624,9 @@ void LanguagesPageView::InitControlLayout() { l10n_util::GetString(IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE)); dictionary_language_label_->SetHorizontalAlignment( views::Label::ALIGN_LEFT); - enable_spellchecking_checkbox_ = new views::CheckBox( + enable_spellchecking_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_ENABLE_SPELLCHECK)); - enable_spellchecking_checkbox_->SetListener(this); + enable_spellchecking_checkbox_->set_listener(this); enable_spellchecking_checkbox_->SetMultiLine(true); // Determine Locale Codes. @@ -731,7 +725,7 @@ void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) { spellcheck_language_index_selected_ = -1; } if (!pref_name || *pref_name == prefs::kEnableSpellCheck) { - enable_spellchecking_checkbox_->SetIsSelected( + enable_spellchecking_checkbox_->SetChecked( enable_spellcheck_.GetValue()); } } diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h index a58cb99..f9f6def 100644 --- a/chrome/browser/views/options/languages_page_view.h +++ b/chrome/browser/views/options/languages_page_view.h @@ -8,13 +8,14 @@ #include "chrome/browser/views/options/options_page_view.h" #include "chrome/common/pref_member.h" #include "chrome/views/controls/combo_box.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/controls/table/table_view.h" #include "chrome/views/view.h" namespace views { -class CheckBox; +class Checkbox; class Label; +class NativeButton; class TableModel; class TableView; } @@ -27,15 +28,15 @@ class AddLanguageView; // LanguagesPageView class LanguagesPageView : public OptionsPageView, - public views::NativeButton::Listener, + public views::ButtonListener, public views::TableViewObserver, public views::ComboBox::Listener { public: explicit LanguagesPageView(Profile* profile); virtual ~LanguagesPageView(); - // views::NativeButton::Listener implementation: - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener implementation: + virtual void ButtonPressed(views::Button* sender); // Save Changes made to relevant pref members associated with this tab. // This is public since it is called by FontsLanguageWindowView in its @@ -77,7 +78,7 @@ class LanguagesPageView : public OptionsPageView, views::Label* ui_language_label_; views::ComboBox* change_ui_language_combobox_; views::ComboBox* change_dictionary_language_combobox_; - views::CheckBox* enable_spellchecking_checkbox_; + views::Checkbox* enable_spellchecking_checkbox_; views::Label* dictionary_language_label_; scoped_ptr<LanguageOrderTableModel> language_order_table_model_; diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index 4a4c53d..ecc3ef8 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -516,8 +516,7 @@ void PageInfoWindow::Init(Profile* profile, cert_id_ = ssl.cert_id(); cert_info_button_ = new views::NativeButton( - l10n_util::GetString(IDS_PAGEINFO_CERT_INFO_BUTTON)); - cert_info_button_->SetListener(this); + this, l10n_util::GetString(IDS_PAGEINFO_CERT_INFO_BUTTON)); contents_ = new PageInfoContentView(); DWORD sys_color = ::GetSysColor(COLOR_3DFACE); @@ -613,7 +612,7 @@ views::View* PageInfoWindow::GetContentsView() { return contents_; } -void PageInfoWindow::ButtonPressed(views::NativeButton* sender) { +void PageInfoWindow::ButtonPressed(views::Button* sender) { if (sender == cert_info_button_) { DCHECK(cert_id_ != 0); ShowCertDialog(cert_id_); diff --git a/chrome/browser/views/page_info_window.h b/chrome/browser/views/page_info_window.h index e82130f..35b2ee0 100644 --- a/chrome/browser/views/page_info_window.h +++ b/chrome/browser/views/page_info_window.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_VIEWS_PAGE_INFO_WINDOW_H__ #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/views/controls/button/native_button.h" +#include "chrome/views/controls/button/button.h" #include "chrome/views/window/dialog_delegate.h" #include "chrome/views/window/window.h" #include "googleurl/src/gurl.h" @@ -25,7 +25,7 @@ class Profile; class X509Certificate; class PageInfoWindow : public views::DialogDelegate, - public views::NativeButton::Listener { + public views::ButtonListener { public: enum TabID { GENERAL = 0, @@ -62,8 +62,8 @@ class PageInfoWindow : public views::DialogDelegate, // views::Window overridden method. void Show(); - // views::NativeButton::Listener method. - virtual void ButtonPressed(views::NativeButton* sender); + // views::ButtonListener method. + virtual void ButtonPressed(views::Button* sender); // views::DialogDelegate methods: virtual int GetDialogButtons() const; diff --git a/chrome/browser/views/password_manager_exceptions_view.cc b/chrome/browser/views/password_manager_exceptions_view.cc index 5af5f7d..ae87998 100644 --- a/chrome/browser/views/password_manager_exceptions_view.cc +++ b/chrome/browser/views/password_manager_exceptions_view.cc @@ -99,9 +99,9 @@ void PasswordManagerExceptionsView::Show(Profile* profile) { } PasswordManagerExceptionsView::PasswordManagerExceptionsView(Profile* profile) - : remove_button_(l10n_util::GetString( + : remove_button_(this, l10n_util::GetString( IDS_PASSWORD_MANAGER_EXCEPTIONS_VIEW_REMOVE_BUTTON)), - remove_all_button_(l10n_util::GetString( + remove_all_button_(this, l10n_util::GetString( IDS_PASSWORD_MANAGER_EXCEPTIONS_VIEW_REMOVE_ALL_BUTTON)), table_model_(profile) { Init(); @@ -132,11 +132,9 @@ void PasswordManagerExceptionsView::SetupButtons() { // Tell View not to delete class stack allocated views. remove_button_.SetParentOwned(false); - remove_button_.SetListener(this); remove_button_.SetEnabled(false); remove_all_button_.SetParentOwned(false); - remove_all_button_.SetListener(this); } void PasswordManagerExceptionsView::Init() { @@ -212,7 +210,7 @@ std::wstring PasswordManagerExceptionsView::GetWindowTitle() const { return l10n_util::GetString(IDS_PASSWORD_MANAGER_EXCEPTIONS_VIEW_TITLE); } -void PasswordManagerExceptionsView::ButtonPressed(views::NativeButton* sender) { +void PasswordManagerExceptionsView::ButtonPressed(views::Button* sender) { DCHECK(window()); // Close will result in our destruction. if (sender == &remove_all_button_) { diff --git a/chrome/browser/views/password_manager_exceptions_view.h b/chrome/browser/views/password_manager_exceptions_view.h index cfd9297..5dacbb6 100644 --- a/chrome/browser/views/password_manager_exceptions_view.h +++ b/chrome/browser/views/password_manager_exceptions_view.h @@ -11,7 +11,6 @@ #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/stl_util-inl.h" #include "chrome/common/gfx/text_elider.h" -#include "chrome/views/controls/button/native_button.h" #include "chrome/views/controls/label.h" #include "chrome/views/controls/table/table_view.h" #include "chrome/views/window/dialog_delegate.h" @@ -37,7 +36,7 @@ class PasswordManagerExceptionsTableModel : public PasswordManagerTableModel { class PasswordManagerExceptionsView : public views::View, public views::DialogDelegate, public views::TableViewObserver, - public views::NativeButton::Listener, + public views::ButtonListener, public PasswordManagerTableModelObserver { public: explicit PasswordManagerExceptionsView(Profile* profile); @@ -55,8 +54,8 @@ class PasswordManagerExceptionsView : public views::View, // views::TableViewObserver implementation. virtual void OnSelectionChanged(); - // NativeButton::Listener implementation. - virtual void ButtonPressed(views::NativeButton* sender); + // ButtonListener implementation. + virtual void ButtonPressed(views::Button* sender); // views::DialogDelegate methods: virtual int GetDialogButtons() const; diff --git a/chrome/browser/views/password_manager_view.cc b/chrome/browser/views/password_manager_view.cc index eb7f5eb..a0561a3 100644 --- a/chrome/browser/views/password_manager_view.cc +++ b/chrome/browser/views/password_manager_view.cc @@ -26,9 +26,10 @@ static const int kDefaultWindowHeight = 240; //////////////////////////////////////////////////////////////////////////////// // MultiLabelButtons // -MultiLabelButtons::MultiLabelButtons(const std::wstring& label, +MultiLabelButtons::MultiLabelButtons(views::ButtonListener* listener, + const std::wstring& label, const std::wstring& alt_label) - : NativeButton(label), + : NativeButton(listener, label), label_(label), alt_label_(alt_label), pref_size_(-1, -1) { @@ -37,7 +38,7 @@ MultiLabelButtons::MultiLabelButtons(const std::wstring& label, gfx::Size MultiLabelButtons::GetPreferredSize() { if (pref_size_.width() == -1 && pref_size_.height() == -1) { // Let's compute our preferred size. - std::wstring current_label = GetLabel(); + std::wstring current_label = label(); SetLabel(label_); pref_size_ = NativeButton::GetPreferredSize(); SetLabel(alt_label_); @@ -204,11 +205,12 @@ void PasswordManagerView::Show(Profile* profile) { PasswordManagerView::PasswordManagerView(Profile* profile) : show_button_( + this, l10n_util::GetString(IDS_PASSWORD_MANAGER_VIEW_SHOW_BUTTON), l10n_util::GetString(IDS_PASSWORD_MANAGER_VIEW_HIDE_BUTTON)), - remove_button_(l10n_util::GetString( + remove_button_(this, l10n_util::GetString( IDS_PASSWORD_MANAGER_VIEW_REMOVE_BUTTON)), - remove_all_button_(l10n_util::GetString( + remove_all_button_(this, l10n_util::GetString( IDS_PASSWORD_MANAGER_VIEW_REMOVE_ALL_BUTTON)), table_model_(profile) { Init(); @@ -242,16 +244,13 @@ void PasswordManagerView::SetupButtonsAndLabels() { // Tell View not to delete class stack allocated views. show_button_.SetParentOwned(false); - show_button_.SetListener(this); show_button_.SetEnabled(false); remove_button_.SetParentOwned(false); - remove_button_.SetListener(this); remove_button_.SetEnabled(false); remove_all_button_.SetParentOwned(false); - remove_all_button_.SetListener(this); - + password_label_.SetParentOwned(false); } @@ -365,7 +364,7 @@ std::wstring PasswordManagerView::GetWindowTitle() const { return l10n_util::GetString(IDS_PASSWORD_MANAGER_VIEW_TITLE); } -void PasswordManagerView::ButtonPressed(views::NativeButton* sender) { +void PasswordManagerView::ButtonPressed(views::Button* sender) { DCHECK(window()); // Close will result in our destruction. if (sender == &remove_all_button_) { diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h index 40bb8ba..ed12d6a 100644 --- a/chrome/browser/views/password_manager_view.h +++ b/chrome/browser/views/password_manager_view.h @@ -118,7 +118,9 @@ class PasswordManagerTableModel : public views::TableModel, // preferred size is the size of the widest string. class MultiLabelButtons : public views::NativeButton { public: - MultiLabelButtons(const std::wstring& label, const std::wstring& alt_label); + MultiLabelButtons(views::ButtonListener* listener, + const std::wstring& label, + const std::wstring& alt_label); virtual gfx::Size GetPreferredSize(); @@ -133,7 +135,7 @@ class MultiLabelButtons : public views::NativeButton { class PasswordManagerView : public views::View, public views::DialogDelegate, public views::TableViewObserver, - public views::NativeButton::Listener, + public views::ButtonListener, public PasswordManagerTableModelObserver { public: explicit PasswordManagerView(Profile* profile); @@ -150,8 +152,8 @@ class PasswordManagerView : public views::View, // views::TableViewObserver implementation. virtual void OnSelectionChanged(); - // NativeButton::Listener implementation. - virtual void ButtonPressed(views::NativeButton* sender); + // ButtonListener implementation. + virtual void ButtonPressed(views::Button* sender); // views::DialogDelegate methods: virtual int GetDialogButtons() const; |