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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 758 } |
758 | 759 |
759 void ExtensionPrefs::SetNtpOverriddenBubbleBeenAcknowledged( | 760 void ExtensionPrefs::SetNtpOverriddenBubbleBeenAcknowledged( |
760 const std::string& extension_id, | 761 const std::string& extension_id, |
761 bool value) { | 762 bool value) { |
762 UpdateExtensionPref(extension_id, | 763 UpdateExtensionPref(extension_id, |
763 kPrefNtpBubbleAcknowledged, | 764 kPrefNtpBubbleAcknowledged, |
764 value ? base::Value::CreateBooleanValue(value) : NULL); | 765 value ? base::Value::CreateBooleanValue(value) : NULL); |
765 } | 766 } |
766 | 767 |
| 768 bool ExtensionPrefs::HasProxyOverriddenBubbleBeenAcknowledged( |
| 769 const std::string& extension_id) { |
| 770 return ReadPrefAsBooleanAndReturn(extension_id, kPrefProxyBubbleAcknowledged); |
| 771 } |
| 772 |
| 773 void ExtensionPrefs::SetProxyOverriddenBubbleBeenAcknowledged( |
| 774 const std::string& extension_id, |
| 775 bool value) { |
| 776 UpdateExtensionPref(extension_id, |
| 777 kPrefProxyBubbleAcknowledged, |
| 778 value ? base::Value::CreateBooleanValue(value) : NULL); |
| 779 } |
| 780 |
767 bool ExtensionPrefs::SetAlertSystemFirstRun() { | 781 bool ExtensionPrefs::SetAlertSystemFirstRun() { |
768 if (prefs_->GetBoolean(pref_names::kAlertsInitialized)) { | 782 if (prefs_->GetBoolean(pref_names::kAlertsInitialized)) { |
769 return true; | 783 return true; |
770 } | 784 } |
771 prefs_->SetBoolean(pref_names::kAlertsInitialized, true); | 785 prefs_->SetBoolean(pref_names::kAlertsInitialized, true); |
772 return false; | 786 return false; |
773 } | 787 } |
774 | 788 |
775 bool ExtensionPrefs::ExtensionsBlacklistedByDefault() const { | 789 bool ExtensionPrefs::ExtensionsBlacklistedByDefault() const { |
776 return admin_policy::BlacklistedByDefault( | 790 return admin_policy::BlacklistedByDefault( |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 extension_pref_value_map_->RegisterExtension( | 2275 extension_pref_value_map_->RegisterExtension( |
2262 extension_id, install_time, is_enabled, is_incognito_enabled); | 2276 extension_id, install_time, is_enabled, is_incognito_enabled); |
2263 | 2277 |
2264 FOR_EACH_OBSERVER( | 2278 FOR_EACH_OBSERVER( |
2265 ExtensionPrefsObserver, | 2279 ExtensionPrefsObserver, |
2266 observer_list_, | 2280 observer_list_, |
2267 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 2281 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
2268 } | 2282 } |
2269 | 2283 |
2270 } // namespace extensions | 2284 } // namespace extensions |
OLD | NEW |