| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 &security_bits); | 1846 &security_bits); |
| 1847 LoadFromMemoryCacheDetails details(url, frame_origin, main_frame_origin, | 1847 LoadFromMemoryCacheDetails details(url, frame_origin, main_frame_origin, |
| 1848 process()->pid(), cert_id, cert_status); | 1848 process()->pid(), cert_id, cert_status); |
| 1849 | 1849 |
| 1850 NotificationService::current()->Notify( | 1850 NotificationService::current()->Notify( |
| 1851 NotificationType::LOAD_FROM_MEMORY_CACHE, | 1851 NotificationType::LOAD_FROM_MEMORY_CACHE, |
| 1852 Source<NavigationController>(&controller_), | 1852 Source<NavigationController>(&controller_), |
| 1853 Details<LoadFromMemoryCacheDetails>(&details)); | 1853 Details<LoadFromMemoryCacheDetails>(&details)); |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 void TabContents::MarkAsDownload() { |
| 1857 NavigationEntry* pending_entry = controller_.pending_entry(); |
| 1858 if (pending_entry) { |
| 1859 pending_entry->set_page_type(NavigationEntry::DOWNLOAD_PAGE); |
| 1860 } |
| 1861 } |
| 1862 |
| 1863 |
| 1856 void TabContents::DidFailProvisionalLoadWithError( | 1864 void TabContents::DidFailProvisionalLoadWithError( |
| 1857 RenderViewHost* render_view_host, | 1865 RenderViewHost* render_view_host, |
| 1858 bool is_main_frame, | 1866 bool is_main_frame, |
| 1859 int error_code, | 1867 int error_code, |
| 1860 const GURL& url, | 1868 const GURL& url, |
| 1861 bool showing_repost_interstitial) { | 1869 bool showing_repost_interstitial) { |
| 1862 if (net::ERR_ABORTED == error_code) { | 1870 if (net::ERR_ABORTED == error_code) { |
| 1863 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. | 1871 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. |
| 1864 // This means that the interstitial won't be torn down properly, which is | 1872 // This means that the interstitial won't be torn down properly, which is |
| 1865 // bad. But if we have an interstitial, go back to another tab type, and | 1873 // bad. But if we have an interstitial, go back to another tab type, and |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1881 if (showing_interstitial_page()) { | 1889 if (showing_interstitial_page()) { |
| 1882 LOG(WARNING) << "Discarding message during interstitial."; | 1890 LOG(WARNING) << "Discarding message during interstitial."; |
| 1883 return; | 1891 return; |
| 1884 } | 1892 } |
| 1885 | 1893 |
| 1886 // This will discard our pending entry if we cancelled the load (e.g., if we | 1894 // This will discard our pending entry if we cancelled the load (e.g., if we |
| 1887 // decided to download the file instead of load it). Only discard the | 1895 // decided to download the file instead of load it). Only discard the |
| 1888 // pending entry if the URLs match, otherwise the user initiated a navigate | 1896 // pending entry if the URLs match, otherwise the user initiated a navigate |
| 1889 // before the page loaded so that the discard would discard the wrong entry. | 1897 // before the page loaded so that the discard would discard the wrong entry. |
| 1890 NavigationEntry* pending_entry = controller_.pending_entry(); | 1898 NavigationEntry* pending_entry = controller_.pending_entry(); |
| 1899 bool is_downloading = pending_entry ? |
| 1900 pending_entry->page_type() == NavigationEntry::DOWNLOAD_PAGE : false; |
| 1891 if (pending_entry && pending_entry->url() == url) | 1901 if (pending_entry && pending_entry->url() == url) |
| 1892 controller_.DiscardNonCommittedEntries(); | 1902 controller_.DiscardNonCommittedEntries(); |
| 1893 | 1903 |
| 1904 if (delegate() && is_downloading) { |
| 1905 delegate()->NavigationStateChanged(this, TabContents::INVALIDATE_URL); |
| 1906 } |
| 1907 |
| 1894 render_manager_.RendererAbortedProvisionalLoad(render_view_host); | 1908 render_manager_.RendererAbortedProvisionalLoad(render_view_host); |
| 1895 } | 1909 } |
| 1896 | 1910 |
| 1897 // Send out a notification that we failed a provisional load with an error. | 1911 // Send out a notification that we failed a provisional load with an error. |
| 1898 ProvisionalLoadDetails details(is_main_frame, | 1912 ProvisionalLoadDetails details(is_main_frame, |
| 1899 controller_.IsURLInPageNavigation(url), | 1913 controller_.IsURLInPageNavigation(url), |
| 1900 url, std::string(), false); | 1914 url, std::string(), false); |
| 1901 details.set_error_code(error_code); | 1915 details.set_error_code(error_code); |
| 1902 | 1916 |
| 1903 NotificationService::current()->Notify( | 1917 NotificationService::current()->Notify( |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 NavigationController::LoadCommittedDetails& committed_details = | 2451 NavigationController::LoadCommittedDetails& committed_details = |
| 2438 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2452 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
| 2439 ExpireInfoBars(committed_details); | 2453 ExpireInfoBars(committed_details); |
| 2440 break; | 2454 break; |
| 2441 } | 2455 } |
| 2442 | 2456 |
| 2443 default: | 2457 default: |
| 2444 NOTREACHED(); | 2458 NOTREACHED(); |
| 2445 } | 2459 } |
| 2446 } | 2460 } |
| OLD | NEW |