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

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

Issue 6697004: Add an exception wrapper to the WindowProc functions so... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 #include <shellapi.h> 11 #include <shellapi.h>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/shared_memory.h" 16 #include "base/shared_memory.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "base/win/wrapped_window_proc.h"
20 #include "ui/base/clipboard/clipboard_util_win.h" 21 #include "ui/base/clipboard/clipboard_util_win.h"
21 #include "ui/gfx/size.h" 22 #include "ui/gfx/size.h"
22 23
23 namespace ui { 24 namespace ui {
24 25
25 namespace { 26 namespace {
26 27
27 // A scoper to manage acquiring and automatically releasing the clipboard. 28 // A scoper to manage acquiring and automatically releasing the clipboard.
28 class ScopedClipboard { 29 class ScopedClipboard {
29 public: 30 public:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return data; 129 return data;
129 }; 130 };
130 131
131 } // namespace 132 } // namespace
132 133
133 Clipboard::Clipboard() : create_window_(false) { 134 Clipboard::Clipboard() : create_window_(false) {
134 if (MessageLoop::current()->type() == MessageLoop::TYPE_UI) { 135 if (MessageLoop::current()->type() == MessageLoop::TYPE_UI) {
135 // Make a dummy HWND to be the clipboard's owner. 136 // Make a dummy HWND to be the clipboard's owner.
136 WNDCLASSEX wcex = {0}; 137 WNDCLASSEX wcex = {0};
137 wcex.cbSize = sizeof(WNDCLASSEX); 138 wcex.cbSize = sizeof(WNDCLASSEX);
138 wcex.lpfnWndProc = ClipboardOwnerWndProc; 139 wcex.lpfnWndProc = base::win::WrappedWindowProc<ClipboardOwnerWndProc>;
139 wcex.hInstance = GetModuleHandle(NULL); 140 wcex.hInstance = GetModuleHandle(NULL);
140 wcex.lpszClassName = L"ClipboardOwnerWindowClass"; 141 wcex.lpszClassName = L"ClipboardOwnerWindowClass";
141 ::RegisterClassEx(&wcex); 142 ::RegisterClassEx(&wcex);
142 create_window_ = true; 143 create_window_ = true;
143 } 144 }
144 145
145 clipboard_owner_ = NULL; 146 clipboard_owner_ = NULL;
146 } 147 }
147 148
148 Clipboard::~Clipboard() { 149 Clipboard::~Clipboard() {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", 598 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass",
598 L"ClipboardOwnerWindow", 599 L"ClipboardOwnerWindow",
599 0, 0, 0, 0, 0, 600 0, 0, 0, 0, 0,
600 HWND_MESSAGE, 601 HWND_MESSAGE,
601 0, 0, 0); 602 0, 0, 0);
602 } 603 }
603 return clipboard_owner_; 604 return clipboard_owner_;
604 } 605 }
605 606
606 } // namespace ui 607 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698