summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 08:13:17 +0000
committermohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 08:13:17 +0000
commitd141b92555ee9218ec843bdab874bafeefde7b24 (patch)
tree6c3e20e38b4ce8c8948c38ff4e3c16f6f0968df4 /ash
parent36a90d1830094c28f3fd5b8d05dc9c3771906f3e (diff)
downloadchromium_src-d141b92555ee9218ec843bdab874bafeefde7b24.zip
chromium_src-d141b92555ee9218ec843bdab874bafeefde7b24.tar.gz
chromium_src-d141b92555ee9218ec843bdab874bafeefde7b24.tar.bz2
Add persisted preference for projection touch HUD
A new preference is created showing if the projection touch HUD is enabled or not. This preference is per-user and unsyncable. It is not exposed anywhere in the UI, but can be toggled using the Ctrl+Alt+9 accelerator combination. BUG=233567 Review URL: https://chromiumcodereview.appspot.com/18163006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/root_window_controller.cc43
-rw-r--r--ash/root_window_controller.h24
-rw-r--r--ash/shell.cc15
-rw-r--r--ash/shell_observer.h3
4 files changed, 45 insertions, 40 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 0bacb01..82ff30d 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -209,18 +209,6 @@ RootWindowController* RootWindowController::ForActiveRootWindow() {
return GetRootWindowController(Shell::GetActiveRootWindow());
}
-void RootWindowController::EnableTouchHudProjection() {
- if (touch_hud_projection_)
- return;
- set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
-}
-
-void RootWindowController::DisableTouchHudProjection() {
- if (!touch_hud_projection_)
- return;
- touch_hud_projection_->Remove();
-}
-
void RootWindowController::SetWallpaperController(
DesktopBackgroundWidgetController* controller) {
wallpaper_controller_.reset(controller);
@@ -234,6 +222,8 @@ void RootWindowController::SetAnimatingWallpaperController(
}
void RootWindowController::Shutdown() {
+ Shell::GetInstance()->RemoveShellObserver(this);
+
if (animating_wallpaper_controller_.get())
animating_wallpaper_controller_->StopAnimating();
wallpaper_controller_.reset();
@@ -298,6 +288,8 @@ void RootWindowController::Init(bool first_run_after_boot) {
GetSystemModalLayoutManager(NULL)->has_modal_background()) {
GetSystemModalLayoutManager(NULL)->CreateModalBackground();
}
+
+ Shell::GetInstance()->AddShellObserver(this);
}
void RootWindowController::ShowLauncher() {
@@ -314,10 +306,6 @@ void RootWindowController::OnLauncherCreated() {
docked_layout_manager_->SetLauncher(shelf_->launcher());
}
-void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
- shelf_->shelf_layout_manager()->UpdateVisibilityState();
-}
-
void RootWindowController::UpdateAfterLoginStatusChange(
user::LoginStatus status) {
if (shelf_->status_area_widget())
@@ -708,5 +696,28 @@ void RootWindowController::CreateContainersInRootWindow(
"PowerButtonAnimationContainer", root_window) ;
}
+void RootWindowController::EnableTouchHudProjection() {
+ if (touch_hud_projection_)
+ return;
+ set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
+}
+
+void RootWindowController::DisableTouchHudProjection() {
+ if (!touch_hud_projection_)
+ return;
+ touch_hud_projection_->Remove();
+}
+
+void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
+ shelf_->shelf_layout_manager()->UpdateVisibilityState();
+}
+
+void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
+ if (enabled)
+ EnableTouchHudProjection();
+ else
+ DisableTouchHudProjection();
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index 393dcb3..920c553 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -9,6 +9,7 @@
#include "ash/ash_export.h"
#include "ash/shelf/shelf_types.h"
+#include "ash/shell_observer.h"
#include "ash/system/user/login_status.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -68,10 +69,10 @@ class WorkspaceController;
// deleted upon the deletion of the root window. The RootWindowController
// for particular root window is stored as a property and can be obtained
// using |GetRootWindowController(aura::RootWindow*)| function.
-class ASH_EXPORT RootWindowController {
+class ASH_EXPORT RootWindowController : public ShellObserver {
public:
explicit RootWindowController(aura::RootWindow* root_window);
- ~RootWindowController();
+ virtual ~RootWindowController();
// Returns a RootWindowController that has a launcher for given
// |window|. This returns the RootWindowController for the |window|'s
@@ -122,12 +123,6 @@ class ASH_EXPORT RootWindowController {
touch_hud_projection_ = hud;
}
- // Enables projection touch HUD.
- void EnableTouchHudProjection();
-
- // Disables projection touch HUD.
- void DisableTouchHudProjection();
-
DesktopBackgroundWidgetController* wallpaper_controller() {
return wallpaper_controller_.get();
}
@@ -173,9 +168,6 @@ class ASH_EXPORT RootWindowController {
// Called when the launcher associated with this root window is created.
void OnLauncherCreated();
- // Called when the user logs in.
- void OnLoginStateChanged(user::LoginStatus status);
-
// Called when the login status changes after login (such as lock/unlock).
// TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
void UpdateAfterLoginStatusChange(user::LoginStatus status);
@@ -228,6 +220,16 @@ class ASH_EXPORT RootWindowController {
// Initializes the virtual keyboard.
void InitKeyboard();
+ // Enables projection touch HUD.
+ void EnableTouchHudProjection();
+
+ // Disables projection touch HUD.
+ void DisableTouchHudProjection();
+
+ // Overridden from ShellObserver.
+ virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
+ virtual void OnTouchHudProjectionToggled(bool enabled) OVERRIDE;
+
scoped_ptr<aura::RootWindow> root_window_;
RootWindowLayoutManager* root_window_layout_;
diff --git a/ash/shell.cc b/ash/shell.cc
index 1610ae3..8d3b3bb 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -715,10 +715,6 @@ void Shell::SetDisplayWorkAreaInsets(Window* contains,
void Shell::OnLoginStateChanged(user::LoginStatus status) {
FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status));
- RootWindowControllerList controllers = GetAllRootWindowControllers();
- for (RootWindowControllerList::iterator iter = controllers.begin();
- iter != controllers.end(); ++iter)
- (*iter)->OnLoginStateChanged(status);
}
void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) {
@@ -854,16 +850,9 @@ void Shell::SetTouchHudProjectionEnabled(bool enabled) {
if (is_touch_hud_projection_enabled_ == enabled)
return;
- RootWindowList roots = GetInstance()->GetAllRootWindows();
- for (RootWindowList::iterator iter = roots.begin(); iter != roots.end();
- ++iter) {
- internal::RootWindowController* controller = GetRootWindowController(*iter);
- if (enabled)
- controller->EnableTouchHudProjection();
- else
- controller->DisableTouchHudProjection();
- }
is_touch_hud_projection_enabled_ = enabled;
+ FOR_EACH_OBSERVER(ShellObserver, observers_,
+ OnTouchHudProjectionToggled(enabled));
}
void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
diff --git a/ash/shell_observer.h b/ash/shell_observer.h
index 0bdd934..060e30a 100644
--- a/ash/shell_observer.h
+++ b/ash/shell_observer.h
@@ -32,6 +32,9 @@ class ASH_EXPORT ShellObserver {
// Invoked when the shelf alignment in |root_window| is changed.
virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) {}
+ // Invoked when the projection touch HUD is toggled.
+ virtual void OnTouchHudProjectionToggled(bool enabled) {}
+
protected:
virtual ~ShellObserver() {}
};