2015-11-10 21:18:16 +01:00
|
|
|
// Copyright 2015 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 "libcef/browser/permissions/permission_util.h"
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
|
|
|
|
|
|
|
using content::PermissionType;
|
|
|
|
|
|
|
|
namespace permission_util {
|
|
|
|
|
|
|
|
ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
|
|
|
switch (permission) {
|
|
|
|
case PermissionType::MIDI_SYSEX:
|
|
|
|
return CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
|
|
|
|
case PermissionType::PUSH_MESSAGING:
|
|
|
|
case PermissionType::NOTIFICATIONS:
|
|
|
|
return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
|
|
|
|
case PermissionType::GEOLOCATION:
|
|
|
|
return CONTENT_SETTINGS_TYPE_GEOLOCATION;
|
|
|
|
case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
|
|
|
|
#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
|
|
|
return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER;
|
|
|
|
#else
|
|
|
|
NOTIMPLEMENTED();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case PermissionType::DURABLE_STORAGE:
|
|
|
|
return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE;
|
|
|
|
case PermissionType::MIDI:
|
|
|
|
// This will hit the NOTREACHED below.
|
|
|
|
break;
|
|
|
|
case PermissionType::AUDIO_CAPTURE:
|
|
|
|
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
|
|
|
|
case PermissionType::VIDEO_CAPTURE:
|
|
|
|
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
|
2016-03-16 03:55:59 +01:00
|
|
|
case PermissionType::BACKGROUND_SYNC:
|
|
|
|
return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC;
|
2016-10-21 21:52:29 +02:00
|
|
|
case PermissionType::FLASH:
|
|
|
|
return CONTENT_SETTINGS_TYPE_PLUGINS;
|
2015-11-10 21:18:16 +01:00
|
|
|
case PermissionType::NUM:
|
|
|
|
// This will hit the NOTREACHED below.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
NOTREACHED() << "Unknown content setting for permission "
|
|
|
|
<< static_cast<int>(permission);
|
|
|
|
return CONTENT_SETTINGS_TYPE_DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace permission_util
|