| 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/dom_automation_controller.h" | 5 #include "content/renderer/dom_automation_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 BindCallback("sendJSON", base::Bind(&DomAutomationController::SendJSON, | 30 BindCallback("sendJSON", base::Bind(&DomAutomationController::SendJSON, |
| 31 base::Unretained(this))); | 31 base::Unretained(this))); |
| 32 BindCallback("sendWithId", base::Bind(&DomAutomationController::SendWithId, | 32 BindCallback("sendWithId", base::Bind(&DomAutomationController::SendWithId, |
| 33 base::Unretained(this))); | 33 base::Unretained(this))); |
| 34 BindCallback("getHistogram", | 34 BindCallback("getHistogram", |
| 35 base::Bind(&DomAutomationController::GetHistogram, | 35 base::Bind(&DomAutomationController::GetHistogram, |
| 36 base::Unretained(this))); | 36 base::Unretained(this))); |
| 37 BindCallback("getBrowserHistogram", | 37 BindCallback("getBrowserHistogram", |
| 38 base::Bind(&DomAutomationController::GetBrowserHistogram, | 38 base::Bind(&DomAutomationController::GetBrowserHistogram, |
| 39 base::Unretained(this))); | 39 base::Unretained(this))); |
| 40 BindCallback("getTabLoadTimingInformation", |
| 41 base::Bind(&DomAutomationController::GetTabLoadTimingInformation, |
| 42 base::Unretained(this))); |
| 40 } | 43 } |
| 41 | 44 |
| 42 void DomAutomationController::Send(const CppArgumentList& args, | 45 void DomAutomationController::Send(const CppArgumentList& args, |
| 43 CppVariant* result) { | 46 CppVariant* result) { |
| 44 if (args.size() != 1) { | 47 if (args.size() != 1) { |
| 45 result->SetNull(); | 48 result->SetNull(); |
| 46 return; | 49 return; |
| 47 } | 50 } |
| 48 | 51 |
| 49 if (automation_id_ == MSG_ROUTING_NONE) { | 52 if (automation_id_ == MSG_ROUTING_NONE) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 result->SetNull(); | 209 result->SetNull(); |
| 207 return; | 210 return; |
| 208 } | 211 } |
| 209 | 212 |
| 210 std::string histogram_json; | 213 std::string histogram_json; |
| 211 sender_->Send(new ChildProcessHostMsg_GetBrowserHistogram( | 214 sender_->Send(new ChildProcessHostMsg_GetBrowserHistogram( |
| 212 args[0].ToString(), &histogram_json)); | 215 args[0].ToString(), &histogram_json)); |
| 213 result->Set(histogram_json); | 216 result->Set(histogram_json); |
| 214 } | 217 } |
| 215 | 218 |
| 219 void DomAutomationController::GetTabLoadTimingInformation( |
| 220 const CppArgumentList& args, |
| 221 CppVariant* result) { |
| 222 if (!sender_) { |
| 223 NOTREACHED(); |
| 224 result->SetNull(); |
| 225 return; |
| 226 } |
| 227 |
| 228 std::string tab_timing_json; |
| 229 sender_->Send( |
| 230 new ChildProcessHostMsg_GetTabLoadTimingInformation(&tab_timing_json)); |
| 231 result->Set(tab_timing_json); |
| 232 } |
| 233 |
| 216 } // namespace content | 234 } // namespace content |
| OLD | NEW |