#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "chrome/browser/extensions/install_tracker_factory.h"
#include "chrome/browser/extensions/install_verifier.h"
#include "chrome/browser/extensions/shared_module_service.h"
-#include "chrome/browser/omaha_query_params/omaha_query_params.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension_constants.h"
+#include "components/crx_file/id_util.h"
+#include "components/omaha_query_params/omaha_query_params.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_save_info.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/shared_module_info.h"
#include "net/base/escape.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#endif
-using chrome::OmahaQueryParams;
using content::BrowserContext;
using content::BrowserThread;
using content::DownloadItem;
std::string url_string = extension_urls::GetWebstoreUpdateUrl().spec();
GURL url(url_string + "?response=redirect&" +
- OmahaQueryParams::Get(OmahaQueryParams::CRX) + "&x=" +
- net::EscapeQueryParamValue(JoinString(params, '&'), true));
+ omaha_query_params::OmahaQueryParams::Get(
+ omaha_query_params::OmahaQueryParams::CRX) +
+ "&x=" + net::EscapeQueryParamValue(JoinString(params, '&'), true));
DCHECK(url.is_valid());
return url;
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(web_contents);
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR,
content::Source<CrxInstaller>(NULL));
extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
}
DCHECK_CURRENTLY_ON(BrowserThread::UI);
AddRef(); // Balanced in ReportSuccess and ReportFailure.
- if (!Extension::IdIsValid(id_)) {
+ if (!crx_file::id_util::IdIsValid(id_)) {
ReportFailure(kInvalidIdError, FAILURE_REASON_OTHER);
return;
}
ExtensionService* extension_service =
ExtensionSystem::Get(profile_)->extension_service();
- if (approval_.get() && approval_->dummy_extension) {
- SharedModuleService::ImportStatus status =
- extension_service->shared_module_service()->CheckImports(
- approval_->dummy_extension,
- &pending_modules_,
- &pending_modules_);
- // For this case, it is because some imports are not shared modules.
- if (status == SharedModuleService::IMPORT_STATUS_UNRECOVERABLE) {
- ReportFailure(kDependencyNotSharedModuleError,
- FAILURE_REASON_DEPENDENCY_NOT_SHARED_MODULE);
- return;
- }
+ if (approval_.get() && approval_->dummy_extension.get()) {
+ extension_service->shared_module_service()->CheckImports(
+ approval_->dummy_extension.get(), &pending_modules_, &pending_modules_);
+ // Do not check the return value of CheckImports, the CRX installer
+ // will report appropriate error messages and fail to install if there
+ // is an import error.
}
// Add the extension main module into the list.
NOTREACHED();
}
extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile_);
+ extensions::InstallTrackerFactory::GetForBrowserContext(profile_);
extensions::InstallObserver::ExtensionInstallParams params(
id_,
name,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: {
+ case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: {
CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr();
CHECK(crx_installer);
if (crx_installer != crx_installer_.get())
void WebstoreInstaller::OnExtensionInstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ bool is_update) {
CHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context)));
if (pending_modules_.empty())
return;
if (delegate_)
delegate_->OnExtensionDownloadProgress(id_, download);
extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile_);
+ extensions::InstallTrackerFactory::GetForBrowserContext(profile_);
tracker->OnDownloadProgress(id_, 100);
}
}
if (percent >= 0) {
percent = (percent + (finished_modules * 100)) / total_modules_;
extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile_);
+ extensions::InstallTrackerFactory::GetForBrowserContext(profile_);
tracker->OnDownloadProgress(id_, percent);
}
}
extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile_);
+ extensions::InstallTrackerFactory::GetForBrowserContext(profile_);
tracker->OnInstallFailure(id_);
Release(); // Balanced in Start().