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

Unified Diff: chrome/browser/extensions/api/omnibox/omnibox_api.cc

Issue 1833773002: [Extensions] Convert APIs to use movable types [8] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/omnibox/omnibox_api.cc
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index a2eeb58c125449652f037feb8ce1196853554724..2349156d11cc65d5acc618b92ef281128ab28dd1 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -320,20 +320,16 @@ ACMatchClassifications StyleTypesToACMatchClassifications(
base::string16 description = base::UTF8ToUTF16(suggestion.description);
std::vector<int> styles(description.length(), 0);
- for (std::vector<linked_ptr<omnibox::SuggestResult::DescriptionStylesType> >
- ::iterator i = suggestion.description_styles->begin();
- i != suggestion.description_styles->end(); ++i) {
- omnibox::SuggestResult::DescriptionStylesType* style = i->get();
-
- int length = description.length();
- if (style->length)
- length = *style->length;
-
- size_t offset = style->offset >= 0 ? style->offset :
- std::max(0, static_cast<int>(description.length()) + style->offset);
+ for (const omnibox::SuggestResult::DescriptionStylesType& style :
+ *suggestion.description_styles) {
+ int length = style.length ? *style.length : description.length();
+ size_t offset = style.offset >= 0
+ ? style.offset
+ : std::max(0, static_cast<int>(description.length()) +
+ style.offset);
int type_class;
- switch (style->type) {
+ switch (style.type) {
case omnibox::DESCRIPTION_STYLE_TYPE_URL:
type_class = AutocompleteMatch::ACMatchClassification::URL;
break;

Powered by Google App Engine
This is Rietveld 408576698