summaryrefslogtreecommitdiffstats
path: root/components/profile_service/profile_service_impl.h
blob: 6022af02c69a042764187c25fb8bfb90b78b0839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2016 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.

#ifndef COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_
#define COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_

#include "base/files/file_path.h"
#include "components/filesystem/public/interfaces/directory.mojom.h"
#include "components/profile_service/public/interfaces/profile.mojom.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/shell/public/cpp/connection.h"

namespace filesystem {
class LockTable;
}

namespace mojo {
class MessageLoopRef;
}

namespace profile {

// A service which serves directories to callers.
class ProfileServiceImpl : public ProfileService {
 public:
  ProfileServiceImpl(const base::FilePath& base_profile_dir,
                     const scoped_refptr<filesystem::LockTable>& lock_table);
  ~ProfileServiceImpl() override;

  // Overridden from ProfileService:
  void GetDirectory(filesystem::DirectoryRequest request,
                    const GetDirectoryCallback& callback) override;
  void GetSubDirectory(const mojo::String& sub_directory_path,
                       filesystem::DirectoryRequest request,
                       const GetSubDirectoryCallback& callback) override;

 private:
  scoped_refptr<filesystem::LockTable> lock_table_;
  base::FilePath path_;

  DISALLOW_COPY_AND_ASSIGN(ProfileServiceImpl);
};

}  // namespace profile

#endif  // COMPONENTS_PROFILE_SERVICE_PROFILE_SERVICE_IMPL_H_