OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 #include "web/WebFrameWidgetImpl.h" | 237 #include "web/WebFrameWidgetImpl.h" |
238 #include "web/WebPluginContainerImpl.h" | 238 #include "web/WebPluginContainerImpl.h" |
239 #include "web/WebRemoteFrameImpl.h" | 239 #include "web/WebRemoteFrameImpl.h" |
240 #include "web/WebViewImpl.h" | 240 #include "web/WebViewImpl.h" |
241 #include "wtf/CurrentTime.h" | 241 #include "wtf/CurrentTime.h" |
242 #include "wtf/HashMap.h" | 242 #include "wtf/HashMap.h" |
243 #include <algorithm> | 243 #include <algorithm> |
244 | 244 |
245 namespace blink { | 245 namespace blink { |
246 | 246 |
| 247 namespace { |
| 248 |
| 249 bool translateConsoleLevel(const WebConsoleMessage::Level level, MessageLevel* w
ebCoreMessageLevel) |
| 250 { |
| 251 switch (level) { |
| 252 case WebConsoleMessage::LevelDebug: |
| 253 *webCoreMessageLevel = DebugMessageLevel; |
| 254 break; |
| 255 case WebConsoleMessage::LevelLog: |
| 256 *webCoreMessageLevel = LogMessageLevel; |
| 257 break; |
| 258 case WebConsoleMessage::LevelWarning: |
| 259 *webCoreMessageLevel = WarningMessageLevel; |
| 260 break; |
| 261 case WebConsoleMessage::LevelError: |
| 262 *webCoreMessageLevel = ErrorMessageLevel; |
| 263 break; |
| 264 default: |
| 265 return false; |
| 266 } |
| 267 return true; |
| 268 } |
| 269 |
| 270 } // namespace |
| 271 |
247 static int frameCount = 0; | 272 static int frameCount = 0; |
248 | 273 |
249 static HeapVector<ScriptSourceCode> createSourcesVector(const WebScriptSource* s
ourcesIn, unsigned numSources) | 274 static HeapVector<ScriptSourceCode> createSourcesVector(const WebScriptSource* s
ourcesIn, unsigned numSources) |
250 { | 275 { |
251 HeapVector<ScriptSourceCode> sources; | 276 HeapVector<ScriptSourceCode> sources; |
252 sources.append(sourcesIn, numSources); | 277 sources.append(sourcesIn, numSources); |
253 return sources; | 278 return sources; |
254 } | 279 } |
255 | 280 |
256 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame*
frame) | 281 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame*
frame) |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 { | 769 { |
745 DCHECK(frame()); | 770 DCHECK(frame()); |
746 DOMWrapperWorld::setIsolatedWorldHumanReadableName(worldID, humanReadableNam
e); | 771 DOMWrapperWorld::setIsolatedWorldHumanReadableName(worldID, humanReadableNam
e); |
747 } | 772 } |
748 | 773 |
749 void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message) | 774 void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message) |
750 { | 775 { |
751 DCHECK(frame()); | 776 DCHECK(frame()); |
752 | 777 |
753 MessageLevel webCoreMessageLevel; | 778 MessageLevel webCoreMessageLevel; |
754 switch (message.level) { | 779 if (!translateConsoleLevel(message.level, &webCoreMessageLevel)) { |
755 case WebConsoleMessage::LevelDebug: | |
756 webCoreMessageLevel = DebugMessageLevel; | |
757 break; | |
758 case WebConsoleMessage::LevelLog: | |
759 webCoreMessageLevel = LogMessageLevel; | |
760 break; | |
761 case WebConsoleMessage::LevelWarning: | |
762 webCoreMessageLevel = WarningMessageLevel; | |
763 break; | |
764 case WebConsoleMessage::LevelError: | |
765 webCoreMessageLevel = ErrorMessageLevel; | |
766 break; | |
767 default: | |
768 NOTREACHED(); | 780 NOTREACHED(); |
769 return; | 781 return; |
770 } | 782 } |
771 | 783 |
772 frame()->document()->addConsoleMessage(ConsoleMessage::create(OtherMessageSo
urce, webCoreMessageLevel, message.text, message.url, message.lineNumber, messag
e.columnNumber)); | 784 frame()->document()->addConsoleMessage(ConsoleMessage::create(OtherMessageSo
urce, webCoreMessageLevel, message.text, message.url, message.lineNumber, messag
e.columnNumber)); |
773 } | 785 } |
774 | 786 |
| 787 void WebLocalFrameImpl::addSecurityMessageToConsole(const WebConsoleMessage& mes
sage) |
| 788 { |
| 789 DCHECK(frame()); |
| 790 |
| 791 MessageLevel webCoreMessageLevel; |
| 792 if (!translateConsoleLevel(message.level, &webCoreMessageLevel)) { |
| 793 ASSERT_NOT_REACHED(); |
| 794 return; |
| 795 } |
| 796 |
| 797 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, webCoreMessageLevel, message.text, message.url, message.lineNumber, mes
sage.columnNumber)); |
| 798 } |
| 799 |
775 void WebLocalFrameImpl::collectGarbage() | 800 void WebLocalFrameImpl::collectGarbage() |
776 { | 801 { |
777 if (!frame()) | 802 if (!frame()) |
778 return; | 803 return; |
779 if (!frame()->settings()->scriptEnabled()) | 804 if (!frame()->settings()->scriptEnabled()) |
780 return; | 805 return; |
781 V8GCController::collectGarbage(v8::Isolate::GetCurrent()); | 806 V8GCController::collectGarbage(v8::Isolate::GetCurrent()); |
782 } | 807 } |
783 | 808 |
784 v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScr
iptSource& source) | 809 v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScr
iptSource& source) |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 return WebSandboxFlags::None; | 2155 return WebSandboxFlags::None; |
2131 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); | 2156 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags(
)); |
2132 } | 2157 } |
2133 | 2158 |
2134 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) | 2159 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
2135 { | 2160 { |
2136 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); | 2161 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
2137 } | 2162 } |
2138 | 2163 |
2139 } // namespace blink | 2164 } // namespace blink |
OLD | NEW |