Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: chrome/browser/data_use_measurement/data_use_web_contents_observer.cc

Issue 2572823002: Propogate the tab foreground, background change events to data use (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/data_use_measurement/data_use_web_contents_observer.h" 5 #include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h"
6 6
7 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h " 7 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h "
8 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service_f actory.h" 8 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service_f actory.h"
9 #include "content/public/browser/navigation_handle.h" 9 #include "content/public/browser/navigation_handle.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/render_process_host.h"
RyanSturm 2016/12/13 22:04:20 is this header needed?
Raj 2016/12/14 23:00:50 Removed.
11 12
12 DEFINE_WEB_CONTENTS_USER_DATA_KEY( 13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(
13 data_use_measurement::DataUseWebContentsObserver); 14 data_use_measurement::DataUseWebContentsObserver);
14 15
15 namespace data_use_measurement { 16 namespace data_use_measurement {
16 17
17 // static 18 // static
18 void DataUseWebContentsObserver::CreateForWebContents( 19 void DataUseWebContentsObserver::CreateForWebContents(
19 content::WebContents* web_contents) { 20 content::WebContents* web_contents) {
20 DCHECK(web_contents); 21 DCHECK(web_contents);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void DataUseWebContentsObserver::DidStartNavigation( 66 void DataUseWebContentsObserver::DidStartNavigation(
66 content::NavigationHandle* navigation_handle) { 67 content::NavigationHandle* navigation_handle) {
67 service_->DidStartNavigation(navigation_handle); 68 service_->DidStartNavigation(navigation_handle);
68 } 69 }
69 70
70 void DataUseWebContentsObserver::ReadyToCommitNavigation( 71 void DataUseWebContentsObserver::ReadyToCommitNavigation(
71 content::NavigationHandle* navigation_handle) { 72 content::NavigationHandle* navigation_handle) {
72 service_->ReadyToCommitNavigation(navigation_handle); 73 service_->ReadyToCommitNavigation(navigation_handle);
73 } 74 }
74 75
76 void DataUseWebContentsObserver::WasShown() {
77 service_->WasShownOrHidden(web_contents()->GetMainFrame(), true);
78 }
79
80 void DataUseWebContentsObserver::WasHidden() {
81 service_->WasShownOrHidden(web_contents()->GetMainFrame(), false);
82 }
83
84 void DataUseWebContentsObserver::RenderFrameHostChanged(
85 content::RenderFrameHost* old_host,
86 content::RenderFrameHost* new_host) {
87 service_->RenderFrameHostChanged(old_host, new_host);
88 }
89
75 } // namespace data_use_measurement 90 } // namespace data_use_measurement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698