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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 new SafeBrowsingNavigationObserver( | 82 base::MakeUnique<SafeBrowsingNavigationObserver>( |
83 web_contents, | 83 web_contents, g_browser_process->safe_browsing_service() |
84 g_browser_process->safe_browsing_service() | 84 ->navigation_observer_manager())); |
85 ->navigation_observer_manager())); | |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
89 // static | 88 // static |
90 SafeBrowsingNavigationObserver* SafeBrowsingNavigationObserver::FromWebContents( | 89 SafeBrowsingNavigationObserver* SafeBrowsingNavigationObserver::FromWebContents( |
91 content::WebContents* web_contents) { | 90 content::WebContents* web_contents) { |
92 return static_cast<SafeBrowsingNavigationObserver*>( | 91 return static_cast<SafeBrowsingNavigationObserver*>( |
93 web_contents->GetUserData(kWebContentsUserDataKey)); | 92 web_contents->GetUserData(kWebContentsUserDataKey)); |
94 } | 93 } |
95 | 94 |
(...skipping 153 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 |