summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-27 01:36:43 +0000
committerkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-27 01:36:43 +0000
commit042ecea347c6984c3263671f45ebec79e9fbb26f (patch)
treebfedface274ededad945b9c7d7871a19941d56ee /chrome/browser
parent43929df205159d29c8e968e93c8572b05c92de17 (diff)
downloadchromium_src-042ecea347c6984c3263671f45ebec79e9fbb26f.zip
chromium_src-042ecea347c6984c3263671f45ebec79e9fbb26f.tar.gz
chromium_src-042ecea347c6984c3263671f45ebec79e9fbb26f.tar.bz2
A basic implementation of information about appcache. Lists manifest files, time and size information.
BUG=38463 TEST=Run chrome, navigate to about:appcache-internals. Review URL: http://codereview.chromium.org/1109009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/appcache/view_appcache_internals_job_factory.cc28
-rw-r--r--chrome/browser/appcache/view_appcache_internals_job_factory.h19
-rw-r--r--chrome/browser/browser_about_handler.cc6
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc6
4 files changed, 58 insertions, 1 deletions
diff --git a/chrome/browser/appcache/view_appcache_internals_job_factory.cc b/chrome/browser/appcache/view_appcache_internals_job_factory.cc
new file mode 100644
index 0000000..3f908af
--- /dev/null
+++ b/chrome/browser/appcache/view_appcache_internals_job_factory.cc
@@ -0,0 +1,28 @@
+// 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 "chrome/browser/appcache/view_appcache_internals_job_factory.h"
+
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/common/url_constants.h"
+#include "webkit/appcache/appcache_service.h"
+#include "webkit/appcache/view_appcache_internals_job.h"
+
+// static.
+bool ViewAppCacheInternalsJobFactory::IsSupportedURL(const GURL& url) {
+ return StartsWithASCII(url.spec(),
+ chrome::kAppCacheViewInternalsURL,
+ true /*case_sensitive*/);
+}
+
+// static.
+URLRequestJob* ViewAppCacheInternalsJobFactory::CreateJobForRequest(
+ URLRequest* request) {
+ URLRequestContext* context = request->context();
+ ChromeURLRequestContext* chrome_request_context =
+ reinterpret_cast<ChromeURLRequestContext*>(context);
+ return new appcache::ViewAppCacheInternalsJob(
+ request, chrome_request_context->appcache_service());
+}
+
diff --git a/chrome/browser/appcache/view_appcache_internals_job_factory.h b/chrome/browser/appcache/view_appcache_internals_job_factory.h
new file mode 100644
index 0000000..50ee303
--- /dev/null
+++ b/chrome/browser/appcache/view_appcache_internals_job_factory.h
@@ -0,0 +1,19 @@
+// 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.
+
+#ifndef CHROME_BROWSER_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_FACTORY_H_
+#define CHROME_BROWSER_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_FACTORY_H_
+
+class GURL;
+class URLRequest;
+class URLRequestJob;
+
+class ViewAppCacheInternalsJobFactory {
+ public:
+ static bool IsSupportedURL(const GURL& url);
+ static URLRequestJob* CreateJobForRequest(URLRequest* request);
+};
+
+#endif // CHROME_BROWSER_APPCACHE_VIEW_APPCACHE_INTERNALS_JOB_FACTORY_H_
+
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 91be7c2..04955ec 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -895,6 +895,12 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) {
return true;
}
+ // Rewrite about:appcache-internals/* URLs to chrome://appcache/*
+ if (StartsWithAboutSpecifier(*url, chrome::kAboutAppCacheInternalsURL)) {
+ *url = RemapAboutURL(chrome::kAppCacheViewInternalsURL, *url);
+ return true;
+ }
+
// Rewrite about:plugins to chrome://plugins/.
if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutPluginsURL)) {
*url = GURL(chrome::kChromeUIPluginsURL);
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index 46a26f4..73594d4 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -16,6 +16,7 @@
#if defined(OS_WIN)
#include "base/win_util.h"
#endif
+#include "chrome/browser/appcache/view_appcache_internals_job_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/chrome_url_request_context.h"
@@ -31,7 +32,6 @@
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_job.h"
-
// URLRequestChromeJob is a URLRequestJob that manages running chrome-internal
// resource requests asynchronously.
// It hands off URL requests to ChromeURLDataManager, which asynchronously
@@ -314,6 +314,10 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
if (ViewNetInternalsJobFactory::IsSupportedURL(request->url()))
return ViewNetInternalsJobFactory::CreateJobForRequest(request);
+ // Next check for chrome://appcache-internals/, which uses its own job type.
+ if (ViewAppCacheInternalsJobFactory::IsSupportedURL(request->url()))
+ return ViewAppCacheInternalsJobFactory::CreateJobForRequest(request);
+
// Fall back to using a custom handler
return new URLRequestChromeJob(request);
}