Chromium Code Reviews| Index: chrome/browser/data_usage/tab_id_annotator.h |
| diff --git a/chrome/browser/data_usage/tab_id_annotator.h b/chrome/browser/data_usage/tab_id_annotator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..24a2c0e8c6f60f84bbc0b4164dbcc60b43b500e4 |
| --- /dev/null |
| +++ b/chrome/browser/data_usage/tab_id_annotator.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
|
bengr
2015/11/05 00:00:38
Remove the "(c)" as per the latest hotness.
sclittle
2015/11/05 01:22:48
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |
| +#define CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "components/data_usage/core/data_use_annotator.h" |
| + |
| +namespace data_usage { |
| +struct DataUse; |
| +} |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +namespace chrome_browser_data_usage { |
| + |
| +// Class that annotates DataUse objects with their associated tab IDs. |
| +class TabIdAnnotator : public data_usage::DataUseAnnotator { |
| + public: |
| + TabIdAnnotator(); |
| + ~TabIdAnnotator() override; |
| + |
| + // Determines the tab ID associated with |request| if there is one, setting |
| + // the tab ID on |data_use| appropriately and passing it to |callback| once |
| + // the tab ID is ready. A tab ID of -1 is used if no tab ID is found for |
| + // |request|. This method will attach a new TabIdProvider to |request| as user |
| + // data if there isn't one attached already and |request| has enough |
| + // information to get a tab ID. |
| + void Annotate(net::URLRequest* request, |
| + scoped_ptr<data_usage::DataUse> data_use, |
| + const base::Callback<void(scoped_ptr<data_usage::DataUse>)>& |
| + callback) override; |
| + |
| + private: |
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TabIdAnnotator); |
| +}; |
| + |
| +} // namespace chrome_browser_data_usage |
| + |
| +#endif // CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ |