OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
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_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_ | |
6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_ | |
7 | |
8 #include "components/keyed_service/core/keyed_service.h" | |
9 | |
10 namespace content { | |
11 class NavigationHandle; | |
12 class RenderFrameHost; | |
13 } | |
14 | |
15 class IOThread; | |
16 | |
17 namespace data_use_measurement { | |
18 class ChromeDataUseAscriber; | |
19 | |
20 // UI thread functionality of |ChromeDataUseAscriber|. | |
21 // | |
22 // 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.
| |
23 // |ChromeDataUseAscriber| on the IO thread. This class depends on external | |
24 // WebContentsObservers to propagate events to itself because each | |
25 // WebContents instance requires its own WebContentsObserver instance. | |
26 // | |
27 // Created and destroyed on the UI thread. Public methods should only be called | |
28 // on the UI thread. | |
29 class ChromeDataUseAscriberService : public KeyedService { | |
30 public: | |
31 ChromeDataUseAscriberService(); | |
32 ~ChromeDataUseAscriberService() override; | |
33 | |
34 // Called when a render frame a created. Propagates this information to | |
35 // |ascriber_| on the IO thread. |RenderFrameHost| methods cannot be called | |
36 // on the IO thread, so only routing IDs of |render_frame_host| and its parent | |
37 // are propagated. | |
38 void RenderFrameCreated(content::RenderFrameHost* render_frame_host); | |
39 | |
40 // Called when a render frame a deleted. Propagates this information to | |
41 // |ascriber_| on the IO thread. |RenderFrameHost| methods cannot be called | |
42 // on the IO thread, so only routing IDs of |render_frame_host| and its parent | |
43 // are propagated. | |
44 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host); | |
45 | |
46 // Called when a navigation is started. Propagates main frame navigation | |
47 // start to the |ascriber_| on the IO thread. |NavigationHandle| methods | |
48 // cannot be called on the IO thread, so the pointer is cast to void*. | |
49 void DidStartNavigation(content::NavigationHandle* navigation_handle); | |
50 | |
51 // Called when a navigation is finished. Propagates main frame navigation | |
52 // finish to the |ascriber_| on the IO thread. |NavigationHandle| methods | |
53 // cannot be called on the IO thread, so the pointer is cast to void*. | |
54 void DidFinishNavigation(content::NavigationHandle* navigation_handle); | |
55 | |
56 // Called when a navigation is redirected. Propagates main frame navigation | |
57 // redirect to the |ascriber_| on the IO thread. |NavigationHandle| methods | |
58 // cannot be called on the IO thread, so the pointer is cast to void*. | |
59 void DidRedirectNavigation(content::NavigationHandle* navigation_handle); | |
60 | |
61 private: | |
62 void InitOnIOThread(IOThread* io_thread); | |
63 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
| |
64 | |
65 // |ascriber_| outlives this instance. | |
66 ChromeDataUseAscriber* ascriber_; | |
67 }; | |
68 | |
69 } // 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.
| |
70 | |
71 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_ H_ | |
OLD | NEW |