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 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/keep_alive_registry.h" |
64 #include "chrome/browser/memory/tab_manager_web_contents_data.h" | 65 #include "chrome/browser/memory/tab_manager_web_contents_data.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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 695 |
695 void Browser::OnWindowClosing() { | 696 void Browser::OnWindowClosing() { |
696 if (!ShouldCloseWindow()) | 697 if (!ShouldCloseWindow()) |
697 return; | 698 return; |
698 | 699 |
699 // Application should shutdown on last window close if the user is explicitly | 700 // Application should shutdown on last window close if the user is explicitly |
700 // trying to quit, or if there is nothing keeping the browser alive (such as | 701 // trying to quit, or if there is nothing keeping the browser alive (such as |
701 // AppController on the Mac, or BackgroundContentsService for background | 702 // AppController on the Mac, or BackgroundContentsService for background |
702 // pages). | 703 // pages). |
703 bool should_quit_if_last_browser = | 704 bool should_quit_if_last_browser = |
704 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); | 705 browser_shutdown::IsTryingToQuit() || |
| 706 !KeepAliveRegistry::GetInstance()->IsKeepingAlive(); |
705 | 707 |
706 if (should_quit_if_last_browser && ShouldStartShutdown()) | 708 if (should_quit_if_last_browser && ShouldStartShutdown()) |
707 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); | 709 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
708 | 710 |
709 // Don't use GetForProfileIfExisting here, we want to force creation of the | 711 // Don't use GetForProfileIfExisting here, we want to force creation of the |
710 // session service so that user can restore what was open. | 712 // session service so that user can restore what was open. |
711 SessionService* session_service = | 713 SessionService* session_service = |
712 SessionServiceFactory::GetForProfile(profile()); | 714 SessionServiceFactory::GetForProfile(profile()); |
713 if (session_service) | 715 if (session_service) |
714 session_service->WindowClosing(session_id()); | 716 session_service->WindowClosing(session_id()); |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 if (contents && !allow_js_access) { | 2737 if (contents && !allow_js_access) { |
2736 contents->web_contents()->GetController().LoadURL( | 2738 contents->web_contents()->GetController().LoadURL( |
2737 target_url, | 2739 target_url, |
2738 content::Referrer(), | 2740 content::Referrer(), |
2739 ui::PAGE_TRANSITION_LINK, | 2741 ui::PAGE_TRANSITION_LINK, |
2740 std::string()); // No extra headers. | 2742 std::string()); // No extra headers. |
2741 } | 2743 } |
2742 | 2744 |
2743 return contents != NULL; | 2745 return contents != NULL; |
2744 } | 2746 } |
OLD | NEW |