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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc

Issue 2367403005: Snackbar for promoting Data Saver to existing users (Closed)
Patch Set: rename "data saving" to "data savings" for consistency Created 4 years, 1 month 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 base::ListValue* received_update = 562 base::ListValue* received_update =
563 GetList(prefs::kDailyHttpReceivedContentLength); 563 GetList(prefs::kDailyHttpReceivedContentLength);
564 original_update->Clear(); 564 original_update->Clear();
565 received_update->Clear(); 565 received_update->Clear();
566 for (size_t i = 0; i < kNumDaysInHistory; ++i) { 566 for (size_t i = 0; i < kNumDaysInHistory; ++i) {
567 original_update->AppendString(base::Int64ToString(0)); 567 original_update->AppendString(base::Int64ToString(0));
568 received_update->AppendString(base::Int64ToString(0)); 568 received_update->AppendString(base::Int64ToString(0));
569 } 569 }
570 } 570 }
571 571
572 int64_t DataReductionProxyCompressionStats::GetHttpReceivedContentLength() {
573 return GetInt64(prefs::kHttpReceivedContentLength);
574 }
575
576 int64_t DataReductionProxyCompressionStats::GetHttpOriginalContentLength() {
577 return GetInt64(prefs::kHttpOriginalContentLength);
578 }
579
572 ContentLengthList DataReductionProxyCompressionStats::GetDailyContentLengths( 580 ContentLengthList DataReductionProxyCompressionStats::GetDailyContentLengths(
573 const char* pref_name) { 581 const char* pref_name) {
574 ContentLengthList content_lengths; 582 ContentLengthList content_lengths;
575 const base::ListValue* list_value = GetList(pref_name); 583 const base::ListValue* list_value = GetList(pref_name);
576 if (list_value->GetSize() == kNumDaysInHistory) { 584 if (list_value->GetSize() == kNumDaysInHistory) {
577 for (size_t i = 0; i < kNumDaysInHistory; ++i) 585 for (size_t i = 0; i < kNumDaysInHistory; ++i)
578 content_lengths.push_back(GetInt64PrefValue(*list_value, i)); 586 content_lengths.push_back(GetInt64PrefValue(*list_value, i));
579 } 587 }
580 return content_lengths; 588 return content_lengths;
581 } 589 }
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 std::string DataReductionProxyCompressionStats::NormalizeHostname( 1246 std::string DataReductionProxyCompressionStats::NormalizeHostname(
1239 const std::string& host) { 1247 const std::string& host) {
1240 size_t pos = host.find("://"); 1248 size_t pos = host.find("://");
1241 if (pos != std::string::npos) 1249 if (pos != std::string::npos)
1242 return host.substr(pos + 3); 1250 return host.substr(pos + 3);
1243 1251
1244 return host; 1252 return host;
1245 } 1253 }
1246 1254
1247 } // namespace data_reduction_proxy 1255 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698