| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/search/instant_service.h" | 19 #include "chrome/browser/search/instant_service.h" |
| 20 #include "chrome/browser/search/instant_service_factory.h" | 20 #include "chrome/browser/search/instant_service_factory.h" |
| 21 #include "chrome/browser/search_engines/template_url_service_factory.h" | 21 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 22 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 22 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_instant_controller.h" | 24 #include "chrome/browser/ui/browser_instant_controller.h" |
| 25 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 25 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/features.h" |
| 27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/search/search_urls.h" | 29 #include "chrome/common/search/search_urls.h" |
| 29 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 30 #include "components/google/core/browser/google_util.h" | 31 #include "components/google/core/browser/google_util.h" |
| 31 #include "components/pref_registry/pref_registry_syncable.h" | 32 #include "components/pref_registry/pref_registry_syncable.h" |
| 32 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
| 33 #include "components/search/search.h" | 34 #include "components/search/search.h" |
| 34 #include "components/search_engines/search_engine_type.h" | 35 #include "components/search_engines/search_engine_type.h" |
| 35 #include "components/search_engines/template_url_service.h" | 36 #include "components/search_engines/template_url_service.h" |
| 36 #include "components/sessions/core/serialized_navigation_entry.h" | 37 #include "components/sessions/core/serialized_navigation_entry.h" |
| 37 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
| 38 #include "content/public/browser/render_process_host.h" | 39 #include "content/public/browser/render_process_host.h" |
| 39 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
| 40 | 41 |
| 41 #if defined(ENABLE_SUPERVISED_USERS) | 42 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 42 #include "chrome/browser/supervised_user/supervised_user_service.h" | 43 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 43 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 44 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 44 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 45 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 48 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 49 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 49 #endif // defined(OS_CHROMEOS) | 50 #endif // defined(OS_CHROMEOS) |
| 50 | 51 |
| 51 namespace search { | 52 namespace search { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 UIThreadSearchTermsData search_terms_data(profile); | 143 UIThreadSearchTermsData search_terms_data(profile); |
| 143 const GURL instant_url = TemplateURLRefToGURL( | 144 const GURL instant_url = TemplateURLRefToGURL( |
| 144 instant_url_ref, search_terms_data, false, false); | 145 instant_url_ref, search_terms_data, false, false); |
| 145 if (!instant_url.is_valid()) | 146 if (!instant_url.is_valid()) |
| 146 return false; | 147 return false; |
| 147 | 148 |
| 148 return MatchesOriginAndPath(url, instant_url); | 149 return MatchesOriginAndPath(url, instant_url); |
| 149 } | 150 } |
| 150 | 151 |
| 151 bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) { | 152 bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) { |
| 152 #if defined(ENABLE_SUPERVISED_USERS) | 153 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 153 SupervisedUserService* supervised_user_service = | 154 SupervisedUserService* supervised_user_service = |
| 154 SupervisedUserServiceFactory::GetForProfile(profile); | 155 SupervisedUserServiceFactory::GetForProfile(profile); |
| 155 SupervisedUserURLFilter* url_filter = | 156 SupervisedUserURLFilter* url_filter = |
| 156 supervised_user_service->GetURLFilterForUIThread(); | 157 supervised_user_service->GetURLFilterForUIThread(); |
| 157 if (url_filter->GetFilteringBehaviorForURL(url) == | 158 if (url_filter->GetFilteringBehaviorForURL(url) == |
| 158 SupervisedUserURLFilter::BLOCK) { | 159 SupervisedUserURLFilter::BLOCK) { |
| 159 return false; | 160 return false; |
| 160 } | 161 } |
| 161 #endif | 162 #endif |
| 162 return true; | 163 return true; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 455 |
| 455 if (IsInstantNTPURL(*url, profile)) { | 456 if (IsInstantNTPURL(*url, profile)) { |
| 456 *url = GURL(chrome::kChromeUINewTabURL); | 457 *url = GURL(chrome::kChromeUINewTabURL); |
| 457 return true; | 458 return true; |
| 458 } | 459 } |
| 459 | 460 |
| 460 return false; | 461 return false; |
| 461 } | 462 } |
| 462 | 463 |
| 463 } // namespace search | 464 } // namespace search |
| OLD | NEW |