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

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

Issue 15600006: Cleanup: Remove unneeded gurl.h includes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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 #include "components/navigation_interception/intercept_navigation_delegate.h" 5 #include "components/navigation_interception/intercept_navigation_delegate.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" 10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h"
11 #include "components/navigation_interception/navigation_params_android.h" 11 #include "components/navigation_interception/navigation_params_android.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "googleurl/src/gurl.h"
16 #include "jni/InterceptNavigationDelegate_jni.h" 15 #include "jni/InterceptNavigationDelegate_jni.h"
17 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
18 17
19 using base::android::ConvertUTF8ToJavaString; 18 using base::android::ConvertUTF8ToJavaString;
20 using base::android::ScopedJavaLocalRef; 19 using base::android::ScopedJavaLocalRef;
21 using content::BrowserThread; 20 using content::BrowserThread;
22 using content::PageTransition; 21 using content::PageTransition;
23 using content::RenderViewHost; 22 using content::RenderViewHost;
24 using content::WebContents; 23 using content::WebContents;
25 24
(...skipping 13 matching lines...) Expand all
39 if (!web_contents) 38 if (!web_contents)
40 return false; 39 return false;
41 InterceptNavigationDelegate* intercept_navigation_delegate = 40 InterceptNavigationDelegate* intercept_navigation_delegate =
42 InterceptNavigationDelegate::Get(web_contents); 41 InterceptNavigationDelegate::Get(web_contents);
43 if (!intercept_navigation_delegate) 42 if (!intercept_navigation_delegate)
44 return false; 43 return false;
45 44
46 return intercept_navigation_delegate->ShouldIgnoreNavigation(params); 45 return intercept_navigation_delegate->ShouldIgnoreNavigation(params);
47 } 46 }
48 47
49 } // namespace 48 } // namespace
50 49
51 // static 50 // static
52 void InterceptNavigationDelegate::Associate( 51 void InterceptNavigationDelegate::Associate(
53 WebContents* web_contents, 52 WebContents* web_contents,
54 scoped_ptr<InterceptNavigationDelegate> delegate) { 53 scoped_ptr<InterceptNavigationDelegate> delegate) {
55 web_contents->SetUserData(kInterceptNavigationDelegateUserDataKey, 54 web_contents->SetUserData(kInterceptNavigationDelegateUserDataKey,
56 delegate.release()); 55 delegate.release());
57 } 56 }
58 57
59 // static 58 // static
(...skipping 13 matching lines...) Expand all
73 InterceptNavigationDelegate::InterceptNavigationDelegate( 72 InterceptNavigationDelegate::InterceptNavigationDelegate(
74 JNIEnv* env, jobject jdelegate) 73 JNIEnv* env, jobject jdelegate)
75 : weak_jdelegate_(env, jdelegate) { 74 : weak_jdelegate_(env, jdelegate) {
76 } 75 }
77 76
78 InterceptNavigationDelegate::~InterceptNavigationDelegate() { 77 InterceptNavigationDelegate::~InterceptNavigationDelegate() {
79 } 78 }
80 79
81 bool InterceptNavigationDelegate::ShouldIgnoreNavigation( 80 bool InterceptNavigationDelegate::ShouldIgnoreNavigation(
82 const NavigationParams& navigation_params) { 81 const NavigationParams& navigation_params) {
83 if (!navigation_params.url().is_valid()) 82 if (!navigation_params.url().is_valid())
joth 2013/06/19 16:27:34 what's the criteria for 'unneeded'? This is callin
84 return false; 83 return false;
85 84
86 JNIEnv* env = base::android::AttachCurrentThread(); 85 JNIEnv* env = base::android::AttachCurrentThread();
87 ScopedJavaLocalRef<jobject> jdelegate = weak_jdelegate_.get(env); 86 ScopedJavaLocalRef<jobject> jdelegate = weak_jdelegate_.get(env);
88 87
89 if (jdelegate.is_null()) 88 if (jdelegate.is_null())
90 return false; 89 return false;
91 90
92 ScopedJavaLocalRef<jobject> jobject_params = 91 ScopedJavaLocalRef<jobject> jobject_params =
93 CreateJavaNavigationParams(env, navigation_params); 92 CreateJavaNavigationParams(env, navigation_params);
94 93
95 return Java_InterceptNavigationDelegate_shouldIgnoreNavigation( 94 return Java_InterceptNavigationDelegate_shouldIgnoreNavigation(
96 env, 95 env,
97 jdelegate.obj(), 96 jdelegate.obj(),
98 jobject_params.obj()); 97 jobject_params.obj());
99 } 98 }
100 99
101 // Register native methods. 100 // Register native methods.
102 101
103 bool RegisterInterceptNavigationDelegate(JNIEnv* env) { 102 bool RegisterInterceptNavigationDelegate(JNIEnv* env) {
104 return RegisterNativesImpl(env); 103 return RegisterNativesImpl(env);
105 } 104 }
106 105
107 } // namespace navigation_interception 106 } // namespace navigation_interception
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698