| OLD | NEW | 
|     1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2009 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/render_view.h" |     5 #include "chrome/renderer/render_view.h" | 
|     6  |     6  | 
|     7 #include <algorithm> |     7 #include <algorithm> | 
|     8 #include <string> |     8 #include <string> | 
|     9 #include <vector> |     9 #include <vector> | 
|    10  |    10  | 
| (...skipping 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2415   Send(new ViewHostMsg_DidDisplayInsecureContent(routing_id_)); |  2415   Send(new ViewHostMsg_DidDisplayInsecureContent(routing_id_)); | 
|  2416 } |  2416 } | 
|  2417  |  2417  | 
|  2418 void RenderView::didRunInsecureContent( |  2418 void RenderView::didRunInsecureContent( | 
|  2419     WebFrame* frame, const WebSecurityOrigin& origin) { |  2419     WebFrame* frame, const WebSecurityOrigin& origin) { | 
|  2420   Send(new ViewHostMsg_DidRunInsecureContent( |  2420   Send(new ViewHostMsg_DidRunInsecureContent( | 
|  2421       routing_id_, |  2421       routing_id_, | 
|  2422       origin.toString().utf8())); |  2422       origin.toString().utf8())); | 
|  2423 } |  2423 } | 
|  2424  |  2424  | 
 |  2425 bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) { | 
 |  2426   if (enabled_per_settings) | 
 |  2427     return true; | 
 |  2428  | 
 |  2429   WebSecurityOrigin origin = frame->securityOrigin(); | 
 |  2430   if (origin.isEmpty()) | 
 |  2431     return false;  // Uninitialized document? | 
 |  2432  | 
 |  2433   if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | 
 |  2434     return true;  // Browser UI elements should still work. | 
 |  2435  | 
 |  2436   // If the scheme is ftp: or file:, an empty file name indicates a directory | 
 |  2437   // listing, which requires JavaScript to function properly. | 
 |  2438   GURL frame_url = frame->url(); | 
 |  2439   const char* kDirProtocols[] = { "ftp", "file" }; | 
 |  2440   for (size_t i = 0; i < arraysize(kDirProtocols); ++i) { | 
 |  2441     if (EqualsASCII(origin.protocol(), kDirProtocols[i])) { | 
 |  2442       return frame_url.SchemeIs(kDirProtocols[i]) && | 
 |  2443              frame_url.ExtractFileName().empty(); | 
 |  2444     } | 
 |  2445   } | 
 |  2446  | 
 |  2447   return false;  // Other protocols fall through here. | 
 |  2448 } | 
 |  2449  | 
|  2425 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { |  2450 void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) { | 
|  2426   Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |  2451   Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 
|  2427 } |  2452 } | 
|  2428  |  2453  | 
|  2429 void RenderView::didCreateScriptContext(WebFrame* frame) { |  2454 void RenderView::didCreateScriptContext(WebFrame* frame) { | 
|  2430   EventBindings::HandleContextCreated(frame, false); |  2455   EventBindings::HandleContextCreated(frame, false); | 
|  2431 } |  2456 } | 
|  2432  |  2457  | 
|  2433 void RenderView::didDestroyScriptContext(WebFrame* frame) { |  2458 void RenderView::didDestroyScriptContext(WebFrame* frame) { | 
|  2434   EventBindings::HandleContextDestroyed(frame); |  2459   EventBindings::HandleContextDestroyed(frame); | 
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3714       new PluginMsg_SignalModalDialogEvent(host_window_)); |  3739       new PluginMsg_SignalModalDialogEvent(host_window_)); | 
|  3715  |  3740  | 
|  3716   message->EnableMessagePumping();  // Runs a nested message loop. |  3741   message->EnableMessagePumping();  // Runs a nested message loop. | 
|  3717   bool rv = Send(message); |  3742   bool rv = Send(message); | 
|  3718  |  3743  | 
|  3719   PluginChannelHost::Broadcast( |  3744   PluginChannelHost::Broadcast( | 
|  3720       new PluginMsg_ResetModalDialogEvent(host_window_)); |  3745       new PluginMsg_ResetModalDialogEvent(host_window_)); | 
|  3721  |  3746  | 
|  3722   return rv; |  3747   return rv; | 
|  3723 } |  3748 } | 
| OLD | NEW |