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

Side by Side Diff: components/navigation_interception/intercept_navigation_delegate.h

Issue 1918083002: Convert //components/[f-n]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: … Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ 5 #ifndef COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_
6 #define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ 6 #define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_
7 7
8 #include <memory>
9
8 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
12 13
13 class GURL; 14 class GURL;
14 15
15 namespace content { 16 namespace content {
16 class NavigationHandle; 17 class NavigationHandle;
17 class NavigationThrottle; 18 class NavigationThrottle;
18 class WebContents; 19 class WebContents;
19 } 20 }
20 21
(...skipping 18 matching lines...) Expand all
39 class InterceptNavigationDelegate : public base::SupportsUserData::Data { 40 class InterceptNavigationDelegate : public base::SupportsUserData::Data {
40 public: 41 public:
41 InterceptNavigationDelegate(JNIEnv* env, jobject jdelegate); 42 InterceptNavigationDelegate(JNIEnv* env, jobject jdelegate);
42 ~InterceptNavigationDelegate() override; 43 ~InterceptNavigationDelegate() override;
43 44
44 // Associates the InterceptNavigationDelegate with a WebContents using the 45 // Associates the InterceptNavigationDelegate with a WebContents using the
45 // SupportsUserData mechanism. 46 // SupportsUserData mechanism.
46 // As implied by the use of scoped_ptr, the WebContents will assume ownership 47 // As implied by the use of scoped_ptr, the WebContents will assume ownership
47 // of |delegate|. 48 // of |delegate|.
48 static void Associate(content::WebContents* web_contents, 49 static void Associate(content::WebContents* web_contents,
49 scoped_ptr<InterceptNavigationDelegate> delegate); 50 std::unique_ptr<InterceptNavigationDelegate> delegate);
50 // Gets the InterceptNavigationDelegate associated with the WebContents, 51 // Gets the InterceptNavigationDelegate associated with the WebContents,
51 // can be null. 52 // can be null.
52 static InterceptNavigationDelegate* Get(content::WebContents* web_contents); 53 static InterceptNavigationDelegate* Get(content::WebContents* web_contents);
53 54
54 // Creates a InterceptNavigationThrottle that will direct all callbacks to 55 // Creates a InterceptNavigationThrottle that will direct all callbacks to
55 // the InterceptNavigationDelegate. 56 // the InterceptNavigationDelegate.
56 static scoped_ptr<content::NavigationThrottle> CreateThrottleFor( 57 static std::unique_ptr<content::NavigationThrottle> CreateThrottleFor(
57 content::NavigationHandle* handle); 58 content::NavigationHandle* handle);
58 59
59 // Updates information to determine whether to have user gesture carryover or 60 // Updates information to determine whether to have user gesture carryover or
60 // not. 61 // not.
61 static void UpdateUserGestureCarryoverInfo(net::URLRequest* request); 62 static void UpdateUserGestureCarryoverInfo(net::URLRequest* request);
62 63
63 virtual bool ShouldIgnoreNavigation( 64 virtual bool ShouldIgnoreNavigation(
64 const NavigationParams& navigation_params); 65 const NavigationParams& navigation_params);
65 66
66 // Updates |last_user_gesture_carryover_timestamp_| when user gesture is 67 // Updates |last_user_gesture_carryover_timestamp_| when user gesture is
67 // carried over. 68 // carried over.
68 void UpdateLastUserGestureCarryoverTimestamp(); 69 void UpdateLastUserGestureCarryoverTimestamp();
69 70
70 private: 71 private:
71 JavaObjectWeakGlobalRef weak_jdelegate_; 72 JavaObjectWeakGlobalRef weak_jdelegate_;
72 base::TimeTicks last_user_gesture_carryover_timestamp_; 73 base::TimeTicks last_user_gesture_carryover_timestamp_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationDelegate); 75 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationDelegate);
75 }; 76 };
76 77
77 bool RegisterInterceptNavigationDelegate(JNIEnv* env); 78 bool RegisterInterceptNavigationDelegate(JNIEnv* env);
78 79
79 } // namespace navigation_interception 80 } // namespace navigation_interception
80 81
81 #endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ 82 #endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698