Chromium Code Reviews| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 // Because this will not tear down the interstitial properly, if "back" is | 848 // Because this will not tear down the interstitial properly, if "back" is |
| 849 // back to another tab type, the interstitial will still be somewhat alive | 849 // back to another tab type, the interstitial will still be somewhat alive |
| 850 // in the previous tab type. If you navigate somewhere that activates the | 850 // in the previous tab type. If you navigate somewhere that activates the |
| 851 // tab with the interstitial again, you'll see a flash before the new load | 851 // tab with the interstitial again, you'll see a flash before the new load |
| 852 // commits of the interstitial page. | 852 // commits of the interstitial page. |
| 853 if (showing_interstitial_page()) { | 853 if (showing_interstitial_page()) { |
| 854 LOG(WARNING) << "Discarding message during interstitial."; | 854 LOG(WARNING) << "Discarding message during interstitial."; |
| 855 return; | 855 return; |
| 856 } | 856 } |
| 857 | 857 |
| 858 // This will discard our pending entry if we cancelled the load (e.g., if we | 858 // Discard our pending entry if the load canceled (e.g. if we decided to |
| 859 // decided to download the file instead of load it). Only discard the | 859 // download the file instead of load it). The URL may not match the pending |
| 860 // pending entry if the URLs match, otherwise the user initiated a navigate | 860 // entry's URL if a redirect occurred, or if the user started a new |
| 861 // before the page loaded so that the discard would discard the wrong entry. | 861 // navigation. It's safer to clear the pending entry in both cases than |
|
brettw
2011/06/12 12:44:56
Can you make more clear how this is wrong in the c
Charlie Reis
2011/06/13 17:46:48
Good idea. I've tried to clarify it-- does it loo
| |
| 862 // possibly leave a stale redirect URL showing. (In the latter case, the | |
| 863 // navigation will commit even if there is no pending entry.) | |
| 862 NavigationEntry* pending_entry = controller_.pending_entry(); | 864 NavigationEntry* pending_entry = controller_.pending_entry(); |
| 863 if (pending_entry && pending_entry->url() == validated_url) { | 865 if (pending_entry) |
| 864 DidCancelLoading(); | 866 DidCancelLoading(); |
| 865 } | |
| 866 | 867 |
| 867 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); | 868 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); |
| 868 } | 869 } |
| 869 | 870 |
| 870 // 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. |
| 871 ProvisionalLoadDetails details( | 872 ProvisionalLoadDetails details( |
| 872 is_main_frame, controller_.IsURLInPageNavigation(validated_url), | 873 is_main_frame, controller_.IsURLInPageNavigation(validated_url), |
| 873 validated_url, std::string(), false, frame_id); | 874 validated_url, std::string(), false, frame_id); |
| 874 details.set_error_code(error_code); | 875 details.set_error_code(error_code); |
| 875 | 876 |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1850 | 1851 |
| 1851 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1852 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1852 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1853 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1853 rwh_view->SetSize(view()->GetContainerSize()); | 1854 rwh_view->SetSize(view()->GetContainerSize()); |
| 1854 } | 1855 } |
| 1855 | 1856 |
| 1856 void TabContents::OnOnlineStateChanged(bool online) { | 1857 void TabContents::OnOnlineStateChanged(bool online) { |
| 1857 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 1858 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 1858 render_view_host()->routing_id(), online)); | 1859 render_view_host()->routing_id(), online)); |
| 1859 } | 1860 } |
| OLD | NEW |