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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // it doesn't act on any notifications that are sent as a result of removing | 500 // it doesn't act on any notifications that are sent as a result of removing |
501 // the browser. | 501 // the browser. |
502 command_controller_.reset(); | 502 command_controller_.reset(); |
503 BrowserList::RemoveBrowser(this); | 503 BrowserList::RemoveBrowser(this); |
504 | 504 |
505 SessionService* session_service = | 505 SessionService* session_service = |
506 SessionServiceFactory::GetForProfile(profile_); | 506 SessionServiceFactory::GetForProfile(profile_); |
507 if (session_service) | 507 if (session_service) |
508 session_service->WindowClosed(session_id_); | 508 session_service->WindowClosed(session_id_); |
509 | 509 |
510 TabRestoreService* tab_restore_service = | 510 sessions::TabRestoreService* tab_restore_service = |
511 TabRestoreServiceFactory::GetForProfile(profile()); | 511 TabRestoreServiceFactory::GetForProfile(profile()); |
512 if (tab_restore_service) | 512 if (tab_restore_service) |
513 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); | 513 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); |
514 | 514 |
515 #if !defined(OS_MACOSX) | 515 #if !defined(OS_MACOSX) |
516 if (!chrome::GetTotalBrowserCountForProfile(profile_)) { | 516 if (!chrome::GetTotalBrowserCountForProfile(profile_)) { |
517 // We're the last browser window with this profile. We need to nuke the | 517 // We're the last browser window with this profile. We need to nuke the |
518 // TabRestoreService, which will start the shutdown of the | 518 // TabRestoreService, which will start the shutdown of the |
519 // NavigationControllers and allow for proper shutdown. If we don't do this | 519 // NavigationControllers and allow for proper shutdown. If we don't do this |
520 // chrome won't shutdown cleanly, and may end up crashing when some | 520 // chrome won't shutdown cleanly, and may end up crashing when some |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); | 722 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
723 } | 723 } |
724 | 724 |
725 // Don't use GetForProfileIfExisting here, we want to force creation of the | 725 // Don't use GetForProfileIfExisting here, we want to force creation of the |
726 // session service so that user can restore what was open. | 726 // session service so that user can restore what was open. |
727 SessionService* session_service = | 727 SessionService* session_service = |
728 SessionServiceFactory::GetForProfile(profile()); | 728 SessionServiceFactory::GetForProfile(profile()); |
729 if (session_service) | 729 if (session_service) |
730 session_service->WindowClosing(session_id()); | 730 session_service->WindowClosing(session_id()); |
731 | 731 |
732 TabRestoreService* tab_restore_service = | 732 sessions::TabRestoreService* tab_restore_service = |
733 TabRestoreServiceFactory::GetForProfile(profile()); | 733 TabRestoreServiceFactory::GetForProfile(profile()); |
734 | 734 |
735 #if defined(USE_AURA) | 735 #if defined(USE_AURA) |
736 if (tab_restore_service && is_app() && !is_devtools()) | 736 if (tab_restore_service && is_app() && !is_devtools()) |
737 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); | 737 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); |
738 #endif | 738 #endif |
739 | 739 |
740 if (tab_restore_service && is_type_tabbed() && tab_strip_model_->count()) | 740 if (tab_restore_service && is_type_tabbed() && tab_strip_model_->count()) |
741 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); | 741 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); |
742 | 742 |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 if (contents && !allow_js_access) { | 2695 if (contents && !allow_js_access) { |
2696 contents->web_contents()->GetController().LoadURL( | 2696 contents->web_contents()->GetController().LoadURL( |
2697 target_url, | 2697 target_url, |
2698 content::Referrer(), | 2698 content::Referrer(), |
2699 ui::PAGE_TRANSITION_LINK, | 2699 ui::PAGE_TRANSITION_LINK, |
2700 std::string()); // No extra headers. | 2700 std::string()); // No extra headers. |
2701 } | 2701 } |
2702 | 2702 |
2703 return contents != NULL; | 2703 return contents != NULL; |
2704 } | 2704 } |
OLD | NEW |