| OLD | NEW |
| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 if (!ShouldCloseWindow()) | 607 if (!ShouldCloseWindow()) |
| 608 return; | 608 return; |
| 609 | 609 |
| 610 // Application should shutdown on last window close if the user is explicitly | 610 // Application should shutdown on last window close if the user is explicitly |
| 611 // trying to quit, or if there is nothing keeping the browser alive (such as | 611 // trying to quit, or if there is nothing keeping the browser alive (such as |
| 612 // AppController on the Mac, or BackgroundContentsService for background | 612 // AppController on the Mac, or BackgroundContentsService for background |
| 613 // pages). | 613 // pages). |
| 614 bool should_quit_if_last_browser = | 614 bool should_quit_if_last_browser = |
| 615 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); | 615 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); |
| 616 | 616 |
| 617 if (should_quit_if_last_browser && | 617 if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this)) |
| 618 BrowserList::GetInstance(host_desktop_type_)->size() == 1) { | |
| 619 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); | 618 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
| 620 } | |
| 621 | 619 |
| 622 // Don't use GetForProfileIfExisting here, we want to force creation of the | 620 // Don't use GetForProfileIfExisting here, we want to force creation of the |
| 623 // session service so that user can restore what was open. | 621 // session service so that user can restore what was open. |
| 624 SessionService* session_service = | 622 SessionService* session_service = |
| 625 SessionServiceFactory::GetForProfile(profile()); | 623 SessionServiceFactory::GetForProfile(profile()); |
| 626 if (session_service) | 624 if (session_service) |
| 627 session_service->WindowClosing(session_id()); | 625 session_service->WindowClosing(session_id()); |
| 628 | 626 |
| 629 TabRestoreService* tab_restore_service = | 627 TabRestoreService* tab_restore_service = |
| 630 TabRestoreServiceFactory::GetForProfile(profile()); | 628 TabRestoreServiceFactory::GetForProfile(profile()); |
| (...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 if (contents && !allow_js_access) { | 2253 if (contents && !allow_js_access) { |
| 2256 contents->web_contents()->GetController().LoadURL( | 2254 contents->web_contents()->GetController().LoadURL( |
| 2257 target_url, | 2255 target_url, |
| 2258 content::Referrer(), | 2256 content::Referrer(), |
| 2259 content::PAGE_TRANSITION_LINK, | 2257 content::PAGE_TRANSITION_LINK, |
| 2260 std::string()); // No extra headers. | 2258 std::string()); // No extra headers. |
| 2261 } | 2259 } |
| 2262 | 2260 |
| 2263 return contents != NULL; | 2261 return contents != NULL; |
| 2264 } | 2262 } |
| OLD | NEW |