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

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

Issue 10829007: Revert 148281 - Remove details from BROWSER_CLOSING and BROWSER_CLOSED notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/ui/browser_list_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 584 }
585 585
586 bool Browser::IsAttemptingToCloseBrowser() const { 586 bool Browser::IsAttemptingToCloseBrowser() const {
587 return unload_controller_->is_attempting_to_close_browser(); 587 return unload_controller_->is_attempting_to_close_browser();
588 } 588 }
589 589
590 void Browser::OnWindowClosing() { 590 void Browser::OnWindowClosing() {
591 if (!ShouldCloseWindow()) 591 if (!ShouldCloseWindow())
592 return; 592 return;
593 593
594 bool exiting = false;
595
594 // Application should shutdown on last window close if the user is explicitly 596 // Application should shutdown on last window close if the user is explicitly
595 // trying to quit, or if there is nothing keeping the browser alive (such as 597 // trying to quit, or if there is nothing keeping the browser alive (such as
596 // AppController on the Mac, or BackgroundContentsService for background 598 // AppController on the Mac, or BackgroundContentsService for background
597 // pages). 599 // pages).
598 bool should_quit_if_last_browser = 600 bool should_quit_if_last_browser =
599 browser_shutdown::IsTryingToQuit() || !browser::WillKeepAlive(); 601 browser_shutdown::IsTryingToQuit() || !browser::WillKeepAlive();
600 602
601 if (should_quit_if_last_browser && BrowserList::size() == 1) 603 if (should_quit_if_last_browser && BrowserList::size() == 1) {
602 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); 604 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
605 exiting = true;
606 }
603 607
604 // Don't use GetForProfileIfExisting here, we want to force creation of the 608 // Don't use GetForProfileIfExisting here, we want to force creation of the
605 // session service so that user can restore what was open. 609 // session service so that user can restore what was open.
606 SessionService* session_service = 610 SessionService* session_service =
607 SessionServiceFactory::GetForProfile(profile()); 611 SessionServiceFactory::GetForProfile(profile());
608 if (session_service) 612 if (session_service)
609 session_service->WindowClosing(session_id()); 613 session_service->WindowClosing(session_id());
610 614
611 TabRestoreService* tab_restore_service = 615 TabRestoreService* tab_restore_service =
612 TabRestoreServiceFactory::GetForProfile(profile()); 616 TabRestoreServiceFactory::GetForProfile(profile());
613 617
614 #if defined(USE_AURA) 618 #if defined(USE_AURA)
615 if (tab_restore_service && is_app()) 619 if (tab_restore_service && is_app())
616 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); 620 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
617 #endif 621 #endif
618 622
619 if (tab_restore_service && is_type_tabbed() && tab_count()) 623 if (tab_restore_service && is_type_tabbed() && tab_count())
620 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); 624 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
621 625
622 // TODO(sky): convert session/tab restore to use notification. 626 // TODO(sky): convert session/tab restore to use notification.
623 content::NotificationService::current()->Notify( 627 content::NotificationService::current()->Notify(
624 chrome::NOTIFICATION_BROWSER_CLOSING, 628 chrome::NOTIFICATION_BROWSER_CLOSING,
625 content::Source<Browser>(this), 629 content::Source<Browser>(this),
626 content::NotificationService::NoDetails()); 630 content::Details<bool>(&exiting));
627 631
628 chrome::CloseAllTabs(this); 632 chrome::CloseAllTabs(this);
629 } 633 }
630 634
631 void Browser::OnWindowActivated() { 635 void Browser::OnWindowActivated() {
632 // On some platforms we want to automatically reload tabs that are 636 // On some platforms we want to automatically reload tabs that are
633 // killed when the user selects them. 637 // killed when the user selects them.
634 WebContents* contents = chrome::GetActiveWebContents(this); 638 WebContents* contents = chrome::GetActiveWebContents(this);
635 if (contents && contents->GetCrashedStatus() == 639 if (contents && contents->GetCrashedStatus() ==
636 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { 640 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 if (contents && !allow_js_access) { 2276 if (contents && !allow_js_access) {
2273 contents->web_contents()->GetController().LoadURL( 2277 contents->web_contents()->GetController().LoadURL(
2274 target_url, 2278 target_url,
2275 content::Referrer(), 2279 content::Referrer(),
2276 content::PAGE_TRANSITION_LINK, 2280 content::PAGE_TRANSITION_LINK,
2277 std::string()); // No extra headers. 2281 std::string()); // No extra headers.
2278 } 2282 }
2279 2283
2280 return contents != NULL; 2284 return contents != NULL;
2281 } 2285 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/ui/browser_list_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698