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

Unified Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 10937028: Do not discard selected tab (Closed) Base URL: http://git.chromium.org/chromium/src.git@new
Patch Set: Created 8 years, 3 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
Index: chrome/browser/ui/tabs/tab_strip_model.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index c622f87da28b953a5db28644bbfea2f0403e8e31..875ad2cf2a77a2eb2ead0cb0d889dd5e99d87ac4 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -217,8 +217,14 @@ TabContents* TabStripModel::DiscardTabContentsAt(int index) {
old_contents->web_contents()->GetController());
// Replace the tab we're discarding with the null version.
ReplaceTabContentsAt(index, null_contents);
- // Mark the tab so it will reload when we click.
- contents_data_[index]->discarded = true;
+
+ // Only mark tabs that are not selected. When selected tab is discarded, it is
+ // the last tab. After discarding last tab, it is reloaded again. So, we
+ // should not mark the tab.
+ if (!IsTabSelected(index)) {
sky 2012/09/20 19:31:09 I don't understand this. What is triggering the lo
simonhong_ 2012/09/21 00:16:37 I'll explain problematic scenario according to thi
+ // Mark the tab so it will reload when we click.
+ contents_data_[index]->discarded = true;
+ }
// Discard the old tab's renderer.
// TODO(jamescook): This breaks script connections with other tabs.
// We need to find a different approach that doesn't do that, perhaps based
« no previous file with comments | « chrome/browser/chromeos/oom_priority_manager_browsertest.cc ('k') | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698