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

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

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (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
« no previous file with comments | « content/child/npapi/webplugin_delegate_impl_win.cc ('k') | content/common/plugin_list_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/plugin_list.h" 5 #include "content/common/plugin_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 mime_type_descriptions_str, base::string16(1, '|'), base::TRIM_WHITESPACE, 138 mime_type_descriptions_str, base::string16(1, '|'), base::TRIM_WHITESPACE,
139 base::SPLIT_WANT_ALL); 139 base::SPLIT_WANT_ALL);
140 140
141 parsed_mime_types->clear(); 141 parsed_mime_types->clear();
142 142
143 if (mime_types.empty()) 143 if (mime_types.empty())
144 return false; 144 return false;
145 145
146 for (size_t i = 0; i < mime_types.size(); ++i) { 146 for (size_t i = 0; i < mime_types.size(); ++i) {
147 WebPluginMimeType mime_type; 147 WebPluginMimeType mime_type;
148 mime_type.mime_type = base::StringToLowerASCII(mime_types[i]); 148 mime_type.mime_type = base::ToLowerASCII(mime_types[i]);
149 if (file_extensions.size() > i) { 149 if (file_extensions.size() > i) {
150 mime_type.file_extensions = base::SplitString( 150 mime_type.file_extensions = base::SplitString(
151 file_extensions[i], ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 151 file_extensions[i], ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
152 } 152 }
153 153
154 if (descriptions.size() > i) { 154 if (descriptions.size() > i) {
155 mime_type.description = descriptions[i]; 155 mime_type.description = descriptions[i];
156 156
157 // On Windows, the description likely has a list of file extensions 157 // On Windows, the description likely has a list of file extensions
158 // embedded in it (e.g. "SurfWriter file (*.swr)"). Remove an extension 158 // embedded in it (e.g. "SurfWriter file (*.swr)"). Remove an extension
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 void PluginList::GetPluginInfoArray( 312 void PluginList::GetPluginInfoArray(
313 const GURL& url, 313 const GURL& url,
314 const std::string& mime_type, 314 const std::string& mime_type,
315 bool allow_wildcard, 315 bool allow_wildcard,
316 bool* use_stale, 316 bool* use_stale,
317 bool include_npapi, 317 bool include_npapi,
318 std::vector<WebPluginInfo>* info, 318 std::vector<WebPluginInfo>* info,
319 std::vector<std::string>* actual_mime_types) { 319 std::vector<std::string>* actual_mime_types) {
320 DCHECK(mime_type == base::StringToLowerASCII(mime_type)); 320 DCHECK(mime_type == base::ToLowerASCII(mime_type));
321 DCHECK(info); 321 DCHECK(info);
322 322
323 if (!use_stale) 323 if (!use_stale)
324 LoadPlugins(include_npapi); 324 LoadPlugins(include_npapi);
325 base::AutoLock lock(lock_); 325 base::AutoLock lock(lock_);
326 if (use_stale) 326 if (use_stale)
327 *use_stale = (loading_state_ != LOADING_STATE_UP_TO_DATE); 327 *use_stale = (loading_state_ != LOADING_STATE_UP_TO_DATE);
328 info->clear(); 328 info->clear();
329 if (actual_mime_types) 329 if (actual_mime_types)
330 actual_mime_types->clear(); 330 actual_mime_types->clear();
(...skipping 15 matching lines...) Expand all
346 // Add in plugins by url. 346 // Add in plugins by url.
347 // We do not permit URL-sniff based plugin MIME type overrides aside from 347 // We do not permit URL-sniff based plugin MIME type overrides aside from
348 // the case where the "type" was initially missing. 348 // the case where the "type" was initially missing.
349 // We collected stats to determine this approach isn't a major compat issue, 349 // We collected stats to determine this approach isn't a major compat issue,
350 // and we defend against content confusion attacks in various cases, such 350 // and we defend against content confusion attacks in various cases, such
351 // as when the user doesn't have the Flash plugin enabled. 351 // as when the user doesn't have the Flash plugin enabled.
352 std::string path = url.path(); 352 std::string path = url.path();
353 std::string::size_type last_dot = path.rfind('.'); 353 std::string::size_type last_dot = path.rfind('.');
354 if (last_dot != std::string::npos && mime_type.empty()) { 354 if (last_dot != std::string::npos && mime_type.empty()) {
355 std::string extension = 355 std::string extension =
356 base::StringToLowerASCII(std::string(path, last_dot+1)); 356 base::ToLowerASCII(base::StringPiece(path).substr(last_dot + 1));
357 std::string actual_mime_type; 357 std::string actual_mime_type;
358 for (size_t i = 0; i < plugins_list_.size(); ++i) { 358 for (size_t i = 0; i < plugins_list_.size(); ++i) {
359 if (SupportsExtension(plugins_list_[i], extension, &actual_mime_type)) { 359 if (SupportsExtension(plugins_list_[i], extension, &actual_mime_type)) {
360 base::FilePath path = plugins_list_[i].path; 360 base::FilePath path = plugins_list_[i].path;
361 if (visited_plugins.insert(path).second) { 361 if (visited_plugins.insert(path).second) {
362 info->push_back(plugins_list_[i]); 362 info->push_back(plugins_list_[i]);
363 if (actual_mime_types) 363 if (actual_mime_types)
364 actual_mime_types->push_back(actual_mime_type); 364 actual_mime_types->push_back(actual_mime_type);
365 } 365 }
366 } 366 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 plugin_path); 410 plugin_path);
411 if (it != extra_plugin_paths_.end()) 411 if (it != extra_plugin_paths_.end())
412 extra_plugin_paths_.erase(it); 412 extra_plugin_paths_.erase(it);
413 } 413 }
414 414
415 PluginList::~PluginList() { 415 PluginList::~PluginList() {
416 } 416 }
417 417
418 418
419 } // namespace content 419 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/webplugin_delegate_impl_win.cc ('k') | content/common/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698