Chromium Code Reviews| 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_H_ | |
| 6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "components/data_use_measurement/core/data_use_ascriber.h" | |
| 10 #include "net/base/layered_network_delegate.h" | |
|
Lei Zhang
2016/09/08 22:04:42
What's this for?
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class NavigationHandle; | |
| 15 class RenderFrameHost; | |
| 16 } | |
| 17 | |
| 18 namespace data_use_measurement { | |
|
Lei Zhang
2016/09/08 22:04:42
nit: blank line after when it's not fwrd decls.
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 19 // Browser implementation of |DataUseAscriber|. Maintains a list of | |
|
Lei Zhang
2016/09/08 22:04:42
|variable_name|, Classes are written normally.
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 20 // |DataUseRecorder| instances, one for each source of data, such as a page | |
| 21 // load. | |
| 22 // | |
| 23 // A page includes all resources loaded in response to a main page navigation. | |
| 24 // The scope of a page load ends either when the tab is closed or a new page | |
| 25 // load is initiated by clicking on a link, entering a new URL, window location | |
| 26 // change, etc | |
|
Lei Zhang
2016/09/08 22:04:42
End sentences with periods.
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 27 // | |
| 28 // For URLRequests initiated outside the context of a page load, such as | |
| 29 // Service Workers, Chrome Services, etc, a new instance of |DataUseRecorder| | |
| 30 // will be created for each |URLRequest|. | |
| 31 // | |
| 32 // Each page load will be associated with an instance of |DataUseRecorder|. | |
| 33 // Each URLRequest initiated in the context of a page load will be mapped to | |
| 34 // the |DataUseRecorder| instance for page load. | |
| 35 // | |
| 36 // This class lives entirely on the IO thread. It maintains a copy of frame and | |
| 37 // navigation information on the IO thread. | |
| 38 class ChromeDataUseAscriber : public DataUseAscriber { | |
| 39 public: | |
| 40 ChromeDataUseAscriber(); | |
| 41 | |
| 42 ~ChromeDataUseAscriber() override; | |
| 43 | |
| 44 // Chrome override of |GetDataUseRecorder()|. | |
|
Lei Zhang
2016/09/08 22:04:42
This is not helpful. Just:
// DataUseAscriber:
[A
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 45 DataUseRecorder* GetDataUseRecorder(const net::URLRequest* request) override; | |
| 46 | |
| 47 // Must be called on the IO thread when a render frame host is created. | |
|
Lei Zhang
2016/09/08 22:04:42
You can probably omit the "Must be called on the I
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 48 void RenderFrameCreated(int render_process_id, | |
| 49 int render_frame_id, | |
| 50 int parent_render_process_id, | |
| 51 int parent_render_frame_id); | |
| 52 | |
| 53 // Must be called on the IO thread when a render frame host is deleted. | |
| 54 void RenderFrameDeleted(int render_process_id, | |
| 55 int render_frame_id, | |
| 56 int parent_render_process_id, | |
| 57 int parent_render_frame_id); | |
| 58 | |
| 59 // Must be called on the IO thread when a main frame navigation is started. | |
| 60 void DidStartMainFrameNavigation(GURL gurl, | |
|
Lei Zhang
2016/09/08 22:04:42
Pass by const-ref, here and below?
Not at Google. Contact bengr
2016/09/09 18:37:16
Comes from a different thread, so cannot use ref.
| |
| 61 int render_process_id, | |
| 62 int render_frame_id, | |
| 63 void* navigation_handle); | |
| 64 | |
| 65 // Must be called on the IO thread when a main frame navigation is completed. | |
| 66 void DidFinishMainFrameNavigation(GURL gurl, | |
| 67 int render_process_id, | |
| 68 int render_frame_id, | |
| 69 bool is_same_page_navigation, | |
| 70 void* navigation_handle); | |
| 71 | |
| 72 // Must be called on the IO thread when a main frame navigation is redirected. | |
| 73 void DidRedirectMainFrameNavigation(GURL gurl, | |
| 74 int render_process_id, | |
| 75 int render_frame_id, | |
| 76 void* navigation_handle); | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); | |
|
Lei Zhang
2016/09/08 22:04:42
DISALLOW_COPY_AND_ASSIGN() does no good if it's pu
Not at Google. Contact bengr
2016/09/09 18:37:16
Done.
| |
| 79 }; | |
| 80 | |
| 81 } // namespace data_use_measurement | |
| 82 | |
| 83 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | |
| OLD | NEW |