| 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/most_visited_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 most_visited_viewed_(false), | 57 most_visited_viewed_(false), |
| 58 user_action_logged_(false), | 58 user_action_logged_(false), |
| 59 weak_ptr_factory_(this) { | 59 weak_ptr_factory_(this) { |
| 60 } | 60 } |
| 61 | 61 |
| 62 MostVisitedHandler::~MostVisitedHandler() { | 62 MostVisitedHandler::~MostVisitedHandler() { |
| 63 if (!user_action_logged_ && most_visited_viewed_) { | 63 if (!user_action_logged_ && most_visited_viewed_) { |
| 64 const GURL ntp_url = GURL(chrome::kChromeUINewTabURL); | 64 const GURL ntp_url = GURL(chrome::kChromeUINewTabURL); |
| 65 int action_id = NTP_FOLLOW_ACTION_OTHER; | 65 int action_id = NTP_FOLLOW_ACTION_OTHER; |
| 66 content::NavigationEntry* entry = | 66 content::NavigationEntry* entry = |
| 67 web_ui()->GetWebContents()->GetController().GetActiveEntry(); | 67 web_ui()->GetWebContents()->GetController().GetVisibleEntry(); |
| 68 if (entry && (entry->GetURL() != ntp_url)) { | 68 if (entry && (entry->GetURL() != ntp_url)) { |
| 69 action_id = | 69 action_id = |
| 70 content::PageTransitionStripQualifier(entry->GetTransitionType()); | 70 content::PageTransitionStripQualifier(entry->GetTransitionType()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisitedAction", action_id, | 73 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisitedAction", action_id, |
| 74 NUM_NTP_FOLLOW_ACTIONS); | 74 NUM_NTP_FOLLOW_ACTIONS); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 #endif | 296 #endif |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 void MostVisitedHandler::RegisterProfilePrefs( | 300 void MostVisitedHandler::RegisterProfilePrefs( |
| 301 user_prefs::PrefRegistrySyncable* registry) { | 301 user_prefs::PrefRegistrySyncable* registry) { |
| 302 registry->RegisterDictionaryPref( | 302 registry->RegisterDictionaryPref( |
| 303 prefs::kNtpMostVisitedURLsBlacklist, | 303 prefs::kNtpMostVisitedURLsBlacklist, |
| 304 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 304 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 305 } | 305 } |
| OLD | NEW |