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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" | 12 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" |
13 #include "chrome/browser/content_settings/content_settings_origin_identifier_val
ue_map.h" | 13 #include "chrome/browser/content_settings/content_settings_origin_identifier_val
ue_map.h" |
14 #include "chrome/common/content_settings_pattern.h" | 14 #include "chrome/common/content_settings_pattern.h" |
| 15 #include "chrome/common/content_settings_types.h" |
15 | 16 |
16 namespace content_settings { | 17 namespace content_settings { |
17 | 18 |
18 // The class MockProvider is a mock for a non default content settings provider. | 19 // The class MockProvider is a mock for a non default content settings provider. |
19 class MockProvider : public ObservableProvider { | 20 class MockProvider : public ObservableProvider { |
20 public: | 21 public: |
21 MockProvider(); | 22 MockProvider(); |
22 MockProvider(ContentSettingsPattern requesting_url_pattern, | 23 explicit MockProvider(bool read_only); |
23 ContentSettingsPattern embedding_url_pattern, | |
24 ContentSettingsType content_type, | |
25 ResourceIdentifier resource_identifier, | |
26 ContentSetting setting, | |
27 bool read_only, | |
28 bool is_managed); | |
29 virtual ~MockProvider(); | 24 virtual ~MockProvider(); |
30 | 25 |
31 virtual RuleIterator* GetRuleIterator( | 26 virtual RuleIterator* GetRuleIterator( |
32 ContentSettingsType content_type, | 27 ContentSettingsType content_type, |
33 const ResourceIdentifier& resource_identifier, | 28 const ResourceIdentifier& resource_identifier, |
34 bool incognito) const OVERRIDE; | 29 bool incognito) const OVERRIDE; |
35 | 30 |
36 // The MockProvider is only able to store one content setting. So every time | 31 // The MockProvider is only able to store one content setting. So every time |
37 // this method is called the previously set content settings is overwritten. | 32 // this method is called the previously set content settings is overwritten. |
38 virtual bool SetWebsiteSetting( | 33 virtual bool SetWebsiteSetting( |
(...skipping 19 matching lines...) Expand all Loading... |
58 private: | 53 private: |
59 OriginIdentifierValueMap value_map_; | 54 OriginIdentifierValueMap value_map_; |
60 bool read_only_; | 55 bool read_only_; |
61 | 56 |
62 DISALLOW_COPY_AND_ASSIGN(MockProvider); | 57 DISALLOW_COPY_AND_ASSIGN(MockProvider); |
63 }; | 58 }; |
64 | 59 |
65 } // namespace content_settings | 60 } // namespace content_settings |
66 | 61 |
67 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | 62 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ |
OLD | NEW |