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

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

Issue 2149953002: Enable login screen apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Devlin and Maksim feedback Created 3 years, 9 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/extensions/external_provider_impl.h" 5 #include "chrome/browser/extensions/external_provider_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 service_->OnExternalExtensionUpdateUrlFound(*extension, true); 133 service_->OnExternalExtensionUpdateUrlFound(*extension, true);
134 134
135 for (const auto& extension : external_file_extensions) 135 for (const auto& extension : external_file_extensions)
136 service_->OnExternalExtensionFileFound(*extension); 136 service_->OnExternalExtensionFileFound(*extension);
137 137
138 service_->OnExternalProviderReady(this); 138 service_->OnExternalProviderReady(this);
139 } 139 }
140 140
141 void ExternalProviderImpl::UpdatePrefs(base::DictionaryValue* prefs) { 141 void ExternalProviderImpl::UpdatePrefs(base::DictionaryValue* prefs) {
142 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 142 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
143 // We only expect updates from windows registry. 143 // We only expect updates from windows registry or via policies on chromeos.
144 CHECK(crx_location_ == Manifest::EXTERNAL_REGISTRY); 144 CHECK(crx_location_ == Manifest::EXTERNAL_REGISTRY ||
145 download_location_ == Manifest::EXTERNAL_POLICY_DOWNLOAD);
145 146
146 // Check if the service is still alive. It is possible that it went 147 // Check if the service is still alive. It is possible that it went
147 // away while |loader_| was working on the FILE thread. 148 // away while |loader_| was working on the FILE thread.
148 if (!service_) 149 if (!service_)
149 return; 150 return;
150 151
151 std::set<std::string> removed_extensions; 152 std::set<std::string> removed_extensions;
152 // Find extensions that were removed by this ExternalProvider. 153 // Find extensions that were removed by this ExternalProvider.
153 for (base::DictionaryValue::Iterator i(*prefs_); !i.IsAtEnd(); i.Advance()) { 154 for (base::DictionaryValue::Iterator i(*prefs_); !i.IsAtEnd(); i.Advance()) {
154 const std::string& extension_id = i.key(); 155 const std::string& extension_id = i.key();
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // static 491 // static
491 void ExternalProviderImpl::CreateExternalProviders( 492 void ExternalProviderImpl::CreateExternalProviders(
492 VisitorInterface* service, 493 VisitorInterface* service,
493 Profile* profile, 494 Profile* profile,
494 ProviderCollection* provider_list) { 495 ProviderCollection* provider_list) {
495 TRACE_EVENT0("browser,startup", 496 TRACE_EVENT0("browser,startup",
496 "ExternalProviderImpl::CreateExternalProviders"); 497 "ExternalProviderImpl::CreateExternalProviders");
497 scoped_refptr<ExternalLoader> external_loader; 498 scoped_refptr<ExternalLoader> external_loader;
498 scoped_refptr<ExternalLoader> external_recommended_loader; 499 scoped_refptr<ExternalLoader> external_recommended_loader;
499 extensions::Manifest::Location crx_location = Manifest::INVALID_LOCATION; 500 extensions::Manifest::Location crx_location = Manifest::INVALID_LOCATION;
501
500 #if defined(OS_CHROMEOS) 502 #if defined(OS_CHROMEOS)
503 if (chromeos::ProfileHelper::IsSigninProfile(profile)) {
504 // Download apps installed by policy in the login profile.
505 external_loader = new ExternalPolicyLoader(
506 ExtensionManagementFactory::GetForBrowserContext(profile),
507 ExternalPolicyLoader::FORCED);
508 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>(
509 service, external_loader, profile, crx_location,
510 Manifest::EXTERNAL_POLICY_DOWNLOAD,
511 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT));
Devlin 2017/03/17 16:37:23 We should add a comment explaining why these flags
achuithb 2017/03/22 00:15:53 Done.
512 return;
513 }
514
501 policy::BrowserPolicyConnectorChromeOS* connector = 515 policy::BrowserPolicyConnectorChromeOS* connector =
502 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 516 g_browser_process->platform_part()->browser_policy_connector_chromeos();
503 bool is_chrome_os_public_session = false; 517 bool is_chrome_os_public_session = false;
504 const user_manager::User* user = 518 const user_manager::User* user =
505 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 519 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
506 policy::DeviceLocalAccount::Type account_type; 520 policy::DeviceLocalAccount::Type account_type;
507 if (user && connector->IsEnterpriseManaged() && 521 if (user && connector->IsEnterpriseManaged() &&
508 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(), 522 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(),
509 &account_type)) { 523 &account_type)) {
510 if (account_type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) 524 if (account_type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION)
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 provider_list->push_back(std::move(drive_migration_provider)); 709 provider_list->push_back(std::move(drive_migration_provider));
696 } 710 }
697 711
698 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>( 712 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>(
699 service, new ExternalComponentLoader(profile), profile, 713 service, new ExternalComponentLoader(profile), profile,
700 Manifest::INVALID_LOCATION, Manifest::EXTERNAL_COMPONENT, 714 Manifest::INVALID_LOCATION, Manifest::EXTERNAL_COMPONENT,
701 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)); 715 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT));
702 } 716 }
703 717
704 } // namespace extensions 718 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698