| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DeleteAutorunKeys(const base::FilePath& user_data_dir) { | 58 void DeleteAutorunKeys(const base::FilePath& user_data_dir) { |
| 59 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE); | 59 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE); |
| 60 if (!key.Valid()) | 60 if (!key.Valid()) |
| 61 return; | 61 return; |
| 62 std::vector<string16> to_delete; | 62 std::vector<string16> to_delete; |
| 63 | 63 |
| 64 base::FilePath abs_user_data_dir = user_data_dir; | 64 base::FilePath abs_user_data_dir = user_data_dir.AsAbsolute(); |
| 65 file_util::AbsolutePath(&abs_user_data_dir); | |
| 66 | 65 |
| 67 { | 66 { |
| 68 base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath); | 67 base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath); |
| 69 for (; value.Valid(); ++value) { | 68 for (; value.Valid(); ++value) { |
| 70 if (value.Type() == REG_SZ && value.Value()) { | 69 if (value.Type() == REG_SZ && value.Value()) { |
| 71 CommandLine cmd = CommandLine::FromString(value.Value()); | 70 CommandLine cmd = CommandLine::FromString(value.Value()); |
| 72 if (cmd.GetSwitchValueASCII(switches::kProcessType) == | 71 if (cmd.GetSwitchValueASCII(switches::kProcessType) == |
| 73 switches::kServiceProcess && | 72 switches::kServiceProcess && |
| 74 cmd.HasSwitch(switches::kUserDataDir)) { | 73 cmd.HasSwitch(switches::kUserDataDir)) { |
| 75 base::FilePath path_from_reg = | 74 base::FilePath path_from_reg = |
| 76 cmd.GetSwitchValuePath(switches::kUserDataDir); | 75 cmd.GetSwitchValuePath(switches::kUserDataDir).AsAbsolute(); |
| 77 file_util::AbsolutePath(&path_from_reg); | |
| 78 if (path_from_reg == abs_user_data_dir) { | 76 if (path_from_reg == abs_user_data_dir) { |
| 79 to_delete.push_back(value.Name()); | 77 to_delete.push_back(value.Name()); |
| 80 } | 78 } |
| 81 } | 79 } |
| 82 } | 80 } |
| 83 } | 81 } |
| 84 } | 82 } |
| 85 | 83 |
| 86 for (size_t i = 0; i < to_delete.size(); ++i) { | 84 for (size_t i = 0; i < to_delete.size(); ++i) { |
| 87 key.DeleteValue(to_delete[i].c_str()); | 85 key.DeleteValue(to_delete[i].c_str()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void ChromeLauncher::CopySwitchesFromCurrent(CommandLine* destination) { | 167 void ChromeLauncher::CopySwitchesFromCurrent(CommandLine* destination) { |
| 170 static const char* const kSwitchesToCopy[] = { | 168 static const char* const kSwitchesToCopy[] = { |
| 171 switches::kEnableLogging, | 169 switches::kEnableLogging, |
| 172 switches::kV, | 170 switches::kV, |
| 173 }; | 171 }; |
| 174 destination->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), | 172 destination->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
| 175 kSwitchesToCopy, | 173 kSwitchesToCopy, |
| 176 arraysize(kSwitchesToCopy)); | 174 arraysize(kSwitchesToCopy)); |
| 177 } | 175 } |
| 178 | 176 |
| OLD | NEW |