| 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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 class DefaultBindingsDelegate : public DevToolsUIBindings::Delegate { | 188 class DefaultBindingsDelegate : public DevToolsUIBindings::Delegate { |
| 189 public: | 189 public: |
| 190 explicit DefaultBindingsDelegate(content::WebContents* web_contents) | 190 explicit DefaultBindingsDelegate(content::WebContents* web_contents) |
| 191 : web_contents_(web_contents) {} | 191 : web_contents_(web_contents) {} |
| 192 | 192 |
| 193 private: | 193 private: |
| 194 ~DefaultBindingsDelegate() override {} | 194 ~DefaultBindingsDelegate() override {} |
| 195 | 195 |
| 196 void ActivateWindow() override; | 196 void ActivateWindow() override; |
| 197 void CloseWindow() override {} | 197 void CloseWindow() override {} |
| 198 void Inspect(scoped_refptr<content::DevToolsAgentHost> host) override {} |
| 198 void SetInspectedPageBounds(const gfx::Rect& rect) override {} | 199 void SetInspectedPageBounds(const gfx::Rect& rect) override {} |
| 199 void InspectElementCompleted() override {} | 200 void InspectElementCompleted() override {} |
| 200 void SetIsDocked(bool is_docked) override {} | 201 void SetIsDocked(bool is_docked) override {} |
| 201 void OpenInNewTab(const std::string& url) override; | 202 void OpenInNewTab(const std::string& url) override; |
| 202 void SetWhitelistedShortcuts(const std::string& message) override {} | 203 void SetWhitelistedShortcuts(const std::string& message) override {} |
| 203 using DispatchCallback = | 204 using DispatchCallback = |
| 204 DevToolsEmbedderMessageDispatcher::Delegate::DispatchCallback; | 205 DevToolsEmbedderMessageDispatcher::Delegate::DispatchCallback; |
| 205 | 206 |
| 206 void InspectedContentsClosing() override; | 207 void InspectedContentsClosing() override; |
| 207 void OnLoadCompleted() override {} | 208 void OnLoadCompleted() override {} |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 806 |
| 806 void DevToolsUIBindings::PerformActionOnRemotePage(const std::string& page_id, | 807 void DevToolsUIBindings::PerformActionOnRemotePage(const std::string& page_id, |
| 807 const std::string& action) { | 808 const std::string& action) { |
| 808 if (!remote_targets_handler_) | 809 if (!remote_targets_handler_) |
| 809 return; | 810 return; |
| 810 scoped_refptr<content::DevToolsAgentHost> host = | 811 scoped_refptr<content::DevToolsAgentHost> host = |
| 811 remote_targets_handler_->GetTarget(page_id); | 812 remote_targets_handler_->GetTarget(page_id); |
| 812 if (!host) | 813 if (!host) |
| 813 return; | 814 return; |
| 814 if (action == kRemotePageActionInspect) | 815 if (action == kRemotePageActionInspect) |
| 815 host->Inspect(); | 816 delegate_->Inspect(host); |
| 816 if (action == kRemotePageActionReload) | 817 else if (action == kRemotePageActionReload) |
| 817 host->Reload(); | 818 host->Reload(); |
| 818 if (action == kRemotePageActionActivate) | 819 else if (action == kRemotePageActionActivate) |
| 819 host->Activate(); | 820 host->Activate(); |
| 820 if (action == kRemotePageActionClose) | 821 else if (action == kRemotePageActionClose) |
| 821 host->Close(); | 822 host->Close(); |
| 822 } | 823 } |
| 823 | 824 |
| 824 void DevToolsUIBindings::OpenRemotePage(const std::string& browser_id, | 825 void DevToolsUIBindings::OpenRemotePage(const std::string& browser_id, |
| 825 const std::string& url) { | 826 const std::string& url) { |
| 826 if (!remote_targets_handler_) | 827 if (!remote_targets_handler_) |
| 827 return; | 828 return; |
| 828 remote_targets_handler_->Open(browser_id, url); | 829 remote_targets_handler_->Open(browser_id, url); |
| 829 } | 830 } |
| 830 | 831 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 void DevToolsUIBindings::FrontendLoaded() { | 1150 void DevToolsUIBindings::FrontendLoaded() { |
| 1150 if (frontend_loaded_) | 1151 if (frontend_loaded_) |
| 1151 return; | 1152 return; |
| 1152 frontend_loaded_ = true; | 1153 frontend_loaded_ = true; |
| 1153 | 1154 |
| 1154 // Call delegate first - it seeds importants bit of information. | 1155 // Call delegate first - it seeds importants bit of information. |
| 1155 delegate_->OnLoadCompleted(); | 1156 delegate_->OnLoadCompleted(); |
| 1156 | 1157 |
| 1157 AddDevToolsExtensionsToClient(); | 1158 AddDevToolsExtensionsToClient(); |
| 1158 } | 1159 } |
| OLD | NEW |