OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_WAKE_LOCK_DISPATCHER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/public/web/WebView.h" |
| 11 #include "third_party/WebKit/public/web/WebWakeLockClient.h" |
| 12 #include "third_party/WebKit/public/web/WebWakeLockController.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // WakeLockDispatcher is a delegate for WakeLock messages used by WebKit. |
| 17 // It's the complement of WakeLockDispatcherHost (owned by RenderViewHost). |
| 18 class WakeLockDispatcher : public content::RenderViewObserver, |
| 19 public blink::WebWakeLockClient { |
| 20 public: |
| 21 explicit WakeLockDispatcher(content::RenderView* render_view); |
| 22 virtual ~WakeLockDispatcher(); |
| 23 |
| 24 private: |
| 25 int routing_id_; |
| 26 scoped_ptr<blink::WebWakeLockController> controller_; |
| 27 |
| 28 // RenderView::Observer implementation. |
| 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 30 |
| 31 // WebWakeLockClient |
| 32 virtual void requestWakeLock(); |
| 33 virtual void requestWakeUnlock(); |
| 34 virtual void wakeLockDestroyed(); |
| 35 virtual void setController(blink::WebWakeLockController*); |
| 36 |
| 37 void OnWakeLockCreatedSuccessful(); |
| 38 void OnWakeLockCreatedFailed(); |
| 39 void OnWakeLockUnlockedSuccessful(); |
| 40 void OnWakeLockUnlockedFailed(); |
| 41 }; |
| 42 } |
| 43 |
| 44 #endif // CONTENT_RENDERER_WAKE_LOCK_DISPATCHER_H_ |
OLD | NEW |