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/suggestions/suggestions_search_provi
der.h" | 5 #include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi
der.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "chrome/browser/favicon/favicon_service_factory.h" | 11 #include "chrome/browser/favicon/favicon_service_factory.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" | 13 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 14 #include "chrome/browser/sync/profile_sync_service_factory.h" |
15 #include "chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h" | 15 #include "chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h" |
16 #include "components/browser_sync/browser/profile_sync_service.h" | 16 #include "components/browser_sync/browser/profile_sync_service.h" |
17 #include "components/favicon/core/favicon_service.h" | 17 #include "components/favicon/core/favicon_service.h" |
18 #include "components/suggestions/proto/suggestions.pb.h" | 18 #include "components/suggestions/proto/suggestions.pb.h" |
19 #include "components/suggestions/suggestions_service.h" | 19 #include "components/suggestions/suggestions_service.h" |
(...skipping 24 matching lines...) Expand all Loading... |
44 if (!query.empty()) | 44 if (!query.empty()) |
45 return; | 45 return; |
46 | 46 |
47 const suggestions::SuggestionsProfile& suggestions_profile = | 47 const suggestions::SuggestionsProfile& suggestions_profile = |
48 suggestions_service_->GetSuggestionsDataFromCache(); | 48 suggestions_service_->GetSuggestionsDataFromCache(); |
49 for (int i = 0; i < suggestions_profile.suggestions_size(); ++i) { | 49 for (int i = 0; i < suggestions_profile.suggestions_size(); ++i) { |
50 const suggestions::ChromeSuggestion& suggestion = | 50 const suggestions::ChromeSuggestion& suggestion = |
51 suggestions_profile.suggestions(i); | 51 suggestions_profile.suggestions(i); |
52 | 52 |
53 // TODO(mathp): If it's an app, create an AppResult. | 53 // TODO(mathp): If it's an app, create an AppResult. |
54 scoped_ptr<URLSuggestionResult> result(new URLSuggestionResult( | 54 std::unique_ptr<URLSuggestionResult> result( |
55 profile_, list_controller_, favicon_service_, suggestions_service_, | 55 new URLSuggestionResult(profile_, list_controller_, favicon_service_, |
56 suggestion)); | 56 suggestions_service_, suggestion)); |
57 result->set_relevance(1.0 / (i + 1)); | 57 result->set_relevance(1.0 / (i + 1)); |
58 Add(std::move(result)); | 58 Add(std::move(result)); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void SuggestionsSearchProvider::Stop() { | 62 void SuggestionsSearchProvider::Stop() { |
63 } | 63 } |
64 | 64 |
65 } // namespace app_list | 65 } // namespace app_list |
OLD | NEW |