OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search_engines/search_engine_tab_helper.h" | 5 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/search_engines/template_url.h" | 8 #include "chrome/browser/search_engines/template_url.h" |
9 #include "chrome/browser/search_engines/template_url_fetcher.h" | 9 #include "chrome/browser/search_engines/template_url_fetcher.h" |
10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 string16 keyword = TemplateURLService::GenerateKeyword( | 118 string16 keyword = TemplateURLService::GenerateKeyword( |
119 keyword_url, | 119 keyword_url, |
120 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); | 120 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); |
121 | 121 |
122 // Download the OpenSearch description document. If this is successful, a | 122 // Download the OpenSearch description document. If this is successful, a |
123 // new keyword will be created when done. | 123 // new keyword will be created when done. |
124 profile->GetTemplateURLFetcher()->ScheduleDownload( | 124 profile->GetTemplateURLFetcher()->ScheduleDownload( |
125 keyword, | 125 keyword, |
126 doc_url, | 126 doc_url, |
127 base_entry->GetFavicon().url, | 127 base_entry->GetFavicon().url, |
| 128 web_contents(), |
128 new TemplateURLFetcherUICallbacks(this, web_contents()), | 129 new TemplateURLFetcherUICallbacks(this, web_contents()), |
129 provider_type); | 130 provider_type); |
130 } | 131 } |
131 | 132 |
132 void SearchEngineTabHelper::GenerateKeywordIfNecessary( | 133 void SearchEngineTabHelper::GenerateKeywordIfNecessary( |
133 const content::FrameNavigateParams& params) { | 134 const content::FrameNavigateParams& params) { |
134 if (!params.searchable_form_url.is_valid()) | 135 if (!params.searchable_form_url.is_valid()) |
135 return; | 136 return; |
136 | 137 |
137 Profile* profile = | 138 Profile* profile = |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // or the favicon url wasn't obtained before the load started. This assumes | 201 // or the favicon url wasn't obtained before the load started. This assumes |
201 // the later. | 202 // the later. |
202 // TODO(sky): Need a way to set the favicon that doesn't involve generating | 203 // TODO(sky): Need a way to set the favicon that doesn't involve generating |
203 // its url. | 204 // its url. |
204 new_url->SetFaviconURL( | 205 new_url->SetFaviconURL( |
205 TemplateURL::GenerateFaviconURL(params.referrer.url)); | 206 TemplateURL::GenerateFaviconURL(params.referrer.url)); |
206 } | 207 } |
207 new_url->set_safe_for_autoreplace(true); | 208 new_url->set_safe_for_autoreplace(true); |
208 url_service->Add(new_url); | 209 url_service->Add(new_url); |
209 } | 210 } |
OLD | NEW |