Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: components/domain_reliability/monitor.h

Issue 238863005: Domain Reliability: Remove browsing data when requested. (Closed) Base URL: http://git.chromium.org/chromium/src.git@domrel_bakedin
Patch Set: ...and fix BrowsingDataRemoverTet Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/domain_reliability/context.cc ('k') | components/domain_reliability/monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "components/domain_reliability/beacon.h" 12 #include "components/domain_reliability/beacon.h"
13 #include "components/domain_reliability/clear_mode.h"
13 #include "components/domain_reliability/config.h" 14 #include "components/domain_reliability/config.h"
14 #include "components/domain_reliability/context.h" 15 #include "components/domain_reliability/context.h"
15 #include "components/domain_reliability/dispatcher.h" 16 #include "components/domain_reliability/dispatcher.h"
16 #include "components/domain_reliability/domain_reliability_export.h" 17 #include "components/domain_reliability/domain_reliability_export.h"
17 #include "components/domain_reliability/scheduler.h" 18 #include "components/domain_reliability/scheduler.h"
18 #include "components/domain_reliability/uploader.h" 19 #include "components/domain_reliability/uploader.h"
19 #include "components/domain_reliability/util.h" 20 #include "components/domain_reliability/util.h"
20 #include "net/base/load_timing_info.h" 21 #include "net/base/load_timing_info.h"
21 #include "net/http/http_response_info.h" 22 #include "net/http/http_response_info.h"
22 #include "net/url_request/url_request_status.h" 23 #include "net/url_request/url_request_status.h"
(...skipping 24 matching lines...) Expand all
47 48
48 // Should be called when |request| is about to follow a redirect. Will 49 // Should be called when |request| is about to follow a redirect. Will
49 // examine and possibly log the redirect request. 50 // examine and possibly log the redirect request.
50 void OnBeforeRedirect(net::URLRequest* request); 51 void OnBeforeRedirect(net::URLRequest* request);
51 52
52 // Should be called when |request| is complete. Will examine and possibly 53 // Should be called when |request| is complete. Will examine and possibly
53 // log the (final) request. (|started| should be true if the request was 54 // log the (final) request. (|started| should be true if the request was
54 // actually started before it was terminated.) 55 // actually started before it was terminated.)
55 void OnCompleted(net::URLRequest* request, bool started); 56 void OnCompleted(net::URLRequest* request, bool started);
56 57
58 // Called to remove browsing data. With CLEAR_BEACONS, leaves contexts in
59 // place but clears beacons (which betray browsing history); with
60 // CLEAR_CONTEXTS, removes all contexts (which can behave as cookies).
61 void ClearBrowsingData(DomainReliabilityClearMode mode);
62
57 DomainReliabilityContext* AddContextForTesting( 63 DomainReliabilityContext* AddContextForTesting(
58 scoped_ptr<const DomainReliabilityConfig> config); 64 scoped_ptr<const DomainReliabilityConfig> config);
59 65
60 size_t contexts_size_for_testing() const { return contexts_.size(); } 66 size_t contexts_size_for_testing() const { return contexts_.size(); }
67 bool was_cleared_for_testing() const { return was_cleared_; }
68 DomainReliabilityClearMode cleared_mode_for_testing() const {
69 return cleared_mode_;
70 }
61 71
62 private: 72 private:
63 friend class DomainReliabilityMonitorTest; 73 friend class DomainReliabilityMonitorTest;
64 74
65 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; 75 typedef std::map<std::string, DomainReliabilityContext*> ContextMap;
66 76
67 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { 77 struct DOMAIN_RELIABILITY_EXPORT RequestInfo {
68 RequestInfo(); 78 RequestInfo();
69 explicit RequestInfo(const net::URLRequest& request); 79 explicit RequestInfo(const net::URLRequest& request);
70 ~RequestInfo(); 80 ~RequestInfo();
71 81
72 bool AccessedNetwork() const; 82 bool AccessedNetwork() const;
73 83
74 GURL url; 84 GURL url;
75 net::URLRequestStatus status; 85 net::URLRequestStatus status;
76 net::HttpResponseInfo response_info; 86 net::HttpResponseInfo response_info;
77 int load_flags; 87 int load_flags;
78 net::LoadTimingInfo load_timing_info; 88 net::LoadTimingInfo load_timing_info;
79 bool is_upload; 89 bool is_upload;
80 }; 90 };
81 91
82 // Creates a context, adds it to the monitor, and returns a pointer to it. 92 // Creates a context, adds it to the monitor, and returns a pointer to it.
83 // (The pointer is only valid until the Monitor is destroyed.) 93 // (The pointer is only valid until the Monitor is destroyed.)
84 DomainReliabilityContext* AddContext( 94 DomainReliabilityContext* AddContext(
85 scoped_ptr<const DomainReliabilityConfig> config); 95 scoped_ptr<const DomainReliabilityConfig> config);
96 // Deletes all contexts from |contexts_| and clears the map.
97 void ClearContexts();
86 void OnRequestLegComplete(const RequestInfo& info); 98 void OnRequestLegComplete(const RequestInfo& info);
87 99
88 scoped_ptr<MockableTime> time_; 100 scoped_ptr<MockableTime> time_;
89 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 101 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
90 const std::string upload_reporter_string_; 102 const std::string upload_reporter_string_;
91 DomainReliabilityScheduler::Params scheduler_params_; 103 DomainReliabilityScheduler::Params scheduler_params_;
92 DomainReliabilityDispatcher dispatcher_; 104 DomainReliabilityDispatcher dispatcher_;
93 scoped_ptr<DomainReliabilityUploader> uploader_; 105 scoped_ptr<DomainReliabilityUploader> uploader_;
94 ContextMap contexts_; 106 ContextMap contexts_;
95 107
108 bool was_cleared_;
109 DomainReliabilityClearMode cleared_mode_;
110
96 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); 111 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor);
97 }; 112 };
98 113
99 } // namespace domain_reliability 114 } // namespace domain_reliability
100 115
101 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ 116 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_
OLDNEW
« no previous file with comments | « components/domain_reliability/context.cc ('k') | components/domain_reliability/monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698