OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.content.Context; | 7 import android.content.Context; |
8 import android.content.res.Configuration; | 8 import android.content.res.Configuration; |
9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
(...skipping 11 matching lines...) Expand all Loading... |
22 import org.chromium.ui.base.WindowAndroid; | 22 import org.chromium.ui.base.WindowAndroid; |
23 | 23 |
24 /** | 24 /** |
25 * The containing view for {@link ContentViewCore} that exists in the Android UI
hierarchy and | 25 * The containing view for {@link ContentViewCore} that exists in the Android UI
hierarchy and |
26 * exposes the various {@link View} functionality to it. | 26 * exposes the various {@link View} functionality to it. |
27 * | 27 * |
28 * TODO(joth): Remove any methods overrides from this class that were added for
WebView | 28 * TODO(joth): Remove any methods overrides from this class that were added for
WebView |
29 * compatibility. | 29 * compatibility. |
30 */ | 30 */ |
31 public class ContentView extends FrameLayout | 31 public class ContentView extends FrameLayout |
32 implements ContentViewCore.InternalAccessDelegate, PageInfo { | 32 implements ContentViewCore.InternalAccessDelegate { |
33 | 33 |
34 private final ContentViewCore mContentViewCore; | 34 private final ContentViewCore mContentViewCore; |
35 | 35 |
36 private float mCurrentTouchOffsetX; | 36 private float mCurrentTouchOffsetX; |
37 private float mCurrentTouchOffsetY; | 37 private float mCurrentTouchOffsetY; |
38 private final int[] mLocationInWindow = new int[2]; | 38 private final int[] mLocationInWindow = new int[2]; |
39 | 39 |
40 /** | 40 /** |
41 * Creates an instance of a ContentView. | 41 * Creates an instance of a ContentView. |
42 * @param context The Context the view is running in, through which it can | 42 * @param context The Context the view is running in, through which it can |
(...skipping 19 matching lines...) Expand all Loading... |
62 setVerticalScrollBarEnabled(false); | 62 setVerticalScrollBarEnabled(false); |
63 } | 63 } |
64 | 64 |
65 setFocusable(true); | 65 setFocusable(true); |
66 setFocusableInTouchMode(true); | 66 setFocusableInTouchMode(true); |
67 | 67 |
68 mContentViewCore = new ContentViewCore(context); | 68 mContentViewCore = new ContentViewCore(context); |
69 mContentViewCore.initialize(this, this, nativeWebContents, windowAndroid
); | 69 mContentViewCore.initialize(this, this, nativeWebContents, windowAndroid
); |
70 } | 70 } |
71 | 71 |
72 // PageInfo implementation. | |
73 | |
74 @Override | |
75 public String getTitle() { | |
76 return mContentViewCore.getTitle(); | |
77 } | |
78 | |
79 @Override | |
80 public int getBackgroundColor() { | |
81 return mContentViewCore.getBackgroundColor(); | |
82 } | |
83 | |
84 @Override | |
85 public View getView() { | |
86 return this; | |
87 } | |
88 | |
89 /** | 72 /** |
90 * @return The core component of the ContentView that handles JNI communicat
ion. Should only be | 73 * @return The core component of the ContentView that handles JNI communicat
ion. Should only be |
91 * used for passing to native. | 74 * used for passing to native. |
92 */ | 75 */ |
93 public ContentViewCore getContentViewCore() { | 76 public ContentViewCore getContentViewCore() { |
94 return mContentViewCore; | 77 return mContentViewCore; |
95 } | 78 } |
96 | 79 |
97 // FrameLayout overrides. | 80 // FrameLayout overrides. |
98 | 81 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 348 |
366 @Override | 349 @Override |
367 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { | 350 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { |
368 return super.awakenScrollBars(startDelay, invalidate); | 351 return super.awakenScrollBars(startDelay, invalidate); |
369 } | 352 } |
370 | 353 |
371 ////////////////////////////////////////////////////////////////////////////
/////////////////// | 354 ////////////////////////////////////////////////////////////////////////////
/////////////////// |
372 // End Implementation of ContentViewCore.InternalAccessDelega
te // | 355 // End Implementation of ContentViewCore.InternalAccessDelega
te // |
373 ////////////////////////////////////////////////////////////////////////////
/////////////////// | 356 ////////////////////////////////////////////////////////////////////////////
/////////////////// |
374 } | 357 } |
OLD | NEW |