blob: ca6782be333271e659ff6fc1a497f6a92d231303 [file] [log] [blame]
// Copyright (c) 2012 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 <string>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "net/url_request/url_request_simple_job.h"
#include "storage/browser/storage_browser_export.h"
namespace net {
class URLRequest;
} // namespace net
namespace storage {
class InternalBlobData;
class BlobStorageContext;
// A job subclass that implements a protocol to inspect the internal
// state of blob registry.
class STORAGE_EXPORT ViewBlobInternalsJob
: public net::URLRequestSimpleJob {
ViewBlobInternalsJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
BlobStorageContext* blob_storage_context);
void Start() override;
int GetData(std::string* mime_type,
std::string* charset,
std::string* data,
const net::CompletionCallback& callback) const override;
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
void Kill() override;
~ViewBlobInternalsJob() override;
void GenerateHTML(std::string* out) const;
static void GenerateHTMLForBlobData(const InternalBlobData& blob_data,
const std::string& content_type,
const std::string& content_disposition,
int refcount,
std::string* out);
BlobStorageContext* blob_storage_context_;
base::WeakPtrFactory<ViewBlobInternalsJob> weak_factory_;
} // namespace storage