Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 1376063005: Cleanup: Pull some browser keep alive functions into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 705
705 void Browser::OnWindowClosing() { 706 void Browser::OnWindowClosing() {
706 if (!ShouldCloseWindow()) 707 if (!ShouldCloseWindow())
707 return; 708 return;
708 709
709 // Application should shutdown on last window close if the user is explicitly 710 // Application should shutdown on last window close if the user is explicitly
710 // trying to quit, or if there is nothing keeping the browser alive (such as 711 // trying to quit, or if there is nothing keeping the browser alive (such as
711 // AppController on the Mac, or BackgroundContentsService for background 712 // AppController on the Mac, or BackgroundContentsService for background
712 // pages). 713 // pages).
713 bool should_quit_if_last_browser = 714 bool should_quit_if_last_browser =
714 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); 715 browser_shutdown::IsTryingToQuit() || !browser_lifetime::WillKeepAlive();
715 716
716 if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this)) 717 if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this))
717 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); 718 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
718 719
719 // Don't use GetForProfileIfExisting here, we want to force creation of the 720 // Don't use GetForProfileIfExisting here, we want to force creation of the
720 // session service so that user can restore what was open. 721 // session service so that user can restore what was open.
721 SessionService* session_service = 722 SessionService* session_service =
722 SessionServiceFactory::GetForProfile(profile()); 723 SessionServiceFactory::GetForProfile(profile());
723 if (session_service) 724 if (session_service)
724 session_service->WindowClosing(session_id()); 725 session_service->WindowClosing(session_id());
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 if (contents && !allow_js_access) { 2682 if (contents && !allow_js_access) {
2682 contents->web_contents()->GetController().LoadURL( 2683 contents->web_contents()->GetController().LoadURL(
2683 target_url, 2684 target_url,
2684 content::Referrer(), 2685 content::Referrer(),
2685 ui::PAGE_TRANSITION_LINK, 2686 ui::PAGE_TRANSITION_LINK,
2686 std::string()); // No extra headers. 2687 std::string()); // No extra headers.
2687 } 2688 }
2688 2689
2689 return contents != NULL; 2690 return contents != NULL;
2690 } 2691 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698