Index: content/browser/loader/loader_test_service_impl.h |
diff --git a/content/browser/loader/loader_test_service_impl.h b/content/browser/loader/loader_test_service_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..789414a70bf260e28b4fb40fe2dc7ace5b6a0d61 |
--- /dev/null |
+++ b/content/browser/loader/loader_test_service_impl.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <unordered_map> |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "content/common/loader_test.mojom.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+ |
+#ifndef CONTENT_BROWSER_LOADER_LOADER_SERVICE_IMPL_H_ |
+#define CONTENT_BROWSER_LOADER_LOADER_SERVICE_IMPL_H_ |
+ |
+namespace content { |
+ |
+class LoaderTestServiceContext; |
+ |
+// Implements the LoaderTestService Mojo interface. |
+class LoaderTestServiceImpl final : public LoaderTestService { |
+ public: |
+ // |context| must outlive this object. |update_callback| will be called when |
+ // location updates are sent, allowing the client to know when the service |
+ // is being used. |
+ LoaderTestServiceImpl(mojo::InterfaceRequest<LoaderTestService> request, |
+ LoaderTestServiceContext* context); |
+ ~LoaderTestServiceImpl() override; |
+ |
+ private: |
+ class Job; |
+ void OnConnectionError(); |
+ |
+ // LoaderTestService: |
+ void Transmit(mojo::ScopedDataPipeConsumerHandle pipe, |
+ const TransmitCallback& callback) override; |
+ void Hash(mojo::ScopedDataPipeConsumerHandle pipe, |
+ const HashCallback& callback) override; |
+ |
+ void DeleteJob(int id); |
+ |
+ mojo::Binding<LoaderTestService> binding_; |
+ // Owns this. |
+ LoaderTestServiceContext* context_; |
+ int job_id_; |
+ std::unordered_map<int, scoped_ptr<Job>> jobs_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LoaderTestServiceImpl); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_LOADER_LOADER_SERVICE_IMPL_H_ |