Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: chrome/browser/ui/tabs/dock_info_win.cc

Issue 10079011: Makes casts in DockInfoWin consistant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tabs/dock_info_win.cc
diff --git a/chrome/browser/ui/tabs/dock_info_win.cc b/chrome/browser/ui/tabs/dock_info_win.cc
index 3c39e91b93b0620b6f5f73194610dde1cbb18ec2..e78c7d64d13f908e34a4239bfa0c2f7a9e20fca8 100644
--- a/chrome/browser/ui/tabs/dock_info_win.cc
+++ b/chrome/browser/ui/tabs/dock_info_win.cc
@@ -28,10 +28,8 @@ class BaseWindowFinder {
virtual ~BaseWindowFinder() {}
protected:
- // Returns true if iteration should stop, false if iteration should continue.
- virtual bool ShouldStopIterating(HWND window) = 0;
-
static BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) {
+ // Cast must match that in as_lparam().
BaseWindowFinder* finder = reinterpret_cast<BaseWindowFinder*>(lParam);
if (finder->ignore_.find(hwnd) != finder->ignore_.end())
return TRUE;
@@ -39,6 +37,14 @@ class BaseWindowFinder {
return finder->ShouldStopIterating(hwnd) ? FALSE : TRUE;
}
+ LPARAM as_lparam() {
+ // Cast must match that in WindowCallbackProc().
+ return reinterpret_cast<LPARAM>(static_cast<BaseWindowFinder*>(this));
+ }
+
+ // Returns true if iteration should stop, false if iteration should continue.
+ virtual bool ShouldStopIterating(HWND window) = 0;
+
private:
const std::set<HWND>& ignore_;
@@ -118,7 +124,7 @@ class TopMostFinder : public BaseWindowFinder {
screen_loc_(screen_loc),
is_top_most_(false),
tmp_region_(CreateRectRgn(0, 0, 0, 0)) {
- EnumWindows(WindowCallbackProc, reinterpret_cast<LPARAM>(this));
+ EnumWindows(WindowCallbackProc, as_lparam());
}
// The window we're looking for.
@@ -177,8 +183,7 @@ class LocalProcessWindowFinder : public BaseWindowFinder {
: BaseWindowFinder(ignore),
screen_loc_(screen_loc),
result_(NULL) {
- EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc,
- reinterpret_cast<LPARAM>(this));
+ EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam());
}
// Position of the mouse.
@@ -241,8 +246,7 @@ class DockToWindowFinder : public BaseWindowFinder {
screen_loc);
if (!work_area.IsEmpty()) {
result_.set_monitor_bounds(work_area);
- EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc,
- reinterpret_cast<LPARAM>(this));
+ EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698