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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ExtensionService* extension_service = | 199 ExtensionService* extension_service = |
200 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 200 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
201 | 201 |
202 // |extension_service| can be NULL in a unit test. | 202 // |extension_service| can be NULL in a unit test. |
203 if (extension_service && | 203 if (extension_service && |
204 extension_service->GetInstalledExtension(extension->id())) | 204 extension_service->GetInstalledExtension(extension->id())) |
205 return true; | 205 return true; |
206 | 206 |
207 if (extension) { | 207 if (extension) { |
208 bool was_installed_by_default = extension->was_installed_by_default(); | 208 bool was_installed_by_default = extension->was_installed_by_default(); |
209 #ifdef OS_CHROMEOS | 209 #if defined(OS_CHROMEOS) |
210 // On Chrome OS all external sources are controlled by us so it means that | 210 // On Chrome OS all external sources are controlled by us so it means that |
211 // they are "default". Method was_installed_by_default returns false because | 211 // they are "default". Method was_installed_by_default returns false because |
212 // extensions creation flags are ignored in case of default extensions with | 212 // extensions creation flags are ignored in case of default extensions with |
213 // update URL(the flags aren't passed to OnExternalExtensionUpdateUrlFound). | 213 // update URL(the flags aren't passed to OnExternalExtensionUpdateUrlFound). |
214 // TODO(dpolukhin): remove this Chrome OS specific code as soon as creation | 214 // TODO(dpolukhin): remove this Chrome OS specific code as soon as creation |
215 // flags are not ignored. | 215 // flags are not ignored. |
216 was_installed_by_default = | 216 was_installed_by_default = |
217 extensions::Manifest::IsExternalLocation(extension->location()); | 217 extensions::Manifest::IsExternalLocation(extension->location()); |
218 #endif | 218 #endif |
219 if (extension->location() == extensions::Manifest::COMPONENT || | 219 if (extension->location() == extensions::Manifest::COMPONENT || |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 441 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
442 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 442 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
443 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 443 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
444 bool allow = false; | 444 bool allow = false; |
445 bool result = it.value().GetAsBoolean(&allow); | 445 bool result = it.value().GetAsBoolean(&allow); |
446 DCHECK(result); | 446 DCHECK(result); |
447 (*url_map)[GURL(it.key())] = allow; | 447 (*url_map)[GURL(it.key())] = allow; |
448 } | 448 } |
449 url_filter_context_.SetManualURLs(url_map.Pass()); | 449 url_filter_context_.SetManualURLs(url_map.Pass()); |
450 } | 450 } |
OLD | NEW |