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 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ |
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/content_settings/core/common/content_settings.h" | 13 #include "components/content_settings/core/common/content_settings.h" |
14 | 14 |
15 namespace content_settings { | 15 namespace content_settings { |
16 | 16 |
17 class WebsiteSettingsInfo; | 17 class WebsiteSettingsInfo; |
18 | 18 |
19 class ContentSettingsInfo { | 19 class ContentSettingsInfo { |
20 public: | 20 public: |
| 21 enum IncognitoBehavior { |
| 22 // Content setting will be inherited from regular to incognito profiles |
| 23 // as usual. |
| 24 INHERIT_IN_INCOGNITO, |
| 25 |
| 26 // Content setting will only partially inherit from regular to incognito |
| 27 // profiles: BLOCK will inherit as usual, but ALLOW will become ASK. |
| 28 // This is unusual, so seek privacy review before using this. |
| 29 INHERIT_IN_INCOGNITO_EXCEPT_ALLOW |
| 30 }; |
| 31 |
21 // This object does not take ownership of |website_settings_info|. | 32 // This object does not take ownership of |website_settings_info|. |
22 ContentSettingsInfo(const WebsiteSettingsInfo* website_settings_info, | 33 ContentSettingsInfo(const WebsiteSettingsInfo* website_settings_info, |
23 const std::vector<std::string>& whitelisted_schemes, | 34 const std::vector<std::string>& whitelisted_schemes, |
24 const std::set<ContentSetting>& valid_settings); | 35 const std::set<ContentSetting>& valid_settings, |
| 36 IncognitoBehavior incognito_behavior); |
25 ~ContentSettingsInfo(); | 37 ~ContentSettingsInfo(); |
26 | 38 |
27 const WebsiteSettingsInfo* website_settings_info() const { | 39 const WebsiteSettingsInfo* website_settings_info() const { |
28 return website_settings_info_; | 40 return website_settings_info_; |
29 } | 41 } |
30 const std::vector<std::string>& whitelisted_schemes() const { | 42 const std::vector<std::string>& whitelisted_schemes() const { |
31 return whitelisted_schemes_; | 43 return whitelisted_schemes_; |
32 } | 44 } |
33 | 45 |
34 bool IsSettingValid(ContentSetting setting) const; | 46 bool IsSettingValid(ContentSetting setting) const; |
35 | 47 |
| 48 IncognitoBehavior incognito_behavior() const { return incognito_behavior_; } |
| 49 |
36 private: | 50 private: |
37 const WebsiteSettingsInfo* website_settings_info_; | 51 const WebsiteSettingsInfo* website_settings_info_; |
38 const std::vector<std::string> whitelisted_schemes_; | 52 const std::vector<std::string> whitelisted_schemes_; |
39 const std::set<ContentSetting> valid_settings_; | 53 const std::set<ContentSetting> valid_settings_; |
| 54 const IncognitoBehavior incognito_behavior_; |
40 | 55 |
41 DISALLOW_COPY_AND_ASSIGN(ContentSettingsInfo); | 56 DISALLOW_COPY_AND_ASSIGN(ContentSettingsInfo); |
42 }; | 57 }; |
43 | 58 |
44 } // namespace content_settings | 59 } // namespace content_settings |
45 | 60 |
46 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ | 61 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ |
OLD | NEW |