chromium/components/search_provider_logos/logo_cache.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/search_provider_logos/logo_cache.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <string_view>
#include <utility>

#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"

namespace search_provider_logos {

namespace {

// The cached logo metadata is persisted as JSON using these keys.
const char kSourceUrlKey[] =;
const char kExpirationTimeKey[] =;
const char kCanShowAfterExpirationKey[] =;
const char kFingerprintKey[] =;
const char kTypeKey[] =;
const char kOnClickURLKey[] =;
const char kFullPageURLKey[] =;
const char kAltTextKey[] =;
const char kMimeTypeKey[] =;
const char kDarkMimeTypeKey[] =;
const char kNumBytesKey[] =;
const char kDarkNumBytesKey[] =;
const char kAnimatedUrlKey[] =;
const char kDarkAnimatedUrlKey[] =;
const char kLogUrlKey[] =;
const char kDarkLogUrlKey[] =;
const char kCtaLogUrlKey[] =;
const char kDarkCtaLogUrlKey[] =;
const char kShortLinkKey[] =;
const char kWidthPx[] =;
const char kHeightPx[] =;
const char kDarkWidthPx[] =;
const char kDarkHeightPx[] =;
const char kIframeWidthPx[] =;
const char kIframeHeightPx[] =;
const char kDarkBackgroundColorKey[] =;

const char kShareButtonX[] =;
const char kShareButtonY[] =;
const char kShareButtonOpacity[] =;
const char kShareButtonIcon[] =;
const char kShareButtonBg[] =;
const char kDarkShareButtonX[] =;
const char kDarkShareButtonY[] =;
const char kDarkShareButtonOpacity[] =;
const char kDarkShareButtonIcon[] =;
const char kDarkShareButtonBg[] =;

const char kSimpleType[] =;
const char kAnimatedType[] =;
const char kInteractiveType[] =;

bool GetTimeValue(const base::Value::Dict& dict,
                  const std::string& key,
                  base::Time* time) {}

void SetTimeValue(base::Value::Dict& dict,
                  const std::string& key,
                  const base::Time& time) {}

LogoType LogoTypeFromString(std::string_view type) {}

std::string LogoTypeToString(LogoType type) {}

}  // namespace

LogoCache::LogoCache(const base::FilePath& cache_directory)
    :{}

LogoCache::~LogoCache() {}

void LogoCache::UpdateCachedLogoMetadata(const LogoMetadata& metadata) {}

const LogoMetadata* LogoCache::GetCachedLogoMetadata() {}

void LogoCache::SetCachedLogo(const EncodedLogo* logo) {}

std::unique_ptr<EncodedLogo> LogoCache::GetCachedLogo() {}

// static
std::unique_ptr<LogoMetadata> LogoCache::LogoMetadataFromString(
    const std::string& str,
    int* logo_num_bytes,
    int* dark_logo_num_bytes) {}

// static
void LogoCache::LogoMetadataToString(const LogoMetadata& metadata,
                                     int num_bytes,
                                     int dark_num_bytes,
                                     std::string* str) {}

base::FilePath LogoCache::GetLogoPath() {}

base::FilePath LogoCache::GetDarkLogoPath() {}

base::FilePath LogoCache::GetMetadataPath() {}

void LogoCache::UpdateMetadata(std::unique_ptr<LogoMetadata> metadata) {}

void LogoCache::ReadMetadataIfNeeded() {}

void LogoCache::WriteMetadata() {}

void LogoCache::WriteLogo(
    scoped_refptr<base::RefCountedMemory> encoded_image,
    scoped_refptr<base::RefCountedMemory> dark_encoded_image) {}

void LogoCache::DeleteLogoAndMetadata() {}

bool LogoCache::EnsureCacheDirectoryExists() {}

}  // namespace search_provider_logos