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

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

Issue 2812113004: Write last_modified date to Content Settings in the PrefProvider (Closed)
Patch Set: Fix Android compilation 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 (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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/time/time.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "components/content_settings/core/common/content_settings_pattern.h" 18 #include "components/content_settings/core/common/content_settings_pattern.h"
18 19
19 namespace content_settings { 20 namespace content_settings {
20 21
21 struct Rule { 22 struct Rule {
22 Rule(); 23 Rule();
23 // Rule takes ownership of |value|. 24 // Rule takes ownership of |value|.
24 Rule(const ContentSettingsPattern& primary_pattern, 25 Rule(const ContentSettingsPattern& primary_pattern,
25 const ContentSettingsPattern& secondary_pattern, 26 const ContentSettingsPattern& secondary_pattern,
27 base::Time last_modified,
26 base::Value* value); 28 base::Value* value);
27 Rule(const Rule& other); 29 Rule(const Rule& other);
28 ~Rule(); 30 ~Rule();
29 31
30 ContentSettingsPattern primary_pattern; 32 ContentSettingsPattern primary_pattern;
31 ContentSettingsPattern secondary_pattern; 33 ContentSettingsPattern secondary_pattern;
34 base::Time last_modified;
32 linked_ptr<base::Value> value; 35 linked_ptr<base::Value> value;
33 }; 36 };
34 37
35 class RuleIterator { 38 class RuleIterator {
36 public: 39 public:
37 virtual ~RuleIterator(); 40 virtual ~RuleIterator();
38 virtual bool HasNext() const = 0; 41 virtual bool HasNext() const = 0;
39 virtual Rule Next() = 0; 42 virtual Rule Next() = 0;
40 }; 43 };
41 44
42 class ConcatenationIterator : public RuleIterator { 45 class ConcatenationIterator : public RuleIterator {
43 public: 46 public:
44 // ConcatenationIterator takes ownership of the pointers in the |iterators| 47 // ConcatenationIterator takes ownership of the pointers in the |iterators|
45 // list and |auto_lock|. |auto_lock| can be NULL if no locking is needed. 48 // list and |auto_lock|. |auto_lock| can be NULL if no locking is needed.
46 ConcatenationIterator(std::vector<std::unique_ptr<RuleIterator>> iterators, 49 ConcatenationIterator(std::vector<std::unique_ptr<RuleIterator>> iterators,
47 base::AutoLock* auto_lock); 50 base::AutoLock* auto_lock);
48 ~ConcatenationIterator() override; 51 ~ConcatenationIterator() override;
49 bool HasNext() const override; 52 bool HasNext() const override;
50 Rule Next() override; 53 Rule Next() override;
51 54
52 private: 55 private:
53 std::vector<std::unique_ptr<RuleIterator>> iterators_; 56 std::vector<std::unique_ptr<RuleIterator>> iterators_;
54 std::unique_ptr<base::AutoLock> auto_lock_; 57 std::unique_ptr<base::AutoLock> auto_lock_;
55 }; 58 };
56 59
57 } // namespace content_settings 60 } // namespace content_settings
58 61
59 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_ 62 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_RULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698