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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 error.reason = http_status_code; | 526 error.reason = http_status_code; |
527 | 527 |
528 render_view->LoadNavigationErrorPage( | 528 render_view->LoadNavigationErrorPage( |
529 frame, frame->dataSource()->request(), error, std::string(), true); | 529 frame, frame->dataSource()->request(), error, std::string(), true); |
530 } | 530 } |
531 } | 531 } |
532 | 532 |
533 std::string ChromeContentRendererClient::GetNavigationErrorHtml( | 533 std::string ChromeContentRendererClient::GetNavigationErrorHtml( |
534 const WebURLRequest& failed_request, | 534 const WebURLRequest& failed_request, |
535 const WebURLError& error) { | 535 const WebURLError& error) { |
536 GURL failed_url = error.unreachableURL; | 536 const GURL failed_url(error.unreachableURL); |
jam
2011/10/05 17:12:06
nit: the compiler is smart enough to call the copy
mkosiba (inactive)
2011/10/05 17:53:18
Ok, I'm going to keep the const in there though.
| |
537 std::string html; | 537 std::string html; |
538 const Extension* extension = NULL; | 538 const Extension* extension = NULL; |
539 | 539 |
540 // Use a local error page. | 540 // Use a local error page. |
541 int resource_id; | 541 int resource_id; |
542 DictionaryValue error_strings; | 542 DictionaryValue error_strings; |
543 if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme)) | 543 if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme)) |
544 extension = extension_dispatcher_->extensions()->GetByURL(failed_url); | 544 extension = extension_dispatcher_->extensions()->GetByURL(failed_url); |
545 if (extension) { | 545 if (extension) { |
546 LocalizedError::GetAppErrorStrings(error, failed_url, extension, | 546 LocalizedError::GetAppErrorStrings(error, failed_url, extension, |
(...skipping 19 matching lines...) Expand all Loading... | |
566 NOTREACHED() << "unable to load template. ID: " << resource_id; | 566 NOTREACHED() << "unable to load template. ID: " << resource_id; |
567 } else { | 567 } else { |
568 // "t" is the id of the templates root node. | 568 // "t" is the id of the templates root node. |
569 html = jstemplate_builder::GetTemplatesHtml( | 569 html = jstemplate_builder::GetTemplatesHtml( |
570 template_html, &error_strings, "t"); | 570 template_html, &error_strings, "t"); |
571 } | 571 } |
572 | 572 |
573 return html; | 573 return html; |
574 } | 574 } |
575 | 575 |
576 string16 ChromeContentRendererClient::GetNavigationErrorDescription( | |
577 const WebKit::WebURLRequest& failed_request, | |
578 const WebKit::WebURLError& error) { | |
579 const GURL failed_url = error.unreachableURL; | |
mmenke
2011/10/05 16:05:18
nit: const GURL failed_url(error.unreachableURL);
mmenke
2011/10/05 17:40:11
This comment was made along the line of "if you're
mkosiba (inactive)
2011/10/05 17:53:18
Done.
| |
580 const Extension* extension = NULL; | |
581 const bool is_repost = | |
582 error.reason == net::ERR_CACHE_MISS && | |
583 error.domain == WebString::fromUTF8(net::kErrorDomain) && | |
584 EqualsASCII(failed_request.httpMethod(), "POST"); | |
mmenke
2011/10/05 16:05:18
We now have this logic in 3 places: Here, just ab
mkosiba (inactive)
2011/10/05 17:53:18
I don't think making that information a parameter
mmenke
2011/10/05 18:07:28
If you end up merging the two functions, as per Jo
| |
585 | |
586 if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme)) | |
587 extension = extension_dispatcher_->extensions()->GetByURL(failed_url); | |
588 | |
589 if (!extension && !is_repost) | |
590 return LocalizedError::GetErrorDetails(error); | |
591 else | |
592 return string16(); | |
593 } | |
594 | |
576 bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { | 595 bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { |
577 return !extension_dispatcher_->is_extension_process(); | 596 return !extension_dispatcher_->is_extension_process(); |
578 } | 597 } |
579 | 598 |
580 bool ChromeContentRendererClient::AllowPopup(const GURL& creator) { | 599 bool ChromeContentRendererClient::AllowPopup(const GURL& creator) { |
581 // Extensions and apps always allowed to create unrequested popups. The second | 600 // Extensions and apps always allowed to create unrequested popups. The second |
582 // check is necessary to include content scripts. | 601 // check is necessary to include content scripts. |
583 return extension_dispatcher_->extensions()->GetByURL(creator) || | 602 return extension_dispatcher_->extensions()->GetByURL(creator) || |
584 ExtensionBindingsContext::GetCurrent(); | 603 ExtensionBindingsContext::GetCurrent(); |
585 } | 604 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 if (spellcheck_.get()) | 789 if (spellcheck_.get()) |
771 thread->RemoveObserver(spellcheck_.get()); | 790 thread->RemoveObserver(spellcheck_.get()); |
772 SpellCheck* new_spellcheck = new SpellCheck(); | 791 SpellCheck* new_spellcheck = new SpellCheck(); |
773 if (spellcheck_provider_) | 792 if (spellcheck_provider_) |
774 spellcheck_provider_->SetSpellCheck(new_spellcheck); | 793 spellcheck_provider_->SetSpellCheck(new_spellcheck); |
775 spellcheck_.reset(new_spellcheck); | 794 spellcheck_.reset(new_spellcheck); |
776 thread->AddObserver(new_spellcheck); | 795 thread->AddObserver(new_spellcheck); |
777 } | 796 } |
778 | 797 |
779 } // namespace chrome | 798 } // namespace chrome |
OLD | NEW |