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

Side by Side Diff: Source/web/WebDevToolsAgentImpl.cpp

Issue 1063653002: [DevTools] Cleanup after moving input to browser. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | Source/web/WebInputEventConversion.h » ('j') | 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) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010-2011 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "web/WebLocalFrameImpl.h" 93 #include "web/WebLocalFrameImpl.h"
94 #include "web/WebSettingsImpl.h" 94 #include "web/WebSettingsImpl.h"
95 #include "web/WebViewImpl.h" 95 #include "web/WebViewImpl.h"
96 #include "wtf/MathExtras.h" 96 #include "wtf/MathExtras.h"
97 #include "wtf/Noncopyable.h" 97 #include "wtf/Noncopyable.h"
98 #include "wtf/ProcessID.h" 98 #include "wtf/ProcessID.h"
99 #include "wtf/text/WTFString.h" 99 #include "wtf/text/WTFString.h"
100 100
101 namespace blink { 101 namespace blink {
102 102
103 namespace {
104
105 class InspectorInputClient : public InspectorInputAgent::Client {
106 public:
107 explicit InspectorInputClient(WebViewImpl* webViewImpl) : m_webViewImpl(webV iewImpl) { }
108 ~InspectorInputClient() override { }
109
110 // InspectorInputAgent::Client implementation.
111 void dispatchKeyEvent(const PlatformKeyboardEvent& event) override
112 {
113 if (!m_webViewImpl->page()->focusController().isFocused())
114 m_webViewImpl->setFocus(true);
115
116 WebKeyboardEvent webEvent = WebKeyboardEventBuilder(event);
117 if (!webEvent.keyIdentifier[0] && webEvent.type != WebInputEvent::Char)
118 webEvent.setKeyIdentifierFromWindowsKeyCode();
119 m_webViewImpl->handleInputEvent(webEvent);
120 }
121
122 void dispatchMouseEvent(const PlatformMouseEvent& event) override
123 {
124 if (!m_webViewImpl->page()->focusController().isFocused())
125 m_webViewImpl->setFocus(true);
126
127 WebMouseEvent webEvent = WebMouseEventBuilder(m_webViewImpl->mainFrameIm pl()->frameView(), event);
128 m_webViewImpl->handleInputEvent(webEvent);
129 }
130
131 private:
132 WebViewImpl* m_webViewImpl;
133 };
134
135 } // namespace
136
137 class ClientMessageLoopAdapter : public PageScriptDebugServer::ClientMessageLoop { 103 class ClientMessageLoopAdapter : public PageScriptDebugServer::ClientMessageLoop {
138 public: 104 public:
139 ~ClientMessageLoopAdapter() override 105 ~ClientMessageLoopAdapter() override
140 { 106 {
141 s_instance = nullptr; 107 s_instance = nullptr;
142 } 108 }
143 109
144 static void ensurePageScriptDebugServerCreated(WebDevToolsAgentClient* clien t) 110 static void ensurePageScriptDebugServerCreated(WebDevToolsAgentClient* clien t)
145 { 111 {
146 if (s_instance) 112 if (s_instance)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 private: 249 private:
284 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; 250 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor;
285 }; 251 };
286 252
287 // static 253 // static
288 PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLoc alFrameImpl* frame, WebDevToolsAgentClient* client) 254 PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLoc alFrameImpl* frame, WebDevToolsAgentClient* client)
289 { 255 {
290 WebViewImpl* view = frame->viewImpl(); 256 WebViewImpl* view = frame->viewImpl();
291 bool isMainFrame = view && view->mainFrameImpl() == frame; 257 bool isMainFrame = view && view->mainFrameImpl() == frame;
292 if (!isMainFrame) 258 if (!isMainFrame)
293 return adoptPtrWillBeNoop(new WebDevToolsAgentImpl(frame, client, frame- >inspectorOverlay(), nullptr)); 259 return adoptPtrWillBeNoop(new WebDevToolsAgentImpl(frame, client, frame- >inspectorOverlay()));
294 260
295 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, view-> inspectorOverlay(), adoptPtr(new InspectorInputClient(view))); 261 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, view-> inspectorOverlay());
296 agent->registerAgent(InspectorRenderingAgent::create(view)); 262 agent->registerAgent(InspectorRenderingAgent::create(view));
297 agent->registerAgent(InspectorEmulationAgent::create(view)); 263 agent->registerAgent(InspectorEmulationAgent::create(view));
298 // TODO(dgozman): migrate each of the following agents to frame once module is ready. 264 // TODO(dgozman): migrate each of the following agents to frame once module is ready.
299 agent->registerAgent(InspectorDatabaseAgent::create(view->page())); 265 agent->registerAgent(InspectorDatabaseAgent::create(view->page()));
300 agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page())); 266 agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page()));
301 agent->registerAgent(InspectorFileSystemAgent::create(view->page())); 267 agent->registerAgent(InspectorFileSystemAgent::create(view->page()));
302 agent->registerAgent(InspectorIndexedDBAgent::create(view->page())); 268 agent->registerAgent(InspectorIndexedDBAgent::create(view->page()));
303 agent->registerAgent(InspectorAccessibilityAgent::create(view->page())); 269 agent->registerAgent(InspectorAccessibilityAgent::create(view->page()));
304 agent->registerAgent(InspectorDOMStorageAgent::create(view->page())); 270 agent->registerAgent(InspectorDOMStorageAgent::create(view->page()));
305 return adoptPtrWillBeNoop(agent); 271 return adoptPtrWillBeNoop(agent);
306 } 272 }
307 273
308 WebDevToolsAgentImpl::WebDevToolsAgentImpl( 274 WebDevToolsAgentImpl::WebDevToolsAgentImpl(
309 WebLocalFrameImpl* webLocalFrameImpl, 275 WebLocalFrameImpl* webLocalFrameImpl,
310 WebDevToolsAgentClient* client, 276 WebDevToolsAgentClient* client,
311 InspectorOverlay* overlay, 277 InspectorOverlay* overlay)
312 PassOwnPtr<InspectorInputAgent::Client> inputClient)
313 : m_client(client) 278 : m_client(client)
314 , m_webLocalFrameImpl(webLocalFrameImpl) 279 , m_webLocalFrameImpl(webLocalFrameImpl)
315 , m_attached(false) 280 , m_attached(false)
316 #if ENABLE(ASSERT) 281 #if ENABLE(ASSERT)
317 , m_hasBeenDisposed(false) 282 , m_hasBeenDisposed(false)
318 #endif 283 #endif
319 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents()) 284 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents())
320 , m_injectedScriptManager(InjectedScriptManager::createForPage()) 285 , m_injectedScriptManager(InjectedScriptManager::createForPage())
321 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this))) 286 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this)))
322 , m_overlay(overlay) 287 , m_overlay(overlay)
323 , m_inputClient(inputClient)
324 , m_cssAgent(nullptr) 288 , m_cssAgent(nullptr)
325 , m_resourceAgent(nullptr) 289 , m_resourceAgent(nullptr)
326 , m_layerTreeAgent(nullptr) 290 , m_layerTreeAgent(nullptr)
327 , m_agents(m_instrumentingAgents.get(), m_state.get()) 291 , m_agents(m_instrumentingAgents.get(), m_state.get())
328 , m_deferredAgentsInitialized(false) 292 , m_deferredAgentsInitialized(false)
329 { 293 {
330 ASSERT(isMainThread()); 294 ASSERT(isMainThread());
331 ASSERT(m_webLocalFrameImpl->frame()); 295 ASSERT(m_webLocalFrameImpl->frame());
332 296
333 long processId = WTF::getCurrentProcessID(); 297 long processId = WTF::getCurrentProcessID();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 422
459 m_agents.append(InspectorApplicationCacheAgent::create(m_pageAgent)); 423 m_agents.append(InspectorApplicationCacheAgent::create(m_pageAgent));
460 424
461 OwnPtrWillBeRawPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgen t::create(PageScriptDebugServer::instance(), m_pageAgent, injectedScriptManager, m_overlay, m_pageRuntimeAgent->debuggerId())); 425 OwnPtrWillBeRawPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgen t::create(PageScriptDebugServer::instance(), m_pageAgent, injectedScriptManager, m_overlay, m_pageRuntimeAgent->debuggerId()));
462 InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get(); 426 InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();
463 m_agents.append(debuggerAgentPtr.release()); 427 m_agents.append(debuggerAgentPtr.release());
464 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent, m_instrumentingAgents.get())); 428 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent, m_instrumentingAgents.get()));
465 429
466 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent) ); 430 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent) );
467 431
468 m_agents.append(InspectorInputAgent::create(m_pageAgent, m_inputClient.get() )); 432 m_agents.append(InspectorInputAgent::create(m_pageAgent));
469 433
470 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, m_over lay)); 434 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, m_over lay));
471 435
472 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); 436 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager));
473 437
474 m_pageAgent->setDeferredAgents(debuggerAgent, m_cssAgent); 438 m_pageAgent->setDeferredAgents(debuggerAgent, m_cssAgent);
475 439
476 PageScriptDebugServer* scriptDebugServer = PageScriptDebugServer::instance() ; 440 PageScriptDebugServer* scriptDebugServer = PageScriptDebugServer::instance() ;
477 m_injectedScriptManager->injectedScriptHost()->init( 441 m_injectedScriptManager->injectedScriptHost()->init(
478 m_pageConsoleAgent.get(), 442 m_pageConsoleAgent.get(),
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) 712 if (!InspectorBackendDispatcher::getCommandName(message, &commandName))
749 return false; 713 return false;
750 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd) 714 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd)
751 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd) 715 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd)
752 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd) 716 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd)
753 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 717 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
754 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 718 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
755 } 719 }
756 720
757 } // namespace blink 721 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | Source/web/WebInputEventConversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698