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

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

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/extensions/external_provider_impl.h" 5 #include "chrome/browser/extensions/external_provider_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 19 matching lines...) Expand all
30 #include "extensions/browser/extension_system.h" 30 #include "extensions/browser/extension_system.h"
31 #include "extensions/browser/external_provider_interface.h" 31 #include "extensions/browser/external_provider_interface.h"
32 #include "extensions/common/extension.h" 32 #include "extensions/common/extension.h"
33 #include "extensions/common/manifest.h" 33 #include "extensions/common/manifest.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 35
36 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
37 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 37 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
38 #include "chrome/browser/chromeos/customization_document.h" 38 #include "chrome/browser/chromeos/customization_document.h"
39 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h" 39 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h"
40 #include "chrome/browser/chromeos/policy/app_pack_updater.h"
41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
42 #include "chrome/browser/chromeos/policy/device_local_account.h" 41 #include "chrome/browser/chromeos/policy/device_local_account.h"
43 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 42 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
44 #include "chrome/browser/chromeos/profiles/profile_helper.h" 43 #include "chrome/browser/chromeos/profiles/profile_helper.h"
45 #include "components/user_manager/user.h" 44 #include "components/user_manager/user.h"
46 #include "components/user_manager/user_manager.h"
47 #else 45 #else
48 #include "chrome/browser/extensions/default_apps.h" 46 #include "chrome/browser/extensions/default_apps.h"
49 #endif 47 #endif
50 48
51 #if defined(OS_WIN) 49 #if defined(OS_WIN)
52 #include "chrome/browser/extensions/external_registry_loader_win.h" 50 #include "chrome/browser/extensions/external_registry_loader_win.h"
53 #endif 51 #endif
54 52
55 using content::BrowserThread; 53 using content::BrowserThread;
56 54
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // On Mac OS, items in /Library/... should be written by the superuser. 455 // On Mac OS, items in /Library/... should be written by the superuser.
458 // Check that all components of the path are writable by root only. 456 // Check that all components of the path are writable by root only.
459 ExternalPrefLoader::Options check_admin_permissions_on_mac; 457 ExternalPrefLoader::Options check_admin_permissions_on_mac;
460 #if defined(OS_MACOSX) 458 #if defined(OS_MACOSX)
461 check_admin_permissions_on_mac = 459 check_admin_permissions_on_mac =
462 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; 460 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN;
463 #else 461 #else
464 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; 462 check_admin_permissions_on_mac = ExternalPrefLoader::NONE;
465 #endif 463 #endif
466 464
467 bool is_chromeos_demo_session = false;
468 int bundled_extension_creation_flags = Extension::NO_FLAGS; 465 int bundled_extension_creation_flags = Extension::NO_FLAGS;
469 #if defined(OS_CHROMEOS) 466 #if defined(OS_CHROMEOS)
470 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
471 is_chromeos_demo_session =
472 user_manager && user_manager->IsLoggedInAsDemoUser() &&
473 connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK;
474 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | 467 bundled_extension_creation_flags = Extension::FROM_WEBSTORE |
475 Extension::WAS_INSTALLED_BY_DEFAULT; 468 Extension::WAS_INSTALLED_BY_DEFAULT;
476 #endif 469 #endif
477 470
478 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 471 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
479 if (!profile->IsSupervised()) { 472 if (!profile->IsSupervised()) {
480 provider_list->push_back( 473 provider_list->push_back(
481 linked_ptr<ExternalProviderInterface>( 474 linked_ptr<ExternalProviderInterface>(
482 new ExternalProviderImpl( 475 new ExternalProviderImpl(
483 service, 476 service,
484 new ExternalPrefLoader( 477 new ExternalPrefLoader(
485 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, 478 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS,
486 ExternalPrefLoader::NONE, 479 ExternalPrefLoader::NONE,
487 NULL), 480 NULL),
488 profile, 481 profile,
489 Manifest::EXTERNAL_PREF, 482 Manifest::EXTERNAL_PREF,
490 Manifest::EXTERNAL_PREF_DOWNLOAD, 483 Manifest::EXTERNAL_PREF_DOWNLOAD,
491 bundled_extension_creation_flags))); 484 bundled_extension_creation_flags)));
492 } 485 }
493 #endif 486 #endif
494 487
495 #if defined(OS_CHROMEOS) 488 #if defined(OS_CHROMEOS)
496 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { 489 if (!is_chrome_os_public_session) {
497 int external_apps_path_id = profile->IsSupervised() ? 490 int external_apps_path_id = profile->IsSupervised() ?
498 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : 491 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS :
499 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; 492 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS;
500 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ? 493 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ?
501 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC : 494 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC :
502 ExternalPrefLoader::NONE; 495 ExternalPrefLoader::NONE;
503 provider_list->push_back( 496 provider_list->push_back(
504 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( 497 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl(
505 service, 498 service,
506 new ExternalPrefLoader(external_apps_path_id, 499 new ExternalPrefLoader(external_apps_path_id,
(...skipping 10 matching lines...) Expand all
517 chromeos::ServicesCustomizationDocument* customization = 510 chromeos::ServicesCustomizationDocument* customization =
518 chromeos::ServicesCustomizationDocument::GetInstance(); 511 chromeos::ServicesCustomizationDocument::GetInstance();
519 provider_list->push_back(linked_ptr<ExternalProviderInterface>( 512 provider_list->push_back(linked_ptr<ExternalProviderInterface>(
520 new ExternalProviderImpl(service, 513 new ExternalProviderImpl(service,
521 customization->CreateExternalLoader(profile), 514 customization->CreateExternalLoader(profile),
522 profile, 515 profile,
523 Manifest::EXTERNAL_PREF, 516 Manifest::EXTERNAL_PREF,
524 Manifest::EXTERNAL_PREF_DOWNLOAD, 517 Manifest::EXTERNAL_PREF_DOWNLOAD,
525 oem_extension_creation_flags))); 518 oem_extension_creation_flags)));
526 } 519 }
527
528 policy::AppPackUpdater* app_pack_updater = connector->GetAppPackUpdater();
529 if (is_chromeos_demo_session && app_pack_updater &&
530 !app_pack_updater->created_external_loader()) {
531 provider_list->push_back(
532 linked_ptr<ExternalProviderInterface>(
533 new ExternalProviderImpl(
534 service,
535 app_pack_updater->CreateExternalLoader(),
536 profile,
537 Manifest::EXTERNAL_PREF,
538 Manifest::INVALID_LOCATION,
539 Extension::NO_FLAGS)));
540 }
541 #endif 520 #endif
542 521
543 if (!profile->IsSupervised() && !is_chromeos_demo_session) { 522 if (!profile->IsSupervised()) {
544 #if !defined(OS_WIN) 523 #if !defined(OS_WIN)
545 provider_list->push_back( 524 provider_list->push_back(
546 linked_ptr<ExternalProviderInterface>( 525 linked_ptr<ExternalProviderInterface>(
547 new ExternalProviderImpl( 526 new ExternalProviderImpl(
548 service, 527 service,
549 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, 528 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS,
550 check_admin_permissions_on_mac, 529 check_admin_permissions_on_mac,
551 NULL), 530 NULL),
552 profile, 531 profile,
553 Manifest::EXTERNAL_PREF, 532 Manifest::EXTERNAL_PREF,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 service, 584 service,
606 new ExternalComponentLoader(profile), 585 new ExternalComponentLoader(profile),
607 profile, 586 profile,
608 Manifest::INVALID_LOCATION, 587 Manifest::INVALID_LOCATION,
609 Manifest::EXTERNAL_COMPONENT, 588 Manifest::EXTERNAL_COMPONENT,
610 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); 589 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)));
611 } 590 }
612 } 591 }
613 592
614 } // namespace extensions 593 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698