| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 #include "extensions/common/constants.h" | 73 #include "extensions/common/constants.h" |
| 74 #include "extensions/common/extension_urls.h" | 74 #include "extensions/common/extension_urls.h" |
| 75 #include "grit/generated_resources.h" | 75 #include "grit/generated_resources.h" |
| 76 #include "grit/locale_settings.h" | 76 #include "grit/locale_settings.h" |
| 77 #include "grit/renderer_resources.h" | 77 #include "grit/renderer_resources.h" |
| 78 #include "ipc/ipc_sync_channel.h" | 78 #include "ipc/ipc_sync_channel.h" |
| 79 #include "net/base/net_errors.h" | 79 #include "net/base/net_errors.h" |
| 80 #include "ppapi/c/private/ppb_nacl_private.h" | 80 #include "ppapi/c/private/ppb_nacl_private.h" |
| 81 #include "ppapi/c/private/ppb_pdf.h" | 81 #include "ppapi/c/private/ppb_pdf.h" |
| 82 #include "ppapi/shared_impl/ppapi_switches.h" | 82 #include "ppapi/shared_impl/ppapi_switches.h" |
| 83 #include "third_party/WebKit/public/platform/WebURL.h" |
| 84 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 85 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 83 #include "third_party/WebKit/public/web/WebCache.h" | 86 #include "third_party/WebKit/public/web/WebCache.h" |
| 84 #include "third_party/WebKit/public/web/WebDataSource.h" | 87 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 85 #include "third_party/WebKit/public/web/WebDocument.h" | 88 #include "third_party/WebKit/public/web/WebDocument.h" |
| 86 #include "third_party/WebKit/public/web/WebElement.h" | 89 #include "third_party/WebKit/public/web/WebElement.h" |
| 87 #include "third_party/WebKit/public/web/WebFrame.h" | 90 #include "third_party/WebKit/public/web/WebFrame.h" |
| 88 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 91 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 89 #include "third_party/WebKit/public/web/WebPluginParams.h" | 92 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 90 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 93 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 91 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 94 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 92 #include "third_party/WebKit/public/platform/WebURL.h" | 95 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 93 #include "third_party/WebKit/public/platform/WebURLError.h" | |
| 94 #include "third_party/WebKit/public/platform/WebURLRequest.h" | |
| 95 #include "ui/base/l10n/l10n_util.h" | 96 #include "ui/base/l10n/l10n_util.h" |
| 96 #include "ui/base/layout.h" | 97 #include "ui/base/layout.h" |
| 97 #include "ui/base/resource/resource_bundle.h" | 98 #include "ui/base/resource/resource_bundle.h" |
| 98 #include "ui/webui/jstemplate_builder.h" | 99 #include "ui/webui/jstemplate_builder.h" |
| 99 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 100 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 100 | 101 |
| 101 #if defined(ENABLE_WEBRTC) | 102 #if defined(ENABLE_WEBRTC) |
| 102 #include "chrome/renderer/media/webrtc_logging_message_filter.h" | 103 #include "chrome/renderer/media/webrtc_logging_message_filter.h" |
| 103 #endif | 104 #endif |
| 104 | 105 |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 bool ChromeContentRendererClient::AllowPopup() { | 918 bool ChromeContentRendererClient::AllowPopup() { |
| 918 extensions::ChromeV8Context* current_context = | 919 extensions::ChromeV8Context* current_context = |
| 919 extension_dispatcher_->v8_context_set().GetCurrent(); | 920 extension_dispatcher_->v8_context_set().GetCurrent(); |
| 920 return current_context && current_context->extension() && | 921 return current_context && current_context->extension() && |
| 921 (current_context->context_type() == | 922 (current_context->context_type() == |
| 922 extensions::Feature::BLESSED_EXTENSION_CONTEXT || | 923 extensions::Feature::BLESSED_EXTENSION_CONTEXT || |
| 923 current_context->context_type() == | 924 current_context->context_type() == |
| 924 extensions::Feature::CONTENT_SCRIPT_CONTEXT); | 925 extensions::Feature::CONTENT_SCRIPT_CONTEXT); |
| 925 } | 926 } |
| 926 | 927 |
| 928 // For top-level navigations, tries to find a platform app that has registered |
| 929 // a URL handler matching the URL. If found, delegates further URL processing |
| 930 // to the browser (the browser is supposed to launch the app), and returns true |
| 931 // to cancel navigation on the renderer side. Otherwise, returns false. |
| 932 bool ChromeContentRendererClient::HandleNavigation( |
| 933 WebKit::WebFrame* frame, |
| 934 const WebKit::WebURLRequest& request, |
| 935 WebKit::WebNavigationType type, |
| 936 WebKit::WebNavigationPolicy default_policy, |
| 937 bool is_redirect) { |
| 938 return extension_dispatcher_->MaybeRedirectUrlToApp(frame, |
| 939 request, |
| 940 type, |
| 941 default_policy); |
| 942 } |
| 943 |
| 927 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, | 944 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, |
| 928 const GURL& url, | 945 const GURL& url, |
| 929 const std::string& http_method, | 946 const std::string& http_method, |
| 930 bool is_initial_navigation, | 947 bool is_initial_navigation, |
| 931 bool is_server_redirect, | 948 bool is_server_redirect, |
| 932 bool* send_referrer) { | 949 bool* send_referrer) { |
| 933 DCHECK(!frame->parent()); | 950 DCHECK(!frame->parent()); |
| 934 | 951 |
| 935 // If this is the Instant process, fork all navigations originating from the | 952 // If this is the Instant process, fork all navigations originating from the |
| 936 // renderer. The destination page will then be bucketed back to this Instant | 953 // renderer. The destination page will then be bucketed back to this Instant |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 #endif // !defined(OS_ANDROID) | 1316 #endif // !defined(OS_ANDROID) |
| 1300 return false; | 1317 return false; |
| 1301 } | 1318 } |
| 1302 | 1319 |
| 1303 bool ChromeContentRendererClient::ShouldReportDetailedMessageForSource( | 1320 bool ChromeContentRendererClient::ShouldReportDetailedMessageForSource( |
| 1304 const base::string16& source) const { | 1321 const base::string16& source) const { |
| 1305 return extensions::IsSourceFromAnExtension(source); | 1322 return extensions::IsSourceFromAnExtension(source); |
| 1306 } | 1323 } |
| 1307 | 1324 |
| 1308 } // namespace chrome | 1325 } // namespace chrome |
| OLD | NEW |