Chromium Code Reviews| 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 "chrome/browser/history/url_index_private_data.h" | 5 #include "chrome/browser/history/url_index_private_data.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 // This new row should be indexed if it qualifies. | 349 // This new row should be indexed if it qualifies. |
| 350 URLRow new_row(row); | 350 URLRow new_row(row); |
| 351 new_row.set_id(row_id); | 351 new_row.set_id(row_id); |
| 352 row_was_updated = RowQualifiesAsSignificant(new_row, base::Time()) && | 352 row_was_updated = RowQualifiesAsSignificant(new_row, base::Time()) && |
| 353 IndexRow(new_row, languages, scheme_whitelist); | 353 IndexRow(new_row, languages, scheme_whitelist); |
| 354 } else if (RowQualifiesAsSignificant(row, base::Time())) { | 354 } else if (RowQualifiesAsSignificant(row, base::Time())) { |
| 355 // This indexed row still qualifies and will be re-indexed. | 355 // This indexed row still qualifies and will be re-indexed. |
| 356 // The url won't have changed but the title, visit count, etc. | 356 // The url won't have changed but the title, visit count, etc. |
| 357 // might have changed. | 357 // might have changed. |
| 358 URLRow& row_to_update = row_pos->second; | 358 URLRow& row_to_update = row_pos->second; |
| 359 bool title_updated = row_to_update.title() != row.title(); | 359 // Ignore title changes where new title is empty. (See bug 102957.) |
|
Peter Kasting
2012/04/10 02:18:57
Nit: Instead of referring to a bug, can you put a
mrossetti
2012/04/11 19:38:55
Removed the test for empty(). I cannot now recreat
| |
| 360 bool title_updated = row_to_update.title() != row.title() && | |
| 361 !row.title().empty(); | |
| 360 if (row_to_update.visit_count() != row.visit_count() || | 362 if (row_to_update.visit_count() != row.visit_count() || |
| 361 row_to_update.typed_count() != row.typed_count() || | 363 row_to_update.typed_count() != row.typed_count() || |
| 362 row_to_update.last_visit() != row.last_visit() || title_updated) { | 364 row_to_update.last_visit() != row.last_visit() || title_updated) { |
| 363 row_to_update.set_visit_count(row.visit_count()); | 365 row_to_update.set_visit_count(row.visit_count()); |
| 364 row_to_update.set_typed_count(row.typed_count()); | 366 row_to_update.set_typed_count(row.typed_count()); |
| 365 row_to_update.set_last_visit(row.last_visit()); | 367 row_to_update.set_last_visit(row.last_visit()); |
| 366 // While the URL is guaranteed to remain stable, the title may have | 368 // While the URL is guaranteed to remain stable, the title may have |
| 367 // changed. If so, then update the index with the changed words. | 369 // changed. If so, then update the index with the changed words. |
| 368 if (title_updated) { | 370 if (title_updated) { |
| 369 // Clear all words associated with this row and re-index both the | 371 // Clear all words associated with this row and re-index both the |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1344 } | 1346 } |
| 1345 | 1347 |
| 1346 // static | 1348 // static |
| 1347 bool URLIndexPrivateData::URLSchemeIsWhitelisted( | 1349 bool URLIndexPrivateData::URLSchemeIsWhitelisted( |
| 1348 const GURL& gurl, | 1350 const GURL& gurl, |
| 1349 const std::set<std::string>& whitelist) { | 1351 const std::set<std::string>& whitelist) { |
| 1350 return whitelist.find(gurl.scheme()) != whitelist.end(); | 1352 return whitelist.find(gurl.scheme()) != whitelist.end(); |
| 1351 } | 1353 } |
| 1352 | 1354 |
| 1353 } // namespace history | 1355 } // namespace history |
| OLD | NEW |