OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <unordered_map> |
| 6 |
| 7 #include "base/callback.h" |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/common/loader_test.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/binding.h" |
| 12 |
| 13 #ifndef CONTENT_BROWSER_LOADER_LOADER_SERVICE_IMPL_H_ |
| 14 #define CONTENT_BROWSER_LOADER_LOADER_SERVICE_IMPL_H_ |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class LoaderTestServiceContext; |
| 19 |
| 20 // Implements the LoaderTestService Mojo interface. |
| 21 class LoaderTestServiceImpl final : public LoaderTestService { |
| 22 public: |
| 23 // |context| must outlive this object. |update_callback| will be called when |
| 24 // location updates are sent, allowing the client to know when the service |
| 25 // is being used. |
| 26 LoaderTestServiceImpl(mojo::InterfaceRequest<LoaderTestService> request, |
| 27 LoaderTestServiceContext* context); |
| 28 ~LoaderTestServiceImpl() override; |
| 29 |
| 30 private: |
| 31 class Job; |
| 32 void OnConnectionError(); |
| 33 |
| 34 // LoaderTestService: |
| 35 void Transmit(mojo::ScopedDataPipeConsumerHandle pipe, |
| 36 const TransmitCallback& callback) override; |
| 37 void Hash(mojo::ScopedDataPipeConsumerHandle pipe, |
| 38 const HashCallback& callback) override; |
| 39 |
| 40 void DeleteJob(int id); |
| 41 |
| 42 mojo::Binding<LoaderTestService> binding_; |
| 43 // Owns this. |
| 44 LoaderTestServiceContext* context_; |
| 45 int job_id_; |
| 46 std::unordered_map<int, scoped_ptr<Job>> jobs_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(LoaderTestServiceImpl); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_LOADER_LOADER_SERVICE_IMPL_H_ |
OLD | NEW |