| 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 <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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 Manifest::Location crx_location, | 73 Manifest::Location crx_location, |
| 74 Manifest::Location download_location, | 74 Manifest::Location download_location, |
| 75 int creation_flags) | 75 int creation_flags) |
| 76 : crx_location_(crx_location), | 76 : crx_location_(crx_location), |
| 77 download_location_(download_location), | 77 download_location_(download_location), |
| 78 service_(service), | 78 service_(service), |
| 79 ready_(false), | 79 ready_(false), |
| 80 loader_(loader), | 80 loader_(loader), |
| 81 profile_(profile), | 81 profile_(profile), |
| 82 creation_flags_(creation_flags), | 82 creation_flags_(creation_flags), |
| 83 auto_acknowledge_(false) { | 83 auto_acknowledge_(false), |
| 84 install_immediately_(false) { |
| 84 loader_->Init(this); | 85 loader_->Init(this); |
| 85 } | 86 } |
| 86 | 87 |
| 87 ExternalProviderImpl::~ExternalProviderImpl() { | 88 ExternalProviderImpl::~ExternalProviderImpl() { |
| 88 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 89 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 89 loader_->OwnerShutdown(); | 90 loader_->OwnerShutdown(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void ExternalProviderImpl::VisitRegisteredExtension() { | 93 void ExternalProviderImpl::VisitRegisteredExtension() { |
| 93 // The loader will call back to SetPrefs. | 94 // The loader will call back to SetPrefs. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 Version version(external_version); | 266 Version version(external_version); |
| 266 if (!version.IsValid()) { | 267 if (!version.IsValid()) { |
| 267 LOG(WARNING) << "Malformed extension dictionary for extension: " | 268 LOG(WARNING) << "Malformed extension dictionary for extension: " |
| 268 << extension_id.c_str() << ". Invalid version string \"" | 269 << extension_id.c_str() << ". Invalid version string \"" |
| 269 << external_version << "\"."; | 270 << external_version << "\"."; |
| 270 continue; | 271 continue; |
| 271 } | 272 } |
| 272 service_->OnExternalExtensionFileFound(extension_id, &version, path, | 273 service_->OnExternalExtensionFileFound(extension_id, &version, path, |
| 273 crx_location_, creation_flags, | 274 crx_location_, creation_flags, |
| 274 auto_acknowledge_); | 275 auto_acknowledge_, |
| 276 install_immediately_); |
| 275 } else { // if (has_external_update_url) | 277 } else { // if (has_external_update_url) |
| 276 CHECK(has_external_update_url); // Checking of keys above ensures this. | 278 CHECK(has_external_update_url); // Checking of keys above ensures this. |
| 277 if (download_location_ == Manifest::INVALID_LOCATION) { | 279 if (download_location_ == Manifest::INVALID_LOCATION) { |
| 278 LOG(WARNING) << "This provider does not support installing external " | 280 LOG(WARNING) << "This provider does not support installing external " |
| 279 << "extensions from update URLs."; | 281 << "extensions from update URLs."; |
| 280 continue; | 282 continue; |
| 281 } | 283 } |
| 282 GURL update_url(external_update_url); | 284 GURL update_url(external_update_url); |
| 283 if (!update_url.is_valid()) { | 285 if (!update_url.is_valid()) { |
| 284 LOG(WARNING) << "Malformed extension dictionary for extension: " | 286 LOG(WARNING) << "Malformed extension dictionary for extension: " |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 Extension::NO_FLAGS))); | 418 Extension::NO_FLAGS))); |
| 417 } | 419 } |
| 418 | 420 |
| 419 // Load the KioskAppExternalProvider when running in kiosk mode. | 421 // Load the KioskAppExternalProvider when running in kiosk mode. |
| 420 if (chrome::IsRunningInForcedAppMode()) { | 422 if (chrome::IsRunningInForcedAppMode()) { |
| 421 #if defined(OS_CHROMEOS) | 423 #if defined(OS_CHROMEOS) |
| 422 chromeos::KioskAppManager* kiosk_app_manager = | 424 chromeos::KioskAppManager* kiosk_app_manager = |
| 423 chromeos::KioskAppManager::Get(); | 425 chromeos::KioskAppManager::Get(); |
| 424 DCHECK(kiosk_app_manager); | 426 DCHECK(kiosk_app_manager); |
| 425 if (kiosk_app_manager && !kiosk_app_manager->external_loader_created()) { | 427 if (kiosk_app_manager && !kiosk_app_manager->external_loader_created()) { |
| 426 provider_list->push_back(linked_ptr<ExternalProviderInterface>( | 428 scoped_ptr<ExternalProviderImpl> kiosk_app_provider( |
| 427 new ExternalProviderImpl(service, | 429 new ExternalProviderImpl( |
| 428 kiosk_app_manager->CreateExternalLoader(), | 430 service, kiosk_app_manager->CreateExternalLoader(), profile, |
| 429 profile, | 431 Manifest::EXTERNAL_PREF, Manifest::INVALID_LOCATION, |
| 430 Manifest::EXTERNAL_PREF, | 432 Extension::NO_FLAGS)); |
| 431 Manifest::INVALID_LOCATION, | 433 kiosk_app_provider->set_auto_acknowledge(true); |
| 432 Extension::NO_FLAGS))); | 434 kiosk_app_provider->set_install_immediately(true); |
| 435 provider_list->push_back( |
| 436 linked_ptr<ExternalProviderInterface>(kiosk_app_provider.release())); |
| 433 } | 437 } |
| 434 #endif | 438 #endif |
| 435 return; | 439 return; |
| 436 } | 440 } |
| 437 | 441 |
| 438 // Extensions provided by recommended policies. | 442 // Extensions provided by recommended policies. |
| 439 if (external_recommended_loader.get()) { | 443 if (external_recommended_loader.get()) { |
| 440 provider_list->push_back(linked_ptr<ExternalProviderInterface>( | 444 provider_list->push_back(linked_ptr<ExternalProviderInterface>( |
| 441 new ExternalProviderImpl(service, | 445 new ExternalProviderImpl(service, |
| 442 external_recommended_loader, | 446 external_recommended_loader, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 service, | 581 service, |
| 578 new ExternalComponentLoader(profile), | 582 new ExternalComponentLoader(profile), |
| 579 profile, | 583 profile, |
| 580 Manifest::INVALID_LOCATION, | 584 Manifest::INVALID_LOCATION, |
| 581 Manifest::EXTERNAL_COMPONENT, | 585 Manifest::EXTERNAL_COMPONENT, |
| 582 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 586 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 583 } | 587 } |
| 584 } | 588 } |
| 585 | 589 |
| 586 } // namespace extensions | 590 } // namespace extensions |
| OLD | NEW |