OLD | NEW |
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_win.h" | 8 #include "ui/base/clipboard/clipboard_win.h" |
9 | 9 |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return true; | 77 return true; |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 // We failed to acquire the clipboard. | 81 // We failed to acquire the clipboard. |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
85 void Release() { | 85 void Release() { |
86 if (opened_) { | 86 if (opened_) { |
| 87 ::ImpersonateAnonymousToken(GetCurrentThread()); |
87 ::CloseClipboard(); | 88 ::CloseClipboard(); |
| 89 ::RevertToSelf(); |
88 opened_ = false; | 90 opened_ = false; |
89 } else { | 91 } else { |
90 NOTREACHED(); | 92 NOTREACHED(); |
91 } | 93 } |
92 } | 94 } |
93 | 95 |
94 private: | 96 private: |
95 bool opened_; | 97 bool opened_; |
96 }; | 98 }; |
97 | 99 |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 if (!clipboard_owner_) | 855 if (!clipboard_owner_) |
854 return NULL; | 856 return NULL; |
855 | 857 |
856 if (clipboard_owner_->hwnd() == NULL) | 858 if (clipboard_owner_->hwnd() == NULL) |
857 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); | 859 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); |
858 | 860 |
859 return clipboard_owner_->hwnd(); | 861 return clipboard_owner_->hwnd(); |
860 } | 862 } |
861 | 863 |
862 } // namespace ui | 864 } // namespace ui |
OLD | NEW |