summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/ownership/owner_settings_service_factory.h
blob: 055fb3e8423402842af21b1c5732100a7c210e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_
#define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_

#include <string>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

class KeyedService;
class Profile;

namespace chromeos {

class OwnerSettingsService;

class OwnerSettingsServiceFactory : public BrowserContextKeyedServiceFactory {
 public:
  static OwnerSettingsService* GetForProfile(Profile* profile);

  static OwnerSettingsServiceFactory* GetInstance();

  // Sets name of the user supposed to be an owner. If profile
  // for |username| is ready, request to reload owner key will be
  // sent. Otherwise, owner key will be reloaded as soon as profile will
  // be ready.
  void SetUsername(const std::string& username);

  // Returns the name of the user supposed to be an owner.
  std::string GetUsername() const;

 private:
  friend struct DefaultSingletonTraits<OwnerSettingsServiceFactory>;

  OwnerSettingsServiceFactory();
  virtual ~OwnerSettingsServiceFactory();

  static KeyedService* BuildInstanceFor(content::BrowserContext* context);

  // BrowserContextKeyedBaseFactory overrides:
  virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;

  // BrowserContextKeyedServiceFactory implementation:
  virtual KeyedService* BuildServiceInstanceFor(
      content::BrowserContext* browser_context) const OVERRIDE;

  // Name of the user supposed to be an owner.
  std::string username_;

  DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceFactory);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_FACTORY_H_