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

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

Issue 2866034: Refactor shutdown code to allow win/linux to run after last browser closes. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Uploaded patch that resolves merge issue Created 10 years, 5 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
« no previous file with comments | « chrome/browser/background_contents_service_unittest.cc ('k') | chrome/browser/browser_init.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 ProcessPendingTabs(); 801 ProcessPendingTabs();
802 return false; 802 return false;
803 } 803 }
804 804
805 void Browser::OnWindowClosing() { 805 void Browser::OnWindowClosing() {
806 if (!ShouldCloseWindow()) 806 if (!ShouldCloseWindow())
807 return; 807 return;
808 808
809 bool exiting = false; 809 bool exiting = false;
810 810
811 #if defined(OS_MACOSX) 811 // Application should shutdown on last window close if the user is explicitly
812 // On Mac, closing the last window isn't usually a sign that the app is 812 // trying to quit, or if there is nothing keeping the browser alive (such as
813 // shutting down. 813 // AppController on the Mac, or BackgroundContentsService for background
814 bool should_quit_if_last_browser = browser_shutdown::IsTryingToQuit(); 814 // pages).
815 #else 815 bool should_quit_if_last_browser =
816 bool should_quit_if_last_browser = true; 816 browser_shutdown::IsTryingToQuit() || !BrowserList::WillKeepAlive();
817 #endif
818 817
819 if (should_quit_if_last_browser && BrowserList::size() == 1) { 818 if (should_quit_if_last_browser && BrowserList::size() == 1) {
820 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); 819 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
821 exiting = true; 820 exiting = true;
822 } 821 }
823 822
824 // Don't use HasSessionService here, we want to force creation of the 823 // Don't use HasSessionService here, we want to force creation of the
825 // session service so that user can restore what was open. 824 // session service so that user can restore what was open.
826 SessionService* session_service = profile()->GetSessionService(); 825 SessionService* session_service = profile()->GetSessionService();
827 if (session_service) 826 if (session_service)
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4037 } 4036 }
4038 4037
4039 bool Browser::IsPinned(TabContents* source) { 4038 bool Browser::IsPinned(TabContents* source) {
4040 int index = tabstrip_model_.GetIndexOfTabContents(source); 4039 int index = tabstrip_model_.GetIndexOfTabContents(source);
4041 if (index == TabStripModel::kNoTab) { 4040 if (index == TabStripModel::kNoTab) {
4042 NOTREACHED() << "IsPinned called for tab not in our strip"; 4041 NOTREACHED() << "IsPinned called for tab not in our strip";
4043 return false; 4042 return false;
4044 } 4043 }
4045 return tabstrip_model_.IsTabPinned(index); 4044 return tabstrip_model_.IsTabPinned(index);
4046 } 4045 }
OLDNEW
« no previous file with comments | « chrome/browser/background_contents_service_unittest.cc ('k') | chrome/browser/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698