| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/safe_browsing/safe_browsing_navigation_observer.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | |
| 11 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" |
| 12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 11 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 13 #include "chrome/browser/sessions/session_tab_helper.h" | 12 #include "chrome/browser/sessions/session_tab_helper.h" |
| 14 #include "content/public/browser/navigation_handle.h" | 13 #include "content/public/browser/navigation_handle.h" |
| 15 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 16 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 17 #include "content/public/browser/resource_request_details.h" | 16 #include "content/public/browser/resource_request_details.h" |
| 18 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
| 20 | 19 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 68 |
| 70 // SafeBrowsingNavigationObserver -------------------------------------------- | 69 // SafeBrowsingNavigationObserver -------------------------------------------- |
| 71 | 70 |
| 72 // static | 71 // static |
| 73 void SafeBrowsingNavigationObserver::MaybeCreateForWebContents( | 72 void SafeBrowsingNavigationObserver::MaybeCreateForWebContents( |
| 74 content::WebContents* web_contents) { | 73 content::WebContents* web_contents) { |
| 75 if (FromWebContents(web_contents)) | 74 if (FromWebContents(web_contents)) |
| 76 return; | 75 return; |
| 77 | 76 |
| 78 if (safe_browsing::SafeBrowsingNavigationObserverManager::IsEnabledAndReady( | 77 if (safe_browsing::SafeBrowsingNavigationObserverManager::IsEnabledAndReady( |
| 79 Profile::FromBrowserContext(web_contents->GetBrowserContext()))) { | 78 web_contents)) { |
| 80 web_contents->SetUserData( | 79 web_contents->SetUserData( |
| 81 kWebContentsUserDataKey, | 80 kWebContentsUserDataKey, |
| 82 new SafeBrowsingNavigationObserver( | 81 new SafeBrowsingNavigationObserver( |
| 83 web_contents, | 82 web_contents, |
| 84 g_browser_process->safe_browsing_service() | 83 g_browser_process->safe_browsing_service() |
| 85 ->navigation_observer_manager())); | 84 ->navigation_observer_manager())); |
| 86 } | 85 } |
| 87 } | 86 } |
| 88 | 87 |
| 89 // static | 88 // static |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 ui::PageTransition transition, | 248 ui::PageTransition transition, |
| 250 bool started_from_context_menu, | 249 bool started_from_context_menu, |
| 251 bool renderer_initiated) { | 250 bool renderer_initiated) { |
| 252 manager_->RecordNewWebContents( | 251 manager_->RecordNewWebContents( |
| 253 web_contents(), source_render_frame_host->GetProcess()->GetID(), | 252 web_contents(), source_render_frame_host->GetProcess()->GetID(), |
| 254 source_render_frame_host->GetRoutingID(), url, new_contents, | 253 source_render_frame_host->GetRoutingID(), url, new_contents, |
| 255 renderer_initiated); | 254 renderer_initiated); |
| 256 } | 255 } |
| 257 | 256 |
| 258 } // namespace safe_browsing | 257 } // namespace safe_browsing |
| OLD | NEW |