Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / policy / cloud / user_policy_signin_service_factory.h
blob12ecd396529b4294d8053487ba232388dc8d23c1
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
11 class Profile;
13 namespace user_prefs {
14 class PrefRegistrySyncable;
17 namespace policy {
19 class DeviceManagementService;
20 class UserPolicySigninService;
22 // Singleton that owns all UserPolicySigninServices and creates/deletes them as
23 // new Profiles are created/shutdown.
24 class UserPolicySigninServiceFactory
25 : public BrowserContextKeyedServiceFactory {
26 public:
27 // Returns an instance of the UserPolicySigninServiceFactory singleton.
28 static UserPolicySigninServiceFactory* GetInstance();
30 // Returns the instance of UserPolicySigninService for the passed |profile|.
31 // Used primarily for testing.
32 static UserPolicySigninService* GetForProfile(Profile* profile);
34 // Allows setting a mock DeviceManagementService for tests. Does not take
35 // ownership, and should be reset to NULL at the end of the test.
36 // Set this before an instance is built for a Profile.
37 static void SetDeviceManagementServiceForTesting(
38 DeviceManagementService* device_management_service);
40 protected:
41 // BrowserContextKeyedServiceFactory implementation.
42 KeyedService* BuildServiceInstanceFor(
43 content::BrowserContext* profile) const override;
45 // Overridden to cause this object to be created when the profile is created.
46 bool ServiceIsCreatedWithBrowserContext() const override;
48 // Register the preferences related to cloud-based user policy.
49 void RegisterProfilePrefs(
50 user_prefs::PrefRegistrySyncable* registry) override;
52 private:
53 friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>;
55 UserPolicySigninServiceFactory();
56 ~UserPolicySigninServiceFactory() override;
58 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceFactory);
61 } // namespace policy
63 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_