diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 16:18:25 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 16:18:25 +0000 |
commit | a326d4afc8ddee0050f616797b5bbed829dd9948 (patch) | |
tree | 2d8069bf4cae0475b741ca231f308725827f5e2a | |
parent | edda6f2964eb176cd35741df9719b275f3d2a622 (diff) | |
download | chromium_src-a326d4afc8ddee0050f616797b5bbed829dd9948.zip chromium_src-a326d4afc8ddee0050f616797b5bbed829dd9948.tar.gz chromium_src-a326d4afc8ddee0050f616797b5bbed829dd9948.tar.bz2 |
views: Convert View::GetID/SetID functions to unix_hacker style.
BUG=72040
TEST=None
R=ben@chromium.org
Review URL: http://codereview.chromium.org/6969087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87791 0039d316-1c4b-4281-b951-d872f2087c98
39 files changed, 142 insertions, 151 deletions
diff --git a/chrome/browser/automation/testing_automation_provider_views.cc b/chrome/browser/automation/testing_automation_provider_views.cc index ca5c06a..fd685b2 100644 --- a/chrome/browser/automation/testing_automation_provider_views.cc +++ b/chrome/browser/automation/testing_automation_provider_views.cc @@ -57,9 +57,9 @@ class ViewFocusChangeWaiter : public views::FocusChangeListener { private: void FocusChanged(views::View* focused_before, views::View* focused_now) { - if (focused_now && focused_now->GetID() != previous_view_id_) { + if (focused_now && focused_now->id() != previous_view_id_) { AutomationMsg_WaitForFocusedViewIDToChange::WriteReplyParams( - reply_message_, true, focused_now->GetID()); + reply_message_, true, focused_now->id()); automation_->Send(reply_message_); delete this; @@ -149,7 +149,7 @@ void TestingAutomationProvider::GetFocusedViewID(int handle, int* view_id) { DCHECK(focus_manager); views::View* focused_view = focus_manager->GetFocusedView(); if (focused_view) - *view_id = focused_view->GetID(); + *view_id = focused_view->id(); } } diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index 82b8056..be541f3 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -130,7 +130,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { void ViewAdded(views::View* host, views::View* view) { ::BrowserViewLayout::ViewAdded(host, view); - switch (view->GetID()) { + switch (view->id()) { case VIEW_ID_STATUS_AREA: status_area_ = static_cast<chromeos::StatusAreaView*>(view); break; @@ -291,7 +291,7 @@ BrowserView::~BrowserView() { void BrowserView::Init() { ::BrowserView::Init(); status_area_ = new StatusAreaView(this); - status_area_->SetID(VIEW_ID_STATUS_AREA); + status_area_->set_id(VIEW_ID_STATUS_AREA); AddChildView(status_area_); status_area_->Init(); diff --git a/chrome/browser/chromeos/login/default_images_view.cc b/chrome/browser/chromeos/login/default_images_view.cc index 25d85aa..5c2a7fc 100644 --- a/chrome/browser/chromeos/login/default_images_view.cc +++ b/chrome/browser/chromeos/login/default_images_view.cc @@ -8,14 +8,14 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/default_user_images.h" #include "chrome/browser/chromeos/login/rounded_rect_painter.h" -#include "grit/theme_resources.h" #include "grit/generated_resources.h" +#include "grit/theme_resources.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "views/border.h" #include "views/background.h" +#include "views/border.h" #include "views/controls/button/image_button.h" #include "views/layout/grid_layout.h" @@ -90,14 +90,14 @@ DefaultImagesView::~DefaultImagesView() {} void DefaultImagesView::Init() { UserImageButton* capture_button = new UserImageButton(this); - capture_button->SetID(kCaptureButtonId); + capture_button->set_id(kCaptureButtonId); capture_button->SetTooltipText(UTF16ToWide( l10n_util::GetStringUTF16(IDS_OPTIONS_CHANGE_PICTURE_TAKE_PHOTO))); InitButton(IDR_BUTTON_USER_IMAGE_TAKE_PHOTO, capture_button); default_images_.push_back(capture_button); for (int i = 0; i < kDefaultImagesCount; ++i) { UserImageButton* image_button = new UserImageButton(this); - image_button->SetID(i + kImageStartId); + image_button->set_id(i + kImageStartId); InitButton(kDefaultImageResources[i], image_button); default_images_.push_back(image_button); } @@ -140,11 +140,11 @@ void DefaultImagesView::ButtonPressed(views::Button* sender, return; ClearSelection(); - if (sender->GetID() == kCaptureButtonId) { + if (sender->id() == kCaptureButtonId) { if (delegate_) delegate_->OnCaptureButtonClicked(); } else { - int image_index = sender->GetID() - kImageStartId; + int image_index = sender->id() - kImageStartId; int images_count = static_cast<int>(default_images_.size()); if (image_index < 0 || image_index >= images_count) { NOTREACHED() << "Got ButtonPressed event from a view with wrong id."; diff --git a/chrome/browser/chromeos/login/shutdown_button.cc b/chrome/browser/chromeos/login/shutdown_button.cc index e99aa04..ca65455 100644 --- a/chrome/browser/chromeos/login/shutdown_button.cc +++ b/chrome/browser/chromeos/login/shutdown_button.cc @@ -72,7 +72,7 @@ void ShutdownButton::Init() { SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON)); set_icon_text_spacing(kIconTextPadding); set_focusable(true); - SetID(VIEW_ID_SCREEN_LOCKER_SHUTDOWN); + set_id(VIEW_ID_SCREEN_LOCKER_SHUTDOWN); // Set label colors. SetEnabledColor(SK_ColorWHITE); SetDisabledColor(SK_ColorWHITE); diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc index 69c29f8..352a42a 100644 --- a/chrome/browser/chromeos/login/user_view.cc +++ b/chrome/browser/chromeos/login/user_view.cc @@ -85,7 +85,7 @@ class SignoutView : public views::View { signout_link_->SetHighlightedColor(kTextColor); signout_link_->SetDisabledColor(kTextColor); signout_link_->SetNormalColor(kTextColor); - signout_link_->SetID(VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK); + signout_link_->set_id(VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK); AddChildView(active_user_label_); AddChildView(signout_link_); diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc index e595d0d..f914ef9 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc @@ -275,7 +275,7 @@ TouchTab* TouchTabStrip::GetTabAtTabDataIndex(int tab_data_index) const { // TouchTabStrip, private: void TouchTabStrip::Init() { - SetID(VIEW_ID_TAB_STRIP); + set_id(VIEW_ID_TAB_STRIP); } //////////////////////////////////////////////////////////////////////////////// @@ -330,7 +330,7 @@ views::View::TouchStatus TouchTabStrip::OnTouchEvent( return TOUCH_STATUS_UNKNOWN; views::View* view = GetEventHandlerForPoint(event.location()); - if (view && view != this && view->GetID() != VIEW_ID_TAB) + if (view && view != this && view->id() != VIEW_ID_TAB) return TOUCH_STATUS_UNKNOWN; base::TimeDelta delta = event.time_stamp() - last_tap_time_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index cd9d595..d965a3a 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -358,7 +358,7 @@ BookmarkBarView::BookmarkBarView(Profile* profile, Browser* browser) sync_service_->AddObserver(this); } - SetID(VIEW_ID_BOOKMARK_BAR); + set_id(VIEW_ID_BOOKMARK_BAR); Init(); SetProfile(profile); @@ -1230,7 +1230,7 @@ MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)), this, false); - button->SetID(VIEW_ID_OTHER_BOOKMARKS); + button->set_id(VIEW_ID_OTHER_BOOKMARKS); button->SetIcon(GetFolderIcon()); button->SetContextMenuController(this); button->set_tag(kOtherFolderButtonTag); @@ -1297,7 +1297,7 @@ void BookmarkBarView::ConfigureButton(const BookmarkNode* node, views::TextButton* button) { button->SetText(UTF16ToWide(node->GetTitle())); button->SetAccessibleName(node->GetTitle()); - button->SetID(VIEW_ID_BOOKMARK_BAR_ELEMENT); + button->set_id(VIEW_ID_BOOKMARK_BAR_ELEMENT); // We don't always have a theme provider (ui tests, for example). if (GetThemeProvider()) { button->SetEnabledColor(GetThemeProvider()->GetColor( diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index 8c88359..54c3277 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -1188,7 +1188,7 @@ class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { views::SubmenuView* submenu = menu->GetSubmenu(); views::View* separator_view = NULL; for (int i = 0; i < submenu->child_count(); ++i) { - if (submenu->GetChildViewAt(i)->GetID() != + if (submenu->GetChildViewAt(i)->id() != views::MenuItemView::kMenuItemViewID) { separator_view = submenu->GetChildViewAt(i); break; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 9667acc..6fd396b 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -189,7 +189,7 @@ void BookmarkEditorView::ContentsChanged(Textfield* sender, void BookmarkEditorView::ButtonPressed( Button* sender, const views::Event& event) { DCHECK(sender); - switch (sender->GetID()) { + switch (sender->id()) { case kNewFolderButtonID: NewFolder(); break; @@ -311,7 +311,7 @@ void BookmarkEditorView::Init() { tree_view_->SetRootShown(false); new_folder_button_->SetEnabled(false); - new_folder_button_->SetID(kNewFolderButtonID); + new_folder_button_->set_id(kNewFolderButtonID); } // Yummy layout code. diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 70b8df3..ebec34e 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -361,7 +361,7 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser, drop_indicator_position_(-1), ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(show_menu_task_factory_(this)) { - SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR); + set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); if (profile_->GetExtensionService()) { model_ = profile_->GetExtensionService()->toolbar_model(); diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc index f6b3738..dd9fd3b 100644 --- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc +++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.cc @@ -125,7 +125,7 @@ void CompactLocationBarView::Init() { UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_RELOAD))); reload_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)); - reload_button_->SetID(VIEW_ID_RELOAD_BUTTON); + reload_button_->set_id(VIEW_ID_RELOAD_BUTTON); ThemeProvider* tp = GetThemeProvider(); reload_button_->SetImage(views::CustomButton::BS_NORMAL, diff --git a/chrome/browser/ui/views/compact_nav/compact_options_bar.cc b/chrome/browser/ui/views/compact_nav/compact_options_bar.cc index 677485f..bcf5b14 100644 --- a/chrome/browser/ui/views/compact_nav/compact_options_bar.cc +++ b/chrome/browser/ui/views/compact_nav/compact_options_bar.cc @@ -49,7 +49,7 @@ void CompactOptionsBar::Init() { app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16( IDS_APPMENU_TOOLTIP, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); - app_menu_->SetID(VIEW_ID_APP_MENU); + app_menu_->set_id(VIEW_ID_APP_MENU); AddChildView(app_menu_); LoadImages(); @@ -92,7 +92,7 @@ void CompactOptionsBar::Layout() { void CompactOptionsBar::RunMenu(views::View* source, const gfx::Point& /* pt */) { - DCHECK_EQ(VIEW_ID_APP_MENU, source->GetID()); + DCHECK_EQ(VIEW_ID_APP_MENU, source->id()); wrench_menu_ = new WrenchMenu(browser_view_->browser()); wrench_menu_->Init(wrench_menu_model_.get()); diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index c6e6a77..aaebcfc 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc @@ -90,7 +90,7 @@ DownloadShelfView::DownloadShelfView(Browser* browser, BrowserView* parent) ALLOW_THIS_IN_INITIALIZER_LIST( mouse_watcher_(this, this, gfx::Insets())) { mouse_watcher_.set_notify_on_exit_time_ms(kNotifyOnExitTimeMS); - SetID(VIEW_ID_DOWNLOAD_SHELF); + set_id(VIEW_ID_DOWNLOAD_SHELF); parent->AddChildView(this); Init(); } diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 64a0f8f..cb7c0f7 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -76,11 +76,11 @@ FindBarView::FindBarView(FindBarHost* host) close_button_(NULL), background_(NULL), background_left_(NULL) { - SetID(VIEW_ID_FIND_IN_PAGE); + set_id(VIEW_ID_FIND_IN_PAGE); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); find_text_ = new SearchTextfieldView(); - find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); + find_text_->set_id(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); find_text_->set_default_width_in_chars(kDefaultCharWidth); find_text_->SetController(this); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index ff20a3b..782450c 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1891,7 +1891,7 @@ void BrowserView::Init() { bool sidebar_allowed = SidebarManager::IsSidebarAllowed(); if (sidebar_allowed) { sidebar_container_ = new TabContentsContainer; - sidebar_container_->SetID(VIEW_ID_SIDE_BAR_CONTAINER); + sidebar_container_->set_id(VIEW_ID_SIDE_BAR_CONTAINER); sidebar_container_->SetVisible(false); sidebar_split_ = new views::SingleSplitView( @@ -1899,7 +1899,7 @@ void BrowserView::Init() { sidebar_container_, views::SingleSplitView::HORIZONTAL_SPLIT, this); - sidebar_split_->SetID(VIEW_ID_SIDE_BAR_SPLIT); + sidebar_split_->set_id(VIEW_ID_SIDE_BAR_SPLIT); sidebar_split_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR)); sidebar_split_->set_background( @@ -1907,7 +1907,7 @@ void BrowserView::Init() { } devtools_container_ = new TabContentsContainer; - devtools_container_->SetID(VIEW_ID_DEV_TOOLS_DOCKED); + devtools_container_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); devtools_container_->SetVisible(false); views::View* contents_view = contents_; @@ -1919,7 +1919,7 @@ void BrowserView::Init() { devtools_container_, views::SingleSplitView::VERTICAL_SPLIT, this); - contents_split_->SetID(VIEW_ID_CONTENTS_SPLIT); + contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); contents_split_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); contents_split_->set_background( @@ -1952,11 +1952,11 @@ void BrowserView::Init() { switches::kEnableCompactNavigation)) { compact_location_bar_view_host_.reset(new CompactLocationBarViewHost(this)); compact_navigation_bar_ = new CompactNavigationBar(this); - compact_navigation_bar_->SetID(VIEW_ID_COMPACT_NAV_BAR); + compact_navigation_bar_->set_id(VIEW_ID_COMPACT_NAV_BAR); AddChildView(compact_navigation_bar_); compact_navigation_bar_->Init(); compact_options_bar_ = new CompactOptionsBar(this); - compact_options_bar_->SetID(VIEW_ID_COMPACT_OPT_BAR); + compact_options_bar_->set_id(VIEW_ID_COMPACT_OPT_BAR); AddChildView(compact_options_bar_); compact_options_bar_->Init(); } @@ -1964,7 +1964,7 @@ void BrowserView::Init() { // Use an empty view for the spacer since all it does is that it replaces the // toolbar area in compact navigation mode. compact_spacer_ = new views::View(); - compact_spacer_->SetID(VIEW_ID_COMPACT_NAV_BAR_SPACER); + compact_spacer_->set_id(VIEW_ID_COMPACT_NAV_BAR_SPACER); AddChildView(compact_spacer_); // We're now initialized and ready to process Layout requests. diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 29bb06c..e6b07c0 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc @@ -249,7 +249,7 @@ void BrowserViewLayout::Installed(views::View* host) { void BrowserViewLayout::Uninstalled(views::View* host) {} void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { - switch (view->GetID()) { + switch (view->id()) { case VIEW_ID_CONTENTS_SPLIT: { contents_split_ = static_cast<views::SingleSplitView*>(view); // We're installed as the LayoutManager before BrowserView creates the @@ -286,7 +286,7 @@ void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { } void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { - switch (view->GetID()) { + switch (view->id()) { case VIEW_ID_BOOKMARK_BAR: active_bookmark_bar_ = NULL; break; diff --git a/chrome/browser/ui/views/infobars/infobar_container_view.cc b/chrome/browser/ui/views/infobars/infobar_container_view.cc index 0ab5fbf..fdf2fb5 100644 --- a/chrome/browser/ui/views/infobars/infobar_container_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_container_view.cc @@ -12,7 +12,7 @@ InfoBarContainerView::InfoBarContainerView(Delegate* delegate) : InfoBarContainer(delegate) { - SetID(VIEW_ID_INFO_BAR_CONTAINER); + set_id(VIEW_ID_INFO_BAR_CONTAINER); } InfoBarContainerView::~InfoBarContainerView() { diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 7b57d07..ad4f476 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -124,7 +124,7 @@ LocationBarView::LocationBarView(Profile* profile, template_url_model_(NULL), animation_offset_(0) { DCHECK(profile_); - SetID(VIEW_ID_LOCATION_BAR); + set_id(VIEW_ID_LOCATION_BAR); set_focusable(true); if (mode_ == NORMAL) @@ -179,7 +179,7 @@ void LocationBarView::Init() { #endif location_entry_view_ = location_entry_->AddToView(this); - location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); + location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); selected_keyword_view_ = new SelectedKeywordView( kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index 8e24153..a6fa14f 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -18,7 +18,7 @@ StarView::StarView(CommandUpdater* command_updater) : command_updater_(command_updater) { - SetID(VIEW_ID_STAR_BUTTON); + set_id(VIEW_ID_STAR_BUTTON); SetToggled(false); set_accessibility_focusable(true); } diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc index ce63670..a25bdb1 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc @@ -20,7 +20,7 @@ NativeTabContentsContainerGtk::NativeTabContentsContainerGtk( TabContentsContainer* container) : container_(container), focus_callback_id_(0) { - SetID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); + set_id(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); } NativeTabContentsContainerGtk::~NativeTabContentsContainerGtk() { diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc index 816b346..5371099 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc @@ -19,7 +19,7 @@ NativeTabContentsContainerWin::NativeTabContentsContainerWin( TabContentsContainer* container) : container_(container) { - SetID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); + set_id(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); } NativeTabContentsContainerWin::~NativeTabContentsContainerWin() { diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.cc index d9f6f60..28ce5f2 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.cc @@ -23,7 +23,7 @@ TabContentsContainer::TabContentsContainer() : native_container_(NULL), tab_contents_(NULL) { - SetID(VIEW_ID_TAB_CONTAINER); + set_id(VIEW_ID_TAB_CONTAINER); } void TabContentsContainer::SetReservedContentsRect( diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc index 9fb7749..5a2016a 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc @@ -29,7 +29,7 @@ const char TabContentsContainer::kViewClassName[] = TabContentsContainer::TabContentsContainer() : tab_contents_(NULL) { - SetID(VIEW_ID_TAB_CONTAINER); + set_id(VIEW_ID_TAB_CONTAINER); } void TabContentsContainer::SetReservedContentsRect( diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index e84f5c9..1b2ddb1 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -153,7 +153,7 @@ BaseTab::BaseTab(TabController* controller) theme_provider_(NULL) { BaseTab::InitResources(); - SetID(VIEW_ID_TAB); + set_id(VIEW_ID_TAB); // Add the Close Button. close_button_ = new TabCloseButton(this); diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index 13eb4cf..7b5c683 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -559,11 +559,10 @@ BaseTab* BaseTabStrip::GetTabAtLocal(const gfx::Point& local_point) { return NULL; // No tab contains the point. // Walk up the view hierarchy until we find a tab, or the TabStrip. - while (view && view != this && view->GetID() != VIEW_ID_TAB) + while (view && view != this && view->id() != VIEW_ID_TAB) view = view->parent(); - return view && view->GetID() == VIEW_ID_TAB ? - static_cast<BaseTab*>(view) : NULL; + return view && view->id() == VIEW_ID_TAB ? static_cast<BaseTab*>(view) : NULL; } void BaseTabStrip::StoppedDraggingTab(BaseTab* tab, bool* is_first_tab) { diff --git a/chrome/browser/ui/views/tabs/side_tab_strip.cc b/chrome/browser/ui/views/tabs/side_tab_strip.cc index 5058c23..86cc393 100644 --- a/chrome/browser/ui/views/tabs/side_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/side_tab_strip.cc @@ -128,7 +128,7 @@ SideTabStrip::SideTabStrip(TabStripController* controller) separator_(new views::View()), first_tab_y_offset_(0), ideal_height_(0) { - SetID(VIEW_ID_TAB_STRIP); + set_id(VIEW_ID_TAB_STRIP); set_background(views::Background::CreateSolidBackground(kBackgroundColor)); AddChildView(newtab_button_); separator_->set_background( diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index bde3788..990bcec 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -533,7 +533,7 @@ void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) { // TabStrip, private: void TabStrip::Init() { - SetID(VIEW_ID_TAB_STRIP); + set_id(VIEW_ID_TAB_STRIP); newtab_button_bounds_.SetRect(0, 0, kNewTabButtonWidth, kNewTabButtonHeight); if (browser_defaults::kSizeTabButtonToTopOfTabStrip) { newtab_button_bounds_.set_height( diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 93799ac..3bbf2a5 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -87,7 +87,7 @@ ToolbarView::ToolbarView(Browser* browser) profile_(NULL), browser_(browser), profiles_menu_contents_(NULL) { - SetID(VIEW_ID_TOOLBAR); + set_id(VIEW_ID_TOOLBAR); browser_->command_updater()->AddCommandObserver(IDC_BACK, this); browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this); @@ -128,7 +128,7 @@ void ToolbarView::Init(Profile* profile) { back_->SetTooltipText( UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_BACK))); back_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)); - back_->SetID(VIEW_ID_BACK_BUTTON); + back_->set_id(VIEW_ID_BACK_BUTTON); forward_ = new views::ButtonDropDown(this, forward_menu_model_.get()); forward_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN | @@ -137,7 +137,7 @@ void ToolbarView::Init(Profile* profile) { forward_->SetTooltipText( UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD))); forward_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)); - forward_->SetID(VIEW_ID_FORWARD_BUTTON); + forward_->set_id(VIEW_ID_FORWARD_BUTTON); // Have to create this before |reload_| as |reload_|'s constructor needs it. location_bar_ = new LocationBarView(profile, browser_, @@ -151,7 +151,7 @@ void ToolbarView::Init(Profile* profile) { reload_->SetTooltipText( UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_RELOAD))); reload_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)); - reload_->SetID(VIEW_ID_RELOAD_BUTTON); + reload_->set_id(VIEW_ID_RELOAD_BUTTON); home_ = new views::ImageButton(this); home_->set_triggerable_event_flags(ui::EF_LEFT_BUTTON_DOWN | @@ -160,7 +160,7 @@ void ToolbarView::Init(Profile* profile) { home_->SetTooltipText( UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME))); home_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)); - home_->SetID(VIEW_ID_HOME_BUTTON); + home_->set_id(VIEW_ID_HOME_BUTTON); browser_actions_ = new BrowserActionsContainer(browser_, this); @@ -171,7 +171,7 @@ void ToolbarView::Init(Profile* profile) { app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16( IDS_APPMENU_TOOLTIP, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)))); - app_menu_->SetID(VIEW_ID_APP_MENU); + app_menu_->set_id(VIEW_ID_APP_MENU); // Add any necessary badges to the menu item based on the system state. if (IsUpgradeRecommended() || ShouldShowIncompatibilityWarning()) { @@ -327,7 +327,7 @@ bool ToolbarView::GetAcceleratorInfo(int id, ui::Accelerator* accel) { // ToolbarView, views::MenuDelegate implementation: void ToolbarView::RunMenu(views::View* source, const gfx::Point& /* pt */) { - DCHECK_EQ(VIEW_ID_APP_MENU, source->GetID()); + DCHECK_EQ(VIEW_ID_APP_MENU, source->id()); wrench_menu_ = new WrenchMenu(browser_); wrench_menu_->Init(wrench_menu_model_.get()); diff --git a/chrome/test/ui_test_utils_linux.cc b/chrome/test/ui_test_utils_linux.cc index d0b9d99..d080faf 100644 --- a/chrome/test/ui_test_utils_linux.cc +++ b/chrome/test/ui_test_utils_linux.cc @@ -53,7 +53,7 @@ bool IsViewFocused(const Browser* browser, ViewID vid) { GTK_WIDGET(window)); DCHECK(focus_manager); return focus_manager->GetFocusedView() && - focus_manager->GetFocusedView()->GetID() == vid; + focus_manager->GetFocusedView()->id() == vid; #else gfx::NativeWindow window = browser_window->GetNativeHandle(); DCHECK(window); diff --git a/chrome/test/ui_test_utils_win.cc b/chrome/test/ui_test_utils_win.cc index 3329c4b..d791860 100644 --- a/chrome/test/ui_test_utils_win.cc +++ b/chrome/test/ui_test_utils_win.cc @@ -22,7 +22,7 @@ bool IsViewFocused(const Browser* browser, ViewID vid) { views::FocusManager* focus_manager = views::FocusManager::GetFocusManagerForNativeView(window); DCHECK(focus_manager); - return focus_manager->GetFocusedView()->GetID() == vid; + return focus_manager->GetFocusedView()->id() == vid; } void ClickOnView(const Browser* browser, ViewID vid) { diff --git a/views/controls/combobox/native_combobox_views_unittest.cc b/views/controls/combobox/native_combobox_views_unittest.cc index dce36af..cb18b31 100644 --- a/views/controls/combobox/native_combobox_views_unittest.cc +++ b/views/controls/combobox/native_combobox_views_unittest.cc @@ -99,7 +99,7 @@ class NativeComboboxViewsTest : public ViewsTestBase { ASSERT_FALSE(combobox_); combobox_ = new TestCombobox(model_.get()); - combobox_->SetID(1); + combobox_->set_id(1); widget_ = new Widget; Widget::InitParams params(Widget::InitParams::TYPE_POPUP); diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 573ffe3..70f1a8b 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -714,7 +714,7 @@ int MenuController::OnPerformDrop(SubmenuView* source, // WARNING: the call to MenuClosed deletes us. // If over an empty menu item, drop occurs on the parent. - if (drop_target->GetID() == MenuItemView::kEmptyMenuItemViewID) + if (drop_target->id() == MenuItemView::kEmptyMenuItemViewID) drop_target = drop_target->GetParentMenuItem(); return drop_target->GetDelegate()->OnPerformDrop( @@ -1130,11 +1130,11 @@ MenuItemView* MenuController::GetMenuItemAt(View* source, int x, int y) { // Walk the view hierarchy until we find a menu item (or the root). View* child_under_mouse = source->GetEventHandlerForPoint(gfx::Point(x, y)); while (child_under_mouse && - child_under_mouse->GetID() != MenuItemView::kMenuItemViewID) { + child_under_mouse->id() != MenuItemView::kMenuItemViewID) { child_under_mouse = child_under_mouse->parent(); } if (child_under_mouse && child_under_mouse->IsEnabled() && - child_under_mouse->GetID() == MenuItemView::kMenuItemViewID) { + child_under_mouse->id() == MenuItemView::kMenuItemViewID) { return static_cast<MenuItemView*>(child_under_mouse); } return NULL; @@ -1143,7 +1143,7 @@ MenuItemView* MenuController::GetMenuItemAt(View* source, int x, int y) { MenuItemView* MenuController::GetEmptyMenuItemAt(View* source, int x, int y) { View* child_under_mouse = source->GetEventHandlerForPoint(gfx::Point(x, y)); if (child_under_mouse && - child_under_mouse->GetID() == MenuItemView::kEmptyMenuItemViewID) { + child_under_mouse->id() == MenuItemView::kEmptyMenuItemViewID) { return static_cast<MenuItemView*>(child_under_mouse); } return NULL; diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index 8c0e07e..beee1b3 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -12,8 +12,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/menu_model.h" #include "ui/gfx/canvas.h" -#include "views/controls/button/text_button.h" #include "views/controls/button/menu_button.h" +#include "views/controls/button/text_button.h" #include "views/controls/menu/menu_config.h" #include "views/controls/menu/menu_controller.h" #include "views/controls/menu/menu_separator.h" @@ -38,7 +38,7 @@ class EmptyMenuMenuItem : public MenuItemView { explicit EmptyMenuMenuItem(MenuItemView* parent) : MenuItemView(parent, 0, EMPTY) { // Set this so that we're not identified as a normal menu item. - SetID(kEmptyMenuItemViewID); + set_id(kEmptyMenuItemViewID); SetTitle(UTF16ToWide( l10n_util::GetStringUTF16(IDS_APP_MENU_EMPTY_SUBMENU))); SetEnabled(false); @@ -445,7 +445,7 @@ MenuItemView* MenuItemView::GetMenuItemByID(int id) { return NULL; for (int i = 0; i < GetSubmenu()->child_count(); ++i) { View* child = GetSubmenu()->GetChildViewAt(i); - if (child->GetID() == MenuItemView::kMenuItemViewID) { + if (child->id() == MenuItemView::kMenuItemViewID) { MenuItemView* result = static_cast<MenuItemView*>(child)-> GetMenuItemByID(id); if (result) @@ -561,7 +561,7 @@ void MenuItemView::Init(MenuItemView* parent, submenu_ = NULL; show_mnemonics_ = false; // Assign our ID, this allows SubmenuItemView to find MenuItemViews. - SetID(kMenuItemViewID); + set_id(kMenuItemViewID); has_icons_ = false; // Don't request enabled status from the root menu item as it is just @@ -656,11 +656,11 @@ void MenuItemView::RemoveEmptyMenus() { // view count. for (int i = submenu_->child_count() - 1; i >= 0; --i) { View* child = submenu_->GetChildViewAt(i); - if (child->GetID() == MenuItemView::kMenuItemViewID) { + if (child->id() == MenuItemView::kMenuItemViewID) { MenuItemView* menu_item = static_cast<MenuItemView*>(child); if (menu_item->HasSubmenu()) menu_item->RemoveEmptyMenus(); - } else if (child->GetID() == EmptyMenuMenuItem::kEmptyMenuItemViewID) { + } else if (child->id() == EmptyMenuMenuItem::kEmptyMenuItemViewID) { submenu_->RemoveChildView(child); delete child; child = NULL; @@ -742,7 +742,7 @@ int MenuItemView::GetChildPreferredWidth() { } string16 MenuItemView::GetAcceleratorText() { - if (GetID() == kEmptyMenuItemViewID) { + if (id() == kEmptyMenuItemViewID) { // Don't query the delegate for menus that represent no children. return string16(); } diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc index 57ab1e3..84e4cd1 100644 --- a/views/controls/menu/submenu_view.cc +++ b/views/controls/menu/submenu_view.cc @@ -55,7 +55,7 @@ SubmenuView::~SubmenuView() { int SubmenuView::GetMenuItemCount() { int count = 0; for (int i = 0; i < child_count(); ++i) { - if (GetChildViewAt(i)->GetID() == MenuItemView::kMenuItemViewID) + if (GetChildViewAt(i)->id() == MenuItemView::kMenuItemViewID) count++; } return count; @@ -63,7 +63,7 @@ int SubmenuView::GetMenuItemCount() { MenuItemView* SubmenuView::GetMenuItemAt(int index) { for (int i = 0, count = 0; i < child_count(); ++i) { - if (GetChildViewAt(i)->GetID() == MenuItemView::kMenuItemViewID && + if (GetChildViewAt(i)->id() == MenuItemView::kMenuItemViewID && count++ == index) { return static_cast<MenuItemView*>(GetChildViewAt(i)); } @@ -113,7 +113,7 @@ gfx::Size SubmenuView::GetPreferredSize() { child->GetPreferredSize() : gfx::Size(); max_width = std::max(max_width, child_pref_size.width()); height += child_pref_size.height(); - if (child->GetID() == MenuItemView::kMenuItemViewID) { + if (child->id() == MenuItemView::kMenuItemViewID) { MenuItemView* menu = static_cast<MenuItemView*>(child); max_accelerator_width_ = std::max(max_accelerator_width_, menu->GetAcceleratorTextWidth()); diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index b213240..012c0a9 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -167,12 +167,12 @@ class NativeTextfieldViewsTest : public ViewsTestBase, textfield_view_ = static_cast<NativeTextfieldViews*>(textfield_->native_wrapper()); - textfield_->SetID(1); + textfield_->set_id(1); for (int i = 1; i < count; i++) { Textfield* textfield = new Textfield(style); container->AddChildView(textfield); - textfield->SetID(i + 1); + textfield->set_id(i + 1); } DCHECK(textfield_view_); @@ -490,35 +490,35 @@ TEST_F(NativeTextfieldViewsTest, FocusTraversalTest) { InitTextfields(Textfield::STYLE_DEFAULT, 3); textfield_->RequestFocus(); - EXPECT_EQ(1, GetFocusedView()->GetID()); + EXPECT_EQ(1, GetFocusedView()->id()); widget_->GetFocusManager()->AdvanceFocus(false); - EXPECT_EQ(2, GetFocusedView()->GetID()); + EXPECT_EQ(2, GetFocusedView()->id()); widget_->GetFocusManager()->AdvanceFocus(false); - EXPECT_EQ(3, GetFocusedView()->GetID()); + EXPECT_EQ(3, GetFocusedView()->id()); // Cycle back to the first textfield. widget_->GetFocusManager()->AdvanceFocus(false); - EXPECT_EQ(1, GetFocusedView()->GetID()); + EXPECT_EQ(1, GetFocusedView()->id()); widget_->GetFocusManager()->AdvanceFocus(true); - EXPECT_EQ(3, GetFocusedView()->GetID()); + EXPECT_EQ(3, GetFocusedView()->id()); widget_->GetFocusManager()->AdvanceFocus(true); - EXPECT_EQ(2, GetFocusedView()->GetID()); + EXPECT_EQ(2, GetFocusedView()->id()); widget_->GetFocusManager()->AdvanceFocus(true); - EXPECT_EQ(1, GetFocusedView()->GetID()); + EXPECT_EQ(1, GetFocusedView()->id()); // Cycle back to the last textfield. widget_->GetFocusManager()->AdvanceFocus(true); - EXPECT_EQ(3, GetFocusedView()->GetID()); + EXPECT_EQ(3, GetFocusedView()->id()); // Request focus should still work. textfield_->RequestFocus(); - EXPECT_EQ(1, GetFocusedView()->GetID()); + EXPECT_EQ(1, GetFocusedView()->id()); // Test if clicking on textfield view sets the focus to textfield_. widget_->GetFocusManager()->AdvanceFocus(true); - EXPECT_EQ(3, GetFocusedView()->GetID()); + EXPECT_EQ(3, GetFocusedView()->id()); MouseEvent click(ui::ET_MOUSE_PRESSED, 0, 0, ui::EF_LEFT_BUTTON_DOWN); textfield_view_->OnMousePressed(click); - EXPECT_EQ(1, GetFocusedView()->GetID()); + EXPECT_EQ(1, GetFocusedView()->id()); } void VerifyTextfieldContextMenuContents(bool textfield_has_selection, diff --git a/views/debug_utils.cc b/views/debug_utils.cc index 1a6cda2..b490736 100644 --- a/views/debug_utils.cc +++ b/views/debug_utils.cc @@ -24,7 +24,7 @@ void PrintViewHierarchyImp(const View* view, int indent) { buf << L' '; buf << UTF8ToWide(view->GetClassName()); buf << L' '; - buf << view->GetID(); + buf << view->id(); buf << L' '; buf << view->x() << L"," << view->y() << L","; buf << view->bounds().right() << L"," << view->bounds().bottom(); @@ -45,7 +45,7 @@ void PrintFocusHierarchyImp(const View* view, int indent) { buf << L' '; buf << UTF8ToWide(view->GetClassName()); buf << L' '; - buf << view->GetID(); + buf << view->id(); buf << L' '; buf << view->GetClassName().c_str(); buf << L' '; diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 411b990..151f436 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -464,13 +464,13 @@ void FocusTraversalTest::InitContentView() { content_view_->AddChildView(cb); // In this fast paced world, who really has time for non hard-coded layout? cb->SetBounds(10, 10, 200, 20); - cb->SetID(kTopCheckBoxID); + cb->set_id(kTopCheckBoxID); left_container_ = new PaneView(); left_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); left_container_->set_background( Background::CreateSolidBackground(240, 240, 240)); - left_container_->SetID(kLeftContainerID); + left_container_->set_id(kLeftContainerID); content_view_->AddChildView(left_container_); left_container_->SetBounds(10, 35, 250, 200); @@ -482,12 +482,12 @@ void FocusTraversalTest::InitContentView() { int gap_between_labels = 10; Label* label = new Label(L"Apple:"); - label->SetID(kAppleLabelID); + label->set_id(kAppleLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); Textfield* text_field = new Textfield(); - text_field->SetID(kAppleTextfieldID); + text_field->set_id(kAppleTextfieldID); left_container_->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -495,12 +495,12 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; label = new Label(L"Orange:"); - label->SetID(kOrangeLabelID); + label->set_id(kOrangeLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); text_field = new Textfield(); - text_field->SetID(kOrangeTextfieldID); + text_field->set_id(kOrangeTextfieldID); left_container_->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -508,12 +508,12 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; label = new Label(L"Banana:"); - label->SetID(kBananaLabelID); + label->set_id(kBananaLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); text_field = new Textfield(); - text_field->SetID(kBananaTextfieldID); + text_field->set_id(kBananaTextfieldID); left_container_->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -521,12 +521,12 @@ void FocusTraversalTest::InitContentView() { y += label_height + gap_between_labels; label = new Label(L"Kiwi:"); - label->SetID(kKiwiLabelID); + label->set_id(kKiwiLabelID); left_container_->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); text_field = new Textfield(); - text_field->SetID(kKiwiTextfieldID); + text_field->set_id(kKiwiTextfieldID); left_container_->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -535,26 +535,26 @@ void FocusTraversalTest::InitContentView() { NativeButton* button = new NativeButton(NULL, L"Click me"); button->SetBounds(label_x, y + 10, 80, 30); - button->SetID(kFruitButtonID); + button->set_id(kFruitButtonID); left_container_->AddChildView(button); y += 40; cb = new NativeCheckbox(L"This is another check box"); cb->SetBounds(label_x + label_width + 5, y, 180, 20); - cb->SetID(kFruitCheckBoxID); + cb->set_id(kFruitCheckBoxID); left_container_->AddChildView(cb); y += 20; Combobox* combobox = new Combobox(&combobox_model_); combobox->SetBounds(label_x + label_width + 5, y, 150, 30); - combobox->SetID(kComboboxID); + combobox->set_id(kComboboxID); left_container_->AddChildView(combobox); right_container_ = new PaneView(); right_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); right_container_->set_background( Background::CreateSolidBackground(240, 240, 240)); - right_container_->SetID(kRightContainerID); + right_container_->set_id(kRightContainerID); content_view_->AddChildView(right_container_); right_container_->SetBounds(270, 35, 300, 200); @@ -562,20 +562,20 @@ void FocusTraversalTest::InitContentView() { int radio_button_height = 18; int gap_between_radio_buttons = 10; RadioButton* radio_button = new RadioButton(L"Asparagus", 1); - radio_button->SetID(kAsparagusButtonID); + radio_button->set_id(kAsparagusButtonID); right_container_->AddChildView(radio_button); radio_button->SetBounds(5, y, 70, radio_button_height); radio_button->SetGroup(1); y += radio_button_height + gap_between_radio_buttons; radio_button = new RadioButton(L"Broccoli", 1); - radio_button->SetID(kBroccoliButtonID); + radio_button->set_id(kBroccoliButtonID); right_container_->AddChildView(radio_button); radio_button->SetBounds(5, y, 70, radio_button_height); radio_button->SetGroup(1); RadioButton* radio_button_to_check = radio_button; y += radio_button_height + gap_between_radio_buttons; radio_button = new RadioButton(L"Cauliflower", 1); - radio_button->SetID(kCauliflowerButtonID); + radio_button->set_id(kCauliflowerButtonID); right_container_->AddChildView(radio_button); radio_button->SetBounds(5, y, 70, radio_button_height); radio_button->SetGroup(1); @@ -585,12 +585,12 @@ void FocusTraversalTest::InitContentView() { inner_container->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK)); inner_container->set_background( Background::CreateSolidBackground(230, 230, 230)); - inner_container->SetID(kInnerContainerID); + inner_container->set_id(kInnerContainerID); right_container_->AddChildView(inner_container); inner_container->SetBounds(100, 10, 150, 180); ScrollView* scroll_view = new ScrollView(); - scroll_view->SetID(kScrollViewID); + scroll_view->set_id(kScrollViewID); inner_container->AddChildView(scroll_view); scroll_view->SetBounds(1, 1, 148, 178); @@ -620,7 +620,7 @@ void FocusTraversalTest::InitContentView() { for (size_t i = 0; i < arraysize(kTitles); ++i) { Link* link = new Link(kTitles[i]); link->SetHorizontalAlignment(Label::ALIGN_LEFT); - link->SetID(kIDs[i]); + link->set_id(kIDs[i]); scroll_content->AddChildView(link); link->SetBounds(5, y, 300, 15); y += 15; @@ -629,19 +629,19 @@ void FocusTraversalTest::InitContentView() { y = 250; int width = 60; button = new NativeButton(NULL, L"OK"); - button->SetID(kOKButtonID); + button->set_id(kOKButtonID); button->SetIsDefault(true); content_view_->AddChildView(button); button->SetBounds(150, y, width, 30); button = new NativeButton(NULL, L"Cancel"); - button->SetID(kCancelButtonID); + button->set_id(kCancelButtonID); content_view_->AddChildView(button); button->SetBounds(220, y, width, 30); button = new NativeButton(NULL, L"Help"); - button->SetID(kHelpButtonID); + button->set_id(kHelpButtonID); content_view_->AddChildView(button); button->SetBounds(290, y, width, 30); @@ -653,30 +653,30 @@ void FocusTraversalTest::InitContentView() { cb = new NativeCheckbox(L"Bold"); contents->AddChildView(cb); cb->SetBounds(10, 10, 50, 20); - cb->SetID(kBoldCheckBoxID); + cb->set_id(kBoldCheckBoxID); cb = new NativeCheckbox(L"Italic"); contents->AddChildView(cb); cb->SetBounds(70, 10, 50, 20); - cb->SetID(kItalicCheckBoxID); + cb->set_id(kItalicCheckBoxID); cb = new NativeCheckbox(L"Underlined"); contents->AddChildView(cb); cb->SetBounds(130, 10, 70, 20); - cb->SetID(kUnderlinedCheckBoxID); + cb->set_id(kUnderlinedCheckBoxID); Link* link = new Link(L"Help"); contents->AddChildView(link); link->SetBounds(10, 35, 70, 10); - link->SetID(kStyleHelpLinkID); + link->set_id(kStyleHelpLinkID); text_field = new Textfield(); contents->AddChildView(text_field); text_field->SetBounds(10, 50, 100, 20); - text_field->SetID(kStyleTextEditID); + text_field->set_id(kStyleTextEditID); style_tab_ = new TabbedPane(); - style_tab_->SetID(kStyleContainerID); + style_tab_->set_id(kStyleContainerID); content_view_->AddChildView(style_tab_); style_tab_->SetBounds(10, y, 210, 100); style_tab_->AddTab(L"Style", contents); @@ -688,21 +688,21 @@ void FocusTraversalTest::InitContentView() { text_field = new Textfield(); contents->AddChildView(text_field); text_field->SetBounds(10, 10, 100, 20); - text_field->SetID(kSearchTextfieldID); + text_field->set_id(kSearchTextfieldID); button = new NativeButton(NULL, L"Search"); contents->AddChildView(button); button->SetBounds(112, 5, 60, 30); - button->SetID(kSearchButtonID); + button->set_id(kSearchButtonID); link = new Link(L"Help"); link->SetHorizontalAlignment(Label::ALIGN_LEFT); - link->SetID(kHelpLinkID); + link->set_id(kHelpLinkID); contents->AddChildView(link); link->SetBounds(175, 10, 30, 20); search_border_view_ = new BorderView(contents); - search_border_view_->SetID(kSearchContainerID); + search_border_view_->set_id(kSearchContainerID); content_view_->AddChildView(search_border_view_); search_border_view_->SetBounds(300, y, 240, 50); @@ -712,15 +712,15 @@ void FocusTraversalTest::InitContentView() { contents = new View(); contents->set_focusable(true); contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE)); - contents->SetID(kThumbnailContainerID); + contents->set_id(kThumbnailContainerID); button = new NativeButton(NULL, L"Star"); contents->AddChildView(button); button->SetBounds(5, 5, 50, 30); - button->SetID(kThumbnailStarID); + button->set_id(kThumbnailStarID); button = new NativeButton(NULL, L"SuperStar"); contents->AddChildView(button); button->SetBounds(60, 5, 100, 30); - button->SetID(kThumbnailSuperStarID); + button->set_id(kThumbnailSuperStarID); content_view_->AddChildView(contents); contents->SetBounds(250, y, 200, 50); @@ -753,15 +753,15 @@ class SimpleTestView : public View { SimpleTestView(std::vector<FocusTestEvent>* event_list, int view_id) : event_list_(event_list) { set_focusable(true); - SetID(view_id); + set_id(view_id); } virtual void OnFocus() { - event_list_->push_back(FocusTestEvent(ON_FOCUS, GetID())); + event_list_->push_back(FocusTestEvent(ON_FOCUS, id())); } virtual void OnBlur() { - event_list_->push_back(FocusTestEvent(ON_BLUR, GetID())); + event_list_->push_back(FocusTestEvent(ON_BLUR, id())); } private: @@ -1085,7 +1085,7 @@ TEST_F(FocusTraversalTest, NormalTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } @@ -1097,7 +1097,7 @@ TEST_F(FocusTraversalTest, NormalTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } } @@ -1138,7 +1138,7 @@ TEST_F(FocusTraversalTest, TraversalWithNonEnabledViews) { focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } @@ -1150,7 +1150,7 @@ TEST_F(FocusTraversalTest, TraversalWithNonEnabledViews) { focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } } @@ -1190,7 +1190,7 @@ TEST_F(FocusTraversalTest, TraversalWithInvisibleViews) { focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } @@ -1202,7 +1202,7 @@ TEST_F(FocusTraversalTest, TraversalWithInvisibleViews) { focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kTraversalIDs[j], focused_view->id()); } } } @@ -1228,7 +1228,7 @@ TEST_F(FocusTraversalTest, PaneTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kLeftTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kLeftTraversalIDs[j], focused_view->id()); } } @@ -1240,7 +1240,7 @@ TEST_F(FocusTraversalTest, PaneTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kLeftTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kLeftTraversalIDs[j], focused_view->id()); } } @@ -1267,7 +1267,7 @@ TEST_F(FocusTraversalTest, PaneTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kRightTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kRightTraversalIDs[j], focused_view->id()); } } @@ -1279,7 +1279,7 @@ TEST_F(FocusTraversalTest, PaneTraversal) { View* focused_view = GetFocusManager()->GetFocusedView(); EXPECT_TRUE(focused_view != NULL); if (focused_view) - EXPECT_EQ(kRightTraversalIDs[j], focused_view->GetID()); + EXPECT_EQ(kRightTraversalIDs[j], focused_view->id()); } } diff --git a/views/view.cc b/views/view.cc index 03bd255..2c36cc7 100644 --- a/views/view.cc +++ b/views/view.cc @@ -552,14 +552,6 @@ View* View::GetViewByID(int id) { return const_cast<View*>(const_cast<const View*>(this)->GetViewByID(id)); } -void View::SetID(int id) { - id_ = id; -} - -int View::GetID() const { - return id_; -} - void View::SetGroup(int gid) { // Don't change the group id once it's set. DCHECK(group_ == -1 || group_ == gid); diff --git a/views/view.h b/views/view.h index cc15c5a..27aed3a 100644 --- a/views/view.h +++ b/views/view.h @@ -429,10 +429,10 @@ class View : public AcceleratorTarget { virtual const View* GetViewByID(int id) const; virtual View* GetViewByID(int id); - // Sets and gets the ID for this view. ID should be unique within the subtree - // that you intend to search for it. 0 is the default ID for views. - void SetID(int id); - int GetID() const; + // Gets and sets the ID for this view. ID should be unique within the subtree + // that you intend to search for it. 0 is the default ID for views. + int id() const { return id_; } + void set_id(int id) { id_ = id; } // A group id is used to tag views which are part of the same logical group. // Focus can be moved between views with the same group using the arrow keys. |