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

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

Issue 2391883006: Mojo-ify implementation of screen orientation locking/unlocking. (Closed)
Patch Set: Codereview update Created 4 years, 2 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_impl.h
diff --git a/content/browser/screen_orientation/screen_orientation_impl.h b/content/browser/screen_orientation/screen_orientation_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..907c84cc5cd8dd7d65c524c36f06e78bf7cdc9ba
--- /dev/null
+++ b/content/browser/screen_orientation/screen_orientation_impl.h
@@ -0,0 +1,48 @@
+// Copyright 2016 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_IMPL_H
+#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_IMPL_H
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "content/common/screen_orientation_interface.mojom.h"
+#include "content/public/browser/web_contents_binding_set.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace content {
+
+class ScreenOrientationProvider;
+class WebContents;
+
+class ScreenOrientation
blundell 2016/10/25 16:09:26 ah you already renamed the class, great! so it's j
lunalu1 2016/11/03 23:15:25 Done.
+ : public mojom::ScreenOrientation,
+ public WebContentsObserver {
+ public:
+ ScreenOrientation(WebContents* web_contents);
+ ~ScreenOrientation() override;
+
+ ScreenOrientationProvider* GetScreenOrientationProvider();
+
+ private:
+ // ScreenOrientation:
+ void LockOrientation(::blink::WebScreenOrientationLockType orientation,
+ const LockOrientationCallback& callback) override;
+ void UnlockOrientation() override;
+ // WebContentsObserver:
blundell 2016/10/25 16:09:26 nit: blank line before
lunalu1 2016/11/03 23:15:25 Done.
+ void DidNavigateMainFrame(const LoadCommittedDetails& details,
+ const FrameNavigateParams& params) override;
+
+ void NotifyLockResult(::blink::mojom::ScreenOrientationLockResult result);
+
+ WebContents* web_contents_;
blundell 2016/10/25 16:09:26 nit: if it's a WCO it can just use web_contents()
lunalu1 2016/11/03 23:15:25 Done.
+ std::unique_ptr<ScreenOrientationProvider> provider_;
+ LockOrientationCallback on_result_callback_;
+ WebContentsFrameBindingSet<mojom::ScreenOrientation> binding_;
blundell 2016/10/25 16:09:26 is this called binding_ or bindings_ in other clas
Ken Rockot(use gerrit already) 2016/10/26 22:00:44 bindings_ is probably a better name. There's a bin
lunalu1 2016/11/03 23:15:25 Done.
+ base::WeakPtrFactory<ScreenOrientation> weak_factory_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_IMPL_H

Powered by Google App Engine
This is Rietveld 408576698