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

Side by Side Diff: chrome/browser/android/chrome_web_contents_delegate_android.cc

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 "chrome/browser/android/chrome_web_contents_delegate_android.h" 5 #include "chrome/browser/android/chrome_web_contents_delegate_android.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 "chrome/browser/file_select_helper.h" 9 #include "chrome/browser/file_select_helper.h"
9 #include "chrome/browser/ui/find_bar/find_match_rects_details.h" 10 #include "chrome/browser/ui/find_bar/find_match_rects_details.h"
10 #include "chrome/browser/ui/find_bar/find_notification_details.h" 11 #include "chrome/browser/ui/find_bar/find_notification_details.h"
11 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 12 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "content/public/browser/notification_details.h" 15 #include "content/public/browser/notification_details.h"
15 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/file_chooser_params.h" 19 #include "content/public/common/file_chooser_params.h"
19 #include "jni/ChromeWebContentsDelegateAndroid_jni.h" 20 #include "jni/ChromeWebContentsDelegateAndroid_jni.h"
20 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
21 #include "ui/gfx/rect_f.h" 22 #include "ui/gfx/rect_f.h"
22 23
23 using base::android::AttachCurrentThread; 24 using base::android::AttachCurrentThread;
25 using base::android::ConvertUTF8ToJavaString;
24 using base::android::GetClass; 26 using base::android::GetClass;
25 using base::android::ScopedJavaLocalRef; 27 using base::android::ScopedJavaLocalRef;
26 using content::FileChooserParams; 28 using content::FileChooserParams;
27 using content::WebContents; 29 using content::WebContents;
28 30
29 namespace { 31 namespace {
30 32
31 // Convenience method to create Android rects. 33 // Convenience method to create Android rects.
32 // RectType should be either gfx::Rect or gfx::RectF. 34 // RectType should be either gfx::Rect or gfx::RectF.
33 template <typename RectType> 35 template <typename RectType>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 jrects.obj(), 224 jrects.obj(),
223 jactive_rect.obj())); 225 jactive_rect.obj()));
224 DCHECK(!details_object.is_null()); 226 DCHECK(!details_object.is_null());
225 227
226 Java_ChromeWebContentsDelegateAndroid_onFindMatchRectsAvailable( 228 Java_ChromeWebContentsDelegateAndroid_onFindMatchRectsAvailable(
227 env, 229 env,
228 obj.obj(), 230 obj.obj(),
229 details_object.obj()); 231 details_object.obj());
230 } 232 }
231 233
234 bool ChromeWebContentsDelegateAndroid::ShouldIgnoreNavigation(
235 const GURL& url,
236 bool is_content_initiated) {
237 if (!url.is_valid())
238 return false;
239
240 JNIEnv* env = AttachCurrentThread();
241 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
242 if (obj.is_null())
243 return false;
244
245 ScopedJavaLocalRef<jstring> jstring_url =
246 ConvertUTF8ToJavaString(env, url.spec());
247 bool ret = Java_ChromeWebContentsDelegateAndroid_shouldIgnoreNavigation(
248 env, obj.obj(), jstring_url.obj(), is_content_initiated);
249 return ret;
250 }
251
232 } // namespace android 252 } // namespace android
233 } // namespace chrome 253 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698