-scoped_refptr<ApplicationData> LoadApplication(
- const base::FilePath& application_path,
- Manifest::SourceType source_type,
- std::string* error) {
- return LoadApplication(application_path, std::string(),
- source_type, error);
-}
-
-scoped_refptr<ApplicationData> LoadApplication(
- const base::FilePath& application_path,
- const std::string& application_id,
- Manifest::SourceType source_type,
- std::string* error) {
- scoped_ptr<base::DictionaryValue> manifest(
- LoadManifest(application_path, error));
- if (!manifest.get())
- return NULL;
-
- scoped_refptr<ApplicationData> application = ApplicationData::Create(
- application_path,
- source_type,
- *manifest,
- application_id,
- error);
- if (!application.get())
- return NULL;
-
- std::vector<InstallWarning> warnings;
- ManifestHandlerRegistry* registry =
- manifest->HasKey(widget_keys::kWidgetKey)
- ? ManifestHandlerRegistry::GetInstance(Manifest::TYPE_WGT)
- : ManifestHandlerRegistry::GetInstance(Manifest::TYPE_XPK);
-
- if (!registry->ValidateAppManifest(application, error, &warnings))
- return NULL;
-
- if (!warnings.empty()) {
- LOG(WARNING) << "There are some warnings when validating the application "
- << application->ID();
- }