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

Side by Side Diff: chrome/browser/safe_browsing/protocol_manager.cc

Issue 303233002: [Android] Add UMA SB download size in background and foreground. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('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 (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/safe_browsing/protocol_manager.h" 5 #include "chrome/browser/safe_browsing/protocol_manager.h"
6 6
7 #ifndef NDEBUG 7 #ifndef NDEBUG
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #endif 9 #endif
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 kSbTimerStartIntervalSecMax))), 117 kSbTimerStartIntervalSecMax))),
118 update_state_(FIRST_REQUEST), 118 update_state_(FIRST_REQUEST),
119 chunk_pending_to_write_(false), 119 chunk_pending_to_write_(false),
120 version_(config.version), 120 version_(config.version),
121 update_size_(0), 121 update_size_(0),
122 client_name_(config.client_name), 122 client_name_(config.client_name),
123 request_context_getter_(request_context_getter), 123 request_context_getter_(request_context_getter),
124 url_prefix_(config.url_prefix), 124 url_prefix_(config.url_prefix),
125 backup_update_reason_(BACKUP_UPDATE_REASON_MAX), 125 backup_update_reason_(BACKUP_UPDATE_REASON_MAX),
126 disable_auto_update_(config.disable_auto_update), 126 disable_auto_update_(config.disable_auto_update),
127 url_fetcher_id_(0) { 127 url_fetcher_id_(0),
128 app_in_foreground_(true) {
128 DCHECK(!url_prefix_.empty()); 129 DCHECK(!url_prefix_.empty());
129 130
130 backup_url_prefixes_[BACKUP_UPDATE_REASON_CONNECT] = 131 backup_url_prefixes_[BACKUP_UPDATE_REASON_CONNECT] =
131 config.backup_connect_error_url_prefix; 132 config.backup_connect_error_url_prefix;
132 backup_url_prefixes_[BACKUP_UPDATE_REASON_HTTP] = 133 backup_url_prefixes_[BACKUP_UPDATE_REASON_HTTP] =
133 config.backup_http_error_url_prefix; 134 config.backup_http_error_url_prefix;
134 backup_url_prefixes_[BACKUP_UPDATE_REASON_NETWORK] = 135 backup_url_prefixes_[BACKUP_UPDATE_REASON_NETWORK] =
135 config.backup_network_error_url_prefix; 136 config.backup_network_error_url_prefix;
136 137
137 // Set the backoff multiplier fuzz to a random value between 0 and 1. 138 // Set the backoff multiplier fuzz to a random value between 0 and 1.
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 &gethash_error_count_, &gethash_back_off_mult_); 700 &gethash_error_count_, &gethash_back_off_mult_);
700 next_gethash_time_ = now + next; 701 next_gethash_time_ = now + next;
701 } 702 }
702 703
703 void SafeBrowsingProtocolManager::UpdateFinished(bool success) { 704 void SafeBrowsingProtocolManager::UpdateFinished(bool success) {
704 UpdateFinished(success, !success); 705 UpdateFinished(success, !success);
705 } 706 }
706 707
707 void SafeBrowsingProtocolManager::UpdateFinished(bool success, bool back_off) { 708 void SafeBrowsingProtocolManager::UpdateFinished(bool success, bool back_off) {
708 DCHECK(CalledOnValidThread()); 709 DCHECK(CalledOnValidThread());
710 #if defined(OS_ANDROID)
711 if (app_in_foreground_)
712 UMA_HISTOGRAM_COUNTS("SB2.UpdateSizeForeground", update_size_);
713 else
714 UMA_HISTOGRAM_COUNTS("SB2.UpdateSizeBackground", update_size_);
715 #else
709 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_); 716 UMA_HISTOGRAM_COUNTS("SB2.UpdateSize", update_size_);
Scott Hess - ex-Googler 2014/05/30 16:08:21 This should probably just be outside the condition
717 #endif
710 update_size_ = 0; 718 update_size_ = 0;
711 bool update_success = success || request_type_ == CHUNK_REQUEST; 719 bool update_success = success || request_type_ == CHUNK_REQUEST;
712 if (backup_update_reason_ == BACKUP_UPDATE_REASON_MAX) { 720 if (backup_update_reason_ == BACKUP_UPDATE_REASON_MAX) {
713 RecordUpdateResult( 721 RecordUpdateResult(
714 update_success ? UPDATE_RESULT_SUCCESS : UPDATE_RESULT_FAIL); 722 update_success ? UPDATE_RESULT_SUCCESS : UPDATE_RESULT_FAIL);
715 } else { 723 } else {
716 UpdateResult update_result = static_cast<UpdateResult>( 724 UpdateResult update_result = static_cast<UpdateResult>(
717 UPDATE_RESULT_BACKUP_START + 725 UPDATE_RESULT_BACKUP_START +
718 (static_cast<int>(backup_update_reason_) * 2) + 726 (static_cast<int>(backup_update_reason_) * 2) +
719 update_success); 727 update_success);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 FullHashCallback callback, bool is_download) 791 FullHashCallback callback, bool is_download)
784 : callback(callback), 792 : callback(callback),
785 is_download(is_download) { 793 is_download(is_download) {
786 } 794 }
787 795
788 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() { 796 SafeBrowsingProtocolManager::FullHashDetails::~FullHashDetails() {
789 } 797 }
790 798
791 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() { 799 SafeBrowsingProtocolManagerDelegate::~SafeBrowsingProtocolManagerDelegate() {
792 } 800 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698