Home | History | Annotate | Download | only in ownership
      1 // Copyright 2014 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 
      5 #ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_
      6 #define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_
      7 
      8 #include <string>
      9 
     10 #include "base/compiler_specific.h"
     11 #include "base/macros.h"
     12 #include "base/memory/singleton.h"
     13 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
     14 
     15 class KeyedService;
     16 class Profile;
     17 
     18 namespace chromeos {
     19 
     20 class OwnerSettingsService;
     21 
     22 class OwnerSettingsServiceFactory : public BrowserContextKeyedServiceFactory {
     23  public:
     24   static OwnerSettingsService* GetForProfile(Profile* profile);
     25 
     26   static OwnerSettingsServiceFactory* GetInstance();
     27 
     28   // Sets name of the user supposed to be an owner. If profile
     29   // for |username| is ready, request to reload owner key will be
     30   // sent. Otherwise, owner key will be reloaded as soon as profile will
     31   // be ready.
     32   void SetUsername(const std::string& username);
     33 
     34   // Returns the name of the user supposed to be an owner.
     35   std::string GetUsername() const;
     36 
     37  private:
     38   friend struct DefaultSingletonTraits<OwnerSettingsServiceFactory>;
     39 
     40   OwnerSettingsServiceFactory();
     41   virtual ~OwnerSettingsServiceFactory();
     42 
     43   static KeyedService* BuildInstanceFor(content::BrowserContext* context);
     44 
     45   // BrowserContextKeyedBaseFactory overrides:
     46   virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
     47 
     48   // BrowserContextKeyedServiceFactory implementation:
     49   virtual KeyedService* BuildServiceInstanceFor(
     50       content::BrowserContext* browser_context) const OVERRIDE;
     51 
     52   // Name of the user supposed to be an owner.
     53   std::string username_;
     54 
     55   DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceFactory);
     56 };
     57 
     58 }  // namespace chromeos
     59 
     60 #endif  // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_
     61