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

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

Issue 11946017: Remove old cloud policy code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_POLICY_NOTIFIER_H_
6 #define CHROME_BROWSER_POLICY_POLICY_NOTIFIER_H_
7
8 #include "base/observer_list.h"
9 #include "chrome/browser/policy/cloud_policy_subsystem.h"
10
11 namespace policy {
12
13 // Keeps track of the state of the policy subsystem components as far as it's
14 // relevant to the outside world. Is informed by components about status
15 // changes (failures and successes), determines the overall state and
16 // communicates it.
17 class PolicyNotifier {
18 public:
19 typedef CloudPolicySubsystem::PolicySubsystemState PolicySubsystemState;
20 typedef CloudPolicySubsystem::ErrorDetails ErrorDetails;
21
22 enum StatusSource {
23 TOKEN_FETCHER,
24 POLICY_CONTROLLER,
25 POLICY_CACHE,
26 NUM_SOURCES // This must be the last element in the enum.
27 };
28
29 PolicyNotifier();
30 ~PolicyNotifier();
31
32 // Called by components of the policy subsystem. Determines the new overall
33 // state and triggers observer notifications as necessary.
34 void Inform(PolicySubsystemState state,
35 ErrorDetails error_details,
36 StatusSource source);
37
38 CloudPolicySubsystem::PolicySubsystemState state() const {
39 return state_;
40 }
41
42 CloudPolicySubsystem::ErrorDetails error_details() const {
43 return error_details_;
44 }
45
46 private:
47 friend class CloudPolicyController;
48 friend class CloudPolicySubsystem::ObserverRegistrar;
49
50 void AddObserver(CloudPolicySubsystem::Observer* observer);
51 void RemoveObserver(CloudPolicySubsystem::Observer* observer);
52
53 void RecomputeState();
54
55 PolicySubsystemState state_;
56 ErrorDetails error_details_;
57
58 PolicySubsystemState component_states_[NUM_SOURCES];
59 ErrorDetails component_error_details_[NUM_SOURCES];
60
61 ObserverList<CloudPolicySubsystem::Observer, true> observer_list_;
62
63 DISALLOW_COPY_AND_ASSIGN(PolicyNotifier);
64 };
65
66 } // namespace policy
67
68 #endif // CHROME_BROWSER_POLICY_POLICY_NOTIFIER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/mock_cloud_policy_data_store.cc ('k') | chrome/browser/policy/policy_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698