forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcast_extensions_api_provider.cc
66 lines (52 loc) · 2.41 KB
/
cast_extensions_api_provider.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2018 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 "chromecast/common/cast_extensions_api_provider.h"
#include "chromecast/common/cast_redirect_manifest_handler.h"
#include "chromecast/common/extensions_api/cast_aliases.h"
#include "chromecast/common/extensions_api/cast_api_features.h"
#include "chromecast/common/extensions_api/cast_api_permissions.h"
#include "chromecast/common/extensions_api/cast_manifest_features.h"
#include "chromecast/common/extensions_api/cast_permission_features.h"
#include "chromecast/common/extensions_api/generated_schemas.h"
#include "extensions/common/features/json_feature_provider_source.h"
#include "extensions/common/manifest_handler.h"
#include "extensions/common/manifest_handlers/automation.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/shell/grit/app_shell_resources.h"
namespace extensions {
CastExtensionsAPIProvider::CastExtensionsAPIProvider() {}
CastExtensionsAPIProvider::~CastExtensionsAPIProvider() = default;
void CastExtensionsAPIProvider::AddAPIFeatures(FeatureProvider* provider) {
AddCastAPIFeatures(provider);
}
void CastExtensionsAPIProvider::AddManifestFeatures(FeatureProvider* provider) {
AddCastManifestFeatures(provider);
}
void CastExtensionsAPIProvider::AddPermissionFeatures(
FeatureProvider* provider) {
AddCastPermissionFeatures(provider);
}
void CastExtensionsAPIProvider::AddBehaviorFeatures(FeatureProvider* provider) {
// Note: No cast-specific behavior features.
}
void CastExtensionsAPIProvider::AddAPIJSONSources(
JSONFeatureProviderSource* json_source) {
json_source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES);
}
bool CastExtensionsAPIProvider::IsAPISchemaGenerated(const std::string& name) {
return cast::api::CastGeneratedSchemas::IsGenerated(name);
}
base::StringPiece CastExtensionsAPIProvider::GetAPISchema(
const std::string& name) {
return cast::api::CastGeneratedSchemas::Get(name);
}
void CastExtensionsAPIProvider::AddPermissionsProviders(
PermissionsInfo* permissions_info) {
permissions_info->AddProvider(api_permissions_, GetCastPermissionAliases());
}
void CastExtensionsAPIProvider::RegisterManifestHandlers() {
(new AutomationHandler)->Register(); // TODO(crbug/837773) De-dupe later.
(new chromecast::CastRedirectHandler)->Register();
}
} // namespace extensions