| 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/ui/webui/ntp/suggestions_page_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 : got_first_suggestions_request_(false), | 42 : got_first_suggestions_request_(false), |
| 43 suggestions_viewed_(false), | 43 suggestions_viewed_(false), |
| 44 user_action_logged_(false) { | 44 user_action_logged_(false) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 SuggestionsHandler::~SuggestionsHandler() { | 47 SuggestionsHandler::~SuggestionsHandler() { |
| 48 if (!user_action_logged_ && suggestions_viewed_) { | 48 if (!user_action_logged_ && suggestions_viewed_) { |
| 49 const GURL ntp_url = GURL(chrome::kChromeUINewTabURL); | 49 const GURL ntp_url = GURL(chrome::kChromeUINewTabURL); |
| 50 int action_id = NTP_FOLLOW_ACTION_OTHER; | 50 int action_id = NTP_FOLLOW_ACTION_OTHER; |
| 51 content::NavigationEntry* entry = | 51 content::NavigationEntry* entry = |
| 52 web_ui()->GetWebContents()->GetController().GetActiveEntry(); | 52 web_ui()->GetWebContents()->GetController().GetVisibleEntry(); |
| 53 if (entry && (entry->GetURL() != ntp_url)) { | 53 if (entry && (entry->GetURL() != ntp_url)) { |
| 54 action_id = | 54 action_id = |
| 55 content::PageTransitionStripQualifier(entry->GetTransitionType()); | 55 content::PageTransitionStripQualifier(entry->GetTransitionType()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestedSitesAction", action_id, | 58 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestedSitesAction", action_id, |
| 59 NUM_NTP_FOLLOW_ACTIONS); | 59 NUM_NTP_FOLLOW_ACTIONS); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 std::string SuggestionsHandler::GetDictionaryKeyForURL(const std::string& url) { | 190 std::string SuggestionsHandler::GetDictionaryKeyForURL(const std::string& url) { |
| 191 return base::MD5String(url); | 191 return base::MD5String(url); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // static | 194 // static |
| 195 void SuggestionsHandler::RegisterProfilePrefs( | 195 void SuggestionsHandler::RegisterProfilePrefs( |
| 196 user_prefs::PrefRegistrySyncable* registry) { | 196 user_prefs::PrefRegistrySyncable* registry) { |
| 197 // TODO(georgey) add user preferences (such as own blacklist) as needed. | 197 // TODO(georgey) add user preferences (such as own blacklist) as needed. |
| 198 } | 198 } |
| OLD | NEW |