#include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/install_warning.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/url_pattern.h"
#include "url/url_constants.h"
keys;
errors;
namespace {
const char kReadAccessString[] = …;
const char kReadWriteAccessString[] = …;
const char kCreateAccessString[] = …;
unsigned int kPermissionsNotDefined = …;
unsigned int kReadPermission = …;
unsigned int kWritePermission = …;
unsigned int kCreatePermission = …;
unsigned int kInvalidPermission = …;
unsigned int GetAccessPermissionFlagFromString(const std::string& access_str) { … }
struct FileBrowserHandlerInfo : public extensions::Extension::ManifestData { … };
FileBrowserHandlerInfo::FileBrowserHandlerInfo() = default;
FileBrowserHandlerInfo::~FileBrowserHandlerInfo() = default;
}
FileBrowserHandler::FileBrowserHandler()
: … { … }
FileBrowserHandler::~FileBrowserHandler() = default;
void FileBrowserHandler::AddPattern(const URLPattern& pattern) { … }
void FileBrowserHandler::ClearPatterns() { … }
bool FileBrowserHandler::MatchesURL(const GURL& url) const { … }
bool FileBrowserHandler::AddFileAccessPermission(
const std::string& access) { … }
bool FileBrowserHandler::ValidateFileAccessPermissions() { … }
bool FileBrowserHandler::CanRead() const { … }
bool FileBrowserHandler::CanWrite() const { … }
bool FileBrowserHandler::HasCreateAccessPermission() const { … }
FileBrowserHandler::List*
FileBrowserHandler::GetHandlers(const extensions::Extension* extension) { … }
const FileBrowserHandler* FileBrowserHandler::FindForActionId(
const extensions::Extension* extension,
const std::string& action_id) { … }
FileBrowserHandlerParser::FileBrowserHandlerParser() = default;
FileBrowserHandlerParser::~FileBrowserHandlerParser() = default;
namespace {
std::unique_ptr<FileBrowserHandler> LoadFileBrowserHandler(
const std::string& extension_id,
const base::Value::Dict* file_browser_handler,
std::u16string* error) { … }
bool LoadFileBrowserHandlers(const std::string& extension_id,
const base::Value::List& extension_actions,
FileBrowserHandler::List* result,
std::u16string* error) { … }
}
bool FileBrowserHandlerParser::Parse(extensions::Extension* extension,
std::u16string* error) { … }
base::span<const char* const> FileBrowserHandlerParser::Keys() const { … }