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

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

Issue 10800031: Remove details from BROWSER_CLOSING and BROWSER_CLOSED notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated logic / comment for pinned tabs 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
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
596 // Application should shutdown on last window close if the user is explicitly 594 // Application should shutdown on last window close if the user is explicitly
597 // trying to quit, or if there is nothing keeping the browser alive (such as 595 // trying to quit, or if there is nothing keeping the browser alive (such as
598 // AppController on the Mac, or BackgroundContentsService for background 596 // AppController on the Mac, or BackgroundContentsService for background
599 // pages). 597 // pages).
600 bool should_quit_if_last_browser = 598 bool should_quit_if_last_browser =
601 browser_shutdown::IsTryingToQuit() || !browser::WillKeepAlive(); 599 browser_shutdown::IsTryingToQuit() || !browser::WillKeepAlive();
602 600
603 if (should_quit_if_last_browser && BrowserList::size() == 1) { 601 if (should_quit_if_last_browser && BrowserList::size() == 1)
604 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); 602 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
605 exiting = true;
606 }
607 603
608 // Don't use GetForProfileIfExisting here, we want to force creation of the 604 // Don't use GetForProfileIfExisting here, we want to force creation of the
609 // session service so that user can restore what was open. 605 // session service so that user can restore what was open.
610 SessionService* session_service = 606 SessionService* session_service =
611 SessionServiceFactory::GetForProfile(profile()); 607 SessionServiceFactory::GetForProfile(profile());
612 if (session_service) 608 if (session_service)
613 session_service->WindowClosing(session_id()); 609 session_service->WindowClosing(session_id());
614 610
615 TabRestoreService* tab_restore_service = 611 TabRestoreService* tab_restore_service =
616 TabRestoreServiceFactory::GetForProfile(profile()); 612 TabRestoreServiceFactory::GetForProfile(profile());
617 613
618 #if defined(USE_AURA) 614 #if defined(USE_AURA)
619 if (tab_restore_service && is_app()) 615 if (tab_restore_service && is_app())
620 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); 616 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
621 #endif 617 #endif
622 618
623 if (tab_restore_service && is_type_tabbed() && tab_count()) 619 if (tab_restore_service && is_type_tabbed() && tab_count())
624 tab_restore_service->BrowserClosing(tab_restore_service_delegate()); 620 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
625 621
626 // TODO(sky): convert session/tab restore to use notification. 622 // TODO(sky): convert session/tab restore to use notification.
627 content::NotificationService::current()->Notify( 623 content::NotificationService::current()->Notify(
628 chrome::NOTIFICATION_BROWSER_CLOSING, 624 chrome::NOTIFICATION_BROWSER_CLOSING,
629 content::Source<Browser>(this), 625 content::Source<Browser>(this),
630 content::Details<bool>(&exiting)); 626 content::NotificationService::NoDetails());
631 627
632 chrome::CloseAllTabs(this); 628 chrome::CloseAllTabs(this);
633 } 629 }
634 630
635 void Browser::OnWindowActivated() { 631 void Browser::OnWindowActivated() {
636 // On some platforms we want to automatically reload tabs that are 632 // On some platforms we want to automatically reload tabs that are
637 // killed when the user selects them. 633 // killed when the user selects them.
638 WebContents* contents = chrome::GetActiveWebContents(this); 634 WebContents* contents = chrome::GetActiveWebContents(this);
639 if (contents && contents->GetCrashedStatus() == 635 if (contents && contents->GetCrashedStatus() ==
640 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { 636 base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 if (contents && !allow_js_access) { 2271 if (contents && !allow_js_access) {
2276 contents->web_contents()->GetController().LoadURL( 2272 contents->web_contents()->GetController().LoadURL(
2277 target_url, 2273 target_url,
2278 content::Referrer(), 2274 content::Referrer(),
2279 content::PAGE_TRANSITION_LINK, 2275 content::PAGE_TRANSITION_LINK,
2280 std::string()); // No extra headers. 2276 std::string()); // No extra headers.
2281 } 2277 }
2282 2278
2283 return contents != NULL; 2279 return contents != NULL;
2284 } 2280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698