| 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 COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
| 6 #define COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Same, but specifies a mock interface for time functions for testing. | 55 // Same, but specifies a mock interface for time functions for testing. |
| 56 DomainReliabilityMonitor( | 56 DomainReliabilityMonitor( |
| 57 const std::string& upload_reporter_string, | 57 const std::string& upload_reporter_string, |
| 58 scoped_refptr<base::SingleThreadTaskRunner> pref_thread, | 58 scoped_refptr<base::SingleThreadTaskRunner> pref_thread, |
| 59 scoped_refptr<base::SingleThreadTaskRunner> network_thread, | 59 scoped_refptr<base::SingleThreadTaskRunner> network_thread, |
| 60 scoped_ptr<MockableTime> time); | 60 scoped_ptr<MockableTime> time); |
| 61 | 61 |
| 62 // Must be called from the pref thread if |MoveToNetworkThread| was not | 62 // Must be called from the pref thread if |MoveToNetworkThread| was not |
| 63 // called, or from the network thread if it was called. | 63 // called, or from the network thread if it was called. |
| 64 virtual ~DomainReliabilityMonitor(); | 64 ~DomainReliabilityMonitor() override; |
| 65 | 65 |
| 66 // Must be called before |InitURLRequestContext| on the same thread on which | 66 // Must be called before |InitURLRequestContext| on the same thread on which |
| 67 // the Monitor was constructed. Moves (most of) the Monitor to the network | 67 // the Monitor was constructed. Moves (most of) the Monitor to the network |
| 68 // thread passed in the constructor. | 68 // thread passed in the constructor. |
| 69 void MoveToNetworkThread(); | 69 void MoveToNetworkThread(); |
| 70 | 70 |
| 71 // All public methods below this point must be called on the network thread | 71 // All public methods below this point must be called on the network thread |
| 72 // after |MoveToNetworkThread| is called on the pref thread. | 72 // after |MoveToNetworkThread| is called on the pref thread. |
| 73 | 73 |
| 74 // Initializes the Monitor's URLRequestContextGetter. | 74 // Initializes the Monitor's URLRequestContextGetter. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 // |SetDiscardUploads|. | 92 // |SetDiscardUploads|. |
| 93 void OnBeforeRedirect(net::URLRequest* request); | 93 void OnBeforeRedirect(net::URLRequest* request); |
| 94 | 94 |
| 95 // Should be called when |request| is complete. Will examine and possibly | 95 // Should be called when |request| is complete. Will examine and possibly |
| 96 // log the (final) request. |started| should be true if the request was | 96 // log the (final) request. |started| should be true if the request was |
| 97 // actually started before it was terminated. Must be called after | 97 // actually started before it was terminated. Must be called after |
| 98 // |SetDiscardUploads|. | 98 // |SetDiscardUploads|. |
| 99 void OnCompleted(net::URLRequest* request, bool started); | 99 void OnCompleted(net::URLRequest* request, bool started); |
| 100 | 100 |
| 101 // net::NetworkChangeNotifier::NetworkChangeObserver implementation: | 101 // net::NetworkChangeNotifier::NetworkChangeObserver implementation: |
| 102 virtual void OnNetworkChanged( | 102 void OnNetworkChanged( |
| 103 net::NetworkChangeNotifier::ConnectionType type) override; | 103 net::NetworkChangeNotifier::ConnectionType type) override; |
| 104 | 104 |
| 105 // Called to remove browsing data. With CLEAR_BEACONS, leaves contexts in | 105 // Called to remove browsing data. With CLEAR_BEACONS, leaves contexts in |
| 106 // place but clears beacons (which betray browsing history); with | 106 // place but clears beacons (which betray browsing history); with |
| 107 // CLEAR_CONTEXTS, removes all contexts (which can behave as cookies). | 107 // CLEAR_CONTEXTS, removes all contexts (which can behave as cookies). |
| 108 void ClearBrowsingData(DomainReliabilityClearMode mode); | 108 void ClearBrowsingData(DomainReliabilityClearMode mode); |
| 109 | 109 |
| 110 // Gets a Value containing data that can be formatted into a web page for | 110 // Gets a Value containing data that can be formatted into a web page for |
| 111 // debugging purposes. | 111 // debugging purposes. |
| 112 scoped_ptr<base::Value> GetWebUIData() const; | 112 scoped_ptr<base::Value> GetWebUIData() const; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 bool discard_uploads_set_; | 172 bool discard_uploads_set_; |
| 173 | 173 |
| 174 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_; | 174 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_; |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); | 176 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace domain_reliability | 179 } // namespace domain_reliability |
| 180 | 180 |
| 181 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 181 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
| OLD | NEW |