| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 template <typename T> | 51 template <typename T> |
| 52 class ResultSavingCookieCallback : public CookieCallback { | 52 class ResultSavingCookieCallback : public CookieCallback { |
| 53 public: | 53 public: |
| 54 ResultSavingCookieCallback() { | 54 ResultSavingCookieCallback() {} |
| 55 } | |
| 56 explicit ResultSavingCookieCallback(base::Thread* run_in_thread) | 55 explicit ResultSavingCookieCallback(base::Thread* run_in_thread) |
| 57 : CookieCallback(run_in_thread) { | 56 : CookieCallback(run_in_thread) {} |
| 58 } | |
| 59 | 57 |
| 60 void Run(T result) { | 58 void Run(T result) { |
| 61 result_ = result; | 59 result_ = result; |
| 62 CallbackEpilogue(); | 60 CallbackEpilogue(); |
| 63 } | 61 } |
| 64 | 62 |
| 65 const T& result() { return result_; } | 63 const T& result() { return result_; } |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 T result_; | 66 T result_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 | 80 |
| 83 private: | 81 private: |
| 84 std::string result_; | 82 std::string result_; |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 class NoResultCookieCallback : public CookieCallback { | 85 class NoResultCookieCallback : public CookieCallback { |
| 88 public: | 86 public: |
| 89 NoResultCookieCallback(); | 87 NoResultCookieCallback(); |
| 90 explicit NoResultCookieCallback(base::Thread* run_in_thread); | 88 explicit NoResultCookieCallback(base::Thread* run_in_thread); |
| 91 | 89 |
| 92 void Run() { | 90 void Run() { CallbackEpilogue(); } |
| 93 CallbackEpilogue(); | |
| 94 } | |
| 95 }; | 91 }; |
| 96 | 92 |
| 97 } // namespace net | 93 } // namespace net |
| 98 | 94 |
| 99 #endif // NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ | 95 #endif // NET_COOKIES_COOKIE_STORE_TEST_CALLBACKS_H_ |
| OLD | NEW |