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

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

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Get session ID from entries, take tabs' active status directly instead of an index Created 4 years, 4 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 | chrome/browser/extensions/api/sessions/sessions_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/recently_closed_tabs_bridge.cc
diff --git a/chrome/browser/android/recently_closed_tabs_bridge.cc b/chrome/browser/android/recently_closed_tabs_bridge.cc
index e27a12290cdc46874cc80fae44edce6bc2fb1999..121bd16d30b88e42c05fcbcaaf3faa747713ee00 100644
--- a/chrome/browser/android/recently_closed_tabs_bridge.cc
+++ b/chrome/browser/android/recently_closed_tabs_bridge.cc
@@ -25,14 +25,12 @@ using base::android::ScopedJavaLocalRef;
namespace {
void AddTabToList(JNIEnv* env,
- sessions::TabRestoreService::Entry* entry,
+ const sessions::TabRestoreService::Tab& tab,
jobject jtabs_list) {
- const sessions::TabRestoreService::Tab* tab =
- static_cast<sessions::TabRestoreService::Tab*>(entry);
const sessions::SerializedNavigationEntry& current_navigation =
- tab->navigations.at(tab->current_navigation_index);
+ tab.navigations.at(tab.current_navigation_index);
Java_RecentlyClosedBridge_pushTab(
- env, jtabs_list, entry->id,
+ env, jtabs_list, tab.id,
ConvertUTF16ToJavaString(env, current_navigation.title()).obj(),
ConvertUTF8ToJavaString(env, current_navigation.virtual_url().spec())
.obj());
@@ -43,14 +41,13 @@ void AddTabsToList(JNIEnv* env,
jobject jtabs_list,
int max_tab_count) {
int added_count = 0;
- for (sessions::TabRestoreService::Entries::const_iterator it =
- entries.begin();
- it != entries.end() && added_count < max_tab_count; ++it) {
- sessions::TabRestoreService::Entry* entry = *it;
+ for (const auto& entry : entries) {
DCHECK_EQ(entry->type, sessions::TabRestoreService::TAB);
if (entry->type == sessions::TabRestoreService::TAB) {
- AddTabToList(env, entry, jtabs_list);
- ++added_count;
+ auto& tab = static_cast<const sessions::TabRestoreService::Tab&>(*entry);
+ AddTabToList(env, tab, jtabs_list);
+ if (++added_count == max_tab_count)
+ break;
}
}
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/sessions/sessions_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698