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 "components/history/core/browser/history_backend.h" | 5 #include "components/history/core/browser/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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 request_transition | ui::PAGE_TRANSITION_CHAIN_START | | 515 request_transition | ui::PAGE_TRANSITION_CHAIN_START | |
516 ui::PAGE_TRANSITION_CHAIN_END); | 516 ui::PAGE_TRANSITION_CHAIN_END); |
517 | 517 |
518 // No redirect case (one element means just the page itself). | 518 // No redirect case (one element means just the page itself). |
519 last_ids = AddPageVisit(request.url, request.time, last_ids.second, t, | 519 last_ids = AddPageVisit(request.url, request.time, last_ids.second, t, |
520 request.visit_source); | 520 request.visit_source); |
521 | 521 |
522 // Update the segment for this visit. KEYWORD_GENERATED visits should not | 522 // Update the segment for this visit. KEYWORD_GENERATED visits should not |
523 // result in changing most visited, so we don't update segments (most | 523 // result in changing most visited, so we don't update segments (most |
524 // visited db). | 524 // visited db). |
525 if (!is_keyword_generated) { | 525 if (!is_keyword_generated && request.consider_for_ntp_most_visited) { |
526 UpdateSegments(request.url, from_visit_id, last_ids.second, t, | 526 UpdateSegments(request.url, from_visit_id, last_ids.second, t, |
527 request.time); | 527 request.time); |
528 | 528 |
529 // Update the referrer's duration. | 529 // Update the referrer's duration. |
530 UpdateVisitDuration(from_visit_id, request.time); | 530 UpdateVisitDuration(from_visit_id, request.time); |
531 } | 531 } |
532 } else { | 532 } else { |
533 // Redirect case. Add the redirect chain. | 533 // Redirect case. Add the redirect chain. |
534 | 534 |
535 ui::PageTransition redirect_info = ui::PAGE_TRANSITION_CHAIN_START; | 535 ui::PageTransition redirect_info = ui::PAGE_TRANSITION_CHAIN_START; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 if (redirect_index == (redirects.size() - 1)) { | 585 if (redirect_index == (redirects.size() - 1)) { |
586 t = ui::PageTransitionFromInt(t | ui::PAGE_TRANSITION_CHAIN_END); | 586 t = ui::PageTransitionFromInt(t | ui::PAGE_TRANSITION_CHAIN_END); |
587 } | 587 } |
588 | 588 |
589 // Record all redirect visits with the same timestamp. We don't display | 589 // Record all redirect visits with the same timestamp. We don't display |
590 // them anyway, and if we ever decide to, we can reconstruct their order | 590 // them anyway, and if we ever decide to, we can reconstruct their order |
591 // from the redirect chain. | 591 // from the redirect chain. |
592 last_ids = AddPageVisit(redirects[redirect_index], request.time, | 592 last_ids = AddPageVisit(redirects[redirect_index], request.time, |
593 last_ids.second, t, request.visit_source); | 593 last_ids.second, t, request.visit_source); |
594 if (t & ui::PAGE_TRANSITION_CHAIN_START) { | 594 if (t & ui::PAGE_TRANSITION_CHAIN_START) { |
595 // Update the segment for this visit. | 595 if (request.consider_for_ntp_most_visited) { |
596 UpdateSegments(redirects[redirect_index], from_visit_id, | 596 UpdateSegments(redirects[redirect_index], from_visit_id, |
597 last_ids.second, t, request.time); | 597 last_ids.second, t, request.time); |
| 598 } |
598 | 599 |
599 // Update the visit_details for this visit. | 600 // Update the visit_details for this visit. |
600 UpdateVisitDuration(from_visit_id, request.time); | 601 UpdateVisitDuration(from_visit_id, request.time); |
601 } | 602 } |
602 | 603 |
603 // Subsequent transitions in the redirect list must all be server | 604 // Subsequent transitions in the redirect list must all be server |
604 // redirects. | 605 // redirects. |
605 redirect_info = ui::PAGE_TRANSITION_SERVER_REDIRECT; | 606 redirect_info = ui::PAGE_TRANSITION_SERVER_REDIRECT; |
606 } | 607 } |
607 | 608 |
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 // transaction is currently open. | 2649 // transaction is currently open. |
2649 db_->CommitTransaction(); | 2650 db_->CommitTransaction(); |
2650 db_->Vacuum(); | 2651 db_->Vacuum(); |
2651 db_->BeginTransaction(); | 2652 db_->BeginTransaction(); |
2652 db_->GetStartDate(&first_recorded_time_); | 2653 db_->GetStartDate(&first_recorded_time_); |
2653 | 2654 |
2654 return true; | 2655 return true; |
2655 } | 2656 } |
2656 | 2657 |
2657 } // namespace history | 2658 } // namespace history |
OLD | NEW |