| 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 #include <iterator> | 10 #include <iterator> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 HRESULT InitializeSecurity() { | 149 HRESULT InitializeSecurity() { |
| 150 // TODO(gene): Check if we need to call CoInitializeSecurity and provide | 150 // TODO(gene): Check if we need to call CoInitializeSecurity and provide |
| 151 // the appropriate security settings for service. | 151 // the appropriate security settings for service. |
| 152 return S_OK; | 152 return S_OK; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode) { | 155 bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode) { |
| 156 CHECK(pnRetCode); | 156 CHECK(pnRetCode); |
| 157 CommandLine command_line(CommandLine::NO_PROGRAM); | 157 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 158 command_line.ParseFromString(lpCmdLine); | 158 command_line.ParseFromString(lpCmdLine); |
| 159 | 159 |
| 160 LOG(INFO) << command_line.GetCommandLineString(); | 160 LOG(INFO) << command_line.GetCommandLineString(); |
| 161 | 161 |
| 162 bool is_service = false; | 162 bool is_service = false; |
| 163 *pnRetCode = ParseCommandLine(command_line, &is_service); | 163 *pnRetCode = ParseCommandLine(command_line, &is_service); |
| 164 if (FAILED(*pnRetCode)) { | 164 if (FAILED(*pnRetCode)) { |
| 165 ReportError(*pnRetCode, IDS_OPERATION_FAILED_TITLE); | 165 ReportError(*pnRetCode, IDS_OPERATION_FAILED_TITLE); |
| 166 } | 166 } |
| 167 if (!is_service) { | 167 if (!is_service) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 191 return hr; | 191 return hr; |
| 192 } | 192 } |
| 193 | 193 |
| 194 HRESULT PostMessageLoop() { | 194 HRESULT PostMessageLoop() { |
| 195 StopConnector(); | 195 StopConnector(); |
| 196 setup_listener_.reset(); | 196 setup_listener_.reset(); |
| 197 return Base::PostMessageLoop(); | 197 return Base::PostMessageLoop(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 HRESULT ParseCommandLine(const CommandLine& command_line, bool* is_service) { | 201 HRESULT ParseCommandLine(const base::CommandLine& command_line, |
| 202 bool* is_service) { |
| 202 if (!is_service) | 203 if (!is_service) |
| 203 return E_INVALIDARG; | 204 return E_INVALIDARG; |
| 204 *is_service = false; | 205 *is_service = false; |
| 205 | 206 |
| 206 user_data_dir_switch_ = | 207 user_data_dir_switch_ = |
| 207 command_line.GetSwitchValuePath(switches::kUserDataDir); | 208 command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 208 if (!user_data_dir_switch_.empty()) | 209 if (!user_data_dir_switch_.empty()) |
| 209 user_data_dir_switch_ = base::MakeAbsoluteFilePath(user_data_dir_switch_); | 210 user_data_dir_switch_ = base::MakeAbsoluteFilePath(user_data_dir_switch_); |
| 210 | 211 |
| 211 if (command_line.HasSwitch(kStopSwitch)) | 212 if (command_line.HasSwitch(kStopSwitch)) |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 }; | 398 }; |
| 398 | 399 |
| 399 CloudPrintServiceModule _AtlModule; | 400 CloudPrintServiceModule _AtlModule; |
| 400 | 401 |
| 401 BOOL CloudPrintServiceModule::ConsoleCtrlHandler(DWORD type) { | 402 BOOL CloudPrintServiceModule::ConsoleCtrlHandler(DWORD type) { |
| 402 PostThreadMessage(_AtlModule.m_dwThreadID, WM_QUIT, 0, 0); | 403 PostThreadMessage(_AtlModule.m_dwThreadID, WM_QUIT, 0, 0); |
| 403 return TRUE; | 404 return TRUE; |
| 404 } | 405 } |
| 405 | 406 |
| 406 int main(int argc, char** argv) { | 407 int main(int argc, char** argv) { |
| 407 CommandLine::Init(argc, argv); | 408 base::CommandLine::Init(argc, argv); |
| 409 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 408 base::AtExitManager at_exit; | 410 base::AtExitManager at_exit; |
| 409 | 411 |
| 410 logging::LoggingSettings settings; | 412 logging::LoggingSettings settings; |
| 411 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 413 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 412 logging::InitLogging(settings); | 414 logging::InitLogging(settings); |
| 413 | 415 |
| 414 logging::SetMinLogLevel( | 416 logging::SetMinLogLevel( |
| 415 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableLogging) ? | 417 command_line->HasSwitch(switches::kEnableLogging) ? |
| 416 logging::LOG_INFO : logging::LOG_FATAL); | 418 logging::LOG_INFO : logging::LOG_FATAL); |
| 417 | 419 |
| 418 return _AtlModule.WinMain(0); | 420 return _AtlModule.WinMain(0); |
| 419 } | 421 } |
| 420 | 422 |
| OLD | NEW |