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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (CanSkipPassphraseDialog(web_contents)) { | 146 if (CanSkipPassphraseDialog(web_contents)) { |
147 callback.Run(true); | 147 callback.Run(true); |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 // Is deleted automatically when the dialog is closed. | 151 // Is deleted automatically when the dialog is closed. |
152 new ManagedUserPassphraseDialog(web_contents, callback); | 152 new ManagedUserPassphraseDialog(web_contents, callback); |
153 } | 153 } |
154 | 154 |
155 // static | 155 // static |
156 void ManagedUserService::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 156 void ManagedUserService::RegisterUserPrefs( |
157 registry->RegisterDictionaryPref(prefs::kManagedModeManualHosts, | 157 user_prefs::PrefRegistrySyncable* registry) { |
158 PrefRegistrySyncable::UNSYNCABLE_PREF); | 158 registry->RegisterDictionaryPref( |
159 registry->RegisterDictionaryPref(prefs::kManagedModeManualURLs, | 159 prefs::kManagedModeManualHosts, |
160 PrefRegistrySyncable::UNSYNCABLE_PREF); | 160 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
161 registry->RegisterIntegerPref(prefs::kDefaultManagedModeFilteringBehavior, | 161 registry->RegisterDictionaryPref( |
162 ManagedModeURLFilter::ALLOW, | 162 prefs::kManagedModeManualURLs, |
163 PrefRegistrySyncable::UNSYNCABLE_PREF); | 163 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
164 registry->RegisterStringPref(prefs::kManagedModeLocalPassphrase, | 164 registry->RegisterIntegerPref( |
165 std::string(), | 165 prefs::kDefaultManagedModeFilteringBehavior, |
166 PrefRegistrySyncable::UNSYNCABLE_PREF); | 166 ManagedModeURLFilter::ALLOW, |
167 registry->RegisterStringPref(prefs::kManagedModeLocalSalt, | 167 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
168 std::string(), | 168 registry->RegisterStringPref( |
169 PrefRegistrySyncable::UNSYNCABLE_PREF); | 169 prefs::kManagedModeLocalPassphrase, |
| 170 std::string(), |
| 171 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 172 registry->RegisterStringPref( |
| 173 prefs::kManagedModeLocalSalt, |
| 174 std::string(), |
| 175 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
170 } | 176 } |
171 | 177 |
172 scoped_refptr<const ManagedModeURLFilter> | 178 scoped_refptr<const ManagedModeURLFilter> |
173 ManagedUserService::GetURLFilterForIOThread() { | 179 ManagedUserService::GetURLFilterForIOThread() { |
174 return url_filter_context_.io_url_filter(); | 180 return url_filter_context_.io_url_filter(); |
175 } | 181 } |
176 | 182 |
177 ManagedModeURLFilter* ManagedUserService::GetURLFilterForUIThread() { | 183 ManagedModeURLFilter* ManagedUserService::GetURLFilterForUIThread() { |
178 return url_filter_context_.ui_url_filter(); | 184 return url_filter_context_.ui_url_filter(); |
179 } | 185 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 509 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
504 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 510 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
505 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 511 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
506 bool allow = false; | 512 bool allow = false; |
507 bool result = it.value().GetAsBoolean(&allow); | 513 bool result = it.value().GetAsBoolean(&allow); |
508 DCHECK(result); | 514 DCHECK(result); |
509 (*url_map)[GURL(it.key())] = allow; | 515 (*url_map)[GURL(it.key())] = allow; |
510 } | 516 } |
511 url_filter_context_.SetManualURLs(url_map.Pass()); | 517 url_filter_context_.SetManualURLs(url_map.Pass()); |
512 } | 518 } |
OLD | NEW |