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

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

Issue 2875263003: Support for transfer navigations in data use ascriber (Closed)
Patch Set: rebased Created 3 years, 7 months 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/chrome_data_use_ascriber_service.h " 5 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" 10 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (!navigation_handle->IsInMainFrame()) 147 if (!navigation_handle->IsInMainFrame())
148 return; 148 return;
149 149
150 if (!ascriber_) 150 if (!ascriber_)
151 return; 151 return;
152 152
153 content::WebContents* web_contents = navigation_handle->GetWebContents(); 153 content::WebContents* web_contents = navigation_handle->GetWebContents();
154 content::BrowserThread::PostTask( 154 content::BrowserThread::PostTask(
155 content::BrowserThread::IO, FROM_HERE, 155 content::BrowserThread::IO, FROM_HERE,
156 base::BindOnce(&ChromeDataUseAscriber::ReadyToCommitMainFrameNavigation, 156 base::BindOnce(&ChromeDataUseAscriber::ReadyToCommitMainFrameNavigation,
157 base::Unretained(ascriber_), navigation_handle->GetURL(), 157 base::Unretained(ascriber_),
158 navigation_handle->GetGlobalRequestID(), 158 navigation_handle->GetGlobalRequestID(),
159 web_contents->GetRenderProcessHost()->GetID(), 159 web_contents->GetRenderProcessHost()->GetID(),
160 web_contents->GetMainFrame()->GetRoutingID(), 160 web_contents->GetMainFrame()->GetRoutingID()));
161 !navigation_handle->HasCommitted() ||
162 navigation_handle->IsSameDocument(),
163 navigation_handle));
164 } 161 }
165 162
166 void ChromeDataUseAscriberService::DidFinishNavigation( 163 void ChromeDataUseAscriberService::DidFinishNavigation(
167 content::NavigationHandle* navigation_handle) { 164 content::NavigationHandle* navigation_handle) {
168 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 165 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
169 166
170 if (!navigation_handle->IsInMainFrame() || 167 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
171 !navigation_handle->HasCommitted() || navigation_handle->IsSameDocument())
172 return; 168 return;
173 169
174 if (!ascriber_) 170 if (!ascriber_)
175 return; 171 return;
176 172
177 content::WebContents* web_contents = navigation_handle->GetWebContents(); 173 content::WebContents* web_contents = navigation_handle->GetWebContents();
178 content::BrowserThread::PostTask( 174 content::BrowserThread::PostTask(
179 content::BrowserThread::IO, FROM_HERE, 175 content::BrowserThread::IO, FROM_HERE,
180 base::BindOnce(&ChromeDataUseAscriber::DidFinishNavigation, 176 base::BindOnce(&ChromeDataUseAscriber::DidFinishNavigation,
181 base::Unretained(ascriber_), 177 base::Unretained(ascriber_),
182 web_contents->GetRenderProcessHost()->GetID(), 178 web_contents->GetRenderProcessHost()->GetID(),
183 web_contents->GetMainFrame()->GetRoutingID(), 179 web_contents->GetMainFrame()->GetRoutingID(),
180 navigation_handle->GetURL(),
181 navigation_handle->IsSameDocument(),
184 navigation_handle->GetPageTransition())); 182 navigation_handle->GetPageTransition()));
185 } 183 }
186 184
187 void ChromeDataUseAscriberService::SetDataUseAscriber( 185 void ChromeDataUseAscriberService::SetDataUseAscriber(
188 ChromeDataUseAscriber* ascriber) { 186 ChromeDataUseAscriber* ascriber) {
189 DCHECK(!is_initialized_); 187 DCHECK(!is_initialized_);
190 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 188 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
191 189
192 ascriber_ = ascriber; 190 ascriber_ = ascriber;
193 is_initialized_ = true; 191 is_initialized_ = true;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 content::BrowserThread::IO, FROM_HERE, 233 content::BrowserThread::IO, FROM_HERE,
236 base::BindOnce( 234 base::BindOnce(
237 &ChromeDataUseAscriber::RenderFrameHostChanged, 235 &ChromeDataUseAscriber::RenderFrameHostChanged,
238 base::Unretained(ascriber_), old_host->GetProcess()->GetID(), 236 base::Unretained(ascriber_), old_host->GetProcess()->GetID(),
239 old_host->GetRoutingID(), new_host->GetProcess()->GetID(), 237 old_host->GetRoutingID(), new_host->GetProcess()->GetID(),
240 new_host->GetRoutingID())); 238 new_host->GetRoutingID()));
241 } 239 }
242 } 240 }
243 241
244 } // namespace data_use_measurement 242 } // namespace data_use_measurement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698