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

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

Issue 536753003: Add recommended extension installation support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-3
Patch Set: fixes addressing #3 Created 6 years, 3 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
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/saved_files_service.h" 8 #include "apps/saved_files_service.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 should_do_verification_check_ = true; 231 should_do_verification_check_ = true;
232 232
233 bool corrupt_install = 233 bool corrupt_install =
234 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0; 234 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0;
235 extension_data->SetBoolean("corruptInstall", corrupt_install); 235 extension_data->SetBoolean("corruptInstall", corrupt_install);
236 236
237 bool managed_install = 237 bool managed_install =
238 !management_policy_->UserMayModifySettings(extension, NULL); 238 !management_policy_->UserMayModifySettings(extension, NULL);
239 extension_data->SetBoolean("managedInstall", managed_install); 239 extension_data->SetBoolean("managedInstall", managed_install);
240 240
241 bool recommended_install =
242 !managed_install &&
243 management_policy_->MustRemainInstalled(extension, NULL);
244 extension_data->SetBoolean("recommendedInstall", recommended_install);
245
241 // We should not get into a state where both are true. 246 // We should not get into a state where both are true.
242 DCHECK(!managed_install || !suspicious_install); 247 DCHECK(!(managed_install || recommended_install) || !suspicious_install);
243 248
244 GURL icon = 249 GURL icon =
245 ExtensionIconSource::GetIconURL(extension, 250 ExtensionIconSource::GetIconURL(extension,
246 extension_misc::EXTENSION_ICON_MEDIUM, 251 extension_misc::EXTENSION_ICON_MEDIUM,
247 ExtensionIconSet::MATCH_BIGGER, 252 ExtensionIconSet::MATCH_BIGGER,
248 !enabled, NULL); 253 !enabled, NULL);
249 if (Manifest::IsUnpackedLocation(extension->location())) { 254 if (Manifest::IsUnpackedLocation(extension->location())) {
250 extension_data->SetString("path", extension->path().value()); 255 extension_data->SetString("path", extension->path().value());
251 extension_data->SetString( 256 extension_data->SetString(
252 "prettifiedPath", 257 "prettifiedPath",
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 util::AllowedScriptingOnAllUrls( 308 util::AllowedScriptingOnAllUrls(
304 extension->id(), extension_service_->GetBrowserContext())); 309 extension->id(), extension_service_->GetBrowserContext()));
305 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); 310 extension_data->SetBoolean("wantsAllUrls", wants_all_urls);
306 extension_data->SetBoolean( 311 extension_data->SetBoolean(
307 "allowAllUrls", 312 "allowAllUrls",
308 util::AllowedScriptingOnAllUrls( 313 util::AllowedScriptingOnAllUrls(
309 extension->id(), 314 extension->id(),
310 extension_service_->GetBrowserContext())); 315 extension_service_->GetBrowserContext()));
311 316
312 base::string16 location_text; 317 base::string16 location_text;
313 if (Manifest::IsPolicyLocation(extension->location())) { 318 if (Manifest::IsPolicyLocation(extension->location()) ||
319 (extension->location() == Manifest::EXTERNAL_PREF_DOWNLOAD &&
320 recommended_install)) {
314 location_text = l10n_util::GetStringUTF16( 321 location_text = l10n_util::GetStringUTF16(
315 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); 322 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE);
316 } else if (extension->location() == Manifest::INTERNAL && 323 } else if (extension->location() == Manifest::INTERNAL &&
317 !ManifestURL::UpdatesFromGallery(extension)) { 324 !ManifestURL::UpdatesFromGallery(extension)) {
318 location_text = l10n_util::GetStringUTF16( 325 location_text = l10n_util::GetStringUTF16(
319 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); 326 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN);
320 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { 327 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) {
321 location_text = l10n_util::GetStringUTF16( 328 location_text = l10n_util::GetStringUTF16(
322 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); 329 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY);
323 } else if (extension->is_shared_module()) { 330 } else if (extension->is_shared_module()) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 source->AddString("extensionSettingsOptions", 526 source->AddString("extensionSettingsOptions",
520 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); 527 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK));
521 source->AddString("extensionSettingsPermissions", 528 source->AddString("extensionSettingsPermissions",
522 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); 529 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK));
523 source->AddString("extensionSettingsVisitWebsite", 530 source->AddString("extensionSettingsVisitWebsite",
524 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); 531 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE));
525 source->AddString("extensionSettingsVisitWebStore", 532 source->AddString("extensionSettingsVisitWebStore",
526 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); 533 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE));
527 source->AddString("extensionSettingsPolicyControlled", 534 source->AddString("extensionSettingsPolicyControlled",
528 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); 535 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED));
536 source->AddString("extensionSettingsPolicyRecommeneded",
537 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_RECOMMENDED));
529 source->AddString("extensionSettingsDependentExtensions", 538 source->AddString("extensionSettingsDependentExtensions",
530 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEPENDENT_EXTENSIONS)); 539 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEPENDENT_EXTENSIONS));
531 source->AddString("extensionSettingsSupervisedUser", 540 source->AddString("extensionSettingsSupervisedUser",
532 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER)); 541 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER));
533 source->AddString("extensionSettingsCorruptInstall", 542 source->AddString("extensionSettingsCorruptInstall",
534 l10n_util::GetStringUTF16( 543 l10n_util::GetStringUTF16(
535 IDS_EXTENSIONS_CORRUPTED_EXTENSION)); 544 IDS_EXTENSIONS_CORRUPTED_EXTENSION));
536 source->AddString("extensionSettingsSuspiciousInstall", 545 source->AddString("extensionSettingsSuspiciousInstall",
537 l10n_util::GetStringFUTF16( 546 l10n_util::GetStringFUTF16(
538 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, 547 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE,
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 extension_service_->EnableExtension(extension_id); 1425 extension_service_->EnableExtension(extension_id);
1417 } else { 1426 } else {
1418 ExtensionErrorReporter::GetInstance()->ReportError( 1427 ExtensionErrorReporter::GetInstance()->ReportError(
1419 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1428 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1420 true); // Be noisy. 1429 true); // Be noisy.
1421 } 1430 }
1422 requirements_checker_.reset(); 1431 requirements_checker_.reset();
1423 } 1432 }
1424 1433
1425 } // namespace extensions 1434 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698