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

Side by Side Diff: components/content_settings/core/browser/content_settings_rule.h

Issue 2318223002: Remove EmptyRuleIterators with nullptrs. (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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Interface for objects providing content setting rules. 5 // Interface for objects providing content setting rules.
6 6
7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_ 7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
8 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_ 8 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 21 matching lines...) Expand all
32 linked_ptr<base::Value> value; 32 linked_ptr<base::Value> value;
33 }; 33 };
34 34
35 class RuleIterator { 35 class RuleIterator {
36 public: 36 public:
37 virtual ~RuleIterator(); 37 virtual ~RuleIterator();
38 virtual bool HasNext() const = 0; 38 virtual bool HasNext() const = 0;
39 virtual Rule Next() = 0; 39 virtual Rule Next() = 0;
40 }; 40 };
41 41
42 class EmptyRuleIterator : public RuleIterator {
43 public:
44 ~EmptyRuleIterator() override;
45 bool HasNext() const override;
46 Rule Next() override;
47 };
48
49 class ConcatenationIterator : public RuleIterator { 42 class ConcatenationIterator : public RuleIterator {
50 public: 43 public:
51 // ConcatenationIterator takes ownership of the pointers in the |iterators| 44 // ConcatenationIterator takes ownership of the pointers in the |iterators|
52 // list and |auto_lock|. |auto_lock| can be NULL if no locking is needed. 45 // list and |auto_lock|. |auto_lock| can be NULL if no locking is needed.
53 ConcatenationIterator(std::vector<std::unique_ptr<RuleIterator>> iterators, 46 ConcatenationIterator(std::vector<std::unique_ptr<RuleIterator>> iterators,
54 base::AutoLock* auto_lock); 47 base::AutoLock* auto_lock);
55 ~ConcatenationIterator() override; 48 ~ConcatenationIterator() override;
56 bool HasNext() const override; 49 bool HasNext() const override;
57 Rule Next() override; 50 Rule Next() override;
58 51
59 private: 52 private:
60 std::vector<std::unique_ptr<RuleIterator>> iterators_; 53 std::vector<std::unique_ptr<RuleIterator>> iterators_;
61 std::unique_ptr<base::AutoLock> auto_lock_; 54 std::unique_ptr<base::AutoLock> auto_lock_;
62 }; 55 };
63 56
64 } // namespace content_settings 57 } // namespace content_settings
65 58
66 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_ 59 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698