OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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/website_settings_registry.h" | 5 #include "components/content_settings/core/browser/website_settings_registry.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/content_settings/core/common/content_settings.h" | 8 #include "components/content_settings/core/common/content_settings.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 return nullptr; | 49 return nullptr; |
50 } | 50 } |
51 | 51 |
52 const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register( | 52 const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register( |
53 ContentSettingsType type, | 53 ContentSettingsType type, |
54 const std::string& name, | 54 const std::string& name, |
55 scoped_ptr<base::Value> initial_default_value, | 55 scoped_ptr<base::Value> initial_default_value, |
56 WebsiteSettingsInfo::SyncStatus sync_status, | 56 WebsiteSettingsInfo::SyncStatus sync_status, |
57 WebsiteSettingsInfo::LossyStatus lossy_status, | 57 WebsiteSettingsInfo::LossyStatus lossy_status, |
58 WebsiteSettingsInfo::ScopingType scoping_type) { | 58 WebsiteSettingsInfo::ScopingType scoping_type, |
| 59 WebsiteSettingsInfo::IncognitoBehavior incognito_behavior) { |
59 WebsiteSettingsInfo* info = | 60 WebsiteSettingsInfo* info = |
60 new WebsiteSettingsInfo(type, name, initial_default_value.Pass(), | 61 new WebsiteSettingsInfo(type, name, initial_default_value.Pass(), |
61 sync_status, lossy_status, scoping_type); | 62 sync_status, lossy_status, scoping_type, |
| 63 incognito_behavior); |
62 website_settings_info_.set(info->type(), make_scoped_ptr(info)); | 64 website_settings_info_.set(info->type(), make_scoped_ptr(info)); |
63 return info; | 65 return info; |
64 } | 66 } |
65 | 67 |
66 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::begin() const { | 68 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::begin() const { |
67 return const_iterator(website_settings_info_.begin()); | 69 return const_iterator(website_settings_info_.begin()); |
68 } | 70 } |
69 | 71 |
70 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::end() const { | 72 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::end() const { |
71 return const_iterator(website_settings_info_.end()); | 73 return const_iterator(website_settings_info_.end()); |
72 } | 74 } |
73 | 75 |
74 void WebsiteSettingsRegistry::Init() { | 76 void WebsiteSettingsRegistry::Init() { |
75 // TODO(raymes): This registration code should not have to be in a single | 77 // TODO(raymes): This registration code should not have to be in a single |
76 // location. It should be possible to register a setting from the code | 78 // location. It should be possible to register a setting from the code |
77 // associated with it. | 79 // associated with it. |
78 | 80 |
79 // WARNING: The string names of the permissions passed in below are used to | 81 // WARNING: The string names of the permissions passed in below are used to |
80 // generate preference names and should never be changed! | 82 // generate preference names and should never be changed! |
81 | 83 |
82 // Website settings. | 84 // Website settings. |
83 Register(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 85 Register(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
84 "auto-select-certificate", nullptr, WebsiteSettingsInfo::UNSYNCABLE, | 86 "auto-select-certificate", nullptr, WebsiteSettingsInfo::UNSYNCABLE, |
85 WebsiteSettingsInfo::NOT_LOSSY, | 87 WebsiteSettingsInfo::NOT_LOSSY, |
86 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE); | 88 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, |
| 89 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
87 Register(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions", | 90 Register(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions", |
88 nullptr, WebsiteSettingsInfo::UNSYNCABLE, | 91 nullptr, WebsiteSettingsInfo::UNSYNCABLE, |
89 WebsiteSettingsInfo::NOT_LOSSY, | 92 WebsiteSettingsInfo::NOT_LOSSY, |
90 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE); | 93 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, |
| 94 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
91 Register(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner", nullptr, | 95 Register(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner", nullptr, |
92 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, | 96 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, |
93 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE); | 97 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, |
| 98 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
94 Register(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, "site-engagement", nullptr, | 99 Register(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, "site-engagement", nullptr, |
95 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, | 100 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, |
96 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE); | 101 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, |
| 102 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
97 Register(CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, "usb-chooser-data", nullptr, | 103 Register(CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, "usb-chooser-data", nullptr, |
98 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, | 104 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, |
99 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE); | 105 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 106 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
100 } | 107 } |
101 | 108 |
102 } // namespace content_settings | 109 } // namespace content_settings |
OLD | NEW |