| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |