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