Index: content/renderer/wake_lock_dispatcher.h |
diff --git a/content/renderer/wake_lock_dispatcher.h b/content/renderer/wake_lock_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cbe24f4e75fbb9462d0a662478e48e2de63a9935 |
--- /dev/null |
+++ b/content/renderer/wake_lock_dispatcher.h |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 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.> |
+ |
+#ifndef CONTENT_RENDERER_WAKE_LOCK_DISPATCHER_H_ |
+#define CONTENT_RENDERER_WAKE_LOCK_DISPATCHER_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/public/renderer/render_view_observer.h" |
+#include "third_party/WebKit/public/web/WebView.h" |
+#include "third_party/WebKit/public/web/WebWakeLockClient.h" |
+#include "third_party/WebKit/public/web/WebWakeLockController.h" |
+ |
+namespace content { |
+ |
+// WakeLockDispatcher is a delegate for WakeLock messages used by WebKit. |
+// It's the complement of WakeLockDispatcherHost (owned by RenderViewHost). |
+class WakeLockDispatcher : public content::RenderViewObserver, |
+ public blink::WebWakeLockClient { |
+ public: |
+ explicit WakeLockDispatcher(content::RenderView* render_view); |
+ virtual ~WakeLockDispatcher(); |
+ |
+ private: |
+ int routing_id_; |
+ scoped_ptr<blink::WebWakeLockController> controller_; |
+ |
+ // RenderView::Observer implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // WebWakeLockClient |
+ virtual void requestWakeLock(); |
+ virtual void requestWakeUnlock(); |
+ virtual void wakeLockDestroyed(); |
+ virtual void setController(blink::WebWakeLockController*); |
+ |
+ void OnWakeLockCreatedSuccessful(); |
+ void OnWakeLockCreatedFailed(); |
+ void OnWakeLockUnlockedSuccessful(); |
+ void OnWakeLockUnlockedFailed(); |
+}; |
+} |
+ |
+#endif // CONTENT_RENDERER_WAKE_LOCK_DISPATCHER_H_ |