diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
commit | 6aa9349ef5c1110d9c096945840e6a105e8a8295 (patch) | |
tree | 8afce0e1f3aae77e05105cfbe0d24ea3bdae9106 /chrome/common | |
parent | b61236c6679615af0811d59d130c91397d8c6be7 (diff) | |
download | chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.zip chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.gz chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.bz2 |
Replace chrome_process_filter with chrome_process_util.
- move code only used by tests to chrome/test
- make a better, more portable abstraction
For now, it still only works on Windows. But this is the first step
to porting this part of code.
Patch by phajdan.jr@chromium.org: <http://codereview.chromium.org/54003>
Review URL: http://codereview.chromium.org/67004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/chrome_process_filter.cc | 35 | ||||
-rw-r--r-- | chrome/common/chrome_process_filter.h | 30 | ||||
-rw-r--r-- | chrome/common/common.vcproj | 8 |
3 files changed, 0 insertions, 73 deletions
diff --git a/chrome/common/chrome_process_filter.cc b/chrome/common/chrome_process_filter.cc deleted file mode 100644 index 2b12d2d..0000000 --- a/chrome/common/chrome_process_filter.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <windows.h> - -#include "chrome/common/chrome_process_filter.h" - -#include "base/path_service.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_paths.h" - -BrowserProcessFilter::BrowserProcessFilter(const std::wstring user_data_dir) - : browser_process_id_(0), - user_data_dir_(user_data_dir) { - // Find the message window (if any) for the current user data directory, - // and get its process ID. We'll only count browser processes that either - // have the same process ID or have that process ID as their parent. - - if (user_data_dir_.length() == 0) - PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_); - - - HWND message_window = FindWindowEx(HWND_MESSAGE, NULL, - chrome::kMessageWindowClass, - user_data_dir_.c_str()); - if (message_window) - GetWindowThreadProcessId(message_window, &browser_process_id_); -} - -bool BrowserProcessFilter::Includes(base::ProcessId pid, - base::ProcessId parent_pid) const { - return browser_process_id_ && (browser_process_id_ == pid || - browser_process_id_ == parent_pid); -} diff --git a/chrome/common/chrome_process_filter.h b/chrome/common/chrome_process_filter.h deleted file mode 100644 index 8421fce..0000000 --- a/chrome/common/chrome_process_filter.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_CHROME_PROCESS_FILTER_H__ -#define CHROME_COMMON_CHROME_PROCESS_FILTER_H__ - -#include "base/process_util.h" - -// Filter all chrome browser processes that run with the same user data -// directory. -class BrowserProcessFilter : public base::ProcessFilter { - public: - // Create the filter for the given user_data_dir. - // If user_data_dir is an empty string, will use the PathService - // user_data_dir (e.g. chrome::DIR_USER_DATA). - explicit BrowserProcessFilter(const std::wstring user_data_dir); - - uint32 browser_process_id() const { return browser_process_id_; } - - virtual bool Includes(base::ProcessId pid, base::ProcessId parent_pid) const; - - private: - std::wstring user_data_dir_; - DWORD browser_process_id_; - - DISALLOW_EVIL_CONSTRUCTORS(BrowserProcessFilter); -}; - -#endif // CHROME_COMMON_CHROME_PROCESS_FILTER_H__ diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index a5ec901..5a26a5e 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -454,14 +454,6 @@ > </File> <File - RelativePath=".\chrome_process_filter.cc" - > - </File> - <File - RelativePath=".\chrome_process_filter.h" - > - </File> - <File RelativePath=".\chrome_switches.cc" > </File> |