| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTLE_H
_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTLE_H
_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTLE_H
_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTLE_H
_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 DelayNavigationThrottle(content::NavigationHandle* handle, | 46 DelayNavigationThrottle(content::NavigationHandle* handle, |
| 47 scoped_refptr<base::TaskRunner> task_runner, | 47 scoped_refptr<base::TaskRunner> task_runner, |
| 48 base::TimeDelta navigation_delay); | 48 base::TimeDelta navigation_delay); |
| 49 ~DelayNavigationThrottle() override; | 49 ~DelayNavigationThrottle() override; |
| 50 | 50 |
| 51 // Return the navigation delay for this throttle. | 51 // Return the navigation delay for this throttle. |
| 52 base::TimeDelta navigation_delay() const { return navigation_delay_; } | 52 base::TimeDelta navigation_delay() const { return navigation_delay_; } |
| 53 | 53 |
| 54 // content::NavigationThrottle: | 54 // content::NavigationThrottle: |
| 55 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; | 55 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
| 56 const char* GetNameForLogging() override; |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 void OnDelayComplete(); | 59 void OnDelayComplete(); |
| 59 | 60 |
| 60 const scoped_refptr<base::TaskRunner> task_runner_; | 61 const scoped_refptr<base::TaskRunner> task_runner_; |
| 61 const base::TimeDelta navigation_delay_; | 62 const base::TimeDelta navigation_delay_; |
| 62 | 63 |
| 63 // The time we added a delay to this navigation. | 64 // The time we added a delay to this navigation. |
| 64 base::TimeTicks delay_start_time_; | 65 base::TimeTicks delay_start_time_; |
| 65 | 66 |
| 66 // This has to be the last member of the class. | 67 // This has to be the last member of the class. |
| 67 base::WeakPtrFactory<DelayNavigationThrottle> weak_ptr_factory_; | 68 base::WeakPtrFactory<DelayNavigationThrottle> weak_ptr_factory_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(DelayNavigationThrottle); | 70 DISALLOW_COPY_AND_ASSIGN(DelayNavigationThrottle); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTL
E_H_ | 73 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_EXPERIMENTS_DELAY_NAVIGATION_THROTTL
E_H_ |
| OLD | NEW |