Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_policy_provider.h

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana ger.h" 15 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana ger.h"
16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
17 #include "components/policy/core/common/configuration_policy_provider.h" 17 #include "components/policy/core/common/configuration_policy_provider.h"
18 18
19 namespace policy { 19 namespace policy {
20 20
21 class PolicyMap; 21 class PolicyMap;
22 22
23 // Policy provider for a device-local account. Pulls policy from 23 // Policy provider for a device-local account. Pulls policy from
24 // DeviceLocalAccountPolicyService. Note that this implementation keeps 24 // DeviceLocalAccountPolicyService. Note that this implementation keeps
25 // functioning when the device-local account disappears from 25 // functioning when the device-local account disappears from
26 // DeviceLocalAccountPolicyService. The current policy will be kept in that case 26 // DeviceLocalAccountPolicyService. The current policy will be kept in that case
27 // and RefreshPolicies becomes a no-op. Policies for any installed extensions 27 // and RefreshPolicies becomes a no-op. Policies for any installed extensions
28 // will be kept as well in that case. 28 // will be kept as well in that case.
29 class DeviceLocalAccountPolicyProvider 29 class DeviceLocalAccountPolicyProvider
30 : public ConfigurationPolicyProvider, 30 : public ConfigurationPolicyProvider,
31 public DeviceLocalAccountPolicyService::Observer { 31 public DeviceLocalAccountPolicyService::Observer {
32 public: 32 public:
33 DeviceLocalAccountPolicyProvider( 33 DeviceLocalAccountPolicyProvider(
34 const std::string& user_id, 34 const std::string& user_id,
35 DeviceLocalAccountPolicyService* service, 35 DeviceLocalAccountPolicyService* service,
36 scoped_ptr<PolicyMap> chrome_policy_overrides); 36 std::unique_ptr<PolicyMap> chrome_policy_overrides);
37 ~DeviceLocalAccountPolicyProvider() override; 37 ~DeviceLocalAccountPolicyProvider() override;
38 38
39 // Factory function to create and initialize a provider for |user_id|. Returns 39 // Factory function to create and initialize a provider for |user_id|. Returns
40 // NULL if |user_id| is not a device-local account or user policy isn't 40 // NULL if |user_id| is not a device-local account or user policy isn't
41 // applicable for user_id's user type. 41 // applicable for user_id's user type.
42 static scoped_ptr<DeviceLocalAccountPolicyProvider> Create( 42 static std::unique_ptr<DeviceLocalAccountPolicyProvider> Create(
43 const std::string& user_id, 43 const std::string& user_id,
44 DeviceLocalAccountPolicyService* service); 44 DeviceLocalAccountPolicyService* service);
45 45
46 // ConfigurationPolicyProvider: 46 // ConfigurationPolicyProvider:
47 bool IsInitializationComplete(PolicyDomain domain) const override; 47 bool IsInitializationComplete(PolicyDomain domain) const override;
48 void RefreshPolicies() override; 48 void RefreshPolicies() override;
49 49
50 // DeviceLocalAccountPolicyService::Observer: 50 // DeviceLocalAccountPolicyService::Observer:
51 void OnPolicyUpdated(const std::string& user_id) override; 51 void OnPolicyUpdated(const std::string& user_id) override;
52 void OnDeviceLocalAccountsChanged() override; 52 void OnDeviceLocalAccountsChanged() override;
(...skipping 11 matching lines...) Expand all
64 void UpdateFromBroker(); 64 void UpdateFromBroker();
65 65
66 const std::string user_id_; 66 const std::string user_id_;
67 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager_; 67 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager_;
68 68
69 DeviceLocalAccountPolicyService* service_; 69 DeviceLocalAccountPolicyService* service_;
70 70
71 // A policy map providing overrides to apply on top of the Chrome policy 71 // A policy map providing overrides to apply on top of the Chrome policy
72 // received from |service_|. This is used to fix certain policies for public 72 // received from |service_|. This is used to fix certain policies for public
73 // sessions regardless of what's actually specified in policy. 73 // sessions regardless of what's actually specified in policy.
74 scoped_ptr<PolicyMap> chrome_policy_overrides_; 74 std::unique_ptr<PolicyMap> chrome_policy_overrides_;
75 75
76 bool store_initialized_; 76 bool store_initialized_;
77 bool waiting_for_policy_refresh_; 77 bool waiting_for_policy_refresh_;
78 78
79 base::WeakPtrFactory<DeviceLocalAccountPolicyProvider> weak_factory_; 79 base::WeakPtrFactory<DeviceLocalAccountPolicyProvider> weak_factory_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyProvider); 81 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyProvider);
82 }; 82 };
83 83
84 } // namespace policy 84 } // namespace policy
85 85
86 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H _ 86 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_PROVIDER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698