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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // The PDF interface is invisible to SupportsInterface() on the browser | 49 // The PDF interface is invisible to SupportsInterface() on the browser |
50 // process because it is provided using PpapiInterfaceFactoryManager. We need | 50 // process because it is provided using PpapiInterfaceFactoryManager. We need |
51 // to check for that as well. | 51 // to check for that as well. |
52 // TODO(cpu): make this more sane. | 52 // TODO(cpu): make this more sane. |
53 return (strcmp(interface_name, PPB_PDF_INTERFACE) == 0); | 53 return (strcmp(interface_name, PPB_PDF_INTERFACE) == 0); |
54 } | 54 } |
55 | 55 |
56 // Returns true if this browser implements one of the interfaces given in | 56 // Returns true if this browser implements one of the interfaces given in |
57 // |interface_string|, which is a '|'-separated string of interface names. | 57 // |interface_string|, which is a '|'-separated string of interface names. |
58 bool CheckPepperFlashInterfaceString(const std::string& interface_string) { | 58 bool CheckPepperFlashInterfaceString(const std::string& interface_string) { |
59 std::vector<std::string> interface_names; | 59 for (const std::string& name : base::SplitString( |
60 base::SplitString(interface_string, '|', &interface_names); | 60 interface_string, "|", |
61 for (size_t i = 0; i < interface_names.size(); i++) { | 61 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
62 if (SupportsPepperInterface(interface_names[i].c_str())) | 62 if (SupportsPepperInterface(name.c_str())) |
63 return true; | 63 return true; |
64 } | 64 } |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 // Returns true if this browser implements all the interfaces that Flash | 68 // Returns true if this browser implements all the interfaces that Flash |
69 // specifies in its component installer manifest. | 69 // specifies in its component installer manifest. |
70 bool CheckPepperFlashInterfaces(const base::DictionaryValue& manifest) { | 70 bool CheckPepperFlashInterfaces(const base::DictionaryValue& manifest) { |
71 const base::ListValue* interface_list = NULL; | 71 const base::ListValue* interface_list = NULL; |
72 | 72 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |