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

Side by Side Diff: ash/frame/caption_buttons/alternate_frame_size_button.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame/caption_buttons/alternate_frame_size_button.h" 5 #include "ash/frame/caption_buttons/alternate_frame_size_button.h"
6 6
7 #include "ash/metrics/user_metrics_recorder.h" 7 #include "ash/metrics/user_metrics_recorder.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/touch/touch_uma.h" 10 #include "ash/touch/touch_uma.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 event->SetHandled(); 130 event->SetHandled();
131 return; 131 return;
132 } 132 }
133 } 133 }
134 134
135 FrameCaptionButton::OnGestureEvent(event); 135 FrameCaptionButton::OnGestureEvent(event);
136 } 136 }
137 137
138 void AlternateFrameSizeButton::StartSetButtonsToSnapModeTimer( 138 void AlternateFrameSizeButton::StartSetButtonsToSnapModeTimer(
139 const ui::LocatedEvent& event) { 139 const ui::LocatedEvent& event) {
140 set_buttons_to_snap_mode_timer_event_location_ = event.location(); 140 set_buttons_to_snap_mode_timer_event_location_ =
141 gfx::ToFlooredPoint(event.location());
141 if (set_buttons_to_snap_mode_delay_ms_ == 0) { 142 if (set_buttons_to_snap_mode_delay_ms_ == 0) {
142 AnimateButtonsToSnapMode(); 143 AnimateButtonsToSnapMode();
143 } else { 144 } else {
144 set_buttons_to_snap_mode_timer_.Start( 145 set_buttons_to_snap_mode_timer_.Start(
145 FROM_HERE, 146 FROM_HERE,
146 base::TimeDelta::FromMilliseconds(set_buttons_to_snap_mode_delay_ms_), 147 base::TimeDelta::FromMilliseconds(set_buttons_to_snap_mode_delay_ms_),
147 this, 148 this,
148 &AlternateFrameSizeButton::AnimateButtonsToSnapMode); 149 &AlternateFrameSizeButton::AnimateButtonsToSnapMode);
149 } 150 }
150 } 151 }
(...skipping 19 matching lines...) Expand all
170 } 171 }
171 } 172 }
172 173
173 void AlternateFrameSizeButton::UpdateSnapType(const ui::LocatedEvent& event) { 174 void AlternateFrameSizeButton::UpdateSnapType(const ui::LocatedEvent& event) {
174 if (!in_snap_mode_) { 175 if (!in_snap_mode_) {
175 // Set the buttons adjacent to the size button to snap left and right early 176 // Set the buttons adjacent to the size button to snap left and right early
176 // if the user drags past the drag threshold. 177 // if the user drags past the drag threshold.
177 // |set_buttons_to_snap_mode_timer_| is checked to avoid entering the snap 178 // |set_buttons_to_snap_mode_timer_| is checked to avoid entering the snap
178 // mode as a result of an unsupported drag type (e.g. only the right mouse 179 // mode as a result of an unsupported drag type (e.g. only the right mouse
179 // button is pressed). 180 // button is pressed).
180 gfx::Vector2d delta( 181 gfx::Vector2d delta(gfx::ToFlooredPoint(event.location()) -
181 event.location() - set_buttons_to_snap_mode_timer_event_location_); 182 set_buttons_to_snap_mode_timer_event_location_);
182 if (!set_buttons_to_snap_mode_timer_.IsRunning() || 183 if (!set_buttons_to_snap_mode_timer_.IsRunning() ||
183 !views::View::ExceededDragThreshold(delta)) { 184 !views::View::ExceededDragThreshold(delta)) {
184 return; 185 return;
185 } 186 }
186 AnimateButtonsToSnapMode(); 187 AnimateButtonsToSnapMode();
187 } 188 }
188 189
189 gfx::Point event_location_in_screen(event.location()); 190 gfx::Point event_location_in_screen(gfx::ToFlooredPoint(event.location()));
190 views::View::ConvertPointToScreen(this, &event_location_in_screen); 191 views::View::ConvertPointToScreen(this, &event_location_in_screen);
191 const FrameCaptionButton* to_hover = 192 const FrameCaptionButton* to_hover =
192 GetButtonToHover(event_location_in_screen); 193 GetButtonToHover(event_location_in_screen);
193 bool press_size_button = 194 bool press_size_button =
194 to_hover || HitTestButton(this, event_location_in_screen); 195 to_hover || HitTestButton(this, event_location_in_screen);
195 196
196 if (to_hover) { 197 if (to_hover) {
197 // Progress the minimize and close icon morph animations to the end if they 198 // Progress the minimize and close icon morph animations to the end if they
198 // are in progress. 199 // are in progress.
199 SetButtonsToSnapMode(AlternateFrameSizeButtonDelegate::ANIMATE_NO); 200 SetButtonsToSnapMode(AlternateFrameSizeButtonDelegate::ANIMATE_NO);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 void AlternateFrameSizeButton::SetButtonsToNormalMode( 276 void AlternateFrameSizeButton::SetButtonsToNormalMode(
276 AlternateFrameSizeButtonDelegate::Animate animate) { 277 AlternateFrameSizeButtonDelegate::Animate animate) {
277 in_snap_mode_ = false; 278 in_snap_mode_ = false;
278 snap_type_ = SNAP_NONE; 279 snap_type_ = SNAP_NONE;
279 set_buttons_to_snap_mode_timer_.Stop(); 280 set_buttons_to_snap_mode_timer_.Stop();
280 delegate_->SetButtonsToNormal(animate); 281 delegate_->SetButtonsToNormal(animate);
281 phantom_window_controller_.reset(); 282 phantom_window_controller_.reset();
282 } 283 }
283 284
284 } // namespace ash 285 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698