Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / content_settings / core / browser / content_settings_rule.h
blob6305c8c3fb2f24dd39e6a11348886a5972662bd4
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
3 // found in the LICENSE file.
5 // Interface for objects providing content setting rules.
7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
8 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "base/synchronization/lock.h"
15 #include "base/values.h"
16 #include "components/content_settings/core/common/content_settings_pattern.h"
18 namespace content_settings {
20 struct Rule {
21 Rule();
22 // Rule takes ownership of |value|.
23 Rule(const ContentSettingsPattern& primary_pattern,
24 const ContentSettingsPattern& secondary_pattern,
25 base::Value* value);
26 ~Rule();
28 ContentSettingsPattern primary_pattern;
29 ContentSettingsPattern secondary_pattern;
30 linked_ptr<base::Value> value;
33 class RuleIterator {
34 public:
35 virtual ~RuleIterator();
36 virtual bool HasNext() const = 0;
37 virtual Rule Next() = 0;
40 class EmptyRuleIterator : public RuleIterator {
41 public:
42 ~EmptyRuleIterator() override;
43 bool HasNext() const override;
44 Rule Next() override;
47 class ConcatenationIterator : public RuleIterator {
48 public:
49 // ConcatenationIterator takes ownership of the pointers in the |iterators|
50 // list and |auto_lock|. |auto_lock| can be NULL if no locking is needed.
51 ConcatenationIterator(ScopedVector<RuleIterator>* iterators,
52 base::AutoLock* auto_lock);
53 ~ConcatenationIterator() override;
54 bool HasNext() const override;
55 Rule Next() override;
57 private:
58 ScopedVector<RuleIterator> iterators_;
59 scoped_ptr<base::AutoLock> auto_lock_;
62 } // namespace content_settings
64 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_