| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 // DevToolsNetworkConditions holds information about desired network conditions. | 15 // DevToolsNetworkConditions holds information about desired network conditions. |
| 16 class DevToolsNetworkConditions | 16 class DevToolsNetworkConditions |
| 17 : public base::RefCounted<DevToolsNetworkConditions> { | 17 : public base::RefCounted<DevToolsNetworkConditions> { |
| 18 public: | 18 public: |
| 19 explicit DevToolsNetworkConditions(const std::vector<std::string>& domains); | 19 DevToolsNetworkConditions(const std::vector<std::string>& domains, |
| 20 double maximal_throughput); |
| 20 | 21 |
| 21 bool HasMatchingDomain(const GURL& url) const; | 22 bool HasMatchingDomain(const GURL& url) const; |
| 22 bool IsOffline() const; | 23 bool IsOffline() const; |
| 24 bool IsThrottling() const; |
| 25 |
| 26 double maximal_throughput() const { return maximal_throughput_; } |
| 23 | 27 |
| 24 private: | 28 private: |
| 25 friend class base::RefCounted<DevToolsNetworkConditions>; | 29 friend class base::RefCounted<DevToolsNetworkConditions>; |
| 26 | 30 |
| 27 virtual ~DevToolsNetworkConditions(); | 31 virtual ~DevToolsNetworkConditions(); |
| 28 | 32 |
| 29 // List of domains that will be affected by network conditions. | 33 // List of domains that will be affected by network conditions. |
| 30 typedef std::vector<std::string> Domains; | 34 typedef std::vector<std::string> Domains; |
| 31 const Domains domains_; | 35 const Domains domains_; |
| 36 const double maximal_throughput_; |
| 32 | 37 |
| 33 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); | 38 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); |
| 34 }; | 39 }; |
| 35 | 40 |
| 36 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 41 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
| OLD | NEW |