| OLD | NEW |
| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/frame_host/cross_site_transferring_request.h" | 8 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 9 #include "content/browser/frame_host/interstitial_page_impl.h" | 9 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
| (...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 } | 2758 } |
| 2759 | 2759 |
| 2760 class LoadingWebContentsObserver : public WebContentsObserver { | 2760 class LoadingWebContentsObserver : public WebContentsObserver { |
| 2761 public: | 2761 public: |
| 2762 explicit LoadingWebContentsObserver(WebContents* contents) | 2762 explicit LoadingWebContentsObserver(WebContents* contents) |
| 2763 : WebContentsObserver(contents), | 2763 : WebContentsObserver(contents), |
| 2764 is_loading_(false) { | 2764 is_loading_(false) { |
| 2765 } | 2765 } |
| 2766 ~LoadingWebContentsObserver() override {} | 2766 ~LoadingWebContentsObserver() override {} |
| 2767 | 2767 |
| 2768 void DidStartLoading(RenderViewHost* rvh) override { | 2768 void DidStartLoading() override { is_loading_ = true; } |
| 2769 is_loading_ = true; | 2769 void DidStopLoading() override { is_loading_ = false; } |
| 2770 } | |
| 2771 void DidStopLoading(RenderViewHost* rvh) override { | |
| 2772 is_loading_ = false; | |
| 2773 } | |
| 2774 | 2770 |
| 2775 bool is_loading() const { return is_loading_; } | 2771 bool is_loading() const { return is_loading_; } |
| 2776 | 2772 |
| 2777 private: | 2773 private: |
| 2778 bool is_loading_; | 2774 bool is_loading_; |
| 2779 | 2775 |
| 2780 DISALLOW_COPY_AND_ASSIGN(LoadingWebContentsObserver); | 2776 DISALLOW_COPY_AND_ASSIGN(LoadingWebContentsObserver); |
| 2781 }; | 2777 }; |
| 2782 | 2778 |
| 2783 // Ensure that DidStartLoading/DidStopLoading events balance out properly with | 2779 // Ensure that DidStartLoading/DidStopLoading events balance out properly with |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3106 frame->SendBeforeUnloadHandlersPresent(false); | 3102 frame->SendBeforeUnloadHandlersPresent(false); |
| 3107 EXPECT_FALSE(frame->SuddenTerminationAllowed()); | 3103 EXPECT_FALSE(frame->SuddenTerminationAllowed()); |
| 3108 frame->SendBeforeUnloadHandlersPresent(true); | 3104 frame->SendBeforeUnloadHandlersPresent(true); |
| 3109 frame->SendUnloadHandlersPresent(false); | 3105 frame->SendUnloadHandlersPresent(false); |
| 3110 EXPECT_FALSE(frame->SuddenTerminationAllowed()); | 3106 EXPECT_FALSE(frame->SuddenTerminationAllowed()); |
| 3111 frame->SendBeforeUnloadHandlersPresent(false); | 3107 frame->SendBeforeUnloadHandlersPresent(false); |
| 3112 EXPECT_TRUE(frame->SuddenTerminationAllowed()); | 3108 EXPECT_TRUE(frame->SuddenTerminationAllowed()); |
| 3113 } | 3109 } |
| 3114 | 3110 |
| 3115 } // namespace content | 3111 } // namespace content |
| OLD | NEW |