OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/devtools/devtools_agent.h" | 5 #include "content/renderer/devtools/devtools_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 TraceEventCallback callback = | 194 TraceEventCallback callback = |
195 reinterpret_cast<TraceEventCallback>( | 195 reinterpret_cast<TraceEventCallback>( |
196 base::subtle::NoBarrier_Load(&event_callback_)); | 196 base::subtle::NoBarrier_Load(&event_callback_)); |
197 if (callback) { | 197 if (callback) { |
198 double timestamp_seconds = (timestamp - base::TimeTicks()).InSecondsF(); | 198 double timestamp_seconds = (timestamp - base::TimeTicks()).InSecondsF(); |
199 callback(phase, category_group_enabled, name, id, num_args, | 199 callback(phase, category_group_enabled, name, id, num_args, |
200 arg_names, arg_types, arg_values, flags, timestamp_seconds); | 200 arg_names, arg_types, arg_values, flags, timestamp_seconds); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 void DevToolsAgent::enableDeviceEmulation( | |
205 const blink::WebDeviceEmulationParams& params) { | |
206 GetRenderViewImpl()->EnableScreenMetricsEmulation(params); | |
207 } | |
208 | |
209 void DevToolsAgent::disableDeviceEmulation() { | |
210 GetRenderViewImpl()->DisableScreenMetricsEmulation(); | |
211 } | |
212 | |
213 // static | 204 // static |
214 DevToolsAgent* DevToolsAgent::FromRoutingId(int routing_id) { | 205 DevToolsAgent* DevToolsAgent::FromRoutingId(int routing_id) { |
215 IdToAgentMap::iterator it = g_agent_for_routing_id.Get().find(routing_id); | 206 IdToAgentMap::iterator it = g_agent_for_routing_id.Get().find(routing_id); |
216 if (it != g_agent_for_routing_id.Get().end()) { | 207 if (it != g_agent_for_routing_id.Get().end()) { |
217 return it->second; | 208 return it->second; |
218 } | 209 } |
219 return NULL; | 210 return NULL; |
220 } | 211 } |
221 | 212 |
222 // static | 213 // static |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 338 |
348 RenderViewImpl* DevToolsAgent::GetRenderViewImpl() { | 339 RenderViewImpl* DevToolsAgent::GetRenderViewImpl() { |
349 return static_cast<RenderViewImpl*>(main_render_frame_->GetRenderView()); | 340 return static_cast<RenderViewImpl*>(main_render_frame_->GetRenderView()); |
350 } | 341 } |
351 | 342 |
352 bool DevToolsAgent::IsAttached() { | 343 bool DevToolsAgent::IsAttached() { |
353 return is_attached_; | 344 return is_attached_; |
354 } | 345 } |
355 | 346 |
356 } // namespace content | 347 } // namespace content |
OLD | NEW |