blob: 917d12a59f9dffd73fa386db817b61f6a3fe0e97 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/url_loader_factory_bundle_struct_traits.h"
namespace mojo {
using Traits = StructTraits<content::mojom::URLLoaderFactoryBundleDataView,
content::URLLoaderFactoryBundle>;
// static
content::mojom::URLLoaderFactoryPtr Traits::default_factory(
content::URLLoaderFactoryBundle& bundle) {
return std::move(bundle.default_factory_);
}
// static
std::map<std::string, content::mojom::URLLoaderFactoryPtr> Traits::factories(
content::URLLoaderFactoryBundle& bundle) {
return std::move(bundle.factories_);
}
// static
bool Traits::Read(content::mojom::URLLoaderFactoryBundleDataView data,
content::URLLoaderFactoryBundle* out_bundle) {
out_bundle->SetDefaultFactory(
data.TakeDefaultFactory<content::mojom::URLLoaderFactoryPtr>());
if (!data.ReadFactories(&out_bundle->factories_))
return false;
return true;
}
} // namespace mojo