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 #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 <utility> | 7 #include <utility> |
| 8 | 8 #include <iostream> |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 base::LazyInstance<content_settings::WebsiteSettingsRegistry> g_instance = | 15 base::LazyInstance<content_settings::WebsiteSettingsRegistry> g_instance = |
| 16 LAZY_INSTANCE_INITIALIZER; | 16 LAZY_INSTANCE_INITIALIZER; |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 return nullptr; | 52 return nullptr; |
| 53 } | 53 } |
| 54 | 54 |
| 55 const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register( | 55 const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register( |
| 56 ContentSettingsType type, | 56 ContentSettingsType type, |
| 57 const std::string& name, | 57 const std::string& name, |
| 58 std::unique_ptr<base::Value> initial_default_value, | 58 std::unique_ptr<base::Value> initial_default_value, |
| 59 WebsiteSettingsInfo::SyncStatus sync_status, | 59 WebsiteSettingsInfo::SyncStatus sync_status, |
| 60 WebsiteSettingsInfo::LossyStatus lossy_status, | 60 WebsiteSettingsInfo::LossyStatus lossy_status, |
| 61 WebsiteSettingsInfo::ScopingType scoping_type, | 61 WebsiteSettingsInfo::ScopingType scoping_type, |
| 62 uint32_t platform, | |
| 62 WebsiteSettingsInfo::IncognitoBehavior incognito_behavior) { | 63 WebsiteSettingsInfo::IncognitoBehavior incognito_behavior) { |
| 64 std::cout << "+++++++++" << type << "++++++" << platform << "++++++++" << (plat form & WebsiteSettingsInfo::PLATFORM_IOS) << std::endl; | |
| 65 | |
| 66 #if defined(OS_IOS) | |
| 67 std::cout << "OS_IOS" << std::endl; | |
| 68 #endif | |
| 69 | |
| 70 #if defined(OS_WIN) | |
| 71 if (!(platform & WebsiteSettingsInfo::PLATFORM_WINDOWS)) | |
| 72 return nullptr; | |
| 73 #elif defined(OS_LINUX) | |
| 74 if (!(platform & WebsiteSettingsInfo::PLATFORM_LINUX)) | |
| 75 return nullptr; | |
| 76 #elif defined(OS_MACOSX) | |
| 77 if (!(platform & WebsiteSettingsInfo::PLATFORM_MAC)) | |
| 78 return nullptr; | |
| 79 #elif defined(OS_CHROMEOS) | |
| 80 if (!(platform & WebsiteSettingsInfo::PLATFORM_CHROMEOS)) | |
| 81 return nullptr; | |
| 82 #elif defined(OS_ANDROID) | |
| 83 if (!(platform & WebsiteSettingsInfo::PLATFORM_ANDROID)) | |
| 84 return nullptr; | |
| 85 #elif defined(OS_IOS) | |
|
msramek
2016/05/23 14:49:49
I read the failing test outputs, and I currently s
lshang
2016/05/24 11:55:46
I added some LOGs and found out that on ios-simula
msramek
2016/05/24 14:29:23
Good to know!
Maybe you want to share this on the
| |
| 86 if ((platform & WebsiteSettingsInfo::PLATFORM_IOS) == 0) | |
| 87 return nullptr; | |
| 88 #endif | |
| 89 std::cout << "+++++++++registered++++++++" << std::endl; | |
| 63 WebsiteSettingsInfo* info = new WebsiteSettingsInfo( | 90 WebsiteSettingsInfo* info = new WebsiteSettingsInfo( |
| 64 type, name, std::move(initial_default_value), sync_status, lossy_status, | 91 type, name, std::move(initial_default_value), sync_status, lossy_status, |
| 65 scoping_type, incognito_behavior); | 92 scoping_type, incognito_behavior); |
| 66 website_settings_info_[info->type()] = base::WrapUnique(info); | 93 website_settings_info_[info->type()] = base::WrapUnique(info); |
| 67 return info; | 94 return info; |
| 68 } | 95 } |
| 69 | 96 |
| 70 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::begin() const { | 97 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::begin() const { |
| 71 return const_iterator(website_settings_info_.begin()); | 98 return const_iterator(website_settings_info_.begin()); |
| 72 } | 99 } |
| 73 | 100 |
| 74 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::end() const { | 101 WebsiteSettingsRegistry::const_iterator WebsiteSettingsRegistry::end() const { |
| 75 return const_iterator(website_settings_info_.end()); | 102 return const_iterator(website_settings_info_.end()); |
| 76 } | 103 } |
| 77 | 104 |
| 78 void WebsiteSettingsRegistry::Init() { | 105 void WebsiteSettingsRegistry::Init() { |
| 79 // TODO(raymes): This registration code should not have to be in a single | 106 // TODO(raymes): This registration code should not have to be in a single |
| 80 // location. It should be possible to register a setting from the code | 107 // location. It should be possible to register a setting from the code |
| 81 // associated with it. | 108 // associated with it. |
| 82 | 109 |
| 83 // WARNING: The string names of the permissions passed in below are used to | 110 // WARNING: The string names of the permissions passed in below are used to |
| 84 // generate preference names and should never be changed! | 111 // generate preference names and should never be changed! |
| 85 | 112 |
| 86 // Website settings. | 113 // Website settings. |
| 87 Register(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 114 Register(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 88 "auto-select-certificate", nullptr, WebsiteSettingsInfo::UNSYNCABLE, | 115 "auto-select-certificate", nullptr, WebsiteSettingsInfo::UNSYNCABLE, |
| 89 WebsiteSettingsInfo::NOT_LOSSY, | 116 WebsiteSettingsInfo::NOT_LOSSY, |
| 90 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, | 117 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, |
| 118 WebsiteSettingsInfo::ALL_PLATFORMS, | |
| 91 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); | 119 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
| 92 Register(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions", | 120 Register(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions", |
| 93 nullptr, WebsiteSettingsInfo::UNSYNCABLE, | 121 nullptr, WebsiteSettingsInfo::UNSYNCABLE, |
| 94 WebsiteSettingsInfo::NOT_LOSSY, | 122 WebsiteSettingsInfo::NOT_LOSSY, |
| 95 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, | 123 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, |
| 124 WebsiteSettingsInfo::DESKTOP | WebsiteSettingsInfo::PLATFORM_ANDROID, | |
| 96 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); | 125 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
| 97 Register(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner", nullptr, | 126 Register(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner", nullptr, |
| 98 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, | 127 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, |
| 99 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, | 128 WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE, |
| 129 WebsiteSettingsInfo::DESKTOP | WebsiteSettingsInfo::PLATFORM_ANDROID, | |
| 100 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); | 130 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
| 101 Register(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, "site-engagement", nullptr, | 131 Register(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, "site-engagement", nullptr, |
| 102 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, | 132 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, |
| 103 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, | 133 WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, |
| 134 WebsiteSettingsInfo::DESKTOP | WebsiteSettingsInfo::PLATFORM_ANDROID, | |
| 104 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); | 135 WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); |
| 105 Register(CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, "usb-chooser-data", nullptr, | 136 Register(CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, "usb-chooser-data", nullptr, |
| 106 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, | 137 WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, |
| 107 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, | 138 WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE, |
| 139 WebsiteSettingsInfo::DESKTOP | WebsiteSettingsInfo::PLATFORM_ANDROID, | |
| 108 WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); | 140 WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); |
| 109 } | 141 } |
| 110 | 142 |
| 111 } // namespace content_settings | 143 } // namespace content_settings |
| OLD | NEW |