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

Issue 362016: Mac: don't restore explicitly closed windows. (Closed)

Created:
11 years, 1 month ago by viettrungluu
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Mac: don't restore explicitly closed windows. With "On startup"/"Restore the pages that were open last" set (in Preferences), a window which was explicitly closed (using the red button, Cmd-Shift-W, the menu item -- but not due to quit) should not be restored on startup. This is the behaviour of Firefox and Camino (Safari doesn't appear to implement this feature). Note about this patch: Depending on how we decide things will work for App mode, much more code could be disabled on Mac. BUG=13341 TEST=Set the browser to restore pages on start (see above). Navigate somewhere interesting; close window; quit; restart; should open a browser with default window (NTP or homepage or whatever). Navigate somewhere; quit; restart; should open previously opened stuff. Make sure that session restore (also crash recovery) still work as expected. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=31164

Patch Set 1 #

Total comments: 6

Patch Set 2 : Updated per sky's review. #

Total comments: 1

Patch Set 3 : Updated comment per sky's re-review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -2 lines) Patch
M chrome/browser/defaults.h View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/defaults.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/sessions/session_service.h View 2 2 chunks +13 lines, -0 lines 0 comments Download
M chrome/browser/sessions/session_service.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
viettrungluu
11 years, 1 month ago (2009-11-05 01:53:35 UTC) #1
sky
http://codereview.chromium.org/362016/diff/1/2 File chrome/browser/sessions/session_service.cc (right): http://codereview.chromium.org/362016/diff/1/2#newcode241 Line 241: #if defined(OS_MACOSX) Rather than an ifdef, could you ...
11 years, 1 month ago (2009-11-05 16:50:08 UTC) #2
viettrungluu
Thanks, I've updated the patch. http://codereview.chromium.org/362016/diff/1/2 File chrome/browser/sessions/session_service.cc (right): http://codereview.chromium.org/362016/diff/1/2#newcode241 Line 241: #if defined(OS_MACOSX) On ...
11 years, 1 month ago (2009-11-05 21:34:50 UTC) #3
sky
LGTM with the following change. http://codereview.chromium.org/362016/diff/3001/7 File chrome/browser/sessions/session_service.h (right): http://codereview.chromium.org/362016/diff/3001/7#newcode332 Line 332: BrowserList::size() > 1); ...
11 years, 1 month ago (2009-11-05 22:16:19 UTC) #4
Ben Goodger (Google)
What do you want from me here? I'm happy if sky is. -Ben On Wed, ...
11 years, 1 month ago (2009-11-05 22:23:57 UTC) #5
viettrungluu
11 years, 1 month ago (2009-11-05 23:32:22 UTC) #6
Thanks sky and Ben. I'm good to go.

On 2009/11/05 22:23:57, Ben Goodger wrote:
> What do you want from me here? I'm happy if sky is.
> 
> -Ben
> 
> On Wed, Nov 4, 2009 at 5:53 PM,  <mailto:viettrungluu@chromium.org> wrote:
> > Reviewers: pink, sky, Ben Goodger,
> >
> > Description:
> > Mac: don't restore explicitly closed windows.
> >
> > With "On startup"/"Restore the pages that were open last" set (in
> > Preferences),
> > a window which was explicitly closed (using the red button, Cmd-Shift-W, =
> the
> > menu item -- but not due to quit) should not be restored on startup. This=
>  is
> > the
> > behaviour of Firefox and Camino (Safari doesn't appear to implement this
> > feature).
> >
> > Note about this patch: Depending on how we decide things will work for Ap=
> p
> > mode,
> > much more code could be disabled on Mac (see comment in code).
> >
> > BUG=3D13341
> > TEST=3DSet the browser to restore pages on start (see above). Navigate
> > somewhere
> > interesting; close window; quit; restart; should open a browser with defa=
> ult
> > window (NTP or homepage or whatever). Navigate somewhere; quit; restart;
> > should
> > open previously opened stuff. Make sure that session restore (also crash
> > recovery) still work as expected.
> >
> > Please review this at http://codereview.chromium.org/362016
> >
> > Affected files:
> > =A0M chrome/browser/sessions/session_service.cc
> >
> >
> > Index: chrome/browser/sessions/session_service.cc
> > diff --git a/chrome/browser/sessions/session_service.cc
> > b/chrome/browser/sessions/session_service.cc
> > index
> > 4682ca380269dc3180a96be2469d35c05cd595fe..305e23453b8056e511a0aecd5c75c98=
> ead7b6e20
> > 100644
> > --- a/chrome/browser/sessions/session_service.cc
> > +++ b/chrome/browser/sessions/session_service.cc
> > @@ -238,8 +238,21 @@ void SessionService::WindowClosing(const SessionID&
> > window_id) {
> > =A0 =A0 // false to true, so only update it if already true.
> > =A0 =A0 has_open_trackable_browsers_ =3D HasOpenTrackableBrowsers(window_=
> id);
> > =A0 }
> > +#if defined(OS_MACOSX)
> > + =A0// On Mac, we record an explicit window close even if it's the last
> > window
> > + =A0// (since the browser stays open; quitting takes a different code pa=
> th).
> > The
> > + =A0// condition below would record a window close as pending if, e.g., =
> an
> > App
> > + =A0// mode window were still open, even though App mode is not yet
> > implemented on
> > + =A0// Mac.
> > + =A0// TODO(viettrungluu): Determine behaviour for App mode. If the beha=
> viour
> > + =A0// isn't that described above, all the |pending_window_...| (and pro=
> bably
> > + =A0// |pending_tab_...|) code can be removed from the Mac build.
> > + =A0if (!has_open_trackable_browsers_ && BrowserList::size() > 1)
> > + =A0 =A0pending_window_close_ids_.insert(window_id.id());
> > +#else
> > =A0 if (!has_open_trackable_browsers_)
> > =A0 =A0 pending_window_close_ids_.insert(window_id.id());
> > +#endif
> > =A0 else
> > =A0 =A0 window_closing_ids_.insert(window_id.id());
> > =A0}
> >
> >
> >

Powered by Google App Engine
This is Rietveld 408576698