| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Require a minimum 5 minute timeout. | 557 // Require a minimum 5 minute timeout. |
| 558 if (timeout_sec < 0 || (timeout_sec > 0 && timeout_sec < 300)) | 558 if (timeout_sec < 0 || (timeout_sec > 0 && timeout_sec < 300)) |
| 559 timeout_sec = kStalePageTimeoutDefault; | 559 timeout_sec = kStalePageTimeoutDefault; |
| 560 | 560 |
| 561 // Randomize by upto 15% either side. | 561 // Randomize by upto 15% either side. |
| 562 timeout_sec = base::RandInt(timeout_sec * 0.85, timeout_sec * 1.15); | 562 timeout_sec = base::RandInt(timeout_sec * 0.85, timeout_sec * 1.15); |
| 563 | 563 |
| 564 return timeout_sec; | 564 return timeout_sec; |
| 565 } | 565 } |
| 566 | 566 |
| 567 bool IsInstantOverlay(const content::WebContents* contents) { | |
| 568 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | |
| 569 if (it->instant_controller() && | |
| 570 it->instant_controller()->instant()->GetOverlayContents() == contents) { | |
| 571 return true; | |
| 572 } | |
| 573 } | |
| 574 return false; | |
| 575 } | |
| 576 | |
| 577 bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents) { | 567 bool IsPreloadedInstantExtendedNTP(const content::WebContents* contents) { |
| 578 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 568 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 579 if (it->instant_controller() && | 569 if (it->instant_controller() && |
| 580 it->instant_controller()->instant()->GetNTPContents() == contents) { | 570 it->instant_controller()->instant()->GetNTPContents() == contents) { |
| 581 return true; | 571 return true; |
| 582 } | 572 } |
| 583 } | 573 } |
| 584 return false; | 574 return false; |
| 585 } | 575 } |
| 586 | 576 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 return instant_url.is_valid() && | 665 return instant_url.is_valid() && |
| 676 (!IsInstantExtendedAPIEnabled() || | 666 (!IsInstantExtendedAPIEnabled() || |
| 677 template_url->HasSearchTermsReplacementKey(instant_url)); | 667 template_url->HasSearchTermsReplacementKey(instant_url)); |
| 678 } | 668 } |
| 679 | 669 |
| 680 void ResetInstantExtendedOptInStateGateForTest() { | 670 void ResetInstantExtendedOptInStateGateForTest() { |
| 681 instant_extended_opt_in_state_gate = false; | 671 instant_extended_opt_in_state_gate = false; |
| 682 } | 672 } |
| 683 | 673 |
| 684 } // namespace chrome | 674 } // namespace chrome |
| OLD | NEW |