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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.h

Issue 2802013002: Move BrowsingDataRemoverImpl:: CompletionInhibitor to the public interface (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | chrome/browser/browsing_data/browsing_data_remover_impl.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 class Observer { 120 class Observer {
121 public: 121 public:
122 // Called when a removal task is finished. Note that every removal task can 122 // Called when a removal task is finished. Note that every removal task can
123 // only have one observer attached to it, and only that one is called. 123 // only have one observer attached to it, and only that one is called.
124 virtual void OnBrowsingDataRemoverDone() = 0; 124 virtual void OnBrowsingDataRemoverDone() = 0;
125 125
126 protected: 126 protected:
127 virtual ~Observer() {} 127 virtual ~Observer() {}
128 }; 128 };
129 129
130 // The completion inhibitor can artificially delay completion of the browsing
131 // data removal process. It is used during testing to simulate scenarios in
132 // which the deletion stalls or takes a very long time.
133 class CompletionInhibitor {
134 public:
135 // Invoked when a |remover| is just about to complete clearing browser data,
136 // and will be prevented from completing until after the callback
137 // |continue_to_completion| is run.
138 virtual void OnBrowsingDataRemoverWouldComplete(
Bernhard Bauer 2017/04/06 15:13:07 You could consider replacing this with a Callback.
msramek 2017/04/07 10:58:42 Note that we're in content/public, so everything n
Bernhard Bauer 2017/04/07 15:14:17 No, what I meant was replacing the whole Completio
msramek 2017/04/10 13:20:08 Got it. Done. I changed the naming to WouldComplet
139 BrowsingDataRemover* remover,
140 const base::Closure& continue_to_completion) = 0;
141
142 protected:
143 virtual ~CompletionInhibitor() {}
144 };
145
130 // Called by the embedder to provide the delegate that will take care of 146 // Called by the embedder to provide the delegate that will take care of
131 // deleting embedder-specific data. 147 // deleting embedder-specific data.
132 virtual void SetEmbedderDelegate( 148 virtual void SetEmbedderDelegate(
133 std::unique_ptr<BrowsingDataRemoverDelegate> embedder_delegate) = 0; 149 std::unique_ptr<BrowsingDataRemoverDelegate> embedder_delegate) = 0;
134 virtual BrowsingDataRemoverDelegate* GetEmbedderDelegate() const = 0; 150 virtual BrowsingDataRemoverDelegate* GetEmbedderDelegate() const = 0;
135 151
136 // Determines whether |origin| matches the |origin_type_mask| according to 152 // Determines whether |origin| matches the |origin_type_mask| according to
137 // the |special_storage_policy|. 153 // the |special_storage_policy|.
138 virtual bool DoesOriginMatchMask( 154 virtual bool DoesOriginMatchMask(
139 int origin_type_mask, 155 int origin_type_mask,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const base::Time& delete_end, 188 const base::Time& delete_end,
173 int remove_mask, 189 int remove_mask,
174 int origin_type_mask, 190 int origin_type_mask,
175 std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder, 191 std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder,
176 Observer* observer) = 0; 192 Observer* observer) = 0;
177 193
178 // Observers. 194 // Observers.
179 virtual void AddObserver(Observer* observer) = 0; 195 virtual void AddObserver(Observer* observer) = 0;
180 virtual void RemoveObserver(Observer* observer) = 0; 196 virtual void RemoveObserver(Observer* observer) = 0;
181 197
198 // Sets a CompletionInhibitor, which will be notified each time an instance is
199 // about to complete a browsing data removal process, and will be able to
200 // artificially delay the completion.
201 virtual void SetCompletionInhibitorForTesting(
202 CompletionInhibitor* inhibitor) = 0;
203
182 // Parameters of the last call are exposed to be used by tests. Removal and 204 // Parameters of the last call are exposed to be used by tests. Removal and
183 // origin type masks equal to -1 mean that no removal has ever been executed. 205 // origin type masks equal to -1 mean that no removal has ever been executed.
184 // TODO(msramek): If other consumers than tests are interested in this, 206 // TODO(msramek): If other consumers than tests are interested in this,
185 // consider returning them in OnBrowsingDataRemoverDone() callback. If not, 207 // consider returning them in OnBrowsingDataRemoverDone() callback. If not,
186 // consider simplifying this interface by removing these methods and changing 208 // consider simplifying this interface by removing these methods and changing
187 // the tests to record the parameters using GMock instead. 209 // the tests to record the parameters using GMock instead.
188 virtual const base::Time& GetLastUsedBeginTime() = 0; 210 virtual const base::Time& GetLastUsedBeginTime() = 0;
189 virtual const base::Time& GetLastUsedEndTime() = 0; 211 virtual const base::Time& GetLastUsedEndTime() = 0;
190 virtual int GetLastUsedRemovalMask() = 0; 212 virtual int GetLastUsedRemovalMask() = 0;
191 virtual int GetLastUsedOriginTypeMask() = 0; 213 virtual int GetLastUsedOriginTypeMask() = 0;
192 }; 214 };
193 215
194 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 216 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698