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

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

Issue 2793443003: Removed NOTIFICATION_BROWSER_CLOSING notification (Closed)
Patch Set: Added browser tests Created 3 years, 8 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 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 TabRestoreServiceFactory::GetForProfile(profile()); 739 TabRestoreServiceFactory::GetForProfile(profile());
740 740
741 #if defined(USE_AURA) 741 #if defined(USE_AURA)
742 if (tab_restore_service && is_app() && !is_devtools()) 742 if (tab_restore_service && is_app() && !is_devtools())
743 tab_restore_service->BrowserClosing(live_tab_context()); 743 tab_restore_service->BrowserClosing(live_tab_context());
744 #endif 744 #endif
745 745
746 if (tab_restore_service && is_type_tabbed() && tab_strip_model_->count()) 746 if (tab_restore_service && is_type_tabbed() && tab_strip_model_->count())
747 tab_restore_service->BrowserClosing(live_tab_context()); 747 tab_restore_service->BrowserClosing(live_tab_context());
748 748
749 BrowserList::NotifyBrowserWindowClosing(this);
750
749 // TODO(sky): convert session/tab restore to use notification. 751 // TODO(sky): convert session/tab restore to use notification.
750 content::NotificationService::current()->Notify( 752 content::NotificationService::current()->Notify(
751 chrome::NOTIFICATION_BROWSER_CLOSING, 753 chrome::NOTIFICATION_BROWSER_CLOSING,
752 content::Source<Browser>(this), 754 content::Source<Browser>(this),
753 content::NotificationService::NoDetails()); 755 content::NotificationService::NoDetails());
754 756
755 if (!IsFastTabUnloadEnabled()) 757 if (!IsFastTabUnloadEnabled())
756 tab_strip_model_->CloseAllTabs(); 758 tab_strip_model_->CloseAllTabs();
757 } 759 }
758 760
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 2551 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
2550 } 2552 }
2551 2553
2552 bool Browser::ShouldHideUIForFullscreen() const { 2554 bool Browser::ShouldHideUIForFullscreen() const {
2553 // Windows and GTK remove the browser controls in fullscreen, but Mac and Ash 2555 // Windows and GTK remove the browser controls in fullscreen, but Mac and Ash
2554 // keep the controls in a slide-down panel. 2556 // keep the controls in a slide-down panel.
2555 return window_ && window_->ShouldHideUIForFullscreen(); 2557 return window_ && window_->ShouldHideUIForFullscreen();
2556 } 2558 }
2557 2559
2558 bool Browser::ShouldStartShutdown() const { 2560 bool Browser::ShouldStartShutdown() const {
2559 return BrowserList::GetInstance()->size() <= 1; 2561 DCHECK_GE(BrowserList::GetInstance()->size(),
2562 BrowserList::GetInstance()->currently_closing_browsers_count());
2563 return (BrowserList::GetInstance()->size() -
2564 BrowserList::GetInstance()->currently_closing_browsers_count()) <= 1;
sky 2017/03/31 14:23:41 Why do you need the <= 1? Shouldn't it be size() +
Alexey Seren 2017/04/02 12:02:35 Yes you are right. Equality checking will allow to
2560 } 2565 }
2561 2566
2562 bool Browser::MaybeCreateBackgroundContents( 2567 bool Browser::MaybeCreateBackgroundContents(
2563 content::SiteInstance* source_site_instance, 2568 content::SiteInstance* source_site_instance,
2564 const GURL& opener_url, 2569 const GURL& opener_url,
2565 int32_t route_id, 2570 int32_t route_id,
2566 int32_t main_frame_route_id, 2571 int32_t main_frame_route_id,
2567 int32_t main_frame_widget_route_id, 2572 int32_t main_frame_widget_route_id,
2568 const std::string& frame_name, 2573 const std::string& frame_name,
2569 const GURL& target_url, 2574 const GURL& target_url,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 // new window later, thus we need to navigate the window now. 2643 // new window later, thus we need to navigate the window now.
2639 if (contents) { 2644 if (contents) {
2640 contents->web_contents()->GetController().LoadURL( 2645 contents->web_contents()->GetController().LoadURL(
2641 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 2646 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
2642 std::string()); // No extra headers. 2647 std::string()); // No extra headers.
2643 } 2648 }
2644 } 2649 }
2645 2650
2646 return contents != NULL; 2651 return contents != NULL;
2647 } 2652 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698