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_fetcher_factory.h" | 8 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
9 #include "chrome/browser/search_engines/template_url_service_factory.h" | 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
10 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" | 10 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 using content::NavigationController; | 25 using content::NavigationController; |
26 using content::NavigationEntry; | 26 using content::NavigationEntry; |
27 using content::WebContents; | 27 using content::WebContents; |
28 | 28 |
29 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchEngineTabHelper); | 29 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchEngineTabHelper); |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // Returns true if the entry's transition type is FORM_SUBMIT. | 33 // Returns true if the entry's transition type is FORM_SUBMIT. |
34 bool IsFormSubmit(const NavigationEntry* entry) { | 34 bool IsFormSubmit(const NavigationEntry* entry) { |
35 return (content::PageTransitionStripQualifier(entry->GetTransitionType()) == | 35 return (ui::PageTransitionStripQualifier(entry->GetTransitionType()) == |
36 content::PAGE_TRANSITION_FORM_SUBMIT); | 36 ui::PAGE_TRANSITION_FORM_SUBMIT); |
37 } | 37 } |
38 | 38 |
39 base::string16 GenerateKeywordFromNavigationEntry( | 39 base::string16 GenerateKeywordFromNavigationEntry( |
40 const NavigationEntry* entry) { | 40 const NavigationEntry* entry) { |
41 // Don't autogenerate keywords for pages that are the result of form | 41 // Don't autogenerate keywords for pages that are the result of form |
42 // submissions. | 42 // submissions. |
43 if (IsFormSubmit(entry)) | 43 if (IsFormSubmit(entry)) |
44 return base::string16(); | 44 return base::string16(); |
45 | 45 |
46 // We want to use the user typed URL if available since that represents what | 46 // We want to use the user typed URL if available since that represents what |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // the favicon url wasn't obtained before the load started. This assumes the | 219 // the favicon url wasn't obtained before the load started. This assumes the |
220 // latter. | 220 // latter. |
221 // TODO(sky): Need a way to set the favicon that doesn't involve generating | 221 // TODO(sky): Need a way to set the favicon that doesn't involve generating |
222 // its url. | 222 // its url. |
223 data.favicon_url = current_favicon.is_valid() ? | 223 data.favicon_url = current_favicon.is_valid() ? |
224 current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url); | 224 current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url); |
225 data.safe_for_autoreplace = true; | 225 data.safe_for_autoreplace = true; |
226 data.input_encodings.push_back(params.searchable_form_encoding); | 226 data.input_encodings.push_back(params.searchable_form_encoding); |
227 url_service->Add(new TemplateURL(data)); | 227 url_service->Add(new TemplateURL(data)); |
228 } | 228 } |
OLD | NEW |