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

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

Issue 415053002: Remove AutocompleteMatch::is_starred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_provider.h" 5 #include "chrome/browser/ui/app_list/search/omnibox_provider.h"
6 6
7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
8 #include "chrome/browser/autocomplete/autocomplete_controller.h" 8 #include "chrome/browser/autocomplete/autocomplete_controller.h"
9 #include "chrome/browser/autocomplete/autocomplete_match.h" 9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 10 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
11 #include "chrome/browser/autocomplete/search_provider.h" 11 #include "chrome/browser/autocomplete/search_provider.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
12 #include "chrome/browser/search_engines/template_url_service_factory.h" 13 #include "chrome/browser/search_engines/template_url_service_factory.h"
13 #include "chrome/browser/ui/app_list/search/chrome_search_result.h" 14 #include "chrome/browser/ui/app_list/search/chrome_search_result.h"
14 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
15 #include "components/autocomplete/autocomplete_input.h" 16 #include "components/autocomplete/autocomplete_input.h"
17 #include "components/bookmarks/browser/bookmark_model.h"
16 #include "components/metrics/proto/omnibox_event.pb.h" 18 #include "components/metrics/proto/omnibox_event.pb.h"
17 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
18 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
19 21
20 namespace app_list { 22 namespace app_list {
21 23
22 namespace { 24 namespace {
23 25
24 int ACMatchStyleToTagStyle(int styles) { 26 int ACMatchStyleToTagStyle(int styles) {
25 int tag_styles = 0; 27 int tag_styles = 0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return scoped_ptr<ChromeSearchResult>( 98 return scoped_ptr<ChromeSearchResult>(
97 new OmniboxResult(profile_, match_)).Pass(); 99 new OmniboxResult(profile_, match_)).Pass();
98 } 100 }
99 101
100 virtual ChromeSearchResultType GetType() OVERRIDE { 102 virtual ChromeSearchResultType GetType() OVERRIDE {
101 return OMNIBOX_SEARCH_RESULT; 103 return OMNIBOX_SEARCH_RESULT;
102 } 104 }
103 105
104 private: 106 private:
105 void UpdateIcon() { 107 void UpdateIcon() {
106 int resource_id = match_.starred ? 108 BookmarkModel* bookmark_model =
109 BookmarkModelFactory::GetForProfile(profile_);
110 bool is_bookmarked =
111 bookmark_model && bookmark_model->IsBookmarked(match_.destination_url);
112 int resource_id = is_bookmarked ?
107 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match_.type); 113 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match_.type);
108 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 114 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
109 resource_id)); 115 resource_id));
110 } 116 }
111 117
112 void UpdateTitleAndDetails() { 118 void UpdateTitleAndDetails() {
113 set_title(match_.contents); 119 set_title(match_.contents);
114 SearchResult::Tags title_tags; 120 SearchResult::Tags title_tags;
115 ACMatchClassificationsToTags(match_.contents, 121 ACMatchClassificationsToTags(match_.contents,
116 match_.contents_class, 122 match_.contents_class,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 Add(scoped_ptr<SearchResult>(new OmniboxResult(profile_, *it))); 174 Add(scoped_ptr<SearchResult>(new OmniboxResult(profile_, *it)));
169 } 175 }
170 } 176 }
171 177
172 void OmniboxProvider::OnResultChanged(bool default_match_changed) { 178 void OmniboxProvider::OnResultChanged(bool default_match_changed) {
173 const AutocompleteResult& result = controller_->result(); 179 const AutocompleteResult& result = controller_->result();
174 PopulateFromACResult(result); 180 PopulateFromACResult(result);
175 } 181 }
176 182
177 } // namespace app_list 183 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698