OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |
| 6 #define CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/threading/thread_checker.h" |
| 11 #include "components/data_usage/core/data_use_annotator.h" |
| 12 |
| 13 namespace data_usage { |
| 14 struct DataUse; |
| 15 } |
| 16 |
| 17 namespace net { |
| 18 class URLRequest; |
| 19 } |
| 20 |
| 21 namespace chrome_browser_data_usage { |
| 22 |
| 23 // Class that annotates DataUse objects with their associated tab IDs. |
| 24 class TabIdAnnotator : public data_usage::DataUseAnnotator { |
| 25 public: |
| 26 TabIdAnnotator(); |
| 27 ~TabIdAnnotator() override; |
| 28 |
| 29 // Determines the tab ID associated with |request| if there is one, setting |
| 30 // the tab ID on |data_use| appropriately and passing it to |callback| once |
| 31 // the tab ID is ready. A tab ID of -1 is used if no tab ID is found for |
| 32 // |request|. This method will attach a new TabIdProvider to |request| as user |
| 33 // data if there isn't one attached already and |request| has enough |
| 34 // information to get a tab ID. |
| 35 void Annotate(net::URLRequest* request, |
| 36 scoped_ptr<data_usage::DataUse> data_use, |
| 37 const DataUseConsumerCallback& callback) override; |
| 38 |
| 39 private: |
| 40 base::ThreadChecker thread_checker_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(TabIdAnnotator); |
| 43 }; |
| 44 |
| 45 } // namespace chrome_browser_data_usage |
| 46 |
| 47 #endif // CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |
OLD | NEW |