Chromium Code Reviews| Index: chrome/browser/views/bookmark_bar_view.cc |
| =================================================================== |
| --- chrome/browser/views/bookmark_bar_view.cc (revision 20591) |
| +++ chrome/browser/views/bookmark_bar_view.cc (working copy) |
| @@ -341,7 +341,29 @@ |
| return gfx::Size(kSeparatorWidth, 1); |
| } |
| + virtual bool GetAccessibleName(std::wstring* name) { |
|
jcampan
2009/07/14 16:44:24
Nit: DCHECK(name)
|
| + if (!accessible_name_.empty()) { |
| + (*name).assign(accessible_name_); |
|
jcampan
2009/07/14 16:44:24
Nit: name-> instead of (*name).
|
| + return true; |
| + } |
| + return false; |
| + } |
| + |
| + virtual bool GetAccessibleRole(AccessibilityTypes::Role* role) { |
| + DCHECK(role); |
| + |
| + *role = AccessibilityTypes::ROLE_SEPARATOR; |
| + return true; |
| + } |
| + |
| + virtual void SetAccessibleName(const std::wstring& name) { |
| + accessible_name_.assign(name); |
| + } |
| + |
| private: |
| + // Storage of strings needed for accessibility. |
| + std::wstring accessible_name_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ButtonSeparatorView); |
| }; |
| @@ -802,9 +824,29 @@ |
| } else { |
| parent_node = root; |
| } |
| - return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node, index); |
| + return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node, |
| + index); |
| } |
| +bool BookmarkBarView::GetAccessibleName(std::wstring* name) { |
| + if (!accessible_name_.empty()) { |
| + (*name).assign(accessible_name_); |
|
jcampan
2009/07/14 16:44:24
Same nits as above: CHECK(name) and name->
|
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +bool BookmarkBarView::GetAccessibleRole(AccessibilityTypes::Role* role) { |
| + DCHECK(role); |
| + |
| + *role = AccessibilityTypes::ROLE_TOOLBAR; |
| + return true; |
| +} |
| + |
| +void BookmarkBarView::SetAccessibleName(const std::wstring& name) { |
| + accessible_name_.assign(name); |
| +} |
| + |
| void BookmarkBarView::OnFullscreenToggled(bool fullscreen) { |
| if (!fullscreen) |
| size_animation_->Reset(IsAlwaysShown() ? 1 : 0); |
| @@ -879,6 +921,8 @@ |
| AddChildView(overflow_button_); |
| bookmarks_separator_view_ = new ButtonSeparatorView(); |
| + bookmarks_separator_view_->SetAccessibleName( |
| + l10n_util::GetString(IDS_ACCNAME_SEPARATOR)); |
| AddChildView(bookmarks_separator_view_); |
| instructions_ = new views::Label( |
| @@ -899,6 +943,8 @@ |
| button->SetIcon(GetGroupIcon()); |
| button->SetContextMenuController(this); |
| button->set_tag(kOtherFolderButtonTag); |
| + button->SetAccessibleName( |
| + l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)); |
| return button; |
| } |
| @@ -918,6 +964,9 @@ |
| // Make visible as necessary. |
| button->SetVisible(false); |
| + // Set accessibility name. |
| + button->SetAccessibleName( |
| + l10n_util::GetString(IDS_ACCNAME_BOOKMARKS_CHEVRON)); |
| return button; |
| } |
| @@ -1263,6 +1312,7 @@ |
| void BookmarkBarView::ConfigureButton(const BookmarkNode* node, |
| views::TextButton* button) { |
| button->SetText(node->GetTitle()); |
| + button->SetAccessibleName(node->GetTitle()); |
| // We don't always have a theme provider (ui tests, for example). |
| if (GetThemeProvider()) { |
| @@ -1512,7 +1562,7 @@ |
| *is_over_other ? model_->other_node() : |
| model_->GetBookmarkBarNode()->GetChild(*index); |
| int operation = |
| - bookmark_utils::BookmarkDropOperation(profile_,event, data, parent, |
| + bookmark_utils::BookmarkDropOperation(profile_, event, data, parent, |
| parent->GetChildCount()); |
| if (!operation && !data.has_single_url() && |
| data.GetFirstNode(profile_) == parent) { |