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/url_suggestion_result.h" | 5 #include "chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
10 #include "chrome/browser/ui/app_list/search/search_util.h" | 10 #include "chrome/browser/ui/app_list/search/search_util.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 std::unique_ptr<SearchResult> URLSuggestionResult::Duplicate() const { | 53 std::unique_ptr<SearchResult> URLSuggestionResult::Duplicate() const { |
54 URLSuggestionResult* new_result = new URLSuggestionResult( | 54 URLSuggestionResult* new_result = new URLSuggestionResult( |
55 profile_, list_controller_, favicon_service_, suggestions_service_, | 55 profile_, list_controller_, favicon_service_, suggestions_service_, |
56 suggestion_); | 56 suggestion_); |
57 new_result->set_relevance(relevance()); | 57 new_result->set_relevance(relevance()); |
58 return std::unique_ptr<SearchResult>(new_result); | 58 return std::unique_ptr<SearchResult>(new_result); |
59 } | 59 } |
60 | 60 |
61 void URLSuggestionResult::UpdateIcon() { | 61 void URLSuggestionResult::UpdateIcon() { |
62 std::vector<int> icon_types; | |
63 icon_types.push_back(favicon_base::IconType::FAVICON); | |
64 icon_types.push_back(favicon_base::IconType::TOUCH_ICON); | |
65 icon_types.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); | |
66 | |
67 if (favicon_service_) { | 62 if (favicon_service_) { |
68 // NOTE: Favicons with size < kMinimumDesiredSizePixels are still returned. | 63 // NOTE: Favicons with size < kMinimumDesiredSizePixels are still returned. |
69 favicon_service_->GetLargestRawFaviconForPageURL( | 64 favicon_service_->GetLargestRawFaviconForPageURL( |
70 GURL(suggestion_.url()), icon_types, kTileIconSize, | 65 GURL(suggestion_.url()), kTileIconSize, |
71 base::Bind(&URLSuggestionResult::OnDidGetIcon, base::Unretained(this)), | 66 base::Bind(&URLSuggestionResult::OnDidGetIcon, base::Unretained(this)), |
72 cancelable_task_tracker_.get()); | 67 cancelable_task_tracker_.get()); |
73 } | 68 } |
74 } | 69 } |
75 | 70 |
76 void URLSuggestionResult::OnDidGetIcon( | 71 void URLSuggestionResult::OnDidGetIcon( |
77 const favicon_base::FaviconRawBitmapResult& bitmap_result) { | 72 const favicon_base::FaviconRawBitmapResult& bitmap_result) { |
78 if (!bitmap_result.is_valid()) { | 73 if (!bitmap_result.is_valid()) { |
79 if (suggestions_service_) { | 74 if (suggestions_service_) { |
80 suggestions_service_->GetPageThumbnail( | 75 suggestions_service_->GetPageThumbnail( |
(...skipping 25 matching lines...) Expand all Loading... |
106 if (!image.IsEmpty()) { | 101 if (!image.IsEmpty()) { |
107 SetIcon(*image.ToImageSkia()); | 102 SetIcon(*image.ToImageSkia()); |
108 } else { | 103 } else { |
109 // There is no image for this suggestion. Disable being shown on the start | 104 // There is no image for this suggestion. Disable being shown on the start |
110 // screen. | 105 // screen. |
111 set_display_type(DISPLAY_NONE); | 106 set_display_type(DISPLAY_NONE); |
112 } | 107 } |
113 } | 108 } |
114 | 109 |
115 } // namespace app_list | 110 } // namespace app_list |
OLD | NEW |