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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 manager_->RecordUserGestureForWebContents(web_contents(), | 235 manager_->RecordUserGestureForWebContents(web_contents(), |
235 last_user_gesture_timestamp_); | 236 last_user_gesture_timestamp_); |
236 } | 237 } |
237 | 238 |
238 void SafeBrowsingNavigationObserver::WebContentsDestroyed() { | 239 void SafeBrowsingNavigationObserver::WebContentsDestroyed() { |
239 manager_->OnWebContentDestroyed(web_contents()); | 240 manager_->OnWebContentDestroyed(web_contents()); |
240 web_contents()->RemoveUserData(kWebContentsUserDataKey); | 241 web_contents()->RemoveUserData(kWebContentsUserDataKey); |
241 // web_contents is null after this function. | 242 // web_contents is null after this function. |
242 } | 243 } |
243 | 244 |
| 245 void SafeBrowsingNavigationObserver::DidOpenRequestedURL( |
| 246 content::WebContents* new_contents, |
| 247 content::RenderFrameHost* source_render_frame_host, |
| 248 const GURL& url, |
| 249 const content::Referrer& referrer, |
| 250 WindowOpenDisposition disposition, |
| 251 ui::PageTransition transition, |
| 252 bool started_from_context_menu, |
| 253 bool renderer_initiated) { |
| 254 manager_->RecordNewWebContents( |
| 255 web_contents(), source_render_frame_host->GetProcess()->GetID(), |
| 256 source_render_frame_host->GetRoutingID(), url, new_contents, |
| 257 renderer_initiated); |
| 258 } |
| 259 |
244 } // namespace safe_browsing | 260 } // namespace safe_browsing |
OLD | NEW |