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 NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ | 5 #ifndef NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ |
6 #define NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ | 6 #define NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 private: | 41 private: |
42 bool did_run_; | 42 bool did_run_; |
43 base::Thread* run_in_thread_; | 43 base::Thread* run_in_thread_; |
44 base::MessageLoop* run_in_loop_; | 44 base::MessageLoop* run_in_loop_; |
45 base::MessageLoop* parent_loop_; | 45 base::MessageLoop* parent_loop_; |
46 base::MessageLoop* loop_to_quit_; | 46 base::MessageLoop* loop_to_quit_; |
47 }; | 47 }; |
48 | 48 |
49 // Callback implementations for the asynchronous CookieStore methods. | 49 // Callback implementations for the asynchronous CookieStore methods. |
50 | 50 |
51 class SetCookieCallback : public CookieCallback { | 51 class BoolResultCookieCallback : public CookieCallback { |
52 public: | 52 public: |
53 SetCookieCallback(); | 53 BoolResultCookieCallback(); |
54 explicit SetCookieCallback(base::Thread* run_in_thread); | 54 explicit BoolResultCookieCallback(base::Thread* run_in_thread); |
55 | 55 |
56 void Run(bool result) { | 56 void Run(bool result) { |
57 result_ = result; | 57 result_ = result; |
58 CallbackEpilogue(); | 58 CallbackEpilogue(); |
59 } | 59 } |
60 | 60 |
61 bool result() { return result_; } | 61 bool result() { return result_; } |
62 | 62 |
63 private: | 63 private: |
64 bool result_; | 64 bool result_; |
65 }; | 65 }; |
66 | 66 |
67 class GetCookieStringCallback : public CookieCallback { | 67 class StringResultCookieCallback : public CookieCallback { |
68 public: | 68 public: |
69 GetCookieStringCallback(); | 69 StringResultCookieCallback(); |
70 explicit GetCookieStringCallback(base::Thread* run_in_thread); | 70 explicit StringResultCookieCallback(base::Thread* run_in_thread); |
71 | 71 |
72 void Run(const std::string& cookie) { | 72 void Run(const std::string& result) { |
73 cookie_ = cookie; | 73 result_ = result; |
74 CallbackEpilogue(); | 74 CallbackEpilogue(); |
75 } | 75 } |
76 | 76 |
77 const std::string& cookie() { return cookie_; } | 77 const std::string& result() { return result_; } |
78 | 78 |
79 private: | 79 private: |
80 std::string cookie_; | 80 std::string result_; |
81 }; | 81 }; |
82 | 82 |
83 class DeleteCallback : public CookieCallback { | 83 class IntResultCookieCallback : public CookieCallback { |
84 public: | 84 public: |
85 DeleteCallback(); | 85 IntResultCookieCallback(); |
86 explicit DeleteCallback(base::Thread* run_in_thread); | 86 explicit IntResultCookieCallback(base::Thread* run_in_thread); |
87 | 87 |
88 void Run(int num_deleted) { | 88 void Run(int result) { |
89 num_deleted_ = num_deleted; | 89 result_ = result; |
90 CallbackEpilogue(); | 90 CallbackEpilogue(); |
91 } | 91 } |
92 | 92 |
93 int num_deleted() { return num_deleted_; } | 93 int result() { return result_; } |
94 | 94 |
95 private: | 95 private: |
96 int num_deleted_; | 96 int result_; |
97 }; | 97 }; |
98 | 98 |
99 class DeleteCookieCallback : public CookieCallback { | 99 class NoResultCookieCallback : public CookieCallback { |
100 public: | 100 public: |
101 DeleteCookieCallback(); | 101 NoResultCookieCallback(); |
102 explicit DeleteCookieCallback(base::Thread* run_in_thread); | 102 explicit NoResultCookieCallback(base::Thread* run_in_thread); |
103 | 103 |
104 void Run() { | 104 void Run() { |
105 CallbackEpilogue(); | 105 CallbackEpilogue(); |
106 } | 106 } |
107 }; | 107 }; |
108 | 108 |
109 } // namespace net | 109 } // namespace net |
110 | 110 |
111 #endif // NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ | 111 #endif // NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ |
OLD | NEW |