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

Side by Side Diff: chrome/browser/android/tab_state.cc

Issue 774183004: Upstream historical tab logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@upstreaming_2
Patch Set: Created 6 years 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 | « chrome/browser/android/tab_android.cc ('k') | no next file » | 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 #include "chrome/browser/android/tab_state.h" 5 #include "chrome/browser/android/tab_state.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 jobject state, 544 jobject state,
545 jint saved_state_version) { 545 jint saved_state_version) {
546 void* data = env->GetDirectBufferAddress(state); 546 void* data = env->GetDirectBufferAddress(state);
547 int size = env->GetDirectBufferCapacity(state); 547 int size = env->GetDirectBufferCapacity(state);
548 ScopedJavaLocalRef<jstring> result = 548 ScopedJavaLocalRef<jstring> result =
549 WebContentsState::GetVirtualUrlFromByteBuffer( 549 WebContentsState::GetVirtualUrlFromByteBuffer(
550 env, data, size, saved_state_version); 550 env, data, size, saved_state_version);
551 return result.Release(); 551 return result.Release();
552 } 552 }
553 553
554 // Creates a historical tab entry from the serialized tab contents contained
555 // within |state|.
556 static void CreateHistoricalTab(JNIEnv* env,
557 jclass clazz,
558 jobject state,
559 jint saved_state_version) {
560 scoped_ptr<WebContents> web_contents(
561 WebContentsState::RestoreContentsFromByteBuffer(env,
562 clazz,
563 state,
564 saved_state_version,
565 true));
566 if (web_contents.get())
567 TabAndroid::CreateHistoricalTabFromContents(web_contents.get());
568 }
569
554 bool RegisterTabState(JNIEnv* env) { 570 bool RegisterTabState(JNIEnv* env) {
555 return RegisterNativesImpl(env); 571 return RegisterNativesImpl(env);
556 } 572 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698