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

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

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review, port unittest 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_service_impl.h
diff --git a/content/browser/screen_orientation/screen_orientation_service_impl.h b/content/browser/screen_orientation/screen_orientation_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb2c2287b0d56c8cf4492d75629a0f7adacd06cd
--- /dev/null
+++ b/content/browser/screen_orientation/screen_orientation_service_impl.h
@@ -0,0 +1,49 @@
+// 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 "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/screen_orientation/screen_orientation_context.h"
+#include "content/common/screen_orientation_service.mojom.h"
+
+#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_SERVICE_IMPL_H_
+#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_SERVICE_IMPL_H_
+
+namespace content {
+
+class ScreenOrientationProvider;
+class WebContents;
+
+class ScreenOrientationServiceImpl
+ : public mojo::InterfaceImpl<ScreenOrientationService>,
+ public ScreenOrientationContext::Observer {
+ public:
+ static void Create(WebContents* web_contents,
+ mojo::InterfaceRequest<ScreenOrientationService> request);
+
+ void NotifyLockResult(ScreenOrientationLockResult result);
+
+ private:
+ ScreenOrientationServiceImpl(WebContents* web_contents);
+ virtual ~ScreenOrientationServiceImpl();
+
+ // ScreenOrientationContext::Observer:
+ virtual void OnScreenOrientationChange() OVERRIDE;
+ virtual void OnNewLockRequest() OVERRIDE;
+
+ // ScreenOrientationService:
+ virtual void LockOrientation(
+ ScreenOrientationLockType lock_type,
+ const mojo::Callback<void(ScreenOrientationLockResult)>& callback)
+ OVERRIDE;
+ virtual void UnlockOrientation() OVERRIDE;
+
+ ScreenOrientationContext* context_;
+ scoped_ptr<ScreenOrientationProvider> provider_;
+ mojo::Callback<void(ScreenOrientationLockResult)> on_result_callback_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698