| 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // in a normal process, or if it's a process for an extension that has been | 768 // in a normal process, or if it's a process for an extension that has been |
| 768 // uninstalled. | 769 // uninstalled. |
| 769 if (frame->top()->document().url() == url) { | 770 if (frame->top()->document().url() == url) { |
| 770 if (is_extension_url != extension_dispatcher_->is_extension_process()) | 771 if (is_extension_url != extension_dispatcher_->is_extension_process()) |
| 771 return true; | 772 return true; |
| 772 } | 773 } |
| 773 | 774 |
| 774 return false; | 775 return false; |
| 775 } | 776 } |
| 776 | 777 |
| 777 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, | 778 bool ChromeContentRendererClient::WillSendRequest( |
| 778 const GURL& url, | 779 WebKit::WebFrame* frame, |
| 779 GURL* new_url) { | 780 content::PageTransition transition_type, |
| 781 const GURL& url, |
| 782 GURL* new_url) { |
| 780 // 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 |
| 781 // 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. |
| 782 if (url.SchemeIs(chrome::kExtensionScheme) && | 785 if (url.SchemeIs(chrome::kExtensionScheme) && |
| 783 !ExtensionResourceRequestPolicy::CanRequestResource( | 786 !ExtensionResourceRequestPolicy::CanRequestResource( |
| 784 url, | 787 url, |
| 785 frame, | 788 frame, |
| 789 transition_type, |
| 786 extension_dispatcher_->extensions())) { | 790 extension_dispatcher_->extensions())) { |
| 787 *new_url = GURL("chrome-extension://invalid/"); | 791 *new_url = GURL("chrome-extension://invalid/"); |
| 788 return true; | 792 return true; |
| 789 | |
| 790 } | 793 } |
| 791 | 794 |
| 792 if (url.SchemeIs(chrome::kExtensionResourceScheme) && | 795 if (url.SchemeIs(chrome::kExtensionResourceScheme) && |
| 793 !ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme( | 796 !ExtensionResourceRequestPolicy::CanRequestExtensionResourceScheme( |
| 794 url, | 797 url, |
| 795 frame)) { | 798 frame)) { |
| 796 *new_url = GURL("chrome-extension-resource://invalid/"); | 799 *new_url = GURL("chrome-extension-resource://invalid/"); |
| 797 return true; | 800 return true; |
| 798 } | 801 } |
| 799 | 802 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 950 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
| 948 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 951 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
| 949 } | 952 } |
| 950 | 953 |
| 951 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 954 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
| 952 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 955 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
| 953 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 956 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
| 954 } | 957 } |
| 955 | 958 |
| 956 } // namespace chrome | 959 } // namespace chrome |
| OLD | NEW |