Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc

Issue 2847353002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/download_metadata_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/download_metadata_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698