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

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 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/customization_document.h" 38 #include "chrome/browser/chromeos/customization/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 #if !defined(OS_WIN) 465 #if !defined(OS_WIN)
469 int bundled_extension_creation_flags = Extension::NO_FLAGS; 466 int bundled_extension_creation_flags = Extension::NO_FLAGS;
470 #endif 467 #endif
471 #if defined(OS_CHROMEOS) 468 #if defined(OS_CHROMEOS)
472 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
473 is_chromeos_demo_session =
474 user_manager && user_manager->IsLoggedInAsDemoUser() &&
475 connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK;
476 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | 469 bundled_extension_creation_flags = Extension::FROM_WEBSTORE |
477 Extension::WAS_INSTALLED_BY_DEFAULT; 470 Extension::WAS_INSTALLED_BY_DEFAULT;
478 471
479 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { 472 if (!is_chrome_os_public_session) {
480 int external_apps_path_id = profile->IsSupervised() ? 473 int external_apps_path_id = profile->IsSupervised() ?
481 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : 474 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS :
482 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; 475 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS;
483 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ? 476 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ?
484 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC : 477 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC :
485 ExternalPrefLoader::NONE; 478 ExternalPrefLoader::NONE;
486 provider_list->push_back( 479 provider_list->push_back(
487 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( 480 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl(
488 service, 481 service,
489 new ExternalPrefLoader(external_apps_path_id, 482 new ExternalPrefLoader(external_apps_path_id,
(...skipping 10 matching lines...) Expand all
500 chromeos::ServicesCustomizationDocument* customization = 493 chromeos::ServicesCustomizationDocument* customization =
501 chromeos::ServicesCustomizationDocument::GetInstance(); 494 chromeos::ServicesCustomizationDocument::GetInstance();
502 provider_list->push_back(linked_ptr<ExternalProviderInterface>( 495 provider_list->push_back(linked_ptr<ExternalProviderInterface>(
503 new ExternalProviderImpl(service, 496 new ExternalProviderImpl(service,
504 customization->CreateExternalLoader(profile), 497 customization->CreateExternalLoader(profile),
505 profile, 498 profile,
506 Manifest::EXTERNAL_PREF, 499 Manifest::EXTERNAL_PREF,
507 Manifest::EXTERNAL_PREF_DOWNLOAD, 500 Manifest::EXTERNAL_PREF_DOWNLOAD,
508 oem_extension_creation_flags))); 501 oem_extension_creation_flags)));
509 } 502 }
510
511 policy::AppPackUpdater* app_pack_updater = connector->GetAppPackUpdater();
512 if (is_chromeos_demo_session && app_pack_updater &&
513 !app_pack_updater->created_external_loader()) {
514 provider_list->push_back(
515 linked_ptr<ExternalProviderInterface>(
516 new ExternalProviderImpl(
517 service,
518 app_pack_updater->CreateExternalLoader(),
519 profile,
520 Manifest::EXTERNAL_PREF,
521 Manifest::INVALID_LOCATION,
522 Extension::NO_FLAGS)));
523 }
524 #elif defined(OS_LINUX) 503 #elif defined(OS_LINUX)
525 if (!profile->IsSupervised()) { 504 if (!profile->IsSupervised()) {
526 provider_list->push_back( 505 provider_list->push_back(
527 linked_ptr<ExternalProviderInterface>( 506 linked_ptr<ExternalProviderInterface>(
528 new ExternalProviderImpl( 507 new ExternalProviderImpl(
529 service, 508 service,
530 new ExternalPrefLoader( 509 new ExternalPrefLoader(
531 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, 510 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS,
532 ExternalPrefLoader::NONE, 511 ExternalPrefLoader::NONE,
533 NULL), 512 NULL),
534 profile, 513 profile,
535 Manifest::EXTERNAL_PREF, 514 Manifest::EXTERNAL_PREF,
536 Manifest::EXTERNAL_PREF_DOWNLOAD, 515 Manifest::EXTERNAL_PREF_DOWNLOAD,
537 bundled_extension_creation_flags))); 516 bundled_extension_creation_flags)));
538 } 517 }
539 #endif 518 #endif
540 519
541 if (!profile->IsSupervised() && !is_chromeos_demo_session) { 520 if (!profile->IsSupervised()) {
542 #if defined(OS_WIN) 521 #if defined(OS_WIN)
543 provider_list->push_back( 522 provider_list->push_back(
544 linked_ptr<ExternalProviderInterface>( 523 linked_ptr<ExternalProviderInterface>(
545 new ExternalProviderImpl( 524 new ExternalProviderImpl(
546 service, 525 service,
547 new ExternalRegistryLoader, 526 new ExternalRegistryLoader,
548 profile, 527 profile,
549 Manifest::EXTERNAL_REGISTRY, 528 Manifest::EXTERNAL_REGISTRY,
550 Manifest::EXTERNAL_PREF_DOWNLOAD, 529 Manifest::EXTERNAL_PREF_DOWNLOAD,
551 Extension::NO_FLAGS))); 530 Extension::NO_FLAGS)));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 service, 580 service,
602 new ExternalComponentLoader(profile), 581 new ExternalComponentLoader(profile),
603 profile, 582 profile,
604 Manifest::INVALID_LOCATION, 583 Manifest::INVALID_LOCATION,
605 Manifest::EXTERNAL_COMPONENT, 584 Manifest::EXTERNAL_COMPONENT,
606 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); 585 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)));
607 } 586 }
608 } 587 }
609 588
610 } // namespace extensions 589 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698