| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.os.Handler; | 7 import android.os.Handler; |
| 8 import android.util.Log; | 8 import android.util.Log; |
| 9 | 9 |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * Creates a WebContents from the buffer. | 77 * Creates a WebContents from the buffer. |
| 78 * @param isHidden Whether or not the tab initially starts hidden. | 78 * @param isHidden Whether or not the tab initially starts hidden. |
| 79 * @return Pointer to the native WebContents. | 79 * @return Pointer to the native WebContents. |
| 80 */ | 80 */ |
| 81 public long restoreContentsFromByteBuffer(boolean isHidden) { | 81 public long restoreContentsFromByteBuffer(boolean isHidden) { |
| 82 return nativeRestoreContentsFromByteBuffer(mBuffer, mVersion, isHidd
en); | 82 return nativeRestoreContentsFromByteBuffer(mBuffer, mVersion, isHidd
en); |
| 83 } | 83 } |
| 84 |
| 85 /** |
| 86 * Creates a WebContents for the ContentsState and adds it as an histori
cal tab, then |
| 87 * deletes the WebContents. |
| 88 */ |
| 89 public void createHistoricalTab() { |
| 90 nativeCreateHistoricalTab(mBuffer, mVersion); |
| 91 } |
| 84 } | 92 } |
| 85 | 93 |
| 86 /** Deletes the native-side portion of the buffer. */ | 94 /** Deletes the native-side portion of the buffer. */ |
| 87 public static class WebContentsStateNative extends WebContentsState { | 95 public static class WebContentsStateNative extends WebContentsState { |
| 88 private final Handler mHandler; | 96 private final Handler mHandler; |
| 89 | 97 |
| 90 public WebContentsStateNative(ByteBuffer buffer) { | 98 public WebContentsStateNative(ByteBuffer buffer) { |
| 91 super(buffer); | 99 super(buffer); |
| 92 this.mHandler = new Handler(); | 100 this.mHandler = new Handler(); |
| 93 } | 101 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 private static native ByteBuffer nativeCreateSingleNavigationStateAsByteBuff
er( | 343 private static native ByteBuffer nativeCreateSingleNavigationStateAsByteBuff
er( |
| 336 String url, String referrerUrl, int referrerPolicy, boolean isIncogn
ito); | 344 String url, String referrerUrl, int referrerPolicy, boolean isIncogn
ito); |
| 337 | 345 |
| 338 private static native String nativeGetDisplayTitleFromByteBuffer( | 346 private static native String nativeGetDisplayTitleFromByteBuffer( |
| 339 ByteBuffer state, int savedStateVersion); | 347 ByteBuffer state, int savedStateVersion); |
| 340 | 348 |
| 341 private static native String nativeGetVirtualUrlFromByteBuffer( | 349 private static native String nativeGetVirtualUrlFromByteBuffer( |
| 342 ByteBuffer state, int savedStateVersion); | 350 ByteBuffer state, int savedStateVersion); |
| 343 | 351 |
| 344 private static native void nativeFreeWebContentsStateBuffer(ByteBuffer buffe
r); | 352 private static native void nativeFreeWebContentsStateBuffer(ByteBuffer buffe
r); |
| 353 |
| 354 private static native void nativeCreateHistoricalTab(ByteBuffer state, int s
avedStateVersion); |
| 345 } | 355 } |
| OLD | NEW |