OLD | NEW |
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 Loading... |
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 Loading... |
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. Flags |
| 505 // FROM_WEBSTORE/WAS_INSTALLED_BY_DEFAULT are applied because these apps are |
| 506 // downloaded from the webstore, and we want to treat them as built-in |
| 507 // extensions. |
| 508 external_loader = new ExternalPolicyLoader( |
| 509 ExtensionManagementFactory::GetForBrowserContext(profile), |
| 510 ExternalPolicyLoader::FORCED); |
| 511 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>( |
| 512 service, external_loader, profile, crx_location, |
| 513 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
| 514 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)); |
| 515 return; |
| 516 } |
| 517 |
501 policy::BrowserPolicyConnectorChromeOS* connector = | 518 policy::BrowserPolicyConnectorChromeOS* connector = |
502 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 519 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
503 bool is_chrome_os_public_session = false; | 520 bool is_chrome_os_public_session = false; |
504 const user_manager::User* user = | 521 const user_manager::User* user = |
505 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 522 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
506 policy::DeviceLocalAccount::Type account_type; | 523 policy::DeviceLocalAccount::Type account_type; |
507 if (user && connector->IsEnterpriseManaged() && | 524 if (user && connector->IsEnterpriseManaged() && |
508 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(), | 525 policy::IsDeviceLocalAccountUser(user->GetAccountId().GetUserEmail(), |
509 &account_type)) { | 526 &account_type)) { |
510 if (account_type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) | 527 if (account_type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 provider_list->push_back(std::move(drive_migration_provider)); | 712 provider_list->push_back(std::move(drive_migration_provider)); |
696 } | 713 } |
697 | 714 |
698 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>( | 715 provider_list->push_back(base::MakeUnique<ExternalProviderImpl>( |
699 service, new ExternalComponentLoader(profile), profile, | 716 service, new ExternalComponentLoader(profile), profile, |
700 Manifest::INVALID_LOCATION, Manifest::EXTERNAL_COMPONENT, | 717 Manifest::INVALID_LOCATION, Manifest::EXTERNAL_COMPONENT, |
701 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)); | 718 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT)); |
702 } | 719 } |
703 | 720 |
704 } // namespace extensions | 721 } // namespace extensions |
OLD | NEW |