OLD | NEW |
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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.pm.ActivityInfo; | 10 import android.content.pm.ActivityInfo; |
(...skipping 22 matching lines...) Expand all Loading... |
33 import android.view.WindowManager; | 33 import android.view.WindowManager; |
34 import android.view.accessibility.AccessibilityEvent; | 34 import android.view.accessibility.AccessibilityEvent; |
35 import android.view.accessibility.AccessibilityNodeInfo; | 35 import android.view.accessibility.AccessibilityNodeInfo; |
36 import android.view.inputmethod.EditorInfo; | 36 import android.view.inputmethod.EditorInfo; |
37 import android.view.inputmethod.InputConnection; | 37 import android.view.inputmethod.InputConnection; |
38 import android.view.inputmethod.InputMethodManager; | 38 import android.view.inputmethod.InputMethodManager; |
39 | 39 |
40 import org.chromium.base.CalledByNative; | 40 import org.chromium.base.CalledByNative; |
41 import org.chromium.base.JNINamespace; | 41 import org.chromium.base.JNINamespace; |
42 import org.chromium.base.WeakContext; | 42 import org.chromium.base.WeakContext; |
43 import org.chromium.content.app.AppResource; | |
44 import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegat
e; | 43 import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegat
e; |
45 import org.chromium.content.browser.accessibility.AccessibilityInjector; | 44 import org.chromium.content.browser.accessibility.AccessibilityInjector; |
46 import org.chromium.content.common.TraceEvent; | 45 import org.chromium.content.common.TraceEvent; |
| 46 import org.chromium.content.R; |
47 import org.chromium.ui.gfx.NativeWindow; | 47 import org.chromium.ui.gfx.NativeWindow; |
48 | 48 |
49 /** | 49 /** |
50 * Provides a Java-side 'wrapper' around a WebContent (native) instance. | 50 * Provides a Java-side 'wrapper' around a WebContent (native) instance. |
51 * Contains all the major functionality necessary to manage the lifecycle of a C
ontentView without | 51 * Contains all the major functionality necessary to manage the lifecycle of a C
ontentView without |
52 * being tied to the view system. | 52 * being tied to the view system. |
53 */ | 53 */ |
54 @JNINamespace("content") | 54 @JNINamespace("content") |
55 public class ContentViewCore implements MotionEventDelegate { | 55 public class ContentViewCore implements MotionEventDelegate { |
56 private static final String TAG = ContentViewCore.class.getName(); | 56 private static final String TAG = ContentViewCore.class.getName(); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 /** | 277 /** |
278 * Constructs a new ContentViewCore. Embedders must call initialize() after
constructing | 278 * Constructs a new ContentViewCore. Embedders must call initialize() after
constructing |
279 * a ContentViewCore and before using it. | 279 * a ContentViewCore and before using it. |
280 * | 280 * |
281 * @param context The context used to create this. | 281 * @param context The context used to create this. |
282 * @param personality The type of ContentViewCore being created. | 282 * @param personality The type of ContentViewCore being created. |
283 */ | 283 */ |
284 public ContentViewCore(Context context, int personality) { | 284 public ContentViewCore(Context context, int personality) { |
285 mContext = context; | 285 mContext = context; |
286 | 286 |
287 // All application resources must be registered by the time the content
view is created. | |
288 // This should be omitted in final release builds where assertions are d
isabled. | |
289 // TODO(leandrogracia): re-enable this as soon as crbug.com/136704 is fi
xed. | |
290 // assert AppResource.verifyResourceRegistration(); | |
291 | |
292 WeakContext.initializeWeakContext(context); | 287 WeakContext.initializeWeakContext(context); |
293 // By default, ContentView will initialize single process mode. The call
to | 288 // By default, ContentView will initialize single process mode. The call
to |
294 // initContentViewProcess below is ignored if either the ContentView hos
t called | 289 // initContentViewProcess below is ignored if either the ContentView hos
t called |
295 // enableMultiProcess() or the platform browser called initChromiumBrows
erProcess(). | 290 // enableMultiProcess() or the platform browser called initChromiumBrows
erProcess(). |
296 AndroidBrowserProcess.initContentViewProcess( | 291 AndroidBrowserProcess.initContentViewProcess( |
297 context, AndroidBrowserProcess.MAX_RENDERERS_SINGLE_PROCESS); | 292 context, AndroidBrowserProcess.MAX_RENDERERS_SINGLE_PROCESS); |
298 | 293 |
299 mPersonality = personality; | 294 mPersonality = personality; |
300 HeapStatsLogger.init(mContext.getApplicationContext()); | 295 HeapStatsLogger.init(mContext.getApplicationContext()); |
301 | 296 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 this, mNativeContentViewCore, isAccessFromFileURLsGrantedByDefau
lt); | 495 this, mNativeContentViewCore, isAccessFromFileURLsGrantedByDefau
lt); |
501 initializeContainerView(internalDispatcher); | 496 initializeContainerView(internalDispatcher); |
502 if (mPersonality == PERSONALITY_VIEW) { | 497 if (mPersonality == PERSONALITY_VIEW) { |
503 setAllUserAgentOverridesInHistory(); | 498 setAllUserAgentOverridesInHistory(); |
504 } | 499 } |
505 | 500 |
506 mAccessibilityInjector = AccessibilityInjector.newInstance(this); | 501 mAccessibilityInjector = AccessibilityInjector.newInstance(this); |
507 mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); | 502 mAccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(); |
508 | 503 |
509 String contentDescription = "Web View"; | 504 String contentDescription = "Web View"; |
510 if (AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION == 0) { | 505 if (R.string.accessibility_content_view == 0) { |
511 Log.w(TAG, "Setting contentDescription to 'Web View' as no value was
specified."); | 506 Log.w(TAG, "Setting contentDescription to 'Web View' as no value was
specified."); |
512 } else { | 507 } else { |
513 contentDescription = mContext.getResources().getString( | 508 contentDescription = mContext.getResources().getString( |
514 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION); | 509 R.string.accessibility_content_view); |
515 } | 510 } |
516 mContainerView.setContentDescription(contentDescription); | 511 mContainerView.setContentDescription(contentDescription); |
517 mWebContentsObserver = new WebContentsObserverAndroid(this) { | 512 mWebContentsObserver = new WebContentsObserverAndroid(this) { |
518 @Override | 513 @Override |
519 public void didStartLoading(String url) { | 514 public void didStartLoading(String url) { |
520 hidePopupDialog(); | 515 hidePopupDialog(); |
521 } | 516 } |
522 }; | 517 }; |
523 } | 518 } |
524 | 519 |
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 private native int nativeGetNavigationHistory(int nativeContentViewCoreImpl,
Object context); | 2422 private native int nativeGetNavigationHistory(int nativeContentViewCoreImpl,
Object context); |
2428 | 2423 |
2429 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, | 2424 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, |
2430 long timebaseMicros, long intervalMicros); | 2425 long timebaseMicros, long intervalMicros); |
2431 | 2426 |
2432 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, | 2427 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, |
2433 Bitmap bitmap); | 2428 Bitmap bitmap); |
2434 | 2429 |
2435 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); | 2430 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); |
2436 } | 2431 } |
OLD | NEW |