Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Unified Diff: content/renderer/screen_orientation/screen_orientation_observer.h

Issue 446603002: Refactor code listening to platform events in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webkitplatform_impl_start_stop
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/screen_orientation/screen_orientation_observer.h
diff --git a/content/renderer/screen_orientation/screen_orientation_observer.h b/content/renderer/screen_orientation/screen_orientation_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1ed843f819f16db5e3673755a92c21e9ed29178
--- /dev/null
+++ b/content/renderer/screen_orientation/screen_orientation_observer.h
@@ -0,0 +1,31 @@
+// 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.
+
+#include "content/public/renderer/platform_event_observer.h"
+
+namespace content {
+
+// ScreenOrientationObserver is a helper class implementing the
+// PlatformEventObserver template with blink::WebPlatformEventListener, which is
+// a pure virtual class because it doesn't expect listeners.
+// It is implemented on top of PlatformEventObserver to make sure it follows a
+// common code path even though it only uses part of this code path: it is not
+// expected to receive messages back but should send messages to start/stop
+// listening.
+// The intent of this class is to make sure that platforms that can't listen for
+// display rotations at a marginal cost can be told when to actually do it.
+class ScreenOrientationObserver
+ : public PlatformEventObserver<blink::WebPlatformEventListener> {
+ public:
+ ScreenOrientationObserver();
+
+ // Overriding this method just to make sure |listener| is always null.
+ virtual void Start(blink::WebPlatformEventListener* listener) OVERRIDE;
+
+ protected:
+ virtual void SendStartMessage() OVERRIDE;
+ virtual void SendStopMessage() OVERRIDE;
+};
+
+}; // namespace content

Powered by Google App Engine
This is Rietveld 408576698