Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / base / win / wrapped_window_proc.cc
blob61b79eda8851bd02e837e6a5cfd91b2becb2f8ce
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
3 // found in the LICENSE file.
5 #include "base/win/wrapped_window_proc.h"
7 #include "base/atomicops.h"
8 #include "base/logging.h"
9 #include "base/process/memory.h"
11 namespace {
13 base::win::WinProcExceptionFilter s_exception_filter = NULL;
15 } // namespace.
17 namespace base {
18 namespace win {
20 WinProcExceptionFilter SetWinProcExceptionFilter(
21 WinProcExceptionFilter filter) {
22 subtle::AtomicWord rv = subtle::NoBarrier_AtomicExchange(
23 reinterpret_cast<subtle::AtomicWord*>(&s_exception_filter),
24 reinterpret_cast<subtle::AtomicWord>(filter));
25 return reinterpret_cast<WinProcExceptionFilter>(rv);
28 int CallExceptionFilter(EXCEPTION_POINTERS* info) {
29 return s_exception_filter ? s_exception_filter(info) :
30 EXCEPTION_CONTINUE_SEARCH;
33 BASE_EXPORT void InitializeWindowClass(
34 const char16* class_name,
35 WNDPROC window_proc,
36 UINT style,
37 int class_extra,
38 int window_extra,
39 HCURSOR cursor,
40 HBRUSH background,
41 const char16* menu_name,
42 HICON large_icon,
43 HICON small_icon,
44 WNDCLASSEX* class_out) {
45 class_out->cbSize = sizeof(WNDCLASSEX);
46 class_out->style = style;
47 class_out->lpfnWndProc = window_proc;
48 class_out->cbClsExtra = class_extra;
49 class_out->cbWndExtra = window_extra;
50 class_out->hInstance = base::GetModuleFromAddress(window_proc);
51 class_out->hIcon = large_icon;
52 class_out->hCursor = cursor;
53 class_out->hbrBackground = background;
54 class_out->lpszMenuName = menu_name;
55 class_out->lpszClassName = class_name;
56 class_out->hIconSm = small_icon;
58 // Check if |window_proc| is valid.
59 DCHECK(class_out->hInstance != NULL);
62 } // namespace win
63 } // namespace base