Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/bookmarks/bookmark_index.h" | 5 #include "chrome/browser/bookmarks/bookmark_index.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 &NodeTypedCountPairSortFunc); | 122 &NodeTypedCountPairSortFunc); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void BookmarkIndex::ExtractBookmarkNodePairs( | 125 void BookmarkIndex::ExtractBookmarkNodePairs( |
| 126 history::URLDatabase* url_db, | 126 history::URLDatabase* url_db, |
| 127 const Match& match, | 127 const Match& match, |
| 128 NodeTypedCountPairs* node_typed_counts) const { | 128 NodeTypedCountPairs* node_typed_counts) const { |
| 129 | 129 |
| 130 for (NodeSet::const_iterator i = match.nodes_begin(); | 130 for (NodeSet::const_iterator i = match.nodes_begin(); |
| 131 i != match.nodes_end(); ++i) { | 131 i != match.nodes_end(); ++i) { |
| 132 history::URLRow url; | 132 int typed_count = 0; |
|
Lei Zhang
2011/03/11 01:09:35
Sorry, not familiar with this code either. See not
Sheridan Rawlins
2011/03/11 01:39:49
reverted
| |
| 133 if (url_db) | 133 if (url_db) { |
| 134 url_db->GetRowForURL((*i)->GetURL(), &url); | 134 history::URLRow url; |
| 135 NodeTypedCountPair pair(*i, url.typed_count()); | 135 if (url_db->GetRowForURL((*i)->GetURL(), &url)) |
| 136 typed_count = url.typed_count(); | |
| 137 } | |
| 138 NodeTypedCountPair pair(*i, typed_count); | |
| 136 node_typed_counts->push_back(pair); | 139 node_typed_counts->push_back(pair); |
| 137 } | 140 } |
| 138 } | 141 } |
| 139 | 142 |
| 140 void BookmarkIndex::AddMatchToResults( | 143 void BookmarkIndex::AddMatchToResults( |
| 141 const BookmarkNode* node, | 144 const BookmarkNode* node, |
| 142 QueryParser* parser, | 145 QueryParser* parser, |
| 143 const std::vector<QueryNode*>& query_nodes, | 146 const std::vector<QueryNode*>& query_nodes, |
| 144 std::vector<bookmark_utils::TitleMatch>* results) { | 147 std::vector<bookmark_utils::TitleMatch>* results) { |
| 145 bookmark_utils::TitleMatch title_match; | 148 bookmark_utils::TitleMatch title_match; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 Index::iterator i = index_.find(term); | 265 Index::iterator i = index_.find(term); |
| 263 if (i == index_.end()) { | 266 if (i == index_.end()) { |
| 264 // We can get here if the node has the same term more than once. For | 267 // We can get here if the node has the same term more than once. For |
| 265 // example, a bookmark with the title 'foo foo' would end up here. | 268 // example, a bookmark with the title 'foo foo' would end up here. |
| 266 return; | 269 return; |
| 267 } | 270 } |
| 268 i->second.erase(node); | 271 i->second.erase(node); |
| 269 if (i->second.empty()) | 272 if (i->second.empty()) |
| 270 index_.erase(i); | 273 index_.erase(i); |
| 271 } | 274 } |
| OLD | NEW |