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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 return nullptr; | 2598 return nullptr; |
2599 | 2599 |
2600 return guest->GetMainFrame(); | 2600 return guest->GetMainFrame(); |
2601 } | 2601 } |
2602 | 2602 |
2603 device::GeolocationServiceContext* | 2603 device::GeolocationServiceContext* |
2604 WebContentsImpl::GetGeolocationServiceContext() { | 2604 WebContentsImpl::GetGeolocationServiceContext() { |
2605 return geolocation_service_context_.get(); | 2605 return geolocation_service_context_.get(); |
2606 } | 2606 } |
2607 | 2607 |
2608 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() { | 2608 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockContext() { |
2609 if (!wake_lock_context_host_) | 2609 if (!wake_lock_context_host_) |
2610 wake_lock_context_host_.reset(new WakeLockContextHost(this)); | 2610 wake_lock_context_host_.reset(new WakeLockContextHost(this)); |
2611 return wake_lock_context_host_->GetWakeLockContext(); | 2611 return wake_lock_context_host_->GetWakeLockContext(); |
2612 } | 2612 } |
2613 | 2613 |
| 2614 device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() { |
| 2615 // WebContents creates a long-lived connection to one WakeLockServiceImpl. |
| 2616 // All the frames' requests will be added into the BindingSet of |
| 2617 // WakeLockServiceImpl via this connection. |
| 2618 if (!renderer_wake_lock_) { |
| 2619 device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext(); |
| 2620 if (!wake_lock_context) { |
| 2621 return nullptr; |
| 2622 } |
| 2623 wake_lock_context->GetWakeLock(mojo::MakeRequest(&renderer_wake_lock_)); |
| 2624 } |
| 2625 return renderer_wake_lock_.get(); |
| 2626 } |
| 2627 |
2614 void WebContentsImpl::OnShowValidationMessage( | 2628 void WebContentsImpl::OnShowValidationMessage( |
2615 RenderViewHostImpl* source, | 2629 RenderViewHostImpl* source, |
2616 const gfx::Rect& anchor_in_root_view, | 2630 const gfx::Rect& anchor_in_root_view, |
2617 const base::string16& main_text, | 2631 const base::string16& main_text, |
2618 const base::string16& sub_text) { | 2632 const base::string16& sub_text) { |
2619 // TODO(nick): Should we consider |source| here or pass it to the delegate? | 2633 // TODO(nick): Should we consider |source| here or pass it to the delegate? |
2620 if (delegate_) | 2634 if (delegate_) |
2621 delegate_->ShowValidationMessage( | 2635 delegate_->ShowValidationMessage( |
2622 this, anchor_in_root_view, main_text, sub_text); | 2636 this, anchor_in_root_view, main_text, sub_text); |
2623 } | 2637 } |
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5585 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5599 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
5586 if (!render_view_host) | 5600 if (!render_view_host) |
5587 continue; | 5601 continue; |
5588 render_view_host_set.insert(render_view_host); | 5602 render_view_host_set.insert(render_view_host); |
5589 } | 5603 } |
5590 for (RenderViewHost* render_view_host : render_view_host_set) | 5604 for (RenderViewHost* render_view_host : render_view_host_set) |
5591 render_view_host->OnWebkitPreferencesChanged(); | 5605 render_view_host->OnWebkitPreferencesChanged(); |
5592 } | 5606 } |
5593 | 5607 |
5594 } // namespace content | 5608 } // namespace content |
OLD | NEW |