| OLD | NEW |
| 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 #include "remoting/host/policy_hack/policy_watcher.h" | 5 #include "remoting/host/policy_hack/policy_watcher.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public: | 25 public: |
| 26 explicit PolicyWatcherMac( | 26 explicit PolicyWatcherMac( |
| 27 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 27 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 28 : PolicyWatcher(task_runner) { | 28 : PolicyWatcher(task_runner) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual ~PolicyWatcherMac() { | 31 virtual ~PolicyWatcherMac() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 virtual void StartWatchingInternal() OVERRIDE { | 35 virtual void StartWatchingInternal() override { |
| 36 Reload(); | 36 Reload(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void StopWatchingInternal() OVERRIDE { | 39 virtual void StopWatchingInternal() override { |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void Reload() OVERRIDE { | 42 virtual void Reload() override { |
| 43 DCHECK(OnPolicyWatcherThread()); | 43 DCHECK(OnPolicyWatcherThread()); |
| 44 base::DictionaryValue policy; | 44 base::DictionaryValue policy; |
| 45 | 45 |
| 46 CFStringRef policy_bundle_id = CFSTR("com.google.Chrome"); | 46 CFStringRef policy_bundle_id = CFSTR("com.google.Chrome"); |
| 47 if (CFPreferencesAppSynchronize(policy_bundle_id)) { | 47 if (CFPreferencesAppSynchronize(policy_bundle_id)) { |
| 48 for (base::DictionaryValue::Iterator i(Defaults()); | 48 for (base::DictionaryValue::Iterator i(Defaults()); |
| 49 !i.IsAtEnd(); i.Advance()) { | 49 !i.IsAtEnd(); i.Advance()) { |
| 50 const std::string& policy_name = i.key(); | 50 const std::string& policy_name = i.key(); |
| 51 base::ScopedCFTypeRef<CFStringRef> policy_key( | 51 base::ScopedCFTypeRef<CFStringRef> policy_key( |
| 52 base::SysUTF8ToCFStringRef(policy_name)); | 52 base::SysUTF8ToCFStringRef(policy_name)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 PolicyWatcher* PolicyWatcher::Create( | 89 PolicyWatcher* PolicyWatcher::Create( |
| 90 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 90 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 91 return new PolicyWatcherMac(task_runner); | 91 return new PolicyWatcherMac(task_runner); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace policy_hack | 94 } // namespace policy_hack |
| 95 } // namespace remoting | 95 } // namespace remoting |
| OLD | NEW |