OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // transition to client redirect. | 395 // transition to client redirect. |
396 // | 396 // |
397 // The referrer is invalid when restoring a session that features an | 397 // The referrer is invalid when restoring a session that features an |
398 // https tab that redirects to a different host or to http. In this | 398 // https tab that redirects to a different host or to http. In this |
399 // case we don't need to reconnect the new redirect with the existing | 399 // case we don't need to reconnect the new redirect with the existing |
400 // chain. | 400 // chain. |
401 if (request->referrer.is_valid()) { | 401 if (request->referrer.is_valid()) { |
402 DCHECK(request->referrer == request->redirects[0]); | 402 DCHECK(request->referrer == request->redirects[0]); |
403 request->redirects.erase(request->redirects.begin()); | 403 request->redirects.erase(request->redirects.begin()); |
404 | 404 |
405 // Make sure to remove the CHAIN_END marker from the first visit. This | 405 // If the navigation entry for this visit has replaced that for the |
| 406 // first visit, remove the CHAIN_END marker from the first visit. This |
406 // can be called a lot, for example, the page cycler, and most of the | 407 // can be called a lot, for example, the page cycler, and most of the |
407 // time we won't have changed anything. | 408 // time we won't have changed anything. |
408 // TODO(brettw) this should be unit tested. | |
409 VisitRow visit_row; | 409 VisitRow visit_row; |
410 if (db_->GetRowForVisit(last_ids.second, &visit_row) && | 410 if (request->did_replace_entry && |
| 411 db_->GetRowForVisit(last_ids.second, &visit_row) && |
411 visit_row.transition | PageTransition::CHAIN_END) { | 412 visit_row.transition | PageTransition::CHAIN_END) { |
412 visit_row.transition &= ~PageTransition::CHAIN_END; | 413 visit_row.transition &= ~PageTransition::CHAIN_END; |
413 db_->UpdateVisitRow(visit_row); | 414 db_->UpdateVisitRow(visit_row); |
414 } | 415 } |
415 } | 416 } |
416 } | 417 } |
417 | 418 |
418 for (size_t redirect_index = 0; redirect_index < request->redirects.size(); | 419 for (size_t redirect_index = 0; redirect_index < request->redirects.size(); |
419 redirect_index++) { | 420 redirect_index++) { |
420 PageTransition::Type t = transition | redirect_info; | 421 PageTransition::Type t = transition | redirect_info; |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 return true; | 1905 return true; |
1905 } | 1906 } |
1906 | 1907 |
1907 BookmarkService* HistoryBackend::GetBookmarkService() { | 1908 BookmarkService* HistoryBackend::GetBookmarkService() { |
1908 if (bookmark_service_) | 1909 if (bookmark_service_) |
1909 bookmark_service_->BlockTillLoaded(); | 1910 bookmark_service_->BlockTillLoaded(); |
1910 return bookmark_service_; | 1911 return bookmark_service_; |
1911 } | 1912 } |
1912 | 1913 |
1913 } // namespace history | 1914 } // namespace history |
OLD | NEW |