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

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

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 <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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // The dictionary containing the extension's manifest. 61 // The dictionary containing the extension's manifest.
62 const char kPrefManifest[] = "manifest"; 62 const char kPrefManifest[] = "manifest";
63 63
64 // The version number. 64 // The version number.
65 const char kPrefVersion[] = "manifest.version"; 65 const char kPrefVersion[] = "manifest.version";
66 66
67 // Indicates whether an extension is blacklisted. 67 // Indicates whether an extension is blacklisted.
68 const char kPrefBlacklist[] = "blacklist"; 68 const char kPrefBlacklist[] = "blacklist";
69 69
70 // If extension is greylisted.
71 const char kPrefGreylist[] = "greylist";
72
70 // The count of how many times we prompted the user to acknowledge an 73 // The count of how many times we prompted the user to acknowledge an
71 // extension. 74 // extension.
72 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count"; 75 const char kPrefAcknowledgePromptCount[] = "ack_prompt_count";
73 76
74 // Indicates whether the user has acknowledged various types of extensions. 77 // Indicates whether the user has acknowledged various types of extensions.
75 const char kPrefExternalAcknowledged[] = "ack_external"; 78 const char kPrefExternalAcknowledged[] = "ack_external";
76 const char kPrefBlacklistAcknowledged[] = "ack_blacklist"; 79 const char kPrefBlacklistAcknowledged[] = "ack_blacklist";
77 const char kPrefWipeoutAcknowledged[] = "ack_wiped"; 80 const char kPrefWipeoutAcknowledged[] = "ack_wiped";
78 81
79 // Indicates whether the external extension was installed during the first 82 // Indicates whether the external extension was installed during the first
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 1143
1141 void ExtensionPrefs::SetExtensionState(const std::string& extension_id, 1144 void ExtensionPrefs::SetExtensionState(const std::string& extension_id,
1142 Extension::State state) { 1145 Extension::State state) {
1143 UpdateExtensionPref(extension_id, kPrefState, 1146 UpdateExtensionPref(extension_id, kPrefState,
1144 new base::FundamentalValue(state)); 1147 new base::FundamentalValue(state));
1145 bool enabled = (state == Extension::ENABLED); 1148 bool enabled = (state == Extension::ENABLED);
1146 extension_pref_value_map_->SetExtensionState(extension_id, enabled); 1149 extension_pref_value_map_->SetExtensionState(extension_id, enabled);
1147 content_settings_store_->SetExtensionState(extension_id, enabled); 1150 content_settings_store_->SetExtensionState(extension_id, enabled);
1148 } 1151 }
1149 1152
1153 void ExtensionPrefs::SetExtensionGreylisted(const std::string& extension_id,
1154 bool state) {
1155 UpdateExtensionPref(extension_id, kPrefGreylist,
1156 new base::FundamentalValue(state));
1157 }
1158
1159 bool ExtensionPrefs::IsExtensionGreylisted(const std::string& extension_id) {
1160 const base::DictionaryValue* ext_prefs = GetExtensionPref(extension_id);
1161 bool bool_value;
1162 return ext_prefs && ext_prefs->GetBoolean(kPrefGreylist, &bool_value)
1163 && bool_value;
1164 }
1165
1150 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) { 1166 std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
1151 const base::DictionaryValue* extension = GetExtensionPref(extension_id); 1167 const base::DictionaryValue* extension = GetExtensionPref(extension_id);
1152 if (!extension) 1168 if (!extension)
1153 return std::string(); 1169 return std::string();
1154 1170
1155 std::string version; 1171 std::string version;
1156 extension->GetString(kPrefVersion, &version); 1172 extension->GetString(kPrefVersion, &version);
1157 1173
1158 return version; 1174 return version;
1159 } 1175 }
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 is_enabled = initial_state == Extension::ENABLED; 1900 is_enabled = initial_state == Extension::ENABLED;
1885 } 1901 }
1886 1902
1887 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 1903 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
1888 is_enabled); 1904 is_enabled);
1889 content_settings_store_->RegisterExtension(extension_id, install_time, 1905 content_settings_store_->RegisterExtension(extension_id, install_time,
1890 is_enabled); 1906 is_enabled);
1891 } 1907 }
1892 1908
1893 } // namespace extensions 1909 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698