Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2867303003: Generalize the API of WakeLockContext mojo interface. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #include "content/public/common/browser_side_navigation_policy.h" 119 #include "content/public/common/browser_side_navigation_policy.h"
120 #include "content/public/common/child_process_host.h" 120 #include "content/public/common/child_process_host.h"
121 #include "content/public/common/content_constants.h" 121 #include "content/public/common/content_constants.h"
122 #include "content/public/common/content_switches.h" 122 #include "content/public/common/content_switches.h"
123 #include "content/public/common/page_zoom.h" 123 #include "content/public/common/page_zoom.h"
124 #include "content/public/common/result_codes.h" 124 #include "content/public/common/result_codes.h"
125 #include "content/public/common/url_utils.h" 125 #include "content/public/common/url_utils.h"
126 #include "content/public/common/web_preferences.h" 126 #include "content/public/common/web_preferences.h"
127 #include "device/geolocation/geolocation_service_context.h" 127 #include "device/geolocation/geolocation_service_context.h"
128 #include "device/nfc/nfc.mojom.h" 128 #include "device/nfc/nfc.mojom.h"
129 #include "device/power_save_blocker/power_save_blocker.h"
129 #include "net/base/url_util.h" 130 #include "net/base/url_util.h"
130 #include "net/http/http_cache.h" 131 #include "net/http/http_cache.h"
131 #include "net/http/http_transaction_factory.h" 132 #include "net/http/http_transaction_factory.h"
132 #include "net/url_request/url_request_context.h" 133 #include "net/url_request/url_request_context.h"
133 #include "net/url_request/url_request_context_getter.h" 134 #include "net/url_request/url_request_context_getter.h"
134 #include "ppapi/features/features.h" 135 #include "ppapi/features/features.h"
135 #include "services/service_manager/public/cpp/interface_provider.h" 136 #include "services/service_manager/public/cpp/interface_provider.h"
136 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" 137 #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
137 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 138 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
138 #include "third_party/skia/include/core/SkBitmap.h" 139 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 2631
2631 device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() { 2632 device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() {
2632 // WebContents creates a long-lived connection to one WakeLockServiceImpl. 2633 // WebContents creates a long-lived connection to one WakeLockServiceImpl.
2633 // All the frames' requests will be added into the BindingSet of 2634 // All the frames' requests will be added into the BindingSet of
2634 // WakeLockServiceImpl via this connection. 2635 // WakeLockServiceImpl via this connection.
2635 if (!renderer_wake_lock_) { 2636 if (!renderer_wake_lock_) {
2636 device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext(); 2637 device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext();
2637 if (!wake_lock_context) { 2638 if (!wake_lock_context) {
2638 return nullptr; 2639 return nullptr;
2639 } 2640 }
2640 wake_lock_context->GetWakeLock(mojo::MakeRequest(&renderer_wake_lock_)); 2641 wake_lock_context->GetWakeLock(
2642 device::PowerSaveBlocker::PowerSaveBlockerType::
2643 kPowerSaveBlockPreventDisplaySleep,
2644 device::PowerSaveBlocker::Reason::kReasonOther, "Wake Lock API",
2645 mojo::MakeRequest(&renderer_wake_lock_));
2641 } 2646 }
2642 return renderer_wake_lock_.get(); 2647 return renderer_wake_lock_.get();
2643 } 2648 }
2644 2649
2645 void WebContentsImpl::OnShowValidationMessage( 2650 void WebContentsImpl::OnShowValidationMessage(
2646 RenderViewHostImpl* source, 2651 RenderViewHostImpl* source,
2647 const gfx::Rect& anchor_in_root_view, 2652 const gfx::Rect& anchor_in_root_view,
2648 const base::string16& main_text, 2653 const base::string16& main_text,
2649 const base::string16& sub_text) { 2654 const base::string16& sub_text) {
2650 // TODO(nick): Should we consider |source| here or pass it to the delegate? 2655 // TODO(nick): Should we consider |source| here or pass it to the delegate?
(...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5621 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5617 if (!render_view_host) 5622 if (!render_view_host)
5618 continue; 5623 continue;
5619 render_view_host_set.insert(render_view_host); 5624 render_view_host_set.insert(render_view_host);
5620 } 5625 }
5621 for (RenderViewHost* render_view_host : render_view_host_set) 5626 for (RenderViewHost* render_view_host : render_view_host_set)
5622 render_view_host->OnWebkitPreferencesChanged(); 5627 render_view_host->OnWebkitPreferencesChanged();
5623 } 5628 }
5624 5629
5625 } // namespace content 5630 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698