OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prerender/prerender_tab_helper.h" | 5 #include "chrome/browser/prerender/prerender_tab_helper.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/predictors/logged_in_predictor_table.h" | 10 #include "chrome/browser/predictors/logged_in_predictor_table.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 void PrerenderTabHelper::DidNavigateAnyFrame( | 246 void PrerenderTabHelper::DidNavigateAnyFrame( |
247 const content::LoadCommittedDetails& details, | 247 const content::LoadCommittedDetails& details, |
248 const content::FrameNavigateParams& params) { | 248 const content::FrameNavigateParams& params) { |
249 PrerenderManager* prerender_manager = MaybeGetPrerenderManager(); | 249 PrerenderManager* prerender_manager = MaybeGetPrerenderManager(); |
250 if (params.password_form.origin.is_valid() && prerender_manager) { | 250 if (params.password_form.origin.is_valid() && prerender_manager) { |
251 prerender_manager->RecordLikelyLoginOnURL(params.url); | 251 prerender_manager->RecordLikelyLoginOnURL(params.url); |
252 RecordEvent(EVENT_LOGIN_ACTION_ADDED); | 252 RecordEvent(EVENT_LOGIN_ACTION_ADDED); |
| 253 if (details.is_main_frame) { |
| 254 RecordEvent(EVENT_LOGIN_ACTION_ADDED_MAINFRAME); |
| 255 if (params.password_form.password_value.empty()) |
| 256 RecordEvent(EVENT_LOGIN_ACTION_ADDED_MAINFRAME_PW_EMPTY); |
| 257 } else { |
| 258 RecordEvent(EVENT_LOGIN_ACTION_ADDED_SUBFRAME); |
| 259 if (params.password_form.password_value.empty()) |
| 260 RecordEvent(EVENT_LOGIN_ACTION_ADDED_SUBFRAME_PW_EMPTY); |
| 261 } |
253 } | 262 } |
254 } | 263 } |
255 | 264 |
256 PrerenderManager* PrerenderTabHelper::MaybeGetPrerenderManager() const { | 265 PrerenderManager* PrerenderTabHelper::MaybeGetPrerenderManager() const { |
257 return PrerenderManagerFactory::GetForProfile( | 266 return PrerenderManagerFactory::GetForProfile( |
258 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 267 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
259 } | 268 } |
260 | 269 |
261 bool PrerenderTabHelper::IsPrerendering() { | 270 bool PrerenderTabHelper::IsPrerendering() { |
262 PrerenderManager* prerender_manager = MaybeGetPrerenderManager(); | 271 PrerenderManager* prerender_manager = MaybeGetPrerenderManager(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 328 |
320 void PrerenderTabHelper::RecordEventIfLoggedInURLResult( | 329 void PrerenderTabHelper::RecordEventIfLoggedInURLResult( |
321 PrerenderTabHelper::Event event, | 330 PrerenderTabHelper::Event event, |
322 scoped_ptr<bool> is_present, | 331 scoped_ptr<bool> is_present, |
323 scoped_ptr<bool> lookup_succeeded) { | 332 scoped_ptr<bool> lookup_succeeded) { |
324 if (*lookup_succeeded && *is_present) | 333 if (*lookup_succeeded && *is_present) |
325 RecordEvent(event); | 334 RecordEvent(event); |
326 } | 335 } |
327 | 336 |
328 } // namespace prerender | 337 } // namespace prerender |
OLD | NEW |