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

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

Issue 284333002: Revert 270872 "Move all callers of GetHomeDir() to PathService::..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « trunk/src/crypto/nss_util.cc ('k') | trunk/src/remoting/host/branding.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 "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/base_paths.h"
10 #include "base/file_util.h" 9 #include "base/file_util.h"
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "base/path_service.h"
13 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
16 #include "base/values.h" 14 #include "base/values.h"
17 #include "printing/backend/print_backend.h" 15 #include "printing/backend/print_backend.h"
18 #include "printing/backend/print_backend_consts.h" 16 #include "printing/backend/print_backend_consts.h"
19 #include "url/gurl.h" 17 #include "url/gurl.h"
20 18
21 namespace printing { 19 namespace printing {
22 20
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void MarkLpOptions(const std::string& printer_name, ppd_file_t** ppd) { 92 void MarkLpOptions(const std::string& printer_name, ppd_file_t** ppd) {
95 cups_option_t* options = NULL; 93 cups_option_t* options = NULL;
96 int num_options = 0; 94 int num_options = 0;
97 ppdMarkDefaults(*ppd); 95 ppdMarkDefaults(*ppd);
98 96
99 const char kSystemLpOptionPath[] = "/etc/cups/lpoptions"; 97 const char kSystemLpOptionPath[] = "/etc/cups/lpoptions";
100 const char kUserLpOptionPath[] = ".cups/lpoptions"; 98 const char kUserLpOptionPath[] = ".cups/lpoptions";
101 99
102 std::vector<base::FilePath> file_locations; 100 std::vector<base::FilePath> file_locations;
103 file_locations.push_back(base::FilePath(kSystemLpOptionPath)); 101 file_locations.push_back(base::FilePath(kSystemLpOptionPath));
104 base::FilePath homedir; 102 file_locations.push_back(base::FilePath(
105 PathService::Get(base::DIR_HOME, &homedir); 103 base::GetHomeDir().Append(kUserLpOptionPath)));
106 file_locations.push_back(base::FilePath(homedir.Append(kUserLpOptionPath)));
107 104
108 for (std::vector<base::FilePath>::const_iterator it = file_locations.begin(); 105 for (std::vector<base::FilePath>::const_iterator it = file_locations.begin();
109 it != file_locations.end(); ++it) { 106 it != file_locations.end(); ++it) {
110 num_options = 0; 107 num_options = 0;
111 options = NULL; 108 options = NULL;
112 ParseLpOptions(*it, printer_name, &num_options, &options); 109 ParseLpOptions(*it, printer_name, &num_options, &options);
113 if (num_options > 0 && options) { 110 if (num_options > 0 && options) {
114 cupsMarkOptions(*ppd, num_options, options); 111 cupsMarkOptions(*ppd, num_options, options);
115 cupsFreeOptions(num_options, options); 112 cupsFreeOptions(num_options, options);
116 } 113 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 caps.bw_model = cm_black; 391 caps.bw_model = cm_black;
395 392
396 ppdClose(ppd); 393 ppdClose(ppd);
397 base::DeleteFile(ppd_file_path, false); 394 base::DeleteFile(ppd_file_path, false);
398 395
399 *printer_info = caps; 396 *printer_info = caps;
400 return true; 397 return true;
401 } 398 }
402 399
403 } // namespace printing 400 } // namespace printing
OLDNEW
« no previous file with comments | « trunk/src/crypto/nss_util.cc ('k') | trunk/src/remoting/host/branding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698