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 #ifndef BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ | 5 #ifndef BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ |
6 #define BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ | 6 #define BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ |
7 | 7 |
8 #include <Security/Authorization.h> | 8 #include <Security/Authorization.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 AuthorizationRef get() const { | 54 AuthorizationRef get() const { |
55 return authorization_; | 55 return authorization_; |
56 } | 56 } |
57 | 57 |
58 void swap(ScopedAuthorizationRef& that) { | 58 void swap(ScopedAuthorizationRef& that) { |
59 AuthorizationRef temp = that.authorization_; | 59 AuthorizationRef temp = that.authorization_; |
60 that.authorization_ = authorization_; | 60 that.authorization_ = authorization_; |
61 authorization_ = temp; | 61 authorization_ = temp; |
62 } | 62 } |
63 | 63 |
64 // ScopedAuthorizationRef::release() is like scoped_ptr<>::release. It is | 64 // ScopedAuthorizationRef::release() is like std::unique_ptr<>::release. It |
65 // is | |
Nico
2016/04/04 17:14:55
manually reflow this comment (clang-format sucks a
dcheng
2016/04/04 17:43:38
Done.
| |
65 // NOT a wrapper for AuthorizationFree(). To force a | 66 // NOT a wrapper for AuthorizationFree(). To force a |
66 // ScopedAuthorizationRef object to call AuthorizationFree(), use | 67 // ScopedAuthorizationRef object to call AuthorizationFree(), use |
67 // ScopedAuthorizationRef::reset(). | 68 // ScopedAuthorizationRef::reset(). |
68 AuthorizationRef release() WARN_UNUSED_RESULT { | 69 AuthorizationRef release() WARN_UNUSED_RESULT { |
69 AuthorizationRef temp = authorization_; | 70 AuthorizationRef temp = authorization_; |
70 authorization_ = NULL; | 71 authorization_ = NULL; |
71 return temp; | 72 return temp; |
72 } | 73 } |
73 | 74 |
74 private: | 75 private: |
75 AuthorizationRef authorization_; | 76 AuthorizationRef authorization_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(ScopedAuthorizationRef); | 78 DISALLOW_COPY_AND_ASSIGN(ScopedAuthorizationRef); |
78 }; | 79 }; |
79 | 80 |
80 } // namespace mac | 81 } // namespace mac |
81 } // namespace base | 82 } // namespace base |
82 | 83 |
83 #endif // BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ | 84 #endif // BASE_MAC_SCOPED_AUTHORIZATIONREF_H_ |
OLD | NEW |