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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added UI, store blacklist state in prefs, +2 unittests. 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/ui/webui/extensions/extension_settings_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
10 #include "apps/shell_window.h" 10 #include "apps/shell_window.h"
11 #include "apps/shell_window_registry.h" 11 #include "apps/shell_window_registry.h"
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/base64.h" 13 #include "base/base64.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "base/version.h" 24 #include "base/version.h"
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/devtools/devtools_window.h" 27 #include "chrome/browser/devtools/devtools_window.h"
28 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 28 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
29 #include "chrome/browser/extensions/blacklist_state.h"
29 #include "chrome/browser/extensions/component_loader.h" 30 #include "chrome/browser/extensions/component_loader.h"
30 #include "chrome/browser/extensions/crx_installer.h" 31 #include "chrome/browser/extensions/crx_installer.h"
31 #include "chrome/browser/extensions/devtools_util.h" 32 #include "chrome/browser/extensions/devtools_util.h"
32 #include "chrome/browser/extensions/error_console/error_console.h" 33 #include "chrome/browser/extensions/error_console/error_console.h"
33 #include "chrome/browser/extensions/extension_action_manager.h" 34 #include "chrome/browser/extensions/extension_action_manager.h"
34 #include "chrome/browser/extensions/extension_disabled_ui.h" 35 #include "chrome/browser/extensions/extension_disabled_ui.h"
35 #include "chrome/browser/extensions/extension_error_reporter.h" 36 #include "chrome/browser/extensions/extension_error_reporter.h"
36 #include "chrome/browser/extensions/extension_host.h" 37 #include "chrome/browser/extensions/extension_host.h"
37 #include "chrome/browser/extensions/extension_service.h" 38 #include "chrome/browser/extensions/extension_service.h"
38 #include "chrome/browser/extensions/extension_system.h" 39 #include "chrome/browser/extensions/extension_system.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); 236 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access());
236 extension_data->SetBoolean("allowFileAccess", 237 extension_data->SetBoolean("allowFileAccess",
237 extension_util::AllowFileAccess(extension, extension_service_)); 238 extension_util::AllowFileAccess(extension, extension_service_));
238 extension_data->SetBoolean("allow_reload", 239 extension_data->SetBoolean("allow_reload",
239 Manifest::IsUnpackedLocation(extension->location())); 240 Manifest::IsUnpackedLocation(extension->location()));
240 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); 241 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
241 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); 242 extension_data->SetBoolean("is_platform_app", extension->is_platform_app());
242 extension_data->SetBoolean("homepageProvided", 243 extension_data->SetBoolean("homepageProvided",
243 ManifestURL::GetHomepageURL(extension).is_valid()); 244 ManifestURL::GetHomepageURL(extension).is_valid());
244 245
246 BlacklistState blacklist_state =
247 extension_service_->extension_prefs()->GetExtensionBlacklistState(
248 extension->id());
245 base::string16 location_text; 249 base::string16 location_text;
246 if (Manifest::IsPolicyLocation(extension->location())) { 250 if (Manifest::IsPolicyLocation(extension->location())) {
247 location_text = l10n_util::GetStringUTF16( 251 location_text = l10n_util::GetStringUTF16(
248 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); 252 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE);
249 } else if (extension->location() == Manifest::INTERNAL && 253 } else if (extension->location() == Manifest::INTERNAL &&
250 !ManifestURL::UpdatesFromGallery(extension)) { 254 !ManifestURL::UpdatesFromGallery(extension)) {
251 location_text = l10n_util::GetStringUTF16( 255 location_text = l10n_util::GetStringUTF16(
252 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); 256 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN);
253 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { 257 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) {
254 location_text = l10n_util::GetStringUTF16( 258 location_text = l10n_util::GetStringUTF16(
255 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); 259 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY);
260 } else if (blacklist_state != NOT_BLACKLISTED) {
261 switch (blacklist_state) {
262 case BLACKLISTED_SECURITY_VULNERABILITY:
263 location_text = l10n_util::GetStringUTF16(
264 IDS_OPTIONS_BLACKLISTED_SECURITY_VULNERABILITY);
265 break;
266
267 case BLACKLISTED_CWS_POLICY_VIOLATION:
268 location_text = l10n_util::GetStringUTF16(
269 IDS_OPTIONS_BLACKLISTED_CWS_POLICY_VIOLATION);
270 break;
271
272 case BLACKLISTED_POTENTIALLY_UNWANTED:
273 location_text = l10n_util::GetStringUTF16(
274 IDS_OPTIONS_BLACKLISTED_POTENTIALLY_UNWANTED);
275 break;
276
277 default:
278 break;
279 }
256 } 280 }
257 extension_data->SetString("locationText", location_text); 281 extension_data->SetString("locationText", location_text);
258 282
259 // Force unpacked extensions to show at the top. 283 // Force unpacked extensions to show at the top.
260 if (Manifest::IsUnpackedLocation(extension->location())) 284 if (Manifest::IsUnpackedLocation(extension->location()))
261 extension_data->SetInteger("order", 1); 285 extension_data->SetInteger("order", 1);
262 else 286 else
263 extension_data->SetInteger("order", 2); 287 extension_data->SetInteger("order", 2);
264 288
265 if (!ExtensionActionAPI::GetBrowserActionVisibility( 289 if (!ExtensionActionAPI::GetBrowserActionVisibility(
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 extension_service_->EnableExtension(extension_id); 1268 extension_service_->EnableExtension(extension_id);
1245 } else { 1269 } else {
1246 ExtensionErrorReporter::GetInstance()->ReportError( 1270 ExtensionErrorReporter::GetInstance()->ReportError(
1247 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1271 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1248 true /* be noisy */); 1272 true /* be noisy */);
1249 } 1273 }
1250 requirements_checker_.reset(); 1274 requirements_checker_.reset();
1251 } 1275 }
1252 1276
1253 } // namespace extensions 1277 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698