| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/scoped_ptr.h" |
| 11 #include "base/string16.h" | 12 #include "base/string16.h" |
| 12 #include "base/task.h" | 13 #include "base/task.h" |
| 13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 14 #include "base/win/object_watcher.h" | 15 #include "base/win/object_watcher.h" |
| 15 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
| 16 #include "base/win/win_util.h" | 17 #include "base/win/win_util.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return false; | 119 return false; |
| 119 } | 120 } |
| 120 if (shutdown_task) { | 121 if (shutdown_task) { |
| 121 state_->shutdown_monitor.reset( | 122 state_->shutdown_monitor.reset( |
| 122 new ServiceProcessShutdownMonitor(shutdown_task)); | 123 new ServiceProcessShutdownMonitor(shutdown_task)); |
| 123 state_->shutdown_monitor->Start(); | 124 state_->shutdown_monitor->Start(); |
| 124 } | 125 } |
| 125 return true; | 126 return true; |
| 126 } | 127 } |
| 127 | 128 |
| 128 bool ServiceProcessState::AddToAutoRun(CommandLine* cmd_line) { | 129 bool ServiceProcessState::AddToAutoRun() { |
| 130 DCHECK(autorun_command_line_.get()); |
| 129 return base::win::AddCommandToAutoRun( | 131 return base::win::AddCommandToAutoRun( |
| 130 HKEY_CURRENT_USER, | 132 HKEY_CURRENT_USER, |
| 131 UTF8ToWide(GetServiceProcessAutoRunKey()), | 133 UTF8ToWide(GetServiceProcessAutoRunKey()), |
| 132 cmd_line->command_line_string()); | 134 autorun_command_line_->command_line_string()); |
| 133 } | 135 } |
| 134 | 136 |
| 135 bool ServiceProcessState::RemoveFromAutoRun() { | 137 bool ServiceProcessState::RemoveFromAutoRun() { |
| 136 return base::win::RemoveCommandFromAutoRun( | 138 return base::win::RemoveCommandFromAutoRun( |
| 137 HKEY_CURRENT_USER, UTF8ToWide(GetServiceProcessAutoRunKey())); | 139 HKEY_CURRENT_USER, UTF8ToWide(GetServiceProcessAutoRunKey())); |
| 138 } | 140 } |
| 139 | 141 |
| 140 void ServiceProcessState::TearDownState() { | 142 void ServiceProcessState::TearDownState() { |
| 141 delete state_; | 143 delete state_; |
| 142 state_ = NULL; | 144 state_ = NULL; |
| 143 } | 145 } |
| OLD | NEW |