| 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 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); | 23 const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); |
| 24 const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); | 24 const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); |
| 25 const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); | 25 const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); |
| 26 | 26 |
| 27 const int kServiceInitializationStartupDelay = 2000; | 27 const int64 kServiceInitializationStartupDelay = 2000; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 namespace policy { | 31 namespace policy { |
| 32 | 32 |
| 33 ProfilePolicyConnector::ProfilePolicyConnector(Profile* profile) | 33 ProfilePolicyConnector::ProfilePolicyConnector(Profile* profile) |
| 34 : profile_(profile) { | 34 : profile_(profile) { |
| 35 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 35 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 36 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { | 36 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { |
| 37 FilePath policy_cache_dir(profile_->GetPath()); | 37 FilePath policy_cache_dir(profile_->GetPath()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 ProfilePolicyConnector::~ProfilePolicyConnector() { | 59 ProfilePolicyConnector::~ProfilePolicyConnector() { |
| 60 managed_cloud_provider_.reset(); | 60 managed_cloud_provider_.reset(); |
| 61 recommended_cloud_provider_.reset(); | 61 recommended_cloud_provider_.reset(); |
| 62 cloud_policy_subsystem_.reset(); | 62 cloud_policy_subsystem_.reset(); |
| 63 identity_strategy_.reset(); | 63 identity_strategy_.reset(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ProfilePolicyConnector::ScheduleServiceInitialization( | 66 void ProfilePolicyConnector::ScheduleServiceInitialization( |
| 67 int delay_milliseconds) { | 67 int64 delay_milliseconds) { |
| 68 if (cloud_policy_subsystem_.get()) | 68 if (cloud_policy_subsystem_.get()) |
| 69 cloud_policy_subsystem_->ScheduleServiceInitialization(delay_milliseconds); | 69 cloud_policy_subsystem_->ScheduleServiceInitialization(delay_milliseconds); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ProfilePolicyConnector::Initialize() { | 72 void ProfilePolicyConnector::Initialize() { |
| 73 if (identity_strategy_.get()) | 73 if (identity_strategy_.get()) |
| 74 identity_strategy_->LoadTokenCache(); | 74 identity_strategy_->LoadTokenCache(); |
| 75 if (cloud_policy_subsystem_.get()) | 75 if (cloud_policy_subsystem_.get()) |
| 76 cloud_policy_subsystem_->Initialize(profile_->GetPrefs(), | 76 cloud_policy_subsystem_->Initialize(profile_->GetPrefs(), |
| 77 kServiceInitializationStartupDelay); | 77 kServiceInitializationStartupDelay); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, | 154 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, |
| 155 observer_list_, OnProviderGoingAway()); | 155 observer_list_, OnProviderGoingAway()); |
| 156 browser_registrar_.reset(); | 156 browser_registrar_.reset(); |
| 157 profile_registrar_.reset(); | 157 profile_registrar_.reset(); |
| 158 browser_policy_provider_ = NULL; | 158 browser_policy_provider_ = NULL; |
| 159 profile_policy_provider_ = NULL; | 159 profile_policy_provider_ = NULL; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace policy | 163 } // namespace policy |
| OLD | NEW |