| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 SessionServiceFactory::GetForProfile(profile_); | 515 SessionServiceFactory::GetForProfile(profile_); |
| 516 if (session_service) | 516 if (session_service) |
| 517 session_service->WindowClosed(session_id_); | 517 session_service->WindowClosed(session_id_); |
| 518 | 518 |
| 519 sessions::TabRestoreService* tab_restore_service = | 519 sessions::TabRestoreService* tab_restore_service = |
| 520 TabRestoreServiceFactory::GetForProfile(profile()); | 520 TabRestoreServiceFactory::GetForProfile(profile()); |
| 521 if (tab_restore_service) | 521 if (tab_restore_service) |
| 522 tab_restore_service->BrowserClosed(live_tab_context()); | 522 tab_restore_service->BrowserClosed(live_tab_context()); |
| 523 | 523 |
| 524 #if !defined(OS_MACOSX) | 524 #if !defined(OS_MACOSX) |
| 525 if (!chrome::GetTotalBrowserCountForProfile(profile_)) { | 525 if (!chrome::GetBrowserCount(profile_)) { |
| 526 // We're the last browser window with this profile. We need to nuke the | 526 // We're the last browser window with this profile. We need to nuke the |
| 527 // TabRestoreService, which will start the shutdown of the | 527 // TabRestoreService, which will start the shutdown of the |
| 528 // NavigationControllers and allow for proper shutdown. If we don't do this | 528 // NavigationControllers and allow for proper shutdown. If we don't do this |
| 529 // chrome won't shutdown cleanly, and may end up crashing when some | 529 // chrome won't shutdown cleanly, and may end up crashing when some |
| 530 // thread tries to use the IO thread (or another thread) that is no longer | 530 // thread tries to use the IO thread (or another thread) that is no longer |
| 531 // valid. | 531 // valid. |
| 532 // This isn't a valid assumption for Mac OS, as it stays running after | 532 // This isn't a valid assumption for Mac OS, as it stays running after |
| 533 // the last browser has closed. The Mac equivalent is in its app | 533 // the last browser has closed. The Mac equivalent is in its app |
| 534 // controller. | 534 // controller. |
| 535 TabRestoreServiceFactory::ResetForProfile(profile_); | 535 TabRestoreServiceFactory::ResetForProfile(profile_); |
| (...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2739 if (contents && !allow_js_access) { | 2739 if (contents && !allow_js_access) { |
| 2740 contents->web_contents()->GetController().LoadURL( | 2740 contents->web_contents()->GetController().LoadURL( |
| 2741 target_url, | 2741 target_url, |
| 2742 content::Referrer(), | 2742 content::Referrer(), |
| 2743 ui::PAGE_TRANSITION_LINK, | 2743 ui::PAGE_TRANSITION_LINK, |
| 2744 std::string()); // No extra headers. | 2744 std::string()); // No extra headers. |
| 2745 } | 2745 } |
| 2746 | 2746 |
| 2747 return contents != NULL; | 2747 return contents != NULL; |
| 2748 } | 2748 } |
| OLD | NEW |