Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 79273002: Fixed accessibility issues in bookmark bubble dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fixes Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
13 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 15 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
16 #include "chrome/browser/ui/sync/sync_promo_ui.h" 16 #include "chrome/browser/ui/sync/sync_promo_ui.h"
17 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" 17 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h"
18 #include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h" 18 #include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h"
19 #include "content/public/browser/user_metrics.h" 19 #include "content/public/browser/user_metrics.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "ui/base/accessibility/accessible_view_state.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/events/keycodes/keyboard_codes.h" 25 #include "ui/events/keycodes/keyboard_codes.h"
25 #include "ui/views/bubble/bubble_frame_view.h" 26 #include "ui/views/bubble/bubble_frame_view.h"
26 #include "ui/views/controls/button/label_button.h" 27 #include "ui/views/controls/button/label_button.h"
27 #include "ui/views/controls/combobox/combobox.h" 28 #include "ui/views/controls/combobox/combobox.h"
28 #include "ui/views/controls/label.h" 29 #include "ui/views/controls/label.h"
29 #include "ui/views/controls/link.h" 30 #include "ui/views/controls/link.h"
30 #include "ui/views/controls/textfield/textfield.h" 31 #include "ui/views/controls/textfield/textfield.h"
31 #include "ui/views/layout/grid_layout.h" 32 #include "ui/views/layout/grid_layout.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 close_button_ = new views::LabelButton( 147 close_button_ = new views::LabelButton(
147 this, l10n_util::GetStringUTF16(IDS_DONE)); 148 this, l10n_util::GetStringUTF16(IDS_DONE));
148 close_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); 149 close_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
149 close_button_->SetIsDefault(true); 150 close_button_->SetIsDefault(true);
150 151
151 views::Label* combobox_label = new views::Label( 152 views::Label* combobox_label = new views::Label(
152 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT)); 153 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT));
153 154
154 parent_combobox_ = new views::Combobox(&parent_model_); 155 parent_combobox_ = new views::Combobox(&parent_model_);
155 parent_combobox_->set_listener(this); 156 parent_combobox_->set_listener(this);
156 parent_combobox_->SetAccessibleName(combobox_label->text()); 157 parent_combobox_->SetAccessibleName(
158 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_FOLDER_TEXT));
157 159
158 GridLayout* layout = new GridLayout(this); 160 GridLayout* layout = new GridLayout(this);
159 SetLayoutManager(layout); 161 SetLayoutManager(layout);
160 162
161 // Column sets used in the layout of the bubble. 163 // Column sets used in the layout of the bubble.
162 enum ColumnSetID { 164 enum ColumnSetID {
163 TITLE_COLUMN_SET_ID, 165 TITLE_COLUMN_SET_ID,
164 CONTENT_COLUMN_SET_ID, 166 CONTENT_COLUMN_SET_ID,
165 SYNC_PROMO_COLUMN_SET_ID 167 SYNC_PROMO_COLUMN_SET_ID
166 }; 168 };
(...skipping 25 matching lines...) Expand all
192 layout->StartRow(0, TITLE_COLUMN_SET_ID); 194 layout->StartRow(0, TITLE_COLUMN_SET_ID);
193 layout->AddView(title_label); 195 layout->AddView(title_label);
194 layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing); 196 layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing);
195 197
196 layout->StartRow(0, CONTENT_COLUMN_SET_ID); 198 layout->StartRow(0, CONTENT_COLUMN_SET_ID);
197 views::Label* label = new views::Label( 199 views::Label* label = new views::Label(
198 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)); 200 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT));
199 layout->AddView(label); 201 layout->AddView(label);
200 title_tf_ = new views::Textfield(); 202 title_tf_ = new views::Textfield();
201 title_tf_->SetText(GetTitle()); 203 title_tf_->SetText(GetTitle());
204 title_tf_->SetAccessibleName(
205 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT));
206
202 layout->AddView(title_tf_, 5, 1); 207 layout->AddView(title_tf_, 5, 1);
203 208
204 layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing); 209 layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing);
205 210
206 layout->StartRow(0, CONTENT_COLUMN_SET_ID); 211 layout->StartRow(0, CONTENT_COLUMN_SET_ID);
207 layout->AddView(combobox_label); 212 layout->AddView(combobox_label);
208 layout->AddView(parent_combobox_, 5, 1); 213 layout->AddView(parent_combobox_, 5, 1);
209 214
210 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 215 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
211 216
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 NOTREACHED(); 287 NOTREACHED();
283 return string16(); 288 return string16();
284 } 289 }
285 290
286 gfx::Size BookmarkBubbleView::GetMinimumSize() { 291 gfx::Size BookmarkBubbleView::GetMinimumSize() {
287 gfx::Size size(views::BubbleDelegateView::GetPreferredSize()); 292 gfx::Size size(views::BubbleDelegateView::GetPreferredSize());
288 size.SetToMax(gfx::Size(kMinBubbleWidth, 0)); 293 size.SetToMax(gfx::Size(kMinBubbleWidth, 0));
289 return size; 294 return size;
290 } 295 }
291 296
297 void BookmarkBubbleView::GetAccessibleState(ui::AccessibleViewState* state) {
298 BubbleDelegateView::GetAccessibleState(state);
299 state->name =
300 l10n_util::GetStringUTF16(
301 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED :
302 IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK);
303 }
304
292 void BookmarkBubbleView::ButtonPressed(views::Button* sender, 305 void BookmarkBubbleView::ButtonPressed(views::Button* sender,
293 const ui::Event& event) { 306 const ui::Event& event) {
294 HandleButtonPressed(sender); 307 HandleButtonPressed(sender);
295 } 308 }
296 309
297 void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) { 310 void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) {
298 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { 311 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) {
299 content::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox")); 312 content::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox"));
300 ShowEditor(); 313 ShowEditor();
301 } 314 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (node) { 355 if (node) {
343 const string16 new_title = title_tf_->text(); 356 const string16 new_title = title_tf_->text();
344 if (new_title != node->GetTitle()) { 357 if (new_title != node->GetTitle()) {
345 model->SetTitle(node, new_title); 358 model->SetTitle(node, new_title);
346 content::RecordAction( 359 content::RecordAction(
347 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 360 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
348 } 361 }
349 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); 362 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index());
350 } 363 }
351 } 364 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_editor_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698