OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |
| 7 |
| 8 #include "content/public/renderer/render_view_observer.h" |
| 9 #include "third_party/WebKit/public/platform/WebWakeLockClient.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 // WakeLockDispatcher is a delegate for WakeLock messages used by WebKit. |
| 14 // It's the complement of WakeLockDispatcherHost. |
| 15 class CONTENT_EXPORT WakeLockDispatcher |
| 16 : public RenderViewObserver, |
| 17 NON_EXPORTED_BASE(public blink::WebWakeLockClient) { |
| 18 public: |
| 19 explicit WakeLockDispatcher(RenderView* render_view); |
| 20 virtual ~WakeLockDispatcher(); |
| 21 |
| 22 private: |
| 23 friend class WakeLockDispatcherTest; |
| 24 |
| 25 blink::WebWakeLockRequestCallback* callback_; |
| 26 |
| 27 // RenderFrame::Observer implementation. |
| 28 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 29 |
| 30 // WebWakeLockClient |
| 31 virtual void requestWakeLock(const blink::WakeLockRequestInfo&, |
| 32 const blink::WebSecurityOrigin&) OVERRIDE; |
| 33 virtual void requestWakeUnlock(const blink::WakeLockRequestInfo&) OVERRIDE; |
| 34 virtual void wakeLockDestroyed() OVERRIDE; |
| 35 virtual void setRequestCallback(blink::WebWakeLockRequestCallback*) OVERRIDE; |
| 36 |
| 37 void OnCreatedWakeLockSuccessful(int request_id); |
| 38 void OnCreatedWakeLockFailed(int request_id); |
| 39 void OnUnlockedWakeLockSuccessful(int request_id); |
| 40 void OnUnlockedWakeLockFailed(int request_id); |
| 41 }; |
| 42 } // namespace content |
| 43 |
| 44 #endif // CONTENT_RENDERER_WAKE_LOCK_WAKE_LOCK_DISPATCHER_H_ |
OLD | NEW |