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

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

Issue 10854037: Multi-display support of some ash debugging commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 case Shell::BACKWARD: 149 case Shell::BACKWARD:
150 shell->focus_cycler()->RotateFocus(internal::FocusCycler::BACKWARD); 150 shell->focus_cycler()->RotateFocus(internal::FocusCycler::BACKWARD);
151 break; 151 break;
152 } 152 }
153 } 153 }
154 return true; 154 return true;
155 } 155 }
156 156
157 // Rotates the default window container. 157 // Rotates the default window container.
158 bool HandleRotateWindows() { 158 bool HandleRotateWindows() {
159 aura::Window* target = 159 Shell::RootWindowControllerList controllers =
160 Shell::GetPrimaryRootWindowController()->GetContainer( 160 Shell::GetAllRootWindowControllers();
161 internal::kShellWindowId_DefaultContainer); 161 for (size_t i = 0; i < controllers.size(); ++i) {
162 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( 162 aura::Window* target = controllers[i]->GetContainer(
163 new ui::LayerAnimationSequence(new ash::ScreenRotation(360))); 163 internal::kShellWindowId_DefaultContainer);
164 target->layer()->GetAnimator()->StartAnimation( 164 scoped_ptr<ui::LayerAnimationSequence> screen_rotation(
165 screen_rotation.release()); 165 new ui::LayerAnimationSequence(new ash::ScreenRotation(360)));
166 target->layer()->GetAnimator()->StartAnimation(
167 screen_rotation.release());
168 }
166 return true; 169 return true;
167 } 170 }
168 171
169 // Rotates the screen. 172 // Rotates the screen.
170 bool HandleRotateScreen() { 173 bool HandleRotateScreen() {
171 static int i = 0; 174 static int i = 0;
172 int delta = 0; 175 int delta = 0;
173 switch (i) { 176 switch (i) {
174 case 0: delta = 90; break; 177 case 0: delta = 90; break;
175 case 1: delta = 90; break; 178 case 1: delta = 90; break;
176 case 2: delta = 90; break; 179 case 2: delta = 90; break;
177 case 3: delta = 90; break; 180 case 3: delta = 90; break;
178 case 4: delta = -90; break; 181 case 4: delta = -90; break;
179 case 5: delta = -90; break; 182 case 5: delta = -90; break;
180 case 6: delta = -90; break; 183 case 6: delta = -90; break;
181 case 7: delta = -90; break; 184 case 7: delta = -90; break;
182 case 8: delta = -90; break; 185 case 8: delta = -90; break;
183 case 9: delta = 180; break; 186 case 9: delta = 180; break;
184 case 10: delta = 180; break; 187 case 10: delta = 180; break;
185 case 11: delta = 90; break; 188 case 11: delta = 90; break;
186 case 12: delta = 180; break; 189 case 12: delta = 180; break;
187 case 13: delta = 180; break; 190 case 13: delta = 180; break;
188 } 191 }
189 i = (i + 1) % 14; 192 i = (i + 1) % 14;
190 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 193 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
191 root_window->layer()->GetAnimator()-> 194 for (size_t i = 0; i < root_windows.size(); ++i) {
192 set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 195 aura::RootWindow* root_window = root_windows[i];
193 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( 196 root_window->layer()->GetAnimator()->
194 new ui::LayerAnimationSequence(new ash::ScreenRotation(delta))); 197 set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
195 screen_rotation->AddObserver(root_window); 198 scoped_ptr<ui::LayerAnimationSequence> screen_rotation(
196 root_window->layer()->GetAnimator()-> 199 new ui::LayerAnimationSequence(new ash::ScreenRotation(delta)));
197 StartAnimation(screen_rotation.release()); 200 screen_rotation->AddObserver(root_window);
201 root_window->layer()->GetAnimator()->
202 StartAnimation(screen_rotation.release());
203 }
198 return true; 204 return true;
199 } 205 }
200 206
201 bool HandleToggleDesktopBackgroundMode() { 207 bool HandleToggleDesktopBackgroundMode() {
202 DesktopBackgroundController* desktop_background_controller = 208 DesktopBackgroundController* desktop_background_controller =
203 Shell::GetInstance()->desktop_background_controller(); 209 Shell::GetInstance()->desktop_background_controller();
204 if (desktop_background_controller->desktop_background_mode() == 210 if (desktop_background_controller->desktop_background_mode() ==
205 DesktopBackgroundController::BACKGROUND_IMAGE) { 211 DesktopBackgroundController::BACKGROUND_IMAGE) {
206 desktop_background_controller->SetDesktopBackgroundSolidColorMode( 212 desktop_background_controller->SetDesktopBackgroundSolidColorMode(
207 SK_ColorBLACK); 213 SK_ColorBLACK);
(...skipping 22 matching lines...) Expand all
230 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); 236 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index));
231 237
232 ash::Shell::GetInstance()->magnification_controller()-> 238 ash::Shell::GetInstance()->magnification_controller()->
233 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); 239 SetScale(std::pow(kMagnificationFactor, new_scale_index), true);
234 240
235 return true; 241 return true;
236 } 242 }
237 243
238 #if !defined(NDEBUG) 244 #if !defined(NDEBUG)
239 bool HandlePrintLayerHierarchy() { 245 bool HandlePrintLayerHierarchy() {
240 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 246 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
241 ui::PrintLayerHierarchy(root_window->layer(), 247 for (size_t i = 0; i < root_windows.size(); ++i) {
242 root_window->GetLastMouseLocationInRoot()); 248 ui::PrintLayerHierarchy(root_windows[i]->layer(),
249 root_windows[i]->GetLastMouseLocationInRoot());
250 }
243 return true; 251 return true;
244 } 252 }
245 253
246 bool HandlePrintViewHierarchy() { 254 bool HandlePrintViewHierarchy() {
247 aura::Window* default_container = 255 aura::Window* default_container =
248 Shell::GetPrimaryRootWindowController()->GetContainer( 256 Shell::GetPrimaryRootWindowController()->GetContainer(
249 internal::kShellWindowId_DefaultContainer); 257 internal::kShellWindowId_DefaultContainer);
250 if (default_container->children().empty()) 258 if (default_container->children().empty())
251 return true; 259 return true;
252 aura::Window* browser_frame = default_container->children()[0]; 260 aura::Window* browser_frame = default_container->children()[0];
253 views::Widget* browser_widget = 261 views::Widget* browser_widget =
254 views::Widget::GetWidgetForNativeWindow(browser_frame); 262 views::Widget::GetWidgetForNativeWindow(browser_frame);
255 views::PrintViewHierarchy(browser_widget->GetRootView()); 263 views::PrintViewHierarchy(browser_widget->GetRootView());
256 return true; 264 return true;
257 } 265 }
258 266
259 void PrintWindowHierarchy(aura::Window* window, int indent) { 267 void PrintWindowHierarchy(aura::Window* window, int indent) {
260 std::string indent_str(indent, ' '); 268 std::string indent_str(indent, ' ');
261 DLOG(INFO) << indent_str << window->name() << " type " << window->type() 269 DLOG(INFO) << indent_str << window->name() << " type " << window->type()
262 << (wm::IsActiveWindow(window) ? "active" : ""); 270 << (wm::IsActiveWindow(window) ? "active" : "");
263 for (size_t i = 0; i < window->children().size(); ++i) 271 for (size_t i = 0; i < window->children().size(); ++i)
264 PrintWindowHierarchy(window->children()[i], indent + 3); 272 PrintWindowHierarchy(window->children()[i], indent + 3);
265 } 273 }
266 274
267 bool HandlePrintWindowHierarchy() { 275 bool HandlePrintWindowHierarchy() {
268 DLOG(INFO) << "Window hierarchy:"; 276 DLOG(INFO) << "Window hierarchy:";
269 aura::Window* container = 277 Shell::RootWindowControllerList controllers =
270 Shell::GetPrimaryRootWindowController()->GetContainer( 278 Shell::GetAllRootWindowControllers();
271 internal::kShellWindowId_DefaultContainer); 279 for (size_t i = 0; i < controllers.size(); ++i) {
272 PrintWindowHierarchy(container, 0); 280 DLOG(INFO) << "RootWindow " << i << ":";
281 aura::Window* container = controllers[i]->GetContainer(
282 internal::kShellWindowId_DefaultContainer);
283 PrintWindowHierarchy(container, 0);
284 }
273 return true; 285 return true;
274 } 286 }
275 287
276 #endif // !defined(NDEBUG) 288 #endif // !defined(NDEBUG)
277 289
278 } // namespace 290 } // namespace
279 291
280 //////////////////////////////////////////////////////////////////////////////// 292 ////////////////////////////////////////////////////////////////////////////////
281 // AcceleratorController, public: 293 // AcceleratorController, public:
282 294
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 accelerators_.insert( 758 accelerators_.insert(
747 std::make_pair(accelerator, accelerators[i].action)); 759 std::make_pair(accelerator, accelerators[i].action));
748 } 760 }
749 } 761 }
750 762
751 bool AcceleratorController::CanHandleAccelerators() const { 763 bool AcceleratorController::CanHandleAccelerators() const {
752 return true; 764 return true;
753 } 765 }
754 766
755 } // namespace ash 767 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698