OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_prefs.h" | 5 #include "extensions/browser/extension_prefs.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_notifier.h" | 10 #include "base/prefs/pref_notifier.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 return GetExtensionPref(extension_id) != NULL; | 534 return GetExtensionPref(extension_id) != NULL; |
535 } | 535 } |
536 | 536 |
537 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id, | 537 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id, |
538 const std::string& pref_key, | 538 const std::string& pref_key, |
539 URLPatternSet* result, | 539 URLPatternSet* result, |
540 int valid_schemes) { | 540 int valid_schemes) { |
541 const base::ListValue* value = NULL; | 541 const base::ListValue* value = NULL; |
542 if (!ReadPrefAsList(extension_id, pref_key, &value)) | 542 if (!ReadPrefAsList(extension_id, pref_key, &value)) |
543 return false; | 543 return false; |
544 /* | |
545 scoped_ptr<ExtensionInfo> installed_extension = | |
546 GetInstalledExtensionInfo(extension_id); | |
547 if (!installed_extension.get()) | |
548 return false; | |
549 if (installed_extension->extension_location == Manifest::COMPONENT) | |
550 valid_schemes |= URLPattern::SCHEME_CHROMEUI; | |
551 */ | |
552 const base::DictionaryValue* extensions = GetExtensionPref(extension_id); | |
not at google - send to devlin
2015/04/09 14:56:07
"extension", not "extensions".
Deepak
2015/04/10 05:16:34
Done.
| |
553 if (!extensions) | |
554 return false; | |
555 int location_value; | |
not at google - send to devlin
2015/04/09 14:56:07
just "location"?
Deepak
2015/04/10 05:16:34
Done.
| |
556 if (extensions->GetInteger(kPrefLocation, &location_value) && | |
557 static_cast<Manifest::Location>(location_value) == Manifest::COMPONENT) { | |
558 valid_schemes |= URLPattern::SCHEME_CHROMEUI; | |
559 } | |
544 | 560 |
545 bool allow_file_access = AllowFileAccess(extension_id); | 561 bool allow_file_access = AllowFileAccess(extension_id); |
546 return result->Populate(*value, valid_schemes, allow_file_access, NULL); | 562 return result->Populate(*value, valid_schemes, allow_file_access, NULL); |
547 } | 563 } |
548 | 564 |
549 void ExtensionPrefs::SetExtensionPrefURLPatternSet( | 565 void ExtensionPrefs::SetExtensionPrefURLPatternSet( |
550 const std::string& extension_id, | 566 const std::string& extension_id, |
551 const std::string& pref_key, | 567 const std::string& pref_key, |
552 const URLPatternSet& new_value) { | 568 const URLPatternSet& new_value) { |
553 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); | 569 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2126 extension_pref_value_map_->RegisterExtension( | 2142 extension_pref_value_map_->RegisterExtension( |
2127 extension_id, install_time, is_enabled, is_incognito_enabled); | 2143 extension_id, install_time, is_enabled, is_incognito_enabled); |
2128 | 2144 |
2129 FOR_EACH_OBSERVER( | 2145 FOR_EACH_OBSERVER( |
2130 ExtensionPrefsObserver, | 2146 ExtensionPrefsObserver, |
2131 observer_list_, | 2147 observer_list_, |
2132 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2148 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2133 } | 2149 } |
2134 | 2150 |
2135 } // namespace extensions | 2151 } // namespace extensions |
OLD | NEW |