OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" | |
12 #include "components/content_settings/core/browser/content_settings_origin_ident
ifier_value_map.h" | |
13 #include "components/content_settings/core/common/content_settings_pattern.h" | |
14 #include "components/content_settings/core/common/content_settings_types.h" | |
15 | |
16 namespace content_settings { | |
17 | |
18 // The class MockProvider is a mock for a non default content settings provider. | |
19 class MockProvider : public ObservableProvider { | |
20 public: | |
21 MockProvider(); | |
22 explicit MockProvider(bool read_only); | |
23 ~MockProvider() override; | |
24 | |
25 RuleIterator* GetRuleIterator(ContentSettingsType content_type, | |
26 const ResourceIdentifier& resource_identifier, | |
27 bool incognito) const override; | |
28 | |
29 // The MockProvider is only able to store one content setting. So every time | |
30 // this method is called the previously set content settings is overwritten. | |
31 bool SetWebsiteSetting(const ContentSettingsPattern& requesting_url_pattern, | |
32 const ContentSettingsPattern& embedding_url_pattern, | |
33 ContentSettingsType content_type, | |
34 const ResourceIdentifier& resource_identifier, | |
35 base::Value* value) override; | |
36 | |
37 void ClearAllContentSettingsRules(ContentSettingsType content_type) override { | |
38 } | |
39 | |
40 void ShutdownOnUIThread() override; | |
41 | |
42 void set_read_only(bool read_only) { | |
43 read_only_ = read_only; | |
44 } | |
45 | |
46 bool read_only() const { | |
47 return read_only_; | |
48 } | |
49 | |
50 private: | |
51 OriginIdentifierValueMap value_map_; | |
52 bool read_only_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(MockProvider); | |
55 }; | |
56 | |
57 } // namespace content_settings | |
58 | |
59 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_MOCK_PROVIDER_H_ | |
OLD | NEW |