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

Side by Side Diff: chrome/browser/history/history_backend.cc

Issue 631253002: Refactor sending NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 NotifyVisitObservers(visit_info); 799 NotifyVisitObservers(visit_info);
800 800
801 if (visit_info.visit_time < first_recorded_time_) 801 if (visit_info.visit_time < first_recorded_time_)
802 first_recorded_time_ = visit_info.visit_time; 802 first_recorded_time_ = visit_info.visit_time;
803 803
804 // Broadcast a notification of the visit. 804 // Broadcast a notification of the visit.
805 if (visit_id) { 805 if (visit_id) {
806 if (typed_url_syncable_service_.get()) 806 if (typed_url_syncable_service_.get())
807 typed_url_syncable_service_->OnUrlVisited(transition, &url_info); 807 typed_url_syncable_service_->OnUrlVisited(transition, &url_info);
808 808
809 scoped_ptr<URLVisitedDetails> details(new URLVisitedDetails); 809 if (delegate_) {
810 details->transition = transition; 810 history::RedirectList redirects;
811 details->row = url_info; 811 // TODO(meelapshah) Disabled due to potential PageCycler regression.
812 details->visit_time = time; 812 // Re-enable this.
813 // TODO(meelapshah) Disabled due to potential PageCycler regression. 813 // QueryRedirectsTo(url, &redirects);
814 // Re-enable this. 814 delegate_->NotifyURLVisited(transition, url_info, redirects, time);
815 // QueryRedirectsTo(url, &details->redirects); 815 }
816 BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URL_VISITED,
817 details.PassAs<HistoryDetails>());
818 } else { 816 } else {
819 VLOG(0) << "Failed to build visit insert statement: " 817 VLOG(0) << "Failed to build visit insert statement: "
820 << "url_id = " << url_id; 818 << "url_id = " << url_id;
821 } 819 }
822 820
823 return std::make_pair(url_id, visit_id); 821 return std::make_pair(url_id, visit_id);
824 } 822 }
825 823
826 void HistoryBackend::AddPagesWithDetails(const URLRows& urls, 824 void HistoryBackend::AddPagesWithDetails(const URLRows& urls,
827 VisitSource visit_source) { 825 VisitSource visit_source) {
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 int rank = kPageVisitStatsMaxTopSites; 2701 int rank = kPageVisitStatsMaxTopSites;
2704 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2702 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2705 if (it != most_visited_urls_map_.end()) 2703 if (it != most_visited_urls_map_.end())
2706 rank = (*it).second; 2704 rank = (*it).second;
2707 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2705 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2708 rank, kPageVisitStatsMaxTopSites + 1); 2706 rank, kPageVisitStatsMaxTopSites + 1);
2709 } 2707 }
2710 #endif 2708 #endif
2711 2709
2712 } // namespace history 2710 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698