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/prefs/pref_notifier.h" | 10 #include "base/prefs/pref_notifier.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // The count of how many times we prompted the user to acknowledge an | 71 // The count of how many times we prompted the user to acknowledge an |
72 // extension. | 72 // extension. |
73 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count"; | 73 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count"; |
74 | 74 |
75 // Indicates whether the user has acknowledged various types of extensions. | 75 // Indicates whether the user has acknowledged various types of extensions. |
76 const char kPrefExternalAcknowledged[] = "ack_external"; | 76 const char kPrefExternalAcknowledged[] = "ack_external"; |
77 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; | 77 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; |
78 const char kPrefWipeoutAcknowledged[] = "ack_wiped"; | 78 const char kPrefWipeoutAcknowledged[] = "ack_wiped"; |
79 const char kPrefSettingsBubbleAcknowledged[] = "ack_settings_bubble"; | 79 const char kPrefSettingsBubbleAcknowledged[] = "ack_settings_bubble"; |
80 const char kPrefNtpBubbleAcknowledged[] = "ack_ntp_bubble"; | 80 const char kPrefNtpBubbleAcknowledged[] = "ack_ntp_bubble"; |
| 81 const char kPrefProxyBubbleAcknowledged[] = "ack_proxy_bubble"; |
81 | 82 |
82 // Indicates whether the external extension was installed during the first | 83 // Indicates whether the external extension was installed during the first |
83 // run of this profile. | 84 // run of this profile. |
84 const char kPrefExternalInstallFirstRun[] = "external_first_run"; | 85 const char kPrefExternalInstallFirstRun[] = "external_first_run"; |
85 | 86 |
86 // Indicates whether to show an install warning when the user enables. | 87 // Indicates whether to show an install warning when the user enables. |
87 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; | 88 const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; |
88 | 89 |
89 // DO NOT USE, use kPrefDisableReasons instead. | 90 // DO NOT USE, use kPrefDisableReasons instead. |
90 // Indicates whether the extension was updated while it was disabled. | 91 // Indicates whether the extension was updated while it was disabled. |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 755 } |
755 | 756 |
756 void ExtensionPrefs::SetNtpOverriddenBubbleBeenAcknowledged( | 757 void ExtensionPrefs::SetNtpOverriddenBubbleBeenAcknowledged( |
757 const std::string& extension_id, | 758 const std::string& extension_id, |
758 bool value) { | 759 bool value) { |
759 UpdateExtensionPref(extension_id, | 760 UpdateExtensionPref(extension_id, |
760 kPrefNtpBubbleAcknowledged, | 761 kPrefNtpBubbleAcknowledged, |
761 value ? base::Value::CreateBooleanValue(value) : NULL); | 762 value ? base::Value::CreateBooleanValue(value) : NULL); |
762 } | 763 } |
763 | 764 |
| 765 bool ExtensionPrefs::HasProxyOverriddenBubbleBeenAcknowledged( |
| 766 const std::string& extension_id) { |
| 767 return ReadPrefAsBooleanAndReturn(extension_id, kPrefProxyBubbleAcknowledged); |
| 768 } |
| 769 |
| 770 void ExtensionPrefs::SetProxyOverriddenBubbleBeenAcknowledged( |
| 771 const std::string& extension_id, |
| 772 bool value) { |
| 773 UpdateExtensionPref(extension_id, |
| 774 kPrefProxyBubbleAcknowledged, |
| 775 value ? base::Value::CreateBooleanValue(value) : NULL); |
| 776 } |
| 777 |
764 bool ExtensionPrefs::SetAlertSystemFirstRun() { | 778 bool ExtensionPrefs::SetAlertSystemFirstRun() { |
765 if (prefs_->GetBoolean(pref_names::kAlertsInitialized)) { | 779 if (prefs_->GetBoolean(pref_names::kAlertsInitialized)) { |
766 return true; | 780 return true; |
767 } | 781 } |
768 prefs_->SetBoolean(pref_names::kAlertsInitialized, true); | 782 prefs_->SetBoolean(pref_names::kAlertsInitialized, true); |
769 return false; | 783 return false; |
770 } | 784 } |
771 | 785 |
772 bool ExtensionPrefs::ExtensionsBlacklistedByDefault() const { | 786 bool ExtensionPrefs::ExtensionsBlacklistedByDefault() const { |
773 return admin_policy::BlacklistedByDefault( | 787 return admin_policy::BlacklistedByDefault( |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 extension_pref_value_map_->RegisterExtension( | 2253 extension_pref_value_map_->RegisterExtension( |
2240 extension_id, install_time, is_enabled, is_incognito_enabled); | 2254 extension_id, install_time, is_enabled, is_incognito_enabled); |
2241 | 2255 |
2242 FOR_EACH_OBSERVER( | 2256 FOR_EACH_OBSERVER( |
2243 ExtensionPrefsObserver, | 2257 ExtensionPrefsObserver, |
2244 observer_list_, | 2258 observer_list_, |
2245 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2259 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2246 } | 2260 } |
2247 | 2261 |
2248 } // namespace extensions | 2262 } // namespace extensions |
OLD | NEW |