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 "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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 | 486 |
| 487 // If the user is adding older history, we need to make sure our times | 487 // If the user is adding older history, we need to make sure our times |
| 488 // are correct. | 488 // are correct. |
| 489 if (request.time < first_recorded_time_) | 489 if (request.time < first_recorded_time_) |
| 490 first_recorded_time_ = request.time; | 490 first_recorded_time_ = request.time; |
| 491 | 491 |
| 492 ui::PageTransition request_transition = request.transition; | 492 ui::PageTransition request_transition = request.transition; |
| 493 bool is_keyword_generated = ui::PageTransitionCoreTypeIs( | 493 bool is_keyword_generated = ui::PageTransitionCoreTypeIs( |
| 494 request_transition, ui::PAGE_TRANSITION_KEYWORD_GENERATED); | 494 request_transition, ui::PAGE_TRANSITION_KEYWORD_GENERATED); |
| 495 | 495 |
| 496 bool has_redirects = request.redirects.size() > 1; | |
| 497 | |
| 498 // data: scheme is sometimes used in combination with AUTO_BOOKMARK to fake a | |
| 499 // redirect as way to make sure it doesn't show up in most visited. Such | |
| 500 // entries should be ignored for the purpose of history (including omnibox | |
| 501 // autocomplete and most visited). | |
| 502 if (!has_redirects && | |
|
sky
2016/09/14 18:01:51
Wouldn't this mean the page won't show up in histo
mastiz
2016/09/14 18:10:18
The article itself (redirectee) gets listed in his
sky
2016/09/14 18:17:49
I believe this change would make it so data urls a
mastiz
2016/09/14 18:22:02
More specifically, data URLs with AUTO_BOOKMARK (n
mastiz
2016/09/14 18:40:47
Also, would it be any better if we left FROM_ADDRE
| |
| 503 ui::PageTransitionCoreTypeIs(request_transition, | |
| 504 ui::PAGE_TRANSITION_AUTO_BOOKMARK) && | |
| 505 request.url.SchemeIs(url::kDataScheme)) { | |
| 506 return; | |
| 507 } | |
| 508 | |
| 496 // If the user is navigating to a not-previously-typed intranet hostname, | 509 // If the user is navigating to a not-previously-typed intranet hostname, |
| 497 // change the transition to TYPED so that the omnibox will learn that this is | 510 // change the transition to TYPED so that the omnibox will learn that this is |
| 498 // a known host. | 511 // a known host. |
| 499 bool has_redirects = request.redirects.size() > 1; | |
| 500 if (ui::PageTransitionIsMainFrame(request_transition) && | 512 if (ui::PageTransitionIsMainFrame(request_transition) && |
| 501 !ui::PageTransitionCoreTypeIs(request_transition, | 513 !ui::PageTransitionCoreTypeIs(request_transition, |
| 502 ui::PAGE_TRANSITION_TYPED) && | 514 ui::PAGE_TRANSITION_TYPED) && |
| 503 !is_keyword_generated) { | 515 !is_keyword_generated) { |
| 504 const GURL& origin_url(has_redirects ? request.redirects[0] : request.url); | 516 const GURL& origin_url(has_redirects ? request.redirects[0] : request.url); |
| 505 if (origin_url.SchemeIs(url::kHttpScheme) || | 517 if (origin_url.SchemeIs(url::kHttpScheme) || |
| 506 origin_url.SchemeIs(url::kHttpsScheme) || | 518 origin_url.SchemeIs(url::kHttpsScheme) || |
| 507 origin_url.SchemeIs(url::kFtpScheme)) { | 519 origin_url.SchemeIs(url::kFtpScheme)) { |
| 508 std::string host(origin_url.host()); | 520 std::string host(origin_url.host()); |
| 509 size_t registry_length = | 521 size_t registry_length = |
| (...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2668 // transaction is currently open. | 2680 // transaction is currently open. |
| 2669 db_->CommitTransaction(); | 2681 db_->CommitTransaction(); |
| 2670 db_->Vacuum(); | 2682 db_->Vacuum(); |
| 2671 db_->BeginTransaction(); | 2683 db_->BeginTransaction(); |
| 2672 db_->GetStartDate(&first_recorded_time_); | 2684 db_->GetStartDate(&first_recorded_time_); |
| 2673 | 2685 |
| 2674 return true; | 2686 return true; |
| 2675 } | 2687 } |
| 2676 | 2688 |
| 2677 } // namespace history | 2689 } // namespace history |
| OLD | NEW |