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
3// found in the LICENSE file.
4
5#ifndef MOJO_SERVICES_TEST_SERVICE_TEST_SERVICE_IMPL_H_
6#define MOJO_SERVICES_TEST_SERVICE_TEST_SERVICE_IMPL_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "mojo/public/cpp/system/macros.h"
10#include "mojo/services/test_service/test_service.mojom.h"
11
12namespace mojo {
13class ApplicationConnection;
14namespace test {
15
16class TestRequestTrackerClientImpl;
17class TestServiceApplication;
18
19class TestServiceImpl : public InterfaceImpl<TestService> {
20 public:
21  TestServiceImpl(ApplicationConnection* connection,
22                  TestServiceApplication* application);
23  virtual ~TestServiceImpl();
24
25  // |TestService| methods:
26  virtual void OnConnectionEstablished() MOJO_OVERRIDE;
27  virtual void OnConnectionError() MOJO_OVERRIDE;
28  virtual void Ping(const mojo::Callback<void()>& callback) MOJO_OVERRIDE;
29  virtual void ConnectToAppAndGetTime(
30      const mojo::String& app_url,
31      const mojo::Callback<void(int64_t)>& callback) MOJO_OVERRIDE;
32  virtual void StartTrackingRequests(const mojo::Callback<void()>& callback)
33      MOJO_OVERRIDE;
34
35 private:
36  TestServiceApplication* const application_;
37  ApplicationConnection* const connection_;
38  TestTimeServicePtr time_service_;
39  scoped_ptr<TestRequestTrackerClientImpl> tracking_;
40
41  MOJO_DISALLOW_COPY_AND_ASSIGN(TestServiceImpl);
42};
43
44}  // namespace test
45}  // namespace mojo
46
47#endif  // MOJO_SERVICES_TEST_SERVICE_TEST_SERVICE_IMPL_H_
48