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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // uninstalled. | 770 // uninstalled. |
770 if (frame->top()->document().url() == url) { | 771 if (frame->top()->document().url() == url) { |
771 if (is_extension_url != extension_dispatcher_->is_extension_process()) | 772 if (is_extension_url != extension_dispatcher_->is_extension_process()) |
772 return true; | 773 return true; |
773 } | 774 } |
774 | 775 |
775 return false; | 776 return false; |
776 } | 777 } |
777 | 778 |
778 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, | 779 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, |
779 const GURL& url, | 780 content::PageTransition transition_type, |
780 GURL* new_url) { | 781 const GURL& url, |
| 782 GURL* new_url) { |
781 // Check whether the request should be allowed. If not allowed, we reset the | 783 // Check whether the request should be allowed. If not allowed, we reset the |
782 // URL to something invalid to prevent the request and cause an error. | 784 // URL to something invalid to prevent the request and cause an error. |
783 if (url.SchemeIs(chrome::kExtensionScheme) && | 785 if (url.SchemeIs(chrome::kExtensionScheme) && |
784 !extensions::ResourceRequestPolicy::CanRequestResource( | 786 !extensions::ResourceRequestPolicy::CanRequestResource( |
785 url, | 787 url, |
786 frame, | 788 frame, |
| 789 transition_type, |
787 extension_dispatcher_->extensions())) { | 790 extension_dispatcher_->extensions())) { |
788 *new_url = GURL("chrome-extension://invalid/"); | 791 *new_url = GURL("chrome-extension://invalid/"); |
789 return true; | 792 return true; |
790 | 793 |
791 } | 794 } |
792 | 795 |
793 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 796 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
794 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( | 797 !extensions::ResourceRequestPolicy::CanRequestExtensionResourceScheme( |
795 url, | 798 url, |
796 frame)) { | 799 frame)) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 951 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
949 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 952 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
950 } | 953 } |
951 | 954 |
952 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 955 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
953 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 956 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
954 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 957 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
955 } | 958 } |
956 | 959 |
957 } // namespace chrome | 960 } // namespace chrome |
OLD | NEW |