summaryrefslogtreecommitdiffstats
path: root/components/profile_service/profile_service_impl.cc
blob: b6239dd706459860cd7bc7d52bf90d00d965cbfe (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
// 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.

#include "components/profile_service/profile_service_impl.h"

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "components/filesystem/directory_impl.h"
#include "components/filesystem/lock_table.h"
#include "mojo/shell/public/cpp/connection.h"

namespace profile {

ProfileServiceImpl::ProfileServiceImpl(
    mojo::Connection* connection,
    mojo::InterfaceRequest<ProfileService> request,
    base::FilePath base_profile_dir,
    filesystem::LockTable* lock_table)
    : binding_(this, std::move(request)),
      lock_table_(lock_table),
      path_(base_profile_dir) {
  if (!base::PathExists(path_))
    base::CreateDirectory(path_);
}

ProfileServiceImpl::~ProfileServiceImpl() {
}

void ProfileServiceImpl::GetDirectory(
    mojo::InterfaceRequest<filesystem::Directory> request) {
  new filesystem::DirectoryImpl(std::move(request),
                                path_,
                                scoped_ptr<base::ScopedTempDir>(),
                                lock_table_);
}

}  // namespace profile