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

Unified Diff: remoting/host/policy_hack/nat_policy_mac.mm

Issue 10804040: [Chromoting] Refactor the host policy watcher so that policies can easily be added. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for Windows. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/policy_hack/nat_policy_linux.cc ('k') | remoting/host/policy_hack/nat_policy_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/policy_hack/nat_policy_mac.mm
diff --git a/remoting/host/policy_hack/nat_policy_mac.mm b/remoting/host/policy_hack/nat_policy_mac.mm
deleted file mode 100644
index d3d26215447009caa985a1ff8523681437b5c130..0000000000000000000000000000000000000000
--- a/remoting/host/policy_hack/nat_policy_mac.mm
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/policy_hack/nat_policy.h"
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include "base/compiler_specific.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "base/sys_string_conversions.h"
-#include "base/values.h"
-
-namespace remoting {
-namespace policy_hack {
-
-// The MacOS version does not watch files because it is accepted
-// practice on the Mac that the user must logout/login for policies to be
-// applied. This will actually pick up policies every
-// |kFallbackReloadDelayMinutes| which is sufficient for right now.
-class NatPolicyMac : public NatPolicy {
- public:
- explicit NatPolicyMac(scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : NatPolicy(task_runner) {
- }
-
- virtual ~NatPolicyMac() {
- }
-
- protected:
- virtual void StartWatchingInternal() OVERRIDE {
- Reload();
- }
-
- virtual void StopWatchingInternal() OVERRIDE {
- }
-
- virtual void Reload() OVERRIDE {
- DCHECK(OnPolicyThread());
- base::DictionaryValue policy;
-
- CFStringRef policy_bundle_id = CFSTR("com.google.Chrome");
- if (CFPreferencesAppSynchronize(policy_bundle_id)) {
- base::mac::ScopedCFTypeRef<CFStringRef> policy_key(
- base::SysUTF8ToCFStringRef(kNatPolicyName));
- Boolean valid = false;
- bool allowed = CFPreferencesGetAppBooleanValue(policy_key,
- policy_bundle_id,
- &valid);
- if (valid) {
- policy.SetBoolean(kNatPolicyName, allowed);
- }
- }
-
- // Set policy. Policy must be set (even if it is empty) so that the
- // default policy is picked up the first time reload is called.
- UpdateNatPolicy(&policy);
-
- // Reschedule task.
- ScheduleFallbackReloadTask();
- }
-};
-
-NatPolicy* NatPolicy::Create(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- return new NatPolicyMac(task_runner);
-}
-
-} // namespace policy_hack
-} // namespace remoting
« no previous file with comments | « remoting/host/policy_hack/nat_policy_linux.cc ('k') | remoting/host/policy_hack/nat_policy_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698