Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / managed_mode / chromeos / managed_user_password_service.h
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_MANAGED_MODE_CHROMEOS_MANAGED_USER_PASSWORD_SERVICE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_CHROMEOS_MANAGED_USER_PASSWORD_SERVICE_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/managed_mode/managed_user_shared_settings_service.h"
14 #include "chrome/browser/managed_mode/managed_users.h"
15 #include "components/browser_context_keyed_service/browser_context_keyed_service.h"
16
17 class ManagedUserPasswordService : public BrowserContextKeyedService {
18  public:
19   ManagedUserPasswordService();
20   virtual ~ManagedUserPasswordService();
21
22   virtual void Shutdown() OVERRIDE;
23
24   void Init(const std::string& user_id,
25             ManagedUserSharedSettingsService* service);
26  private:
27   void OnSharedSettingsChange(const std::string& mu_id, const std::string& key);
28
29   // Cached value from Init().
30   // User id of currently logged in managed user.
31   std::string user_id_;
32   ManagedUserSharedSettingsService* settings_service_;
33
34   scoped_ptr<ManagedUserSharedSettingsService::ChangeCallbackList::Subscription>
35       settings_service_subscription_;
36
37   base::WeakPtrFactory<ManagedUserPasswordService> weak_ptr_factory_;
38
39   DISALLOW_COPY_AND_ASSIGN(ManagedUserPasswordService);
40 };
41
42 #endif  // CHROME_BROWSER_MANAGED_MODE_CHROMEOS_MANAGED_USER_PASSWORD_SERVICE_H_