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

Unified Diff: components/data_usage/core/data_use.h

Issue 1373373002: Create component to expose network usage stats to consumers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished and added tests Created 5 years, 2 months 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
Index: components/data_usage/core/data_use.h
diff --git a/components/data_usage/core/data_use.h b/components/data_usage/core/data_use.h
new file mode 100644
index 0000000000000000000000000000000000000000..0dcb5677f30fe9a583e0ee9a9c82e6eaa7bbe205
--- /dev/null
+++ b/components/data_usage/core/data_use.h
@@ -0,0 +1,40 @@
+// 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 COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_
+#define COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_
+
+#include <stdint.h>
+
+#include "base/time/time.h"
+#include "net/base/network_change_notifier.h"
+#include "url/gurl.h"
+
+namespace data_usage {
+
+struct DataUse {
+ DataUse(const GURL& url,
+ const base::Time& request_time,
+ const GURL& first_party_for_cookies,
+ int tab_id,
bengr 2015/10/06 19:30:28 Perhaps we should use a const std::string& tab_lab
tbansal1 2015/10/06 20:13:15 There is a tab_id field in Chromium (which is int3
sclittle 2015/10/07 01:07:55 Changed to int32_t according to tbansal's comment.
+ net::NetworkChangeNotifier::ConnectionType connection_type,
+ int64_t tx_bytes,
+ int64_t rx_bytes);
+
+ GURL url;
+ // The time that the request that is associated with these bytes was started.
+ base::Time request_time;
+ GURL first_party_for_cookies;
+ int tab_id;
+ net::NetworkChangeNotifier::ConnectionType connection_type;
+ // TODO(sclittle): Add more network info here, e.g. for Android, SIM operator
+ // and whether the device is roaming.
+
+ int64_t tx_bytes;
+ int64_t rx_bytes;
+};
+
+} // namespace data_usage
+
+#endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_

Powered by Google App Engine
This is Rietveld 408576698