summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 23:33:03 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 23:33:03 +0000
commited37a488af68728706d279f569d2b8a5e5ca6668 (patch)
treed4b0e44bb4d7a7aa0c85c87c5a0f771ad220fe30 /ui
parentb90cad745115eb376bc0e02fed58c6abb0094bf5 (diff)
downloadchromium_src-ed37a488af68728706d279f569d2b8a5e5ca6668.zip
chromium_src-ed37a488af68728706d279f569d2b8a5e5ca6668.tar.gz
chromium_src-ed37a488af68728706d279f569d2b8a5e5ca6668.tar.bz2
Make WindowImpl take into account the icon in the class registrar.
This fixes the bug where an incorrect icon was being shown in the Windows Task Manager and Task Switcher. The problem was that the ClassRegistrar was re-using window classes between different windows, but its lookup function was not taking into account the icon. This caused the main Chrome window to take on the class registered by SingletonHwnd, which did not have an icon set. BUG=118368, 117687 TEST=Launch Chrome and check that Chrome's icon looks correct in the Task Manager and Task Switcher. Review URL: http://codereview.chromium.org/10031045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/win/window_impl.cc16
-rw-r--r--ui/base/win/window_impl.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc
index 216a77c..648f2b6 100644
--- a/ui/base/win/window_impl.cc
+++ b/ui/base/win/window_impl.cc
@@ -53,15 +53,15 @@ const wchar_t* const WindowImpl::kBaseClassName = L"Chrome_WidgetWin_";
// WindowImpl class information used for registering unique windows.
struct ClassInfo {
UINT style;
- HBRUSH background;
+ HICON icon;
- explicit ClassInfo(int style)
+ ClassInfo(int style, HICON icon)
: style(style),
- background(NULL) {}
+ icon(icon) {}
// Compares two ClassInfos. Returns true if all members match.
bool Equals(const ClassInfo& other) const {
- return (other.style == style && other.background == background);
+ return (other.style == style && other.icon == icon);
}
};
@@ -247,14 +247,14 @@ LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd,
}
std::wstring WindowImpl::GetWindowClassName() {
- ClassInfo class_info(initial_class_style());
+ HICON icon = GetDefaultWindowIcon();
+ ClassInfo class_info(initial_class_style(), icon);
std::wstring name;
if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name))
return name;
- HICON icon = GetDefaultWindowIcon();
-
// No class found, need to register one.
+ HBRUSH background = NULL;
WNDCLASSEX class_ex = {
sizeof(WNDCLASSEX),
class_info.style,
@@ -264,7 +264,7 @@ std::wstring WindowImpl::GetWindowClassName() {
NULL,
icon,
NULL,
- reinterpret_cast<HBRUSH>(class_info.background + 1),
+ reinterpret_cast<HBRUSH>(background + 1),
NULL,
name.c_str(),
icon
diff --git a/ui/base/win/window_impl.h b/ui/base/win/window_impl.h
index 1f70920..f4795cb 100644
--- a/ui/base/win/window_impl.h
+++ b/ui/base/win/window_impl.h
@@ -49,7 +49,7 @@ class UI_EXPORT WindowImpl : public MessageMapInterface {
// Initializes the Window with a parent and an initial desired size.
void Init(HWND parent, const gfx::Rect& bounds);
- // Retrieves the default window icon to use for windows if none is specified.
+ // Returns the default window icon to use for windows of this type.
virtual HICON GetDefaultWindowIcon() const;
// Returns the HWND associated with this Window.