Chromium Code Reviews| 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 { | 21 enum IncognitoBehavior { |
| 22 // Content setting will be inherited from regular to incognito profiles | 22 // Content setting will be inherited from regular to incognito profiles |
| 23 // as usual. | 23 // as usual. |
| 24 INHERIT_IN_INCOGNITO, | 24 INHERIT_IN_INCOGNITO, |
| 25 | 25 |
| 26 // Content setting will only partially inherit from regular to incognito | 26 // Content setting is disallowed in incognito. However, to prevent sites |
| 27 // profiles: BLOCK will inherit as usual, but ALLOW will become ASK. | 27 // from using this setting to detect whether incognito mode is active, the |
| 28 // This is unusual, so seek privacy review before using this. | 28 // actual behavior is more subtle. The content setting will only partially |
| 29 INHERIT_IN_INCOGNITO_EXCEPT_ALLOW | 29 // inherit from regular to incognito profiles: BLOCK will inherit as usual, |
| 30 // but ALLOW will become ASK. Only once the website actually requests the | |
| 31 // permission, will it then be automatically denied after a random time | |
| 32 // delay (simulating a user clicking a bubble/infobar). This is unusual, so | |
| 33 // seek privacy review before using this. | |
| 34 DENY_IN_INCOGNITO_AFTER_DELAY | |
|
raymes
2016/01/12 06:00:41
Now that I think about it, could we instead remove
johnme
2016/01/12 18:04:52
Done. I've moved the main behavior to a simple ove
| |
| 30 }; | 35 }; |
| 31 | 36 |
| 32 // This object does not take ownership of |website_settings_info|. | 37 // This object does not take ownership of |website_settings_info|. |
| 33 ContentSettingsInfo(const WebsiteSettingsInfo* website_settings_info, | 38 ContentSettingsInfo(const WebsiteSettingsInfo* website_settings_info, |
| 34 const std::vector<std::string>& whitelisted_schemes, | 39 const std::vector<std::string>& whitelisted_schemes, |
| 35 const std::set<ContentSetting>& valid_settings, | 40 const std::set<ContentSetting>& valid_settings, |
| 36 IncognitoBehavior incognito_behavior); | 41 IncognitoBehavior incognito_behavior); |
| 37 ~ContentSettingsInfo(); | 42 ~ContentSettingsInfo(); |
| 38 | 43 |
| 39 const WebsiteSettingsInfo* website_settings_info() const { | 44 const WebsiteSettingsInfo* website_settings_info() const { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 52 const std::vector<std::string> whitelisted_schemes_; | 57 const std::vector<std::string> whitelisted_schemes_; |
| 53 const std::set<ContentSetting> valid_settings_; | 58 const std::set<ContentSetting> valid_settings_; |
| 54 const IncognitoBehavior incognito_behavior_; | 59 const IncognitoBehavior incognito_behavior_; |
| 55 | 60 |
| 56 DISALLOW_COPY_AND_ASSIGN(ContentSettingsInfo); | 61 DISALLOW_COPY_AND_ASSIGN(ContentSettingsInfo); |
| 57 }; | 62 }; |
| 58 | 63 |
| 59 } // namespace content_settings | 64 } // namespace content_settings |
| 60 | 65 |
| 61 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ | 66 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_INFO_H_ |
| OLD | NEW |