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

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 LKGR. 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 15 matching lines...) Expand all
33 bool* defer) { 34 bool* defer) {
34 *defer = request_deferred_ = !request_allowed_; 35 *defer = request_deferred_ = !request_allowed_;
35 } 36 }
36 37
37 void DownloadResourceThrottle::WillProcessResponse(bool* defer) { 38 void DownloadResourceThrottle::WillProcessResponse(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;
44 if (allow) {
45 // Presumes all downloads initiated by navigation using this throttle and
46 // nothing else does.
47 download_util::RecordDownloadSource(
48 download_util::INITIATED_BY_NAVIGATION);
49 } else {
50 download_util::RecordDownloadCount(download_util::BLOCKED_BY_THROTTLING);
51 }
43 52
44 if (request_deferred_) { 53 if (request_deferred_) {
45 if (allow) { 54 if (allow) {
46 controller()->Resume(); 55 controller()->Resume();
47 } else { 56 } else {
48 controller()->Cancel(); 57 controller()->Cancel();
49 } 58 }
50 } 59 }
51 } 60 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/imageburner/burn_manager.cc ('k') | chrome/browser/download/download_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698