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

Unified Diff: chrome/browser/android/tab_state.cc

Issue 2802213002: Simplify WebContentsState::GetContentsStateAsByteBuffer (Closed)
Patch Set: Addressed comments (@eugenebut) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/tab_state.cc
diff --git a/chrome/browser/android/tab_state.cc b/chrome/browser/android/tab_state.cc
index b3547a251ce1c89d51214178aaf7b8daa892885e..0c94d37719e81cd545195cdd829236c57257d65c 100644
--- a/chrome/browser/android/tab_state.cc
+++ b/chrome/browser/android/tab_state.cc
@@ -286,37 +286,26 @@ bool ExtractNavigationEntries(
}; // anonymous namespace
ScopedJavaLocalRef<jobject> WebContentsState::GetContentsStateAsByteBuffer(
- JNIEnv* env, TabAndroid* tab) {
+ JNIEnv* env,
+ TabAndroid* tab) {
Profile* profile = tab->GetProfile();
if (!profile)
return ScopedJavaLocalRef<jobject>();
content::NavigationController& controller =
tab->web_contents()->GetController();
- const int pending_index = controller.GetPendingEntryIndex();
- int entry_count = controller.GetEntryCount();
- if (entry_count == 0 && pending_index == 0)
Charlie Reis 2017/04/11 23:31:08 Right. pending_index should be -1 if entry_count
- entry_count++;
-
+ const int entry_count = controller.GetEntryCount();
if (entry_count == 0)
return ScopedJavaLocalRef<jobject>();
- int current_entry = controller.GetLastCommittedEntryIndex();
- if (current_entry == -1 && entry_count > 0)
- current_entry = 0;
Charlie Reis 2017/04/11 23:31:08 Yeah, I think this was in response to the entry_co
-
std::vector<content::NavigationEntry*> navigations(entry_count);
for (int i = 0; i < entry_count; ++i) {
- content::NavigationEntry* entry = (i == pending_index) ?
- controller.GetPendingEntry() : controller.GetEntryAtIndex(i);
- navigations[i] = entry;
+ navigations[i] = controller.GetEntryAtIndex(i);
}
return WebContentsState::WriteNavigationsAsByteBuffer(
- env,
- profile->IsOffTheRecord(),
- navigations,
- current_entry);
+ env, profile->IsOffTheRecord(), navigations,
+ controller.GetLastCommittedEntryIndex());
}
// Common implementation for GetContentsStateAsByteBuffer() and
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698