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

Side by Side Diff: chrome/browser/policy/profile_policy_context.h

Issue 6310012: Allow policy refresh rate to be configured through policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test. Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_POLICY_PROFILE_POLICY_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_POLICY_PROFILE_POLICY_CONTEXT_H_
6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONTEXT_H_ 6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/prefs/pref_member.h"
11 #include "chrome/common/notification_observer.h"
10 12
11 class Profile; 13 class Profile;
12 14
13 namespace policy { 15 namespace policy {
14 16
15 class DeviceManagementPolicyProvider; 17 class DeviceManagementPolicyProvider;
16 class DeviceManagementService; 18 class DeviceManagementService;
17 19
18 // This class is a container for the profile-specific policy bits located in the 20 // This class is a container for the profile-specific policy bits located in the
19 // profile. Since the context owns the policy provider, it's vital that it gets 21 // profile. Since the context owns the policy provider, it's vital that it gets
20 // initialized before the profile's prefs and destroyed after the prefs are 22 // initialized before the profile's prefs and destroyed after the prefs are
21 // gone. 23 // gone.
22 class ProfilePolicyContext { 24 class ProfilePolicyContext : public NotificationObserver {
23 public: 25 public:
24 explicit ProfilePolicyContext(Profile* profile); 26 explicit ProfilePolicyContext(Profile* profile);
25 ~ProfilePolicyContext(); 27 ~ProfilePolicyContext();
26 28
27 // Initializes the context. Should be called only after the profile's request 29 // Initializes the context. Should be called only after the profile's request
28 // context is up. 30 // context is up.
29 void Initialize(); 31 void Initialize();
30 32
31 // Shuts the context down. This must be called before the networking 33 // Shuts the context down. This must be called before the networking
32 // infrastructure in the profile goes away. 34 // infrastructure in the profile goes away.
33 void Shutdown(); 35 void Shutdown();
34 36
35 // Get the policy provider. 37 // Get the policy provider.
36 DeviceManagementPolicyProvider* GetDeviceManagementPolicyProvider(); 38 DeviceManagementPolicyProvider* GetDeviceManagementPolicyProvider();
37 39
40 // Register preferences.
41 static void RegisterUserPrefs(PrefService* user_prefs);
42
43 static const int kDefaultPolicyRefreshRateInMilliseconds =
44 3 * 60 * 60 * 1000; // 3 hours.
45
38 private: 46 private:
47 // Updates the policy provider with a new refresh rate value.
48 void UpdatePolicyRefreshRate();
49
50 // NotificationObserver overrides.
51 virtual void Observe(NotificationType type,
52 const NotificationSource& source,
53 const NotificationDetails& details);
54
39 // The profile this context is associated with. 55 // The profile this context is associated with.
40 Profile* profile_; 56 Profile* profile_;
41 57
58 // Tracks the pref value for the policy refresh rate.
59 IntegerPrefMember policy_refresh_rate_;
60
42 // The device management service. 61 // The device management service.
43 scoped_ptr<DeviceManagementService> device_management_service_; 62 scoped_ptr<DeviceManagementService> device_management_service_;
44 63
45 // Our provider. 64 // Our provider.
46 scoped_ptr<DeviceManagementPolicyProvider> device_management_policy_provider_; 65 scoped_ptr<DeviceManagementPolicyProvider> device_management_policy_provider_;
47 }; 66 };
48 67
49 } // namespace policy 68 } // namespace policy
50 69
51 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONTEXT_H_ 70 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_token_fetcher_unittest.cc ('k') | chrome/browser/policy/profile_policy_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698