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

Side by Side Diff: content/browser/webui/web_ui_url_loader_factory.cc

Issue 2874623002: Implement chrome://histograms with network service. (Closed)
Patch Set: add comment 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 unified diff | Download patch
« no previous file with comments | « content/browser/histogram_internals_url_loader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/webui/web_ui_url_loader_factory.h" 5 #include "content/browser/webui/web_ui_url_loader_factory.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "content/browser/blob_storage/blob_internals_url_loader.h" 14 #include "content/browser/blob_storage/blob_internals_url_loader.h"
15 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 15 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
16 #include "content/browser/frame_host/frame_tree_node.h" 16 #include "content/browser/frame_host/frame_tree_node.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/browser/histogram_internals_url_loader.h"
18 #include "content/browser/resource_context_impl.h" 19 #include "content/browser/resource_context_impl.h"
19 #include "content/browser/webui/url_data_manager_backend.h" 20 #include "content/browser/webui/url_data_manager_backend.h"
20 #include "content/browser/webui/url_data_source_impl.h" 21 #include "content/browser/webui/url_data_source_impl.h"
21 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/url_constants.h" 26 #include "content/public/common/url_constants.h"
26 #include "mojo/public/cpp/bindings/binding_set.h" 27 #include "mojo/public/cpp/bindings/binding_set.h"
27 #include "third_party/zlib/google/compression_utils.h" 28 #include "third_party/zlib/google/compression_utils.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 mojom::URLLoaderClientPtr client) override { 241 mojom::URLLoaderClientPtr client) override {
241 DCHECK_CURRENTLY_ON(BrowserThread::UI); 242 DCHECK_CURRENTLY_ON(BrowserThread::UI);
242 if (request.url.host_piece() == kChromeUIBlobInternalsHost) { 243 if (request.url.host_piece() == kChromeUIBlobInternalsHost) {
243 BrowserThread::PostTask( 244 BrowserThread::PostTask(
244 BrowserThread::IO, FROM_HERE, 245 BrowserThread::IO, FROM_HERE,
245 base::BindOnce( 246 base::BindOnce(
246 &StartBlobInternalsURLLoader, request, client.PassInterface(), 247 &StartBlobInternalsURLLoader, request, client.PassInterface(),
247 base::Unretained( 248 base::Unretained(
248 ChromeBlobStorageContext::GetFor(browser_context_)))); 249 ChromeBlobStorageContext::GetFor(browser_context_))));
249 return; 250 return;
251 } else if (request.url.host_piece() == kChromeUIHistogramHost) {
252 StartHistogramInternalsURLLoader(request, std::move(client));
253 return;
250 } 254 }
251 255
252 BrowserThread::PostTask( 256 BrowserThread::PostTask(
253 BrowserThread::IO, FROM_HERE, 257 BrowserThread::IO, FROM_HERE,
254 base::BindOnce(&StartURLLoader, request, frame_tree_node_id_, 258 base::BindOnce(&StartURLLoader, request, frame_tree_node_id_,
255 client.PassInterface(), 259 client.PassInterface(),
256 browser_context_->GetResourceContext())); 260 browser_context_->GetResourceContext()));
257 } 261 }
258 262
259 void SyncLoad(int32_t routing_id, 263 void SyncLoad(int32_t routing_id,
(...skipping 19 matching lines...) Expand all
279 } // namespace 283 } // namespace
280 284
281 mojom::URLLoaderFactoryPtr GetWebUIURLLoader(FrameTreeNode* node) { 285 mojom::URLLoaderFactoryPtr GetWebUIURLLoader(FrameTreeNode* node) {
282 int ftn_id = node->frame_tree_node_id(); 286 int ftn_id = node->frame_tree_node_id();
283 if (g_factories.Get()[ftn_id].get() == nullptr) 287 if (g_factories.Get()[ftn_id].get() == nullptr)
284 g_factories.Get()[ftn_id] = base::MakeUnique<WebUIURLLoaderFactory>(node); 288 g_factories.Get()[ftn_id] = base::MakeUnique<WebUIURLLoaderFactory>(node);
285 return g_factories.Get()[ftn_id]->CreateBinding(); 289 return g_factories.Get()[ftn_id]->CreateBinding();
286 } 290 }
287 291
288 } // namespace content 292 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/histogram_internals_url_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698