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

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: Move blacklist_state.h to extensions/. 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"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "content/public/browser/notification_source.h" 62 #include "content/public/browser/notification_source.h"
63 #include "content/public/browser/notification_types.h" 63 #include "content/public/browser/notification_types.h"
64 #include "content/public/browser/render_process_host.h" 64 #include "content/public/browser/render_process_host.h"
65 #include "content/public/browser/render_view_host.h" 65 #include "content/public/browser/render_view_host.h"
66 #include "content/public/browser/site_instance.h" 66 #include "content/public/browser/site_instance.h"
67 #include "content/public/browser/user_metrics.h" 67 #include "content/public/browser/user_metrics.h"
68 #include "content/public/browser/web_contents.h" 68 #include "content/public/browser/web_contents.h"
69 #include "content/public/browser/web_contents_view.h" 69 #include "content/public/browser/web_contents_view.h"
70 #include "content/public/browser/web_ui.h" 70 #include "content/public/browser/web_ui.h"
71 #include "content/public/browser/web_ui_data_source.h" 71 #include "content/public/browser/web_ui_data_source.h"
72 #include "extensions/browser/blacklist_state.h"
72 #include "extensions/browser/extension_error.h" 73 #include "extensions/browser/extension_error.h"
73 #include "extensions/browser/extension_registry.h" 74 #include "extensions/browser/extension_registry.h"
74 #include "extensions/browser/lazy_background_task_queue.h" 75 #include "extensions/browser/lazy_background_task_queue.h"
75 #include "extensions/browser/management_policy.h" 76 #include "extensions/browser/management_policy.h"
76 #include "extensions/browser/pref_names.h" 77 #include "extensions/browser/pref_names.h"
77 #include "extensions/browser/view_type_utils.h" 78 #include "extensions/browser/view_type_utils.h"
78 #include "extensions/common/constants.h" 79 #include "extensions/common/constants.h"
79 #include "extensions/common/extension.h" 80 #include "extensions/common/extension.h"
80 #include "extensions/common/extension_set.h" 81 #include "extensions/common/extension_set.h"
81 #include "extensions/common/feature_switch.h" 82 #include "extensions/common/feature_switch.h"
(...skipping 153 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) {
Finnur 2014/01/23 15:21:38 It is a bit weird that we'd categorize this label
Oleg Eterevsky 2014/01/23 16:33:06 I'll ask a PM working on this feature to find the
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;
Finnur 2014/01/23 15:21:38 Why is BLACKLISTED_MALWARE not handled?
Oleg Eterevsky 2014/01/23 16:33:06 Because malware extensions are not shown in the li
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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 extension_service_->EnableExtension(extension_id); 1243 extension_service_->EnableExtension(extension_id);
1220 } else { 1244 } else {
1221 ExtensionErrorReporter::GetInstance()->ReportError( 1245 ExtensionErrorReporter::GetInstance()->ReportError(
1222 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1246 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1223 true /* be noisy */); 1247 true /* be noisy */);
1224 } 1248 }
1225 requirements_checker_.reset(); 1249 requirements_checker_.reset();
1226 } 1250 }
1227 1251
1228 } // namespace extensions 1252 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698