OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "base/version.h" | 7 #include "base/version.h" |
8 #include "chrome/common/pepper_flash.h" | 8 #include "chrome/common/pepper_flash.h" |
9 #include "chrome/common/ppapi_utils.h" | 9 #include "chrome/common/ppapi_utils.h" |
10 #include "ppapi/c/private/ppb_pdf.h" | 10 #include "ppapi/c/private/ppb_pdf.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (!CheckPepperFlashInterfaceString(interface_string)) | 81 if (!CheckPepperFlashInterfaceString(interface_string)) |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 bool CheckPepperFlashManifest(const base::DictionaryValue& manifest, | 90 bool CheckPepperFlashManifest(const base::DictionaryValue& manifest, |
91 Version* version_out) { | 91 base::Version* version_out) { |
92 std::string name; | 92 std::string name; |
93 manifest.GetStringASCII("name", &name); | 93 manifest.GetStringASCII("name", &name); |
94 // TODO(viettrungluu): Support WinFlapper for now, while we change the format | 94 // TODO(viettrungluu): Support WinFlapper for now, while we change the format |
95 // of the manifest. (Should be safe to remove checks for "WinFlapper" in, say, | 95 // of the manifest. (Should be safe to remove checks for "WinFlapper" in, say, |
96 // Nov. 2011.) crbug.com/98458 | 96 // Nov. 2011.) crbug.com/98458 |
97 if (name != kPepperFlashManifestName && name != "WinFlapper") | 97 if (name != kPepperFlashManifestName && name != "WinFlapper") |
98 return false; | 98 return false; |
99 | 99 |
100 std::string proposed_version; | 100 std::string proposed_version; |
101 manifest.GetStringASCII("version", &proposed_version); | 101 manifest.GetStringASCII("version", &proposed_version); |
102 Version version(proposed_version.c_str()); | 102 base::Version version(proposed_version.c_str()); |
103 if (!version.IsValid()) | 103 if (!version.IsValid()) |
104 return false; | 104 return false; |
105 | 105 |
106 if (!CheckPepperFlashInterfaces(manifest)) | 106 if (!CheckPepperFlashInterfaces(manifest)) |
107 return false; | 107 return false; |
108 | 108 |
109 // TODO(viettrungluu): See above TODO. | 109 // TODO(viettrungluu): See above TODO. |
110 if (name == "WinFlapper") { | 110 if (name == "WinFlapper") { |
111 *version_out = version; | 111 *version_out = version; |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 std::string os; | 115 std::string os; |
116 manifest.GetStringASCII("x-ppapi-os", &os); | 116 manifest.GetStringASCII("x-ppapi-os", &os); |
117 if (os != kPepperFlashOperatingSystem) | 117 if (os != kPepperFlashOperatingSystem) |
118 return false; | 118 return false; |
119 | 119 |
120 std::string arch; | 120 std::string arch; |
121 manifest.GetStringASCII("x-ppapi-arch", &arch); | 121 manifest.GetStringASCII("x-ppapi-arch", &arch); |
122 if (arch != kPepperFlashArch) | 122 if (arch != kPepperFlashArch) |
123 return false; | 123 return false; |
124 | 124 |
125 *version_out = version; | 125 *version_out = version; |
126 return true; | 126 return true; |
127 } | 127 } |
128 | 128 |
129 } // namespace chrome | 129 } // namespace chrome |
OLD | NEW |