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

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

Issue 8586030: Added ConfigurationPolicyProvider::RefreshPolicies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_ASYNCHRONOUS_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
10 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
11 #include "chrome/browser/policy/configuration_policy_provider.h" 12 #include "chrome/browser/policy/configuration_policy_provider.h"
12 13
13 namespace policy { 14 namespace policy {
14 15
15 class AsynchronousPolicyLoader; 16 class AsynchronousPolicyLoader;
16 17
17 // Policy provider that loads policy asynchronously. Providers should subclass 18 // Policy provider that loads policy asynchronously. Providers should subclass
18 // from this class if loading the policy requires disk access or must for some 19 // from this class if loading the policy requires disk access or must for some
19 // other reason be performed on the file thread. The actual logic for loading 20 // other reason be performed on the file thread. The actual logic for loading
(...skipping 10 matching lines...) Expand all
30 31
31 virtual DictionaryValue* Load() = 0; 32 virtual DictionaryValue* Load() = 0;
32 }; 33 };
33 34
34 // Assumes ownership of |loader|. 35 // Assumes ownership of |loader|.
35 AsynchronousPolicyProvider( 36 AsynchronousPolicyProvider(
36 const PolicyDefinitionList* policy_list, 37 const PolicyDefinitionList* policy_list,
37 scoped_refptr<AsynchronousPolicyLoader> loader); 38 scoped_refptr<AsynchronousPolicyLoader> loader);
38 virtual ~AsynchronousPolicyProvider(); 39 virtual ~AsynchronousPolicyProvider();
39 40
40 // Force a policy reload from the underlying data source.
41 void ForceReload();
42
43 protected:
44 // ConfigurationPolicyProvider implementation. 41 // ConfigurationPolicyProvider implementation.
45 virtual bool ProvideInternal(PolicyMap* map) OVERRIDE; 42 virtual bool ProvideInternal(PolicyMap* map) OVERRIDE;
43 virtual void RefreshPolicies() OVERRIDE;
44
45 private:
46 // Callbacks from the loader. OnRefreshReload is invoked when an explicitly
47 // requested refresh is done, while OnUnexpectedReload is invoked when the
48 // loader refreshed its policies without being triggered.
49 void OnRefreshReload();
50 void OnUnexpectedReload();
46 51
47 // The loader object used internally. 52 // The loader object used internally.
48 scoped_refptr<AsynchronousPolicyLoader> loader_; 53 scoped_refptr<AsynchronousPolicyLoader> loader_;
49 54
50 private: 55 // Used to create and invalidate WeakPtrs from RefreshPolicies, to make sure
56 // that notifications are only issued after any pending reloads are done.
57 base::WeakPtrFactory<AsynchronousPolicyProvider> weak_ptr_factory_;
58
51 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider); 59 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider);
52 }; 60 };
53 61
54 } // namespace policy 62 } // namespace policy
55 63
56 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ 64 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698