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

Side by Side Diff: chrome/browser/android/data_usage/data_use_tab_model.cc

Issue 2165123002: Make ExternalDataUseReporter independent of other data use classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/android/data_usage/external_data_use_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/data_usage/data_use_tab_model.h" 5 #include "chrome/browser/android/data_usage/data_use_tab_model.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 tab_entry.OnTabCloseEvent(); 215 tab_entry.OnTabCloseEvent();
216 } 216 }
217 217
218 void DataUseTabModel::OnTrackingLabelRemoved(const std::string& label) { 218 void DataUseTabModel::OnTrackingLabelRemoved(const std::string& label) {
219 for (auto& tab_entry : active_tabs_) 219 for (auto& tab_entry : active_tabs_)
220 tab_entry.second.EndTrackingWithLabel(label); 220 tab_entry.second.EndTrackingWithLabel(label);
221 } 221 }
222 222
223 bool DataUseTabModel::GetTrackingInfoForTabAtTime( 223 bool DataUseTabModel::GetTrackingInfoForTabAtTime(
224 SessionID::id_type tab_id, 224 SessionID::id_type tab_id,
225 base::TimeTicks timestamp, 225 const base::TimeTicks timestamp,
226 TrackingInfo* output_tracking_info) const { 226 TrackingInfo* output_tracking_info) const {
227 DCHECK(thread_checker_.CalledOnValidThread()); 227 DCHECK(thread_checker_.CalledOnValidThread());
228 228
229 output_tracking_info->label = ""; 229 output_tracking_info->label = "";
230 230
231 // Data use that cannot be attributed to a tab will not be labeled. 231 // Data use that cannot be attributed to a tab will not be labeled.
232 if (!IsValidTabID(tab_id)) 232 if (!IsValidTabID(tab_id))
233 return false; 233 return false;
234 234
235 TabEntryMap::const_iterator tab_entry_iterator = active_tabs_.find(tab_id); 235 TabEntryMap::const_iterator tab_entry_iterator = active_tabs_.find(tab_id);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 NowTicks() - 514 NowTicks() -
515 oldest_tab_entry_iterator->second.GetLatestStartOrEndTime(), 515 oldest_tab_entry_iterator->second.GetLatestStartOrEndTime(),
516 base::TimeDelta::FromMinutes(1), base::TimeDelta::FromHours(1), 50); 516 base::TimeDelta::FromMinutes(1), base::TimeDelta::FromHours(1), 50);
517 active_tabs_.erase(oldest_tab_entry_iterator); 517 active_tabs_.erase(oldest_tab_entry_iterator);
518 } 518 }
519 } 519 }
520 520
521 } // namespace android 521 } // namespace android
522 522
523 } // namespace chrome 523 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/data_usage/external_data_use_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698