| 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 "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "chrome/browser/android/data_usage/external_data_use_observer.h" | 8 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
| 9 #include "chrome/browser/android/data_usage/tab_data_use_entry.h" | 9 #include "chrome/browser/android/data_usage/tab_data_use_entry.h" |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 DCHECK(thread_checker_.CalledOnValidThread()); | 40 DCHECK(thread_checker_.CalledOnValidThread()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 base::WeakPtr<DataUseTabModel> DataUseTabModel::GetWeakPtr() { | 43 base::WeakPtr<DataUseTabModel> DataUseTabModel::GetWeakPtr() { |
| 44 DCHECK(thread_checker_.CalledOnValidThread()); | 44 DCHECK(thread_checker_.CalledOnValidThread()); |
| 45 return weak_factory_.GetWeakPtr(); | 45 return weak_factory_.GetWeakPtr(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void DataUseTabModel::OnNavigationEvent(int32_t tab_id, | 48 void DataUseTabModel::OnNavigationEvent(int32_t tab_id, |
| 49 TransitionType transition, | 49 TransitionType transition, |
| 50 const GURL& url, | 50 const GURL& url) { |
| 51 const std::string& package) { | |
| 52 DCHECK(thread_checker_.CalledOnValidThread()); | 51 DCHECK(thread_checker_.CalledOnValidThread()); |
| 53 DCHECK(IsValidTabID(tab_id)); | 52 DCHECK(IsValidTabID(tab_id)); |
| 54 | 53 |
| 55 // TODO(rajendrant): implementation to use package. | |
| 56 switch (transition) { | 54 switch (transition) { |
| 57 case TRANSITION_OMNIBOX_SEARCH: | 55 case TRANSITION_OMNIBOX_SEARCH: |
| 58 case TRANSITION_FROM_EXTERNAL_APP: { | 56 case TRANSITION_FROM_EXTERNAL_APP: { |
| 59 // Enter events. | 57 // Enter events. |
| 60 std::string label; | 58 std::string label; |
| 61 if (data_use_observer_->Matches(url, &label)) { | 59 if (data_use_observer_->Matches(url, &label)) { |
| 62 // TODO(rajendrant): Need to handle scenarios where these labels change | 60 // TODO(rajendrant): Need to handle scenarios where these labels change |
| 63 // in the middle of a tab session. Should |data_use_observer_| notify us | 61 // in the middle of a tab session. Should |data_use_observer_| notify us |
| 64 // about a cleanup. What happens to currently active tab sessions. | 62 // about a cleanup. What happens to currently active tab sessions. |
| 65 DCHECK(!label.empty()); | 63 DCHECK(!label.empty()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 187 } |
| 190 } | 188 } |
| 191 DCHECK(oldest_tab_entry_iterator != active_tabs_.end()); | 189 DCHECK(oldest_tab_entry_iterator != active_tabs_.end()); |
| 192 active_tabs_.erase(oldest_tab_entry_iterator); | 190 active_tabs_.erase(oldest_tab_entry_iterator); |
| 193 } | 191 } |
| 194 } | 192 } |
| 195 | 193 |
| 196 } // namespace android | 194 } // namespace android |
| 197 | 195 |
| 198 } // namespace chrome | 196 } // namespace chrome |
| OLD | NEW |