[Ozone-Gbm] Explicitly crash if trying software rendering on GBM
[chromium-blink-merge.git] / content / browser / devtools / devtools_frontend_host_impl.cc
blob6d3c658936fd4aeaeb740557dc6c7b458e5bfd8f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/devtools/devtools_frontend_host_impl.h"
7 #include "content/common/devtools_messages.h"
8 #include "content/public/browser/navigation_entry.h"
9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/web_contents.h"
12 namespace content {
14 // static
15 DevToolsFrontendHost* DevToolsFrontendHost::Create(
16 RenderFrameHost* frontend_main_frame,
17 DevToolsFrontendHost::Delegate* delegate) {
18 return new DevToolsFrontendHostImpl(frontend_main_frame, delegate);
21 DevToolsFrontendHostImpl::DevToolsFrontendHostImpl(
22 RenderFrameHost* frontend_main_frame,
23 DevToolsFrontendHost::Delegate* delegate)
24 : WebContentsObserver(
25 WebContents::FromRenderFrameHost(frontend_main_frame)),
26 delegate_(delegate) {
27 frontend_main_frame->Send(
28 new DevToolsMsg_SetupDevToolsClient(frontend_main_frame->GetRoutingID()));
31 DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() {
34 bool DevToolsFrontendHostImpl::OnMessageReceived(
35 const IPC::Message& message,
36 RenderFrameHost* render_frame_host) {
37 if (render_frame_host != web_contents()->GetMainFrame())
38 return false;
39 bool handled = true;
40 IPC_BEGIN_MESSAGE_MAP(DevToolsFrontendHostImpl, message)
41 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
42 OnDispatchOnInspectorBackend)
43 IPC_MESSAGE_HANDLER(DevToolsHostMsg_DispatchOnEmbedder,
44 OnDispatchOnEmbedder)
45 IPC_MESSAGE_UNHANDLED(handled = false)
46 IPC_END_MESSAGE_MAP()
47 return handled;
50 void DevToolsFrontendHostImpl::OnDispatchOnInspectorBackend(
51 const std::string& message) {
52 delegate_->HandleMessageFromDevToolsFrontendToBackend(message);
55 void DevToolsFrontendHostImpl::OnDispatchOnEmbedder(
56 const std::string& message) {
57 delegate_->HandleMessageFromDevToolsFrontend(message);
60 } // namespace content