| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/url_row.h" | 5 #include "components/history/core/browser/url_row.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 namespace history { | 9 namespace history { |
| 10 | 10 |
| 11 URLRow::URLRow() { | 11 URLRow::URLRow() { |
| 12 Initialize(); | 12 Initialize(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 URLRow::URLRow(const GURL& url) : url_(url) { | 15 URLRow::URLRow(const GURL& url) : url_(url) { |
| 16 // Initialize will not set the URL, so our initialization above will stay. | 16 // Initialize will not set the URL, so our initialization above will stay. |
| 17 Initialize(); | 17 Initialize(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 URLRow::URLRow(const GURL& url, URLID id) : url_(url) { | 20 URLRow::URLRow(const GURL& url, URLID id) : url_(url) { |
| 21 // Initialize will not set the URL, so our initialization above will stay. | 21 // Initialize will not set the URL, so our initialization above will stay. |
| 22 Initialize(); | 22 Initialize(); |
| 23 // Initialize will zero the id_, so set it here. | 23 // Initialize will zero the id_, so set it here. |
| 24 id_ = id; | 24 id_ = id; |
| 25 } | 25 } |
| 26 | 26 |
| 27 URLRow::URLRow(const URLRow& other) = default; |
| 28 |
| 27 URLRow::~URLRow() { | 29 URLRow::~URLRow() { |
| 28 } | 30 } |
| 29 | 31 |
| 30 URLRow& URLRow::operator=(const URLRow& other) { | 32 URLRow& URLRow::operator=(const URLRow& other) { |
| 31 if (this == &other) | 33 if (this == &other) |
| 32 return *this; | 34 return *this; |
| 33 id_ = other.id_; | 35 id_ = other.id_; |
| 34 url_ = other.url_; | 36 url_ = other.url_; |
| 35 title_ = other.title_; | 37 title_ = other.title_; |
| 36 visit_count_ = other.visit_count_; | 38 visit_count_ = other.visit_count_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 URLResult::URLResult(const GURL& url, | 74 URLResult::URLResult(const GURL& url, |
| 73 const query_parser::Snippet::MatchPositions& title_matches) | 75 const query_parser::Snippet::MatchPositions& title_matches) |
| 74 : URLRow(url) { | 76 : URLRow(url) { |
| 75 title_match_positions_ = title_matches; | 77 title_match_positions_ = title_matches; |
| 76 } | 78 } |
| 77 URLResult::URLResult(const URLRow& url_row) | 79 URLResult::URLResult(const URLRow& url_row) |
| 78 : URLRow(url_row), | 80 : URLRow(url_row), |
| 79 blocked_visit_(false) { | 81 blocked_visit_(false) { |
| 80 } | 82 } |
| 81 | 83 |
| 84 URLResult::URLResult(const URLResult& other) = default; |
| 85 |
| 82 URLResult::~URLResult() { | 86 URLResult::~URLResult() { |
| 83 } | 87 } |
| 84 | 88 |
| 85 void URLResult::SwapResult(URLResult* other) { | 89 void URLResult::SwapResult(URLResult* other) { |
| 86 URLRow::Swap(other); | 90 URLRow::Swap(other); |
| 87 std::swap(visit_time_, other->visit_time_); | 91 std::swap(visit_time_, other->visit_time_); |
| 88 snippet_.Swap(&other->snippet_); | 92 snippet_.Swap(&other->snippet_); |
| 89 title_match_positions_.swap(other->title_match_positions_); | 93 title_match_positions_.swap(other->title_match_positions_); |
| 90 std::swap(blocked_visit_, other->blocked_visit_); | 94 std::swap(blocked_visit_, other->blocked_visit_); |
| 91 } | 95 } |
| 92 | 96 |
| 93 // static | 97 // static |
| 94 bool URLResult::CompareVisitTime(const URLResult& lhs, const URLResult& rhs) { | 98 bool URLResult::CompareVisitTime(const URLResult& lhs, const URLResult& rhs) { |
| 95 return lhs.visit_time() > rhs.visit_time(); | 99 return lhs.visit_time() > rhs.visit_time(); |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace history | 102 } // namespace history |
| OLD | NEW |