blob: b9fb2a858c2e70e4bf2ee6895d36f096287510ea [file] [log] [blame]
sanjeetnd54f6f9f42023-08-23 17:33:341// Copyright 2023 The Chromium Authors
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 "chrome/browser/manta/manta_service.h"
6
7#include <memory>
8
9#include "base/check.h"
Xinglong Luanacb2f9b2023-09-05 23:47:1310#include "chrome/browser/manta/orca_provider.h"
sanjeetnd54f6f9f42023-08-23 17:33:3411#include "chrome/browser/manta/snapper_provider.h"
12#include "chrome/browser/profiles/profile.h"
13#include "chrome/browser/signin/identity_manager_factory.h"
14#include "components/signin/public/identity_manager/identity_manager.h"
15#include "content/public/browser/storage_partition.h"
16
17namespace manta {
18
19MantaService::MantaService(Profile* const profile) : profile_(profile) {
20 CHECK(profile_);
21}
22
Xinglong Luanacb2f9b2023-09-05 23:47:1323std::unique_ptr<OrcaProvider> MantaService::CreateOrcaProvider() {
24 signin::IdentityManager* identity_manager =
25 IdentityManagerFactory::GetForProfile(profile_);
26 CHECK(identity_manager);
27
28 return std::make_unique<OrcaProvider>(
29 profile_->GetDefaultStoragePartition()
30 ->GetURLLoaderFactoryForBrowserProcess(),
31 identity_manager);
32}
33
sanjeetnd54f6f9f42023-08-23 17:33:3434std::unique_ptr<SnapperProvider> MantaService::CreateSnapperProvider() {
35 signin::IdentityManager* identity_manager =
36 IdentityManagerFactory::GetForProfile(profile_);
37 CHECK(identity_manager);
38
39 return std::make_unique<SnapperProvider>(
40 profile_->GetDefaultStoragePartition()
41 ->GetURLLoaderFactoryForBrowserProcess(),
42 identity_manager);
43}
44
45} // namespace manta