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 "athena/main/url_search_provider.h" | 5 #include "athena/main/url_search_provider.h" |
6 | 6 |
7 #include "athena/activity/public/activity.h" | 7 #include "athena/activity/public/activity.h" |
8 #include "athena/activity/public/activity_factory.h" | 8 #include "athena/activity/public/activity_factory.h" |
9 #include "athena/content/public/scheme_classifier_factory.h" | 9 #include "athena/content/public/scheme_classifier_factory.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // See comments in autocomplete_provider.h. | 163 // See comments in autocomplete_provider.h. |
164 set_relevance(match_.relevance / 1500.0); | 164 set_relevance(match_.relevance / 1500.0); |
165 | 165 |
166 UpdateIcon(); | 166 UpdateIcon(); |
167 UpdateTitleAndDetails(); | 167 UpdateTitleAndDetails(); |
168 } | 168 } |
169 | 169 |
170 virtual ~UrlSearchResult() {} | 170 virtual ~UrlSearchResult() {} |
171 | 171 |
172 private: | 172 private: |
173 // Overriddenn from app_list::SearchResult: | 173 // Overridden from app_list::SearchResult: |
| 174 virtual scoped_ptr<app_list::SearchResult> Duplicate() override { |
| 175 return make_scoped_ptr(new UrlSearchResult(browser_context_, match_)); |
| 176 } |
| 177 |
174 virtual void Open(int event_flags) override { | 178 virtual void Open(int event_flags) override { |
175 Activity* activity = ActivityFactory::Get()->CreateWebActivity( | 179 Activity* activity = ActivityFactory::Get()->CreateWebActivity( |
176 browser_context_, base::string16(), match_.destination_url); | 180 browser_context_, base::string16(), match_.destination_url); |
177 Activity::Show(activity); | 181 Activity::Show(activity); |
178 } | 182 } |
179 | 183 |
180 void UpdateIcon() { | 184 void UpdateIcon() { |
181 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 185 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
182 AutocompleteMatch::TypeToIcon(match_.type))); | 186 AutocompleteMatch::TypeToIcon(match_.type))); |
183 } | 187 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 ++it) { | 281 ++it) { |
278 if (!it->destination_url.is_valid()) | 282 if (!it->destination_url.is_valid()) |
279 continue; | 283 continue; |
280 | 284 |
281 Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( | 285 Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( |
282 browser_context_, *it))); | 286 browser_context_, *it))); |
283 } | 287 } |
284 } | 288 } |
285 | 289 |
286 } // namespace athena | 290 } // namespace athena |
OLD | NEW |