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 2315443002: Make ClearBrowsingDataHandler only observe its own removal task (Closed)
Patch Set: Created 4 years, 3 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.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // 85 //
86 // void DeleteCookies() { 86 // void DeleteCookies() {
87 // remover->RemoveAndReply(Unbounded(), REMOVE_COOKIES, ALL, this); 87 // remover->RemoveAndReply(Unbounded(), REMOVE_COOKIES, ALL, this);
88 // } 88 // }
89 // 89 //
90 // void OnBrowsingDataRemoverDone() { 90 // void OnBrowsingDataRemoverDone() {
91 // LOG(INFO) << "Cookies were deleted."; 91 // LOG(INFO) << "Cookies were deleted.";
92 // } 92 // }
93 // } 93 // }
94 // 94 //
95 // 3. Using an observer to report when any removal task started or all removal
96 // tasks finished (i.e. when BrowsingDataRemover changes state from idle
97 // to busy and vice versa).
98 //
99 // class BrowsingDataRemoverStatusObsever {
100 // BrowsingDataRemoverStatusObserver() { remover->AddObserver(this); }
101 // ~BrowsingDataRemoverStatusObserver() {
102 // remover->RemoveObserver(this);
103 // }
104 //
105 // void OnBrowsingDataRemoving(bool removing) {
106 // LOG(INFO) << "Remover is now " << (removing ? "busy" : "idle");
107 // }
108 // }
109 //
110 //////////////////////////////////////////////////////////////////////////////// 95 ////////////////////////////////////////////////////////////////////////////////
111 96
112 class BrowsingDataRemover : public KeyedService 97 class BrowsingDataRemover : public KeyedService
113 #if defined(ENABLE_PLUGINS) 98 #if defined(ENABLE_PLUGINS)
114 , public PepperFlashSettingsManager::Client 99 , public PepperFlashSettingsManager::Client
115 #endif 100 #endif
116 { 101 {
117 public: 102 public:
118 // Mask used for Remove. 103 // Mask used for Remove.
119 enum RemoveDataMask { 104 enum RemoveDataMask {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 }; 180 };
196 181
197 struct TimeRange { 182 struct TimeRange {
198 TimeRange(base::Time begin, base::Time end) : begin(begin), end(end) {} 183 TimeRange(base::Time begin, base::Time end) : begin(begin), end(end) {}
199 bool operator==(const TimeRange& other) const; 184 bool operator==(const TimeRange& other) const;
200 185
201 base::Time begin; 186 base::Time begin;
202 base::Time end; 187 base::Time end;
203 }; 188 };
204 189
205 // Observer is notified when the removal is active and when it's done. 190 // Observer is notified when its own removal task is done.
206 // TODO(msramek): The semantics of the two methods are slightly different;
207 // one is called for every observer at the same time, while the other only
208 // for one observer at a time. Split the interface or deprecate
209 // OnBrowsingDataRemoving().
210 class Observer { 191 class Observer {
211 public: 192 public:
212 // NOTE: DEPRECATED; talk to dbeam/msramek before using this.
213 //
214 // Whether removal is active. Note that not having an active removal is not
215 // same as completing a removal. That is why the removing status is separate
216 // from the done message.
217 virtual void OnBrowsingDataRemoving(bool is_removing) {}
218
219 // Called when a removal task is finished. Note that every removal task can 193 // Called when a removal task is finished. Note that every removal task can
220 // only have one observer attached to it, and only that one is called. 194 // only have one observer attached to it, and only that one is called.
221 virtual void OnBrowsingDataRemoverDone() {} 195 virtual void OnBrowsingDataRemoverDone() = 0;
222 196
223 protected: 197 protected:
224 virtual ~Observer() {} 198 virtual ~Observer() {}
225 }; 199 };
226 200
227 // The completion inhibitor can artificially delay completion of the browsing 201 // The completion inhibitor can artificially delay completion of the browsing
228 // data removal process. It is used during testing to simulate scenarios in 202 // data removal process. It is used during testing to simulate scenarios in
229 // which the deletion stalls or takes a very long time. 203 // which the deletion stalls or takes a very long time.
230 class CompletionInhibitor { 204 class CompletionInhibitor {
231 public: 205 public:
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 // not initialised, so the registry must be mocked out. 576 // not initialised, so the registry must be mocked out.
603 std::unique_ptr<WebappRegistry> webapp_registry_; 577 std::unique_ptr<WebappRegistry> webapp_registry_;
604 #endif 578 #endif
605 579
606 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; 580 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_;
607 581
608 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 582 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
609 }; 583 };
610 584
611 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 585 #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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698