| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" |
| 18 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
| 19 #include "chrome/browser/ui/browser_dialogs.h" | 19 #include "chrome/browser/ui/browser_dialogs.h" |
| 20 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 20 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| 21 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" | 21 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" |
| 22 #include "chrome/grit/chromium_strings.h" | 22 #include "chrome/grit/chromium_strings.h" |
| 23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 24 #include "components/bookmarks/browser/bookmark_model.h" | 24 #include "components/bookmarks/browser/bookmark_model.h" |
| 25 #include "components/bookmarks/browser/bookmark_utils.h" | 25 #include "components/bookmarks/browser/bookmark_utils.h" |
| 26 #include "components/strings/grit/components_strings.h" | 26 #include "components/strings/grit/components_strings.h" |
| 27 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
| 28 #include "ui/accessibility/ax_view_state.h" | 28 #include "ui/accessibility/ax_node_data.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/events/keycodes/keyboard_codes.h" | 30 #include "ui/events/keycodes/keyboard_codes.h" |
| 31 #include "ui/views/bubble/bubble_frame_view.h" | 31 #include "ui/views/bubble/bubble_frame_view.h" |
| 32 #include "ui/views/controls/button/md_text_button.h" | 32 #include "ui/views/controls/button/md_text_button.h" |
| 33 #include "ui/views/controls/combobox/combobox.h" | 33 #include "ui/views/controls/combobox/combobox.h" |
| 34 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 35 #include "ui/views/controls/link.h" | 35 #include "ui/views/controls/link.h" |
| 36 #include "ui/views/controls/textfield/textfield.h" | 36 #include "ui/views/controls/textfield/textfield.h" |
| 37 #include "ui/views/layout/grid_layout.h" | 37 #include "ui/views/layout/grid_layout.h" |
| 38 #include "ui/views/layout/layout_constants.h" | 38 #include "ui/views/layout/layout_constants.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 BookmarkModelFactory::GetForBrowserContext(profile_); | 275 BookmarkModelFactory::GetForBrowserContext(profile_); |
| 276 const BookmarkNode* node = | 276 const BookmarkNode* node = |
| 277 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_); | 277 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_); |
| 278 if (node) | 278 if (node) |
| 279 return node->GetTitle(); | 279 return node->GetTitle(); |
| 280 else | 280 else |
| 281 NOTREACHED(); | 281 NOTREACHED(); |
| 282 return base::string16(); | 282 return base::string16(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void BookmarkBubbleView::GetAccessibleState(ui::AXViewState* state) { | 285 void BookmarkBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 286 LocationBarBubbleDelegateView::GetAccessibleState(state); | 286 LocationBarBubbleDelegateView::GetAccessibleNodeData(node_data); |
| 287 state->name = | 287 node_data->SetName(l10n_util::GetStringUTF8( |
| 288 l10n_util::GetStringUTF16( | 288 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED |
| 289 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : | 289 : IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK)); |
| 290 IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK); | |
| 291 } | 290 } |
| 292 | 291 |
| 293 void BookmarkBubbleView::ButtonPressed(views::Button* sender, | 292 void BookmarkBubbleView::ButtonPressed(views::Button* sender, |
| 294 const ui::Event& event) { | 293 const ui::Event& event) { |
| 295 HandleButtonPressed(sender); | 294 HandleButtonPressed(sender); |
| 296 } | 295 } |
| 297 | 296 |
| 298 void BookmarkBubbleView::OnPerformAction(views::Combobox* combobox) { | 297 void BookmarkBubbleView::OnPerformAction(views::Combobox* combobox) { |
| 299 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { | 298 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { |
| 300 content::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox")); | 299 content::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox")); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (node) { | 345 if (node) { |
| 347 const base::string16 new_title = title_tf_->text(); | 346 const base::string16 new_title = title_tf_->text(); |
| 348 if (new_title != node->GetTitle()) { | 347 if (new_title != node->GetTitle()) { |
| 349 model->SetTitle(node, new_title); | 348 model->SetTitle(node, new_title); |
| 350 content::RecordAction( | 349 content::RecordAction( |
| 351 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); | 350 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); |
| 352 } | 351 } |
| 353 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); | 352 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); |
| 354 } | 353 } |
| 355 } | 354 } |
| OLD | NEW |