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 <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 ResetInstantTab(); | 1032 ResetInstantTab(); |
1033 } | 1033 } |
1034 | 1034 |
1035 void InstantController::TabDeactivated(content::WebContents* contents) { | 1035 void InstantController::TabDeactivated(content::WebContents* contents) { |
1036 LOG_INSTANT_DEBUG_EVENT(this, "TabDeactivated"); | 1036 LOG_INSTANT_DEBUG_EVENT(this, "TabDeactivated"); |
1037 if (extended_enabled() && !contents->IsBeingDestroyed()) | 1037 if (extended_enabled() && !contents->IsBeingDestroyed()) |
1038 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); | 1038 CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); |
1039 | 1039 |
1040 if (GetOverlayContents()) | 1040 if (GetOverlayContents()) |
1041 HideOverlay(); | 1041 HideOverlay(); |
| 1042 |
| 1043 // If user is deactivating an NTP tab, log the number of mouseovers for this |
| 1044 // NTP session. |
| 1045 if (chrome::IsInstantNTP(contents)) |
| 1046 InstantNTP::EmitMouseoverCount(contents); |
1042 } | 1047 } |
1043 | 1048 |
1044 void InstantController::SetInstantEnabled(bool instant_enabled, | 1049 void InstantController::SetInstantEnabled(bool instant_enabled, |
1045 bool use_local_page_only) { | 1050 bool use_local_page_only) { |
1046 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 1051 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
1047 "SetInstantEnabled: instant_enabled=%d, use_local_page_only=%d", | 1052 "SetInstantEnabled: instant_enabled=%d, use_local_page_only=%d", |
1048 instant_enabled, use_local_page_only)); | 1053 instant_enabled, use_local_page_only)); |
1049 | 1054 |
1050 // Non extended mode does not care about |use_local_page_only|. | 1055 // Non extended mode does not care about |use_local_page_only|. |
1051 if (instant_enabled == instant_enabled_ && | 1056 if (instant_enabled == instant_enabled_ && |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 | 1909 |
1905 bool InstantController::InStartup() const { | 1910 bool InstantController::InStartup() const { |
1906 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1911 // TODO(shishir): This is not completely reliable. Find a better way to detect |
1907 // startup time. | 1912 // startup time. |
1908 return !browser_->GetActiveWebContents(); | 1913 return !browser_->GetActiveWebContents(); |
1909 } | 1914 } |
1910 | 1915 |
1911 InstantService* InstantController::GetInstantService() const { | 1916 InstantService* InstantController::GetInstantService() const { |
1912 return InstantServiceFactory::GetForProfile(profile()); | 1917 return InstantServiceFactory::GetForProfile(profile()); |
1913 } | 1918 } |
OLD | NEW |