| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (instant_url.SchemeIsSecure() || | 341 if (instant_url.SchemeIsSecure() || |
| 342 google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) | 342 google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) |
| 343 return instant_url; | 343 return instant_url; |
| 344 GURL::Replacements replacements; | 344 GURL::Replacements replacements; |
| 345 const std::string secure_scheme(chrome::kHttpsScheme); | 345 const std::string secure_scheme(chrome::kHttpsScheme); |
| 346 replacements.SetSchemeStr(secure_scheme); | 346 replacements.SetSchemeStr(secure_scheme); |
| 347 return instant_url.ReplaceComponents(replacements); | 347 return instant_url.ReplaceComponents(replacements); |
| 348 } | 348 } |
| 349 | 349 |
| 350 GURL GetLocalInstantURL(Profile* profile) { | 350 GURL GetLocalInstantURL(Profile* profile) { |
| 351 return GURL(chrome::kChromeSearchLocalNtpUrl); |
| 352 } |
| 353 |
| 354 bool DefaultSearchProviderIsGoogle(Profile* profile) { |
| 355 DCHECK(profile); |
| 351 const TemplateURL* default_provider = | 356 const TemplateURL* default_provider = |
| 352 GetDefaultSearchProviderTemplateURL(profile); | 357 GetDefaultSearchProviderTemplateURL(profile); |
| 353 | 358 |
| 354 if (default_provider && | 359 return default_provider && |
| 355 (TemplateURLPrepopulateData::GetEngineType(default_provider->url()) == | 360 (TemplateURLPrepopulateData::GetEngineType(default_provider->url()) == |
| 356 SEARCH_ENGINE_GOOGLE)) { | 361 SEARCH_ENGINE_GOOGLE); |
| 357 return GURL(chrome::kChromeSearchLocalGoogleNtpUrl); | |
| 358 } | |
| 359 return GURL(chrome::kChromeSearchLocalNtpUrl); | |
| 360 } | 362 } |
| 361 | 363 |
| 362 bool ShouldPreferRemoteNTPOnStartup() { | 364 bool ShouldPreferRemoteNTPOnStartup() { |
| 363 // Check the command-line/about:flags setting first, which should have | 365 // Check the command-line/about:flags setting first, which should have |
| 364 // precedence and allows the trial to not be reported (if it's never queried). | 366 // precedence and allows the trial to not be reported (if it's never queried). |
| 365 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 367 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 366 if (command_line->HasSwitch(switches::kDisableInstantExtendedAPI) || | 368 if (command_line->HasSwitch(switches::kDisableInstantExtendedAPI) || |
| 367 command_line->HasSwitch(switches::kEnableLocalFirstLoadNTP)) { | 369 command_line->HasSwitch(switches::kEnableLocalFirstLoadNTP)) { |
| 368 return false; | 370 return false; |
| 369 } | 371 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 bool default_value, | 544 bool default_value, |
| 543 const FieldTrialFlags& flags) { | 545 const FieldTrialFlags& flags) { |
| 544 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); | 546 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); |
| 545 } | 547 } |
| 546 | 548 |
| 547 void ResetInstantExtendedOptInStateGateForTest() { | 549 void ResetInstantExtendedOptInStateGateForTest() { |
| 548 instant_extended_opt_in_state_gate = false; | 550 instant_extended_opt_in_state_gate = false; |
| 549 } | 551 } |
| 550 | 552 |
| 551 } // namespace chrome | 553 } // namespace chrome |
| OLD | NEW |