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 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" | 5 #include "chrome/browser/android/data_usage/data_use_tab_helper.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/android/data_usage/data_use_ui_tab_model.h" | 8 #include "chrome/browser/android/data_usage/data_use_ui_tab_model.h" |
9 #include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h" | 9 #include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 43 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
44 SessionID::id_type tab_id = SessionTabHelper::IdForTab(web_contents()); | 44 SessionID::id_type tab_id = SessionTabHelper::IdForTab(web_contents()); |
45 if (data_use_ui_tab_model && tab_id >= 0) { | 45 if (data_use_ui_tab_model && tab_id >= 0) { |
46 data_use_ui_tab_model->ReportBrowserNavigation( | 46 data_use_ui_tab_model->ReportBrowserNavigation( |
47 navigation_handle->GetURL(), | 47 navigation_handle->GetURL(), |
48 ui::PageTransitionFromInt(navigation_handle->GetPageTransition()), | 48 ui::PageTransitionFromInt(navigation_handle->GetPageTransition()), |
49 tab_id); | 49 tab_id); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 void DataUseTabHelper::RenderFrameDeleted( | 53 void DataUseTabHelper::FrameDeleted( |
54 content::RenderFrameHost* render_frame_host) { | 54 content::RenderFrameHost* render_frame_host) { |
55 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 55 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
56 | 56 |
57 // Check if it is a main frame. | 57 // Check if it is a main frame. |
58 if (render_frame_host->GetParent()) | 58 if (render_frame_host->GetParent()) |
59 return; | 59 return; |
60 | 60 |
61 // Notify the DataUseUITabModel. | 61 // Notify the DataUseUITabModel. |
62 chrome::android::DataUseUITabModel* data_use_ui_tab_model = | 62 chrome::android::DataUseUITabModel* data_use_ui_tab_model = |
63 chrome::android::DataUseUITabModelFactory::GetForBrowserContext( | 63 chrome::android::DataUseUITabModelFactory::GetForBrowserContext( |
64 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 64 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
65 SessionID::id_type tab_id = SessionTabHelper::IdForTab(web_contents()); | 65 SessionID::id_type tab_id = SessionTabHelper::IdForTab(web_contents()); |
66 if (data_use_ui_tab_model && tab_id >= 0) | 66 if (data_use_ui_tab_model && tab_id >= 0) |
67 data_use_ui_tab_model->ReportTabClosure(tab_id); | 67 data_use_ui_tab_model->ReportTabClosure(tab_id); |
68 } | 68 } |
OLD | NEW |