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() {
// highlighted "+" sign between the bubble views and the rest of the
// text.
if (!item.shortcut_key_codes.empty())
item.shortcut_key_codes.emplace_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.emplace_back(
GetKeyCodeForModifier(modifier));
item.shortcut_key_codes.push_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.push_back(GetKeyCodeForModifier(modifier));
}
}
// For non grouped accelerators, we need to populate the key as well.
if (item.accelerator_ids.size() == 1) {
if (!item.shortcut_key_codes.empty())
item.shortcut_key_codes.emplace_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.emplace_back(accelerator_id.keycode);
item.shortcut_key_codes.push_back(ui::VKEY_UNKNOWN);
item.shortcut_key_codes.push_back(accelerator_id.keycode);
}
}
}
......
......@@ -91,11 +91,11 @@ KeyboardShortcutItemView::KeyboardShortcutItemView(
has_invalid_dom_key = true;
break;
}
replacement_strings.emplace_back(dom_key_string);
replacement_strings.push_back(dom_key_string);
base::string16 accessible_name = GetAccessibleNameForKeyboardCode(key_code);
accessible_names.emplace_back(accessible_name.empty() ? dom_key_string
: accessible_name);
accessible_names.push_back(accessible_name.empty() ? dom_key_string
: accessible_name);
}
base::string16 shortcut_string;
......
......@@ -383,7 +383,7 @@ void KeyboardShortcutView::InitViews() {
continue;
for (auto category : item.categories) {
shortcut_views_.emplace_back(
shortcut_views_.push_back(
std::make_unique<KeyboardShortcutItemView>(item, category));
shortcut_views_.back()->set_owned_by_client();
}
......@@ -472,7 +472,7 @@ void KeyboardShortcutView::InitCategoriesTabbedPane(
// Clear any styles used to highlight matched search query in search mode.
description_label_view->ClearStyleRanges();
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.
description_label_view->InvalidateLayout();
}
......@@ -557,7 +557,7 @@ void KeyboardShortcutView::ShowSearchResults(
}
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(
const int number_search_results = found_shortcut_items_.size();
if (!found_items_list_view->children().empty()) {
UpdateAXNodeDataPosition(found_shortcut_items_);
replacement_strings.emplace_back(
replacement_strings.push_back(
base::NumberToString16(number_search_results));
// To offset the padding between the bottom of the |search_box_view_| and
......@@ -577,7 +577,7 @@ void KeyboardShortcutView::ShowSearchResults(
search_container_content_view =
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(
number_search_results == 0
? 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