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" |
11 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" | 11 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" |
12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
13 #include "chrome/browser/sessions/session_tab_helper.h" | 13 #include "chrome/browser/sessions/session_tab_helper.h" |
14 #include "content/public/browser/navigation_handle.h" | 14 #include "content/public/browser/navigation_handle.h" |
15 #include "content/public/browser/render_frame_host.h" | 15 #include "content/public/browser/render_frame_host.h" |
| 16 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/resource_request_details.h" | 17 #include "content/public/browser/resource_request_details.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
19 | 20 |
20 using content::WebContents; | 21 using content::WebContents; |
21 | 22 |
22 namespace { | 23 namespace { |
23 const char kWebContentsUserDataKey[] = | 24 const char kWebContentsUserDataKey[] = |
24 "web_contents_safe_browsing_navigation_observer"; | 25 "web_contents_safe_browsing_navigation_observer"; |
25 } // namespace | 26 } // namespace |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 manager_->RecordUserGestureForWebContents(web_contents(), | 233 manager_->RecordUserGestureForWebContents(web_contents(), |
233 last_user_gesture_timestamp_); | 234 last_user_gesture_timestamp_); |
234 } | 235 } |
235 | 236 |
236 void SafeBrowsingNavigationObserver::WebContentsDestroyed() { | 237 void SafeBrowsingNavigationObserver::WebContentsDestroyed() { |
237 manager_->OnWebContentDestroyed(web_contents()); | 238 manager_->OnWebContentDestroyed(web_contents()); |
238 web_contents()->RemoveUserData(kWebContentsUserDataKey); | 239 web_contents()->RemoveUserData(kWebContentsUserDataKey); |
239 // web_contents is null after this function. | 240 // web_contents is null after this function. |
240 } | 241 } |
241 | 242 |
| 243 void SafeBrowsingNavigationObserver::DidOpenRequestedURL( |
| 244 content::WebContents* new_contents, |
| 245 content::RenderFrameHost* source_render_frame_host, |
| 246 const GURL& url, |
| 247 const content::Referrer& referrer, |
| 248 WindowOpenDisposition disposition, |
| 249 ui::PageTransition transition, |
| 250 bool started_from_context_menu, |
| 251 bool renderer_initiated) { |
| 252 manager_->RecordNewWebContents( |
| 253 web_contents(), source_render_frame_host->GetProcess()->GetID(), |
| 254 source_render_frame_host->GetRoutingID(), url, new_contents, |
| 255 renderer_initiated); |
| 256 } |
| 257 |
242 } // namespace safe_browsing | 258 } // namespace safe_browsing |
OLD | NEW |