OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/search/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/content_settings/content_settings_provider.h" | 10 #include "chrome/browser/content_settings/content_settings_provider.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 void InstantController::ActiveTabChanged() { | 279 void InstantController::ActiveTabChanged() { |
280 if (!extended_enabled()) | 280 if (!extended_enabled()) |
281 return; | 281 return; |
282 | 282 |
283 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged"); | 283 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged"); |
284 ResetInstantTab(); | 284 ResetInstantTab(); |
285 } | 285 } |
286 | 286 |
287 void InstantController::TabDeactivated(content::WebContents* contents) { | 287 void InstantController::TabDeactivated(content::WebContents* contents) { |
| 288 // If user is deactivating an NTP tab, log the number of mouseovers for this |
| 289 // NTP session. |
| 290 if (chrome::IsInstantNTP(contents)) |
| 291 InstantNTP::EmitMouseoverCount(contents); |
288 } | 292 } |
289 | 293 |
290 void InstantController::ThemeInfoChanged( | 294 void InstantController::ThemeInfoChanged( |
291 const ThemeBackgroundInfo& theme_info) { | 295 const ThemeBackgroundInfo& theme_info) { |
292 if (!extended_enabled()) | 296 if (!extended_enabled()) |
293 return; | 297 return; |
294 | 298 |
295 if (ntp_) | 299 if (ntp_) |
296 ntp_->sender()->SendThemeBackgroundInfo(theme_info); | 300 ntp_->sender()->SendThemeBackgroundInfo(theme_info); |
297 if (instant_tab_) | 301 if (instant_tab_) |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 673 |
670 bool InstantController::InStartup() const { | 674 bool InstantController::InStartup() const { |
671 // TODO(shishir): This is not completely reliable. Find a better way to detect | 675 // TODO(shishir): This is not completely reliable. Find a better way to detect |
672 // startup time. | 676 // startup time. |
673 return !browser_->GetActiveWebContents(); | 677 return !browser_->GetActiveWebContents(); |
674 } | 678 } |
675 | 679 |
676 InstantService* InstantController::GetInstantService() const { | 680 InstantService* InstantController::GetInstantService() const { |
677 return InstantServiceFactory::GetForProfile(profile()); | 681 return InstantServiceFactory::GetForProfile(profile()); |
678 } | 682 } |
OLD | NEW |