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 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/search_urls.h" | 28 #include "chrome/common/search_urls.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "components/sessions/serialized_navigation_entry.h" | 30 #include "components/sessions/serialized_navigation_entry.h" |
31 #include "components/user_prefs/pref_registry_syncable.h" | 31 #include "components/user_prefs/pref_registry_syncable.h" |
32 #include "content/public/browser/navigation_entry.h" | 32 #include "content/public/browser/navigation_entry.h" |
33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 36 #include "net/base/url_constants.h" |
36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
37 | 38 |
38 #if defined(ENABLE_MANAGED_USERS) | 39 #if defined(ENABLE_MANAGED_USERS) |
39 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 40 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
40 #include "chrome/browser/managed_mode/managed_user_service.h" | 41 #include "chrome/browser/managed_mode/managed_user_service.h" |
41 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 42 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
42 #endif | 43 #endif |
43 | 44 |
44 namespace chrome { | 45 namespace chrome { |
45 | 46 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 if (!instant_url.is_valid() || | 514 if (!instant_url.is_valid() || |
514 !template_url->HasSearchTermsReplacementKey(instant_url)) | 515 !template_url->HasSearchTermsReplacementKey(instant_url)) |
515 return GURL(); | 516 return GURL(); |
516 | 517 |
517 // Extended mode requires HTTPS. Force it unless the base URL was overridden | 518 // Extended mode requires HTTPS. Force it unless the base URL was overridden |
518 // on the command line, in which case we allow HTTP (see comments on | 519 // on the command line, in which case we allow HTTP (see comments on |
519 // IsSuitableURLForInstant()). | 520 // IsSuitableURLForInstant()). |
520 if (!instant_url.SchemeIsSecure() && | 521 if (!instant_url.SchemeIsSecure() && |
521 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { | 522 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { |
522 GURL::Replacements replacements; | 523 GURL::Replacements replacements; |
523 const std::string secure_scheme(content::kHttpsScheme); | 524 const std::string secure_scheme(net::kHttpsScheme); |
524 replacements.SetSchemeStr(secure_scheme); | 525 replacements.SetSchemeStr(secure_scheme); |
525 instant_url = instant_url.ReplaceComponents(replacements); | 526 instant_url = instant_url.ReplaceComponents(replacements); |
526 } | 527 } |
527 | 528 |
528 if (!IsURLAllowedForSupervisedUser(instant_url, profile)) | 529 if (!IsURLAllowedForSupervisedUser(instant_url, profile)) |
529 return GURL(); | 530 return GURL(); |
530 | 531 |
531 return instant_url; | 532 return instant_url; |
532 } | 533 } |
533 | 534 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 | 830 |
830 // Given a FieldTrialFlags object, returns the boolean value of the provided | 831 // Given a FieldTrialFlags object, returns the boolean value of the provided |
831 // flag. | 832 // flag. |
832 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 833 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
833 bool default_value, | 834 bool default_value, |
834 const FieldTrialFlags& flags) { | 835 const FieldTrialFlags& flags) { |
835 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 836 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
836 } | 837 } |
837 | 838 |
838 } // namespace chrome | 839 } // namespace chrome |
OLD | NEW |