| 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" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // SafeBrowsingNavigationObserver -------------------------------------------- | 70 // SafeBrowsingNavigationObserver -------------------------------------------- |
| 71 | 71 |
| 72 // static | 72 // static |
| 73 void SafeBrowsingNavigationObserver::MaybeCreateForWebContents( | 73 void SafeBrowsingNavigationObserver::MaybeCreateForWebContents( |
| 74 content::WebContents* web_contents) { | 74 content::WebContents* web_contents) { |
| 75 if (FromWebContents(web_contents)) | 75 if (FromWebContents(web_contents)) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 if (safe_browsing::SafeBrowsingNavigationObserverManager::IsEnabledAndReady( | 78 if (safe_browsing::SafeBrowsingNavigationObserverManager::IsEnabledAndReady( |
| 79 Profile::FromBrowserContext(web_contents->GetBrowserContext()))) { | 79 Profile::FromBrowserContext(web_contents->GetBrowserContext()))) { |
| 80 web_contents->SetUserData( | 80 web_contents->SetUserData( |
| 81 kWebContentsUserDataKey, | 81 kWebContentsUserDataKey, |
| 82 base::MakeUnique<SafeBrowsingNavigationObserver>( | 82 base::MakeUnique<SafeBrowsingNavigationObserver>( |
| 83 web_contents, g_browser_process->safe_browsing_service() | 83 web_contents, g_browser_process->safe_browsing_service() |
| 84 ->navigation_observer_manager())); | 84 ->navigation_observer_manager())); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 SafeBrowsingNavigationObserver* SafeBrowsingNavigationObserver::FromWebContents( | 89 SafeBrowsingNavigationObserver* SafeBrowsingNavigationObserver::FromWebContents( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 ui::PageTransition transition, | 248 ui::PageTransition transition, |
| 249 bool started_from_context_menu, | 249 bool started_from_context_menu, |
| 250 bool renderer_initiated) { | 250 bool renderer_initiated) { |
| 251 manager_->RecordNewWebContents( | 251 manager_->RecordNewWebContents( |
| 252 web_contents(), source_render_frame_host->GetProcess()->GetID(), | 252 web_contents(), source_render_frame_host->GetProcess()->GetID(), |
| 253 source_render_frame_host->GetRoutingID(), url, new_contents, | 253 source_render_frame_host->GetRoutingID(), url, new_contents, |
| 254 renderer_initiated); | 254 renderer_initiated); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace safe_browsing | 257 } // namespace safe_browsing |
| OLD | NEW |