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

Side by Side Diff: content/browser/loader/content_size_resource_handler.cc

Issue 2180933002: Add experimental code behind a flag for Content Size Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: while -> for Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/loader/content_size_resource_handler.h"
6
7 #include "content/browser/loader/content_size_resource_handler_manager.h"
8 #include "net/url_request/url_request.h"
9
10 namespace content {
11
12 ContentSizeResourceHandler::ContentSizeResourceHandler(
13 std::unique_ptr<ResourceHandler> next_handler,
14 net::URLRequest* request,
15 ContentSizeResourceHandlerManager* manager)
16 : LayeredResourceHandler(request, std::move(next_handler)),
17 manager_(manager) {}
18
19 ContentSizeResourceHandler::~ContentSizeResourceHandler() {}
20
21 bool ContentSizeResourceHandler::OnWillStart(const GURL& url, bool* defer) {
22 if (manager_->ShouldCancelRequest(GetRequestInfo(), 0))
23 return false;
24 return next_handler_->OnWillStart(url, defer);
25 }
26
27 bool ContentSizeResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
28 if (manager_->ShouldCancelRequest(GetRequestInfo(), bytes_read))
29 return false;
30 return next_handler_->OnReadCompleted(bytes_read, defer);
31 }
32
33 void ContentSizeResourceHandler::OnResponseCompleted(
34 const net::URLRequestStatus& status,
35 const std::string& security_info,
36 bool* defer) {
37 manager_->NotifyUIThreadReadUpdates();
38 next_handler_->OnResponseCompleted(status, security_info, defer);
39 }
40
41 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/content_size_resource_handler.h ('k') | content/browser/loader/content_size_resource_handler_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698