cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / policy / core / common / policy_loader_ios.h
bloba9868f0ab8dc030e898da35c1ffb46e319c41d1d
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_IOS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_IOS_H_
8 #include "base/basictypes.h"
9 #include "base/mac/scoped_nsobject.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h"
12 #include "components/policy/core/common/async_policy_loader.h"
13 #include "components/policy/policy_export.h"
15 namespace policy {
17 // A policy loader that loads policy from the managed app configuration
18 // introduced in iOS 7.
19 class POLICY_EXPORT PolicyLoaderIOS : public AsyncPolicyLoader {
20 public:
21 explicit PolicyLoaderIOS(
22 scoped_refptr<base::SequencedTaskRunner> task_runner);
23 ~PolicyLoaderIOS() override;
25 // AsyncPolicyLoader implementation.
26 void InitOnBackgroundThread() override;
27 scoped_ptr<PolicyBundle> Load() override;
28 base::Time LastModificationTime() override;
30 private:
31 void UserDefaultsChanged();
33 // Loads the Chrome policies in |dictionary| into the given |bundle|.
34 static void LoadNSDictionaryToPolicyBundle(NSDictionary* dictionary,
35 PolicyBundle* bundle);
37 // Used to manage the registration for NSNotificationCenter notifications.
38 base::scoped_nsobject<id> notification_observer_;
40 // Timestamp of the last notification.
41 // Used to coalesce repeated notifications into a single Load() call.
42 base::Time last_notification_time_;
44 // Used to Bind() a WeakPtr to |this| for the callback passed to the
45 // |notification_observer_|.
46 base::WeakPtrFactory<PolicyLoaderIOS> weak_factory_;
48 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderIOS);
51 } // namespace policy
53 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_IOS_H_