OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_COMMON_FILTER_POLICY_H__ | 5 #ifndef CHROME_COMMON_FILTER_POLICY_H__ |
6 #define CHROME_COMMON_FILTER_POLICY_H__ | 6 #define CHROME_COMMON_FILTER_POLICY_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 // When an insecure resource (mixed content or bad HTTPS) is loaded, the browser | 10 // When an insecure resource (mixed content or bad HTTPS) is loaded, the browser |
11 // can decide to filter it. The filtering is done in the renderer. This class | 11 // can decide to filter it. The filtering is done in the renderer. This class |
12 // enumerates the different policy that can be used for the filtering. It is | 12 // enumerates the different policy that can be used for the filtering. It is |
13 // passed along with resource response messages. | 13 // passed along with resource response messages. |
| 14 // It can be used for content post-processing, like message replacement within |
| 15 // extension css files. |
14 class FilterPolicy { | 16 class FilterPolicy { |
15 public: | 17 public: |
16 enum Type { | 18 enum Type { |
17 // Pass all types of resources through unmodified. | 19 // Pass all types of resources through unmodified. |
18 DONT_FILTER = 0, | 20 DONT_FILTER = 0, |
19 | 21 |
| 22 // Post-process extension css files. |
| 23 FILTER_EXTENSION_MESSAGES, |
| 24 |
20 // Block all types of resources, except images. For images, modify them to | 25 // Block all types of resources, except images. For images, modify them to |
21 // indicate that they have been filtered. | 26 // indicate that they have been filtered. |
22 // TODO(abarth): This is a misleading name for this enum value. We should | 27 // TODO(abarth): This is a misleading name for this enum value. We should |
23 // change it to something more suggestive of what this | 28 // change it to something more suggestive of what this |
24 // actually does. | 29 // actually does. |
25 FILTER_ALL_EXCEPT_IMAGES, | 30 FILTER_ALL_EXCEPT_IMAGES, |
26 | 31 |
27 // Block all types of resources. | 32 // Block all types of resources. |
28 FILTER_ALL | 33 FILTER_ALL |
29 }; | 34 }; |
30 | 35 |
31 static bool ValidType(int32 type) { | 36 static bool ValidType(int32 type) { |
32 return type >= DONT_FILTER && type <= FILTER_ALL; | 37 return type >= DONT_FILTER && type <= FILTER_ALL; |
33 } | 38 } |
34 | 39 |
35 static Type FromInt(int32 type) { | 40 static Type FromInt(int32 type) { |
36 return static_cast<Type>(type); | 41 return static_cast<Type>(type); |
37 } | 42 } |
38 | 43 |
39 private: | 44 private: |
40 // Don't instantiate this class. | 45 // Don't instantiate this class. |
41 FilterPolicy(); | 46 FilterPolicy(); |
42 ~FilterPolicy(); | 47 ~FilterPolicy(); |
43 | 48 |
44 }; | 49 }; |
45 | 50 |
46 #endif // CHROME_COMMON_FILTER_POLICY_H__ | 51 #endif // CHROME_COMMON_FILTER_POLICY_H__ |
OLD | NEW |