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_DATA_USE_WEB_CONTENTS_OBSERVER_H_ | |
6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_DATA_USE_WEB_CONTENTS_OBSERVER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 #include "content/public/browser/web_contents_user_data.h" | |
11 | |
12 namespace content { | |
13 class NavigationHandle; | |
14 class RenderFrameHost; | |
15 } | |
16 | |
17 namespace data_use_measurement { | |
18 | |
19 class ChromeDataUseAscriberService; | |
20 | |
21 // Forwards navigation and frame events to |ChromeDataUseAscriberService|. | |
22 class DataUseWebContentsObserver | |
23 : public content::WebContentsObserver, | |
24 public content::WebContentsUserData<DataUseWebContentsObserver> { | |
25 public: | |
26 // Creates a |DataUseWebContentsObserver| for the given |WebContents| and | |
27 // |ChromeDataUseAscriberService|. | |
28 static void CreateForWebContents(content::WebContents* web_contents, | |
29 ChromeDataUseAscriberService* service); | |
30 | |
31 ~DataUseWebContentsObserver() override; | |
32 | |
33 // Called when a render frame host is created. Propagates this event to | |
Lei Zhang
2016/09/08 22:04:43
Just write a class summary to explain this class f
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
34 // |ChromeDataUseAscriberService|. | |
35 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | |
36 | |
37 // Called when a render frame host is deleted. Propagates this event to | |
38 // |ChromeDataUseAscriberService|. | |
39 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | |
40 | |
41 // Called when a navigation is started. Propagates this event to | |
42 // |ChromeDataUseAscriberService|. | |
43 void DidStartNavigation( | |
44 content::NavigationHandle* navigation_handle) override; | |
45 | |
46 // Called when a navigation is completed. Propagates this event to | |
47 // |ChromeDataUseAscriberService|. | |
48 void DidFinishNavigation( | |
49 content::NavigationHandle* navigation_handle) override; | |
50 | |
51 // Called when a navigation is redirected. Propagates this event to | |
52 // |ChromeDataUseAscriberService|. | |
53 void DidRedirectNavigation( | |
54 content::NavigationHandle* navigation_handle) override; | |
55 | |
56 private: | |
57 explicit DataUseWebContentsObserver(content::WebContents* web_contents, | |
Lei Zhang
2016/09/08 22:04:43
Multiple parameters - not explicit.
Not at Google. Contact bengr
2016/09/09 18:37:17
Done.
| |
58 ChromeDataUseAscriberService* service); | |
59 friend class content::WebContentsUserData<DataUseWebContentsObserver>; | |
Lei Zhang
2016/09/08 22:04:43
Put the friend first and add a blank line before t
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
60 ChromeDataUseAscriberService* service_; | |
Lei Zhang
2016/09/08 22:04:43
ChromeDataUseAscriberService* const service_;
Not at Google. Contact bengr
2016/09/09 18:37:17
Done.
| |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(DataUseWebContentsObserver); | |
63 }; | |
64 | |
65 } // namespace data_use_measurement | |
66 | |
67 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_DATA_USE_WEB_CONTENTS_OBSERVER_H_ | |
OLD | NEW |