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 | 22 |
23 /** | 23 /** |
24 * The containing view for {@link ContentViewCore} that exists in the Android UI
hierarchy and | 24 * The containing view for {@link ContentViewCore} that exists in the Android UI
hierarchy and |
25 * exposes the various {@link View} functionality to it. | 25 * exposes the various {@link View} functionality to it. |
26 */ | 26 */ |
27 public class ContentView extends FrameLayout | 27 public class ContentView extends FrameLayout |
28 implements ContentViewCore.InternalAccessDelegate { | 28 implements ContentViewCore.InternalAccessDelegate { |
29 | 29 |
30 protected final ContentViewCore mContentViewCore; | 30 protected final ContentViewCore mContentViewCore; |
31 | 31 |
32 private final int[] mLocationInWindow = new int[2]; | |
33 | |
34 /** | 32 /** |
35 * Creates an instance of a ContentView. | 33 * Creates an instance of a ContentView. |
36 * @param context The Context the view is running in, through which it can | 34 * @param context The Context the view is running in, through which it can |
37 * access the current theme, resources, etc. | 35 * access the current theme, resources, etc. |
38 * @param cvc A pointer to the content view core managing this content view. | 36 * @param cvc A pointer to the content view core managing this content view. |
39 * @return A ContentView instance. | 37 * @return A ContentView instance. |
40 */ | 38 */ |
41 public static ContentView newInstance(Context context, ContentViewCore cvc)
{ | 39 public static ContentView newInstance(Context context, ContentViewCore cvc)
{ |
42 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { | 40 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { |
43 return new ContentView(context, cvc); | 41 return new ContentView(context, cvc); |
(...skipping 30 matching lines...) Expand all Loading... |
74 | 72 |
75 @Override | 73 @Override |
76 protected void onSizeChanged(int w, int h, int ow, int oh) { | 74 protected void onSizeChanged(int w, int h, int ow, int oh) { |
77 TraceEvent.begin(); | 75 TraceEvent.begin(); |
78 super.onSizeChanged(w, h, ow, oh); | 76 super.onSizeChanged(w, h, ow, oh); |
79 mContentViewCore.onSizeChanged(w, h, ow, oh); | 77 mContentViewCore.onSizeChanged(w, h, ow, oh); |
80 TraceEvent.end(); | 78 TraceEvent.end(); |
81 } | 79 } |
82 | 80 |
83 @Override | 81 @Override |
84 protected void onLayout(boolean changed, int left, int top, int right, int b
ottom) { | |
85 super.onLayout(changed, left, top, right, bottom); | |
86 if (changed) { | |
87 getLocationInWindow(mLocationInWindow); | |
88 mContentViewCore.onLocationInWindowChanged(mLocationInWindow[0], mLo
cationInWindow[1]); | |
89 } | |
90 } | |
91 | |
92 @Override | |
93 public InputConnection onCreateInputConnection(EditorInfo outAttrs) { | 82 public InputConnection onCreateInputConnection(EditorInfo outAttrs) { |
94 return mContentViewCore.onCreateInputConnection(outAttrs); | 83 return mContentViewCore.onCreateInputConnection(outAttrs); |
95 } | 84 } |
96 | 85 |
97 @Override | 86 @Override |
98 public boolean onCheckIsTextEditor() { | 87 public boolean onCheckIsTextEditor() { |
99 return mContentViewCore.onCheckIsTextEditor(); | 88 return mContentViewCore.onCheckIsTextEditor(); |
100 } | 89 } |
101 | 90 |
102 @Override | 91 @Override |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 278 |
290 @Override | 279 @Override |
291 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { | 280 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { |
292 return super.awakenScrollBars(startDelay, invalidate); | 281 return super.awakenScrollBars(startDelay, invalidate); |
293 } | 282 } |
294 | 283 |
295 ////////////////////////////////////////////////////////////////////////////
/////////////////// | 284 ////////////////////////////////////////////////////////////////////////////
/////////////////// |
296 // End Implementation of ContentViewCore.InternalAccessDelega
te // | 285 // End Implementation of ContentViewCore.InternalAccessDelega
te // |
297 ////////////////////////////////////////////////////////////////////////////
/////////////////// | 286 ////////////////////////////////////////////////////////////////////////////
/////////////////// |
298 } | 287 } |
OLD | NEW |