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 "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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void DeleteAutorunKeys(const base::FilePath& user_data_dir) { | 140 void DeleteAutorunKeys(const base::FilePath& user_data_dir) { |
141 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE); | 141 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE); |
142 if (!key.Valid()) | 142 if (!key.Valid()) |
143 return; | 143 return; |
144 std::vector<base::string16> to_delete; | 144 std::vector<base::string16> to_delete; |
145 | 145 |
146 base::FilePath abs_user_data_dir = base::MakeAbsoluteFilePath(user_data_dir); | 146 base::FilePath abs_user_data_dir = base::MakeAbsoluteFilePath(user_data_dir); |
147 | 147 |
148 { | 148 { |
149 base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath); | 149 base::win::RegistryValueIterator value( |
| 150 HKEY_CURRENT_USER, kAutoRunKeyPath, 0); |
150 for (; value.Valid(); ++value) { | 151 for (; value.Valid(); ++value) { |
151 if (value.Type() == REG_SZ && value.Value()) { | 152 if (value.Type() == REG_SZ && value.Value()) { |
152 CommandLine cmd = CommandLine::FromString(value.Value()); | 153 CommandLine cmd = CommandLine::FromString(value.Value()); |
153 if (cmd.GetSwitchValueASCII(switches::kProcessType) == | 154 if (cmd.GetSwitchValueASCII(switches::kProcessType) == |
154 switches::kServiceProcess && | 155 switches::kServiceProcess && |
155 cmd.HasSwitch(switches::kUserDataDir)) { | 156 cmd.HasSwitch(switches::kUserDataDir)) { |
156 base::FilePath path_from_reg = base::MakeAbsoluteFilePath( | 157 base::FilePath path_from_reg = base::MakeAbsoluteFilePath( |
157 cmd.GetSwitchValuePath(switches::kUserDataDir)); | 158 cmd.GetSwitchValuePath(switches::kUserDataDir)); |
158 if (path_from_reg == abs_user_data_dir) { | 159 if (path_from_reg == abs_user_data_dir) { |
159 to_delete.push_back(value.Name()); | 160 to_delete.push_back(value.Name()); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 LOG(ERROR) << "Chrome launch failed."; | 314 LOG(ERROR) << "Chrome launch failed."; |
314 return std::string(); | 315 return std::string(); |
315 } | 316 } |
316 if (!json.empty()) { | 317 if (!json.empty()) { |
317 // Close chrome because Service State is ready. | 318 // Close chrome because Service State is ready. |
318 CloseChrome(chrome_handle, thread_id); | 319 CloseChrome(chrome_handle, thread_id); |
319 return json; | 320 return json; |
320 } | 321 } |
321 } | 322 } |
322 } | 323 } |
OLD | NEW |