OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 10 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
11 #include "chrome/browser/policy/profile_policy_connector.h" | 11 #include "chrome/browser/policy/profile_policy_connector.h" |
| 12 #include "chrome/browser/policy/user_policy_cache.h" |
12 #include "chrome/browser/policy/user_policy_identity_strategy.h" | 13 #include "chrome/browser/policy/user_policy_identity_strategy.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/net/url_request_context_getter.h" | 17 #include "chrome/common/net/url_request_context_getter.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); | 22 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); |
(...skipping 22 matching lines...) Expand all Loading... |
44 LOG(WARNING) << "Failed to create policy state dir " | 45 LOG(WARNING) << "Failed to create policy state dir " |
45 << policy_cache_dir.value() | 46 << policy_cache_dir.value() |
46 << ", skipping cloud policy initialization."; | 47 << ", skipping cloud policy initialization."; |
47 return; | 48 return; |
48 } | 49 } |
49 | 50 |
50 identity_strategy_.reset(new UserPolicyIdentityStrategy( | 51 identity_strategy_.reset(new UserPolicyIdentityStrategy( |
51 profile_, | 52 profile_, |
52 policy_cache_dir.Append(kTokenCacheFile))); | 53 policy_cache_dir.Append(kTokenCacheFile))); |
53 cloud_policy_subsystem_.reset(new CloudPolicySubsystem( | 54 cloud_policy_subsystem_.reset(new CloudPolicySubsystem( |
54 policy_cache_dir.Append(kPolicyCacheFile), | 55 identity_strategy_.get(), |
55 identity_strategy_.get())); | 56 new UserPolicyCache(policy_cache_dir.Append(kPolicyCacheFile)))); |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
59 ProfilePolicyConnector::~ProfilePolicyConnector() { | 60 ProfilePolicyConnector::~ProfilePolicyConnector() { |
60 cloud_policy_subsystem_.reset(); | 61 cloud_policy_subsystem_.reset(); |
61 identity_strategy_.reset(); | 62 identity_strategy_.reset(); |
62 } | 63 } |
63 | 64 |
64 void ProfilePolicyConnector::Initialize() { | 65 void ProfilePolicyConnector::Initialize() { |
65 // TODO(jkummerow, mnissler): Move this out of the browser startup path. | 66 // TODO(jkummerow, mnissler): Move this out of the browser startup path. |
(...skipping 25 matching lines...) Expand all Loading... |
91 return NULL; | 92 return NULL; |
92 } | 93 } |
93 | 94 |
94 // static | 95 // static |
95 void ProfilePolicyConnector::RegisterPrefs(PrefService* user_prefs) { | 96 void ProfilePolicyConnector::RegisterPrefs(PrefService* user_prefs) { |
96 user_prefs->RegisterIntegerPref(prefs::kPolicyUserPolicyRefreshRate, | 97 user_prefs->RegisterIntegerPref(prefs::kPolicyUserPolicyRefreshRate, |
97 kDefaultPolicyRefreshRateInMilliseconds); | 98 kDefaultPolicyRefreshRateInMilliseconds); |
98 } | 99 } |
99 | 100 |
100 } // namespace policy | 101 } // namespace policy |
OLD | NEW |