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/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 return GetExtensionPref(extension_id) != NULL; | 536 return GetExtensionPref(extension_id) != NULL; |
537 } | 537 } |
538 | 538 |
539 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id, | 539 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id, |
540 const std::string& pref_key, | 540 const std::string& pref_key, |
541 URLPatternSet* result, | 541 URLPatternSet* result, |
542 int valid_schemes) { | 542 int valid_schemes) { |
543 const base::ListValue* value = NULL; | 543 const base::ListValue* value = NULL; |
544 if (!ReadPrefAsList(extension_id, pref_key, &value)) | 544 if (!ReadPrefAsList(extension_id, pref_key, &value)) |
545 return false; | 545 return false; |
| 546 const base::DictionaryValue* extension = GetExtensionPref(extension_id); |
| 547 if (!extension) |
| 548 return false; |
| 549 int location; |
| 550 if (extension->GetInteger(kPrefLocation, &location) && |
| 551 static_cast<Manifest::Location>(location) == Manifest::COMPONENT) { |
| 552 valid_schemes |= URLPattern::SCHEME_CHROMEUI; |
| 553 } |
546 | 554 |
547 bool allow_file_access = AllowFileAccess(extension_id); | 555 bool allow_file_access = AllowFileAccess(extension_id); |
548 return result->Populate(*value, valid_schemes, allow_file_access, NULL); | 556 return result->Populate(*value, valid_schemes, allow_file_access, NULL); |
549 } | 557 } |
550 | 558 |
551 void ExtensionPrefs::SetExtensionPrefURLPatternSet( | 559 void ExtensionPrefs::SetExtensionPrefURLPatternSet( |
552 const std::string& extension_id, | 560 const std::string& extension_id, |
553 const std::string& pref_key, | 561 const std::string& pref_key, |
554 const URLPatternSet& new_value) { | 562 const URLPatternSet& new_value) { |
555 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); | 563 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 extension_pref_value_map_->RegisterExtension( | 2146 extension_pref_value_map_->RegisterExtension( |
2139 extension_id, install_time, is_enabled, is_incognito_enabled); | 2147 extension_id, install_time, is_enabled, is_incognito_enabled); |
2140 | 2148 |
2141 FOR_EACH_OBSERVER( | 2149 FOR_EACH_OBSERVER( |
2142 ExtensionPrefsObserver, | 2150 ExtensionPrefsObserver, |
2143 observer_list_, | 2151 observer_list_, |
2144 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2152 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2145 } | 2153 } |
2146 | 2154 |
2147 } // namespace extensions | 2155 } // namespace extensions |
OLD | NEW |