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

Side by Side Diff: ash/wm/workspace/frame_maximize_button.cc

Issue 11280283: Extract the code of showing a dragging window on another display from PhantomWindowController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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/wm/workspace/frame_maximize_button.h" 5 #include "ash/wm/workspace/frame_maximize_button.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/maximize_bubble_controller.h" 10 #include "ash/wm/maximize_bubble_controller.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location, 379 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location,
380 bool select_default, 380 bool select_default,
381 bool is_touch) { 381 bool is_touch) {
382 SnapType type = SnapTypeForLocation(location); 382 SnapType type = SnapTypeForLocation(location);
383 if (type == snap_type_) { 383 if (type == snap_type_) {
384 if (snap_sizer_.get()) { 384 if (snap_sizer_.get()) {
385 snap_sizer_->Update(LocationForSnapSizer(location)); 385 snap_sizer_->Update(LocationForSnapSizer(location));
386 phantom_window_->Show(ScreenAsh::ConvertRectToScreen( 386 phantom_window_->Show(ScreenAsh::ConvertRectToScreen(
387 frame_->GetWidget()->GetNativeView()->parent(), 387 frame_->GetWidget()->GetNativeView()->parent(),
388 snap_sizer_->target_bounds()), NULL); 388 snap_sizer_->target_bounds()));
389 } 389 }
390 return; 390 return;
391 } 391 }
392 392
393 snap_type_ = type; 393 snap_type_ = type;
394 snap_sizer_.reset(); 394 snap_sizer_.reset();
395 SchedulePaint(); 395 SchedulePaint();
396 396
397 if (snap_type_ == SNAP_NONE) { 397 if (snap_type_ == SNAP_NONE) {
398 phantom_window_.reset(); 398 phantom_window_.reset();
(...skipping 15 matching lines...) Expand all
414 } 414 }
415 if (!phantom_window_.get()) { 415 if (!phantom_window_.get()) {
416 phantom_window_.reset(new internal::PhantomWindowController( 416 phantom_window_.reset(new internal::PhantomWindowController(
417 frame_->GetWidget()->GetNativeWindow())); 417 frame_->GetWidget()->GetNativeWindow()));
418 } 418 }
419 if (maximizer_.get()) { 419 if (maximizer_.get()) {
420 phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow()); 420 phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow());
421 maximizer_->SetSnapType(snap_type_); 421 maximizer_->SetSnapType(snap_type_);
422 } 422 }
423 phantom_window_->Show( 423 phantom_window_->Show(
424 ScreenBoundsForType(snap_type_, *snap_sizer_.get()), NULL); 424 ScreenBoundsForType(snap_type_, *snap_sizer_.get()));
425 } 425 }
426 426
427 SnapType FrameMaximizeButton::SnapTypeForLocation( 427 SnapType FrameMaximizeButton::SnapTypeForLocation(
428 const gfx::Point& location) const { 428 const gfx::Point& location) const {
429 MaximizeBubbleFrameState maximize_type = GetMaximizeBubbleFrameState(); 429 MaximizeBubbleFrameState maximize_type = GetMaximizeBubbleFrameState();
430 gfx::Vector2d delta(location - press_location_); 430 gfx::Vector2d delta(location - press_location_);
431 if (!views::View::ExceededDragThreshold(delta)) 431 if (!views::View::ExceededDragThreshold(delta))
432 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE; 432 return maximize_type != FRAME_STATE_FULL ? SNAP_MAXIMIZE : SNAP_RESTORE;
433 if (delta.x() < 0 && delta.y() > delta.x() && delta.y() < -delta.x()) 433 if (delta.x() < 0 && delta.y() > delta.x() && delta.y() < -delta.x())
434 return maximize_type == FRAME_STATE_SNAP_LEFT ? SNAP_RESTORE : SNAP_LEFT; 434 return maximize_type == FRAME_STATE_SNAP_LEFT ? SNAP_RESTORE : SNAP_LEFT;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return FRAME_STATE_SNAP_LEFT; 554 return FRAME_STATE_SNAP_LEFT;
555 if (bounds.right() == screen.right()) 555 if (bounds.right() == screen.right())
556 return FRAME_STATE_SNAP_RIGHT; 556 return FRAME_STATE_SNAP_RIGHT;
557 // If we come here, it is likely caused by the fact that the 557 // If we come here, it is likely caused by the fact that the
558 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case 558 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case
559 // we allow all maximize operations (and keep the restore rectangle). 559 // we allow all maximize operations (and keep the restore rectangle).
560 return FRAME_STATE_NONE; 560 return FRAME_STATE_NONE;
561 } 561 }
562 562
563 } // namespace ash 563 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698