OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebCallbacks_h | 31 #ifndef WebCallbacks_h |
32 #define WebCallbacks_h | 32 #define WebCallbacks_h |
33 | 33 |
34 #include "public/platform/WebPassOwnPtr.h" | |
35 | |
36 namespace blink { | 34 namespace blink { |
37 | 35 |
38 // A WebCallbacks<S, T> represents a callback object. Typically it is created | 36 // A WebCallbacks<S, T> represents a callback object. Typically it is created |
39 // in Blink and passed to Chromium, and onSuccess or onError will be called | 37 // in Blink and passed to Chromium, and onSuccess or onError will be called |
40 // from Chromium. | 38 // from Chromium. |
41 // When transferring ownership, use |WebPrivatePassOwnPtr<X>| as a type | 39 // When transferring ownership, use |WebPrivatePassOwnPtr<X>| as a type |
kinuko
2016/04/07 00:36:45
nit: WebPrivatePassOwnPtr<X> -> unique_ptr<X>
dcheng
2016/04/07 00:58:45
Done, thanks.
| |
42 // parameter. Otherwise, |const X&| or |X| for a type parameter. It is | 40 // parameter. Otherwise, |const X&| or |X| for a type parameter. It is |
43 // generally not preferred to use |X*| because the object ownership is not well | 41 // generally not preferred to use |X*| because the object ownership is not well |
44 // specified. | 42 // specified. |
45 | 43 |
46 template<typename S, typename T> | 44 template<typename S, typename T> |
47 class WebCallbacks { | 45 class WebCallbacks { |
48 public: | 46 public: |
49 virtual ~WebCallbacks() {} | 47 virtual ~WebCallbacks() {} |
50 virtual void onSuccess(S) {} | 48 virtual void onSuccess(S) {} |
51 virtual void onError(T) {} | 49 virtual void onError(T) {} |
(...skipping 19 matching lines...) Expand all Loading... | |
71 class WebCallbacks<void, void> { | 69 class WebCallbacks<void, void> { |
72 public: | 70 public: |
73 virtual ~WebCallbacks() {} | 71 virtual ~WebCallbacks() {} |
74 virtual void onSuccess() {} | 72 virtual void onSuccess() {} |
75 virtual void onError() {} | 73 virtual void onError() {} |
76 }; | 74 }; |
77 | 75 |
78 } // namespace blink | 76 } // namespace blink |
79 | 77 |
80 #endif | 78 #endif |
OLD | NEW |