| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/WebDevToolsFrontendImpl.h" | 31 #include "web/WebDevToolsFrontendImpl.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 34 #include "bindings/core/v8/V8BindingForCore.h" | 34 #include "bindings/core/v8/V8BindingForCore.h" |
| 35 #include "bindings/core/v8/V8DevToolsHost.h" | 35 #include "bindings/core/v8/V8DevToolsHost.h" |
| 36 #include "core/exported/WebViewBase.h" | 36 #include "core/exported/WebViewBase.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/WebLocalFrameBase.h" |
| 38 #include "core/inspector/DevToolsHost.h" | 39 #include "core/inspector/DevToolsHost.h" |
| 39 #include "core/page/Page.h" | 40 #include "core/page/Page.h" |
| 40 #include "public/platform/WebSecurityOrigin.h" | 41 #include "public/platform/WebSecurityOrigin.h" |
| 41 #include "public/platform/WebString.h" | 42 #include "public/platform/WebString.h" |
| 42 #include "public/web/WebDevToolsFrontendClient.h" | 43 #include "public/web/WebDevToolsFrontendClient.h" |
| 43 #include "web/WebLocalFrameImpl.h" | |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 WebDevToolsFrontend* WebDevToolsFrontend::Create( | 47 WebDevToolsFrontend* WebDevToolsFrontend::Create( |
| 48 WebLocalFrame* frame, | 48 WebLocalFrame* frame, |
| 49 WebDevToolsFrontendClient* client) { | 49 WebDevToolsFrontendClient* client) { |
| 50 return new WebDevToolsFrontendImpl(ToWebLocalFrameImpl(frame), client); | 50 return new WebDevToolsFrontendImpl(ToWebLocalFrameBase(frame), client); |
| 51 } | 51 } |
| 52 | 52 |
| 53 WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( | 53 WebDevToolsFrontendImpl::WebDevToolsFrontendImpl( |
| 54 WebLocalFrameImpl* web_frame, | 54 WebLocalFrameBase* web_frame, |
| 55 WebDevToolsFrontendClient* client) | 55 WebDevToolsFrontendClient* client) |
| 56 : web_frame_(web_frame), client_(client) { | 56 : web_frame_(web_frame), client_(client) { |
| 57 web_frame_->SetDevToolsFrontend(this); | 57 web_frame_->SetDevToolsFrontend(this); |
| 58 web_frame_->GetFrame()->GetPage()->SetDefaultPageScaleLimits(1.f, 1.f); | 58 web_frame_->GetFrame()->GetPage()->SetDefaultPageScaleLimits(1.f, 1.f); |
| 59 } | 59 } |
| 60 | 60 |
| 61 WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() { | 61 WebDevToolsFrontendImpl::~WebDevToolsFrontendImpl() { |
| 62 if (devtools_host_) | 62 if (devtools_host_) |
| 63 devtools_host_->DisconnectClient(); | 63 devtools_host_->DisconnectClient(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void WebDevToolsFrontendImpl::DidClearWindowObject(WebLocalFrameImpl* frame) { | 66 void WebDevToolsFrontendImpl::DidClearWindowObject(WebLocalFrameBase* frame) { |
| 67 if (web_frame_ == frame) { | 67 if (web_frame_ == frame) { |
| 68 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 68 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 69 // Use higher limit for DevTools isolate so that it does not OOM when | 69 // Use higher limit for DevTools isolate so that it does not OOM when |
| 70 // profiling large heaps. | 70 // profiling large heaps. |
| 71 isolate->IncreaseHeapLimitForDebugging(); | 71 isolate->IncreaseHeapLimitForDebugging(); |
| 72 ScriptState* script_state = | 72 ScriptState* script_state = |
| 73 ToScriptStateForMainWorld(web_frame_->GetFrame()); | 73 ToScriptStateForMainWorld(web_frame_->GetFrame()); |
| 74 DCHECK(script_state); | 74 DCHECK(script_state); |
| 75 ScriptState::Scope scope(script_state); | 75 ScriptState::Scope scope(script_state); |
| 76 | 76 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 bool WebDevToolsFrontendImpl::IsUnderTest() { | 109 bool WebDevToolsFrontendImpl::IsUnderTest() { |
| 110 return client_ ? client_->IsUnderTest() : false; | 110 return client_ ? client_->IsUnderTest() : false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WebDevToolsFrontendImpl::ShowContextMenu( | 113 void WebDevToolsFrontendImpl::ShowContextMenu( |
| 114 LocalFrame* target_frame, | 114 LocalFrame* target_frame, |
| 115 float x, | 115 float x, |
| 116 float y, | 116 float y, |
| 117 ContextMenuProvider* menu_provider) { | 117 ContextMenuProvider* menu_provider) { |
| 118 WebLocalFrameImpl::FromFrame(target_frame) | 118 WebLocalFrameBase::FromFrame(target_frame) |
| 119 ->ViewImpl() | 119 ->ViewImpl() |
| 120 ->ShowContextMenuAtPoint(x, y, menu_provider); | 120 ->ShowContextMenuAtPoint(x, y, menu_provider); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void WebDevToolsFrontendImpl::SetInjectedScriptForOrigin(const String& origin, | 123 void WebDevToolsFrontendImpl::SetInjectedScriptForOrigin(const String& origin, |
| 124 const String& source) { | 124 const String& source) { |
| 125 injected_script_for_origin_.Set(origin, source); | 125 injected_script_for_origin_.Set(origin, source); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |