| 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/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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 URLRow existing_url; | 785 URLRow existing_url; |
| 786 URLID url_id = db_->GetRowForURL(i->url(), &existing_url); | 786 URLID url_id = db_->GetRowForURL(i->url(), &existing_url); |
| 787 if (!url_id) { | 787 if (!url_id) { |
| 788 // Add the page if it doesn't exist. | 788 // Add the page if it doesn't exist. |
| 789 url_id = db_->AddURL(*i); | 789 url_id = db_->AddURL(*i); |
| 790 if (!url_id) { | 790 if (!url_id) { |
| 791 NOTREACHED() << "Could not add row to DB"; | 791 NOTREACHED() << "Could not add row to DB"; |
| 792 return; | 792 return; |
| 793 } | 793 } |
| 794 | 794 |
| 795 if (i->typed_count() > 0) { | 795 modified->changed_urls.push_back(*i); |
| 796 modified->changed_urls.push_back(*i); | 796 modified->changed_urls.back().set_id(url_id); // i->id_ is likely 0. |
| 797 modified->changed_urls.back().set_id(url_id); // i->id_ is likely 0. | |
| 798 } | |
| 799 } | 797 } |
| 800 | 798 |
| 801 // Sync code manages the visits itself. | 799 // Sync code manages the visits itself. |
| 802 if (visit_source != SOURCE_SYNCED) { | 800 if (visit_source != SOURCE_SYNCED) { |
| 803 // Make up a visit to correspond to the last visit to the page. | 801 // Make up a visit to correspond to the last visit to the page. |
| 804 VisitRow visit_info(url_id, i->last_visit(), 0, | 802 VisitRow visit_info(url_id, i->last_visit(), 0, |
| 805 content::PageTransitionFromInt( | 803 content::PageTransitionFromInt( |
| 806 content::PAGE_TRANSITION_LINK | | 804 content::PAGE_TRANSITION_LINK | |
| 807 content::PAGE_TRANSITION_CHAIN_START | | 805 content::PAGE_TRANSITION_CHAIN_START | |
| 808 content::PAGE_TRANSITION_CHAIN_END), 0); | 806 content::PAGE_TRANSITION_CHAIN_END), 0); |
| (...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2848 int rank = kPageVisitStatsMaxTopSites; | 2846 int rank = kPageVisitStatsMaxTopSites; |
| 2849 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); | 2847 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); |
| 2850 if (it != most_visited_urls_map_.end()) | 2848 if (it != most_visited_urls_map_.end()) |
| 2851 rank = (*it).second; | 2849 rank = (*it).second; |
| 2852 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", | 2850 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", |
| 2853 rank, kPageVisitStatsMaxTopSites + 1); | 2851 rank, kPageVisitStatsMaxTopSites + 1); |
| 2854 } | 2852 } |
| 2855 #endif | 2853 #endif |
| 2856 | 2854 |
| 2857 } // namespace history | 2855 } // namespace history |
| OLD | NEW |