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

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: 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
« no previous file with comments | « chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() ||
171 !navigation_handle->HasCommitted() || navigation_handle->IsSameDocument()) 168 !navigation_handle->HasCommitted() || navigation_handle->IsSameDocument())
RyanSturm 2017/05/17 16:14:49 You are checking IsSameDocument in two places Prob
172 return; 169 return;
173 170
174 if (!ascriber_) 171 if (!ascriber_)
175 return; 172 return;
176 173
177 content::WebContents* web_contents = navigation_handle->GetWebContents(); 174 content::WebContents* web_contents = navigation_handle->GetWebContents();
178 content::BrowserThread::PostTask( 175 content::BrowserThread::PostTask(
179 content::BrowserThread::IO, FROM_HERE, 176 content::BrowserThread::IO, FROM_HERE,
180 base::BindOnce(&ChromeDataUseAscriber::DidFinishNavigation, 177 base::BindOnce(&ChromeDataUseAscriber::DidFinishNavigation,
181 base::Unretained(ascriber_), 178 base::Unretained(ascriber_),
182 web_contents->GetRenderProcessHost()->GetID(), 179 web_contents->GetRenderProcessHost()->GetID(),
183 web_contents->GetMainFrame()->GetRoutingID(), 180 web_contents->GetMainFrame()->GetRoutingID(),
181 navigation_handle->GetURL(),
182 navigation_handle->IsSameDocument(),
184 navigation_handle->GetPageTransition())); 183 navigation_handle->GetPageTransition()));
185 } 184 }
186 185
187 void ChromeDataUseAscriberService::SetDataUseAscriber( 186 void ChromeDataUseAscriberService::SetDataUseAscriber(
188 ChromeDataUseAscriber* ascriber) { 187 ChromeDataUseAscriber* ascriber) {
189 DCHECK(!is_initialized_); 188 DCHECK(!is_initialized_);
190 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 189 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
191 190
192 ascriber_ = ascriber; 191 ascriber_ = ascriber;
193 is_initialized_ = true; 192 is_initialized_ = true;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 content::BrowserThread::IO, FROM_HERE, 234 content::BrowserThread::IO, FROM_HERE,
236 base::BindOnce( 235 base::BindOnce(
237 &ChromeDataUseAscriber::RenderFrameHostChanged, 236 &ChromeDataUseAscriber::RenderFrameHostChanged,
238 base::Unretained(ascriber_), old_host->GetProcess()->GetID(), 237 base::Unretained(ascriber_), old_host->GetProcess()->GetID(),
239 old_host->GetRoutingID(), new_host->GetProcess()->GetID(), 238 old_host->GetRoutingID(), new_host->GetProcess()->GetID(),
240 new_host->GetRoutingID())); 239 new_host->GetRoutingID()));
241 } 240 }
242 } 241 }
243 242
244 } // namespace data_use_measurement 243 } // namespace data_use_measurement
OLDNEW
« no previous file with comments | « chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698