Commit d46e8831 authored by blundell's avatar blundell Committed by Commit bot

Content Modularization Project: Move Wake Lock to //device

As part of the Content Modularization Project, this CL moves the
implementation of the wake_lock_service.mojom interface from
//content/browser to //device. It also moves that interface itself
out from Blink to //device.

BUG=612346
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2389743002
Cr-Commit-Position: refs/heads/master@{#423831}
parent 908c1a14
...@@ -67,6 +67,7 @@ source_set("browser") { ...@@ -67,6 +67,7 @@ source_set("browser") {
"//device/power_save_blocker", "//device/power_save_blocker",
"//device/time_zone_monitor", "//device/time_zone_monitor",
"//device/vibration", "//device/vibration",
"//device/wake_lock",
"//gin", "//gin",
"//google_apis", "//google_apis",
"//gpu", "//gpu",
...@@ -1321,10 +1322,6 @@ source_set("browser") { ...@@ -1321,10 +1322,6 @@ source_set("browser") {
"user_metrics.cc", "user_metrics.cc",
"utility_process_host_impl.cc", "utility_process_host_impl.cc",
"utility_process_host_impl.h", "utility_process_host_impl.h",
"wake_lock/wake_lock_service_context.cc",
"wake_lock/wake_lock_service_context.h",
"wake_lock/wake_lock_service_impl.cc",
"wake_lock/wake_lock_service_impl.h",
"web_contents/aura/gesture_nav_simple.cc", "web_contents/aura/gesture_nav_simple.cc",
"web_contents/aura/gesture_nav_simple.h", "web_contents/aura/gesture_nav_simple.h",
"web_contents/aura/overscroll_navigation_overlay.cc", "web_contents/aura/overscroll_navigation_overlay.cc",
......
...@@ -22,6 +22,7 @@ include_rules = [ ...@@ -22,6 +22,7 @@ include_rules = [
"+device/time_zone_monitor", # For TimeZoneMonitor creation. "+device/time_zone_monitor", # For TimeZoneMonitor creation.
"+device/vibration", # For Vibration API "+device/vibration", # For Vibration API
"+device/vr", # For WebVR API "+device/vr", # For WebVR API
"+device/wake_lock",
"+gin/v8_initializer.h", "+gin/v8_initializer.h",
"+mojo", "+mojo",
"+services", "+services",
...@@ -88,7 +89,6 @@ include_rules = [ ...@@ -88,7 +89,6 @@ include_rules = [
"+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h", "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h",
"+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h", "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h",
"+third_party/WebKit/public/platform/modules/vr/WebVR.h", "+third_party/WebKit/public/platform/modules/vr/WebVR.h",
"+third_party/WebKit/public/platform/modules/wake_lock/wake_lock_service.mojom.h",
"+third_party/WebKit/public/platform/modules/websockets/websocket.mojom.h", "+third_party/WebKit/public/platform/modules/websockets/websocket.mojom.h",
"+third_party/WebKit/public/web/WebAXEnums.h", "+third_party/WebKit/public/web/WebAXEnums.h",
"+third_party/WebKit/public/web/WebCompositionUnderline.h", "+third_party/WebKit/public/web/WebCompositionUnderline.h",
......
...@@ -72,7 +72,8 @@ RenderFrameHostDelegate::GetGeolocationServiceContext() { ...@@ -72,7 +72,8 @@ RenderFrameHostDelegate::GetGeolocationServiceContext() {
return nullptr; return nullptr;
} }
WakeLockServiceContext* RenderFrameHostDelegate::GetWakeLockServiceContext() { device::WakeLockServiceContext*
RenderFrameHostDelegate::GetWakeLockServiceContext() {
return nullptr; return nullptr;
} }
......
...@@ -33,6 +33,7 @@ class Message; ...@@ -33,6 +33,7 @@ class Message;
namespace device { namespace device {
class GeolocationServiceContext; class GeolocationServiceContext;
class WakeLockServiceContext;
} }
namespace content { namespace content {
...@@ -40,7 +41,6 @@ class FrameTreeNode; ...@@ -40,7 +41,6 @@ class FrameTreeNode;
class InterstitialPage; class InterstitialPage;
class PageState; class PageState;
class RenderFrameHost; class RenderFrameHost;
class WakeLockServiceContext;
class WebContents; class WebContents;
struct AXEventNotificationDetails; struct AXEventNotificationDetails;
struct AXLocationChangeNotificationDetails; struct AXLocationChangeNotificationDetails;
...@@ -168,7 +168,7 @@ class CONTENT_EXPORT RenderFrameHostDelegate { ...@@ -168,7 +168,7 @@ class CONTENT_EXPORT RenderFrameHostDelegate {
virtual device::GeolocationServiceContext* GetGeolocationServiceContext(); virtual device::GeolocationServiceContext* GetGeolocationServiceContext();
// Gets the WakeLockServiceContext associated with this delegate. // Gets the WakeLockServiceContext associated with this delegate.
virtual WakeLockServiceContext* GetWakeLockServiceContext(); virtual device::WakeLockServiceContext* GetWakeLockServiceContext();
// Notification that the frame wants to go into fullscreen mode. // Notification that the frame wants to go into fullscreen mode.
// |origin| represents the origin of the frame that requests fullscreen. // |origin| represents the origin of the frame that requests fullscreen.
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/shared_worker/shared_worker_service_impl.h" #include "content/browser/shared_worker/shared_worker_service_impl.h"
#include "content/browser/wake_lock/wake_lock_service_context.h"
#include "content/browser/websockets/websocket_manager.h" #include "content/browser/websockets/websocket_manager.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h" #include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/common/accessibility_messages.h" #include "content/common/accessibility_messages.h"
...@@ -90,6 +89,7 @@ ...@@ -90,6 +89,7 @@
#include "device/generic_sensor/sensor_provider_impl.h" #include "device/generic_sensor/sensor_provider_impl.h"
#include "device/geolocation/geolocation_service_context.h" #include "device/geolocation/geolocation_service_context.h"
#include "device/vibration/vibration_manager_impl.h" #include "device/vibration/vibration_manager_impl.h"
#include "device/wake_lock/wake_lock_service_context.h"
#include "media/mojo/interfaces/media_service.mojom.h" #include "media/mojo/interfaces/media_service.mojom.h"
#include "media/mojo/interfaces/service_factory.mojom.h" #include "media/mojo/interfaces/service_factory.mojom.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
...@@ -2146,14 +2146,14 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { ...@@ -2146,14 +2146,14 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
weak_ptr_factory_.GetWeakPtr()))); weak_ptr_factory_.GetWeakPtr())));
} }
WakeLockServiceContext* wake_lock_service_context = device::WakeLockServiceContext* wake_lock_service_context =
delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
if (wake_lock_service_context) { if (wake_lock_service_context) {
// WakeLockServiceContext is owned by WebContentsImpl so it will outlive // WakeLockServiceContext is owned by WebContentsImpl so it will outlive
// this RenderFrameHostImpl, hence a raw pointer can be bound to service // this RenderFrameHostImpl, hence a raw pointer can be bound to service
// factory callback. // factory callback.
GetInterfaceRegistry()->AddInterface<blink::mojom::WakeLockService>( GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
base::Bind(&WakeLockServiceContext::CreateService, base::Bind(&device::WakeLockServiceContext::CreateService,
base::Unretained(wake_lock_service_context))); base::Unretained(wake_lock_service_context)));
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
#include "content/browser/wake_lock/wake_lock_service_context.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
...@@ -13,6 +12,7 @@ ...@@ -13,6 +12,7 @@
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h" #include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h" #include "content/test/content_browser_test_utils_internal.h"
#include "device/wake_lock/wake_lock_service_context.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
...@@ -62,7 +62,7 @@ class WakeLockTest : public ContentBrowserTest { ...@@ -62,7 +62,7 @@ class WakeLockTest : public ContentBrowserTest {
return GetNestedFrameNode()->current_frame_host(); return GetNestedFrameNode()->current_frame_host();
} }
WakeLockServiceContext* GetWakeLockServiceContext() { device::WakeLockServiceContext* GetWakeLockServiceContext() {
return GetWebContentsImpl()->GetWakeLockServiceContext(); return GetWebContentsImpl()->GetWakeLockServiceContext();
} }
......
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
#include "content/browser/renderer_host/text_input_manager.h" #include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h" #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h"
#include "content/browser/site_instance_impl.h" #include "content/browser/site_instance_impl.h"
#include "content/browser/wake_lock/wake_lock_service_context.h"
#include "content/browser/web_contents/web_contents_view_child_frame.h" #include "content/browser/web_contents/web_contents_view_child_frame.h"
#include "content/browser/web_contents/web_contents_view_guest.h" #include "content/browser/web_contents/web_contents_view_guest.h"
#include "content/browser/webui/generic_handler.h" #include "content/browser/webui/generic_handler.h"
...@@ -121,6 +120,7 @@ ...@@ -121,6 +120,7 @@
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "device/geolocation/geolocation_service_context.h" #include "device/geolocation/geolocation_service_context.h"
#include "device/nfc/nfc.mojom.h" #include "device/nfc/nfc.mojom.h"
#include "device/wake_lock/wake_lock_service_context.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
#include "net/http/http_cache.h" #include "net/http/http_cache.h"
#include "net/http/http_transaction_factory.h" #include "net/http/http_transaction_factory.h"
...@@ -463,7 +463,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) ...@@ -463,7 +463,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); pepper_playback_observer_.reset(new PepperPlaybackObserver(this));
#endif #endif
loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this));
wake_lock_service_context_.reset(new WakeLockServiceContext( wake_lock_service_context_.reset(new device::WakeLockServiceContext(
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
base::Bind(&WebContentsImpl::GetNativeView, base::Unretained(this)))); base::Bind(&WebContentsImpl::GetNativeView, base::Unretained(this))));
} }
...@@ -2429,7 +2429,7 @@ WebContentsImpl::GetGeolocationServiceContext() { ...@@ -2429,7 +2429,7 @@ WebContentsImpl::GetGeolocationServiceContext() {
return geolocation_service_context_.get(); return geolocation_service_context_.get();
} }
WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { device::WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() {
return wake_lock_service_context_.get(); return wake_lock_service_context_.get();
} }
......
...@@ -491,7 +491,7 @@ class CONTENT_EXPORT WebContentsImpl ...@@ -491,7 +491,7 @@ class CONTENT_EXPORT WebContentsImpl
RenderFrameHost* render_frame_host, RenderFrameHost* render_frame_host,
int browser_plugin_instance_id) override; int browser_plugin_instance_id) override;
device::GeolocationServiceContext* GetGeolocationServiceContext() override; device::GeolocationServiceContext* GetGeolocationServiceContext() override;
WakeLockServiceContext* GetWakeLockServiceContext() override; device::WakeLockServiceContext* GetWakeLockServiceContext() override;
void EnterFullscreenMode(const GURL& origin) override; void EnterFullscreenMode(const GURL& origin) override;
void ExitFullscreenMode(bool will_cause_resize) override; void ExitFullscreenMode(bool will_cause_resize) override;
bool ShouldRouteMessageEvent( bool ShouldRouteMessageEvent(
...@@ -1413,7 +1413,7 @@ class CONTENT_EXPORT WebContentsImpl ...@@ -1413,7 +1413,7 @@ class CONTENT_EXPORT WebContentsImpl
std::unique_ptr<device::GeolocationServiceContext> std::unique_ptr<device::GeolocationServiceContext>
geolocation_service_context_; geolocation_service_context_;
std::unique_ptr<WakeLockServiceContext> wake_lock_service_context_; std::unique_ptr<device::WakeLockServiceContext> wake_lock_service_context_;
std::unique_ptr<ScreenOrientationDispatcherHost> std::unique_ptr<ScreenOrientationDispatcherHost>
screen_orientation_dispatcher_host_; screen_orientation_dispatcher_host_;
......
...@@ -729,6 +729,7 @@ test("content_browsertests") { ...@@ -729,6 +729,7 @@ test("content_browsertests") {
"//device/battery:mojo_bindings", "//device/battery:mojo_bindings",
"//device/power_save_blocker", "//device/power_save_blocker",
"//device/vibration:mojo_bindings", "//device/vibration:mojo_bindings",
"//device/wake_lock",
"//gin", "//gin",
"//gpu", "//gpu",
"//ipc:mojom", "//ipc:mojom",
...@@ -1221,7 +1222,6 @@ test("content_unittests") { ...@@ -1221,7 +1222,6 @@ test("content_unittests") {
"../browser/streams/stream_unittest.cc", "../browser/streams/stream_unittest.cc",
"../browser/streams/stream_url_request_job_unittest.cc", "../browser/streams/stream_url_request_job_unittest.cc",
"../browser/tracing/background_tracing_config_unittest.cc", "../browser/tracing/background_tracing_config_unittest.cc",
"../browser/wake_lock/wake_lock_service_context_unittest.cc",
"../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc", "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
"../browser/web_contents/aura/overscroll_window_animation_unittest.cc", "../browser/web_contents/aura/overscroll_window_animation_unittest.cc",
"../browser/web_contents/aura/overscroll_window_delegate_unittest.cc", "../browser/web_contents/aura/overscroll_window_delegate_unittest.cc",
......
...@@ -63,6 +63,7 @@ test("device_unittests") { ...@@ -63,6 +63,7 @@ test("device_unittests") {
"gamepad/gamepad_provider_unittest.cc", "gamepad/gamepad_provider_unittest.cc",
"generic_sensor/platform_sensor_provider_unittest.cc", "generic_sensor/platform_sensor_provider_unittest.cc",
"test/run_all_unittests.cc", "test/run_all_unittests.cc",
"wake_lock/wake_lock_service_context_unittest.cc",
] ]
deps = [ deps = [
...@@ -79,6 +80,7 @@ test("device_unittests") { ...@@ -79,6 +80,7 @@ test("device_unittests") {
"//device/generic_sensor:testing", "//device/generic_sensor:testing",
"//device/geolocation:unittests", "//device/geolocation:unittests",
"//device/power_save_blocker", "//device/power_save_blocker",
"//device/wake_lock",
"//mojo/common", "//mojo/common",
"//mojo/edk/system", "//mojo/edk/system",
"//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings",
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("wake_lock") {
sources = [
"wake_lock_service_context.cc",
"wake_lock_service_context.h",
"wake_lock_service_impl.cc",
"wake_lock_service_impl.h",
]
public_deps = [
"//base",
"//device/wake_lock/public/interfaces",
"//mojo/public/cpp/bindings",
"//ui/gfx",
]
deps = [
"//device/power_save_blocker",
]
}
include_rules = [
"+ui/gfx",
]
blundell@chromium.org
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"wake_lock_service.mojom",
]
}
# Changes to Mojo interfaces require a security review to avoid
# introducing new sandbox escapes.
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
module blink.mojom; module device.mojom;
// WebLockService receives per-frame wake lock preference from its client. // WebLockService receives wake lock preferences from its client.
interface WakeLockService { interface WakeLockService {
RequestWakeLock(); RequestWakeLock();
CancelWakeLock(); CancelWakeLock();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/wake_lock/wake_lock_service_context.h" #include "device/wake_lock/wake_lock_service_context.h"
#include <utility> #include <utility>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "device/power_save_blocker/power_save_blocker.h" #include "device/power_save_blocker/power_save_blocker.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
namespace content { namespace device {
WakeLockServiceContext::WakeLockServiceContext( WakeLockServiceContext::WakeLockServiceContext(
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
...@@ -26,7 +26,7 @@ WakeLockServiceContext::WakeLockServiceContext( ...@@ -26,7 +26,7 @@ WakeLockServiceContext::WakeLockServiceContext(
WakeLockServiceContext::~WakeLockServiceContext() {} WakeLockServiceContext::~WakeLockServiceContext() {}
void WakeLockServiceContext::CreateService( void WakeLockServiceContext::CreateService(
mojo::InterfaceRequest<blink::mojom::WakeLockService> request) { mojo::InterfaceRequest<mojom::WakeLockService> request) {
mojo::MakeStrongBinding( mojo::MakeStrongBinding(
base::MakeUnique<WakeLockServiceImpl>(weak_factory_.GetWeakPtr()), base::MakeUnique<WakeLockServiceImpl>(weak_factory_.GetWeakPtr()),
std::move(request)); std::move(request));
...@@ -79,4 +79,4 @@ void WakeLockServiceContext::UpdateWakeLock() { ...@@ -79,4 +79,4 @@ void WakeLockServiceContext::UpdateWakeLock() {
} }
} }
} // namespace content } // namespace device
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ #ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
#define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ #define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
#include <memory> #include <memory>
#include <set> #include <set>
...@@ -14,18 +14,15 @@ ...@@ -14,18 +14,15 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "content/browser/wake_lock/wake_lock_service_impl.h" #include "device/wake_lock/wake_lock_service_impl.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
namespace device { namespace device {
class PowerSaveBlocker;
} // namespace device
namespace content { class PowerSaveBlocker;
class CONTENT_EXPORT WakeLockServiceContext { class WakeLockServiceContext {
public: public:
WakeLockServiceContext( WakeLockServiceContext(
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
...@@ -33,8 +30,7 @@ class CONTENT_EXPORT WakeLockServiceContext { ...@@ -33,8 +30,7 @@ class CONTENT_EXPORT WakeLockServiceContext {
~WakeLockServiceContext(); ~WakeLockServiceContext();
// Creates a WakeLockServiceImpl that is strongly bound to |request|. // Creates a WakeLockServiceImpl that is strongly bound to |request|.
void CreateService( void CreateService(mojo::InterfaceRequest<mojom::WakeLockService> request);
mojo::InterfaceRequest<blink::mojom::WakeLockService> request);
// Requests wake lock. // Requests wake lock.
void RequestWakeLock(); void RequestWakeLock();
...@@ -56,7 +52,7 @@ class CONTENT_EXPORT WakeLockServiceContext { ...@@ -56,7 +52,7 @@ class CONTENT_EXPORT WakeLockServiceContext {
int num_lock_requests_; int num_lock_requests_;
// The actual power save blocker for screen. // The actual power save blocker for screen.
std::unique_ptr<device::PowerSaveBlocker> wake_lock_; std::unique_ptr<PowerSaveBlocker> wake_lock_;
base::Callback<gfx::NativeView()> native_view_getter_; base::Callback<gfx::NativeView()> native_view_getter_;
base::WeakPtrFactory<WakeLockServiceContext> weak_factory_; base::WeakPtrFactory<WakeLockServiceContext> weak_factory_;
...@@ -64,6 +60,6 @@ class CONTENT_EXPORT WakeLockServiceContext { ...@@ -64,6 +60,6 @@ class CONTENT_EXPORT WakeLockServiceContext {
DISALLOW_COPY_AND_ASSIGN(WakeLockServiceContext); DISALLOW_COPY_AND_ASSIGN(WakeLockServiceContext);
}; };
} // namespace content } // namespace device
#endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/wake_lock/wake_lock_service_context.h" #include "device/wake_lock/wake_lock_service_context.h"
#include <memory> #include <memory>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/process/kill.h" #include "base/process/kill.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace content { namespace device {
class WakeLockServiceContextTest : public testing::Test { class WakeLockServiceContextTest : public testing::Test {
public: public:
...@@ -60,4 +60,4 @@ TEST_F(WakeLockServiceContextTest, LockUnlock) { ...@@ -60,4 +60,4 @@ TEST_F(WakeLockServiceContextTest, LockUnlock) {
EXPECT_FALSE(HasWakeLock()); EXPECT_FALSE(HasWakeLock());
} }
} // namespace content } // namespace device
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/wake_lock/wake_lock_service_impl.h" #include "device/wake_lock/wake_lock_service_impl.h"
#include <utility> #include <utility>
#include "content/browser/wake_lock/wake_lock_service_context.h" #include "device/wake_lock/wake_lock_service_context.h"
namespace content { namespace device {
WakeLockServiceImpl::WakeLockServiceImpl( WakeLockServiceImpl::WakeLockServiceImpl(
base::WeakPtr<WakeLockServiceContext> context) base::WeakPtr<WakeLockServiceContext> context)
...@@ -34,4 +34,4 @@ void WakeLockServiceImpl::CancelWakeLock() { ...@@ -34,4 +34,4 @@ void WakeLockServiceImpl::CancelWakeLock() {
context_->CancelWakeLock(); context_->CancelWakeLock();
} }
} // namespace content } // namespace device
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ #ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
#define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ #define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h"
#include "third_party/WebKit/public/platform/modules/wake_lock/wake_lock_service.mojom.h"
namespace content { namespace device {
class WakeLockServiceContext; class WakeLockServiceContext;
class WakeLockServiceImpl : public blink::mojom::WakeLockService { class WakeLockServiceImpl : public mojom::WakeLockService {
public: public:
explicit WakeLockServiceImpl(base::WeakPtr<WakeLockServiceContext> context); explicit WakeLockServiceImpl(base::WeakPtr<WakeLockServiceContext> context);
~WakeLockServiceImpl() override; ~WakeLockServiceImpl() override;
...@@ -30,6 +30,6 @@ class WakeLockServiceImpl : public blink::mojom::WakeLockService { ...@@ -30,6 +30,6 @@ class WakeLockServiceImpl : public blink::mojom::WakeLockService {
DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl); DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl);
}; };
} // namespace content } // namespace device
#endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
...@@ -9,4 +9,8 @@ blink_modules_sources("wake_lock") { ...@@ -9,4 +9,8 @@ blink_modules_sources("wake_lock") {
"ScreenWakeLock.cpp", "ScreenWakeLock.cpp",
"ScreenWakeLock.h", "ScreenWakeLock.h",
] ]
deps = [
"//device/wake_lock/public/interfaces:interfaces_blink",
]
} }
include_rules = [ include_rules = [
"+core", "+device/wake_lock/public/interfaces",
"-modules",
"+modules/ModulesExport.h",
"+modules/wake_lock",
"+platform",
"+public/platform",
"-web",
] ]
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "core/dom/ContextLifecycleObserver.h" #include "core/dom/ContextLifecycleObserver.h"
#include "core/page/PageVisibilityObserver.h" #include "core/page/PageVisibilityObserver.h"
#include "device/wake_lock/public/interfaces/wake_lock_service.mojom-blink.h"
#include "modules/ModulesExport.h" #include "modules/ModulesExport.h"
#include "public/platform/modules/wake_lock/wake_lock_service.mojom-blink.h"
#include "wtf/Noncopyable.h" #include "wtf/Noncopyable.h"
namespace blink { namespace blink {
...@@ -48,7 +48,7 @@ class MODULES_EXPORT ScreenWakeLock final ...@@ -48,7 +48,7 @@ class MODULES_EXPORT ScreenWakeLock final
static ScreenWakeLock* fromScreen(Screen&); static ScreenWakeLock* fromScreen(Screen&);
void notifyService(); void notifyService();
mojom::blink::WakeLockServicePtr m_service; device::mojom::blink::WakeLockServicePtr m_service;
bool m_keepAwake; bool m_keepAwake;
}; };
......
...@@ -396,6 +396,7 @@ test("webkit_unit_tests") { ...@@ -396,6 +396,7 @@ test("webkit_unit_tests") {
"//base:i18n", "//base:i18n",
"//base/test:test_support", "//base/test:test_support",
"//content/test:test_support", "//content/test:test_support",
"//device/wake_lock/public/interfaces:interfaces_blink",
"//gpu:test_support", "//gpu:test_support",
"//mojo/edk/system:system", "//mojo/edk/system:system",
"//testing/gmock", "//testing/gmock",
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
namespace { namespace {
using blink::ScreenWakeLock; using blink::ScreenWakeLock;
using blink::mojom::blink::WakeLockService; using device::mojom::blink::WakeLockService;
using blink::mojom::blink::WakeLockServiceRequest; using device::mojom::blink::WakeLockServiceRequest;
// This class allows binding interface requests to a MockWakeLockService. // This class allows binding interface requests to a MockWakeLockService.
class MockInterfaceProvider : public blink::InterfaceProvider { class MockInterfaceProvider : public blink::InterfaceProvider {
......
...@@ -637,7 +637,6 @@ mojom("mojo_bindings") { ...@@ -637,7 +637,6 @@ mojom("mojo_bindings") {
"platform/modules/notifications/notification.mojom", "platform/modules/notifications/notification.mojom",
"platform/modules/notifications/notification_service.mojom", "platform/modules/notifications/notification_service.mojom",
"platform/modules/serviceworker/service_worker_event_status.mojom", "platform/modules/serviceworker/service_worker_event_status.mojom",
"platform/modules/wake_lock/wake_lock_service.mojom",
] ]
public_deps = [ public_deps = [
":android_mojo_bindings", ":android_mojo_bindings",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment