OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/string_tokenizer.h" | 14 #include "base/string_tokenizer.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
17 #include "chrome/common/chrome_content_client.h" | 18 #include "chrome/common/chrome_content_client.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 // in a normal process, or if it's a process for an extension that has been | 761 // in a normal process, or if it's a process for an extension that has been |
761 // uninstalled. | 762 // uninstalled. |
762 if (frame->top()->document().url() == url) { | 763 if (frame->top()->document().url() == url) { |
763 if (is_extension_url != extension_dispatcher_->is_extension_process()) | 764 if (is_extension_url != extension_dispatcher_->is_extension_process()) |
764 return true; | 765 return true; |
765 } | 766 } |
766 | 767 |
767 return false; | 768 return false; |
768 } | 769 } |
769 | 770 |
770 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, | 771 bool ChromeContentRendererClient::WillSendRequest( |
771 const GURL& url, | 772 WebKit::WebFrame* frame, |
772 GURL* new_url) { | 773 content::PageTransition transition_type, |
| 774 const GURL& url, |
| 775 GURL* new_url) { |
773 // Check whether the request should be allowed. If not allowed, we reset the | 776 // Check whether the request should be allowed. If not allowed, we reset the |
774 // URL to something invalid to prevent the request and cause an error. | 777 // URL to something invalid to prevent the request and cause an error. |
775 if (url.SchemeIs(chrome::kExtensionScheme) && | 778 if (url.SchemeIs(chrome::kExtensionScheme) && |
776 !ExtensionResourceRequestPolicy::CanRequestResource( | 779 !ExtensionResourceRequestPolicy::CanRequestResource( |
777 url, | 780 url, |
778 frame, | 781 frame, |
| 782 transition_type, |
779 extension_dispatcher_->extensions())) { | 783 extension_dispatcher_->extensions())) { |
780 *new_url = GURL("chrome-extension://invalid/"); | 784 *new_url = GURL("chrome-extension://invalid/"); |
781 return true; | 785 return true; |
782 | |
783 } | 786 } |
784 | 787 |
785 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 788 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
786 !ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme( | 789 !ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme( |
787 url, | 790 url, |
788 frame)) { | 791 frame)) { |
789 *new_url = GURL("chrome-extension-resource://invalid/"); | 792 *new_url = GURL("chrome-extension-resource://invalid/"); |
790 return true; | 793 return true; |
791 } | 794 } |
792 | 795 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 943 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
941 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 944 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
942 } | 945 } |
943 | 946 |
944 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 947 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
945 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 948 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
946 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 949 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
947 } | 950 } |
948 | 951 |
949 } // namespace chrome | 952 } // namespace chrome |
OLD | NEW |