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

Side by Side Diff: chrome/browser/ui/search/instant_controller.cc

Issue 17526008: Log NTP hovers in 1993 clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Edited histogram summary Created 7 years, 5 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 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
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 (ntp_ && (chrome::MatchesOriginAndPath(
Jered 2013/06/28 16:24:17 Instead, say if (chrome::IsInstantNTP(contents))
annark1 2013/06/28 18:38:22 Done.
1046 GURL(GetInstantURL()), contents->GetURL()) ||
1047 chrome::MatchesOriginAndPath(
1048 GURL(GetLocalInstantURL()), contents->GetURL()))) {
1049 ntp_->LogTotalMouseovers(contents);
Jered 2013/06/28 16:24:17 ntp_ is a preloaded new tab page, not the one that
annark1 2013/06/28 18:38:22 Done.
1050 }
1042 } 1051 }
1043 1052
1044 void InstantController::SetInstantEnabled(bool instant_enabled, 1053 void InstantController::SetInstantEnabled(bool instant_enabled,
1045 bool use_local_page_only) { 1054 bool use_local_page_only) {
1046 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( 1055 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf(
1047 "SetInstantEnabled: instant_enabled=%d, use_local_page_only=%d", 1056 "SetInstantEnabled: instant_enabled=%d, use_local_page_only=%d",
1048 instant_enabled, use_local_page_only)); 1057 instant_enabled, use_local_page_only));
1049 1058
1050 // Non extended mode does not care about |use_local_page_only|. 1059 // Non extended mode does not care about |use_local_page_only|.
1051 if (instant_enabled == instant_enabled_ && 1060 if (instant_enabled == instant_enabled_ &&
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 result->relevance = match.relevance; 1881 result->relevance = match.relevance;
1873 result->autocomplete_match_index = autocomplete_match_index; 1882 result->autocomplete_match_index = autocomplete_match_index;
1874 1883
1875 DVLOG(1) << " " << result->relevance << " " 1884 DVLOG(1) << " " << result->relevance << " "
1876 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " " 1885 << UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " "
1877 << result->provider << " " << result->destination_url << " '" 1886 << result->provider << " " << result->destination_url << " '"
1878 << result->description << "' '" << result->search_query << "' " 1887 << result->description << "' '" << result->search_query << "' "
1879 << result->transition << " " << result->autocomplete_match_index; 1888 << result->transition << " " << result->autocomplete_match_index;
1880 } 1889 }
1881 1890
1891 void InstantController::LogIframeHover() {
Jered 2013/06/28 16:24:17 Omit this method on InstantController. Handle this
annark1 2013/06/28 18:38:22 Done.
1892 if (!browser_ || !browser_->GetActiveWebContents() || !ntp_)
1893 return;
1894
1895 ntp_->LogIframeHover(browser_->GetActiveWebContents());
1896 }
1897
1882 bool InstantController::IsJavascriptEnabled() const { 1898 bool InstantController::IsJavascriptEnabled() const {
1883 GURL instant_url(GetInstantURL()); 1899 GURL instant_url(GetInstantURL());
1884 GURL origin(instant_url.GetOrigin()); 1900 GURL origin(instant_url.GetOrigin());
1885 ContentSetting js_setting = profile()->GetHostContentSettingsMap()-> 1901 ContentSetting js_setting = profile()->GetHostContentSettingsMap()->
1886 GetContentSetting(origin, origin, CONTENT_SETTINGS_TYPE_JAVASCRIPT, 1902 GetContentSetting(origin, origin, CONTENT_SETTINGS_TYPE_JAVASCRIPT,
1887 NO_RESOURCE_IDENTIFIER); 1903 NO_RESOURCE_IDENTIFIER);
1888 // Javascript can be disabled either in content settings or via a WebKit 1904 // Javascript can be disabled either in content settings or via a WebKit
1889 // preference, so check both. Disabling it through the Settings page affects 1905 // preference, so check both. Disabling it through the Settings page affects
1890 // content settings. I'm not sure how to disable the WebKit preference, but 1906 // content settings. I'm not sure how to disable the WebKit preference, but
1891 // it's theoretically possible some users have it off. 1907 // it's theoretically possible some users have it off.
1892 bool js_content_enabled = 1908 bool js_content_enabled =
1893 js_setting == CONTENT_SETTING_DEFAULT || 1909 js_setting == CONTENT_SETTING_DEFAULT ||
1894 js_setting == CONTENT_SETTING_ALLOW; 1910 js_setting == CONTENT_SETTING_ALLOW;
1895 bool js_webkit_enabled = profile()->GetPrefs()->GetBoolean( 1911 bool js_webkit_enabled = profile()->GetPrefs()->GetBoolean(
1896 prefs::kWebKitJavascriptEnabled); 1912 prefs::kWebKitJavascriptEnabled);
1897 return js_content_enabled && js_webkit_enabled; 1913 return js_content_enabled && js_webkit_enabled;
1898 } 1914 }
1899 1915
1900 bool InstantController::InStartup() const { 1916 bool InstantController::InStartup() const {
1901 // TODO(shishir): This is not completely reliable. Find a better way to detect 1917 // TODO(shishir): This is not completely reliable. Find a better way to detect
1902 // startup time. 1918 // startup time.
1903 return !browser_->GetActiveWebContents(); 1919 return !browser_->GetActiveWebContents();
1904 } 1920 }
1905 1921
1906 InstantService* InstantController::GetInstantService() const { 1922 InstantService* InstantController::GetInstantService() const {
1907 return InstantServiceFactory::GetForProfile(profile()); 1923 return InstantServiceFactory::GetForProfile(profile());
1908 } 1924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698