| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // current content state during tab closing we use a shorter timeout for the | 291 // current content state during tab closing we use a shorter timeout for the |
| 292 // foreground renderer. This means there is a small window of time from which | 292 // foreground renderer. This means there is a small window of time from which |
| 293 // content state is modified and not sent to session restore, but this is | 293 // content state is modified and not sent to session restore, but this is |
| 294 // better than having to wake up all renderers during shutdown. | 294 // better than having to wake up all renderers during shutdown. |
| 295 static const int kDelaySecondsForContentStateSyncHidden = 5; | 295 static const int kDelaySecondsForContentStateSyncHidden = 5; |
| 296 static const int kDelaySecondsForContentStateSync = 1; | 296 static const int kDelaySecondsForContentStateSync = 1; |
| 297 | 297 |
| 298 // The maximum number of popups that can be spawned from one page. | 298 // The maximum number of popups that can be spawned from one page. |
| 299 static const int kMaximumNumberOfUnacknowledgedPopups = 25; | 299 static const int kMaximumNumberOfUnacknowledgedPopups = 25; |
| 300 | 300 |
| 301 static const char kUnreachableWebDataURL[] = "chrome://chromewebdata/"; | |
| 302 static const char kBackForwardNavigationScheme[] = "history"; | 301 static const char kBackForwardNavigationScheme[] = "history"; |
| 303 | 302 |
| 304 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 303 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
| 305 WebVector<WebURL> urls; | 304 WebVector<WebURL> urls; |
| 306 ds->redirectChain(urls); | 305 ds->redirectChain(urls); |
| 307 result->reserve(urls.size()); | 306 result->reserve(urls.size()); |
| 308 for (size_t i = 0; i < urls.size(); ++i) | 307 for (size_t i = 0; i < urls.size(); ++i) |
| 309 result->push_back(urls[i]); | 308 result->push_back(urls[i]); |
| 310 } | 309 } |
| 311 | 310 |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 resource_id = IDR_NET_ERROR_HTML; | 1624 resource_id = IDR_NET_ERROR_HTML; |
| 1626 } | 1625 } |
| 1627 } | 1626 } |
| 1628 | 1627 |
| 1629 alt_html = GetAltHTMLForTemplate(error_strings, resource_id); | 1628 alt_html = GetAltHTMLForTemplate(error_strings, resource_id); |
| 1630 } else { | 1629 } else { |
| 1631 alt_html = html; | 1630 alt_html = html; |
| 1632 } | 1631 } |
| 1633 | 1632 |
| 1634 frame->loadHTMLString(alt_html, | 1633 frame->loadHTMLString(alt_html, |
| 1635 GURL(kUnreachableWebDataURL), | 1634 GURL(chrome::kChromeUnreachableWebDataURL), |
| 1636 failed_url, | 1635 failed_url, |
| 1637 replace); | 1636 replace); |
| 1638 } | 1637 } |
| 1639 | 1638 |
| 1640 void RenderView::BindDOMAutomationController(WebFrame* frame) { | 1639 void RenderView::BindDOMAutomationController(WebFrame* frame) { |
| 1641 if (!dom_automation_controller_.get()) { | 1640 if (!dom_automation_controller_.get()) { |
| 1642 dom_automation_controller_.reset(new DomAutomationController()); | 1641 dom_automation_controller_.reset(new DomAutomationController()); |
| 1643 } | 1642 } |
| 1644 dom_automation_controller_->set_message_sender(this); | 1643 dom_automation_controller_->set_message_sender(this); |
| 1645 dom_automation_controller_->set_routing_id(routing_id_); | 1644 dom_automation_controller_->set_routing_id(routing_id_); |
| (...skipping 3123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4769 return false; | 4768 return false; |
| 4770 | 4769 |
| 4771 const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL, | 4770 const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL, |
| 4772 ec == net::ERR_NAME_NOT_RESOLVED ? DNS_ERROR : CONNECTION_ERROR); | 4771 ec == net::ERR_NAME_NOT_RESOLVED ? DNS_ERROR : CONNECTION_ERROR); |
| 4773 if (!error_page_url.is_valid()) | 4772 if (!error_page_url.is_valid()) |
| 4774 return false; | 4773 return false; |
| 4775 | 4774 |
| 4776 // Load an empty page first so there is an immediate response to the error, | 4775 // Load an empty page first so there is an immediate response to the error, |
| 4777 // and then kick off a request for the alternate error page. | 4776 // and then kick off a request for the alternate error page. |
| 4778 frame->loadHTMLString(std::string(), | 4777 frame->loadHTMLString(std::string(), |
| 4779 GURL(kUnreachableWebDataURL), | 4778 GURL(chrome::kChromeUnreachableWebDataURL), |
| 4780 error.unreachableURL, | 4779 error.unreachableURL, |
| 4781 replace); | 4780 replace); |
| 4782 | 4781 |
| 4783 // Now, create a fetcher for the error page and associate it with the data | 4782 // Now, create a fetcher for the error page and associate it with the data |
| 4784 // source we just created via the LoadHTMLString call. That way if another | 4783 // source we just created via the LoadHTMLString call. That way if another |
| 4785 // navigation occurs, the fetcher will get destroyed. | 4784 // navigation occurs, the fetcher will get destroyed. |
| 4786 NavigationState* navigation_state = | 4785 NavigationState* navigation_state = |
| 4787 NavigationState::FromDataSource(frame->provisionalDataSource()); | 4786 NavigationState::FromDataSource(frame->provisionalDataSource()); |
| 4788 navigation_state->set_alt_error_page_fetcher( | 4787 navigation_state->set_alt_error_page_fetcher( |
| 4789 new AltErrorPageResourceFetcher( | 4788 new AltErrorPageResourceFetcher( |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6071 } | 6070 } |
| 6072 | 6071 |
| 6073 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, | 6072 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, |
| 6074 IPC::PlatformFileForTransit file_for_transit, | 6073 IPC::PlatformFileForTransit file_for_transit, |
| 6075 int message_id) { | 6074 int message_id) { |
| 6076 pepper_delegate_.OnAsyncFileOpened( | 6075 pepper_delegate_.OnAsyncFileOpened( |
| 6077 error_code, | 6076 error_code, |
| 6078 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6077 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 6079 message_id); | 6078 message_id); |
| 6080 } | 6079 } |
| OLD | NEW |