| 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 #include <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <security.h> | 6 #include <security.h> |
| 7 | 7 |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 | 10 |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/guid.h" | 14 #include "base/guid.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 19 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 20 #include "cloud_print/service/service_state.h" | 20 #include "cloud_print/service/service_state.h" |
| 21 #include "cloud_print/service/service_switches.h" | 21 #include "cloud_print/service/service_switches.h" |
| 22 #include "cloud_print/service/win/chrome_launcher.h" | 22 #include "cloud_print/service/win/chrome_launcher.h" |
| 23 #include "cloud_print/service/win/service_controller.h" | 23 #include "cloud_print/service/win/service_controller.h" |
| 24 #include "cloud_print/service/win/service_utils.h" |
| 24 #include "printing/backend/print_backend.h" | 25 #include "printing/backend/print_backend.h" |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 const char kChromeIsNotAvalible[] = "\nChrome is not available\n"; | 29 const char kChromeIsNotAvalible[] = "\nChrome is not available\n"; |
| 29 const char kChromeIsAvalible[] = "\nChrome is available\n"; | 30 const char kChromeIsAvalible[] = "\nChrome is available\n"; |
| 30 const wchar_t kRequirementsFileName[] = L"cloud_print_service_requirements.txt"; | 31 const wchar_t kRequirementsFileName[] = L"cloud_print_service_requirements.txt"; |
| 31 const wchar_t kServiceStateFileName[] = L"Service State"; | 32 const wchar_t kServiceStateFileName[] = L"Service State"; |
| 32 | 33 |
| 33 void InvalidUsage() { | 34 void InvalidUsage() { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 std::getline(std::cin, input); | 104 std::getline(std::cin, input); |
| 104 StringToLowerASCII(&input); | 105 StringToLowerASCII(&input); |
| 105 if (input.empty() || input == "y") { | 106 if (input.empty() || input == "y") { |
| 106 return true; | 107 return true; |
| 107 } else if (input == "n") { | 108 } else if (input == "n") { |
| 108 return false; | 109 return false; |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 } | 112 } |
| 112 | 113 |
| 113 string16 GetCurrentUserName() { | |
| 114 ULONG size = 0; | |
| 115 string16 result; | |
| 116 ::GetUserNameEx(::NameSamCompatible, NULL, &size); | |
| 117 result.resize(size); | |
| 118 if (result.empty()) | |
| 119 return result; | |
| 120 if (!::GetUserNameEx(::NameSamCompatible, &result[0], &size)) | |
| 121 result.clear(); | |
| 122 result.resize(size); | |
| 123 return result; | |
| 124 } | |
| 125 | |
| 126 } // namespace | 114 } // namespace |
| 127 | 115 |
| 128 class CloudPrintServiceModule | 116 class CloudPrintServiceModule |
| 129 : public ATL::CAtlServiceModuleT<CloudPrintServiceModule, IDS_SERVICENAME> { | 117 : public ATL::CAtlServiceModuleT<CloudPrintServiceModule, IDS_SERVICENAME> { |
| 130 public: | 118 public: |
| 131 typedef ATL::CAtlServiceModuleT<CloudPrintServiceModule, | 119 typedef ATL::CAtlServiceModuleT<CloudPrintServiceModule, |
| 132 IDS_SERVICENAME> Base; | 120 IDS_SERVICENAME> Base; |
| 133 | 121 |
| 134 CloudPrintServiceModule() | 122 CloudPrintServiceModule() |
| 135 : check_requirements_(false), | 123 : check_requirements_(false), |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 BOOL CloudPrintServiceModule::ConsoleCtrlHandler(DWORD type) { | 378 BOOL CloudPrintServiceModule::ConsoleCtrlHandler(DWORD type) { |
| 391 PostThreadMessage(_AtlModule.m_dwThreadID, WM_QUIT, 0, 0); | 379 PostThreadMessage(_AtlModule.m_dwThreadID, WM_QUIT, 0, 0); |
| 392 return TRUE; | 380 return TRUE; |
| 393 } | 381 } |
| 394 | 382 |
| 395 int main() { | 383 int main() { |
| 396 base::AtExitManager at_exit; | 384 base::AtExitManager at_exit; |
| 397 return _AtlModule.WinMain(0); | 385 return _AtlModule.WinMain(0); |
| 398 } | 386 } |
| 399 | 387 |
| OLD | NEW |