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

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

Issue 2802013002: Move BrowsingDataRemoverImpl:: CompletionInhibitor to the public interface (Closed)
Patch Set: Fix profile tests. 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
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 CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover.h" 11 #include "chrome/browser/browsing_data/browsing_data_remover.h"
12 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h"
13 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
14 13
15 // This class can be used to wait for a BrowsingDataRemover to complete 14 // This class can be used to wait for a BrowsingDataRemover to complete
16 // operation. It is not suitable for repeated use. 15 // operation. It is not suitable for repeated use.
17 class BrowsingDataRemoverCompletionObserver 16 class BrowsingDataRemoverCompletionObserver
18 : public BrowsingDataRemover::Observer { 17 : public BrowsingDataRemover::Observer {
19 public: 18 public:
20 explicit BrowsingDataRemoverCompletionObserver(BrowsingDataRemover* remover); 19 explicit BrowsingDataRemoverCompletionObserver(BrowsingDataRemover* remover);
21 ~BrowsingDataRemoverCompletionObserver() override; 20 ~BrowsingDataRemoverCompletionObserver() override;
22 21
23 void BlockUntilCompletion(); 22 void BlockUntilCompletion();
24 23
25 protected: 24 protected:
26 // BrowsingDataRemover::Observer: 25 // BrowsingDataRemover::Observer:
27 void OnBrowsingDataRemoverDone() override; 26 void OnBrowsingDataRemoverDone() override;
28 27
29 private: 28 private:
30 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 29 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
31 ScopedObserver<BrowsingDataRemover, BrowsingDataRemover::Observer> observer_; 30 ScopedObserver<BrowsingDataRemover, BrowsingDataRemover::Observer> observer_;
32 31
33 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverCompletionObserver); 32 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverCompletionObserver);
34 }; 33 };
35 34
36 class BrowsingDataRemoverCompletionInhibitor 35 class BrowsingDataRemoverCompletionInhibitor {
37 : public BrowsingDataRemoverImpl::CompletionInhibitor {
38 public: 36 public:
39 BrowsingDataRemoverCompletionInhibitor(); 37 explicit BrowsingDataRemoverCompletionInhibitor(BrowsingDataRemover* remover);
40 ~BrowsingDataRemoverCompletionInhibitor() override; 38 virtual ~BrowsingDataRemoverCompletionInhibitor();
41 39
42 void BlockUntilNearCompletion(); 40 void BlockUntilNearCompletion();
43 void ContinueToCompletion(); 41 void ContinueToCompletion();
44 42
45 protected: 43 protected:
46 // BrowsingDataRemoverImpl::CompletionInhibitor: 44 virtual void OnBrowsingDataRemoverWouldComplete(
47 void OnBrowsingDataRemoverWouldComplete( 45 const base::Closure& continue_to_completion);
48 BrowsingDataRemoverImpl* remover,
msramek 2017/04/10 13:20:08 I removed this parameter. Since the inhibitor is n
49 const base::Closure& continue_to_completion) override;
50 46
51 private: 47 private:
48 base::WeakPtr<BrowsingDataRemover> remover_;
49
52 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 50 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
53 base::Closure continue_to_completion_callback_; 51 base::Closure continue_to_completion_callback_;
54 52
55 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverCompletionInhibitor); 53 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverCompletionInhibitor);
56 }; 54 };
57 55
58 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_ 56 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698