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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); | 310 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); |
311 } else { | 311 } else { |
312 // It would be nice to CHECK that this doesn't happen, but since prefs can | 312 // It would be nice to CHECK that this doesn't happen, but since prefs can |
313 // get into a mangled state, we can't really do that. Instead, handle it | 313 // get into a mangled state, we can't really do that. Instead, handle it |
314 // gracefully (by overwriting whatever was previously there). | 314 // gracefully (by overwriting whatever was previously there). |
315 // TODO(devlin): It's unclear if there's anything we'll ever be able to do | 315 // TODO(devlin): It's unclear if there's anything we'll ever be able to do |
316 // here (corrupted prefs are sometimes a fact of life), but the debug info | 316 // here (corrupted prefs are sometimes a fact of life), but the debug info |
317 // might be useful. Remove the dumps after we analyze them. | 317 // might be useful. Remove the dumps after we analyze them. |
318 if (key_value->GetType() != type_enum_value) { | 318 if (key_value->GetType() != type_enum_value) { |
319 NOTREACHED(); | 319 NOTREACHED(); |
320 base::debug::SetCrashKeyValue( | 320 base::debug::SetCrashKeyValue( |
achuithb
2017/02/27 14:05:03
This change is due to the rebase.
| |
321 "existing_extension_pref_value_type", | 321 "existing_extension_pref_value_type", |
322 base::IntToString(static_cast<int>(key_value->GetType()))); | 322 base::IntToString(static_cast<int>(key_value->GetType()))); |
323 base::debug::DumpWithoutCrashing(); | 323 base::debug::DumpWithoutCrashing(); |
324 value_as_t = new T(); | 324 value_as_t = new T(); |
325 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); | 325 extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t)); |
326 } else { | 326 } else { |
327 value_as_t = static_cast<T*>(key_value); | 327 value_as_t = static_cast<T*>(key_value); |
328 } | 328 } |
329 } | 329 } |
330 return value_as_t; | 330 return value_as_t; |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1772 void ExtensionPrefs::RegisterProfilePrefs( | 1772 void ExtensionPrefs::RegisterProfilePrefs( |
1773 user_prefs::PrefRegistrySyncable* registry) { | 1773 user_prefs::PrefRegistrySyncable* registry) { |
1774 registry->RegisterDictionaryPref(pref_names::kExtensions); | 1774 registry->RegisterDictionaryPref(pref_names::kExtensions); |
1775 registry->RegisterListPref(pref_names::kToolbar, | 1775 registry->RegisterListPref(pref_names::kToolbar, |
1776 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 1776 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
1777 registry->RegisterIntegerPref(pref_names::kToolbarSize, -1); | 1777 registry->RegisterIntegerPref(pref_names::kToolbarSize, -1); |
1778 registry->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 1778 registry->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
1779 registry->RegisterListPref(pref_names::kInstallAllowList); | 1779 registry->RegisterListPref(pref_names::kInstallAllowList); |
1780 registry->RegisterListPref(pref_names::kInstallDenyList); | 1780 registry->RegisterListPref(pref_names::kInstallDenyList); |
1781 registry->RegisterDictionaryPref(pref_names::kInstallForceList); | 1781 registry->RegisterDictionaryPref(pref_names::kInstallForceList); |
1782 registry->RegisterDictionaryPref(pref_names::kInstallLoginList); | |
1782 registry->RegisterListPref(pref_names::kAllowedTypes); | 1783 registry->RegisterListPref(pref_names::kAllowedTypes); |
1783 registry->RegisterBooleanPref(pref_names::kStorageGarbageCollect, false); | 1784 registry->RegisterBooleanPref(pref_names::kStorageGarbageCollect, false); |
1784 registry->RegisterInt64Pref(pref_names::kLastUpdateCheck, 0); | 1785 registry->RegisterInt64Pref(pref_names::kLastUpdateCheck, 0); |
1785 registry->RegisterInt64Pref(pref_names::kNextUpdateCheck, 0); | 1786 registry->RegisterInt64Pref(pref_names::kNextUpdateCheck, 0); |
1786 registry->RegisterListPref(pref_names::kAllowedInstallSites); | 1787 registry->RegisterListPref(pref_names::kAllowedInstallSites); |
1787 registry->RegisterStringPref(pref_names::kLastChromeVersion, std::string()); | 1788 registry->RegisterStringPref(pref_names::kLastChromeVersion, std::string()); |
1788 registry->RegisterDictionaryPref(kInstallSignature); | 1789 registry->RegisterDictionaryPref(kInstallSignature); |
1789 | 1790 |
1790 registry->RegisterListPref(pref_names::kNativeMessagingBlacklist); | 1791 registry->RegisterListPref(pref_names::kNativeMessagingBlacklist); |
1791 registry->RegisterListPref(pref_names::kNativeMessagingWhitelist); | 1792 registry->RegisterListPref(pref_names::kNativeMessagingWhitelist); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1975 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); | 1976 bool is_incognito_enabled = IsIncognitoEnabled(extension_id); |
1976 | 1977 |
1977 extension_pref_value_map_->RegisterExtension( | 1978 extension_pref_value_map_->RegisterExtension( |
1978 extension_id, install_time, is_enabled, is_incognito_enabled); | 1979 extension_id, install_time, is_enabled, is_incognito_enabled); |
1979 | 1980 |
1980 for (auto& observer : observer_list_) | 1981 for (auto& observer : observer_list_) |
1981 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); | 1982 observer.OnExtensionRegistered(extension_id, install_time, is_enabled); |
1982 } | 1983 } |
1983 | 1984 |
1984 } // namespace extensions | 1985 } // namespace extensions |
OLD | NEW |