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