| Index: chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc
|
| diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc
|
| index ed9ffecdd5a48f8234fd3792ee458abd4124dcc0..af9eb0219901c44850454f5a63753adf63b26f0e 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc
|
| @@ -165,7 +165,7 @@ void SafeBrowsingNavigationObserverManager::RecordHostToIpMapping(
|
| // host_to_ip_map already contains this key.
|
| // If this IP is already in the vector, we update its timestamp.
|
| for (auto& vector_entry : insert_result.first->second) {
|
| - if (vector_entry.ip == host) {
|
| + if (vector_entry.ip == ip) {
|
| vector_entry.timestamp = base::Time::Now();
|
| return;
|
| }
|
| @@ -304,7 +304,6 @@ void SafeBrowsingNavigationObserverManager::RecordRetargeting(
|
| SafeBrowsingNavigationObserverManager::ClearEmptyRef(
|
| source_contents->GetLastCommittedURL());
|
| nav_event.original_request_url = target_url;
|
| - nav_event.destination_url = target_url;
|
| nav_event.target_tab_id = SessionTabHelper::IdForTab(target_contents);
|
| nav_event.frame_id = rfh ? rfh->GetFrameTreeNodeId() : -1;
|
| auto it = user_gesture_map_.find(source_contents);
|
| @@ -397,7 +396,7 @@ NavigationEvent* SafeBrowsingNavigationObserverManager::FindNavigationEvent(
|
| // the vector in reverse order to get the latest match.
|
| for (auto rit = it->second.rbegin(); rit != it->second.rend(); ++rit) {
|
| // If tab id is not valid, we only compare url, otherwise we compare both.
|
| - if (rit->destination_url == search_url &&
|
| + if (rit->GetDestinationUrl() == search_url &&
|
| (target_tab_id == -1 || rit->target_tab_id == target_tab_id)) {
|
| // If both source_url and source_main_frame_url are empty, and this
|
| // navigation is not triggered by user, a retargeting navigation probably
|
| @@ -416,7 +415,8 @@ NavigationEvent* SafeBrowsingNavigationObserverManager::FindNavigationEvent(
|
| return nullptr;
|
| // Adjust retargeting navigation event's attributes.
|
| retargeting_nav_event->has_server_redirect = true;
|
| - retargeting_nav_event->destination_url = search_url;
|
| + retargeting_nav_event->server_redirect_urls.push_back(
|
| + std::move(search_url));
|
| return retargeting_nav_event;
|
| } else {
|
| continue;
|
| @@ -435,9 +435,10 @@ void SafeBrowsingNavigationObserverManager::AddToReferrerChain(
|
| ReferrerChainEntry::URLType type) {
|
| std::unique_ptr<ReferrerChainEntry> referrer_chain_entry =
|
| base::MakeUnique<ReferrerChainEntry>();
|
| - referrer_chain_entry->set_url(nav_event->destination_url.spec());
|
| + const GURL destination_url = nav_event->GetDestinationUrl();
|
| + referrer_chain_entry->set_url(destination_url.spec());
|
| referrer_chain_entry->set_type(type);
|
| - auto ip_it = host_to_ip_map_.find(nav_event->destination_url.host());
|
| + auto ip_it = host_to_ip_map_.find(destination_url.host());
|
| if (ip_it != host_to_ip_map_.end()) {
|
| for (ResolvedIPAddress entry : ip_it->second) {
|
| referrer_chain_entry->add_ip_addresses(entry.ip);
|
| @@ -454,6 +455,12 @@ void SafeBrowsingNavigationObserverManager::AddToReferrerChain(
|
| nav_event->target_tab_id);
|
| referrer_chain_entry->set_navigation_time_msec(
|
| nav_event->last_updated.ToJavaTime());
|
| + if (nav_event->has_server_redirect) {
|
| + referrer_chain_entry->add_server_redirect_chain(
|
| + nav_event->original_request_url.spec());
|
| + for (const GURL& redirect: nav_event->server_redirect_urls)
|
| + referrer_chain_entry->add_server_redirect_chain(redirect.spec());
|
| + }
|
| referrer_chain->push_back(std::move(referrer_chain_entry));
|
| }
|
|
|
|
|