Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / devtools / render_frame_devtools_agent_host.h
blob0d9c3ed903d9d860167b402361bb5f4477ce4123
1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_
6 #define CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/browser/devtools/devtools_agent_host_impl.h"
14 #include "content/common/content_export.h"
15 #include "content/public/browser/web_contents_observer.h"
17 namespace cc {
18 class CompositorFrameMetadata;
21 namespace content {
23 class BrowserContext;
24 class DevToolsFrameTraceRecorder;
25 class DevToolsProtocolHandler;
26 class RenderFrameHostImpl;
28 #if defined(OS_ANDROID)
29 class PowerSaveBlockerImpl;
30 #endif
32 namespace devtools {
33 namespace dom { class DOMHandler; }
34 namespace emulation { class EmulationHandler; }
35 namespace input { class InputHandler; }
36 namespace inspector { class InspectorHandler; }
37 namespace network { class NetworkHandler; }
38 namespace page { class PageHandler; }
39 namespace power { class PowerHandler; }
40 namespace security { class SecurityHandler; }
41 namespace service_worker { class ServiceWorkerHandler; }
42 namespace tracing { class TracingHandler; }
45 class CONTENT_EXPORT RenderFrameDevToolsAgentHost
46 : public DevToolsAgentHostImpl,
47 private WebContentsObserver {
48 public:
49 static void AddAllAgentHosts(DevToolsAgentHost::List* result);
51 static void OnCancelPendingNavigation(RenderFrameHost* pending,
52 RenderFrameHost* current);
54 void SynchronousSwapCompositorFrame(
55 const cc::CompositorFrameMetadata& frame_metadata);
57 bool HasRenderFrameHost(RenderFrameHost* host);
59 // DevTooolsAgentHost overrides.
60 void DisconnectWebContents() override;
61 void ConnectWebContents(WebContents* web_contents) override;
62 BrowserContext* GetBrowserContext() override;
63 WebContents* GetWebContents() override;
64 Type GetType() override;
65 std::string GetTitle() override;
66 GURL GetURL() override;
67 bool Activate() override;
68 bool Close() override;
69 bool DispatchProtocolMessage(const std::string& message) override;
71 private:
72 friend class DevToolsAgentHost;
73 explicit RenderFrameDevToolsAgentHost(RenderFrameHostImpl*);
74 ~RenderFrameDevToolsAgentHost() override;
76 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor(
77 RenderFrameHostImpl* host);
78 static void AppendAgentHostForFrameIfApplicable(
79 DevToolsAgentHost::List* result,
80 RenderFrameHost* host);
82 // DevToolsAgentHostImpl overrides.
83 void Attach() override;
84 void Detach() override;
85 void InspectElement(int x, int y) override;
87 // WebContentsObserver overrides.
88 void AboutToNavigateRenderFrame(RenderFrameHost* old_host,
89 RenderFrameHost* new_host) override;
90 void RenderFrameHostChanged(RenderFrameHost* old_host,
91 RenderFrameHost* new_host) override;
92 void FrameDeleted(RenderFrameHost* rfh) override;
93 void RenderFrameDeleted(RenderFrameHost* rfh) override;
94 void RenderProcessGone(base::TerminationStatus status) override;
95 bool OnMessageReceived(const IPC::Message& message,
96 RenderFrameHost* render_frame_host) override;
97 bool OnMessageReceived(const IPC::Message& message) override;
98 void DidAttachInterstitialPage() override;
99 void DidDetachInterstitialPage() override;
100 void DidCommitProvisionalLoadForFrame(
101 RenderFrameHost* render_frame_host,
102 const GURL& url,
103 ui::PageTransition transition_type) override;
104 void DidFailProvisionalLoad(
105 RenderFrameHost* render_frame_host,
106 const GURL& validated_url,
107 int error_code,
108 const base::string16& error_description,
109 bool was_ignored_by_handler) override;
111 void SetPending(RenderFrameHostImpl* host);
112 void CommitPending();
113 void DiscardPending();
114 void UpdateProtocolHandlers(RenderFrameHostImpl* host);
116 bool IsChildFrame();
118 void OnClientAttached();
119 void OnClientDetached();
121 void RenderFrameCrashed();
122 void OnSwapCompositorFrame(const IPC::Message& message);
123 void DestroyOnRenderFrameGone();
125 class FrameHostHolder;
127 scoped_ptr<FrameHostHolder> current_;
128 scoped_ptr<FrameHostHolder> pending_;
130 scoped_ptr<devtools::dom::DOMHandler> dom_handler_;
131 scoped_ptr<devtools::input::InputHandler> input_handler_;
132 scoped_ptr<devtools::inspector::InspectorHandler> inspector_handler_;
133 scoped_ptr<devtools::network::NetworkHandler> network_handler_;
134 scoped_ptr<devtools::page::PageHandler> page_handler_;
135 scoped_ptr<devtools::power::PowerHandler> power_handler_;
136 scoped_ptr<devtools::security::SecurityHandler> security_handler_;
137 scoped_ptr<devtools::service_worker::ServiceWorkerHandler>
138 service_worker_handler_;
139 scoped_ptr<devtools::tracing::TracingHandler> tracing_handler_;
140 scoped_ptr<devtools::emulation::EmulationHandler> emulation_handler_;
141 scoped_ptr<DevToolsFrameTraceRecorder> frame_trace_recorder_;
142 #if defined(OS_ANDROID)
143 scoped_ptr<PowerSaveBlockerImpl> power_save_blocker_;
144 #endif
145 scoped_ptr<DevToolsProtocolHandler> protocol_handler_;
146 bool current_frame_crashed_;
148 DISALLOW_COPY_AND_ASSIGN(RenderFrameDevToolsAgentHost);
151 } // namespace content
153 #endif // CONTENT_BROWSER_DEVTOOLS_RENDER_FRAME_DEVTOOLS_AGENT_HOST_H_