| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 if (!instant_url.is_valid() || | 525 if (!instant_url.is_valid() || |
| 526 !template_url->HasSearchTermsReplacementKey(instant_url)) | 526 !template_url->HasSearchTermsReplacementKey(instant_url)) |
| 527 return GURL(); | 527 return GURL(); |
| 528 | 528 |
| 529 // Extended mode requires HTTPS. Force it unless the base URL was overridden | 529 // Extended mode requires HTTPS. Force it unless the base URL was overridden |
| 530 // on the command line, in which case we allow HTTP (see comments on | 530 // on the command line, in which case we allow HTTP (see comments on |
| 531 // IsSuitableURLForInstant()). | 531 // IsSuitableURLForInstant()). |
| 532 if (!instant_url.SchemeIsSecure() && | 532 if (!instant_url.SchemeIsSecure() && |
| 533 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { | 533 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { |
| 534 GURL::Replacements replacements; | 534 GURL::Replacements replacements; |
| 535 const std::string secure_scheme(content::kHttpsScheme); | 535 const std::string secure_scheme(url::kHttpsScheme); |
| 536 replacements.SetSchemeStr(secure_scheme); | 536 replacements.SetSchemeStr(secure_scheme); |
| 537 instant_url = instant_url.ReplaceComponents(replacements); | 537 instant_url = instant_url.ReplaceComponents(replacements); |
| 538 } | 538 } |
| 539 | 539 |
| 540 if (!IsURLAllowedForSupervisedUser(instant_url, profile)) | 540 if (!IsURLAllowedForSupervisedUser(instant_url, profile)) |
| 541 return GURL(); | 541 return GURL(); |
| 542 | 542 |
| 543 return instant_url; | 543 return instant_url; |
| 544 } | 544 } |
| 545 | 545 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 841 |
| 842 // Given a FieldTrialFlags object, returns the boolean value of the provided | 842 // Given a FieldTrialFlags object, returns the boolean value of the provided |
| 843 // flag. | 843 // flag. |
| 844 bool GetBoolValueForFlagWithDefault(const std::string& flag, | 844 bool GetBoolValueForFlagWithDefault(const std::string& flag, |
| 845 bool default_value, | 845 bool default_value, |
| 846 const FieldTrialFlags& flags) { | 846 const FieldTrialFlags& flags) { |
| 847 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 847 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
| 848 } | 848 } |
| 849 | 849 |
| 850 } // namespace chrome | 850 } // namespace chrome |
| OLD | NEW |