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

Side by Side Diff: ash/magnifier/magnification_controller.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | « ash/extended_desktop_unittest.cc ('k') | ash/magnifier/magnification_controller_unittest.cc » ('j') | 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/magnifier/magnification_controller.h" 5 #include "ash/magnifier/magnification_controller.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/root_window_transformers.h" 10 #include "ash/display/root_window_transformers.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 settings.SetPreemptionStrategy( 265 settings.SetPreemptionStrategy(
266 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 266 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
267 settings.SetTweenType(gfx::Tween::EASE_OUT); 267 settings.SetTweenType(gfx::Tween::EASE_OUT);
268 settings.SetTransitionDuration( 268 settings.SetTransitionDuration(
269 base::TimeDelta::FromMilliseconds(animate ? 100 : 0)); 269 base::TimeDelta::FromMilliseconds(animate ? 100 : 0));
270 270
271 gfx::Display display = 271 gfx::Display display =
272 Shell::GetScreen()->GetDisplayNearestWindow(root_window_); 272 Shell::GetScreen()->GetDisplayNearestWindow(root_window_);
273 scoped_ptr<aura::RootWindowTransformer> transformer( 273 scoped_ptr<aura::RootWindowTransformer> transformer(
274 internal::CreateRootWindowTransformerForDisplay(root_window_, display)); 274 internal::CreateRootWindowTransformerForDisplay(root_window_, display));
275 root_window_->GetDispatcher()->host()->SetRootWindowTransformer( 275 root_window_->GetHost()->SetRootWindowTransformer(transformer.Pass());
276 transformer.Pass());
277 276
278 if (animate) 277 if (animate)
279 is_on_animation_ = true; 278 is_on_animation_ = true;
280 279
281 return true; 280 return true;
282 } 281 }
283 282
284 void MagnificationControllerImpl::StartOrStopScrollIfNecessary() { 283 void MagnificationControllerImpl::StartOrStopScrollIfNecessary() {
285 // This value controls the scrolling speed. 284 // This value controls the scrolling speed.
286 const int kMoveOffset = 40; 285 const int kMoveOffset = 40;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 y = top + y_diff; 353 y = top + y_diff;
355 354
356 if (start_zoom && !is_on_animation_) { 355 if (start_zoom && !is_on_animation_) {
357 // No animation on panning. 356 // No animation on panning.
358 bool animate = false; 357 bool animate = false;
359 bool ret = RedrawDIP(gfx::Point(x, y), scale_, animate); 358 bool ret = RedrawDIP(gfx::Point(x, y), scale_, animate);
360 359
361 if (ret) { 360 if (ret) {
362 // If the magnified region is moved, hides the mouse cursor and moves it. 361 // If the magnified region is moved, hides the mouse cursor and moves it.
363 if (x_diff != 0 || y_diff != 0) 362 if (x_diff != 0 || y_diff != 0)
364 MoveCursorTo(root_window_->GetDispatcher()->host(), mouse); 363 MoveCursorTo(root_window_->GetHost(), mouse);
365 } 364 }
366 } 365 }
367 } 366 }
368 367
369 void MagnificationControllerImpl::AfterAnimationMoveCursorTo( 368 void MagnificationControllerImpl::AfterAnimationMoveCursorTo(
370 const gfx::Point& location) { 369 const gfx::Point& location) {
371 DCHECK(root_window_); 370 DCHECK(root_window_);
372 371
373 aura::client::CursorClient* cursor_client = 372 aura::client::CursorClient* cursor_client =
374 aura::client::GetCursorClient(root_window_); 373 aura::client::GetCursorClient(root_window_);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 *scale = kMaxMagnifiedScale; 410 *scale = kMaxMagnifiedScale;
412 411
413 DCHECK(kNonMagnifiedScale <= *scale && *scale <= kMaxMagnifiedScale); 412 DCHECK(kNonMagnifiedScale <= *scale && *scale <= kMaxMagnifiedScale);
414 } 413 }
415 414
416 void MagnificationControllerImpl::OnImplicitAnimationsCompleted() { 415 void MagnificationControllerImpl::OnImplicitAnimationsCompleted() {
417 if (!is_on_animation_) 416 if (!is_on_animation_)
418 return; 417 return;
419 418
420 if (move_cursor_after_animation_) { 419 if (move_cursor_after_animation_) {
421 MoveCursorTo(root_window_->GetDispatcher()->host(), 420 MoveCursorTo(root_window_->GetHost(), position_after_animation_);
422 position_after_animation_);
423 move_cursor_after_animation_ = false; 421 move_cursor_after_animation_ = false;
424 422
425 aura::client::CursorClient* cursor_client = 423 aura::client::CursorClient* cursor_client =
426 aura::client::GetCursorClient(root_window_); 424 aura::client::GetCursorClient(root_window_);
427 if (cursor_client) 425 if (cursor_client)
428 cursor_client->EnableMouseEvents(); 426 cursor_client->EnableMouseEvents();
429 } 427 }
430 428
431 is_on_animation_ = false; 429 is_on_animation_ = false;
432 430
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 596
599 //////////////////////////////////////////////////////////////////////////////// 597 ////////////////////////////////////////////////////////////////////////////////
600 // MagnificationController: 598 // MagnificationController:
601 599
602 // static 600 // static
603 MagnificationController* MagnificationController::CreateInstance() { 601 MagnificationController* MagnificationController::CreateInstance() {
604 return new MagnificationControllerImpl(); 602 return new MagnificationControllerImpl();
605 } 603 }
606 604
607 } // namespace ash 605 } // namespace ash
OLDNEW
« no previous file with comments | « ash/extended_desktop_unittest.cc ('k') | ash/magnifier/magnification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698