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

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

Powered by Google App Engine
This is Rietveld 408576698