quick_pair_browser_delegate.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_QUICK_PAIR_COMMON_QUICK_PAIR_BROWSER_DELEGATE_H_
  5. #define ASH_QUICK_PAIR_COMMON_QUICK_PAIR_BROWSER_DELEGATE_H_
  6. #include "ash/services/quick_pair/public/mojom/quick_pair_service.mojom-forward.h"
  7. #include "base/component_export.h"
  8. #include "base/memory/scoped_refptr.h"
  9. #include "mojo/public/cpp/bindings/pending_receiver.h"
  10. class PrefService;
  11. namespace image_fetcher {
  12. class ImageFetcher;
  13. } // namespace image_fetcher
  14. namespace network {
  15. class SharedURLLoaderFactory;
  16. } // namespace network
  17. namespace signin {
  18. class IdentityManager;
  19. } // namespace signin
  20. namespace ash {
  21. namespace quick_pair {
  22. // Interface for a class which provides browser dependences to classes within
  23. // ash::quick_pair. This allows us to retrieve dependencies (such as the active
  24. // user profile) which cannot directly be retrieved in ash.
  25. class COMPONENT_EXPORT(QUICK_PAIR_COMMON) QuickPairBrowserDelegate {
  26. public:
  27. QuickPairBrowserDelegate();
  28. QuickPairBrowserDelegate(const QuickPairBrowserDelegate&) = delete;
  29. QuickPairBrowserDelegate& operator=(const QuickPairBrowserDelegate&) = delete;
  30. virtual ~QuickPairBrowserDelegate();
  31. static QuickPairBrowserDelegate* Get();
  32. // Returns the URL loader factory associated with the active user's profile.
  33. virtual scoped_refptr<network::SharedURLLoaderFactory>
  34. GetURLLoaderFactory() = 0;
  35. // Returns a pointer to the IdentityManager for the active user.
  36. virtual signin::IdentityManager* GetIdentityManager() = 0;
  37. virtual std::unique_ptr<image_fetcher::ImageFetcher> GetImageFetcher() = 0;
  38. // For accessing prefs of the active user.
  39. virtual PrefService* GetActivePrefService() = 0;
  40. // Starts the utility process which houses QuickPairService and returns a
  41. // PendingReceiver for it.
  42. virtual void RequestService(
  43. mojo::PendingReceiver<mojom::QuickPairService> receiver) = 0;
  44. };
  45. } // namespace quick_pair
  46. } // namespace ash
  47. #endif // ASH_QUICK_PAIR_COMMON_QUICK_PAIR_BROWSER_DELEGATE_H_