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 const base::DictionaryValue* extension = GetExtensionPref(extension_id); |
| 545 if (!extension) |
| 546 return false; |
| 547 int location; |
| 548 if (extension->GetInteger(kPrefLocation, &location) && |
| 549 static_cast<Manifest::Location>(location) == Manifest::COMPONENT) { |
| 550 valid_schemes |= URLPattern::SCHEME_CHROMEUI; |
| 551 } |
544 | 552 |
545 bool allow_file_access = AllowFileAccess(extension_id); | 553 bool allow_file_access = AllowFileAccess(extension_id); |
546 return result->Populate(*value, valid_schemes, allow_file_access, NULL); | 554 return result->Populate(*value, valid_schemes, allow_file_access, NULL); |
547 } | 555 } |
548 | 556 |
549 void ExtensionPrefs::SetExtensionPrefURLPatternSet( | 557 void ExtensionPrefs::SetExtensionPrefURLPatternSet( |
550 const std::string& extension_id, | 558 const std::string& extension_id, |
551 const std::string& pref_key, | 559 const std::string& pref_key, |
552 const URLPatternSet& new_value) { | 560 const URLPatternSet& new_value) { |
553 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); | 561 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( | 2134 extension_pref_value_map_->RegisterExtension( |
2127 extension_id, install_time, is_enabled, is_incognito_enabled); | 2135 extension_id, install_time, is_enabled, is_incognito_enabled); |
2128 | 2136 |
2129 FOR_EACH_OBSERVER( | 2137 FOR_EACH_OBSERVER( |
2130 ExtensionPrefsObserver, | 2138 ExtensionPrefsObserver, |
2131 observer_list_, | 2139 observer_list_, |
2132 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2140 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2133 } | 2141 } |
2134 | 2142 |
2135 } // namespace extensions | 2143 } // namespace extensions |
OLD | NEW |