OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/policy/core/common/policy_loader_ios.h" | 5 #include "components/policy/core/common/policy_loader_ios.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #import <UIKit/UIKit.h> | 9 #import <UIKit/UIKit.h> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 @end | 90 @end |
91 | 91 |
92 namespace policy { | 92 namespace policy { |
93 | 93 |
94 PolicyLoaderIOS::PolicyLoaderIOS( | 94 PolicyLoaderIOS::PolicyLoaderIOS( |
95 scoped_refptr<base::SequencedTaskRunner> task_runner) | 95 scoped_refptr<base::SequencedTaskRunner> task_runner) |
96 : AsyncPolicyLoader(task_runner), | 96 : AsyncPolicyLoader(task_runner), |
97 weak_factory_(this) {} | 97 weak_factory_(this) {} |
98 | 98 |
99 PolicyLoaderIOS::~PolicyLoaderIOS() { | 99 PolicyLoaderIOS::~PolicyLoaderIOS() { |
100 DCHECK(task_runner()->RunsTasksOnCurrentThread()); | 100 DCHECK(task_runner()->RunsTasksInCurrentSequence()); |
101 } | 101 } |
102 | 102 |
103 void PolicyLoaderIOS::InitOnBackgroundThread() { | 103 void PolicyLoaderIOS::InitOnBackgroundThread() { |
104 DCHECK(task_runner()->RunsTasksOnCurrentThread()); | 104 DCHECK(task_runner()->RunsTasksInCurrentSequence()); |
105 base::Closure callback = base::Bind(&PolicyLoaderIOS::UserDefaultsChanged, | 105 base::Closure callback = base::Bind(&PolicyLoaderIOS::UserDefaultsChanged, |
106 weak_factory_.GetWeakPtr()); | 106 weak_factory_.GetWeakPtr()); |
107 notification_observer_.reset( | 107 notification_observer_.reset( |
108 [[PolicyNotificationObserver alloc] initWithCallback:callback | 108 [[PolicyNotificationObserver alloc] initWithCallback:callback |
109 taskRunner:task_runner()]); | 109 taskRunner:task_runner()]); |
110 } | 110 } |
111 | 111 |
112 std::unique_ptr<PolicyBundle> PolicyLoaderIOS::Load() { | 112 std::unique_ptr<PolicyBundle> PolicyLoaderIOS::Load() { |
113 std::unique_ptr<PolicyBundle> bundle(new PolicyBundle()); | 113 std::unique_ptr<PolicyBundle> bundle(new PolicyBundle()); |
114 NSDictionary* configuration = [[NSUserDefaults standardUserDefaults] | 114 NSDictionary* configuration = [[NSUserDefaults standardUserDefaults] |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 PropertyToValue(static_cast<CFPropertyListRef>(dictionary)); | 177 PropertyToValue(static_cast<CFPropertyListRef>(dictionary)); |
178 base::DictionaryValue* dict = NULL; | 178 base::DictionaryValue* dict = NULL; |
179 if (value && value->GetAsDictionary(&dict)) { | 179 if (value && value->GetAsDictionary(&dict)) { |
180 PolicyMap& map = bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); | 180 PolicyMap& map = bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); |
181 map.LoadFrom(dict, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 181 map.LoadFrom(dict, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
182 POLICY_SOURCE_PLATFORM); | 182 POLICY_SOURCE_PLATFORM); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 } // namespace policy | 186 } // namespace policy |
OLD | NEW |