| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/content_settings_mock_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_mock_provider.h" |
| 6 | 6 |
| 7 namespace content_settings { | 7 namespace content_settings { |
| 8 | 8 |
| 9 MockDefaultProvider::MockDefaultProvider( | 9 MockDefaultProvider::MockDefaultProvider( |
| 10 ContentSettingsType content_type, | 10 ContentSettingsType content_type, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void MockDefaultProvider::ResetToDefaults() { | 40 void MockDefaultProvider::ResetToDefaults() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 MockProvider::MockProvider() | 43 MockProvider::MockProvider() |
| 44 : requesting_url_pattern_(ContentSettingsPattern()), | 44 : requesting_url_pattern_(ContentSettingsPattern()), |
| 45 embedding_url_pattern_(ContentSettingsPattern()), | 45 embedding_url_pattern_(ContentSettingsPattern()), |
| 46 content_type_(CONTENT_SETTINGS_TYPE_COOKIES), | 46 content_type_(CONTENT_SETTINGS_TYPE_COOKIES), |
| 47 resource_identifier_(""), | 47 resource_identifier_(""), |
| 48 setting_(CONTENT_SETTING_DEFAULT), | 48 setting_(CONTENT_SETTING_DEFAULT), |
| 49 read_only_(false) {} | 49 read_only_(false), |
| 50 is_managed_(false) {} |
| 50 | 51 |
| 51 MockProvider::MockProvider(ContentSettingsPattern requesting_url_pattern, | 52 MockProvider::MockProvider(ContentSettingsPattern requesting_url_pattern, |
| 52 ContentSettingsPattern embedding_url_pattern, | 53 ContentSettingsPattern embedding_url_pattern, |
| 53 ContentSettingsType content_type, | 54 ContentSettingsType content_type, |
| 54 ResourceIdentifier resource_identifier, | 55 ResourceIdentifier resource_identifier, |
| 55 ContentSetting setting, | 56 ContentSetting setting, |
| 56 bool read_only) | 57 bool read_only, |
| 58 bool is_managed) |
| 57 : requesting_url_pattern_(requesting_url_pattern), | 59 : requesting_url_pattern_(requesting_url_pattern), |
| 58 embedding_url_pattern_(embedding_url_pattern), | 60 embedding_url_pattern_(embedding_url_pattern), |
| 59 content_type_(content_type), | 61 content_type_(content_type), |
| 60 resource_identifier_(resource_identifier), | 62 resource_identifier_(resource_identifier), |
| 61 setting_(setting), | 63 setting_(setting), |
| 62 read_only_(read_only) {} | 64 read_only_(read_only), |
| 65 is_managed_(is_managed) {} |
| 63 | 66 |
| 64 MockProvider::~MockProvider() {} | 67 MockProvider::~MockProvider() {} |
| 65 | 68 |
| 66 ContentSetting MockProvider::GetContentSetting( | 69 ContentSetting MockProvider::GetContentSetting( |
| 67 const GURL& requesting_url, | 70 const GURL& requesting_url, |
| 68 const GURL& embedding_url, | 71 const GURL& embedding_url, |
| 69 ContentSettingsType content_type, | 72 ContentSettingsType content_type, |
| 70 const ResourceIdentifier& resource_identifier) const { | 73 const ResourceIdentifier& resource_identifier) const { |
| 71 if (requesting_url_pattern_.Matches(requesting_url) && | 74 if (requesting_url_pattern_.Matches(requesting_url) && |
| 72 content_type_ == content_type && | 75 content_type_ == content_type && |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 ContentSetting content_setting) { | 87 ContentSetting content_setting) { |
| 85 if (read_only_) | 88 if (read_only_) |
| 86 return; | 89 return; |
| 87 requesting_url_pattern_ = ContentSettingsPattern(requesting_url_pattern); | 90 requesting_url_pattern_ = ContentSettingsPattern(requesting_url_pattern); |
| 88 embedding_url_pattern_ = ContentSettingsPattern(embedding_url_pattern); | 91 embedding_url_pattern_ = ContentSettingsPattern(embedding_url_pattern); |
| 89 content_type_ = content_type; | 92 content_type_ = content_type; |
| 90 resource_identifier_ = resource_identifier; | 93 resource_identifier_ = resource_identifier; |
| 91 setting_ = content_setting; | 94 setting_ = content_setting; |
| 92 } | 95 } |
| 93 | 96 |
| 97 bool MockProvider::ContentSettingsTypeIsManaged(ContentSettingsType type) { |
| 98 if (type == content_type_) { |
| 99 return is_managed_; |
| 100 } |
| 101 return false; |
| 102 } |
| 103 |
| 94 } // namespace content_settings | 104 } // namespace content_settings |
| OLD | NEW |