| OLD | NEW |
| 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 <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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const char kPrefBlacklist[] = "blacklist"; | 83 const char kPrefBlacklist[] = "blacklist"; |
| 84 | 84 |
| 85 // The count of how many times we prompted the user to acknowledge an | 85 // The count of how many times we prompted the user to acknowledge an |
| 86 // extension. | 86 // extension. |
| 87 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count"; | 87 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count"; |
| 88 | 88 |
| 89 // Indicates whether the user has acknowledged various types of extensions. | 89 // Indicates whether the user has acknowledged various types of extensions. |
| 90 const char kPrefExternalAcknowledged[] = "ack_external"; | 90 const char kPrefExternalAcknowledged[] = "ack_external"; |
| 91 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; | 91 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; |
| 92 const char kPrefWipeoutAcknowledged[] = "ack_wiped"; | 92 const char kPrefWipeoutAcknowledged[] = "ack_wiped"; |
| 93 const char kPrefDevModeAcknowledged[] = "ack_devmode"; |
| 93 | 94 |
| 94 // Indicates whether the external extension was installed during the first | 95 // Indicates whether the external extension was installed during the first |
| 95 // run of this profile. | 96 // run of this profile. |
| 96 const char kPrefExternalInstallFirstRun[] = "external_first_run"; | 97 const char kPrefExternalInstallFirstRun[] = "external_first_run"; |
| 97 | 98 |
| 98 // Indicates whether to show an install warning when the user enables. | 99 // Indicates whether to show an install warning when the user enables. |
| 99 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; | 100 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; |
| 100 | 101 |
| 101 // DO NOT USE, use kPrefDisableReasons instead. | 102 // DO NOT USE, use kPrefDisableReasons instead. |
| 102 // Indicates whether the extension was updated while it was disabled. | 103 // Indicates whether the extension was updated while it was disabled. |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 685 |
| 685 bool ExtensionPrefs::HasWipeoutBeenAcknowledged( | 686 bool ExtensionPrefs::HasWipeoutBeenAcknowledged( |
| 686 const std::string& extension_id) { | 687 const std::string& extension_id) { |
| 687 return ReadPrefAsBooleanAndReturn(extension_id, kPrefWipeoutAcknowledged); | 688 return ReadPrefAsBooleanAndReturn(extension_id, kPrefWipeoutAcknowledged); |
| 688 } | 689 } |
| 689 | 690 |
| 690 void ExtensionPrefs::SetWipeoutAcknowledged( | 691 void ExtensionPrefs::SetWipeoutAcknowledged( |
| 691 const std::string& extension_id, | 692 const std::string& extension_id, |
| 692 bool value) { | 693 bool value) { |
| 693 UpdateExtensionPref(extension_id, kPrefWipeoutAcknowledged, | 694 UpdateExtensionPref(extension_id, kPrefWipeoutAcknowledged, |
| 694 Value::CreateBooleanValue(value)); | 695 value ? Value::CreateBooleanValue(value) : NULL); |
| 696 } |
| 697 |
| 698 bool ExtensionPrefs::HasDevModeBeenAcknowledged( |
| 699 const std::string& extension_id) { |
| 700 return ReadPrefAsBooleanAndReturn(extension_id, kPrefDevModeAcknowledged); |
| 701 } |
| 702 |
| 703 void ExtensionPrefs::SetDevModeAcknowledged( |
| 704 const std::string& extension_id, |
| 705 bool value) { |
| 706 UpdateExtensionPref(extension_id, kPrefDevModeAcknowledged, |
| 707 value ? Value::CreateBooleanValue(value) : NULL); |
| 695 } | 708 } |
| 696 | 709 |
| 697 bool ExtensionPrefs::SetAlertSystemFirstRun() { | 710 bool ExtensionPrefs::SetAlertSystemFirstRun() { |
| 698 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) { | 711 if (prefs_->GetBoolean(prefs::kExtensionAlertsInitializedPref)) { |
| 699 return true; | 712 return true; |
| 700 } | 713 } |
| 701 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true); | 714 prefs_->SetBoolean(prefs::kExtensionAlertsInitializedPref, true); |
| 702 return false; | 715 return false; |
| 703 } | 716 } |
| 704 | 717 |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 is_enabled = initial_state == Extension::ENABLED; | 2000 is_enabled = initial_state == Extension::ENABLED; |
| 1988 } | 2001 } |
| 1989 | 2002 |
| 1990 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 2003 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
| 1991 is_enabled); | 2004 is_enabled); |
| 1992 content_settings_store_->RegisterExtension(extension_id, install_time, | 2005 content_settings_store_->RegisterExtension(extension_id, install_time, |
| 1993 is_enabled); | 2006 is_enabled); |
| 1994 } | 2007 } |
| 1995 | 2008 |
| 1996 } // namespace extensions | 2009 } // namespace extensions |
| OLD | NEW |