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