| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 bool success = ExtractNavigationEntries(data, | 419 bool success = ExtractNavigationEntries(data, |
| 420 size, | 420 size, |
| 421 saved_state_version, | 421 saved_state_version, |
| 422 &is_off_the_record, | 422 &is_off_the_record, |
| 423 ¤t_entry_index, | 423 ¤t_entry_index, |
| 424 &navigations); | 424 &navigations); |
| 425 if (!success) | 425 if (!success) |
| 426 return NULL; | 426 return NULL; |
| 427 | 427 |
| 428 Profile* profile = ProfileManager::GetActiveUserProfile(); | 428 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 429 ScopedVector<content::NavigationEntry> scoped_entries = | 429 std::vector<scoped_ptr<content::NavigationEntry>> entries = |
| 430 sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( | 430 sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( |
| 431 navigations, profile); | 431 navigations, profile); |
| 432 | 432 |
| 433 if (is_off_the_record) | 433 if (is_off_the_record) |
| 434 profile = profile->GetOffTheRecordProfile(); | 434 profile = profile->GetOffTheRecordProfile(); |
| 435 WebContents::CreateParams params(profile); | 435 WebContents::CreateParams params(profile); |
| 436 params.initially_hidden = initially_hidden; | 436 params.initially_hidden = initially_hidden; |
| 437 scoped_ptr<WebContents> web_contents(WebContents::Create(params)); | 437 scoped_ptr<WebContents> web_contents(WebContents::Create(params)); |
| 438 web_contents->GetController().Restore( | 438 web_contents->GetController().Restore( |
| 439 current_entry_index, | 439 current_entry_index, NavigationController::RESTORE_CURRENT_SESSION, |
| 440 NavigationController::RESTORE_CURRENT_SESSION, | 440 &entries); |
| 441 &scoped_entries); | |
| 442 return web_contents.release(); | 441 return web_contents.release(); |
| 443 } | 442 } |
| 444 | 443 |
| 445 ScopedJavaLocalRef<jobject> WebContentsState::RestoreContentsFromByteBuffer( | 444 ScopedJavaLocalRef<jobject> WebContentsState::RestoreContentsFromByteBuffer( |
| 446 JNIEnv* env, | 445 JNIEnv* env, |
| 447 jclass clazz, | 446 jclass clazz, |
| 448 jobject state, | 447 jobject state, |
| 449 jint saved_state_version, | 448 jint saved_state_version, |
| 450 jboolean initially_hidden) { | 449 jboolean initially_hidden) { |
| 451 void* data = env->GetDirectBufferAddress(state); | 450 void* data = env->GetDirectBufferAddress(state); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 WebContentsState::RestoreContentsFromByteBuffer(env, clazz, state, | 571 WebContentsState::RestoreContentsFromByteBuffer(env, clazz, state, |
| 573 saved_state_version, true) | 572 saved_state_version, true) |
| 574 .obj())); | 573 .obj())); |
| 575 if (web_contents.get()) | 574 if (web_contents.get()) |
| 576 TabAndroid::CreateHistoricalTabFromContents(web_contents.get()); | 575 TabAndroid::CreateHistoricalTabFromContents(web_contents.get()); |
| 577 } | 576 } |
| 578 | 577 |
| 579 bool RegisterTabState(JNIEnv* env) { | 578 bool RegisterTabState(JNIEnv* env) { |
| 580 return RegisterNativesImpl(env); | 579 return RegisterNativesImpl(env); |
| 581 } | 580 } |
| OLD | NEW |