| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 // Because this will not tear down the interstitial properly, if "back" is | 846 // Because this will not tear down the interstitial properly, if "back" is |
| 847 // back to another tab type, the interstitial will still be somewhat alive | 847 // back to another tab type, the interstitial will still be somewhat alive |
| 848 // in the previous tab type. If you navigate somewhere that activates the | 848 // in the previous tab type. If you navigate somewhere that activates the |
| 849 // tab with the interstitial again, you'll see a flash before the new load | 849 // tab with the interstitial again, you'll see a flash before the new load |
| 850 // commits of the interstitial page. | 850 // commits of the interstitial page. |
| 851 if (showing_interstitial_page()) { | 851 if (showing_interstitial_page()) { |
| 852 LOG(WARNING) << "Discarding message during interstitial."; | 852 LOG(WARNING) << "Discarding message during interstitial."; |
| 853 return; | 853 return; |
| 854 } | 854 } |
| 855 | 855 |
| 856 // This will discard our pending entry if we cancelled the load (e.g., if we | 856 // Discard our pending entry if the load canceled (e.g. if we decided to |
| 857 // decided to download the file instead of load it). Only discard the | 857 // download the file instead of load it). We do not verify that the URL |
| 858 // pending entry if the URLs match, otherwise the user initiated a navigate | 858 // being canceled matches the pending entry's URL because they will not |
| 859 // before the page loaded so that the discard would discard the wrong entry. | 859 // match if a redirect occurred (in which case we do not want to leave a |
| 860 // stale redirect URL showing). This means that we also cancel the pending |
| 861 // entry if the user started a new navigation. As a result, the navigation |
| 862 // controller may not remember that a load is in progress, but the |
| 863 // navigation will still commit even if there is no pending entry. |
| 860 NavigationEntry* pending_entry = controller_.pending_entry(); | 864 NavigationEntry* pending_entry = controller_.pending_entry(); |
| 861 if (pending_entry && pending_entry->url() == validated_url) { | 865 if (pending_entry) |
| 862 DidCancelLoading(); | 866 DidCancelLoading(); |
| 863 } | |
| 864 | 867 |
| 865 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); | 868 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); |
| 866 } | 869 } |
| 867 | 870 |
| 868 // Send out a notification that we failed a provisional load with an error. | 871 // Send out a notification that we failed a provisional load with an error. |
| 869 ProvisionalLoadDetails details( | 872 ProvisionalLoadDetails details( |
| 870 is_main_frame, controller_.IsURLInPageNavigation(validated_url), | 873 is_main_frame, controller_.IsURLInPageNavigation(validated_url), |
| 871 validated_url, std::string(), false, frame_id); | 874 validated_url, std::string(), false, frame_id); |
| 872 details.set_error_code(error_code); | 875 details.set_error_code(error_code); |
| 873 | 876 |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 | 1841 |
| 1839 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1842 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1840 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1843 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1841 rwh_view->SetSize(view()->GetContainerSize()); | 1844 rwh_view->SetSize(view()->GetContainerSize()); |
| 1842 } | 1845 } |
| 1843 | 1846 |
| 1844 void TabContents::OnOnlineStateChanged(bool online) { | 1847 void TabContents::OnOnlineStateChanged(bool online) { |
| 1845 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 1848 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 1846 render_view_host()->routing_id(), online)); | 1849 render_view_host()->routing_id(), online)); |
| 1847 } | 1850 } |
| OLD | NEW |