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_ |