| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 if (enabled) { | 623 if (enabled) { |
| 624 remote_targets_handler_ = DevToolsTargetsUIHandler::CreateForAdb( | 624 remote_targets_handler_ = DevToolsTargetsUIHandler::CreateForAdb( |
| 625 base::Bind(&DevToolsUIBindings::DevicesUpdated, | 625 base::Bind(&DevToolsUIBindings::DevicesUpdated, |
| 626 base::Unretained(this)), | 626 base::Unretained(this)), |
| 627 profile_); | 627 profile_); |
| 628 } else { | 628 } else { |
| 629 remote_targets_handler_.reset(); | 629 remote_targets_handler_.reset(); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| 633 void DevToolsUIBindings::SendMessageToBrowser(const std::string& message) { |
| 634 content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
| 635 this, message); |
| 636 } |
| 637 |
| 633 void DevToolsUIBindings::DeviceCountChanged(int count) { | 638 void DevToolsUIBindings::DeviceCountChanged(int count) { |
| 634 base::FundamentalValue value(count); | 639 base::FundamentalValue value(count); |
| 635 CallClientFunction("InspectorFrontendAPI.deviceCountUpdated", &value, NULL, | 640 CallClientFunction("InspectorFrontendAPI.deviceCountUpdated", &value, NULL, |
| 636 NULL); | 641 NULL); |
| 637 } | 642 } |
| 638 | 643 |
| 639 void DevToolsUIBindings::DevicesUpdated( | 644 void DevToolsUIBindings::DevicesUpdated( |
| 640 const std::string& source, | 645 const std::string& source, |
| 641 const base::ListValue& targets) { | 646 const base::ListValue& targets) { |
| 642 CallClientFunction("InspectorFrontendAPI.devicesUpdated", &targets, NULL, | 647 CallClientFunction("InspectorFrontendAPI.devicesUpdated", &targets, NULL, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); | 809 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); |
| 805 } | 810 } |
| 806 | 811 |
| 807 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 812 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
| 808 // Call delegate first - it seeds importants bit of information. | 813 // Call delegate first - it seeds importants bit of information. |
| 809 delegate_->OnLoadCompleted(); | 814 delegate_->OnLoadCompleted(); |
| 810 | 815 |
| 811 UpdateTheme(); | 816 UpdateTheme(); |
| 812 AddDevToolsExtensionsToClient(); | 817 AddDevToolsExtensionsToClient(); |
| 813 } | 818 } |
| OLD | NEW |