| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_frame/test_utils.h" | 5 #include "chrome_frame/test_utils.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlwin.h> | 8 #include <atlwin.h> |
| 9 #include <winternl.h> | 9 #include <winternl.h> |
| 10 | 10 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // should not have side-effects and should be idempotent. | 271 // should not have side-effects and should be idempotent. |
| 272 virtual bool Includes(const base::ProcessEntry& entry) const { | 272 virtual bool Includes(const base::ProcessEntry& entry) const { |
| 273 bool found = false; | 273 bool found = false; |
| 274 std::wstring command_line; | 274 std::wstring command_line; |
| 275 if (GetCommandLineForProcess(entry.pid(), &command_line)) { | 275 if (GetCommandLineForProcess(entry.pid(), &command_line)) { |
| 276 std::wstring::const_iterator it = | 276 std::wstring::const_iterator it = |
| 277 std::search(command_line.begin(), | 277 std::search(command_line.begin(), |
| 278 command_line.end(), | 278 command_line.end(), |
| 279 argument_to_find_.begin(), | 279 argument_to_find_.begin(), |
| 280 argument_to_find_.end(), | 280 argument_to_find_.end(), |
| 281 CaseInsensitiveCompareASCII<wchar_t>()); | 281 base::CaseInsensitiveCompareASCII<wchar_t>()); |
| 282 found = (it != command_line.end()); | 282 found = (it != command_line.end()); |
| 283 } | 283 } |
| 284 return found; | 284 return found; |
| 285 } | 285 } |
| 286 | 286 |
| 287 protected: | 287 protected: |
| 288 std::wstring argument_to_find_; | 288 std::wstring argument_to_find_; |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 } // namespace | 291 } // namespace |
| 292 | 292 |
| 293 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, | 293 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, |
| 294 const std::wstring& argument) { | 294 const std::wstring& argument) { |
| 295 bool result = true; | 295 bool result = true; |
| 296 ArgumentFilter filter(argument); | 296 ArgumentFilter filter(argument); |
| 297 base::NamedProcessIterator iter(process_name, &filter); | 297 base::NamedProcessIterator iter(process_name, &filter); |
| 298 while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { | 298 while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { |
| 299 if (!base::KillProcessById(entry->pid(), 0, true)) { | 299 if (!base::KillProcessById(entry->pid(), 0, true)) { |
| 300 result = false; | 300 result = false; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 return result; | 304 return result; |
| 305 } | 305 } |
| OLD | NEW |