| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" | 5 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 PrintersManagerFactory::~PrintersManagerFactory() {} | 51 PrintersManagerFactory::~PrintersManagerFactory() {} |
| 52 | 52 |
| 53 PrintersManager* PrintersManagerFactory::BuildServiceInstanceFor( | 53 PrintersManager* PrintersManagerFactory::BuildServiceInstanceFor( |
| 54 content::BrowserContext* browser_context) const { | 54 content::BrowserContext* browser_context) const { |
| 55 Profile* profile = Profile::FromBrowserContext(browser_context); | 55 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 56 | 56 |
| 57 browser_sync::ProfileSyncService* sync_service = | 57 browser_sync::ProfileSyncService* sync_service = |
| 58 ProfileSyncServiceFactory::GetForProfile(profile); | 58 ProfileSyncServiceFactory::GetForProfile(profile); |
| 59 | 59 |
| 60 // TODO(skau): --disable-sync and --enable-native-cups are mutually exclusive | 60 // TODO(skym): After crbug.com/688533 is fixed, this should not use |
| 61 // until crbug.com/688533 is resolved. | 61 // CreateInMemoryStoreForTest, but rather a ModelTypeStore creation mechanism |
| 62 DCHECK(sync_service); | 62 // that's agnostic to the existence of sync infrastructure. |
| 63 const syncer::ModelTypeStoreFactory& store_factory = |
| 64 sync_service ? sync_service->GetModelTypeStoreFactory(syncer::PRINTERS) |
| 65 : base::BindRepeating( |
| 66 syncer::ModelTypeStore::CreateInMemoryStoreForTest, |
| 67 syncer::PRINTERS); |
| 63 | 68 |
| 64 std::unique_ptr<PrintersSyncBridge> sync_bridge = | 69 std::unique_ptr<PrintersSyncBridge> sync_bridge = |
| 65 base::MakeUnique<PrintersSyncBridge>( | 70 base::MakeUnique<PrintersSyncBridge>( |
| 66 sync_service->GetModelTypeStoreFactory(syncer::PRINTERS), | 71 store_factory, |
| 67 base::BindRepeating( | 72 base::BindRepeating( |
| 68 base::IgnoreResult(&base::debug::DumpWithoutCrashing))); | 73 base::IgnoreResult(&base::debug::DumpWithoutCrashing))); |
| 69 | 74 |
| 70 return new PrintersManager(profile, std::move(sync_bridge)); | 75 return new PrintersManager(profile, std::move(sync_bridge)); |
| 71 } | 76 } |
| 72 | 77 |
| 73 } // namespace chromeos | 78 } // namespace chromeos |
| OLD | NEW |