Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/TabState.java

Issue 2791183003: [Sync] Restore previous session if no tabbed windows present (Closed)
Patch Set: Fix android compile Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.graphics.Color; 7 import android.graphics.Color;
8 import android.os.Build; 8 import android.os.Build;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.util.Log; 10 import android.util.Log;
11 import android.util.Pair; 11 import android.util.Pair;
12 12
13 import org.chromium.base.StreamUtil; 13 import org.chromium.base.StreamUtil;
14 import org.chromium.base.VisibleForTesting; 14 import org.chromium.base.VisibleForTesting;
15 import org.chromium.chrome.browser.tab.Tab; 15 import org.chromium.chrome.browser.tab.Tab;
16 import org.chromium.components.sync.SyncConstants;
16 import org.chromium.content.browser.crypto.CipherFactory; 17 import org.chromium.content.browser.crypto.CipherFactory;
17 import org.chromium.content_public.browser.WebContents; 18 import org.chromium.content_public.browser.WebContents;
18 19
19 import java.io.DataInputStream; 20 import java.io.DataInputStream;
20 import java.io.DataOutputStream; 21 import java.io.DataOutputStream;
21 import java.io.EOFException; 22 import java.io.EOFException;
22 import java.io.File; 23 import java.io.File;
23 import java.io.FileInputStream; 24 import java.io.FileInputStream;
24 import java.io.FileNotFoundException; 25 import java.io.FileNotFoundException;
25 import java.io.FileOutputStream; 26 import java.io.FileOutputStream;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 tabState.contentsState.setVersion(isStableChannelBuild() ? 0 : 1 ); 250 tabState.contentsState.setVersion(isStableChannelBuild() ? 0 : 1 );
250 251
251 // Could happen if reading a version of a TabState that does not include the 252 // Could happen if reading a version of a TabState that does not include the
252 // version id. 253 // version id.
253 Log.w(TAG, "Failed to read saved state version id from tab state . Assuming " 254 Log.w(TAG, "Failed to read saved state version id from tab state . Assuming "
254 + "version " + tabState.contentsState.version()); 255 + "version " + tabState.contentsState.version());
255 } 256 }
256 try { 257 try {
257 tabState.syncId = stream.readLong(); 258 tabState.syncId = stream.readLong();
258 } catch (EOFException eof) { 259 } catch (EOFException eof) {
259 tabState.syncId = 0; 260 tabState.syncId = SyncConstants.INVALID_TAB_NODE_ID;
260 // Could happen if reading a version of TabState without syncId. 261 // Could happen if reading a version of TabState without syncId.
261 Log.w(TAG, "Failed to read syncId from tab state. Assuming syncI d is: 0"); 262 Log.w(TAG, "Failed to read syncId from tab state. Assuming syncI d is: -1");
262 } 263 }
263 try { 264 try {
264 tabState.shouldPreserve = stream.readBoolean(); 265 tabState.shouldPreserve = stream.readBoolean();
265 } catch (EOFException eof) { 266 } catch (EOFException eof) {
266 // Could happen if reading a version of TabState without this fl ag set. 267 // Could happen if reading a version of TabState without this fl ag set.
267 tabState.shouldPreserve = false; 268 tabState.shouldPreserve = false;
268 Log.w(TAG, "Failed to read shouldPreserve flag from tab state. " 269 Log.w(TAG, "Failed to read shouldPreserve flag from tab state. "
269 + "Assuming shouldPreserve is false"); 270 + "Assuming shouldPreserve is false");
270 } 271 }
271 tabState.mIsIncognito = encrypted; 272 tabState.mIsIncognito = encrypted;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 478
478 private static native String nativeGetDisplayTitleFromByteBuffer( 479 private static native String nativeGetDisplayTitleFromByteBuffer(
479 ByteBuffer state, int savedStateVersion); 480 ByteBuffer state, int savedStateVersion);
480 481
481 private static native String nativeGetVirtualUrlFromByteBuffer( 482 private static native String nativeGetVirtualUrlFromByteBuffer(
482 ByteBuffer state, int savedStateVersion); 483 ByteBuffer state, int savedStateVersion);
483 484
484 private static native void nativeFreeWebContentsStateBuffer(ByteBuffer buffe r); 485 private static native void nativeFreeWebContentsStateBuffer(ByteBuffer buffe r);
485 486
486 private static native void nativeCreateHistoricalTab(ByteBuffer state, int s avedStateVersion); 487 private static native void nativeCreateHistoricalTab(ByteBuffer state, int s avedStateVersion);
487 } 488 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698