| 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 void DevToolsUIBindings::HandleMessageFromDevToolsFrontendToBackend( | 403 void DevToolsUIBindings::HandleMessageFromDevToolsFrontendToBackend( |
| 404 const std::string& message) { | 404 const std::string& message) { |
| 405 content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend( | 405 content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
| 406 this, message); | 406 this, message); |
| 407 } | 407 } |
| 408 | 408 |
| 409 // content::DevToolsClientHost implementation --------------------------------- | 409 // content::DevToolsClientHost implementation --------------------------------- |
| 410 void DevToolsUIBindings::DispatchOnInspectorFrontend( | 410 void DevToolsUIBindings::DispatchOnInspectorFrontend( |
| 411 const std::string& message) { | 411 const std::string& message) { |
| 412 base::StringValue message_value(message); | 412 if (frontend_host_) |
| 413 CallClientFunction("InspectorFrontendAPI.dispatchMessage", | 413 frontend_host_->DispatchOnDevToolsFrontend(message); |
| 414 &message_value, NULL, NULL); | |
| 415 } | 414 } |
| 416 | 415 |
| 417 void DevToolsUIBindings::InspectedContentsClosing() { | 416 void DevToolsUIBindings::InspectedContentsClosing() { |
| 418 delegate_->InspectedContentsClosing(); | 417 delegate_->InspectedContentsClosing(); |
| 419 } | 418 } |
| 420 | 419 |
| 421 void DevToolsUIBindings::ReplacedWithAnotherClient() { | 420 void DevToolsUIBindings::ReplacedWithAnotherClient() { |
| 422 } | 421 } |
| 423 | 422 |
| 424 // DevToolsEmbedderMessageDispatcher::Delegate implementation ----------------- | 423 // DevToolsEmbedderMessageDispatcher::Delegate implementation ----------------- |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 params.append(json); | 789 params.append(json); |
| 791 if (arg2) { | 790 if (arg2) { |
| 792 base::JSONWriter::Write(arg2, &json); | 791 base::JSONWriter::Write(arg2, &json); |
| 793 params.append(", " + json); | 792 params.append(", " + json); |
| 794 if (arg3) { | 793 if (arg3) { |
| 795 base::JSONWriter::Write(arg3, &json); | 794 base::JSONWriter::Write(arg3, &json); |
| 796 params.append(", " + json); | 795 params.append(", " + json); |
| 797 } | 796 } |
| 798 } | 797 } |
| 799 } | 798 } |
| 800 | 799 base::string16 javascript = |
| 801 base::string16 javascript = base::UTF8ToUTF16( | 800 base::UTF8ToUTF16(function_name + "(" + params + ");"); |
| 802 function_name + "(" + params + ");"); | |
| 803 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); | 801 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); |
| 804 } | 802 } |
| 805 | 803 |
| 806 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 804 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
| 807 // Call delegate first - it seeds importants bit of information. | 805 // Call delegate first - it seeds importants bit of information. |
| 808 delegate_->OnLoadCompleted(); | 806 delegate_->OnLoadCompleted(); |
| 809 | 807 |
| 810 UpdateTheme(); | 808 UpdateTheme(); |
| 811 AddDevToolsExtensionsToClient(); | 809 AddDevToolsExtensionsToClient(); |
| 812 } | 810 } |
| OLD | NEW |