blob: fee0801083d1f002ceb4c8f80adcadaaf0f24cb1 [file] [log] [blame]
// Copyright (c) 2010 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 "net/url_request/url_request_simple_job.h"
#include "webkit/appcache/appcache_service.h"
class URLRequest;
namespace appcache {
// A job subclass that implements a protocol to inspect the internal
// state of appcache service.
class ViewAppCacheInternalsJob : public URLRequestSimpleJob {
// Stores handle to appcache service for getting information.
ViewAppCacheInternalsJob(URLRequest* request, AppCacheService* service);
// Fetches the AppCache Info and calls StartAsync after it is done.
virtual void Start();
virtual bool GetData(std::string* mime_type,
std::string* charset,
std::string* data) const;
// Overridden method from URLRequestJob.
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
void AppCacheDone(int rv);
// Adds HTML from appcache information to out.
void GenerateHTMLAppCacheInfo(std::string* out) const;
void GetAppCacheInfoAsync();
void RemoveAppCacheInfoAsync(const std::string& manifest_url_spec);
// This is a common callback for both remove and getinfo for appcache.
scoped_refptr<net::CancelableCompletionCallback<ViewAppCacheInternalsJob> >
scoped_refptr<AppCacheInfoCollection> info_collection_;
// Not owned.
AppCacheService* appcache_service_;
} // namespace appcache