| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/histogram.h" | 11 #include "base/histogram.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "chrome/browser/autocomplete/history_url_provider.h" | 16 #include "chrome/browser/autocomplete/history_url_provider.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_service.h" | 17 #include "chrome/browser/bookmarks/bookmark_service.h" |
| 18 #include "chrome/browser/history/download_types.h" | 18 #include "chrome/browser/history/download_types.h" |
| 19 #include "chrome/browser/history/history_publisher.h" | 19 #include "chrome/browser/history/history_publisher.h" |
| 20 #include "chrome/browser/history/in_memory_history_backend.h" | 20 #include "chrome/browser/history/in_memory_history_backend.h" |
| 21 #include "chrome/browser/history/page_usage_data.h" | 21 #include "chrome/browser/history/page_usage_data.h" |
| 22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/notification_type.h" | 23 #include "chrome/common/notification_type.h" |
| 24 #include "chrome/common/sqlite_utils.h" | 24 #include "chrome/common/sqlite_utils.h" |
| 25 #include "chrome/common/url_constants.h" |
| 25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 26 #include "net/base/registry_controlled_domain.h" | 27 #include "net/base/registry_controlled_domain.h" |
| 27 | 28 |
| 28 using base::Time; | 29 using base::Time; |
| 29 using base::TimeDelta; | 30 using base::TimeDelta; |
| 30 using base::TimeTicks; | 31 using base::TimeTicks; |
| 31 | 32 |
| 32 /* The HistoryBackend consists of a number of components: | 33 /* The HistoryBackend consists of a number of components: |
| 33 | 34 |
| 34 HistoryDatabase (stores past 3 months of history) | 35 HistoryDatabase (stores past 3 months of history) |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // Update the segment for this visit. | 362 // Update the segment for this visit. |
| 362 UpdateSegments(request->url, from_visit_id, last_ids.second, t, | 363 UpdateSegments(request->url, from_visit_id, last_ids.second, t, |
| 363 last_recorded_time_); | 364 last_recorded_time_); |
| 364 } else { | 365 } else { |
| 365 // Redirect case. Add the redirect chain. | 366 // Redirect case. Add the redirect chain. |
| 366 PageTransition::Type transition = | 367 PageTransition::Type transition = |
| 367 PageTransition::StripQualifier(request->transition); | 368 PageTransition::StripQualifier(request->transition); |
| 368 | 369 |
| 369 PageTransition::Type redirect_info = PageTransition::CHAIN_START; | 370 PageTransition::Type redirect_info = PageTransition::CHAIN_START; |
| 370 | 371 |
| 371 if (request->redirects[0].SchemeIs("about")) { | 372 if (request->redirects[0].SchemeIs(chrome::kAboutScheme)) { |
| 372 // When the redirect source + referrer is "about" we skip it. This | 373 // When the redirect source + referrer is "about" we skip it. This |
| 373 // happens when a page opens a new frame/window to about:blank and then | 374 // happens when a page opens a new frame/window to about:blank and then |
| 374 // script sets the URL to somewhere else (used to hide the referrer). It | 375 // script sets the URL to somewhere else (used to hide the referrer). It |
| 375 // would be nice to keep all these redirects properly but we don't ever | 376 // would be nice to keep all these redirects properly but we don't ever |
| 376 // see the initial about:blank load, so we don't know where the | 377 // see the initial about:blank load, so we don't know where the |
| 377 // subsequent client redirect came from. | 378 // subsequent client redirect came from. |
| 378 // | 379 // |
| 379 // In this case, we just don't bother hooking up the source of the | 380 // In this case, we just don't bother hooking up the source of the |
| 380 // redirects, so we remove it. | 381 // redirects, so we remove it. |
| 381 request->redirects.erase(request->redirects.begin()); | 382 request->redirects.erase(request->redirects.begin()); |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 return true; | 1825 return true; |
| 1825 } | 1826 } |
| 1826 | 1827 |
| 1827 BookmarkService* HistoryBackend::GetBookmarkService() { | 1828 BookmarkService* HistoryBackend::GetBookmarkService() { |
| 1828 if (bookmark_service_) | 1829 if (bookmark_service_) |
| 1829 bookmark_service_->BlockTillLoaded(); | 1830 bookmark_service_->BlockTillLoaded(); |
| 1830 return bookmark_service_; | 1831 return bookmark_service_; |
| 1831 } | 1832 } |
| 1832 | 1833 |
| 1833 } // namespace history | 1834 } // namespace history |
| OLD | NEW |