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() | 25 WebPluginInfo::WebPluginInfo() : type(PLUGIN_TYPE_NPAPI) { |
26 : enabled(USER_DISABLED_POLICY_UNMANAGED), type(PLUGIN_TYPE_NPAPI) { | |
27 } | 26 } |
28 | 27 |
29 WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs) | 28 WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs) |
30 : name(rhs.name), | 29 : name(rhs.name), |
31 path(rhs.path), | 30 path(rhs.path), |
32 version(rhs.version), | 31 version(rhs.version), |
33 desc(rhs.desc), | 32 desc(rhs.desc), |
34 mime_types(rhs.mime_types), | 33 mime_types(rhs.mime_types), |
35 enabled(rhs.enabled), | |
36 type(rhs.type) { | 34 type(rhs.type) { |
37 } | 35 } |
38 | 36 |
39 WebPluginInfo::~WebPluginInfo() {} | 37 WebPluginInfo::~WebPluginInfo() {} |
40 | 38 |
41 WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { | 39 WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) { |
42 name = rhs.name; | 40 name = rhs.name; |
43 path = rhs.path; | 41 path = rhs.path; |
44 version = rhs.version; | 42 version = rhs.version; |
45 desc = rhs.desc; | 43 desc = rhs.desc; |
46 mime_types = rhs.mime_types; | 44 mime_types = rhs.mime_types; |
47 enabled = rhs.enabled; | |
48 type = rhs.type; | 45 type = rhs.type; |
49 return *this; | 46 return *this; |
50 } | 47 } |
51 | 48 |
52 WebPluginInfo::WebPluginInfo(const string16& fake_name, | 49 WebPluginInfo::WebPluginInfo(const string16& fake_name, |
53 const FilePath& fake_path, | 50 const FilePath& fake_path, |
54 const string16& fake_version, | 51 const string16& fake_version, |
55 const string16& fake_desc) | 52 const string16& fake_desc) |
56 : name(fake_name), | 53 : name(fake_name), |
57 path(fake_path), | 54 path(fake_path), |
58 version(fake_version), | 55 version(fake_version), |
59 desc(fake_desc), | 56 desc(fake_desc), |
60 mime_types(), | 57 mime_types(), |
61 enabled(USER_ENABLED_POLICY_UNMANAGED), | |
62 type(PLUGIN_TYPE_NPAPI) { | 58 type(PLUGIN_TYPE_NPAPI) { |
63 } | 59 } |
64 | 60 |
65 bool IsPluginEnabled(const WebPluginInfo& plugin) { | |
66 return ((plugin.enabled & WebPluginInfo::POLICY_ENABLED) || | |
67 plugin.enabled == WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED); | |
68 } | |
69 | |
70 bool IsPepperPlugin(const WebPluginInfo& plugin) { | 61 bool IsPepperPlugin(const WebPluginInfo& plugin) { |
71 return ((plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS ) || | 62 return ((plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS ) || |
72 plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 63 plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
73 } | 64 } |
74 | 65 |
75 } // namespace webkit | 66 } // namespace webkit |
OLD | NEW |