Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/common/pepper_plugin_list.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/common/pepper_plugin_list.h" 5 #include "content/common/pepper_plugin_list.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 switches::kRegisterPepperPlugins); 45 switches::kRegisterPepperPlugins);
46 if (value.empty()) 46 if (value.empty())
47 return; 47 return;
48 48
49 // FORMAT: 49 // FORMAT:
50 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) 50 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> )
51 // plugin-entry = 51 // plugin-entry =
52 // <file-path> + 52 // <file-path> +
53 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + 53 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] +
54 // *1( LWS + ";" + LWS + <mime-type> ) 54 // *1( LWS + ";" + LWS + <mime-type> )
55 std::vector<std::string> modules = base::SplitString( 55 std::vector<std::string> modules;
56 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 56 base::SplitString(value, ',', &modules);
57 57
58 size_t plugins_to_register = modules.size(); 58 size_t plugins_to_register = modules.size();
59 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) { 59 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) {
60 DVLOG(1) << plugins_to_register << " pepper plugins registered from" 60 DVLOG(1) << plugins_to_register << " pepper plugins registered from"
61 << " command line which exceeds the limit (maximum " 61 << " command line which exceeds the limit (maximum "
62 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)"; 62 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)";
63 plugins_to_register = kMaxPluginsToRegisterFromCommandLine; 63 plugins_to_register = kMaxPluginsToRegisterFromCommandLine;
64 } 64 }
65 65
66 for (size_t i = 0; i < plugins_to_register; ++i) { 66 for (size_t i = 0; i < plugins_to_register; ++i) {
67 std::vector<std::string> parts = base::SplitString( 67 std::vector<std::string> parts;
68 modules[i], ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 68 base::SplitString(modules[i], ';', &parts);
69 if (parts.size() < 2) { 69 if (parts.size() < 2) {
70 DVLOG(1) << "Required mime-type not found"; 70 DVLOG(1) << "Required mime-type not found";
71 continue; 71 continue;
72 } 72 }
73 73
74 std::vector<std::string> name_parts = base::SplitString( 74 std::vector<std::string> name_parts;
75 parts[0], "#", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 75 base::SplitString(parts[0], '#', &name_parts);
76 76
77 PepperPluginInfo plugin; 77 PepperPluginInfo plugin;
78 plugin.is_out_of_process = out_of_process; 78 plugin.is_out_of_process = out_of_process;
79 #if defined(OS_WIN) 79 #if defined(OS_WIN)
80 // This means we can't provide plugins from non-ASCII paths, but 80 // This means we can't provide plugins from non-ASCII paths, but
81 // since this switch is only for development I don't think that's 81 // since this switch is only for development I don't think that's
82 // too awful. 82 // too awful.
83 plugin.path = base::FilePath(base::ASCIIToUTF16(name_parts[0])); 83 plugin.path = base::FilePath(base::ASCIIToUTF16(name_parts[0]));
84 #else 84 #else
85 plugin.path = base::FilePath(name_parts[0]); 85 plugin.path = base::FilePath(name_parts[0]);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 return true; 141 return true;
142 } 142 }
143 143
144 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { 144 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) {
145 GetContentClient()->AddPepperPlugins(plugins); 145 GetContentClient()->AddPepperPlugins(plugins);
146 ComputePluginsFromCommandLine(plugins); 146 ComputePluginsFromCommandLine(plugins);
147 } 147 }
148 148
149 } // namespace content 149 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_encode_accelerator_unittest.cc ('k') | content/common/plugin_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698