sanjeetnd | 54f6f9f4 | 2023-08-23 17:33:34 | [diff] [blame] | 1 | // 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 Luan | acb2f9b | 2023-09-05 23:47:13 | [diff] [blame^] | 10 | #include "chrome/browser/manta/orca_provider.h" |
sanjeetnd | 54f6f9f4 | 2023-08-23 17:33:34 | [diff] [blame] | 11 | #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 | |
| 17 | namespace manta { |
| 18 | |
| 19 | MantaService::MantaService(Profile* const profile) : profile_(profile) { |
| 20 | CHECK(profile_); |
| 21 | } |
| 22 | |
Xinglong Luan | acb2f9b | 2023-09-05 23:47:13 | [diff] [blame^] | 23 | std::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 | |
sanjeetnd | 54f6f9f4 | 2023-08-23 17:33:34 | [diff] [blame] | 34 | std::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 |