Commit 83931b97 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[vr] Add compatibility to component 1.y, check integrity of WAV files

Bug: 811987
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I5c33b4210727b62357e0706c7b19800b98bdebc4
Reviewed-on: https://chromium-review.googlesource.com/956251Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542128}
parent c06388a9
...@@ -96,7 +96,7 @@ bool VrAssetsComponentInstallerPolicy::VerifyInstallation( ...@@ -96,7 +96,7 @@ bool VrAssetsComponentInstallerPolicy::VerifyInstallation(
return false; return false;
} }
if (version.components()[0] > vr::kCompatibleMajorVrAssetsComponentVersion) { if (version.components()[0] > vr::kTargetMajorVrAssetsComponentVersion) {
// Component needs to be downgraded. Differential downgrades are not // Component needs to be downgraded. Differential downgrades are not
// supported. Just delete this component version. // supported. Just delete this component version.
vr::AssetsLoader::GetInstance()->GetMetricsHelper()->OnComponentUpdated( vr::AssetsLoader::GetInstance()->GetMetricsHelper()->OnComponentUpdated(
...@@ -111,7 +111,7 @@ void VrAssetsComponentInstallerPolicy::ComponentReady( ...@@ -111,7 +111,7 @@ void VrAssetsComponentInstallerPolicy::ComponentReady(
const base::Version& version, const base::Version& version,
const base::FilePath& install_dir, const base::FilePath& install_dir,
std::unique_ptr<base::DictionaryValue> manifest) { std::unique_ptr<base::DictionaryValue> manifest) {
if (version.components()[0] != vr::kCompatibleMajorVrAssetsComponentVersion) { if (version.components()[0] < vr::kMinMajorVrAssetsComponentVersion) {
// Don't propagate component readiness and wait until differential update // Don't propagate component readiness and wait until differential update
// delivers compatible component version. // delivers compatible component version.
vr::AssetsLoader::GetInstance()->GetMetricsHelper()->OnComponentUpdated( vr::AssetsLoader::GetInstance()->GetMetricsHelper()->OnComponentUpdated(
...@@ -139,7 +139,7 @@ std::string VrAssetsComponentInstallerPolicy::GetName() const { ...@@ -139,7 +139,7 @@ std::string VrAssetsComponentInstallerPolicy::GetName() const {
update_client::InstallerAttributes update_client::InstallerAttributes
VrAssetsComponentInstallerPolicy::GetInstallerAttributes() const { VrAssetsComponentInstallerPolicy::GetInstallerAttributes() const {
return {{"compatible_major_version", return {{"compatible_major_version",
std::to_string(vr::kCompatibleMajorVrAssetsComponentVersion)}}; std::to_string(vr::kTargetMajorVrAssetsComponentVersion)}};
} }
std::vector<std::string> VrAssetsComponentInstallerPolicy::GetMimeTypes() std::vector<std::string> VrAssetsComponentInstallerPolicy::GetMimeTypes()
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "chrome/browser/vr/model/assets.h" #include "chrome/browser/vr/model/assets.h"
#include "chrome/browser/vr/vr_features.h" #include "chrome/browser/vr/vr_features.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "media/audio/sounds/wav_audio_handler.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
...@@ -168,6 +169,10 @@ AssetsLoadStatus LoadSound(const base::FilePath& component_install_dir, ...@@ -168,6 +169,10 @@ AssetsLoadStatus LoadSound(const base::FilePath& component_install_dir,
return AssetsLoadStatus::kParseFailure; return AssetsLoadStatus::kParseFailure;
} }
if (!media::WavAudioHandler::Create(*buffer)) {
return AssetsLoadStatus::kInvalidContent;
}
*out_buffer = std::move(buffer); *out_buffer = std::move(buffer);
return AssetsLoadStatus::kSuccess; return AssetsLoadStatus::kSuccess;
} }
......
...@@ -22,7 +22,11 @@ class Version; ...@@ -22,7 +22,11 @@ class Version;
namespace vr { namespace vr {
constexpr uint32_t kCompatibleMajorVrAssetsComponentVersion = 2; // Major component version we need to support all features.
constexpr uint32_t kTargetMajorVrAssetsComponentVersion = 2;
// Minimum major component version we are able to use with potentially reduced
// set of features.
constexpr uint32_t kMinMajorVrAssetsComponentVersion = 1;
class MetricsHelper; class MetricsHelper;
struct AssetsLoaderSingletonTrait; struct AssetsLoaderSingletonTrait;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment