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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 10908285: Add WebContents accessor in ContentViewCore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (virtual_url_for_data_url) { 251 if (virtual_url_for_data_url) {
252 params.virtual_url_for_data_url = 252 params.virtual_url_for_data_url =
253 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url)); 253 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url));
254 } 254 }
255 255
256 LoadUrl(params); 256 LoadUrl(params);
257 } 257 }
258 258
259 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( 259 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL(
260 JNIEnv* env, jobject) const { 260 JNIEnv* env, jobject) const {
261 return ConvertUTF8ToJavaString(env, web_contents()->GetURL().spec()); 261 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec());
262 } 262 }
263 263
264 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( 264 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle(
265 JNIEnv* env, jobject obj) const { 265 JNIEnv* env, jobject obj) const {
266 return ConvertUTF16ToJavaString(env, web_contents()->GetTitle()); 266 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle());
267 } 267 }
268 268
269 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) { 269 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) {
270 return web_contents()->GetBrowserContext()->IsOffTheRecord(); 270 return GetWebContents()->GetBrowserContext()->IsOffTheRecord();
271 }
272
273 WebContents* ContentViewCoreImpl::GetWebContents() const {
274 return web_contents_;
271 } 275 }
272 276
273 jboolean ContentViewCoreImpl::TouchEvent(JNIEnv* env, 277 jboolean ContentViewCoreImpl::TouchEvent(JNIEnv* env,
274 jobject obj, 278 jobject obj,
275 jlong time_ms, 279 jlong time_ms,
276 jint type, 280 jint type,
277 jobjectArray pts) { 281 jobjectArray pts) {
278 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 282 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
279 if (rwhv) { 283 if (rwhv) {
280 using WebKit::WebTouchEvent; 284 using WebKit::WebTouchEvent;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return 0; 535 return 0;
532 return rwhva->GetNativeImeAdapter(); 536 return rwhva->GetNativeImeAdapter();
533 } 537 }
534 538
535 // -------------------------------------------------------------------------- 539 // --------------------------------------------------------------------------
536 // Methods called from native code 540 // Methods called from native code
537 // -------------------------------------------------------------------------- 541 // --------------------------------------------------------------------------
538 542
539 void ContentViewCoreImpl::LoadUrl( 543 void ContentViewCoreImpl::LoadUrl(
540 NavigationController::LoadURLParams& params) { 544 NavigationController::LoadURLParams& params) {
541 web_contents()->GetController().LoadURLWithParams(params); 545 GetWebContents()->GetController().LoadURLWithParams(params);
542 tab_crashed_ = false; 546 tab_crashed_ = false;
543 } 547 }
544 548
545 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() { 549 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() {
546 return window_android_; 550 return window_android_;
547 } 551 }
548 552
549 // ---------------------------------------------------------------------------- 553 // ----------------------------------------------------------------------------
550 // Native JNI methods 554 // Native JNI methods
551 // ---------------------------------------------------------------------------- 555 // ----------------------------------------------------------------------------
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 732 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
729 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 733 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
730 return false; 734 return false;
731 } 735 }
732 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 736 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
733 737
734 return RegisterNativesImpl(env) >= 0; 738 return RegisterNativesImpl(env) >= 0;
735 } 739 }
736 740
737 } // namespace content 741 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698