| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_list/search/omnibox_result.h" | 5 #include "chrome/browser/ui/app_list/search/omnibox_result.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 13 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 14 #include "chrome/browser/ui/app_list/search/search_util.h" | 14 #include "chrome/browser/ui/app_list/search/search_util.h" |
| 15 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
| 16 #include "components/omnibox/browser/autocomplete_controller.h" | 16 #include "components/omnibox/browser/autocomplete_controller.h" |
| 17 #include "components/omnibox/browser/autocomplete_match_type.h" | 17 #include "components/omnibox/browser/autocomplete_match_type.h" |
| 18 #include "components/omnibox/browser/vector_icons.h" |
| 18 #include "ui/app_list/app_list_constants.h" | 19 #include "ui/app_list/app_list_constants.h" |
| 19 #include "ui/gfx/paint_vector_icon.h" | 20 #include "ui/gfx/paint_vector_icon.h" |
| 20 #include "ui/gfx/vector_icons_public.h" | |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 #include "url/url_canon.h" | 22 #include "url/url_canon.h" |
| 23 | 23 |
| 24 using bookmarks::BookmarkModel; | 24 using bookmarks::BookmarkModel; |
| 25 | 25 |
| 26 namespace app_list { | 26 namespace app_list { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 int ACMatchStyleToTagStyle(int styles) { | 30 int ACMatchStyleToTagStyle(int styles) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 new OmniboxResult(profile_, list_controller_, autocomplete_controller_, | 161 new OmniboxResult(profile_, list_controller_, autocomplete_controller_, |
| 162 is_voice_query_, match_)); | 162 is_voice_query_, match_)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void OmniboxResult::UpdateIcon() { | 165 void OmniboxResult::UpdateIcon() { |
| 166 BookmarkModel* bookmark_model = | 166 BookmarkModel* bookmark_model = |
| 167 BookmarkModelFactory::GetForBrowserContext(profile_); | 167 BookmarkModelFactory::GetForBrowserContext(profile_); |
| 168 bool is_bookmarked = | 168 bool is_bookmarked = |
| 169 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); | 169 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); |
| 170 | 170 |
| 171 gfx::VectorIconId icon_id = is_bookmarked ? | 171 const gfx::VectorIcon& icon = |
| 172 gfx::VectorIconId::OMNIBOX_STAR : | 172 is_bookmarked ? omnibox::kStarIcon |
| 173 AutocompleteMatch::TypeToVectorIcon(match_.type); | 173 : AutocompleteMatch::TypeToVectorIcon(match_.type); |
| 174 SetIcon(gfx::CreateVectorIcon(icon_id, 16, app_list::kIconColor)); | 174 SetIcon(gfx::CreateVectorIcon(icon, 16, app_list::kIconColor)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void OmniboxResult::UpdateTitleAndDetails() { | 177 void OmniboxResult::UpdateTitleAndDetails() { |
| 178 set_title(match_.contents); | 178 set_title(match_.contents); |
| 179 SearchResult::Tags title_tags; | 179 SearchResult::Tags title_tags; |
| 180 ACMatchClassificationsToTags(match_.contents, match_.contents_class, | 180 ACMatchClassificationsToTags(match_.contents, match_.contents_class, |
| 181 &title_tags); | 181 &title_tags); |
| 182 set_title_tags(title_tags); | 182 set_title_tags(title_tags); |
| 183 | 183 |
| 184 set_details(match_.description); | 184 set_details(match_.description); |
| 185 SearchResult::Tags details_tags; | 185 SearchResult::Tags details_tags; |
| 186 ACMatchClassificationsToTags(match_.description, match_.description_class, | 186 ACMatchClassificationsToTags(match_.description, match_.description_class, |
| 187 &details_tags); | 187 &details_tags); |
| 188 set_details_tags(details_tags); | 188 set_details_tags(details_tags); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace app_list | 191 } // namespace app_list |
| OLD | NEW |