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

Unified Diff: athena/screen/screen_manager_impl.cc

Issue 431183003: Rotate screen in response to accelerator or device orientation sensors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use the FILE thread for IO 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: athena/screen/screen_manager_impl.cc
diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc
index 2c9c76401c1f8c02b2fd90e83ef20349bb4dbbba..c3b7b5d69118eee64f88757c17e78d1a8f42975d 100644
--- a/athena/screen/screen_manager_impl.cc
+++ b/athena/screen/screen_manager_impl.cc
@@ -14,11 +14,13 @@
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/layout_manager.h"
+#include "ui/aura/test/test_screen.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
#include "ui/aura/window_targeter.h"
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/layer.h"
+#include "ui/gfx/screen.h"
#include "ui/wm/core/base_focus_rules.h"
#include "ui/wm/core/capture_controller.h"
@@ -200,10 +202,13 @@ class ScreenManagerImpl : public ScreenManager {
virtual aura::Window* CreateContainer(const ContainerParams& params) OVERRIDE;
virtual aura::Window* GetContext() OVERRIDE { return root_window_; }
virtual void SetBackgroundImage(const gfx::ImageSkia& image) OVERRIDE;
+ virtual gfx::Display::Rotation GetRotation() OVERRIDE;
+ virtual void SetRotation(gfx::Display::Rotation rotation) OVERRIDE;
virtual ui::LayerAnimator* GetScreenAnimator() OVERRIDE;
aura::Window* root_window_;
aura::Window* background_window_;
+ gfx::Display::Rotation rotation_;
scoped_ptr<BackgroundController> background_controller_;
scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
@@ -215,7 +220,8 @@ class ScreenManagerImpl : public ScreenManager {
};
ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window)
- : root_window_(root_window) {
+ : root_window_(root_window),
+ rotation_(gfx::Display::ROTATE_0) {
DCHECK(root_window_);
DCHECK(!instance);
instance = this;
@@ -324,6 +330,21 @@ void ScreenManagerImpl::SetBackgroundImage(const gfx::ImageSkia& image) {
background_controller_->SetImage(image);
}
+gfx::Display::Rotation ScreenManagerImpl::GetRotation() {
+ return rotation_;
+}
+
+void ScreenManagerImpl::SetRotation(gfx::Display::Rotation rotation) {
+ if (rotation == rotation_)
+ return;
+
+ rotation_ = rotation;
+ // TODO(flackr): Use display manager to update display rotation:
+ // http://crbug.com/401044.
+ static_cast<aura::TestScreen*>(gfx::Screen::GetNativeScreen())->
+ SetDisplayRotation(rotation);
+}
+
ui::LayerAnimator* ScreenManagerImpl::GetScreenAnimator() {
return root_window_->layer()->GetAnimator();
}

Powered by Google App Engine
This is Rietveld 408576698