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

Side by Side Diff: remoting/host/clipboard_win.cc

Issue 792413003: Added impersonation of the anonymous token around CloseClipboard (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 | « no previous file | ui/base/clipboard/clipboard_win.cc » ('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 "remoting/host/clipboard.h" 5 #include "remoting/host/clipboard.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 // A scoper class that opens and closes the clipboard. 25 // A scoper class that opens and closes the clipboard.
26 // This class was adapted from the ScopedClipboard class in 26 // This class was adapted from the ScopedClipboard class in
27 // ui/base/clipboard/clipboard_win.cc. 27 // ui/base/clipboard/clipboard_win.cc.
28 class ScopedClipboard { 28 class ScopedClipboard {
29 public: 29 public:
30 ScopedClipboard() : opened_(false) { 30 ScopedClipboard() : opened_(false) {
31 } 31 }
32 32
33 ~ScopedClipboard() { 33 ~ScopedClipboard() {
34 if (opened_) { 34 if (opened_) {
35 ::ImpersonateAnonymousToken(GetCurrentThread());
jschuh 2014/12/11 17:53:06 I know the impersonate *shouldn't* fail, but it's
dcheng 2014/12/11 18:18:23 Can we use a scoper to wrap this logic? ... also,
35 ::CloseClipboard(); 36 ::CloseClipboard();
37 ::RevertToSelf();
36 } 38 }
37 } 39 }
38 40
39 bool Init(HWND owner) { 41 bool Init(HWND owner) {
40 const int kMaxAttemptsToOpenClipboard = 5; 42 const int kMaxAttemptsToOpenClipboard = 5;
41 const base::TimeDelta kSleepTimeBetweenAttempts = 43 const base::TimeDelta kSleepTimeBetweenAttempts =
42 base::TimeDelta::FromMilliseconds(5); 44 base::TimeDelta::FromMilliseconds(5);
43 45
44 if (opened_) { 46 if (opened_) {
45 NOTREACHED(); 47 NOTREACHED();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 271 }
270 272
271 return false; 273 return false;
272 } 274 }
273 275
274 scoped_ptr<Clipboard> Clipboard::Create() { 276 scoped_ptr<Clipboard> Clipboard::Create() {
275 return make_scoped_ptr(new ClipboardWin()); 277 return make_scoped_ptr(new ClipboardWin());
276 } 278 }
277 279
278 } // namespace remoting 280 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698