OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/devtools/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 return agent_host_.get() == agent_host; | 1009 return agent_host_.get() == agent_host; |
1010 } | 1010 } |
1011 | 1011 |
1012 void DevToolsUIBindings::CallClientFunction(const std::string& function_name, | 1012 void DevToolsUIBindings::CallClientFunction(const std::string& function_name, |
1013 const base::Value* arg1, | 1013 const base::Value* arg1, |
1014 const base::Value* arg2, | 1014 const base::Value* arg2, |
1015 const base::Value* arg3) { | 1015 const base::Value* arg3) { |
1016 std::string javascript = function_name + "("; | 1016 std::string javascript = function_name + "("; |
1017 if (arg1) { | 1017 if (arg1) { |
1018 std::string json; | 1018 std::string json; |
1019 base::JSONWriter::Write(arg1, &json); | 1019 base::JSONWriter::Write(*arg1, &json); |
1020 javascript.append(json); | 1020 javascript.append(json); |
1021 if (arg2) { | 1021 if (arg2) { |
1022 base::JSONWriter::Write(arg2, &json); | 1022 base::JSONWriter::Write(*arg2, &json); |
1023 javascript.append(", ").append(json); | 1023 javascript.append(", ").append(json); |
1024 if (arg3) { | 1024 if (arg3) { |
1025 base::JSONWriter::Write(arg3, &json); | 1025 base::JSONWriter::Write(*arg3, &json); |
1026 javascript.append(", ").append(json); | 1026 javascript.append(", ").append(json); |
1027 } | 1027 } |
1028 } | 1028 } |
1029 } | 1029 } |
1030 javascript.append(");"); | 1030 javascript.append(");"); |
1031 web_contents_->GetMainFrame()->ExecuteJavaScript( | 1031 web_contents_->GetMainFrame()->ExecuteJavaScript( |
1032 base::UTF8ToUTF16(javascript)); | 1032 base::UTF8ToUTF16(javascript)); |
1033 } | 1033 } |
1034 | 1034 |
1035 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 1035 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
(...skipping 13 matching lines...) Expand all Loading... |
1049 if (frontend_loaded_) | 1049 if (frontend_loaded_) |
1050 return; | 1050 return; |
1051 frontend_loaded_ = true; | 1051 frontend_loaded_ = true; |
1052 | 1052 |
1053 // Call delegate first - it seeds importants bit of information. | 1053 // Call delegate first - it seeds importants bit of information. |
1054 delegate_->OnLoadCompleted(); | 1054 delegate_->OnLoadCompleted(); |
1055 | 1055 |
1056 UpdateTheme(); | 1056 UpdateTheme(); |
1057 AddDevToolsExtensionsToClient(); | 1057 AddDevToolsExtensionsToClient(); |
1058 } | 1058 } |
OLD | NEW |