Commit 42940a08 authored by Zentaro Kavanagh's avatar Zentaro Kavanagh Committed by Commit Bot

Shortcut Viewer: Use push_back vs emplace_back

Use push_back where equivalent - see https://abseil.io/tips/112

Bug: None
Change-Id: I98e6180eb7ec7eb3823ea2d1ad9deb47dcc31ab5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368317Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Zentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800716}
parent 40fbc5e6
...@@ -1448,16 +1448,15 @@ const std::vector<KeyboardShortcutItem>& GetKeyboardShortcutItemList() { ...@@ -1448,16 +1448,15 @@ const std::vector<KeyboardShortcutItem>& GetKeyboardShortcutItemList() {
// highlighted "+" sign between the bubble views and the rest of the // highlighted "+" sign between the bubble views and the rest of the
// text. // text.
if (!item.shortcut_key_codes.empty()) if (!item.shortcut_key_codes.empty())
item.shortcut_key_codes.emplace_back(ui::VKEY_UNKNOWN); item.shortcut_key_codes.push_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.emplace_back( item.shortcut_key_codes.push_back(GetKeyCodeForModifier(modifier));
GetKeyCodeForModifier(modifier));
} }
} }
// For non grouped accelerators, we need to populate the key as well. // For non grouped accelerators, we need to populate the key as well.
if (item.accelerator_ids.size() == 1) { if (item.accelerator_ids.size() == 1) {
if (!item.shortcut_key_codes.empty()) if (!item.shortcut_key_codes.empty())
item.shortcut_key_codes.emplace_back(ui::VKEY_UNKNOWN); item.shortcut_key_codes.push_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.emplace_back(accelerator_id.keycode); item.shortcut_key_codes.push_back(accelerator_id.keycode);
} }
} }
} }
......
...@@ -91,11 +91,11 @@ KeyboardShortcutItemView::KeyboardShortcutItemView( ...@@ -91,11 +91,11 @@ KeyboardShortcutItemView::KeyboardShortcutItemView(
has_invalid_dom_key = true; has_invalid_dom_key = true;
break; break;
} }
replacement_strings.emplace_back(dom_key_string); replacement_strings.push_back(dom_key_string);
base::string16 accessible_name = GetAccessibleNameForKeyboardCode(key_code); base::string16 accessible_name = GetAccessibleNameForKeyboardCode(key_code);
accessible_names.emplace_back(accessible_name.empty() ? dom_key_string accessible_names.push_back(accessible_name.empty() ? dom_key_string
: accessible_name); : accessible_name);
} }
base::string16 shortcut_string; base::string16 shortcut_string;
......
...@@ -383,7 +383,7 @@ void KeyboardShortcutView::InitViews() { ...@@ -383,7 +383,7 @@ void KeyboardShortcutView::InitViews() {
continue; continue;
for (auto category : item.categories) { for (auto category : item.categories) {
shortcut_views_.emplace_back( shortcut_views_.push_back(
std::make_unique<KeyboardShortcutItemView>(item, category)); std::make_unique<KeyboardShortcutItemView>(item, category));
shortcut_views_.back()->set_owned_by_client(); shortcut_views_.back()->set_owned_by_client();
} }
...@@ -472,7 +472,7 @@ void KeyboardShortcutView::InitCategoriesTabbedPane( ...@@ -472,7 +472,7 @@ void KeyboardShortcutView::InitCategoriesTabbedPane(
// Clear any styles used to highlight matched search query in search mode. // Clear any styles used to highlight matched search query in search mode.
description_label_view->ClearStyleRanges(); description_label_view->ClearStyleRanges();
item_list_view->AddChildView(item_view.get()); item_list_view->AddChildView(item_view.get());
shortcut_items.emplace_back(item_view.get()); shortcut_items.push_back(item_view.get());
// Remove the search query highlight. // Remove the search query highlight.
description_label_view->InvalidateLayout(); description_label_view->InvalidateLayout();
} }
...@@ -557,7 +557,7 @@ void KeyboardShortcutView::ShowSearchResults( ...@@ -557,7 +557,7 @@ void KeyboardShortcutView::ShowSearchResults(
} }
found_items_list_view->AddChildView(item_view.get()); found_items_list_view->AddChildView(item_view.get());
found_shortcut_items_.emplace_back(item_view.get()); found_shortcut_items_.push_back(item_view.get());
} }
} }
...@@ -565,7 +565,7 @@ void KeyboardShortcutView::ShowSearchResults( ...@@ -565,7 +565,7 @@ void KeyboardShortcutView::ShowSearchResults(
const int number_search_results = found_shortcut_items_.size(); const int number_search_results = found_shortcut_items_.size();
if (!found_items_list_view->children().empty()) { if (!found_items_list_view->children().empty()) {
UpdateAXNodeDataPosition(found_shortcut_items_); UpdateAXNodeDataPosition(found_shortcut_items_);
replacement_strings.emplace_back( replacement_strings.push_back(
base::NumberToString16(number_search_results)); base::NumberToString16(number_search_results));
// To offset the padding between the bottom of the |search_box_view_| and // To offset the padding between the bottom of the |search_box_view_| and
...@@ -577,7 +577,7 @@ void KeyboardShortcutView::ShowSearchResults( ...@@ -577,7 +577,7 @@ void KeyboardShortcutView::ShowSearchResults(
search_container_content_view = search_container_content_view =
CreateScrollView(std::move(found_items_list_view)).release(); CreateScrollView(std::move(found_items_list_view)).release();
} }
replacement_strings.emplace_back(search_query); replacement_strings.push_back(search_query);
search_box_view_->SetAccessibleValue(l10n_util::GetStringFUTF16( search_box_view_->SetAccessibleValue(l10n_util::GetStringFUTF16(
number_search_results == 0 number_search_results == 0
? IDS_KSV_SEARCH_BOX_ACCESSIBILITY_VALUE_WITHOUT_RESULTS ? IDS_KSV_SEARCH_BOX_ACCESSIBILITY_VALUE_WITHOUT_RESULTS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment