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_BASE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "chrome/browser/content_settings/content_settings_provider.h" | 14 #include "chrome/browser/content_settings/content_settings_provider.h" |
15 | 15 |
16 namespace content_settings { | 16 namespace content_settings { |
17 | 17 |
18 typedef std::pair<ContentSettingsType, std::string> | 18 typedef std::pair<ContentSettingsType, std::string> |
19 ContentSettingsTypeResourceIdentifierPair; | 19 ContentSettingsTypeResourceIdentifierPair; |
20 typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting> | 20 typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting> |
21 ResourceContentSettings; | 21 ResourceContentSettings; |
22 | 22 |
23 struct ExtendedContentSettings { | 23 struct ExtendedContentSettings { |
| 24 ExtendedContentSettings(); |
| 25 ExtendedContentSettings(const ExtendedContentSettings& rhs); |
| 26 ~ExtendedContentSettings(); |
| 27 |
24 ContentSettings content_settings; | 28 ContentSettings content_settings; |
25 ResourceContentSettings content_settings_for_resources; | 29 ResourceContentSettings content_settings_for_resources; |
26 }; | 30 }; |
27 | 31 |
28 // Map for ContentSettings. | 32 // Map for ContentSettings. |
29 typedef std::map<std::string, ExtendedContentSettings> HostContentSettings; | 33 typedef std::map<std::string, ExtendedContentSettings> HostContentSettings; |
30 | 34 |
31 // BaseProvider is the abstract base class for all content-settings-provider | 35 // BaseProvider is the abstract base class for all content-settings-provider |
32 // classes. | 36 // classes. |
33 class BaseProvider : public ProviderInterface { | 37 class BaseProvider : public ProviderInterface { |
34 public: | 38 public: |
35 // Maps CONTENT_SETTING_ASK for the CONTENT_SETTINGS_TYPE_PLUGINS to | 39 // Maps CONTENT_SETTING_ASK for the CONTENT_SETTINGS_TYPE_PLUGINS to |
36 // CONTENT_SETTING_BLOCK if click-to-play is not enabled. | 40 // CONTENT_SETTING_BLOCK if click-to-play is not enabled. |
37 static ContentSetting ClickToPlayFixup(ContentSettingsType content_type, | 41 static ContentSetting ClickToPlayFixup(ContentSettingsType content_type, |
38 ContentSetting setting); | 42 ContentSetting setting); |
39 | 43 |
40 explicit BaseProvider(bool is_otr) | 44 explicit BaseProvider(bool is_otr); |
41 : is_off_the_record_(is_otr) { | 45 virtual ~BaseProvider(); |
42 } | |
43 virtual ~BaseProvider() {} | |
44 | 46 |
45 // Initializes the Provider. | 47 // Initializes the Provider. |
46 virtual void Init() = 0; | 48 virtual void Init() = 0; |
47 | 49 |
48 // ProviderInterface Implementation | 50 // ProviderInterface Implementation |
49 virtual bool ContentSettingsTypeIsManaged( | 51 virtual bool ContentSettingsTypeIsManaged( |
50 ContentSettingsType content_type) = 0; | 52 ContentSettingsType content_type) = 0; |
51 | 53 |
52 virtual ContentSetting GetContentSetting( | 54 virtual ContentSetting GetContentSetting( |
53 const GURL& requesting_url, | 55 const GURL& requesting_url, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 HostContentSettings off_the_record_settings_; | 117 HostContentSettings off_the_record_settings_; |
116 | 118 |
117 // Used around accesses to the content_settings_ object to guarantee | 119 // Used around accesses to the content_settings_ object to guarantee |
118 // thread safety. | 120 // thread safety. |
119 mutable base::Lock lock_; | 121 mutable base::Lock lock_; |
120 }; | 122 }; |
121 | 123 |
122 } // namespace content_settings | 124 } // namespace content_settings |
123 | 125 |
124 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ | 126 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
OLD | NEW |