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

Side by Side Diff: remoting/host/policy_hack/policy_watcher.h

Issue 686373002: Revert of Remote assistance on Chrome OS Part IV - It2MeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ 5 #ifndef REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_
6 #define REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ 6 #define REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "components/policy/core/common/policy_service.h"
12 11
13 namespace base { 12 namespace base {
14 class SingleThreadTaskRunner; 13 class SingleThreadTaskRunner;
15 class TimeDelta; 14 class TimeDelta;
16 class WaitableEvent; 15 class WaitableEvent;
17 } // namespace base 16 } // namespace base
18 17
19 namespace remoting { 18 namespace remoting {
20 namespace policy_hack { 19 namespace policy_hack {
21 20
(...skipping 10 matching lines...) Expand all
32 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
33 virtual ~PolicyWatcher(); 32 virtual ~PolicyWatcher();
34 33
35 // This guarantees that the |policy_callback| is called at least once with 34 // This guarantees that the |policy_callback| is called at least once with
36 // the current policies. After that, |policy_callback| will be called 35 // the current policies. After that, |policy_callback| will be called
37 // whenever a change to any policy is detected. It will then be called only 36 // whenever a change to any policy is detected. It will then be called only
38 // with the changed policies. 37 // with the changed policies.
39 virtual void StartWatching(const PolicyCallback& policy_callback); 38 virtual void StartWatching(const PolicyCallback& policy_callback);
40 39
41 // Should be called after StartWatching() before the object is deleted. Calls 40 // Should be called after StartWatching() before the object is deleted. Calls
42 // should wait for |stopped_callback| to be called before deleting it. 41 // just wait for |done| to be signaled before deleting the object.
43 virtual void StopWatching(const base::Closure& stopped_callback); 42 virtual void StopWatching(base::WaitableEvent* done);
44 43
45 // Implemented by each platform. |task_runner| should be an IO message loop. 44 // Implemented by each platform. This message loop should be an IO message
46 // |policy_service| is currently only used on ChromeOS. The caller must 45 // loop.
47 // ensure that |policy_service| remains valid for the lifetime of 46 static PolicyWatcher* Create(
48 // PolicyWatcher.
49 static scoped_ptr<PolicyWatcher> Create(
50 policy::PolicyService* policy_service,
51 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 47 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
52 48
53 // The name of the NAT traversal policy. 49 // The name of the NAT traversal policy.
54 static const char kNatPolicyName[]; 50 static const char kNatPolicyName[];
55 51
56 // The name of the policy for requiring 2-factor authentication. 52 // The name of the policy for requiring 2-factor authentication.
57 static const char kHostRequireTwoFactorPolicyName[]; 53 static const char kHostRequireTwoFactorPolicyName[];
58 54
59 // The name of the host domain policy. 55 // The name of the host domain policy.
60 static const char kHostDomainPolicyName[]; 56 static const char kHostDomainPolicyName[];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 100
105 // Used for time-based reloads in case something goes wrong with the 101 // Used for time-based reloads in case something goes wrong with the
106 // notification system. 102 // notification system.
107 void ScheduleFallbackReloadTask(); 103 void ScheduleFallbackReloadTask();
108 void ScheduleReloadTask(const base::TimeDelta& delay); 104 void ScheduleReloadTask(const base::TimeDelta& delay);
109 105
110 // Returns a DictionaryValue containing the default values for each policy. 106 // Returns a DictionaryValue containing the default values for each policy.
111 const base::DictionaryValue& Defaults() const; 107 const base::DictionaryValue& Defaults() const;
112 108
113 private: 109 private:
114 void StopWatchingOnPolicyWatcherThread();
115 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
116 111
117 PolicyCallback policy_callback_; 112 PolicyCallback policy_callback_;
118 113
119 scoped_ptr<base::DictionaryValue> old_policies_; 114 scoped_ptr<base::DictionaryValue> old_policies_;
120 scoped_ptr<base::DictionaryValue> default_values_; 115 scoped_ptr<base::DictionaryValue> default_values_;
121 scoped_ptr<base::DictionaryValue> bad_type_values_; 116 scoped_ptr<base::DictionaryValue> bad_type_values_;
122 117
123 // Allows us to cancel any inflight FileWatcher events or scheduled reloads. 118 // Allows us to cancel any inflight FileWatcher events or scheduled reloads.
124 base::WeakPtrFactory<PolicyWatcher> weak_factory_; 119 base::WeakPtrFactory<PolicyWatcher> weak_factory_;
125 }; 120 };
126 121
127 } // namespace policy_hack 122 } // namespace policy_hack
128 } // namespace remoting 123 } // namespace remoting
129 124
130 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ 125 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host_unittest.cc ('k') | remoting/host/policy_hack/policy_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698