OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/managed_mode/managed_user_service.h" | 5 #include "chrome/browser/managed_mode/managed_user_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 bool ManagedUserService::ProfileIsManaged() const { | 157 bool ManagedUserService::ProfileIsManaged() const { |
158 return ProfileIsManaged(profile_); | 158 return ProfileIsManaged(profile_); |
159 } | 159 } |
160 | 160 |
161 // static | 161 // static |
162 bool ManagedUserService::ProfileIsManaged(Profile* profile) { | 162 bool ManagedUserService::ProfileIsManaged(Profile* profile) { |
163 return profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged); | 163 return profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged); |
164 } | 164 } |
165 | 165 |
166 // static | 166 // static |
167 void ManagedUserService::RegisterUserPrefs( | 167 void ManagedUserService::RegisterProfilePrefs( |
168 user_prefs::PrefRegistrySyncable* registry) { | 168 user_prefs::PrefRegistrySyncable* registry) { |
169 registry->RegisterDictionaryPref( | 169 registry->RegisterDictionaryPref( |
170 prefs::kManagedModeManualHosts, | 170 prefs::kManagedModeManualHosts, |
171 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 171 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
172 registry->RegisterDictionaryPref( | 172 registry->RegisterDictionaryPref( |
173 prefs::kManagedModeManualURLs, | 173 prefs::kManagedModeManualURLs, |
174 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 174 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
175 registry->RegisterIntegerPref( | 175 registry->RegisterIntegerPref( |
176 prefs::kDefaultManagedModeFilteringBehavior, ManagedModeURLFilter::ALLOW, | 176 prefs::kDefaultManagedModeFilteringBehavior, ManagedModeURLFilter::ALLOW, |
177 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 177 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 612 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
613 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 613 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
614 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 614 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
615 bool allow = false; | 615 bool allow = false; |
616 bool result = it.value().GetAsBoolean(&allow); | 616 bool result = it.value().GetAsBoolean(&allow); |
617 DCHECK(result); | 617 DCHECK(result); |
618 (*url_map)[GURL(it.key())] = allow; | 618 (*url_map)[GURL(it.key())] = allow; |
619 } | 619 } |
620 url_filter_context_.SetManualURLs(url_map.Pass()); | 620 url_filter_context_.SetManualURLs(url_map.Pass()); |
621 } | 621 } |
OLD | NEW |