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

Side by Side Diff: ash/accelerators/accelerator_controller_delegate_aura.cc

Issue 2269383002: Magnifier border is now more visible on light backgrounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 5 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 15 matching lines...) Expand all
26 #include "ash/common/wm/window_state.h" 26 #include "ash/common/wm/window_state.h"
27 #include "ash/common/wm/wm_event.h" 27 #include "ash/common/wm/wm_event.h"
28 #include "ash/common/wm_shell.h" 28 #include "ash/common/wm_shell.h"
29 #include "ash/debug.h" 29 #include "ash/debug.h"
30 #include "ash/desktop_background/desktop_background_controller.h" 30 #include "ash/desktop_background/desktop_background_controller.h"
31 #include "ash/desktop_background/user_wallpaper_delegate.h" 31 #include "ash/desktop_background/user_wallpaper_delegate.h"
32 #include "ash/display/display_manager.h" 32 #include "ash/display/display_manager.h"
33 #include "ash/display/window_tree_host_manager.h" 33 #include "ash/display/window_tree_host_manager.h"
34 #include "ash/host/ash_window_tree_host.h" 34 #include "ash/host/ash_window_tree_host.h"
35 #include "ash/magnifier/magnification_controller.h" 35 #include "ash/magnifier/magnification_controller.h"
36 #include "ash/magnifier/partial_magnification_controller.h"
37 #include "ash/root_window_controller.h" 36 #include "ash/root_window_controller.h"
38 #include "ash/rotator/screen_rotation_animator.h" 37 #include "ash/rotator/screen_rotation_animator.h"
39 #include "ash/rotator/window_rotation.h" 38 #include "ash/rotator/window_rotation.h"
40 #include "ash/screen_util.h" 39 #include "ash/screen_util.h"
41 #include "ash/screenshot_delegate.h" 40 #include "ash/screenshot_delegate.h"
42 #include "ash/shelf/shelf.h" 41 #include "ash/shelf/shelf.h"
43 #include "ash/shelf/shelf_widget.h" 42 #include "ash/shelf/shelf_widget.h"
44 #include "ash/shell.h" 43 #include "ash/shell.h"
45 #include "ash/touch/touch_hud_debug.h" 44 #include "ash/touch/touch_hud_debug.h"
46 #include "ash/utility/screenshot_controller.h" 45 #include "ash/utility/screenshot_controller.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 base::RecordAction(UserMetricsAction("Accel_Launch_App")); 144 base::RecordAction(UserMetricsAction("Accel_Launch_App"));
146 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n); 145 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n);
147 } 146 }
148 147
149 void HandleLaunchLastApp() { 148 void HandleLaunchLastApp() {
150 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); 149 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
151 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(-1); 150 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(-1);
152 } 151 }
153 152
154 bool CanHandleMagnifyScreen() { 153 bool CanHandleMagnifyScreen() {
155 Shell* shell = Shell::GetInstance(); 154 return Shell::GetInstance()->magnification_controller()->IsEnabled();
156 return shell->magnification_controller()->IsEnabled() ||
157 shell->partial_magnification_controller()->is_enabled();
158 } 155 }
159 156
160 // Magnify the screen 157 // Magnify the screen
161 void HandleMagnifyScreen(int delta_index) { 158 void HandleMagnifyScreen(int delta_index) {
162 if (Shell::GetInstance()->magnification_controller()->IsEnabled()) { 159 if (Shell::GetInstance()->magnification_controller()->IsEnabled()) {
163 // TODO(yoshiki): Move the following logic to MagnificationController. 160 // TODO(yoshiki): Move the following logic to MagnificationController.
164 float scale = Shell::GetInstance()->magnification_controller()->GetScale(); 161 float scale = Shell::GetInstance()->magnification_controller()->GetScale();
165 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. 162 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale.
166 int scale_index = 163 int scale_index =
167 std::floor(std::log(scale) / std::log(kMagnificationScaleFactor) + 0.5); 164 std::floor(std::log(scale) / std::log(kMagnificationScaleFactor) + 0.5);
168 165
169 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); 166 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index));
170 167
171 Shell::GetInstance()->magnification_controller()->SetScale( 168 Shell::GetInstance()->magnification_controller()->SetScale(
172 std::pow(kMagnificationScaleFactor, new_scale_index), true); 169 std::pow(kMagnificationScaleFactor, new_scale_index), true);
173 } else if (Shell::GetInstance()
174 ->partial_magnification_controller()
175 ->is_enabled()) {
176 float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1;
177 Shell::GetInstance()->partial_magnification_controller()->SetScale(scale);
178 } 170 }
179 } 171 }
180 172
181 display::Display::Rotation GetNextRotation(display::Display::Rotation current) { 173 display::Display::Rotation GetNextRotation(display::Display::Rotation current) {
182 switch (current) { 174 switch (current) {
183 case display::Display::ROTATE_0: 175 case display::Display::ROTATE_0:
184 return display::Display::ROTATE_90; 176 return display::Display::ROTATE_90;
185 case display::Display::ROTATE_90: 177 case display::Display::ROTATE_90:
186 return display::Display::ROTATE_180; 178 return display::Display::ROTATE_180;
187 case display::Display::ROTATE_180: 179 case display::Display::ROTATE_180:
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 message_center::NotifierId( 645 message_center::NotifierId(
654 message_center::NotifierId::SYSTEM_COMPONENT, 646 message_center::NotifierId::SYSTEM_COMPONENT,
655 system_notifier::kNotifierDeprecatedAccelerator), 647 system_notifier::kNotifierDeprecatedAccelerator),
656 message_center::RichNotificationData(), 648 message_center::RichNotificationData(),
657 new DeprecatedAcceleratorNotificationDelegate)); 649 new DeprecatedAcceleratorNotificationDelegate));
658 message_center::MessageCenter::Get()->AddNotification( 650 message_center::MessageCenter::Get()->AddNotification(
659 std::move(notification)); 651 std::move(notification));
660 } 652 }
661 653
662 } // namespace ash 654 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/ash.gyp » ('j') | ash/magnifier/partial_magnification_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698