Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2859273002: [DevTools] Do not talk to inspector overlay from outside (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 #include "public/web/WebSelection.h" 154 #include "public/web/WebSelection.h"
155 #include "public/web/WebViewClient.h" 155 #include "public/web/WebViewClient.h"
156 #include "public/web/WebWindowFeatures.h" 156 #include "public/web/WebWindowFeatures.h"
157 #include "web/AnimationWorkletProxyClientImpl.h" 157 #include "web/AnimationWorkletProxyClientImpl.h"
158 #include "web/CompositorMutatorImpl.h" 158 #include "web/CompositorMutatorImpl.h"
159 #include "web/CompositorWorkerProxyClientImpl.h" 159 #include "web/CompositorWorkerProxyClientImpl.h"
160 #include "web/ContextMenuAllowedScope.h" 160 #include "web/ContextMenuAllowedScope.h"
161 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" 161 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h"
162 #include "web/DevToolsEmulator.h" 162 #include "web/DevToolsEmulator.h"
163 #include "web/FullscreenController.h" 163 #include "web/FullscreenController.h"
164 #include "web/InspectorOverlayAgent.h"
165 #include "web/LinkHighlightImpl.h" 164 #include "web/LinkHighlightImpl.h"
166 #include "web/PageOverlay.h" 165 #include "web/PageOverlay.h"
167 #include "web/PrerendererClientImpl.h" 166 #include "web/PrerendererClientImpl.h"
168 #include "web/SpeechRecognitionClientProxy.h" 167 #include "web/SpeechRecognitionClientProxy.h"
169 #include "web/StorageQuotaClientImpl.h" 168 #include "web/StorageQuotaClientImpl.h"
170 #include "web/ValidationMessageClientImpl.h" 169 #include "web/ValidationMessageClientImpl.h"
171 #include "web/WebDevToolsAgentImpl.h" 170 #include "web/WebDevToolsAgentImpl.h"
172 #include "web/WebInputEventConversion.h" 171 #include "web/WebInputEventConversion.h"
173 #include "web/WebInputMethodControllerImpl.h" 172 #include "web/WebInputMethodControllerImpl.h"
174 #include "web/WebLocalFrameImpl.h" 173 #include "web/WebLocalFrameImpl.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 // in destructor. m_linkHighlightsTimeline might be destroyed earlier 427 // in destructor. m_linkHighlightsTimeline might be destroyed earlier
429 // than m_linkHighlights. 428 // than m_linkHighlights.
430 DCHECK(link_highlights_.IsEmpty()); 429 DCHECK(link_highlights_.IsEmpty());
431 } 430 }
432 431
433 WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() { 432 WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() {
434 WebLocalFrameImpl* main_frame = MainFrameImpl(); 433 WebLocalFrameImpl* main_frame = MainFrameImpl();
435 return main_frame ? main_frame->DevToolsAgentImpl() : nullptr; 434 return main_frame ? main_frame->DevToolsAgentImpl() : nullptr;
436 } 435 }
437 436
438 InspectorOverlayAgent* WebViewImpl::GetInspectorOverlay() {
439 if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl())
440 return devtools->OverlayAgent();
441 return nullptr;
442 }
443
444 WebLocalFrameImpl* WebViewImpl::MainFrameImpl() const { 437 WebLocalFrameImpl* WebViewImpl::MainFrameImpl() const {
445 return page_ && page_->MainFrame() && page_->MainFrame()->IsLocalFrame() 438 return page_ && page_->MainFrame() && page_->MainFrame()->IsLocalFrame()
446 ? WebLocalFrameImpl::FromFrame(page_->DeprecatedLocalMainFrame()) 439 ? WebLocalFrameImpl::FromFrame(page_->DeprecatedLocalMainFrame())
447 : nullptr; 440 : nullptr;
448 } 441 }
449 442
450 bool WebViewImpl::TabKeyCyclesThroughElements() const { 443 bool WebViewImpl::TabKeyCyclesThroughElements() const {
451 DCHECK(page_); 444 DCHECK(page_);
452 return page_->TabKeyCyclesThroughElements(); 445 return page_->TabKeyCyclesThroughElements();
453 } 446 }
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 if (!MainFrameImpl()) 2024 if (!MainFrameImpl())
2032 return; 2025 return;
2033 2026
2034 DocumentLifecycle::AllowThrottlingScope throttling_scope( 2027 DocumentLifecycle::AllowThrottlingScope throttling_scope(
2035 MainFrameImpl()->GetFrame()->GetDocument()->Lifecycle()); 2028 MainFrameImpl()->GetFrame()->GetDocument()->Lifecycle());
2036 UpdateLayerTreeBackgroundColor(); 2029 UpdateLayerTreeBackgroundColor();
2037 2030
2038 PageWidgetDelegate::UpdateAllLifecyclePhases(*page_, 2031 PageWidgetDelegate::UpdateAllLifecyclePhases(*page_,
2039 *MainFrameImpl()->GetFrame()); 2032 *MainFrameImpl()->GetFrame());
2040 2033
2041 if (InspectorOverlayAgent* overlay = GetInspectorOverlay()) { 2034 if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl())
2042 overlay->UpdateAllLifecyclePhases(); 2035 devtools->PaintOverlay();
2043 // TODO(chrishtr): integrate paint into the overlay's lifecycle.
2044 if (overlay->GetPageOverlay() &&
2045 overlay->GetPageOverlay()->GetGraphicsLayer())
2046 overlay->GetPageOverlay()->GetGraphicsLayer()->Paint(nullptr);
2047 }
2048 if (page_color_overlay_) 2036 if (page_color_overlay_)
2049 page_color_overlay_->GetGraphicsLayer()->Paint(nullptr); 2037 page_color_overlay_->GetGraphicsLayer()->Paint(nullptr);
2050 2038
2051 // TODO(chrishtr): link highlights don't currently paint themselves, it's 2039 // TODO(chrishtr): link highlights don't currently paint themselves, it's
2052 // still driven by cc. Fix this. 2040 // still driven by cc. Fix this.
2053 for (size_t i = 0; i < link_highlights_.size(); ++i) 2041 for (size_t i = 0; i < link_highlights_.size(); ++i)
2054 link_highlights_[i]->UpdateGeometry(); 2042 link_highlights_[i]->UpdateGeometry();
2055 2043
2056 if (FrameView* view = MainFrameImpl()->GetFrameView()) { 2044 if (FrameView* view = MainFrameImpl()->GetFrameView()) {
2057 LocalFrame* frame = MainFrameImpl()->GetFrame(); 2045 LocalFrame* frame = MainFrameImpl()->GetFrame();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 TRACE_EVENT1("input,rail", "WebViewImpl::handleInputEvent", "type", 2162 TRACE_EVENT1("input,rail", "WebViewImpl::handleInputEvent", "type",
2175 WebInputEvent::GetName(input_event.GetType())); 2163 WebInputEvent::GetName(input_event.GetType()));
2176 2164
2177 // If a drag-and-drop operation is in progress, ignore input events. 2165 // If a drag-and-drop operation is in progress, ignore input events.
2178 if (MainFrameImpl()->FrameWidget()->DoingDragAndDrop()) 2166 if (MainFrameImpl()->FrameWidget()->DoingDragAndDrop())
2179 return WebInputEventResult::kHandledSuppressed; 2167 return WebInputEventResult::kHandledSuppressed;
2180 2168
2181 if (dev_tools_emulator_->HandleInputEvent(input_event)) 2169 if (dev_tools_emulator_->HandleInputEvent(input_event))
2182 return WebInputEventResult::kHandledSuppressed; 2170 return WebInputEventResult::kHandledSuppressed;
2183 2171
2184 if (InspectorOverlayAgent* overlay = GetInspectorOverlay()) { 2172 if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl()) {
2185 if (overlay->HandleInputEvent(input_event)) 2173 if (devtools->HandleInputEvent(input_event))
2186 return WebInputEventResult::kHandledSuppressed; 2174 return WebInputEventResult::kHandledSuppressed;
2187 } 2175 }
2188 2176
2189 // Report the event to be NOT processed by WebKit, so that the browser can 2177 // Report the event to be NOT processed by WebKit, so that the browser can
2190 // handle it appropriately. 2178 // handle it appropriately.
2191 if (WebFrameWidgetBase::IgnoreInputEvents()) 2179 if (WebFrameWidgetBase::IgnoreInputEvents())
2192 return WebInputEventResult::kNotHandled; 2180 return WebInputEventResult::kNotHandled;
2193 2181
2194 AutoReset<const WebInputEvent*> current_event_change(&current_input_event_, 2182 AutoReset<const WebInputEvent*> current_event_change(&current_input_event_,
2195 &input_event); 2183 &input_event);
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
4153 return new CompositorWorkerProxyClientImpl(&Mutator()); 4141 return new CompositorWorkerProxyClientImpl(&Mutator());
4154 } 4142 }
4155 4143
4156 AnimationWorkletProxyClient* WebViewImpl::CreateAnimationWorkletProxyClient() { 4144 AnimationWorkletProxyClient* WebViewImpl::CreateAnimationWorkletProxyClient() {
4157 return new AnimationWorkletProxyClientImpl(&Mutator()); 4145 return new AnimationWorkletProxyClientImpl(&Mutator());
4158 } 4146 }
4159 4147
4160 void WebViewImpl::UpdatePageOverlays() { 4148 void WebViewImpl::UpdatePageOverlays() {
4161 if (page_color_overlay_) 4149 if (page_color_overlay_)
4162 page_color_overlay_->Update(); 4150 page_color_overlay_->Update();
4163 if (InspectorOverlayAgent* overlay = GetInspectorOverlay()) { 4151 if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl())
4164 PageOverlay* inspector_page_overlay = overlay->GetPageOverlay(); 4152 devtools->LayoutOverlay();
4165 if (inspector_page_overlay)
4166 inspector_page_overlay->Update();
4167 }
4168 } 4153 }
4169 4154
4170 float WebViewImpl::DeviceScaleFactor() const { 4155 float WebViewImpl::DeviceScaleFactor() const {
4171 // TODO(oshima): Investigate if this should return the ScreenInfo's scale 4156 // TODO(oshima): Investigate if this should return the ScreenInfo's scale
4172 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf 4157 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf
4173 // mode. 4158 // mode.
4174 if (!GetPage()) 4159 if (!GetPage())
4175 return 1; 4160 return 1;
4176 4161
4177 return GetPage()->DeviceScaleFactorDeprecated(); 4162 return GetPage()->DeviceScaleFactorDeprecated();
4178 } 4163 }
4179 4164
4180 LocalFrame* WebViewImpl::FocusedLocalFrameInWidget() const { 4165 LocalFrame* WebViewImpl::FocusedLocalFrameInWidget() const {
4181 if (!MainFrameImpl()) 4166 if (!MainFrameImpl())
4182 return nullptr; 4167 return nullptr;
4183 4168
4184 LocalFrame* focused_frame = ToLocalFrame(FocusedCoreFrame()); 4169 LocalFrame* focused_frame = ToLocalFrame(FocusedCoreFrame());
4185 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4170 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4186 return nullptr; 4171 return nullptr;
4187 return focused_frame; 4172 return focused_frame;
4188 } 4173 }
4189 4174
4190 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4175 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4191 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4176 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4192 } 4177 }
4193 4178
4194 } // namespace blink 4179 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698