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 "webkit/plugins/webplugininfo.h" | 5 #include "webkit/plugins/webplugininfo.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 | 9 |
10 namespace webkit { | 10 namespace webkit { |
11 | 11 |
12 WebPluginMimeType::WebPluginMimeType() {} | 12 WebPluginMimeType::WebPluginMimeType() {} |
13 | 13 |
14 WebPluginMimeType::WebPluginMimeType(const std::string& m, | 14 WebPluginMimeType::WebPluginMimeType(const std::string& m, |
15 const std::string& f, | 15 const std::string& f, |
16 const std::string& d) | 16 const std::string& d) |
17 : mime_type(m), | 17 : mime_type(m), |
18 file_extensions(), | 18 file_extensions(), |
19 description(ASCIIToUTF16(d)) { | 19 description(ASCIIToUTF16(d)) { |
20 file_extensions.push_back(f); | 20 file_extensions.push_back(f); |
21 } | 21 } |
22 | 22 |
23 WebPluginMimeType::~WebPluginMimeType() {} | 23 WebPluginMimeType::~WebPluginMimeType() {} |
24 | 24 |
25 WebPluginInfo::WebPluginInfo() : type(PLUGIN_TYPE_NPAPI) { | 25 WebPluginInfo::WebPluginInfo() |
| 26 : enabled(USER_DISABLED_POLICY_UNMANAGED), type(PLUGIN_TYPE_NPAPI) { |
26 } | 27 } |
27 | 28 |
28 WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs) | 29 WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs) |
29 : name(rhs.name), | 30 : name(rhs.name), |
30 path(rhs.path), | 31 path(rhs.path), |
31 version(rhs.version), | 32 version(rhs.version), |
32 desc(rhs.desc), | 33 desc(rhs.desc), |
33 mime_types(rhs.mime_types), | 34 mime_types(rhs.mime_types), |
| 35 enabled(rhs.enabled), |
34 type(rhs.type) { | 36 type(rhs.type) { |
35 } | 37 } |
36 | 38 |
37 WebPluginInfo::~WebPluginInfo() {} | 39 WebPluginInfo::~WebPluginInfo() {} |
38 | 40 |
39 WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { | 41 WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { |
40 name = rhs.name; | 42 name = rhs.name; |
41 path = rhs.path; | 43 path = rhs.path; |
42 version = rhs.version; | 44 version = rhs.version; |
43 desc = rhs.desc; | 45 desc = rhs.desc; |
44 mime_types = rhs.mime_types; | 46 mime_types = rhs.mime_types; |
| 47 enabled = rhs.enabled; |
45 type = rhs.type; | 48 type = rhs.type; |
46 return *this; | 49 return *this; |
47 } | 50 } |
48 | 51 |
49 WebPluginInfo::WebPluginInfo(const string16& fake_name, | 52 WebPluginInfo::WebPluginInfo(const string16& fake_name, |
50 const FilePath& fake_path, | 53 const FilePath& fake_path, |
51 const string16& fake_version, | 54 const string16& fake_version, |
52 const string16& fake_desc) | 55 const string16& fake_desc) |
53 : name(fake_name), | 56 : name(fake_name), |
54 path(fake_path), | 57 path(fake_path), |
55 version(fake_version), | 58 version(fake_version), |
56 desc(fake_desc), | 59 desc(fake_desc), |
57 mime_types(), | 60 mime_types(), |
| 61 enabled(USER_ENABLED_POLICY_UNMANAGED), |
58 type(PLUGIN_TYPE_NPAPI) { | 62 type(PLUGIN_TYPE_NPAPI) { |
59 } | 63 } |
60 | 64 |
| 65 bool IsPluginEnabled(const WebPluginInfo& plugin) { |
| 66 return ((plugin.enabled & WebPluginInfo::POLICY_ENABLED) || |
| 67 plugin.enabled == WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED); |
| 68 } |
| 69 |
61 bool IsPepperPlugin(const WebPluginInfo& plugin) { | 70 bool IsPepperPlugin(const WebPluginInfo& plugin) { |
62 return ((plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS ) || | 71 return ((plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS ) || |
63 plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 72 plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
64 } | 73 } |
65 | 74 |
66 } // namespace webkit | 75 } // namespace webkit |
OLD | NEW |