Chromium Code Reviews| Index: chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc |
| diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc |
| index f74297f4a21021439ced590b8661d398112d500f..78bfc5bb8f20b0e6f60fdaaa9c279f4ebf8d8988 100644 |
| --- a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc |
| +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc |
| @@ -18,10 +18,12 @@ |
| #include "chrome/browser/autocomplete/autocomplete_match.h" |
| #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| +#include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| #include "chrome/browser/history/history_service.h" |
| #include "chrome/browser/history/history_service_factory.h" |
| #include "chrome/browser/search/search.h" |
| #include "chrome/browser/search_engines/template_url_service_factory.h" |
| +#include "components/bookmarks/browser/bookmark_model.h" |
| #include "components/history/core/browser/url_database.h" |
| #include "components/metrics/proto/omnibox_event.pb.h" |
| #include "components/search_engines/template_url.h" |
| @@ -82,7 +84,6 @@ class TypeConverter<AutocompleteMatchMojoPtr, AutocompleteMatch> { |
| mojo::String::From(input.associated_keyword->keyword); |
| } |
| result->keyword = mojo::String::From(input.keyword); |
| - result->starred = input.starred; |
| result->duplicates = static_cast<int32>(input.duplicate_matches.size()); |
| result->from_previous = input.from_previous; |
| @@ -141,6 +142,24 @@ void OmniboxUIHandler::OnResultChanged(bool default_match_changed) { |
| result->results_by_provider = |
| mojo::Array<AutocompleteResultsForProviderMojoPtr>::From( |
| controller_->providers()); |
| + |
| + // Fill AutocompleteMatchMojo::starred. |
| + BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); |
| + if (bookmark_model) { |
| + for (size_t i = 0; i < result->combined_results.size(); ++i) { |
|
Peter Kasting
2014/07/26 02:12:08
Nit: Use an iterator instead of an index here and
hashimoto
2014/07/28 06:49:43
IIUC mojo::Array doesn't provide iterators.
(https
Peter Kasting
2014/07/28 11:11:02
Then unless it is infeasible to do so, can you add
hashimoto
2014/07/29 02:03:49
If we are to use iterators here, it should be non-
Peter Kasting
2014/07/29 02:19:50
That sounds scary given that the header file for M
|
| + result->combined_results[i]->starred = bookmark_model->IsBookmarked( |
| + GURL(result->combined_results[i]->destination_url)); |
| + } |
| + for (size_t i = 0; i < result->results_by_provider.size(); ++i) { |
| + const AutocompleteResultsForProviderMojo& result_by_provider = |
| + *result->results_by_provider[i]; |
| + for (size_t j = 0; j < result_by_provider.results.size(); ++j) { |
| + result_by_provider.results[j]->starred = bookmark_model->IsBookmarked( |
| + GURL(result_by_provider.results[j]->destination_url)); |
| + } |
| + } |
| + } |
| + |
| client()->HandleNewAutocompleteResult(result.Pass()); |
| } |