| 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> |
| 6 #include <string> |
| 7 |
| 5 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 6 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 7 #include "chrome/browser/policy/device_management_policy_provider.h" | 10 #include "chrome/browser/policy/device_management_policy_provider.h" |
| 8 #include "chrome/browser/policy/device_management_service.h" | 11 #include "chrome/browser/policy/device_management_service.h" |
| 9 #include "chrome/browser/policy/profile_policy_context.h" | 12 #include "chrome/browser/policy/profile_policy_context.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/notification_details.h" | 16 #include "chrome/common/notification_details.h" |
| 14 #include "chrome/common/notification_source.h" | 17 #include "chrome/common/notification_source.h" |
| 15 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 // Refresh rate sanity interval bounds. | 22 // Refresh rate sanity interval bounds. |
| 20 const int64 kPolicyRefreshRateMinMs = 30 * 60 * 1000; // 30 minutes | 23 const int64 kPolicyRefreshRateMinMs = 30 * 60 * 1000; // 30 minutes |
| 21 const int64 kPolicyRefreshRateMaxMs = 24 * 60 * 60 * 1000; // 1 day | 24 const int64 kPolicyRefreshRateMaxMs = 24 * 60 * 60 * 1000; // 1 day |
| 22 | 25 |
| 23 } | 26 } // namespace |
| 24 | 27 |
| 25 namespace policy { | 28 namespace policy { |
| 26 | 29 |
| 27 ProfilePolicyContext::ProfilePolicyContext(Profile* profile) | 30 ProfilePolicyContext::ProfilePolicyContext(Profile* profile) |
| 28 : profile_(profile) { | 31 : profile_(profile) { |
| 29 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 32 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 30 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { | 33 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { |
| 31 device_management_service_.reset(new DeviceManagementService( | 34 device_management_service_.reset(new DeviceManagementService( |
| 32 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl))); | 35 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl))); |
| 33 device_management_policy_provider_.reset( | 36 device_management_policy_provider_.reset( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 if (type == NotificationType::PREF_CHANGED && | 87 if (type == NotificationType::PREF_CHANGED && |
| 85 prefs::kPolicyRefreshRate == *(Details<std::string>(details).ptr()) && | 88 prefs::kPolicyRefreshRate == *(Details<std::string>(details).ptr()) && |
| 86 profile_->GetPrefs() == Source<PrefService>(source).ptr()) { | 89 profile_->GetPrefs() == Source<PrefService>(source).ptr()) { |
| 87 UpdatePolicyRefreshRate(); | 90 UpdatePolicyRefreshRate(); |
| 88 } else { | 91 } else { |
| 89 NOTREACHED(); | 92 NOTREACHED(); |
| 90 } | 93 } |
| 91 } | 94 } |
| 92 | 95 |
| 93 } // namespace policy | 96 } // namespace policy |
| OLD | NEW |