| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 88 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 89 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 89 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 90 #include "chrome/browser/ui/browser_command_controller.h" | 90 #include "chrome/browser/ui/browser_command_controller.h" |
| 91 #include "chrome/browser/ui/browser_commands.h" | 91 #include "chrome/browser/ui/browser_commands.h" |
| 92 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 92 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| 93 #include "chrome/browser/ui/browser_dialogs.h" | 93 #include "chrome/browser/ui/browser_dialogs.h" |
| 94 #include "chrome/browser/ui/browser_finder.h" | 94 #include "chrome/browser/ui/browser_finder.h" |
| 95 #include "chrome/browser/ui/browser_instant_controller.h" | 95 #include "chrome/browser/ui/browser_instant_controller.h" |
| 96 #include "chrome/browser/ui/browser_iterator.h" | 96 #include "chrome/browser/ui/browser_iterator.h" |
| 97 #include "chrome/browser/ui/browser_list.h" | 97 #include "chrome/browser/ui/browser_list.h" |
| 98 #include "chrome/browser/ui/browser_list_impl.h" |
| 98 #include "chrome/browser/ui/browser_navigator.h" | 99 #include "chrome/browser/ui/browser_navigator.h" |
| 99 #include "chrome/browser/ui/browser_tab_contents.h" | 100 #include "chrome/browser/ui/browser_tab_contents.h" |
| 100 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 101 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 101 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" | 102 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" |
| 102 #include "chrome/browser/ui/browser_tabstrip.h" | 103 #include "chrome/browser/ui/browser_tabstrip.h" |
| 103 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" | 104 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" |
| 104 #include "chrome/browser/ui/browser_ui_prefs.h" | 105 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 105 #include "chrome/browser/ui/browser_window.h" | 106 #include "chrome/browser/ui/browser_window.h" |
| 106 #include "chrome/browser/ui/chrome_pages.h" | 107 #include "chrome/browser/ui/chrome_pages.h" |
| 107 #include "chrome/browser/ui/chrome_select_file_policy.h" | 108 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 if (!ShouldCloseWindow()) | 626 if (!ShouldCloseWindow()) |
| 626 return; | 627 return; |
| 627 | 628 |
| 628 // Application should shutdown on last window close if the user is explicitly | 629 // Application should shutdown on last window close if the user is explicitly |
| 629 // trying to quit, or if there is nothing keeping the browser alive (such as | 630 // trying to quit, or if there is nothing keeping the browser alive (such as |
| 630 // AppController on the Mac, or BackgroundContentsService for background | 631 // AppController on the Mac, or BackgroundContentsService for background |
| 631 // pages). | 632 // pages). |
| 632 bool should_quit_if_last_browser = | 633 bool should_quit_if_last_browser = |
| 633 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); | 634 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); |
| 634 | 635 |
| 635 if (should_quit_if_last_browser && BrowserList::size() == 1) | 636 if (should_quit_if_last_browser && |
| 637 chrome::BrowserListImpl::GetInstance(host_desktop_type_)->size() == 1) { |
| 636 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); | 638 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
| 639 } |
| 637 | 640 |
| 638 // Don't use GetForProfileIfExisting here, we want to force creation of the | 641 // Don't use GetForProfileIfExisting here, we want to force creation of the |
| 639 // session service so that user can restore what was open. | 642 // session service so that user can restore what was open. |
| 640 SessionService* session_service = | 643 SessionService* session_service = |
| 641 SessionServiceFactory::GetForProfile(profile()); | 644 SessionServiceFactory::GetForProfile(profile()); |
| 642 if (session_service) | 645 if (session_service) |
| 643 session_service->WindowClosing(session_id()); | 646 session_service->WindowClosing(session_id()); |
| 644 | 647 |
| 645 TabRestoreService* tab_restore_service = | 648 TabRestoreService* tab_restore_service = |
| 646 TabRestoreServiceFactory::GetForProfile(profile()); | 649 TabRestoreServiceFactory::GetForProfile(profile()); |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 if (contents && !allow_js_access) { | 2281 if (contents && !allow_js_access) { |
| 2279 contents->web_contents()->GetController().LoadURL( | 2282 contents->web_contents()->GetController().LoadURL( |
| 2280 target_url, | 2283 target_url, |
| 2281 content::Referrer(), | 2284 content::Referrer(), |
| 2282 content::PAGE_TRANSITION_LINK, | 2285 content::PAGE_TRANSITION_LINK, |
| 2283 std::string()); // No extra headers. | 2286 std::string()); // No extra headers. |
| 2284 } | 2287 } |
| 2285 | 2288 |
| 2286 return contents != NULL; | 2289 return contents != NULL; |
| 2287 } | 2290 } |
| OLD | NEW |