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

Unified Diff: ash/wm/caption_buttons/alternate_frame_size_button.cc

Issue 101773004: Refactor PhantomWindowController so that the PhantomWindowController owns the phantom window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/caption_buttons/alternate_frame_size_button.cc
diff --git a/ash/wm/caption_buttons/alternate_frame_size_button.cc b/ash/wm/caption_buttons/alternate_frame_size_button.cc
index 24f9a0ad90be5a162b2de09cc2aa520946e83956..044e7a3a69b5c9c10cee4036c823e6cb79e520a4 100644
--- a/ash/wm/caption_buttons/alternate_frame_size_button.cc
+++ b/ash/wm/caption_buttons/alternate_frame_size_button.cc
@@ -8,6 +8,7 @@
#include "ash/shell.h"
#include "ash/touch/touch_uma.h"
#include "ash/wm/window_state.h"
+#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "ui/gfx/vector2d.h"
#include "ui/views/widget/widget.h"
@@ -176,6 +177,24 @@ void AlternateFrameSizeButton::UpdatePressedButton(
break;
}
}
+
+ if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) {
+ if (!phantom_window_controller_.get()) {
+ phantom_window_controller_.reset(
+ new internal::PhantomWindowController(frame_->GetNativeWindow()));
+ }
+
+ using internal::SnapSizer;
+ SnapSizer snap_sizer(wm::GetWindowState(frame_->GetNativeWindow()),
+ gfx::Point(),
+ snap_type_ == SNAP_LEFT ?
+ SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE,
+ SnapSizer::OTHER_INPUT);
+ phantom_window_controller_->Show(snap_sizer.target_bounds());
+ } else {
+ if (phantom_window_controller_.get())
+ phantom_window_controller_->StartFadeOut();
+ }
}
bool AlternateFrameSizeButton::CommitSnap(const ui::LocatedEvent& event) {
@@ -206,6 +225,7 @@ void AlternateFrameSizeButton::SetButtonsToNormalMode(
snap_type_ = SNAP_NONE;
set_buttons_to_snap_mode_timer_.Stop();
delegate_->SetButtonsToNormal(animate);
+ phantom_window_controller_.reset();
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698