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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 URLSuggestionResult::~URLSuggestionResult() {} | 44 URLSuggestionResult::~URLSuggestionResult() {} |
45 | 45 |
46 void URLSuggestionResult::Open(int event_flags) { | 46 void URLSuggestionResult::Open(int event_flags) { |
47 RecordHistogram(SUGGESTIONS_SEARCH_RESULT); | 47 RecordHistogram(SUGGESTIONS_SEARCH_RESULT); |
48 list_controller_->OpenURL(profile_, GURL(suggestion_.url()), | 48 list_controller_->OpenURL(profile_, GURL(suggestion_.url()), |
49 ui::PageTransition::PAGE_TRANSITION_LINK, | 49 ui::PageTransition::PAGE_TRANSITION_LINK, |
50 ui::DispositionFromEventFlags(event_flags)); | 50 ui::DispositionFromEventFlags(event_flags)); |
51 } | 51 } |
52 | 52 |
53 scoped_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 scoped_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; | 62 std::vector<int> icon_types; |
63 icon_types.push_back(favicon_base::IconType::FAVICON); | 63 icon_types.push_back(favicon_base::IconType::FAVICON); |
64 icon_types.push_back(favicon_base::IconType::TOUCH_ICON); | 64 icon_types.push_back(favicon_base::IconType::TOUCH_ICON); |
65 icon_types.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); | 65 icon_types.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); |
66 | 66 |
67 if (favicon_service_) { | 67 if (favicon_service_) { |
68 // NOTE: Favicons with size < kMinimumDesiredSizePixels are still returned. | 68 // NOTE: Favicons with size < kMinimumDesiredSizePixels are still returned. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (bitmap) { | 106 if (bitmap) { |
107 SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); | 107 SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); |
108 } else { | 108 } else { |
109 // There is no image for this suggestion. Disable being shown on the start | 109 // There is no image for this suggestion. Disable being shown on the start |
110 // screen. | 110 // screen. |
111 set_display_type(DISPLAY_NONE); | 111 set_display_type(DISPLAY_NONE); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 } // namespace app_list | 115 } // namespace app_list |
OLD | NEW |