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

Side by Side Diff: cloud_print/service/win/chrome_launcher.cc

Issue 1408623002: Add cloud_print to the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 2 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 "cloud_print/service/win/chrome_launcher.h" 5 #include "cloud_print/service/win/chrome_launcher.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.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/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 273
274 base::FilePath printers_file = temp_user_data.path().Append(L"printers.json"); 274 base::FilePath printers_file = temp_user_data.path().Append(L"printers.json");
275 275
276 base::ListValue printer_list; 276 base::ListValue printer_list;
277 printer_list.AppendStrings(printers); 277 printer_list.AppendStrings(printers);
278 std::string printers_json; 278 std::string printers_json;
279 base::JSONWriter::Write(printer_list, &printers_json); 279 base::JSONWriter::Write(printer_list, &printers_json);
280 size_t written = base::WriteFile(printers_file, 280 size_t written = base::WriteFile(printers_file,
281 printers_json.c_str(), 281 printers_json.c_str(),
282 printers_json.size()); 282 static_cast<int>(printers_json.size()));
283 if (written != printers_json.size()) { 283 if (written != printers_json.size()) {
284 LOG(ERROR) << "Can't write file."; 284 LOG(ERROR) << "Can't write file.";
285 return std::string(); 285 return std::string();
286 } 286 }
287 287
288 base::CommandLine cmd(chrome_path); 288 base::CommandLine cmd(chrome_path);
289 CopyChromeSwitchesFromCurrentProcess(&cmd); 289 CopyChromeSwitchesFromCurrentProcess(&cmd);
290 cmd.AppendSwitchPath(switches::kUserDataDir, temp_user_data.path()); 290 cmd.AppendSwitchPath(switches::kUserDataDir, temp_user_data.path());
291 cmd.AppendSwitchPath(switches::kCloudPrintSetupProxy, printers_file); 291 cmd.AppendSwitchPath(switches::kCloudPrintSetupProxy, printers_file);
292 cmd.AppendSwitch(switches::kNoServiceAutorun); 292 cmd.AppendSwitch(switches::kNoServiceAutorun);
(...skipping 28 matching lines...) Expand all
321 LOG(ERROR) << "Chrome launch failed."; 321 LOG(ERROR) << "Chrome launch failed.";
322 return std::string(); 322 return std::string();
323 } 323 }
324 if (!json.empty()) { 324 if (!json.empty()) {
325 // Close chrome because Service State is ready. 325 // Close chrome because Service State is ready.
326 CloseChrome(chrome_process.Pass(), thread_id); 326 CloseChrome(chrome_process.Pass(), thread_id);
327 return json; 327 return json;
328 } 328 }
329 } 329 }
330 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698