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 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 return nullptr; | 2615 return nullptr; |
2616 | 2616 |
2617 return guest->GetMainFrame(); | 2617 return guest->GetMainFrame(); |
2618 } | 2618 } |
2619 | 2619 |
2620 device::GeolocationServiceContext* | 2620 device::GeolocationServiceContext* |
2621 WebContentsImpl::GetGeolocationServiceContext() { | 2621 WebContentsImpl::GetGeolocationServiceContext() { |
2622 return geolocation_service_context_.get(); | 2622 return geolocation_service_context_.get(); |
2623 } | 2623 } |
2624 | 2624 |
2625 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() { | 2625 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockContext() { |
2626 if (!wake_lock_context_host_) | 2626 if (!wake_lock_context_host_) |
2627 wake_lock_context_host_.reset(new WakeLockContextHost(this)); | 2627 wake_lock_context_host_.reset(new WakeLockContextHost(this)); |
2628 return wake_lock_context_host_->GetWakeLockContext(); | 2628 return wake_lock_context_host_->GetWakeLockContext(); |
2629 } | 2629 } |
2630 | 2630 |
| 2631 device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() { |
| 2632 // WebContents creates a long-lived connection to one WakeLockServiceImpl. |
| 2633 // All the frames' requests will be added into the BindingSet of |
| 2634 // WakeLockServiceImpl via this connection. |
| 2635 if (!renderer_wake_lock_) { |
| 2636 device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext(); |
| 2637 if (!wake_lock_context) { |
| 2638 return nullptr; |
| 2639 } |
| 2640 wake_lock_context->GetWakeLock(mojo::MakeRequest(&renderer_wake_lock_)); |
| 2641 } |
| 2642 return renderer_wake_lock_.get(); |
| 2643 } |
| 2644 |
2631 void WebContentsImpl::OnShowValidationMessage( | 2645 void WebContentsImpl::OnShowValidationMessage( |
2632 RenderViewHostImpl* source, | 2646 RenderViewHostImpl* source, |
2633 const gfx::Rect& anchor_in_root_view, | 2647 const gfx::Rect& anchor_in_root_view, |
2634 const base::string16& main_text, | 2648 const base::string16& main_text, |
2635 const base::string16& sub_text) { | 2649 const base::string16& sub_text) { |
2636 // TODO(nick): Should we consider |source| here or pass it to the delegate? | 2650 // TODO(nick): Should we consider |source| here or pass it to the delegate? |
2637 if (delegate_) | 2651 if (delegate_) |
2638 delegate_->ShowValidationMessage( | 2652 delegate_->ShowValidationMessage( |
2639 this, anchor_in_root_view, main_text, sub_text); | 2653 this, anchor_in_root_view, main_text, sub_text); |
2640 } | 2654 } |
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5602 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5616 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
5603 if (!render_view_host) | 5617 if (!render_view_host) |
5604 continue; | 5618 continue; |
5605 render_view_host_set.insert(render_view_host); | 5619 render_view_host_set.insert(render_view_host); |
5606 } | 5620 } |
5607 for (RenderViewHost* render_view_host : render_view_host_set) | 5621 for (RenderViewHost* render_view_host : render_view_host_set) |
5608 render_view_host->OnWebkitPreferencesChanged(); | 5622 render_view_host->OnWebkitPreferencesChanged(); |
5609 } | 5623 } |
5610 | 5624 |
5611 } // namespace content | 5625 } // namespace content |
OLD | NEW |