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

Side by Side Diff: ui/gfx/win/window_impl.cc

Issue 772533002: Fix icon on Windows XP taskbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/win/window_impl.h ('k') | ui/views/test/test_views_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/win/window_impl.h" 5 #include "ui/gfx/win/window_impl.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // Several external scripts rely explicitly on this base class name for 27 // Several external scripts rely explicitly on this base class name for
28 // acquiring the window handle and will break if this is modified! 28 // acquiring the window handle and will break if this is modified!
29 // static 29 // static
30 const wchar_t* const WindowImpl::kBaseClassName = L"Chrome_WidgetWin_"; 30 const wchar_t* const WindowImpl::kBaseClassName = L"Chrome_WidgetWin_";
31 31
32 // WindowImpl class information used for registering unique windows. 32 // WindowImpl class information used for registering unique windows.
33 struct ClassInfo { 33 struct ClassInfo {
34 UINT style; 34 UINT style;
35 HICON icon; 35 HICON icon;
36 HICON small_icon;
36 37
37 ClassInfo(int style, HICON icon) 38 ClassInfo(int style, HICON icon, HICON small_icon)
38 : style(style), 39 : style(style),
39 icon(icon) {} 40 icon(icon),
41 small_icon(small_icon) {}
40 42
41 // Compares two ClassInfos. Returns true if all members match. 43 // Compares two ClassInfos. Returns true if all members match.
42 bool Equals(const ClassInfo& other) const { 44 bool Equals(const ClassInfo& other) const {
43 return (other.style == style && other.icon == icon); 45 return (other.style == style && other.icon == icon);
44 } 46 }
45 }; 47 };
46 48
47 // WARNING: this class may be used on multiple threads. 49 // WARNING: this class may be used on multiple threads.
48 class ClassRegistrar { 50 class ClassRegistrar {
49 public: 51 public:
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::win::InitializeWindowClass( 130 base::win::InitializeWindowClass(
129 name.c_str(), 131 name.c_str(),
130 &base::win::WrappedWindowProc<WindowImpl::WndProc>, 132 &base::win::WrappedWindowProc<WindowImpl::WndProc>,
131 class_info.style, 133 class_info.style,
132 0, 134 0,
133 0, 135 0,
134 NULL, 136 NULL,
135 reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)), 137 reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)),
136 NULL, 138 NULL,
137 class_info.icon, 139 class_info.icon,
138 class_info.icon, 140 class_info.small_icon,
139 &window_class); 141 &window_class);
140 HMODULE instance = window_class.hInstance; 142 HMODULE instance = window_class.hInstance;
141 ATOM atom = RegisterClassEx(&window_class); 143 ATOM atom = RegisterClassEx(&window_class);
142 CHECK(atom) << GetLastError(); 144 CHECK(atom) << GetLastError();
143 145
144 registered_classes_.push_back(RegisteredClass( 146 registered_classes_.push_back(RegisteredClass(
145 class_info, name, atom, instance)); 147 class_info, name, atom, instance));
146 148
147 return atom; 149 return atom;
148 } 150 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 CheckWindowCreated(hwnd_); 254 CheckWindowCreated(hwnd_);
253 255
254 // The window procedure should have set the data for us. 256 // The window procedure should have set the data for us.
255 CHECK_EQ(this, GetWindowUserData(hwnd)); 257 CHECK_EQ(this, GetWindowUserData(hwnd));
256 } 258 }
257 259
258 HICON WindowImpl::GetDefaultWindowIcon() const { 260 HICON WindowImpl::GetDefaultWindowIcon() const {
259 return NULL; 261 return NULL;
260 } 262 }
261 263
264 HICON WindowImpl::GetSmallWindowIcon() const {
265 return NULL;
sky 2014/12/01 17:35:52 If possible, nullptr every where.
266 }
267
262 LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { 268 LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
263 LRESULT result = 0; 269 LRESULT result = 0;
264 270
265 HWND hwnd = hwnd_; 271 HWND hwnd = hwnd_;
266 if (message == WM_NCDESTROY) 272 if (message == WM_NCDESTROY)
267 hwnd_ = NULL; 273 hwnd_ = NULL;
268 274
269 // Handle the message if it's in our message map; otherwise, let the system 275 // Handle the message if it's in our message map; otherwise, let the system
270 // handle it. 276 // handle it.
271 if (!ProcessWindowMessage(hwnd, message, w_param, l_param, result)) 277 if (!ProcessWindowMessage(hwnd, message, w_param, l_param, result))
(...skipping 26 matching lines...) Expand all
298 304
299 WindowImpl* window = reinterpret_cast<WindowImpl*>(GetWindowUserData(hwnd)); 305 WindowImpl* window = reinterpret_cast<WindowImpl*>(GetWindowUserData(hwnd));
300 if (!window) 306 if (!window)
301 return 0; 307 return 0;
302 308
303 return window->OnWndProc(message, w_param, l_param); 309 return window->OnWndProc(message, w_param, l_param);
304 } 310 }
305 311
306 ATOM WindowImpl::GetWindowClassAtom() { 312 ATOM WindowImpl::GetWindowClassAtom() {
307 HICON icon = GetDefaultWindowIcon(); 313 HICON icon = GetDefaultWindowIcon();
308 ClassInfo class_info(initial_class_style(), icon); 314 HICON small_icon = GetSmallWindowIcon();
315 ClassInfo class_info(initial_class_style(), icon, small_icon);
309 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info); 316 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info);
310 } 317 }
311 318
312 } // namespace gfx 319 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/win/window_impl.h ('k') | ui/views/test/test_views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698