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_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
8 #include "athena/activity/public/activity_manager.h" | |
9 #include "athena/content/public/scheme_classifier_factory.h" | 8 #include "athena/content/public/scheme_classifier_factory.h" |
10 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 10 #include "base/values.h" |
12 #include "components/metrics/proto/omnibox_event.pb.h" | 11 #include "components/metrics/proto/omnibox_event.pb.h" |
13 #include "components/metrics/proto/omnibox_input_type.pb.h" | 12 #include "components/metrics/proto/omnibox_input_type.pb.h" |
14 #include "components/omnibox/autocomplete_input.h" | 13 #include "components/omnibox/autocomplete_input.h" |
15 #include "components/omnibox/autocomplete_provider_client.h" | 14 #include "components/omnibox/autocomplete_provider_client.h" |
16 #include "components/omnibox/search_provider.h" | 15 #include "components/omnibox/search_provider.h" |
17 #include "components/search_engines/search_terms_data.h" | 16 #include "components/search_engines/search_terms_data.h" |
18 #include "components/search_engines/template_url_service.h" | 17 #include "components/search_engines/template_url_service.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 164 |
166 UpdateIcon(); | 165 UpdateIcon(); |
167 UpdateTitleAndDetails(); | 166 UpdateTitleAndDetails(); |
168 } | 167 } |
169 | 168 |
170 virtual ~UrlSearchResult() {} | 169 virtual ~UrlSearchResult() {} |
171 | 170 |
172 private: | 171 private: |
173 // Overriddenn from app_list::SearchResult: | 172 // Overriddenn from app_list::SearchResult: |
174 virtual void Open(int event_flags) OVERRIDE { | 173 virtual void Open(int event_flags) OVERRIDE { |
175 ActivityManager::Get()->AddActivity( | 174 ActivityFactory::Get()->CreateWebActivity( |
176 ActivityFactory::Get()->CreateWebActivity( | 175 browser_context_, base::string16(), match_.destination_url); |
177 browser_context_, base::string16(), match_.destination_url)); | |
178 } | 176 } |
179 | 177 |
180 void UpdateIcon() { | 178 void UpdateIcon() { |
181 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 179 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
182 AutocompleteMatch::TypeToIcon(match_.type))); | 180 AutocompleteMatch::TypeToIcon(match_.type))); |
183 } | 181 } |
184 | 182 |
185 void UpdateTitleAndDetails() { | 183 void UpdateTitleAndDetails() { |
186 set_title(match_.contents); | 184 set_title(match_.contents); |
187 SearchResult::Tags title_tags; | 185 SearchResult::Tags title_tags; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 ++it) { | 275 ++it) { |
278 if (!it->destination_url.is_valid()) | 276 if (!it->destination_url.is_valid()) |
279 continue; | 277 continue; |
280 | 278 |
281 Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( | 279 Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( |
282 browser_context_, *it))); | 280 browser_context_, *it))); |
283 } | 281 } |
284 } | 282 } |
285 | 283 |
286 } // namespace athena | 284 } // namespace athena |
OLD | NEW |