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