| 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 "content/browser/devtools/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 if (!web_contents()) | 495 if (!web_contents()) |
| 496 return; | 496 return; |
| 497 | 497 |
| 498 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); | 498 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); |
| 499 #if defined(OS_ANDROID) | 499 #if defined(OS_ANDROID) |
| 500 power_save_blocker_.reset(static_cast<PowerSaveBlockerImpl*>( | 500 power_save_blocker_.reset(static_cast<PowerSaveBlockerImpl*>( |
| 501 CreatePowerSaveBlocker( | 501 CreatePowerSaveBlocker( |
| 502 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 502 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 503 PowerSaveBlocker::kReasonOther, "DevTools") | 503 PowerSaveBlocker::kReasonOther, "DevTools") |
| 504 .release())); | 504 .release())); |
| 505 power_save_blocker_->InitDisplaySleepBlocker(web_contents()); | 505 power_save_blocker_->InitDisplaySleepBlocker(web_contents()->GetNativeView()); |
| 506 #endif | 506 #endif |
| 507 | 507 |
| 508 // TODO(kaznacheev): Move this call back to DevToolsManager when | 508 // TODO(kaznacheev): Move this call back to DevToolsManager when |
| 509 // extensions::ProcessManager no longer relies on this notification. | 509 // extensions::ProcessManager no longer relies on this notification. |
| 510 DevToolsAgentHostImpl::NotifyCallbacks(this, true); | 510 DevToolsAgentHostImpl::NotifyCallbacks(this, true); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void RenderFrameDevToolsAgentHost::OnClientDetached() { | 513 void RenderFrameDevToolsAgentHost::OnClientDetached() { |
| 514 #if defined(OS_ANDROID) | 514 #if defined(OS_ANDROID) |
| 515 power_save_blocker_.reset(); | 515 power_save_blocker_.reset(); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 const GURL& validated_url, | 742 const GURL& validated_url, |
| 743 int error_code, | 743 int error_code, |
| 744 const base::string16& error_description, | 744 const base::string16& error_description, |
| 745 bool was_ignored_by_handler) { | 745 bool was_ignored_by_handler) { |
| 746 if (IsBrowserSideNavigationEnabled()) | 746 if (IsBrowserSideNavigationEnabled()) |
| 747 return; | 747 return; |
| 748 if (pending_ && pending_->host() == render_frame_host) | 748 if (pending_ && pending_->host() == render_frame_host) |
| 749 DiscardPending(); | 749 DiscardPending(); |
| 750 } | 750 } |
| 751 | 751 |
| 752 void RenderFrameDevToolsAgentHost::WebContentsDestroyed() { |
| 753 #if defined(OS_ANDROID) |
| 754 if (power_save_blocker_) |
| 755 power_save_blocker_->ClearViewForSleepBlocker(); |
| 756 #endif |
| 757 } |
| 758 |
| 752 void RenderFrameDevToolsAgentHost:: | 759 void RenderFrameDevToolsAgentHost:: |
| 753 DispatchBufferedProtocolMessagesIfNecessary() { | 760 DispatchBufferedProtocolMessagesIfNecessary() { |
| 754 if (navigating_handles_.empty() && | 761 if (navigating_handles_.empty() && |
| 755 in_navigation_protocol_message_buffer_.size()) { | 762 in_navigation_protocol_message_buffer_.size()) { |
| 756 DCHECK(current_); | 763 DCHECK(current_); |
| 757 for (const auto& pair : in_navigation_protocol_message_buffer_) { | 764 for (const auto& pair : in_navigation_protocol_message_buffer_) { |
| 758 current_->DispatchProtocolMessage( | 765 current_->DispatchProtocolMessage( |
| 759 pair.second.session_id, pair.first, pair.second.method, | 766 pair.second.session_id, pair.first, pair.second.method, |
| 760 pair.second.message); | 767 pair.second.message); |
| 761 } | 768 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 RenderFrameHost* host) { | 915 RenderFrameHost* host) { |
| 909 return (current_ && current_->host() == host) || | 916 return (current_ && current_->host() == host) || |
| 910 (pending_ && pending_->host() == host); | 917 (pending_ && pending_->host() == host); |
| 911 } | 918 } |
| 912 | 919 |
| 913 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 920 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 914 return current_ && current_->host()->GetParent(); | 921 return current_ && current_->host()->GetParent(); |
| 915 } | 922 } |
| 916 | 923 |
| 917 } // namespace content | 924 } // namespace content |
| OLD | NEW |