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

Side by Side Diff: chrome/browser/ui/app_list/search/omnibox_result.cc

Issue 2399333002: Revert of Delete pre-MD code from OmniboxResultView (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 "chrome/grit/theme_resources.h"
15 #include "components/bookmarks/browser/bookmark_model.h" 16 #include "components/bookmarks/browser/bookmark_model.h"
16 #include "components/omnibox/browser/autocomplete_controller.h" 17 #include "components/omnibox/browser/autocomplete_controller.h"
17 #include "components/omnibox/browser/autocomplete_match_type.h" 18 #include "components/omnibox/browser/autocomplete_match_type.h"
18 #include "ui/app_list/app_list_constants.h" 19 #include "ui/app_list/app_list_constants.h"
20 #include "ui/base/material_design/material_design_controller.h"
21 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/paint_vector_icon.h" 22 #include "ui/gfx/paint_vector_icon.h"
20 #include "ui/gfx/vector_icons_public.h" 23 #include "ui/gfx/vector_icons_public.h"
21 #include "url/gurl.h" 24 #include "url/gurl.h"
22 #include "url/url_canon.h" 25 #include "url/url_canon.h"
23 26
24 using bookmarks::BookmarkModel; 27 using bookmarks::BookmarkModel;
25 28
26 namespace app_list { 29 namespace app_list {
27 30
28 namespace { 31 namespace {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 new OmniboxResult(profile_, list_controller_, autocomplete_controller_, 164 new OmniboxResult(profile_, list_controller_, autocomplete_controller_,
162 is_voice_query_, match_)); 165 is_voice_query_, match_));
163 } 166 }
164 167
165 void OmniboxResult::UpdateIcon() { 168 void OmniboxResult::UpdateIcon() {
166 BookmarkModel* bookmark_model = 169 BookmarkModel* bookmark_model =
167 BookmarkModelFactory::GetForBrowserContext(profile_); 170 BookmarkModelFactory::GetForBrowserContext(profile_);
168 bool is_bookmarked = 171 bool is_bookmarked =
169 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); 172 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url);
170 173
171 gfx::VectorIconId icon_id = is_bookmarked ? 174 if (ui::MaterialDesignController::IsModeMaterial()) {
172 gfx::VectorIconId::OMNIBOX_STAR : 175 gfx::VectorIconId icon_id = is_bookmarked ?
173 AutocompleteMatch::TypeToVectorIcon(match_.type); 176 gfx::VectorIconId::OMNIBOX_STAR :
174 SetIcon(gfx::CreateVectorIcon(icon_id, 16, app_list::kIconColor)); 177 AutocompleteMatch::TypeToVectorIcon(match_.type);
178 SetIcon(gfx::CreateVectorIcon(icon_id, 16, app_list::kIconColor));
179 return;
180 }
181
182 int resource_id = is_bookmarked ? IDR_OMNIBOX_STAR
183 : AutocompleteMatch::TypeToIcon(match_.type);
184 SetIcon(
185 *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id));
175 } 186 }
176 187
177 void OmniboxResult::UpdateTitleAndDetails() { 188 void OmniboxResult::UpdateTitleAndDetails() {
178 set_title(match_.contents); 189 set_title(match_.contents);
179 SearchResult::Tags title_tags; 190 SearchResult::Tags title_tags;
180 ACMatchClassificationsToTags(match_.contents, match_.contents_class, 191 ACMatchClassificationsToTags(match_.contents, match_.contents_class,
181 &title_tags); 192 &title_tags);
182 set_title_tags(title_tags); 193 set_title_tags(title_tags);
183 194
184 set_details(match_.description); 195 set_details(match_.description);
185 SearchResult::Tags details_tags; 196 SearchResult::Tags details_tags;
186 ACMatchClassificationsToTags(match_.description, match_.description_class, 197 ACMatchClassificationsToTags(match_.description, match_.description_class,
187 &details_tags); 198 &details_tags);
188 set_details_tags(details_tags); 199 set_details_tags(details_tags);
189 } 200 }
190 201
191 } // namespace app_list 202 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698