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

Side by Side Diff: ui/base/clipboard/clipboard_util_mac.h

Issue 1852433004: Fix NSPasteboard leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_
6 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_
7 7
8 #import <AppKit/AppKit.h> 8 #import <AppKit/AppKit.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/memory/ref_counted.h"
11 #include "ui/base/ui_base_export.h" 12 #include "ui/base/ui_base_export.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
16 class UI_BASE_EXPORT UniquePasteboard
17 : public base::RefCounted<UniquePasteboard> {
18 public:
19 UniquePasteboard();
20
21 NSPasteboard* get() { return pasteboard_; }
22
23 private:
24 friend class base::RefCounted<UniquePasteboard>;
25 ~UniquePasteboard();
26 base::scoped_nsobject<NSPasteboard> pasteboard_;
27 };
28
15 class UI_BASE_EXPORT ClipboardUtil { 29 class UI_BASE_EXPORT ClipboardUtil {
16 public: 30 public:
17 // Returns an NSPasteboardItem that represents the given |url|. 31 // Returns an NSPasteboardItem that represents the given |url|.
18 // |url| must not be nil. 32 // |url| must not be nil.
19 // If |title| is nil, |url| is used in its place. 33 // If |title| is nil, |url| is used in its place.
20 static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrl( 34 static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrl(
21 NSString* url, 35 NSString* url,
22 NSString* title); 36 NSString* title);
23 }; 37 };
24 } 38 }
25 39
26 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ 40 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_
OLDNEW
« no previous file with comments | « content/common/sandbox_mac_system_access_unittest.mm ('k') | ui/base/clipboard/clipboard_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698