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

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

Issue 886913002: Always run PolicyWatcher on UI thread in It2Me host. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const PolicyErrorCallback& policy_error_callback); 69 const PolicyErrorCallback& policy_error_callback);
70 70
71 // Should be called after StartWatching() before the object is deleted. Calls 71 // Should be called after StartWatching() before the object is deleted. Calls
72 // should wait for |stopped_callback| to be called before deleting it. 72 // should wait for |stopped_callback| to be called before deleting it.
73 virtual void StopWatching(const base::Closure& stopped_callback); 73 virtual void StopWatching(const base::Closure& stopped_callback);
74 74
75 // Specify a |policy_service| to borrow (on Chrome OS, from the browser 75 // Specify a |policy_service| to borrow (on Chrome OS, from the browser
76 // process) or specify nullptr to internally construct and use a new 76 // process) or specify nullptr to internally construct and use a new
77 // PolicyService (on other OS-es). 77 // PolicyService (on other OS-es).
78 // 78 //
79 // When |policy_service| is null, then |task_runner| is used for reading the 79 // |current_task_runner| refers to the task runner for the current thread. The
80 // policy from files / registry / preferences. PolicyUpdatedCallback and 80 // PolicyWatcher must only be used on the same thread it's created and it call
Łukasz Anforowicz 2015/01/30 05:35:55 Non-native speaker here, but I think it should be
Łukasz Anforowicz 2015/01/30 17:16:00 RE: PolicyWatcher must only be used on the same th
Sergey Ulanov 2015/01/30 19:33:45 Yes, Thank you. Actually marked PolicyWatcher as N
Sergey Ulanov 2015/01/30 19:33:45 Done.
81 // PolicyErrorCallback will be called on the same |task_runner|. 81 // all callbacks on this thread.
82 // |task_runner| should be of TYPE_IO type. 82 //
83 // When |policy_service| is null, then |io_task_runner| is used for reading
84 // the policy from files / registry / preferences. |io_task_runner| should be
85 // of TYPE_IO type.
83 // 86 //
84 // When |policy_service| is specified then |task_runner| argument is ignored 87 // When |policy_service| is specified then |task_runner| argument is ignored
Łukasz Anforowicz 2015/01/30 05:35:55 Need to update the name of the parameter in the co
Sergey Ulanov 2015/01/30 19:33:45 Done.
85 // and 1) BrowserThread::UI is used for PolicyUpdatedCallback and 88 // and 1) BrowserThread::UI is used for PolicyUpdatedCallback and
86 // PolicyErrorCallback and 2) BrowserThread::FILE is used for reading the 89 // PolicyErrorCallback and 2) BrowserThread::FILE is used for reading the
87 // policy from files / registry / preferences (although (2) is just an 90 // policy from files / registry / preferences (although (2) is just an
88 // implementation detail and should likely be ignored outside of 91 // implementation detail and should likely be ignored outside of
89 // PolicyWatcher). 92 // PolicyWatcher).
90 static scoped_ptr<PolicyWatcher> Create( 93 static scoped_ptr<PolicyWatcher> Create(
91 policy::PolicyService* policy_service, 94 policy::PolicyService* policy_service,
92 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 95 const scoped_refptr<base::SingleThreadTaskRunner>& current_task_runner,
96 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
93 97
94 private: 98 private:
95 friend class PolicyWatcherTest; 99 friend class PolicyWatcherTest;
96 100
97 // Used to check if the class is on the right thread. 101 // Used to check if the class is on the right thread.
98 bool OnPolicyServiceThread() const; 102 bool OnPolicyServiceThread() const;
99 103
100 // Takes the policy dictionary from the OS specific store and extracts the 104 // Takes the policy dictionary from the OS specific store and extracts the
101 // relevant policies. 105 // relevant policies.
102 void UpdatePolicies(const base::DictionaryValue* new_policy); 106 void UpdatePolicies(const base::DictionaryValue* new_policy);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; 165 scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_;
162 scoped_ptr<policy::PolicyService> owned_policy_service_; 166 scoped_ptr<policy::PolicyService> owned_policy_service_;
163 167
164 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); 168 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher);
165 }; 169 };
166 170
167 } // namespace policy_hack 171 } // namespace policy_hack
168 } // namespace remoting 172 } // namespace remoting
169 173
170 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ 174 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698