| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 55 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
| 56 #include "chrome/browser/extensions/extension_service.h" | 56 #include "chrome/browser/extensions/extension_service.h" |
| 57 #include "chrome/browser/extensions/extension_ui_util.h" | 57 #include "chrome/browser/extensions/extension_ui_util.h" |
| 58 #include "chrome/browser/extensions/extension_util.h" | 58 #include "chrome/browser/extensions/extension_util.h" |
| 59 #include "chrome/browser/extensions/tab_helper.h" | 59 #include "chrome/browser/extensions/tab_helper.h" |
| 60 #include "chrome/browser/file_select_helper.h" | 60 #include "chrome/browser/file_select_helper.h" |
| 61 #include "chrome/browser/first_run/first_run.h" | 61 #include "chrome/browser/first_run/first_run.h" |
| 62 #include "chrome/browser/history/top_sites_factory.h" | 62 #include "chrome/browser/history/top_sites_factory.h" |
| 63 #include "chrome/browser/infobars/infobar_service.h" | 63 #include "chrome/browser/infobars/infobar_service.h" |
| 64 #include "chrome/browser/lifetime/application_lifetime.h" | 64 #include "chrome/browser/lifetime/application_lifetime.h" |
| 65 #include "chrome/browser/lifetime/browser_keep_alive.h" |
| 65 #include "chrome/browser/notifications/notification_ui_manager.h" | 66 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 66 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 67 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| 67 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 68 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 68 #include "chrome/browser/profiles/profile.h" | 69 #include "chrome/browser/profiles/profile.h" |
| 69 #include "chrome/browser/profiles/profile_destroyer.h" | 70 #include "chrome/browser/profiles/profile_destroyer.h" |
| 70 #include "chrome/browser/profiles/profile_metrics.h" | 71 #include "chrome/browser/profiles/profile_metrics.h" |
| 71 #include "chrome/browser/profiles/profiles_state.h" | 72 #include "chrome/browser/profiles/profiles_state.h" |
| 72 #include "chrome/browser/repost_form_warning_controller.h" | 73 #include "chrome/browser/repost_form_warning_controller.h" |
| 73 #include "chrome/browser/search/search.h" | 74 #include "chrome/browser/search/search.h" |
| 74 #include "chrome/browser/sessions/session_restore.h" | 75 #include "chrome/browser/sessions/session_restore.h" |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 707 |
| 707 void Browser::OnWindowClosing() { | 708 void Browser::OnWindowClosing() { |
| 708 if (!ShouldCloseWindow()) | 709 if (!ShouldCloseWindow()) |
| 709 return; | 710 return; |
| 710 | 711 |
| 711 // Application should shutdown on last window close if the user is explicitly | 712 // Application should shutdown on last window close if the user is explicitly |
| 712 // trying to quit, or if there is nothing keeping the browser alive (such as | 713 // trying to quit, or if there is nothing keeping the browser alive (such as |
| 713 // AppController on the Mac, or BackgroundContentsService for background | 714 // AppController on the Mac, or BackgroundContentsService for background |
| 714 // pages). | 715 // pages). |
| 715 bool should_quit_if_last_browser = | 716 bool should_quit_if_last_browser = |
| 716 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); | 717 browser_shutdown::IsTryingToQuit() || !browser_lifetime::WillKeepAlive(); |
| 717 | 718 |
| 718 if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this)) { | 719 if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this)) { |
| 719 #if defined(OS_WIN) | 720 #if defined(OS_WIN) |
| 720 browser_watcher::ExitFunnel::RecordSingleEvent( | 721 browser_watcher::ExitFunnel::RecordSingleEvent( |
| 721 chrome::kBrowserExitCodesRegistryPath, L"LastWindowClose"); | 722 chrome::kBrowserExitCodesRegistryPath, L"LastWindowClose"); |
| 722 #endif | 723 #endif |
| 723 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); | 724 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
| 724 } | 725 } |
| 725 | 726 |
| 726 // Don't use GetForProfileIfExisting here, we want to force creation of the | 727 // Don't use GetForProfileIfExisting here, we want to force creation of the |
| (...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 if (contents && !allow_js_access) { | 2692 if (contents && !allow_js_access) { |
| 2692 contents->web_contents()->GetController().LoadURL( | 2693 contents->web_contents()->GetController().LoadURL( |
| 2693 target_url, | 2694 target_url, |
| 2694 content::Referrer(), | 2695 content::Referrer(), |
| 2695 ui::PAGE_TRANSITION_LINK, | 2696 ui::PAGE_TRANSITION_LINK, |
| 2696 std::string()); // No extra headers. | 2697 std::string()); // No extra headers. |
| 2697 } | 2698 } |
| 2698 | 2699 |
| 2699 return contents != NULL; | 2700 return contents != NULL; |
| 2700 } | 2701 } |
| OLD | NEW |