| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 DCHECK(IsFastTabUnloadEnabled()); | 681 DCHECK(IsFastTabUnloadEnabled()); |
| 682 return fast_unload_controller_->HasCompletedUnloadProcessing(); | 682 return fast_unload_controller_->HasCompletedUnloadProcessing(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 bool Browser::IsAttemptingToCloseBrowser() const { | 685 bool Browser::IsAttemptingToCloseBrowser() const { |
| 686 if (IsFastTabUnloadEnabled()) | 686 if (IsFastTabUnloadEnabled()) |
| 687 return fast_unload_controller_->is_attempting_to_close_browser(); | 687 return fast_unload_controller_->is_attempting_to_close_browser(); |
| 688 return unload_controller_->is_attempting_to_close_browser(); | 688 return unload_controller_->is_attempting_to_close_browser(); |
| 689 } | 689 } |
| 690 | 690 |
| 691 bool Browser::ShouldRunUnloadListenerBeforeClosing( |
| 692 content::WebContents* web_contents) { |
| 693 if (IsFastTabUnloadEnabled()) |
| 694 return fast_unload_controller_->ShouldRunUnloadEventsHelper(web_contents); |
| 695 return unload_controller_->ShouldRunUnloadEventsHelper(web_contents); |
| 696 } |
| 697 |
| 698 bool Browser::RunUnloadListenerBeforeClosing( |
| 699 content::WebContents* web_contents) { |
| 700 if (IsFastTabUnloadEnabled()) |
| 701 return fast_unload_controller_->RunUnloadEventsHelper(web_contents); |
| 702 return unload_controller_->RunUnloadEventsHelper(web_contents); |
| 703 } |
| 704 |
| 691 void Browser::OnWindowClosing() { | 705 void Browser::OnWindowClosing() { |
| 692 if (!ShouldCloseWindow()) | 706 if (!ShouldCloseWindow()) |
| 693 return; | 707 return; |
| 694 | 708 |
| 695 // Application should shutdown on last window close if the user is explicitly | 709 // Application should shutdown on last window close if the user is explicitly |
| 696 // trying to quit, or if there is nothing keeping the browser alive (such as | 710 // trying to quit, or if there is nothing keeping the browser alive (such as |
| 697 // AppController on the Mac, or BackgroundContentsService for background | 711 // AppController on the Mac, or BackgroundContentsService for background |
| 698 // pages). | 712 // pages). |
| 699 bool should_quit_if_last_browser = | 713 bool should_quit_if_last_browser = |
| 700 browser_shutdown::IsTryingToQuit() || | 714 browser_shutdown::IsTryingToQuit() || |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 if (contents && !allow_js_access) { | 2759 if (contents && !allow_js_access) { |
| 2746 contents->web_contents()->GetController().LoadURL( | 2760 contents->web_contents()->GetController().LoadURL( |
| 2747 target_url, | 2761 target_url, |
| 2748 content::Referrer(), | 2762 content::Referrer(), |
| 2749 ui::PAGE_TRANSITION_LINK, | 2763 ui::PAGE_TRANSITION_LINK, |
| 2750 std::string()); // No extra headers. | 2764 std::string()); // No extra headers. |
| 2751 } | 2765 } |
| 2752 | 2766 |
| 2753 return contents != NULL; | 2767 return contents != NULL; |
| 2754 } | 2768 } |
| OLD | NEW |