| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ | 5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |
| 6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ | 6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 13 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 14 #include "sync/internal_api/public/http_post_provider_factory.h" | 15 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 15 #include "sync/internal_api/public/http_post_provider_interface.h" | 16 #include "sync/internal_api/public/http_post_provider_interface.h" |
| 16 | 17 |
| 17 namespace fake_server { | 18 namespace fake_server { |
| 18 | 19 |
| 19 class FakeServer; | 20 class FakeServer; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 64 |
| 64 class FakeServerHttpPostProviderFactory | 65 class FakeServerHttpPostProviderFactory |
| 65 : public syncer::HttpPostProviderFactory { | 66 : public syncer::HttpPostProviderFactory { |
| 66 public: | 67 public: |
| 67 FakeServerHttpPostProviderFactory( | 68 FakeServerHttpPostProviderFactory( |
| 68 const base::WeakPtr<FakeServer>& fake_server, | 69 const base::WeakPtr<FakeServer>& fake_server, |
| 69 scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner); | 70 scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner); |
| 70 ~FakeServerHttpPostProviderFactory() override; | 71 ~FakeServerHttpPostProviderFactory() override; |
| 71 | 72 |
| 72 // HttpPostProviderFactory: | 73 // HttpPostProviderFactory: |
| 73 void Init(const std::string& user_agent) override; | 74 void Init( |
| 75 const std::string& user_agent, |
| 76 const syncer::BindToTrackerCallback& bind_to_tracker_callback) override; |
| 74 syncer::HttpPostProviderInterface* Create() override; | 77 syncer::HttpPostProviderInterface* Create() override; |
| 75 void Destroy(syncer::HttpPostProviderInterface* http) override; | 78 void Destroy(syncer::HttpPostProviderInterface* http) override; |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 // |fake_server_| should only be dereferenced on the same thread as | 81 // |fake_server_| should only be dereferenced on the same thread as |
| 79 // |fake_server_task_runner_| runs on. | 82 // |fake_server_task_runner_| runs on. |
| 80 base::WeakPtr<FakeServer> fake_server_; | 83 base::WeakPtr<FakeServer> fake_server_; |
| 81 scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner_; | 84 scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner_; |
| 82 | 85 |
| 83 DISALLOW_COPY_AND_ASSIGN(FakeServerHttpPostProviderFactory); | 86 DISALLOW_COPY_AND_ASSIGN(FakeServerHttpPostProviderFactory); |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 } // namespace fake_server | 89 } // namespace fake_server |
| 87 | 90 |
| 88 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ | 91 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_HTTP_POST_PROVIDER_H_ |
| OLD | NEW |