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

Unified Diff: content/browser/screen_orientation/screen_orientation_context.h

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 6 years, 3 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/browser/screen_orientation/screen_orientation_context.h
diff --git a/content/browser/screen_orientation/screen_orientation_context.h b/content/browser/screen_orientation/screen_orientation_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..453a61f61304d26435f9e68242e898d966dfd4e3
--- /dev/null
+++ b/content/browser/screen_orientation/screen_orientation_context.h
@@ -0,0 +1,50 @@
+// 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_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_CONTEXT_H_
+#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_CONTEXT_H_
+
+#include "base/observer_list.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Provides information about changes within a screen orientation context to a
+// set of observers of that context.
+class CONTENT_EXPORT ScreenOrientationContext {
+ public:
+ class Observer {
+ public:
+ // Called when the screen orientation changes.
+ virtual void OnScreenOrientationChange() = 0;
+
+ // Called when a new lock request is received within this screen
+ // orientation context.
+ virtual void OnNewLockRequest() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ ScreenOrientationContext();
+ virtual ~ScreenOrientationContext();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ // Notifies observers that screen orientation changed.
+ void OnScreenOrientationChange();
+
+ // Notifies observers that a new lock request was received.
+ void OnNewLockRequest();
+
+ private:
+ ObserverList<Observer> observer_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenOrientationContext);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698