OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #include "components/content_settings/core/browser/content_settings_global_value
_map.h" | 5 #include "components/content_settings/core/browser/content_settings_global_value
_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "components/content_settings/core/browser/content_settings_rule.h" | 11 #include "components/content_settings/core/browser/content_settings_rule.h" |
12 #include "components/content_settings/core/common/content_settings.h" | 12 #include "components/content_settings/core/common/content_settings.h" |
13 | 13 |
14 namespace content_settings { | 14 namespace content_settings { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class RuleIteratorSimple : public RuleIterator { | 18 class RuleIteratorSimple : public RuleIterator { |
19 public: | 19 public: |
20 RuleIteratorSimple(ContentSetting setting) : setting_(setting) {} | 20 RuleIteratorSimple(ContentSetting setting) : setting_(setting) {} |
21 | 21 |
22 bool HasNext() const override { return !is_done_; } | 22 bool HasNext() const override { return !is_done_; } |
23 | 23 |
24 Rule Next() override { | 24 Rule Next() override { |
25 DCHECK(HasNext()); | 25 DCHECK(HasNext()); |
26 is_done_ = true; | 26 is_done_ = true; |
27 return Rule(ContentSettingsPattern::Wildcard(), | 27 return Rule(ContentSettingsPattern::Wildcard(), |
28 ContentSettingsPattern::Wildcard(), | 28 ContentSettingsPattern::Wildcard(), new base::Value(setting_)); |
29 new base::FundamentalValue(setting_)); | |
30 } | 29 } |
31 | 30 |
32 private: | 31 private: |
33 const ContentSetting setting_; | 32 const ContentSetting setting_; |
34 bool is_done_ = false; | 33 bool is_done_ = false; |
35 | 34 |
36 DISALLOW_COPY_AND_ASSIGN(RuleIteratorSimple); | 35 DISALLOW_COPY_AND_ASSIGN(RuleIteratorSimple); |
37 }; | 36 }; |
38 | 37 |
39 } // namespace | 38 } // namespace |
(...skipping 23 matching lines...) Expand all Loading... |
63 settings_[content_type] = setting; | 62 settings_[content_type] = setting; |
64 } | 63 } |
65 | 64 |
66 ContentSetting GlobalValueMap::GetContentSetting( | 65 ContentSetting GlobalValueMap::GetContentSetting( |
67 ContentSettingsType content_type) const { | 66 ContentSettingsType content_type) const { |
68 auto it = settings_.find(content_type); | 67 auto it = settings_.find(content_type); |
69 return it == settings_.end() ? CONTENT_SETTING_DEFAULT : it->second; | 68 return it == settings_.end() ? CONTENT_SETTING_DEFAULT : it->second; |
70 } | 69 } |
71 | 70 |
72 } // namespace content_settings | 71 } // namespace content_settings |
OLD | NEW |