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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 17382005: Unbreak tabs.onRemove extension API in face of fast tab closure Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't modify content Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 session_service->TabClosing(contents); 975 session_service->TabClosing(contents);
976 content::NotificationService::current()->Notify( 976 content::NotificationService::current()->Notify(
977 chrome::NOTIFICATION_TAB_CLOSING, 977 chrome::NOTIFICATION_TAB_CLOSING,
978 content::Source<NavigationController>(&contents->GetController()), 978 content::Source<NavigationController>(&contents->GetController()),
979 content::NotificationService::NoDetails()); 979 content::NotificationService::NoDetails());
980 980
981 // Sever the WebContents' connection back to us. 981 // Sever the WebContents' connection back to us.
982 SetAsDelegate(contents, NULL); 982 SetAsDelegate(contents, NULL);
983 } 983 }
984 984
985 void Browser::TabDetachedAt(WebContents* contents, int index) { 985 void Browser::TabDetachedAt(WebContents* contents,
986 int index,
987 bool closing_all) {
986 // TabDetachedAt is called before TabStripModel has updated the 988 // TabDetachedAt is called before TabStripModel has updated the
987 // active index. 989 // active index.
988 int old_active_index = tab_strip_model_->active_index(); 990 int old_active_index = tab_strip_model_->active_index();
989 if (index < old_active_index && !tab_strip_model_->closing_all()) { 991 if (index < old_active_index && !closing_all) {
990 SessionService* session_service = 992 SessionService* session_service =
991 SessionServiceFactory::GetForProfileIfExisting(profile_); 993 SessionServiceFactory::GetForProfileIfExisting(profile_);
992 if (session_service) 994 if (session_service)
993 session_service->SetSelectedTabInWindow(session_id(), 995 session_service->SetSelectedTabInWindow(session_id(),
994 old_active_index - 1); 996 old_active_index - 1);
995 } 997 }
996 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); 998 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
997 } 999 }
998 1000
999 void Browser::TabDeactivated(WebContents* contents) { 1001 void Browser::TabDeactivated(WebContents* contents) {
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 if (contents && !allow_js_access) { 2214 if (contents && !allow_js_access) {
2213 contents->web_contents()->GetController().LoadURL( 2215 contents->web_contents()->GetController().LoadURL(
2214 target_url, 2216 target_url,
2215 content::Referrer(), 2217 content::Referrer(),
2216 content::PAGE_TRANSITION_LINK, 2218 content::PAGE_TRANSITION_LINK,
2217 std::string()); // No extra headers. 2219 std::string()); // No extra headers.
2218 } 2220 }
2219 2221
2220 return contents != NULL; 2222 return contents != NULL;
2221 } 2223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698