Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: content/browser/webui/web_ui_url_loader_factory.cc

Issue 2870203002: Implement chrome://view-http-cache with network service. (Closed)
Patch Set: rebase and add test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/webui/web_ui_url_loader_factory.cc
diff --git a/content/browser/webui/web_ui_url_loader_factory.cc b/content/browser/webui/web_ui_url_loader_factory.cc
index a6ba11d35876de3c0d4e0d1f947eda9eedc03bac..25e164cfc32bab20cffb2d8d5d062e4169c5b0e4 100644
--- a/content/browser/webui/web_ui_url_loader_factory.cc
+++ b/content/browser/webui/web_ui_url_loader_factory.cc
@@ -19,12 +19,16 @@
#include "content/browser/resource_context_impl.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/browser/webui/url_data_source_impl.h"
+#include "content/common/network_service.mojom.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/service_manager_connection.h"
+#include "content/public/common/service_names.mojom.h"
#include "content/public/common/url_constants.h"
#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/cpp/connector.h"
#include "third_party/zlib/google/compression_utils.h"
#include "ui/base/template_expressions.h"
@@ -240,7 +244,13 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory,
const ResourceRequest& request,
mojom::URLLoaderClientPtr client) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (request.url.host_piece() == kChromeUIBlobInternalsHost) {
+ if (request.url.host_piece() == kChromeUINetworkViewCacheHost) {
+ mojom::NetworkServicePtr network_service;
+ ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
+ mojom::kNetworkServiceName, &network_service);
+ network_service->HandleViewCacheRequest(request, std::move(client));
+ return;
+ } else if (request.url.host_piece() == kChromeUIBlobInternalsHost) {
mmenke 2017/05/10 18:52:30 optional nit: I think the preferred style is not
jam 2017/05/10 22:02:53 Done.
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(

Powered by Google App Engine
This is Rietveld 408576698