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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/base64.h" | 11 #include "base/base64.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/json/string_escape.h" | 14 #include "base/json/string_escape.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/devtools/devtools_file_watcher.h" | 24 #include "chrome/browser/devtools/devtools_file_watcher.h" |
25 #include "chrome/browser/devtools/devtools_protocol.h" | 25 #include "chrome/browser/devtools/devtools_protocol.h" |
26 #include "chrome/browser/devtools/devtools_target_impl.h" | |
27 #include "chrome/browser/devtools/global_confirm_info_bar.h" | 26 #include "chrome/browser/devtools/global_confirm_info_bar.h" |
28 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 27 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
29 #include "chrome/browser/infobars/infobar_service.h" | 28 #include "chrome/browser/infobars/infobar_service.h" |
30 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
33 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 33 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
35 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 35 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 port_status_serializer_.reset(); | 750 port_status_serializer_.reset(); |
752 pref_change_registrar_.RemoveAll(); | 751 pref_change_registrar_.RemoveAll(); |
753 SendPortForwardingStatus(base::DictionaryValue()); | 752 SendPortForwardingStatus(base::DictionaryValue()); |
754 } | 753 } |
755 } | 754 } |
756 | 755 |
757 void DevToolsUIBindings::PerformActionOnRemotePage(const std::string& page_id, | 756 void DevToolsUIBindings::PerformActionOnRemotePage(const std::string& page_id, |
758 const std::string& action) { | 757 const std::string& action) { |
759 if (!remote_targets_handler_) | 758 if (!remote_targets_handler_) |
760 return; | 759 return; |
761 DevToolsTargetImpl* target = remote_targets_handler_->GetTarget(page_id); | 760 scoped_refptr<content::DevToolsAgentHost> host = |
762 if (!target) | 761 remote_targets_handler_->GetTarget(page_id); |
| 762 if (!host) |
763 return; | 763 return; |
764 if (action == kRemotePageActionInspect) | 764 if (action == kRemotePageActionInspect) |
765 target->GetAgentHost()->Inspect(); | 765 host->Inspect(); |
766 if (action == kRemotePageActionReload) | 766 if (action == kRemotePageActionReload) |
767 target->GetAgentHost()->Reload(); | 767 host->Reload(); |
768 if (action == kRemotePageActionActivate) | 768 if (action == kRemotePageActionActivate) |
769 target->GetAgentHost()->Activate(); | 769 host->Activate(); |
770 if (action == kRemotePageActionClose) | 770 if (action == kRemotePageActionClose) |
771 target->GetAgentHost()->Close(); | 771 host->Close(); |
772 } | 772 } |
773 | 773 |
774 void DevToolsUIBindings::OpenRemotePage(const std::string& browser_id, | 774 void DevToolsUIBindings::OpenRemotePage(const std::string& browser_id, |
775 const std::string& url) { | 775 const std::string& url) { |
776 if (!remote_targets_handler_) | 776 if (!remote_targets_handler_) |
777 return; | 777 return; |
778 remote_targets_handler_->Open(browser_id, url); | 778 remote_targets_handler_->Open(browser_id, url); |
779 } | 779 } |
780 | 780 |
781 void DevToolsUIBindings::GetPreferences(const DispatchCallback& callback) { | 781 void DevToolsUIBindings::GetPreferences(const DispatchCallback& callback) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 void DevToolsUIBindings::FrontendLoaded() { | 1099 void DevToolsUIBindings::FrontendLoaded() { |
1100 if (frontend_loaded_) | 1100 if (frontend_loaded_) |
1101 return; | 1101 return; |
1102 frontend_loaded_ = true; | 1102 frontend_loaded_ = true; |
1103 | 1103 |
1104 // Call delegate first - it seeds importants bit of information. | 1104 // Call delegate first - it seeds importants bit of information. |
1105 delegate_->OnLoadCompleted(); | 1105 delegate_->OnLoadCompleted(); |
1106 | 1106 |
1107 AddDevToolsExtensionsToClient(); | 1107 AddDevToolsExtensionsToClient(); |
1108 } | 1108 } |
OLD | NEW |