Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/dom_ui/shown_sections_handler.h" | |
| 10 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 12 | 13 |
| 13 using base::Time; | 14 using base::Time; |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 // Additional preferences keys | 18 // Additional preferences keys |
| 18 | 19 |
| 19 // Where an extension was installed from. (see Extension::Location) | 20 // Where an extension was installed from. (see Extension::Location) |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 extension->path(), NULL); | 532 extension->path(), NULL); |
| 532 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path)); | 533 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path)); |
| 533 // We store prefs about LOAD extensions, but don't cache their manifest | 534 // We store prefs about LOAD extensions, but don't cache their manifest |
| 534 // since it may change on disk. | 535 // since it may change on disk. |
| 535 if (extension->location() != Extension::LOAD) { | 536 if (extension->location() != Extension::LOAD) { |
| 536 UpdateExtensionPref(id, kPrefManifest, | 537 UpdateExtensionPref(id, kPrefManifest, |
| 537 extension->manifest_value()->DeepCopy()); | 538 extension->manifest_value()->DeepCopy()); |
| 538 } | 539 } |
| 539 UpdateExtensionPref(id, kPrefAppLaunchIndex, | 540 UpdateExtensionPref(id, kPrefAppLaunchIndex, |
| 540 Value::CreateIntegerValue(GetNextAppLaunchIndex())); | 541 Value::CreateIntegerValue(GetNextAppLaunchIndex())); |
| 542 ShownSectionsHandler::OnExtensionInstalled(prefs_, extension); | |
|
Aaron Boodman
2010/11/11 17:59:13
We usually do this kind of work in ExtensionsServi
Dmitry Polukhin
2010/11/11 20:08:20
Done.
| |
| 541 SavePrefsAndNotify(); | 543 SavePrefsAndNotify(); |
| 542 } | 544 } |
| 543 | 545 |
| 544 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, | 546 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, |
| 545 const Extension::Location& location, | 547 const Extension::Location& location, |
| 546 bool external_uninstall) { | 548 bool external_uninstall) { |
| 547 // For external extensions, we save a preference reminding ourself not to try | 549 // For external extensions, we save a preference reminding ourself not to try |
| 548 // and install the extension anymore (except when |external_uninstall| is | 550 // and install the extension anymore (except when |external_uninstall| is |
| 549 // true, which signifies that the registry key was deleted or the pref file | 551 // true, which signifies that the registry key was deleted or the pref file |
| 550 // no longer lists the extension). | 552 // no longer lists the extension). |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 901 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
| 900 prefs->RegisterDictionaryPref(kExtensionsPref); | 902 prefs->RegisterDictionaryPref(kExtensionsPref); |
| 901 prefs->RegisterListPref(kExtensionToolbar); | 903 prefs->RegisterListPref(kExtensionToolbar); |
| 902 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 904 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
| 903 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 905 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
| 904 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 906 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
| 905 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 907 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
| 906 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 908 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
| 907 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 909 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
| 908 } | 910 } |
| OLD | NEW |