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

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 2338133006: [NTP] Fix article suggestion clicks contributing to Most Visited tiles (Closed)
Patch Set: Addressed comments: new comment, arg naming. Created 4 years, 3 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 "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
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
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 // Update the segment for this visit.
sky 2016/09/16 17:18:51 This comment belongs inside the if, but the commen
mastiz 2016/09/16 17:58:20 Done.
596 UpdateSegments(redirects[redirect_index], from_visit_id, 596 if (request.consider_for_ntp_most_visited) {
597 last_ids.second, t, request.time); 597 UpdateSegments(redirects[redirect_index], from_visit_id,
598 last_ids.second, t, request.time);
599 }
598 600
599 // Update the visit_details for this visit. 601 // Update the visit_details for this visit.
600 UpdateVisitDuration(from_visit_id, request.time); 602 UpdateVisitDuration(from_visit_id, request.time);
601 } 603 }
602 604
603 // Subsequent transitions in the redirect list must all be server 605 // Subsequent transitions in the redirect list must all be server
604 // redirects. 606 // redirects.
605 redirect_info = ui::PAGE_TRANSITION_SERVER_REDIRECT; 607 redirect_info = ui::PAGE_TRANSITION_SERVER_REDIRECT;
606 } 608 }
607 609
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 // transaction is currently open. 2650 // transaction is currently open.
2649 db_->CommitTransaction(); 2651 db_->CommitTransaction();
2650 db_->Vacuum(); 2652 db_->Vacuum();
2651 db_->BeginTransaction(); 2653 db_->BeginTransaction();
2652 db_->GetStartDate(&first_recorded_time_); 2654 db_->GetStartDate(&first_recorded_time_);
2653 2655
2654 return true; 2656 return true;
2655 } 2657 }
2656 2658
2657 } // namespace history 2659 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698