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 19 matching lines...) Expand all Loading... |
30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
31 #include "components/pref_registry/pref_registry_syncable.h" | 31 #include "components/pref_registry/pref_registry_syncable.h" |
32 #include "components/sessions/serialized_navigation_entry.h" | 32 #include "components/sessions/serialized_navigation_entry.h" |
33 #include "content/public/browser/navigation_entry.h" | 33 #include "content/public/browser/navigation_entry.h" |
34 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 | 38 |
39 #if defined(ENABLE_MANAGED_USERS) | 39 #if defined(ENABLE_MANAGED_USERS) |
40 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 40 #include "chrome/browser/supervised_user/supervised_user_service.h" |
41 #include "chrome/browser/managed_mode/managed_user_service.h" | 41 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
42 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 42 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
43 #endif | 43 #endif |
44 | 44 |
45 namespace chrome { | 45 namespace chrome { |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 // Configuration options for Embedded Search. | 49 // Configuration options for Embedded Search. |
50 // EmbeddedSearch field trials are named in such a way that we can parse out | 50 // EmbeddedSearch field trials are named in such a way that we can parse out |
51 // the experiment configuration from the trial's group name in order to give | 51 // the experiment configuration from the trial's group name in order to give |
52 // us maximum flexability in running experiments. | 52 // us maximum flexability in running experiments. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 if (!IsQueryExtractionAllowedForURL(profile, entry->GetVirtualURL())) | 283 if (!IsQueryExtractionAllowedForURL(profile, entry->GetVirtualURL())) |
284 return base::string16(); | 284 return base::string16(); |
285 | 285 |
286 // Otherwise, extract from the URL. | 286 // Otherwise, extract from the URL. |
287 return ExtractSearchTermsFromURL(profile, entry->GetVirtualURL()); | 287 return ExtractSearchTermsFromURL(profile, entry->GetVirtualURL()); |
288 } | 288 } |
289 | 289 |
290 bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) { | 290 bool IsURLAllowedForSupervisedUser(const GURL& url, Profile* profile) { |
291 #if defined(ENABLE_MANAGED_USERS) | 291 #if defined(ENABLE_MANAGED_USERS) |
292 ManagedUserService* managed_user_service = | 292 SupervisedUserService* supervised_user_service = |
293 ManagedUserServiceFactory::GetForProfile(profile); | 293 SupervisedUserServiceFactory::GetForProfile(profile); |
294 ManagedModeURLFilter* url_filter = | 294 SupervisedUserURLFilter* url_filter = |
295 managed_user_service->GetURLFilterForUIThread(); | 295 supervised_user_service->GetURLFilterForUIThread(); |
296 if (url_filter->GetFilteringBehaviorForURL(url) == | 296 if (url_filter->GetFilteringBehaviorForURL(url) == |
297 ManagedModeURLFilter::BLOCK) { | 297 SupervisedUserURLFilter::BLOCK) { |
298 return false; | 298 return false; |
299 } | 299 } |
300 #endif | 300 #endif |
301 return true; | 301 return true; |
302 } | 302 } |
303 | 303 |
304 // Returns whether |new_tab_url| can be used as a URL for the New Tab page. | 304 // Returns whether |new_tab_url| can be used as a URL for the New Tab page. |
305 // NEW_TAB_URL_VALID means a valid URL; other enum values imply an invalid URL. | 305 // NEW_TAB_URL_VALID means a valid URL; other enum values imply an invalid URL. |
306 NewTabURLState IsValidNewTabURL(Profile* profile, const GURL& new_tab_url) { | 306 NewTabURLState IsValidNewTabURL(Profile* profile, const GURL& new_tab_url) { |
307 if (profile->IsOffTheRecord()) | 307 if (profile->IsOffTheRecord()) |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 828 |
829 // Given a FieldTrialFlags object, returns the boolean value of the provided | 829 // Given a FieldTrialFlags object, returns the boolean value of the provided |
830 // flag. | 830 // flag. |
831 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 831 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
832 bool default_value, | 832 bool default_value, |
833 const FieldTrialFlags& flags) { | 833 const FieldTrialFlags& flags) { |
834 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 834 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
835 } | 835 } |
836 | 836 |
837 } // namespace chrome | 837 } // namespace chrome |
OLD | NEW |