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

Side by Side Diff: printing/backend/cups_helper.cc

Issue 183853011: Move TrimWhitespace to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 "printing/backend/cups_helper.h" 5 #include "printing/backend/cups_helper.h"
6 6
7 #include <cups/ppd.h> 7 #include <cups/ppd.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (base::strncasecmp (line.c_str(), kDefault, kDefaultLen) == 0 && 55 if (base::strncasecmp (line.c_str(), kDefault, kDefaultLen) == 0 &&
56 isspace(line[kDefaultLen])) { 56 isspace(line[kDefaultLen])) {
57 line = line.substr(kDefaultLen); 57 line = line.substr(kDefaultLen);
58 } else if (base::strncasecmp (line.c_str(), kDest, kDestLen) == 0 && 58 } else if (base::strncasecmp (line.c_str(), kDest, kDestLen) == 0 &&
59 isspace(line[kDestLen])) { 59 isspace(line[kDestLen])) {
60 line = line.substr(kDestLen); 60 line = line.substr(kDestLen);
61 } else { 61 } else {
62 continue; 62 continue;
63 } 63 }
64 64
65 TrimWhitespaceASCII(line, TRIM_ALL, &line); 65 base::TrimWhitespaceASCII(line, base::TRIM_ALL, &line);
66 if (line.empty()) 66 if (line.empty())
67 continue; 67 continue;
68 68
69 size_t space_found = line.find(' '); 69 size_t space_found = line.find(' ');
70 if (space_found == std::string::npos) 70 if (space_found == std::string::npos)
71 continue; 71 continue;
72 72
73 std::string name = line.substr(0, space_found); 73 std::string name = line.substr(0, space_found);
74 if (name.empty()) 74 if (name.empty())
75 continue; 75 continue;
76 76
77 if (base::strncasecmp(printer_name.c_str(), name.c_str(), 77 if (base::strncasecmp(printer_name.c_str(), name.c_str(),
78 name.length()) != 0) { 78 name.length()) != 0) {
79 continue; // This is not the required printer. 79 continue; // This is not the required printer.
80 } 80 }
81 81
82 line = line.substr(space_found + 1); 82 line = line.substr(space_found + 1);
83 TrimWhitespaceASCII(line, TRIM_ALL, &line); // Remove extra spaces. 83 // Remove extra spaces.
84 base::TrimWhitespaceASCII(line, base::TRIM_ALL, &line);
84 if (line.empty()) 85 if (line.empty())
85 continue; 86 continue;
86 // Parse the selected printer custom options. 87 // Parse the selected printer custom options.
87 *num_options = cupsParseOptions(line.c_str(), 0, options); 88 *num_options = cupsParseOptions(line.c_str(), 0, options);
88 } 89 }
89 } 90 }
90 91
91 void MarkLpOptions(const std::string& printer_name, ppd_file_t** ppd) { 92 void MarkLpOptions(const std::string& printer_name, ppd_file_t** ppd) {
92 cups_option_t* options = NULL; 93 cups_option_t* options = NULL;
93 int num_options = 0; 94 int num_options = 0;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 caps.bw_model = cm_black; 391 caps.bw_model = cm_black;
391 392
392 ppdClose(ppd); 393 ppdClose(ppd);
393 base::DeleteFile(ppd_file_path, false); 394 base::DeleteFile(ppd_file_path, false);
394 395
395 *printer_info = caps; 396 *printer_info = caps;
396 return true; 397 return true;
397 } 398 }
398 399
399 } // namespace printing 400 } // namespace printing
OLDNEW
« no previous file with comments | « ppapi/proxy/file_chooser_resource.cc ('k') | remoting/host/setup/daemon_controller_delegate_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698