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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 10915140: Add the partial screen magnifier to Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fixes Created 8 years, 1 month 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
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/magnifier/partial_magnification_controller.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 5520e98247cfb254efbd58487a2108b7d61df019..dd998dad3bd530d9419703def347e02d85a36c0c 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -20,6 +20,7 @@
#include "ash/launcher/launcher_delegate.h"
#include "ash/launcher/launcher_model.h"
#include "ash/magnifier/magnification_controller.h"
+#include "ash/magnifier/partial_magnification_controller.h"
#include "ash/root_window_controller.h"
#include "ash/rotator/screen_rotation.h"
#include "ash/screen_ash.h"
@@ -228,18 +229,25 @@ bool HandleToggleRootWindowFullScreen() {
// Magnify the screen
bool HandleMagnifyScreen(int delta_index) {
- // TODO(yoshiki): Create the class like MagnifierStepScaleController, and
- // move the following scale control to it.
- float scale =
- ash::Shell::GetInstance()->magnification_controller()->GetScale();
- // Calculate rounded logarithm (base kMagnificationFactor) of scale.
- int scale_index =
- std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5);
-
- int new_scale_index = std::max(0, std::min(8, scale_index + delta_index));
-
- ash::Shell::GetInstance()->magnification_controller()->
- SetScale(std::pow(kMagnificationFactor, new_scale_index), true);
+ if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) {
+ // TODO(yoshiki): Create the class like MagnifierStepScaleController, and
+ // move the following scale control to it.
+ float scale =
+ ash::Shell::GetInstance()->magnification_controller()->GetScale();
+ // Calculate rounded logarithm (base kMagnificationFactor) of scale.
+ int scale_index =
+ std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5);
+
+ int new_scale_index = std::max(0, std::min(8, scale_index + delta_index));
+
+ ash::Shell::GetInstance()->magnification_controller()->
+ SetScale(std::pow(kMagnificationFactor, new_scale_index), true);
+ } else if (ash::Shell::GetInstance()
+ ->partial_magnification_controller()->IsEnabled()) {
sky 2012/11/12 15:23:46 nit: -> on previous line (you do on 248).
Zachary Kuznia 2012/11/13 08:16:15 Done.
+ float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1;
+ ash::Shell::GetInstance()->partial_magnification_controller()->
+ SetScale(scale);
+ }
return true;
}
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/magnifier/partial_magnification_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698