OLD | NEW |
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 // Work around warning in atlbase.h |
| 6 // https://connect.microsoft.com/VisualStudio/feedback/details/1032199/atlbase-h
-gives-warning-c4189-when-compiling-with-atl-no-com-support |
| 7 #pragma warning(push) |
| 8 #pragma warning(disable:4189) |
5 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #pragma warning(pop) |
6 #include <security.h> | 11 #include <security.h> |
7 | 12 |
8 #include <iomanip> | 13 #include <iomanip> |
9 #include <iostream> | 14 #include <iostream> |
10 #include <iterator> | 15 #include <iterator> |
11 #include <string> | 16 #include <string> |
12 #include <vector> | 17 #include <vector> |
13 | 18 |
14 #include "base/at_exit.h" | 19 #include "base/at_exit.h" |
15 #include "base/bind.h" | 20 #include "base/bind.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 *user_data_dir = setup.user_data_dir(); | 332 *user_data_dir = setup.user_data_dir(); |
328 *printers = setup.printers(); | 333 *printers = setup.printers(); |
329 return S_OK; | 334 return S_OK; |
330 } | 335 } |
331 | 336 |
332 HRESULT SetupServiceState(const base::FilePath& user_data_dir, | 337 HRESULT SetupServiceState(const base::FilePath& user_data_dir, |
333 const std::vector<std::string>& printers) { | 338 const std::vector<std::string>& printers) { |
334 base::FilePath file = user_data_dir.Append(chrome::kServiceStateFileName); | 339 base::FilePath file = user_data_dir.Append(chrome::kServiceStateFileName); |
335 | 340 |
336 std::string contents; | 341 std::string contents; |
| 342 base::ReadFileToString(file, &contents); |
337 ServiceState service_state; | 343 ServiceState service_state; |
338 | 344 service_state.FromString(contents); |
339 bool is_valid = base::ReadFileToString(file, &contents) && | |
340 service_state.FromString(contents); | |
341 std::string proxy_id = service_state.proxy_id(); | 345 std::string proxy_id = service_state.proxy_id(); |
342 | 346 |
343 LOG(INFO) << file.value() << ": " << contents; | 347 LOG(INFO) << file.value() << ": " << contents; |
344 | 348 |
345 base::string16 message = | 349 base::string16 message = |
346 cloud_print::LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME); | 350 cloud_print::LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME); |
347 std::cout << "\n" << message.c_str() << "\n" ; | 351 std::cout << "\n" << message.c_str() << "\n" ; |
348 std::string new_contents = | 352 std::string new_contents = |
349 ChromeLauncher::CreateServiceStateFile(proxy_id, printers); | 353 ChromeLauncher::CreateServiceStateFile(proxy_id, printers); |
350 | 354 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 417 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
414 logging::InitLogging(settings); | 418 logging::InitLogging(settings); |
415 | 419 |
416 logging::SetMinLogLevel( | 420 logging::SetMinLogLevel( |
417 command_line->HasSwitch(switches::kEnableLogging) ? | 421 command_line->HasSwitch(switches::kEnableLogging) ? |
418 logging::LOG_INFO : logging::LOG_FATAL); | 422 logging::LOG_INFO : logging::LOG_FATAL); |
419 | 423 |
420 return _AtlModule.WinMain(0); | 424 return _AtlModule.WinMain(0); |
421 } | 425 } |
422 | 426 |
OLD | NEW |