Index: content/renderer/wake_lock/wake_lock_dispatcher.h |
diff --git a/content/renderer/wake_lock/wake_lock_dispatcher.h b/content/renderer/wake_lock/wake_lock_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca92670e050e4e8a0bb5ed829ca273f1b436861a |
--- /dev/null |
+++ b/content/renderer/wake_lock/wake_lock_dispatcher.h |
@@ -0,0 +1,44 @@ |
+// 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. |
+ |
+#ifndef CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |
+#define CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |
+ |
+#include "content/public/renderer/render_view_observer.h" |
+#include "third_party/WebKit/public/platform/WebWakeLockClient.h" |
+ |
+namespace content { |
+ |
+// WakeLockDispatcher is a delegate for WakeLock messages used by WebKit. |
+// It's the complement of WakeLockDispatcherHost. |
+class CONTENT_EXPORT WakeLockDispatcher |
+ : public RenderViewObserver, |
+ NON_EXPORTED_BASE(public blink::WebWakeLockClient) { |
+ public: |
+ explicit WakeLockDispatcher(RenderView* render_view); |
+ virtual ~WakeLockDispatcher(); |
+ |
+ private: |
+ friend class WakeLockDispatcherTest; |
+ |
+ blink::WebWakeLockRequestCallback* callback_; |
+ |
+ // RenderFrame::Observer implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // WebWakeLockClient |
+ virtual void requestWakeLock(const blink::WakeLockRequestInfo&, |
+ const blink::WebSecurityOrigin&) OVERRIDE; |
+ virtual void requestWakeUnlock(const blink::WakeLockRequestInfo&) OVERRIDE; |
+ virtual void wakeLockDestroyed() OVERRIDE; |
+ virtual void setRequestCallback(blink::WebWakeLockRequestCallback*) OVERRIDE; |
+ |
+ void OnCreatedWakeLockSuccessful(int request_id); |
+ void OnCreatedWakeLockFailed(int request_id); |
+ void OnUnlockedWakeLockSuccessful(int request_id); |
+ void OnUnlockedWakeLockFailed(int request_id); |
+}; |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |