| 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 "content/shell/shell_content_renderer_client.h" | 5 #include "content/shell/shell_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 std::string mime_type = params.mimeType.utf8(); | 74 std::string mime_type = params.mimeType.utf8(); |
| 75 if (mime_type == content::kBrowserPluginMimeType) { | 75 if (mime_type == content::kBrowserPluginMimeType) { |
| 76 // Allow browser plugin in content_shell only if it is forced by flag. | 76 // Allow browser plugin in content_shell only if it is forced by flag. |
| 77 // Returning true here disables the plugin. | 77 // Returning true here disables the plugin. |
| 78 return !CommandLine::ForCurrentProcess()->HasSwitch( | 78 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 79 switches::kEnableBrowserPluginForAllViewTypes); | 79 switches::kEnableBrowserPluginForAllViewTypes); |
| 80 } | 80 } |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool ShellContentRendererClient::WillSendRequest( | |
| 85 WebFrame* frame, | |
| 86 PageTransition transition_type, | |
| 87 const GURL& url, | |
| 88 const GURL& first_party_for_cookies, | |
| 89 GURL* new_url) { | |
| 90 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 91 if (!command_line->HasSwitch(switches::kDumpRenderTree)) | |
| 92 return false; | |
| 93 ShellRenderProcessObserver* render_process_observer = | |
| 94 ShellRenderProcessObserver::GetInstance(); | |
| 95 if (!command_line->HasSwitch(switches::kAllowExternalPages) && | |
| 96 IsExternalPage(url) && !IsExternalPage(first_party_for_cookies)) { | |
| 97 if (render_process_observer->test_delegate()) { | |
| 98 render_process_observer->test_delegate()->printMessage( | |
| 99 std::string("Blocked access to external URL " + url.spec() + "\n")); | |
| 100 } | |
| 101 *new_url = GURL(); | |
| 102 return true; | |
| 103 } | |
| 104 if (render_process_observer->test_delegate()) { | |
| 105 *new_url = render_process_observer->test_delegate()->rewriteLayoutTestsURL( | |
| 106 url.spec()); | |
| 107 } | |
| 108 return true; | |
| 109 } | |
| 110 | |
| 111 } // namespace content | 84 } // namespace content |
| OLD | NEW |