Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 23694020: Don't clear existing extension-defined preferences and content settings when reloading or updating… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/prefs/pref_notifier.h" 7 #include "base/prefs/pref_notifier.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } 1828 }
1829 } 1829 }
1830 1830
1831 void ExtensionPrefs::FinishExtensionInfoPrefs( 1831 void ExtensionPrefs::FinishExtensionInfoPrefs(
1832 const std::string& extension_id, 1832 const std::string& extension_id,
1833 const base::Time install_time, 1833 const base::Time install_time,
1834 bool needs_sort_ordinal, 1834 bool needs_sort_ordinal,
1835 const syncer::StringOrdinal& suggested_page_ordinal, 1835 const syncer::StringOrdinal& suggested_page_ordinal,
1836 DictionaryValue* extension_dict) { 1836 DictionaryValue* extension_dict) {
1837 // Reinitializes various preferences with empty dictionaries. 1837 // Reinitializes various preferences with empty dictionaries.
1838 extension_dict->Set(pref_names::kPrefPreferences, new DictionaryValue); 1838 if (!extension_dict->HasKey(pref_names::kPrefPreferences))
Jeffrey Yasskin 2013/09/06 21:31:56 Nit: This might be clearer with a helper function:
Jeffrey Yasskin 2013/09/06 21:31:56 I double-checked that uninstalling an extension re
1839 extension_dict->Set(pref_names::kPrefIncognitoPreferences, 1839 extension_dict->Set(pref_names::kPrefPreferences, new DictionaryValue);
1840 new DictionaryValue); 1840
1841 extension_dict->Set(pref_names::kPrefRegularOnlyPreferences, 1841 if (!extension_dict->HasKey(pref_names::kPrefIncognitoPreferences)) {
1842 new DictionaryValue); 1842 extension_dict->Set(pref_names::kPrefIncognitoPreferences,
1843 extension_dict->Set(pref_names::kPrefContentSettings, new ListValue); 1843 new DictionaryValue);
1844 extension_dict->Set(pref_names::kPrefIncognitoContentSettings, new ListValue); 1844 }
1845
1846 if (!extension_dict->HasKey(pref_names::kPrefRegularOnlyPreferences)) {
1847 extension_dict->Set(pref_names::kPrefRegularOnlyPreferences,
1848 new DictionaryValue);
1849 }
1850
1851 if (!extension_dict->HasKey(pref_names::kPrefContentSettings))
1852 extension_dict->Set(pref_names::kPrefContentSettings, new ListValue);
1853
1854 if (!extension_dict->HasKey(pref_names::kPrefIncognitoContentSettings)) {
1855 extension_dict->Set(pref_names::kPrefIncognitoContentSettings,
1856 new ListValue);
1857 }
1845 1858
1846 // If this point has been reached, any pending installs should be considered 1859 // If this point has been reached, any pending installs should be considered
1847 // out of date. 1860 // out of date.
1848 extension_dict->Remove(kDelayedInstallInfo, NULL); 1861 extension_dict->Remove(kDelayedInstallInfo, NULL);
1849 1862
1850 // Clear state that may be registered from a previous install. 1863 // Clear state that may be registered from a previous install.
1851 extension_dict->Remove(EventRouter::kRegisteredEvents, NULL); 1864 extension_dict->Remove(EventRouter::kRegisteredEvents, NULL);
1852 1865
1853 // FYI, all code below here races on sudden shutdown because 1866 // FYI, all code below here races on sudden shutdown because
1854 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|, 1867 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|,
(...skipping 11 matching lines...) Expand all
1866 is_enabled = initial_state == Extension::ENABLED; 1879 is_enabled = initial_state == Extension::ENABLED;
1867 } 1880 }
1868 1881
1869 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 1882 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
1870 is_enabled); 1883 is_enabled);
1871 content_settings_store_->RegisterExtension(extension_id, install_time, 1884 content_settings_store_->RegisterExtension(extension_id, install_time,
1872 is_enabled); 1885 is_enabled);
1873 } 1886 }
1874 1887
1875 } // namespace extensions 1888 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698