| 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 #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 Loading... |
| 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 } |
| OLD | NEW |