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 "chrome/browser/ui/webui/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "chrome/browser/devtools/devtools_targets_ui.h" | 9 #include "chrome/browser/devtools/devtools_targets_ui.h" |
10 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 600 |
601 scoped_refptr<content::DevToolsAgentHost> InspectUI::FindTarget( | 601 scoped_refptr<content::DevToolsAgentHost> InspectUI::FindTarget( |
602 const std::string& source_id, const std::string& target_id) { | 602 const std::string& source_id, const std::string& target_id) { |
603 auto it = target_handlers_.find(source_id); | 603 auto it = target_handlers_.find(source_id); |
604 return it != target_handlers_.end() ? | 604 return it != target_handlers_.end() ? |
605 it->second->GetTarget(target_id) : nullptr; | 605 it->second->GetTarget(target_id) : nullptr; |
606 } | 606 } |
607 | 607 |
608 void InspectUI::PopulateTargets(const std::string& source, | 608 void InspectUI::PopulateTargets(const std::string& source, |
609 const base::ListValue& targets) { | 609 const base::ListValue& targets) { |
610 web_ui()->CallJavascriptFunctionUnsafe("populateTargets", | 610 web_ui()->CallJavascriptFunctionUnsafe("populateTargets", base::Value(source), |
611 base::StringValue(source), targets); | 611 targets); |
612 } | 612 } |
613 | 613 |
614 void InspectUI::PopulateAdditionalTargets(const base::ListValue& targets) { | 614 void InspectUI::PopulateAdditionalTargets(const base::ListValue& targets) { |
615 web_ui()->CallJavascriptFunctionUnsafe("populateAdditionalTargets", targets); | 615 web_ui()->CallJavascriptFunctionUnsafe("populateAdditionalTargets", targets); |
616 } | 616 } |
617 | 617 |
618 void InspectUI::ForceUpdateIfNeeded(const std::string& source_id, | 618 void InspectUI::ForceUpdateIfNeeded(const std::string& source_id, |
619 const std::string& target_type) { | 619 const std::string& target_type) { |
620 // TODO(dgozman): remove this after moving discovery to protocol. | 620 // TODO(dgozman): remove this after moving discovery to protocol. |
621 // See crbug.com/398049. | 621 // See crbug.com/398049. |
622 if (target_type != content::DevToolsAgentHost::kTypeServiceWorker) | 622 if (target_type != content::DevToolsAgentHost::kTypeServiceWorker) |
623 return; | 623 return; |
624 DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id); | 624 DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id); |
625 if (handler) | 625 if (handler) |
626 handler->ForceUpdate(); | 626 handler->ForceUpdate(); |
627 } | 627 } |
628 | 628 |
629 void InspectUI::PopulatePortStatus(const base::Value& status) { | 629 void InspectUI::PopulatePortStatus(const base::Value& status) { |
630 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); | 630 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); |
631 } | 631 } |
632 | 632 |
633 void InspectUI::ShowIncognitoWarning() { | 633 void InspectUI::ShowIncognitoWarning() { |
634 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); | 634 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); |
635 } | 635 } |
OLD | NEW |