| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 // Require a minimum 5 minute timeout. | 549 // Require a minimum 5 minute timeout. |
| 550 if (timeout_sec < 0 || (timeout_sec > 0 && timeout_sec < 300)) | 550 if (timeout_sec < 0 || (timeout_sec > 0 && timeout_sec < 300)) |
| 551 timeout_sec = kStalePageTimeoutDefault; | 551 timeout_sec = kStalePageTimeoutDefault; |
| 552 | 552 |
| 553 // Randomize by upto 15% either side. | 553 // Randomize by upto 15% either side. |
| 554 timeout_sec = base::RandInt(timeout_sec * 0.85, timeout_sec * 1.15); | 554 timeout_sec = base::RandInt(timeout_sec * 0.85, timeout_sec * 1.15); |
| 555 | 555 |
| 556 return timeout_sec; | 556 return timeout_sec; |
| 557 } | 557 } |
| 558 | 558 |
| 559 bool IsInstantOverlay(const content::WebContents* contents) { | |
| 560 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | |
| 561 if (it->instant_controller() && | |
| 562 it->instant_controller()->instant()->GetOverlayContents() == contents) { | |
| 563 return true; | |
| 564 } | |
| 565 } | |
| 566 return false; | |
| 567 } | |
| 568 | |
| 569 bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents) { | 559 bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents) { |
| 570 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 560 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 571 if (it->instant_controller() && | 561 if (it->instant_controller() && |
| 572 it->instant_controller()->instant()->GetNTPContents() == contents) { | 562 it->instant_controller()->instant()->GetNTPContents() == contents) { |
| 573 return true; | 563 return true; |
| 574 } | 564 } |
| 575 } | 565 } |
| 576 return false; | 566 return false; |
| 577 } | 567 } |
| 578 | 568 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 return instant_url.is_valid() && | 657 return instant_url.is_valid() && |
| 668 (!IsInstantExtendedAPIEnabled() || | 658 (!IsInstantExtendedAPIEnabled() || |
| 669 template_url->HasSearchTermsReplacementKey(instant_url)); | 659 template_url->HasSearchTermsReplacementKey(instant_url)); |
| 670 } | 660 } |
| 671 | 661 |
| 672 void ResetInstantExtendedOptInStateGateForTest() { | 662 void ResetInstantExtendedOptInStateGateForTest() { |
| 673 instant_extended_opt_in_state_gate = false; | 663 instant_extended_opt_in_state_gate = false; |
| 674 } | 664 } |
| 675 | 665 |
| 676 } // namespace chrome | 666 } // namespace chrome |
| OLD | NEW |