Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Unified Diff: chrome/browser/data_usage/tab_id_annotator.h

Issue 1421983002: Include tab IDs when reporting data use accounting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_use_scoped_vector
Patch Set: Fixed external_data_use_observer test Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/data_usage/OWNERS ('k') | chrome/browser/data_usage/tab_id_annotator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f4fcccf8255cc6c1585e965b697cdf9d612b0e39
--- /dev/null
+++ b/chrome/browser/data_usage/tab_id_annotator.h
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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/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 DataUseConsumerCallback& 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_
« no previous file with comments | « chrome/browser/data_usage/OWNERS ('k') | chrome/browser/data_usage/tab_id_annotator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698