This source file includes following definitions.
- GetPermissionMessages
- GetWarningMessages
- GetWarningMessagesDetails
- IsPrivilegeIncrease
- Initialize
- GetPermissionsProvider
- GetPermissionMessageProvider
- GetFeatureProviderByName
- FilterHostPermissions
- SetScriptingWhitelist
- GetScriptingWhitelist
- GetPermittedChromeSchemeHosts
- IsScriptableURL
- IsAPISchemaGenerated
- GetAPISchema
- AddExtraFeatureFilters
#include "apps/shell/common/shell_extensions_client.h"
#include "apps/common/api/generated_schemas.h"
#include "base/logging.h"
#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
#include "extensions/common/api/generated_schemas.h"
#include "extensions/common/api/sockets/sockets_manifest_handler.h"
#include "extensions/common/common_manifest_handlers.h"
#include "extensions/common/features/base_feature_provider.h"
#include "extensions/common/manifest_handler.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_provider.h"
#include "extensions/common/url_pattern_set.h"
using extensions::APIPermissionInfo;
using extensions::APIPermissionSet;
using extensions::Extension;
using extensions::Manifest;
using extensions::PermissionMessage;
using extensions::PermissionMessages;
using extensions::PermissionSet;
using extensions::URLPatternSet;
namespace apps {
namespace {
class ShellPermissionMessageProvider
: public extensions::PermissionMessageProvider {
public:
ShellPermissionMessageProvider() {}
virtual ~ShellPermissionMessageProvider() {}
virtual PermissionMessages GetPermissionMessages(
const PermissionSet* permissions,
Manifest::Type extension_type) const OVERRIDE {
return PermissionMessages();
}
virtual std::vector<base::string16> GetWarningMessages(
const PermissionSet* permissions,
Manifest::Type extension_type) const OVERRIDE {
return std::vector<base::string16>();
}
virtual std::vector<base::string16> GetWarningMessagesDetails(
const PermissionSet* permissions,
Manifest::Type extension_type) const OVERRIDE {
return std::vector<base::string16>();
}
virtual bool IsPrivilegeIncrease(
const PermissionSet* old_permissions,
const PermissionSet* new_permissions,
Manifest::Type extension_type) const OVERRIDE {
CHECK(false);
return false;
}
private:
DISALLOW_COPY_AND_ASSIGN(ShellPermissionMessageProvider);
};
}
ShellExtensionsClient::ShellExtensionsClient() {
}
ShellExtensionsClient::~ShellExtensionsClient() {
}
void ShellExtensionsClient::Initialize() {
extensions::RegisterCommonManifestHandlers();
(new extensions::SocketsManifestHandler)->Register();
extensions::ManifestHandler::FinalizeRegistration();
}
const extensions::PermissionsProvider&
ShellExtensionsClient::GetPermissionsProvider() const {
static extensions::ChromeAPIPermissions provider;
return provider;
}
const extensions::PermissionMessageProvider&
ShellExtensionsClient::GetPermissionMessageProvider() const {
NOTIMPLEMENTED();
static ShellPermissionMessageProvider provider;
return provider;
}
extensions::FeatureProvider* ShellExtensionsClient::GetFeatureProviderByName(
const std::string& name) const {
return extensions::BaseFeatureProvider::GetByName(name);
}
void ShellExtensionsClient::FilterHostPermissions(
const URLPatternSet& hosts,
URLPatternSet* new_hosts,
std::set<PermissionMessage>* messages) const {
NOTIMPLEMENTED();
}
void ShellExtensionsClient::SetScriptingWhitelist(
const ScriptingWhitelist& whitelist) {
scripting_whitelist_ = whitelist;
}
const extensions::ExtensionsClient::ScriptingWhitelist&
ShellExtensionsClient::GetScriptingWhitelist() const {
return scripting_whitelist_;
}
URLPatternSet ShellExtensionsClient::GetPermittedChromeSchemeHosts(
const Extension* extension,
const APIPermissionSet& api_permissions) const {
NOTIMPLEMENTED();
return URLPatternSet();
}
bool ShellExtensionsClient::IsScriptableURL(const GURL& url,
std::string* error) const {
NOTIMPLEMENTED();
return true;
}
bool ShellExtensionsClient::IsAPISchemaGenerated(
const std::string& name) const {
return extensions::api::GeneratedSchemas::IsGenerated(name) ||
extensions::core_api::GeneratedSchemas::IsGenerated(name) ||
apps::api::GeneratedSchemas::IsGenerated(name);
}
base::StringPiece ShellExtensionsClient::GetAPISchema(
const std::string& name) const {
if (extensions::api::GeneratedSchemas::IsGenerated(name))
return extensions::api::GeneratedSchemas::Get(name);
if (extensions::core_api::GeneratedSchemas::IsGenerated(name))
return extensions::core_api::GeneratedSchemas::Get(name);
return apps::api::GeneratedSchemas::Get(name);
}
void ShellExtensionsClient::AddExtraFeatureFilters(
extensions::SimpleFeature* feature) const {}
}