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

Side by Side Diff: ui/base/clipboard/clipboard_win.cc

Issue 10315012: Added base::win::InitializeWindowClass() wrapper to make sure that window classes are properly asso… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 // Many of these functions are based on those found in 5 // Many of these functions are based on those found in
6 // webkit/port/platform/PasteboardWin.cpp 6 // webkit/port/platform/PasteboardWin.cpp
7 7
8 #include "ui/base/clipboard/clipboard.h" 8 #include "ui/base/clipboard/clipboard.h"
9 9
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!base::StringToInt(serialization, &clipboard_format)) { 181 if (!base::StringToInt(serialization, &clipboard_format)) {
182 NOTREACHED(); 182 NOTREACHED();
183 return FormatType(); 183 return FormatType();
184 } 184 }
185 return FormatType(clipboard_format); 185 return FormatType(clipboard_format);
186 } 186 }
187 187
188 Clipboard::Clipboard() : create_window_(false) { 188 Clipboard::Clipboard() : create_window_(false) {
189 if (MessageLoop::current()->type() == MessageLoop::TYPE_UI) { 189 if (MessageLoop::current()->type() == MessageLoop::TYPE_UI) {
190 // Make a dummy HWND to be the clipboard's owner. 190 // Make a dummy HWND to be the clipboard's owner.
191 WNDCLASSEX wcex = {0}; 191 WNDCLASSEXW window_class;
dcheng 2012/05/04 19:40:31 Why change this from WNDCLASSEX to WNDCLASSEXW?
alexeypa (please no reviews) 2012/05/04 19:54:24 Unintentional. Reverted.
192 wcex.cbSize = sizeof(WNDCLASSEX); 192 base::win::InitializeWindowClass(
193 wcex.lpfnWndProc = base::win::WrappedWindowProc<ClipboardOwnerWndProc>; 193 L"ClipboardOwnerWindowClass",
194 wcex.hInstance = GetModuleHandle(NULL); 194 &base::win::WrappedWindowProc<ClipboardOwnerWndProc>,
195 wcex.lpszClassName = L"ClipboardOwnerWindowClass"; 195 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
196 ::RegisterClassEx(&wcex); 196 &window_class);
197 ::RegisterClassEx(&window_class);
197 create_window_ = true; 198 create_window_ = true;
198 } 199 }
199 200
200 clipboard_owner_ = NULL; 201 clipboard_owner_ = NULL;
201 } 202 }
202 203
203 Clipboard::~Clipboard() { 204 Clipboard::~Clipboard() {
204 if (clipboard_owner_) 205 if (clipboard_owner_)
205 ::DestroyWindow(clipboard_owner_); 206 ::DestroyWindow(clipboard_owner_);
206 clipboard_owner_ = NULL; 207 clipboard_owner_ = NULL;
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", 837 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass",
837 L"ClipboardOwnerWindow", 838 L"ClipboardOwnerWindow",
838 0, 0, 0, 0, 0, 839 0, 0, 0, 0, 0,
839 HWND_MESSAGE, 840 HWND_MESSAGE,
840 0, 0, 0); 841 0, 0, 0);
841 } 842 }
842 return clipboard_owner_; 843 return clipboard_owner_;
843 } 844 }
844 845
845 } // namespace ui 846 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698