| 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/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/policy/browser_policy_connector.h" | 11 #include "chrome/browser/policy/browser_policy_connector.h" |
| 12 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 12 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 13 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 13 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 14 #include "chrome/browser/policy/profile_policy_connector.h" | 14 #include "chrome/browser/policy/profile_policy_connector.h" |
| 15 #include "chrome/browser/policy/user_policy_cache.h" | 15 #include "chrome/browser/policy/user_policy_cache.h" |
| 16 #include "chrome/browser/policy/user_policy_identity_strategy.h" | 16 #include "chrome/browser/policy/user_policy_identity_strategy.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); | 25 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); |
| 25 const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); | 26 const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); |
| 26 const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); | 27 const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); |
| 27 | 28 |
| 28 } // namespace | 29 } // namespace |
| 29 | 30 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 58 ProfilePolicyConnector::~ProfilePolicyConnector() { | 59 ProfilePolicyConnector::~ProfilePolicyConnector() { |
| 59 managed_cloud_provider_.reset(); | 60 managed_cloud_provider_.reset(); |
| 60 recommended_cloud_provider_.reset(); | 61 recommended_cloud_provider_.reset(); |
| 61 cloud_policy_subsystem_.reset(); | 62 cloud_policy_subsystem_.reset(); |
| 62 identity_strategy_.reset(); | 63 identity_strategy_.reset(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void ProfilePolicyConnector::Initialize() { | 66 void ProfilePolicyConnector::Initialize() { |
| 66 // TODO(jkummerow, mnissler): Move this out of the browser startup path. | 67 // TODO(jkummerow, mnissler): Move this out of the browser startup path. |
| 67 if (cloud_policy_subsystem_.get()) { | 68 if (cloud_policy_subsystem_.get()) { |
| 68 cloud_policy_subsystem_->Initialize(profile_->GetPrefs(), | 69 cloud_policy_subsystem_->Initialize(prefs::kUserPolicyRefreshRate, |
| 69 profile_->GetRequestContext()); | 70 profile_->GetRequestContext()); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 | 73 |
| 73 void ProfilePolicyConnector::Shutdown() { | 74 void ProfilePolicyConnector::Shutdown() { |
| 74 if (cloud_policy_subsystem_.get()) | 75 if (cloud_policy_subsystem_.get()) |
| 75 cloud_policy_subsystem_->Shutdown(); | 76 cloud_policy_subsystem_->Shutdown(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 ConfigurationPolicyProvider* | 79 ConfigurationPolicyProvider* |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, | 148 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, |
| 148 observer_list_, OnProviderGoingAway()); | 149 observer_list_, OnProviderGoingAway()); |
| 149 browser_registrar_.reset(); | 150 browser_registrar_.reset(); |
| 150 profile_registrar_.reset(); | 151 profile_registrar_.reset(); |
| 151 browser_policy_provider_ = NULL; | 152 browser_policy_provider_ = NULL; |
| 152 profile_policy_provider_ = NULL; | 153 profile_policy_provider_ = NULL; |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 | 156 |
| 156 } // namespace policy | 157 } // namespace policy |
| OLD | NEW |