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

Side by Side Diff: chrome/browser/download/download_resource_throttle.cc

Issue 9316116: Isolate initiation counts for downloads to their own histograms and improve (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to TOT. Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/download/download_resource_throttle.h" 5 #include "chrome/browser/download/download_resource_throttle.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/download/download_util.h"
8 #include "content/public/browser/resource_throttle_controller.h" 9 #include "content/public/browser/resource_throttle_controller.h"
9 10
10 DownloadResourceThrottle::DownloadResourceThrottle( 11 DownloadResourceThrottle::DownloadResourceThrottle(
11 DownloadRequestLimiter* limiter, 12 DownloadRequestLimiter* limiter,
12 int render_process_id, 13 int render_process_id,
13 int render_view_id, 14 int render_view_id,
14 int request_id) 15 int request_id)
15 : request_allowed_(false), 16 : request_allowed_(false),
16 request_deferred_(false) { 17 request_deferred_(false) {
17 limiter->CanDownloadOnIOThread( 18 limiter->CanDownloadOnIOThread(
(...skipping 18 matching lines...) Expand all
36 37
37 void DownloadResourceThrottle::WillReadRequest(bool* defer) { 38 void DownloadResourceThrottle::WillReadRequest(bool* defer) {
38 *defer = request_deferred_ = !request_allowed_; 39 *defer = request_deferred_ = !request_allowed_;
39 } 40 }
40 41
41 void DownloadResourceThrottle::ContinueDownload(bool allow) { 42 void DownloadResourceThrottle::ContinueDownload(bool allow) {
42 request_allowed_ = allow; 43 request_allowed_ = allow;
43 44
44 if (request_deferred_) { 45 if (request_deferred_) {
45 if (allow) { 46 if (allow) {
47 download_util::RecordDownloadSource(
48 download_util::INITIATED_BY_NAVIGATION);
46 controller()->Resume(); 49 controller()->Resume();
47 } else { 50 } else {
51 download_util::RecordDownloadCount(download_util::BLOCKED_BY_THROTTLING);
48 controller()->Cancel(); 52 controller()->Cancel();
49 } 53 }
50 } 54 }
51 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698