#include "third_party/blink/renderer/modules/content_index/content_index.h"
#include <optional>
#include "base/feature_list.h"
#include "base/task/sequenced_task_runner.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_content_icon_definition.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/content_index/content_description_type_converter.h"
#include "third_party/blink/renderer/modules/content_index/content_index_icon_loader.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
namespace features {
BASE_FEATURE(…);
}
namespace blink {
namespace {
WTF::String ValidateDescription(const ContentDescription& description,
ServiceWorkerRegistration* registration) { … }
}
ContentIndex::ContentIndex(ServiceWorkerRegistration* registration,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: … { … }
ContentIndex::~ContentIndex() = default;
ScriptPromise<IDLUndefined> ContentIndex::add(
ScriptState* script_state,
const ContentDescription* description,
ExceptionState& exception_state) { … }
void ContentIndex::DidGetIconSizes(
mojom::blink::ContentDescriptionPtr description,
ScriptPromiseResolver<IDLUndefined>* resolver,
const Vector<gfx::Size>& icon_sizes) { … }
void ContentIndex::DidGetIcons(ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::blink::ContentDescriptionPtr description,
Vector<SkBitmap> icons) { … }
void ContentIndex::DidCheckOfflineCapability(
KURL launch_url,
mojom::blink::ContentDescriptionPtr description,
Vector<SkBitmap> icons,
ScriptPromiseResolver<IDLUndefined>* resolver,
bool is_offline_capable) { … }
void ContentIndex::DidAdd(ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::blink::ContentIndexError error) { … }
ScriptPromise<IDLUndefined> ContentIndex::deleteDescription(
ScriptState* script_state,
const String& id,
ExceptionState& exception_state) { … }
void ContentIndex::DidDeleteDescription(
ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::blink::ContentIndexError error) { … }
ScriptPromise<IDLSequence<ContentDescription>> ContentIndex::getDescriptions(
ScriptState* script_state,
ExceptionState& exception_state) { … }
void ContentIndex::DidGetDescriptions(
ScriptPromiseResolver<IDLSequence<ContentDescription>>* resolver,
mojom::blink::ContentIndexError error,
Vector<mojom::blink::ContentDescriptionPtr> descriptions) { … }
void ContentIndex::Trace(Visitor* visitor) const { … }
mojom::blink::ContentIndexService* ContentIndex::GetService() { … }
}