OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class RenderFrameHost; | 13 class RenderFrameHost; |
14 class NavigationHandle; | 14 class NavigationHandle; |
15 } | 15 } |
16 | 16 |
17 // Per-tab class to manage tab closures and navigations, so that data usage per | 17 // Per-tab class to manage tab closures and navigations, so that data usage per |
18 // tab can be properly recorded.. | 18 // tab can be properly recorded.. |
19 class DataUseTabHelper : public content::WebContentsObserver, | 19 class DataUseTabHelper : public content::WebContentsObserver, |
20 public content::WebContentsUserData<DataUseTabHelper> { | 20 public content::WebContentsUserData<DataUseTabHelper> { |
21 public: | 21 public: |
22 ~DataUseTabHelper() override; | 22 ~DataUseTabHelper() override; |
23 | 23 |
24 private: | 24 private: |
25 friend class content::WebContentsUserData<DataUseTabHelper>; | 25 friend class content::WebContentsUserData<DataUseTabHelper>; |
26 | 26 |
27 explicit DataUseTabHelper(content::WebContents* web_contents); | 27 explicit DataUseTabHelper(content::WebContents* web_contents); |
28 | 28 |
29 // Overridden from content::WebContentsObserver: | 29 // Overridden from content::WebContentsObserver: |
30 void ReadyToCommitNavigation( | 30 void DidFinishNavigation( |
31 content::NavigationHandle* navigation_handle) override; | 31 content::NavigationHandle* navigation_handle) override; |
32 void FrameDeleted(content::RenderFrameHost* render_frame_host) override; | 32 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
33 | 33 |
34 DISALLOW_COPY_AND_ASSIGN(DataUseTabHelper); | 34 DISALLOW_COPY_AND_ASSIGN(DataUseTabHelper); |
35 }; | 35 }; |
36 | 36 |
37 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ | 37 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_HELPER_H_ |
OLD | NEW |