| 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 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ | 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <memory> | 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/containers/hash_tables.h" | |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "chrome/browser/android/data_usage/data_use_tab_model.h" | 17 #include "chrome/browser/android/data_usage/data_use_tab_model.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" | 18 #include "components/keyed_service/core/keyed_service.h" |
| 19 #include "components/sessions/core/session_id.h" | 19 #include "components/sessions/core/session_id.h" |
| 20 #include "ui/base/page_transition_types.h" | 20 #include "ui/base/page_transition_types.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 transition_type(transition_type), | 129 transition_type(transition_type), |
| 130 url(url), | 130 url(url), |
| 131 package(package) {} | 131 package(package) {} |
| 132 | 132 |
| 133 const SessionID::id_type tab_id; | 133 const SessionID::id_type tab_id; |
| 134 const DataUseTabModel::TransitionType transition_type; | 134 const DataUseTabModel::TransitionType transition_type; |
| 135 const GURL url; | 135 const GURL url; |
| 136 const std::string package; | 136 const std::string package; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 typedef base::hash_map<SessionID::id_type, DataUseTrackingEvent> TabEvents; | 139 typedef std::map<SessionID::id_type, DataUseTrackingEvent> TabEvents; |
| 140 | 140 |
| 141 // DataUseTabModel::TabDataUseObserver implementation: | 141 // DataUseTabModel::TabDataUseObserver implementation: |
| 142 void NotifyTrackingStarting(SessionID::id_type tab_id) override; | 142 void NotifyTrackingStarting(SessionID::id_type tab_id) override; |
| 143 void NotifyTrackingEnding(SessionID::id_type tab_id) override; | 143 void NotifyTrackingEnding(SessionID::id_type tab_id) override; |
| 144 void OnDataUseTabModelReady() override; | 144 void OnDataUseTabModelReady() override; |
| 145 | 145 |
| 146 // Creates |event| for tab with id |tab_id| and value |event|, if there is no | 146 // Creates |event| for tab with id |tab_id| and value |event|, if there is no |
| 147 // existing entry for |tab_id|, and returns true. Otherwise, returns false | 147 // existing entry for |tab_id|, and returns true. Otherwise, returns false |
| 148 // without modifying the entry. | 148 // without modifying the entry. |
| 149 bool MaybeCreateTabEvent(SessionID::id_type tab_id, | 149 bool MaybeCreateTabEvent(SessionID::id_type tab_id, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 base::WeakPtrFactory<DataUseUITabModel> weak_factory_; | 196 base::WeakPtrFactory<DataUseUITabModel> weak_factory_; |
| 197 | 197 |
| 198 DISALLOW_COPY_AND_ASSIGN(DataUseUITabModel); | 198 DISALLOW_COPY_AND_ASSIGN(DataUseUITabModel); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace android | 201 } // namespace android |
| 202 | 202 |
| 203 } // namespace chrome | 203 } // namespace chrome |
| 204 | 204 |
| 205 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ | 205 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ |
| OLD | NEW |