| 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/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 BrowserThread::PostTask( | 81 BrowserThread::PostTask( |
| 82 BrowserThread::IO, | 82 BrowserThread::IO, |
| 83 FROM_HERE, | 83 FROM_HERE, |
| 84 base::Bind(&ManagedModeURLFilter::SetManualURLs, | 84 base::Bind(&ManagedModeURLFilter::SetManualURLs, |
| 85 io_url_filter_, base::Owned(url_map.release()))); | 85 io_url_filter_, base::Owned(url_map.release()))); |
| 86 } | 86 } |
| 87 | 87 |
| 88 ManagedUserService::ManagedUserService(Profile* profile) | 88 ManagedUserService::ManagedUserService(Profile* profile) |
| 89 : profile_(profile), | 89 : profile_(profile), |
| 90 is_elevated_(false) { | 90 is_elevated_(false) { |
| 91 Init(); | |
| 92 } | 91 } |
| 93 | 92 |
| 94 ManagedUserService::~ManagedUserService() { | 93 ManagedUserService::~ManagedUserService() { |
| 95 } | 94 } |
| 96 | 95 |
| 97 bool ManagedUserService::ProfileIsManaged() const { | 96 bool ManagedUserService::ProfileIsManaged() const { |
| 98 return profile_->GetPrefs()->GetBoolean(prefs::kProfileIsManaged); | 97 return profile_->GetPrefs()->GetBoolean(prefs::kProfileIsManaged); |
| 99 } | 98 } |
| 100 | 99 |
| 101 // static | 100 // static |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 359 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
| 361 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 360 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
| 362 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 361 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
| 363 bool allow = false; | 362 bool allow = false; |
| 364 bool result = it.value().GetAsBoolean(&allow); | 363 bool result = it.value().GetAsBoolean(&allow); |
| 365 DCHECK(result); | 364 DCHECK(result); |
| 366 (*url_map)[GURL(it.key())] = allow; | 365 (*url_map)[GURL(it.key())] = allow; |
| 367 } | 366 } |
| 368 url_filter_context_.SetManualURLs(url_map.Pass()); | 367 url_filter_context_.SetManualURLs(url_map.Pass()); |
| 369 } | 368 } |
| OLD | NEW |