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

Side by Side Diff: chrome/browser/extensions/api/developer_private/extension_info_generator.cc

Issue 1051273002: Update chrome://extensions for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test data Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/api/developer_private/extension_info_generat or.h" 5 #include "chrome/browser/extensions/api/developer_private/extension_info_generat or.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find er.h" 9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find er.h"
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 blacklist_text = IDS_OPTIONS_BLACKLISTED_POTENTIALLY_UNWANTED; 250 blacklist_text = IDS_OPTIONS_BLACKLISTED_POTENTIALLY_UNWANTED;
251 break; 251 break;
252 default: 252 default:
253 break; 253 break;
254 } 254 }
255 if (blacklist_text != -1) { 255 if (blacklist_text != -1) {
256 info->blacklist_text.reset( 256 info->blacklist_text.reset(
257 new std::string(l10n_util::GetStringUTF8(blacklist_text))); 257 new std::string(l10n_util::GetStringUTF8(blacklist_text)));
258 } 258 }
259 259
260 Profile* profile = Profile::FromBrowserContext(browser_context_);
261
262 bool is_policy_location = Manifest::IsPolicyLocation(extension.location());
263 if (is_policy_location || util::IsExtensionSupervised(&extension, profile)) {
264 info->controlled_info.reset(new developer::ControlledInfo());
265 if (is_policy_location) {
266 info->controlled_info->type = developer::CONTROLLER_TYPE_POLICY;
267 info->controlled_info->text =
268 l10n_util::GetStringUTF8(IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE);
269 } else if (profile->IsChild()) {
270 info->controlled_info->type = developer::CONTROLLER_TYPE_CHILD_CUSTODIAN;
271 info->controlled_info->text = l10n_util::GetStringUTF8(
272 IDS_EXTENSIONS_INSTALLED_BY_CHILD_CUSTODIAN);
273 } else {
274 info->controlled_info->type =
275 developer::CONTROLLER_TYPE_SUPERVISED_USER_CUSTODIAN;
276 info->controlled_info->text = l10n_util::GetStringUTF8(
277 IDS_EXTENSIONS_INSTALLED_BY_SUPERVISED_USER_CUSTODIAN);
278 }
279 }
280
260 // Dependent extensions. 281 // Dependent extensions.
261 if (extension.is_shared_module()) { 282 if (extension.is_shared_module()) {
262 scoped_ptr<ExtensionSet> dependent_extensions = 283 scoped_ptr<ExtensionSet> dependent_extensions =
263 extension_system_->extension_service()-> 284 extension_system_->extension_service()->
264 shared_module_service()->GetDependentExtensions(&extension); 285 shared_module_service()->GetDependentExtensions(&extension);
265 for (const scoped_refptr<const Extension>& dependent : 286 for (const scoped_refptr<const Extension>& dependent :
266 *dependent_extensions) 287 *dependent_extensions)
267 info->dependent_extensions.push_back(dependent->id()); 288 info->dependent_extensions.push_back(dependent->id());
268 } 289 }
269 290
(...skipping 25 matching lines...) Expand all
295 info->home_page.url = ManifestURL::GetHomepageURL(&extension).spec(); 316 info->home_page.url = ManifestURL::GetHomepageURL(&extension).spec();
296 info->home_page.specified = ManifestURL::SpecifiedHomepageURL(&extension); 317 info->home_page.specified = ManifestURL::SpecifiedHomepageURL(&extension);
297 318
298 info->id = extension.id(); 319 info->id = extension.id();
299 320
300 // Incognito access. 321 // Incognito access.
301 info->incognito_access.is_enabled = extension.can_be_incognito_enabled(); 322 info->incognito_access.is_enabled = extension.can_be_incognito_enabled();
302 info->incognito_access.is_active = 323 info->incognito_access.is_active =
303 util::IsIncognitoEnabled(extension.id(), browser_context_); 324 util::IsIncognitoEnabled(extension.id(), browser_context_);
304 325
305 Profile* profile = Profile::FromBrowserContext(browser_context_);
306 info->installed_by_custodian =
307 util::IsExtensionSupervised(&extension, profile);
308
309 // Install warnings (only if unpacked and no error console). 326 // Install warnings (only if unpacked and no error console).
310 if (!error_console_enabled && 327 if (!error_console_enabled &&
311 Manifest::IsUnpackedLocation(extension.location())) { 328 Manifest::IsUnpackedLocation(extension.location())) {
312 const std::vector<InstallWarning>& install_warnings = 329 const std::vector<InstallWarning>& install_warnings =
313 extension.install_warnings(); 330 extension.install_warnings();
314 for (const InstallWarning& warning : install_warnings) 331 for (const InstallWarning& warning : install_warnings)
315 info->install_warnings.push_back(warning.message); 332 info->install_warnings.push_back(warning.message);
316 } 333 }
317 334
318 // Launch url. 335 // Launch url.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 OptionsPageInfo::GetOptionsPage(&extension).spec(); 401 OptionsPageInfo::GetOptionsPage(&extension).spec();
385 } 402 }
386 403
387 // Path. 404 // Path.
388 if (Manifest::IsUnpackedLocation(extension.location())) { 405 if (Manifest::IsUnpackedLocation(extension.location())) {
389 info->path.reset(new std::string(extension.path().AsUTF8Unsafe())); 406 info->path.reset(new std::string(extension.path().AsUTF8Unsafe()));
390 info->prettified_path.reset(new std::string( 407 info->prettified_path.reset(new std::string(
391 extensions::path_util::PrettifyPath(extension.path()).AsUTF8Unsafe())); 408 extensions::path_util::PrettifyPath(extension.path()).AsUTF8Unsafe()));
392 } 409 }
393 410
394 if (Manifest::IsPolicyLocation(extension.location())) {
395 info->policy_text.reset(new std::string(
396 l10n_util::GetStringUTF8(IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE)));
397 }
398
399 // Runs on all urls. 411 // Runs on all urls.
400 info->run_on_all_urls.is_enabled = 412 info->run_on_all_urls.is_enabled =
401 (FeatureSwitch::scripts_require_action()->IsEnabled() && 413 (FeatureSwitch::scripts_require_action()->IsEnabled() &&
402 PermissionsData::ScriptsMayRequireActionForExtension( 414 PermissionsData::ScriptsMayRequireActionForExtension(
403 &extension, 415 &extension,
404 extension.permissions_data()->active_permissions().get())) || 416 extension.permissions_data()->active_permissions().get())) ||
405 extension.permissions_data()->HasWithheldImpliedAllHosts() || 417 extension.permissions_data()->HasWithheldImpliedAllHosts() ||
406 util::HasSetAllowedScriptingOnAllUrls(extension.id(), browser_context_); 418 util::HasSetAllowedScriptingOnAllUrls(extension.id(), browser_context_);
407 info->run_on_all_urls.is_active = 419 info->run_on_all_urls.is_active =
408 util::AllowedScriptingOnAllUrls(extension.id(), browser_context_); 420 util::AllowedScriptingOnAllUrls(extension.id(), browser_context_);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // that at the end of the method, any stored refs are destroyed. 536 // that at the end of the method, any stored refs are destroyed.
525 ExtensionInfoList list; 537 ExtensionInfoList list;
526 list.swap(list_); 538 list.swap(list_);
527 ExtensionInfosCallback callback = callback_; 539 ExtensionInfosCallback callback = callback_;
528 callback_.Reset(); 540 callback_.Reset();
529 callback.Run(list); // WARNING: |this| is possibly deleted after this line! 541 callback.Run(list); // WARNING: |this| is possibly deleted after this line!
530 } 542 }
531 } 543 }
532 544
533 } // namespace extensions 545 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/resources/extensions/extension_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698