OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search/search.h" | 5 #include "chrome/browser/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 search_terms_args.omnibox_start_margin = start_margin; | 121 search_terms_args.omnibox_start_margin = start_margin; |
122 search_terms_args.append_extra_query_params = append_extra_query_params; | 122 search_terms_args.append_extra_query_params = append_extra_query_params; |
123 return GURL(ref.ReplaceSearchTerms(search_terms_args)); | 123 return GURL(ref.ReplaceSearchTerms(search_terms_args)); |
124 } | 124 } |
125 | 125 |
126 bool MatchesOrigin(const GURL& my_url, const GURL& other_url) { | 126 bool MatchesOrigin(const GURL& my_url, const GURL& other_url) { |
127 return my_url.host() == other_url.host() && | 127 return my_url.host() == other_url.host() && |
128 my_url.port() == other_url.port() && | 128 my_url.port() == other_url.port() && |
129 (my_url.scheme() == other_url.scheme() || | 129 (my_url.scheme() == other_url.scheme() || |
130 (my_url.SchemeIs(content::kHttpsScheme) && | 130 (my_url.SchemeIs(content::kHttpsScheme) && |
131 other_url.SchemeIs(chrome::kHttpScheme))); | 131 other_url.SchemeIs(content::kHttpScheme))); |
132 } | 132 } |
133 | 133 |
134 bool MatchesAnySearchURL(const GURL& url, TemplateURL* template_url) { | 134 bool MatchesAnySearchURL(const GURL& url, TemplateURL* template_url) { |
135 GURL search_url = | 135 GURL search_url = |
136 TemplateURLRefToGURL(template_url->url_ref(), kDisableStartMargin, false); | 136 TemplateURLRefToGURL(template_url->url_ref(), kDisableStartMargin, false); |
137 if (search_url.is_valid() && MatchesOriginAndPath(url, search_url)) | 137 if (search_url.is_valid() && MatchesOriginAndPath(url, search_url)) |
138 return true; | 138 return true; |
139 | 139 |
140 // "URLCount() - 1" because we already tested url_ref above. | 140 // "URLCount() - 1" because we already tested url_ref above. |
141 for (size_t i = 0; i < template_url->URLCount() - 1; ++i) { | 141 for (size_t i = 0; i < template_url->URLCount() - 1; ++i) { |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 752 |
753 return TemplateURLRefToGURL(template_url->new_tab_url_ref(), | 753 return TemplateURLRefToGURL(template_url->new_tab_url_ref(), |
754 kDisableStartMargin, false); | 754 kDisableStartMargin, false); |
755 } | 755 } |
756 | 756 |
757 void ResetInstantExtendedOptInStateGateForTest() { | 757 void ResetInstantExtendedOptInStateGateForTest() { |
758 instant_extended_opt_in_state_gate = false; | 758 instant_extended_opt_in_state_gate = false; |
759 } | 759 } |
760 | 760 |
761 } // namespace chrome | 761 } // namespace chrome |
OLD | NEW |