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

Side by Side Diff: chrome/browser/sessions/session_service.cc

Issue 362016: Mac: don't restore explicitly closed windows. (Closed)
Patch Set: Updated comment per sky's re-review. Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sessions/session_service.h" 7 #include "chrome/browser/sessions/session_service.h"
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // The window is about to close. If there are other tabbed browsers with the 231 // The window is about to close. If there are other tabbed browsers with the
232 // same original profile commit the close immediately. 232 // same original profile commit the close immediately.
233 // 233 //
234 // NOTE: if the user chooses the exit menu item session service is destroyed 234 // NOTE: if the user chooses the exit menu item session service is destroyed
235 // and this code isn't hit. 235 // and this code isn't hit.
236 if (has_open_trackable_browsers_) { 236 if (has_open_trackable_browsers_) {
237 // Closing a window can never make has_open_trackable_browsers_ go from 237 // Closing a window can never make has_open_trackable_browsers_ go from
238 // false to true, so only update it if already true. 238 // false to true, so only update it if already true.
239 has_open_trackable_browsers_ = HasOpenTrackableBrowsers(window_id); 239 has_open_trackable_browsers_ = HasOpenTrackableBrowsers(window_id);
240 } 240 }
241 if (!has_open_trackable_browsers_) 241 if (should_record_close_as_pending())
242 pending_window_close_ids_.insert(window_id.id()); 242 pending_window_close_ids_.insert(window_id.id());
243 else 243 else
244 window_closing_ids_.insert(window_id.id()); 244 window_closing_ids_.insert(window_id.id());
245 } 245 }
246 246
247 void SessionService::WindowClosed(const SessionID& window_id) { 247 void SessionService::WindowClosed(const SessionID& window_id) {
248 if (!ShouldTrackChangesToWindow(window_id)) 248 if (!ShouldTrackChangesToWindow(window_id))
249 return; 249 return;
250 250
251 windows_tracking_.erase(window_id.id()); 251 windows_tracking_.erase(window_id.id());
252 252
253 if (window_closing_ids_.find(window_id.id()) != window_closing_ids_.end()) { 253 if (window_closing_ids_.find(window_id.id()) != window_closing_ids_.end()) {
254 window_closing_ids_.erase(window_id.id()); 254 window_closing_ids_.erase(window_id.id());
255 ScheduleCommand(CreateWindowClosedCommand(window_id.id())); 255 ScheduleCommand(CreateWindowClosedCommand(window_id.id()));
256 } else if (pending_window_close_ids_.find(window_id.id()) == 256 } else if (pending_window_close_ids_.find(window_id.id()) ==
257 pending_window_close_ids_.end()) { 257 pending_window_close_ids_.end()) {
258 // We'll hit this if user closed the last tab in a window. 258 // We'll hit this if user closed the last tab in a window.
259 has_open_trackable_browsers_ = HasOpenTrackableBrowsers(window_id); 259 has_open_trackable_browsers_ = HasOpenTrackableBrowsers(window_id);
260 if (!has_open_trackable_browsers_) 260 if (should_record_close_as_pending())
261 pending_window_close_ids_.insert(window_id.id()); 261 pending_window_close_ids_.insert(window_id.id());
262 else 262 else
263 ScheduleCommand(CreateWindowClosedCommand(window_id.id())); 263 ScheduleCommand(CreateWindowClosedCommand(window_id.id()));
264 } 264 }
265 } 265 }
266 266
267 void SessionService::SetWindowType(const SessionID& window_id, 267 void SessionService::SetWindowType(const SessionID& window_id,
268 Browser::Type type) { 268 Browser::Type type) {
269 if (!should_track_changes_for_browser_type(type)) 269 if (!should_track_changes_for_browser_type(type))
270 return; 270 return;
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 case TYPE_APP: 1191 case TYPE_APP:
1192 return Browser::TYPE_APP; 1192 return Browser::TYPE_APP;
1193 case TYPE_APP_POPUP: 1193 case TYPE_APP_POPUP:
1194 return Browser::TYPE_APP_POPUP; 1194 return Browser::TYPE_APP_POPUP;
1195 case TYPE_NORMAL: 1195 case TYPE_NORMAL:
1196 default: 1196 default:
1197 return Browser::TYPE_NORMAL; 1197 return Browser::TYPE_NORMAL;
1198 } 1198 }
1199 } 1199 }
1200 1200
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698