| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ios/chrome/browser/ui/fullscreen_controller.h" | 5 #import "ios/chrome/browser/ui/fullscreen_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/objc_property_releaser.h" | 10 #include "base/mac/objc_property_releaser.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 ~ScopedIncrementer() { --(*value_); } | 33 ~ScopedIncrementer() { --(*value_); } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 int* value_; | 36 int* value_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 CGFloat kPrecision = 0.00001; | 39 CGFloat kPrecision = 0.00001; |
| 40 | 40 |
| 41 // Duration for the delay before showing the omnibox. | 41 // Duration for the delay before showing the omnibox. |
| 42 const double kShowOmniboxDelaySeconds = 0.5; | 42 const double kShowOmniboxDelaySeconds = 0.5; |
| 43 // Default duration for the delay before hiding the omnibox. | |
| 44 const double kDefaultHideOmniboxDelaySeconds = 3.0; | |
| 45 // Duration for the delay before hiding the omnibox. | |
| 46 double gHideOmniboxDelaySeconds = kDefaultHideOmniboxDelaySeconds; | |
| 47 // Indicates if the FullScreenController returns nil from |init|. Used for | 43 // Indicates if the FullScreenController returns nil from |init|. Used for |
| 48 // testing purposes. | 44 // testing purposes. |
| 49 BOOL gEnabledForTests = YES; | 45 BOOL gEnabledForTests = YES; |
| 50 | 46 |
| 51 // Compares that two CGFloat a and b are within a range of kPrecision of each | 47 // Compares that two CGFloat a and b are within a range of kPrecision of each |
| 52 // other. | 48 // other. |
| 53 BOOL CGFloatEquals(CGFloat a, CGFloat b) { | 49 BOOL CGFloatEquals(CGFloat a, CGFloat b) { |
| 54 CGFloat delta = std::abs(a - b); | 50 CGFloat delta = std::abs(a - b); |
| 55 | 51 |
| 56 return delta < kPrecision; | 52 return delta < kPrecision; |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 overscrollActionsInProgress_ = YES; | 815 overscrollActionsInProgress_ = YES; |
| 820 } | 816 } |
| 821 | 817 |
| 822 - (void)overscrollActionsDidEnd { | 818 - (void)overscrollActionsDidEnd { |
| 823 [self decrementFullScreenLock]; | 819 [self decrementFullScreenLock]; |
| 824 overscrollActionsInProgress_ = NO; | 820 overscrollActionsInProgress_ = NO; |
| 825 } | 821 } |
| 826 | 822 |
| 827 #pragma mark - Used for testing | 823 #pragma mark - Used for testing |
| 828 | 824 |
| 829 + (void)setHideOmniboxDelaySeconds:(double)hideOmniboxDelaySeconds { | |
| 830 gHideOmniboxDelaySeconds = hideOmniboxDelaySeconds; | |
| 831 } | |
| 832 | |
| 833 + (void)resetHideOmniboxDelaySeconds { | |
| 834 gHideOmniboxDelaySeconds = kDefaultHideOmniboxDelaySeconds; | |
| 835 } | |
| 836 | |
| 837 + (void)setEnabledForTests:(BOOL)enabled { | 825 + (void)setEnabledForTests:(BOOL)enabled { |
| 838 gEnabledForTests = enabled; | 826 gEnabledForTests = enabled; |
| 839 } | 827 } |
| 840 | 828 |
| 841 @end | 829 @end |
| OLD | NEW |