OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/content_settings/content_settings_store. h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "components/content_settings/core/browser/content_settings_rule.h" | 8 #include "components/content_settings/core/browser/content_settings_rule.h" |
9 #include "components/content_settings/core/browser/content_settings_utils.h" | 9 #include "components/content_settings/core/browser/content_settings_utils.h" |
10 #include "components/content_settings/core/browser/host_content_settings_map.h" | |
raymes
2015/12/07 03:02:30
How come you added this?
johnme
2015/12/07 11:28:51
Oops - removed.
| |
11 #include "components/content_settings/core/test/content_settings_test_utils.h" | |
10 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
13 | 15 |
14 using ::testing::Mock; | 16 using ::testing::Mock; |
15 | 17 |
16 namespace extensions { | 18 namespace extensions { |
17 | 19 |
18 namespace { | 20 namespace { |
19 | 21 |
(...skipping 28 matching lines...) Expand all Loading... | |
48 | 50 |
49 ContentSetting GetContentSettingFromStore( | 51 ContentSetting GetContentSettingFromStore( |
50 const ContentSettingsStore* store, | 52 const ContentSettingsStore* store, |
51 const GURL& primary_url, const GURL& secondary_url, | 53 const GURL& primary_url, const GURL& secondary_url, |
52 ContentSettingsType content_type, | 54 ContentSettingsType content_type, |
53 const std::string& resource_identifier, | 55 const std::string& resource_identifier, |
54 bool incognito) { | 56 bool incognito) { |
55 scoped_ptr<content_settings::RuleIterator> rule_iterator( | 57 scoped_ptr<content_settings::RuleIterator> rule_iterator( |
56 store->GetRuleIterator(content_type, resource_identifier, incognito)); | 58 store->GetRuleIterator(content_type, resource_identifier, incognito)); |
57 scoped_ptr<base::Value> setting( | 59 scoped_ptr<base::Value> setting( |
58 content_settings::GetContentSettingValueAndPatterns( | 60 content_settings::TestUtils::GetContentSettingValueAndPatterns( |
59 rule_iterator.get(), primary_url, secondary_url, NULL, NULL)); | 61 rule_iterator.get(), primary_url, secondary_url, NULL, NULL)); |
60 return content_settings::ValueToContentSetting(setting.get()); | 62 return content_settings::ValueToContentSetting(setting.get()); |
61 } | 63 } |
62 | 64 |
63 void GetSettingsForOneTypeFromStore( | 65 void GetSettingsForOneTypeFromStore( |
64 const ContentSettingsStore* store, | 66 const ContentSettingsStore* store, |
65 ContentSettingsType content_type, | 67 ContentSettingsType content_type, |
66 const std::string& resource_identifier, | 68 const std::string& resource_identifier, |
67 bool incognito, | 69 bool incognito, |
68 std::vector<content_settings::Rule>* rules) { | 70 std::vector<content_settings::Rule>* rules) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 | 246 |
245 // Uninstall second extension. | 247 // Uninstall second extension. |
246 store()->UnregisterExtension(ext_id_2); | 248 store()->UnregisterExtension(ext_id_2); |
247 | 249 |
248 GetSettingsForOneTypeFromStore( | 250 GetSettingsForOneTypeFromStore( |
249 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); | 251 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); |
250 ASSERT_EQ(0u, rules.size()); | 252 ASSERT_EQ(0u, rules.size()); |
251 } | 253 } |
252 | 254 |
253 } // namespace extensions | 255 } // namespace extensions |
OLD | NEW |