| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133       BrowserThread::IO, | 133       BrowserThread::IO, | 
| 134       FROM_HERE, | 134       FROM_HERE, | 
| 135       base::Bind(&ManagedModeURLFilter::SetManualURLs, | 135       base::Bind(&ManagedModeURLFilter::SetManualURLs, | 
| 136                  io_url_filter_, base::Owned(url_map.release()))); | 136                  io_url_filter_, base::Owned(url_map.release()))); | 
| 137 } | 137 } | 
| 138 | 138 | 
| 139 ManagedUserService::ManagedUserService(Profile* profile) | 139 ManagedUserService::ManagedUserService(Profile* profile) | 
| 140     : weak_ptr_factory_(this), | 140     : weak_ptr_factory_(this), | 
| 141       profile_(profile), | 141       profile_(profile), | 
| 142       waiting_for_sync_initialization_(false), | 142       waiting_for_sync_initialization_(false), | 
| 143       elevated_for_testing_(false) { | 143       elevated_for_testing_(false), | 
|  | 144       did_shutdown_(false) { | 
| 144 } | 145 } | 
| 145 | 146 | 
| 146 ManagedUserService::~ManagedUserService() {} | 147 ManagedUserService::~ManagedUserService() { | 
|  | 148   DCHECK(did_shutdown_); | 
|  | 149 } | 
| 147 | 150 | 
| 148 void ManagedUserService::Shutdown() { | 151 void ManagedUserService::Shutdown() { | 
|  | 152   did_shutdown_ = true; | 
| 149   if (!waiting_for_sync_initialization_) | 153   if (!waiting_for_sync_initialization_) | 
| 150     return; | 154     return; | 
| 151 | 155 | 
| 152   ProfileSyncService* sync_service = | 156   ProfileSyncService* sync_service = | 
| 153         ProfileSyncServiceFactory::GetForProfile(profile_); | 157         ProfileSyncServiceFactory::GetForProfile(profile_); | 
| 154   sync_service->RemoveObserver(this); | 158   sync_service->RemoveObserver(this); | 
| 155 } | 159 } | 
| 156 | 160 | 
| 157 bool ManagedUserService::ProfileIsManaged() const { | 161 bool ManagedUserService::ProfileIsManaged() const { | 
| 158   return ProfileIsManaged(profile_); | 162   return ProfileIsManaged(profile_); | 
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 612       profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 616       profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 
| 613   scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 617   scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 
| 614   for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 618   for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 
| 615     bool allow = false; | 619     bool allow = false; | 
| 616     bool result = it.value().GetAsBoolean(&allow); | 620     bool result = it.value().GetAsBoolean(&allow); | 
| 617     DCHECK(result); | 621     DCHECK(result); | 
| 618     (*url_map)[GURL(it.key())] = allow; | 622     (*url_map)[GURL(it.key())] = allow; | 
| 619   } | 623   } | 
| 620   url_filter_context_.SetManualURLs(url_map.Pass()); | 624   url_filter_context_.SetManualURLs(url_map.Pass()); | 
| 621 } | 625 } | 
| OLD | NEW | 
|---|