OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.graphics.Picture; | 7 import android.graphics.Picture; |
8 import android.os.Handler; | 8 import android.os.Handler; |
9 import android.os.Looper; | 9 import android.os.Looper; |
10 import android.os.Message; | 10 import android.os.Message; |
11 import android.os.SystemClock; | 11 import android.os.SystemClock; |
12 | 12 |
| 13 import com.google.common.annotations.VisibleForTesting; |
| 14 |
13 import java.util.concurrent.Callable; | 15 import java.util.concurrent.Callable; |
14 | 16 |
15 /** | 17 /** |
16 * This class is responsible for calling certain client callbacks on the UI thre
ad. | 18 * This class is responsible for calling certain client callbacks on the UI thre
ad. |
17 * | 19 * |
18 * Most callbacks do no go through here, but get forwarded to AwContentsClient d
irectly. The | 20 * Most callbacks do no go through here, but get forwarded to AwContentsClient d
irectly. The |
19 * messages processed here may originate from the IO or UI thread. | 21 * messages processed here may originate from the IO or UI thread. |
20 */ | 22 */ |
21 class AwContentsClientCallbackHelper { | 23 @VisibleForTesting |
| 24 public class AwContentsClientCallbackHelper { |
22 | 25 |
23 // TODO(boliu): Consider removing DownloadInfo and LoginRequestInfo by using
native | 26 // TODO(boliu): Consider removing DownloadInfo and LoginRequestInfo by using
native |
24 // MessageLoop to post directly to AwContents. | 27 // MessageLoop to post directly to AwContents. |
25 | 28 |
26 private static class DownloadInfo { | 29 private static class DownloadInfo { |
27 final String mUrl; | 30 final String mUrl; |
28 final String mUserAgent; | 31 final String mUserAgent; |
29 final String mContentDisposition; | 32 final String mContentDisposition; |
30 final String mMimeType; | 33 final String mMimeType; |
31 final long mContentLength; | 34 final long mContentLength; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 190 |
188 public void postOnScaleChangedScaled(float oldScale, float newScale) { | 191 public void postOnScaleChangedScaled(float oldScale, float newScale) { |
189 // The float->int->float conversion here is to avoid unnecessary allocat
ions. The | 192 // The float->int->float conversion here is to avoid unnecessary allocat
ions. The |
190 // documentation states that intBitsToFloat(floatToIntBits(a)) == a for
all values of a | 193 // documentation states that intBitsToFloat(floatToIntBits(a)) == a for
all values of a |
191 // (except for NaNs which are collapsed to a single canonical NaN, but w
e don't care for | 194 // (except for NaNs which are collapsed to a single canonical NaN, but w
e don't care for |
192 // that case). | 195 // that case). |
193 mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_SCALE_CHANGED_SCALED, | 196 mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_SCALE_CHANGED_SCALED, |
194 Float.floatToIntBits(oldScale), Float.floatToIntBits(newScal
e))); | 197 Float.floatToIntBits(oldScale), Float.floatToIntBits(newScal
e))); |
195 } | 198 } |
196 } | 199 } |
OLD | NEW |