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 <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "content/browser/site_instance_impl.h" | 33 #include "content/browser/site_instance_impl.h" |
34 #include "content/browser/web_contents/web_contents_impl.h" | 34 #include "content/browser/web_contents/web_contents_impl.h" |
35 #include "content/common/view_messages.h" | 35 #include "content/common/view_messages.h" |
36 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
37 #include "content/public/browser/content_browser_client.h" | 37 #include "content/public/browser/content_browser_client.h" |
38 #include "content/public/browser/render_widget_host_iterator.h" | 38 #include "content/public/browser/render_widget_host_iterator.h" |
39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
40 #include "content/public/common/browser_side_navigation_policy.h" | 40 #include "content/public/common/browser_side_navigation_policy.h" |
41 | 41 |
42 #if defined(OS_ANDROID) | 42 #if defined(OS_ANDROID) |
43 #include "content/browser/power_save_blocker_factory.h" | 43 #include "content/browser/power_save_blocker_impl.h" |
| 44 #include "content/public/browser/power_save_blocker_factory.h" |
44 #include "content/public/browser/render_widget_host_view.h" | 45 #include "content/public/browser/render_widget_host_view.h" |
45 #include "device/power_save_blocker/power_save_blocker_impl.h" | |
46 #endif | 46 #endif |
47 | 47 |
48 namespace content { | 48 namespace content { |
49 | 49 |
50 typedef std::vector<RenderFrameDevToolsAgentHost*> Instances; | 50 typedef std::vector<RenderFrameDevToolsAgentHost*> Instances; |
51 | 51 |
52 namespace { | 52 namespace { |
53 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; | 53 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; |
54 | 54 |
55 static RenderFrameDevToolsAgentHost* FindAgentHost(RenderFrameHost* host) { | 55 static RenderFrameDevToolsAgentHost* FindAgentHost(RenderFrameHost* host) { |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 if (pending_) | 494 if (pending_) |
495 pending_->InspectElement(x, y); | 495 pending_->InspectElement(x, y); |
496 } | 496 } |
497 | 497 |
498 void RenderFrameDevToolsAgentHost::OnClientAttached() { | 498 void RenderFrameDevToolsAgentHost::OnClientAttached() { |
499 if (!web_contents()) | 499 if (!web_contents()) |
500 return; | 500 return; |
501 | 501 |
502 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); | 502 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); |
503 #if defined(OS_ANDROID) | 503 #if defined(OS_ANDROID) |
504 power_save_blocker_.reset(static_cast<device::PowerSaveBlockerImpl*>( | 504 power_save_blocker_.reset(static_cast<PowerSaveBlockerImpl*>( |
505 CreatePowerSaveBlocker( | 505 CreatePowerSaveBlocker( |
506 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 506 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
507 device::PowerSaveBlocker::kReasonOther, "DevTools") | 507 PowerSaveBlocker::kReasonOther, "DevTools") |
508 .release())); | 508 .release())); |
509 if (web_contents()->GetNativeView()) { | 509 if (web_contents()->GetNativeView()) { |
510 view_weak_factory_.reset(new base::WeakPtrFactory<ui::ViewAndroid>( | 510 view_weak_factory_.reset(new base::WeakPtrFactory<ui::ViewAndroid>( |
511 web_contents()->GetNativeView())); | 511 web_contents()->GetNativeView())); |
512 power_save_blocker_->InitDisplaySleepBlocker( | 512 power_save_blocker_->InitDisplaySleepBlocker( |
513 view_weak_factory_->GetWeakPtr()); | 513 view_weak_factory_->GetWeakPtr()); |
514 } | 514 } |
515 #endif | 515 #endif |
516 | 516 |
517 // TODO(kaznacheev): Move this call back to DevToolsManager when | 517 // TODO(kaznacheev): Move this call back to DevToolsManager when |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 RenderFrameHost* host) { | 922 RenderFrameHost* host) { |
923 return (current_ && current_->host() == host) || | 923 return (current_ && current_->host() == host) || |
924 (pending_ && pending_->host() == host); | 924 (pending_ && pending_->host() == host); |
925 } | 925 } |
926 | 926 |
927 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 927 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
928 return current_ && current_->host()->GetParent(); | 928 return current_ && current_->host()->GetParent(); |
929 } | 929 } |
930 | 930 |
931 } // namespace content | 931 } // namespace content |
OLD | NEW |