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

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

Issue 1248613003: Issue 501916 : Add data type counts to profile deletion flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Third draft - removed all password manager code Created 5 years, 4 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/visit_database.h" 5 #include "components/history/core/browser/visit_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 529 }
530 530
531 if (!statement.Succeeded()) 531 if (!statement.Succeeded())
532 return false; 532 return false;
533 533
534 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0)); 534 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0));
535 *count = statement.ColumnInt(1); 535 *count = statement.ColumnInt(1);
536 return true; 536 return true;
537 } 537 }
538 538
539 int VisitDatabase::GetCountOfURLsWithVisibleVisit() {
msramek 2015/07/29 13:55:01 In the Clear Browsing Data dialog, we decided to g
lwchkg 2015/07/29 14:46:05 I see. It means if "www.google.com" was visited in
540 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
541 "SELECT COUNT(*) FROM ("
542 "SELECT DISTINCT url FROM visits "
543 "WHERE (transition & ?) != 0 " // CHAIN_END
544 "AND (transition & ?) NOT IN (?, ?, ?)" // NO SUBFRAME or
545 // KEYWORD_GENERATED
546 ")"));
547
548 statement.BindInt(0, ui::PAGE_TRANSITION_CHAIN_END);
549 statement.BindInt(1, ui::PAGE_TRANSITION_CORE_MASK);
550 statement.BindInt(2, ui::PAGE_TRANSITION_AUTO_SUBFRAME);
551 statement.BindInt(3, ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
552 statement.BindInt(4, ui::PAGE_TRANSITION_KEYWORD_GENERATED);
553
554 statement.Step();
555 return statement.ColumnInt(0);
556 }
557
539 bool VisitDatabase::GetStartDate(base::Time* first_visit) { 558 bool VisitDatabase::GetStartDate(base::Time* first_visit) {
540 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 559 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
541 "SELECT MIN(visit_time) FROM visits WHERE visit_time != 0")); 560 "SELECT MIN(visit_time) FROM visits WHERE visit_time != 0"));
542 if (!statement.Step() || statement.ColumnInt64(0) == 0) { 561 if (!statement.Step() || statement.ColumnInt64(0) == 0) {
543 *first_visit = base::Time::Now(); 562 *first_visit = base::Time::Now();
544 return false; 563 return false;
545 } 564 }
546 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0)); 565 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0));
547 return true; 566 return true;
548 } 567 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 // Old versions don't have the visit_duration column, we modify the table 612 // Old versions don't have the visit_duration column, we modify the table
594 // to add that field. 613 // to add that field.
595 if (!GetDB().Execute("ALTER TABLE visits " 614 if (!GetDB().Execute("ALTER TABLE visits "
596 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL")) 615 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL"))
597 return false; 616 return false;
598 } 617 }
599 return true; 618 return true;
600 } 619 }
601 620
602 } // namespace history 621 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698