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

Unified Diff: chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h

Issue 2285903002: Framework to ascribe all network data use to a source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ascriber to chrome/browser Created 4 years, 4 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: chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..5bca84c92556ddd7f362ce5879462c66d776f6f4
--- /dev/null
+++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h
@@ -0,0 +1,71 @@
+// Copyright 2016 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_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_
+#define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_
+
+#include "components/keyed_service/core/keyed_service.h"
+
+namespace content {
+class NavigationHandle;
+class RenderFrameHost;
+}
+
+class IOThread;
+
+namespace data_use_measurement {
+class ChromeDataUseAscriber;
+
+// UI thread functionality of |ChromeDataUseAscriber|.
+//
+// Listens to navigation and frame events on UI thread and propagates them to
bengr 2016/09/01 00:16:55 on -> on the
Not at Google. Contact bengr 2016/09/07 23:38:37 Done.
+// |ChromeDataUseAscriber| on the IO thread. This class depends on external
+// WebContentsObservers to propagate events to itself because each
+// WebContents instance requires its own WebContentsObserver instance.
+//
+// Created and destroyed on the UI thread. Public methods should only be called
+// on the UI thread.
+class ChromeDataUseAscriberService : public KeyedService {
+ public:
+ ChromeDataUseAscriberService();
+ ~ChromeDataUseAscriberService() override;
+
+ // Called when a render frame a created. Propagates this information to
+ // |ascriber_| on the IO thread. |RenderFrameHost| methods cannot be called
+ // on the IO thread, so only routing IDs of |render_frame_host| and its parent
+ // are propagated.
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host);
+
+ // Called when a render frame a deleted. Propagates this information to
+ // |ascriber_| on the IO thread. |RenderFrameHost| methods cannot be called
+ // on the IO thread, so only routing IDs of |render_frame_host| and its parent
+ // are propagated.
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host);
+
+ // Called when a navigation is started. Propagates main frame navigation
+ // start to the |ascriber_| on the IO thread. |NavigationHandle| methods
+ // cannot be called on the IO thread, so the pointer is cast to void*.
+ void DidStartNavigation(content::NavigationHandle* navigation_handle);
+
+ // Called when a navigation is finished. Propagates main frame navigation
+ // finish to the |ascriber_| on the IO thread. |NavigationHandle| methods
+ // cannot be called on the IO thread, so the pointer is cast to void*.
+ void DidFinishNavigation(content::NavigationHandle* navigation_handle);
+
+ // Called when a navigation is redirected. Propagates main frame navigation
+ // redirect to the |ascriber_| on the IO thread. |NavigationHandle| methods
+ // cannot be called on the IO thread, so the pointer is cast to void*.
+ void DidRedirectNavigation(content::NavigationHandle* navigation_handle);
+
+ private:
+ void InitOnIOThread(IOThread* io_thread);
+ void SetDataUseAscriber(ChromeDataUseAscriber* ascriber);
bengr 2016/09/01 00:16:55 I don't understand the relationship. Who owns the
Not at Google. Contact bengr 2016/09/07 23:38:37 This class listens to callbacks on the UI thread a
+
+ // |ascriber_| outlives this instance.
+ ChromeDataUseAscriber* ascriber_;
+};
+
+} // namespace data_use_measurement
bengr 2016/09/01 00:16:55 DISALLOW_COPY_AND_ASSIGN?
Not at Google. Contact bengr 2016/09/07 23:38:37 Done.
+
+#endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698