| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 ScopedVector<ManagedModeSiteList> site_lists; | 311 ScopedVector<ManagedModeSiteList> site_lists; |
| 312 ExtensionService* extension_service = | 312 ExtensionService* extension_service = |
| 313 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 313 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 314 // Can be NULL in unit tests. | 314 // Can be NULL in unit tests. |
| 315 if (!extension_service) | 315 if (!extension_service) |
| 316 return site_lists.Pass(); | 316 return site_lists.Pass(); |
| 317 | 317 |
| 318 const ExtensionSet* extensions = extension_service->extensions(); | 318 const ExtensionSet* extensions = extension_service->extensions(); |
| 319 for (ExtensionSet::const_iterator it = extensions->begin(); | 319 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 320 it != extensions->end(); ++it) { | 320 it != extensions->end(); ++it) { |
| 321 const extensions::Extension* extension = *it; | 321 const extensions::Extension* extension = it->get(); |
| 322 if (!extension_service->IsExtensionEnabled(extension->id())) | 322 if (!extension_service->IsExtensionEnabled(extension->id())) |
| 323 continue; | 323 continue; |
| 324 | 324 |
| 325 extensions::ExtensionResource site_list = | 325 extensions::ExtensionResource site_list = |
| 326 extensions::ManagedModeInfo::GetContentPackSiteList(extension); | 326 extensions::ManagedModeInfo::GetContentPackSiteList(extension); |
| 327 if (!site_list.empty()) | 327 if (!site_list.empty()) |
| 328 site_lists.push_back(new ManagedModeSiteList(extension->id(), site_list)); | 328 site_lists.push_back(new ManagedModeSiteList(extension->id(), site_list)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 return site_lists.Pass(); | 331 return site_lists.Pass(); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 576 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
| 577 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 577 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
| 578 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 578 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
| 579 bool allow = false; | 579 bool allow = false; |
| 580 bool result = it.value().GetAsBoolean(&allow); | 580 bool result = it.value().GetAsBoolean(&allow); |
| 581 DCHECK(result); | 581 DCHECK(result); |
| 582 (*url_map)[GURL(it.key())] = allow; | 582 (*url_map)[GURL(it.key())] = allow; |
| 583 } | 583 } |
| 584 url_filter_context_.SetManualURLs(url_map.Pass()); | 584 url_filter_context_.SetManualURLs(url_map.Pass()); |
| 585 } | 585 } |
| OLD | NEW |