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

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

Issue 10969012: Fix: Prerendering was confusing SessionService to not save sessionStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 8 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1016
1017 // Make sure the loading state is updated correctly, otherwise the throbber 1017 // Make sure the loading state is updated correctly, otherwise the throbber
1018 // won't start if the page is loading. 1018 // won't start if the page is loading.
1019 LoadingStateChanged(contents->web_contents()); 1019 LoadingStateChanged(contents->web_contents());
1020 1020
1021 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, 1021 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
1022 content::Source<WebContents>(contents->web_contents())); 1022 content::Source<WebContents>(contents->web_contents()));
1023 1023
1024 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_DETACHED, 1024 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_DETACHED,
1025 content::Source<WebContents>(contents->web_contents())); 1025 content::Source<WebContents>(contents->web_contents()));
1026 SessionService* session_service =
1027 SessionServiceFactory::GetForProfile(profile_);
1028 if (session_service)
1029 session_service->TabInserted(contents->web_contents());
1026 } 1030 }
1027 1031
1028 void Browser::TabClosingAt(TabStripModel* tab_strip_model, 1032 void Browser::TabClosingAt(TabStripModel* tab_strip_model,
1029 TabContents* contents, 1033 TabContents* contents,
1030 int index) { 1034 int index) {
1031 fullscreen_controller_->OnTabClosing(contents->web_contents()); 1035 fullscreen_controller_->OnTabClosing(contents->web_contents());
1036 SessionService* session_service =
1037 SessionServiceFactory::GetForProfile(profile_);
1038 if (session_service)
1039 session_service->TabClosing(contents->web_contents());
1032 content::NotificationService::current()->Notify( 1040 content::NotificationService::current()->Notify(
1033 chrome::NOTIFICATION_TAB_CLOSING, 1041 chrome::NOTIFICATION_TAB_CLOSING,
1034 content::Source<NavigationController>( 1042 content::Source<NavigationController>(
1035 &contents->web_contents()->GetController()), 1043 &contents->web_contents()->GetController()),
1036 content::NotificationService::NoDetails()); 1044 content::NotificationService::NoDetails());
1037 1045
1038 // Sever the WebContents' connection back to us. 1046 // Sever the WebContents' connection back to us.
1039 SetAsDelegate(contents->web_contents(), NULL); 1047 SetAsDelegate(contents->web_contents(), NULL);
1040 } 1048 }
1041 1049
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 DCHECK(from_index >= 0 && to_index >= 0); 1139 DCHECK(from_index >= 0 && to_index >= 0);
1132 // Notify the history service. 1140 // Notify the history service.
1133 SyncHistoryWithTabs(std::min(from_index, to_index)); 1141 SyncHistoryWithTabs(std::min(from_index, to_index));
1134 } 1142 }
1135 1143
1136 void Browser::TabReplacedAt(TabStripModel* tab_strip_model, 1144 void Browser::TabReplacedAt(TabStripModel* tab_strip_model,
1137 TabContents* old_contents, 1145 TabContents* old_contents,
1138 TabContents* new_contents, 1146 TabContents* new_contents,
1139 int index) { 1147 int index) {
1140 TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE); 1148 TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE);
1149 SessionService* session_service =
1150 SessionServiceFactory::GetForProfile(profile_);
1151 if (session_service)
1152 session_service->TabClosing(old_contents->web_contents());
1141 TabInsertedAt(new_contents, index, (index == active_index())); 1153 TabInsertedAt(new_contents, index, (index == active_index()));
1142 1154
1143 int entry_count = 1155 int entry_count =
1144 new_contents->web_contents()->GetController().GetEntryCount(); 1156 new_contents->web_contents()->GetController().GetEntryCount();
1145 if (entry_count > 0) { 1157 if (entry_count > 0) {
1146 // Send out notification so that observers are updated appropriately. 1158 // Send out notification so that observers are updated appropriately.
1147 new_contents->web_contents()->GetController().NotifyEntryChanged( 1159 new_contents->web_contents()->GetController().NotifyEntryChanged(
1148 new_contents->web_contents()->GetController().GetEntryAtIndex( 1160 new_contents->web_contents()->GetController().GetEntryAtIndex(
1149 entry_count - 1), 1161 entry_count - 1),
1150 entry_count - 1); 1162 entry_count - 1);
1151 } 1163 }
1152 1164
1153 SessionService* session_service =
1154 SessionServiceFactory::GetForProfile(profile());
1155 if (session_service) { 1165 if (session_service) {
1156 // The new_contents may end up with a different navigation stack. Force 1166 // The new_contents may end up with a different navigation stack. Force
1157 // the session service to update itself. 1167 // the session service to update itself.
1158 session_service->TabRestored(new_contents, 1168 session_service->TabRestored(new_contents,
1159 tab_strip_model_->IsTabPinned(index)); 1169 tab_strip_model_->IsTabPinned(index));
1160 } 1170 }
1161 1171
1162 content::DevToolsManager::GetInstance()->ContentsReplaced( 1172 content::DevToolsManager::GetInstance()->ContentsReplaced(
1163 old_contents->web_contents(), new_contents->web_contents()); 1173 old_contents->web_contents(), new_contents->web_contents());
1164 } 1174 }
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 if (contents && !allow_js_access) { 2297 if (contents && !allow_js_access) {
2288 contents->web_contents()->GetController().LoadURL( 2298 contents->web_contents()->GetController().LoadURL(
2289 target_url, 2299 target_url,
2290 content::Referrer(), 2300 content::Referrer(),
2291 content::PAGE_TRANSITION_LINK, 2301 content::PAGE_TRANSITION_LINK,
2292 std::string()); // No extra headers. 2302 std::string()); // No extra headers.
2293 } 2303 }
2294 2304
2295 return contents != NULL; 2305 return contents != NULL;
2296 } 2306 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/ui/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698