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

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

Issue 10832282: Replace views::MouseEvent with ui::MouseEvent (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
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/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) { 178 void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) {
179 maximizer_.reset(); 179 maximizer_.reset();
180 if (window_) { 180 if (window_) {
181 CHECK_EQ(window_, window); 181 CHECK_EQ(window_, window);
182 window_->RemoveObserver(this); 182 window_->RemoveObserver(this);
183 window_ = NULL; 183 window_ = NULL;
184 } 184 }
185 } 185 }
186 186
187 bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) { 187 bool FrameMaximizeButton::OnMousePressed(const ui::MouseEvent& event) {
188 is_snap_enabled_ = event.IsLeftMouseButton(); 188 is_snap_enabled_ = event.IsLeftMouseButton();
189 if (is_snap_enabled_) 189 if (is_snap_enabled_)
190 ProcessStartEvent(event); 190 ProcessStartEvent(event);
191 ImageButton::OnMousePressed(event); 191 ImageButton::OnMousePressed(event);
192 return true; 192 return true;
193 } 193 }
194 194
195 void FrameMaximizeButton::OnMouseEntered(const views::MouseEvent& event) { 195 void FrameMaximizeButton::OnMouseEntered(const ui::MouseEvent& event) {
196 ImageButton::OnMouseEntered(event); 196 ImageButton::OnMouseEntered(event);
197 if (!maximizer_.get()) { 197 if (!maximizer_.get()) {
198 DCHECK(GetWidget()); 198 DCHECK(GetWidget());
199 if (!window_) { 199 if (!window_) {
200 window_ = frame_->GetWidget()->GetNativeWindow(); 200 window_ = frame_->GetWidget()->GetNativeWindow();
201 window_->AddObserver(this); 201 window_->AddObserver(this);
202 } 202 }
203 maximizer_.reset(new MaximizeBubbleController( 203 maximizer_.reset(new MaximizeBubbleController(
204 this, 204 this,
205 frame_->GetWidget()->IsMaximized())); 205 frame_->GetWidget()->IsMaximized()));
206 } 206 }
207 } 207 }
208 208
209 void FrameMaximizeButton::OnMouseExited(const views::MouseEvent& event) { 209 void FrameMaximizeButton::OnMouseExited(const ui::MouseEvent& event) {
210 ImageButton::OnMouseExited(event); 210 ImageButton::OnMouseExited(event);
211 // Remove the bubble menu when the button is not pressed and the mouse is not 211 // Remove the bubble menu when the button is not pressed and the mouse is not
212 // within the bubble. 212 // within the bubble.
213 if (!is_snap_enabled_ && maximizer_.get()) { 213 if (!is_snap_enabled_ && maximizer_.get()) {
214 if (maximizer_->GetBubbleWindow()) { 214 if (maximizer_->GetBubbleWindow()) {
215 gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint(); 215 gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint();
216 if (!maximizer_->GetBubbleWindow()->GetBoundsInScreen().Contains( 216 if (!maximizer_->GetBubbleWindow()->GetBoundsInScreen().Contains(
217 screen_location)) { 217 screen_location)) {
218 maximizer_.reset(); 218 maximizer_.reset();
219 // Make sure that all remaining snap hover states get removed. 219 // Make sure that all remaining snap hover states get removed.
220 SnapButtonHovered(SNAP_NONE); 220 SnapButtonHovered(SNAP_NONE);
221 } 221 }
222 } else { 222 } else {
223 // The maximize dialog does not show up immediately after creating the 223 // The maximize dialog does not show up immediately after creating the
224 // |mazimizer_|. Destroy the dialog therefore before it shows up. 224 // |mazimizer_|. Destroy the dialog therefore before it shows up.
225 maximizer_.reset(); 225 maximizer_.reset();
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 bool FrameMaximizeButton::OnMouseDragged(const views::MouseEvent& event) { 230 bool FrameMaximizeButton::OnMouseDragged(const ui::MouseEvent& event) {
231 if (is_snap_enabled_) 231 if (is_snap_enabled_)
232 ProcessUpdateEvent(event); 232 ProcessUpdateEvent(event);
233 return ImageButton::OnMouseDragged(event); 233 return ImageButton::OnMouseDragged(event);
234 } 234 }
235 235
236 void FrameMaximizeButton::OnMouseReleased(const views::MouseEvent& event) { 236 void FrameMaximizeButton::OnMouseReleased(const ui::MouseEvent& event) {
237 maximizer_.reset(); 237 maximizer_.reset();
238 if (!ProcessEndEvent(event)) 238 if (!ProcessEndEvent(event))
239 ImageButton::OnMouseReleased(event); 239 ImageButton::OnMouseReleased(event);
240 // At this point |this| might be already destroyed. 240 // At this point |this| might be already destroyed.
241 } 241 }
242 242
243 void FrameMaximizeButton::OnMouseCaptureLost() { 243 void FrameMaximizeButton::OnMouseCaptureLost() {
244 Cancel(false); 244 Cancel(false);
245 ImageButton::OnMouseCaptureLost(); 245 ImageButton::OnMouseCaptureLost();
246 } 246 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 break; 490 break;
491 case SNAP_RESTORE: 491 case SNAP_RESTORE:
492 frame_->GetWidget()->Restore(); 492 frame_->GetWidget()->Restore();
493 break; 493 break;
494 case SNAP_NONE: 494 case SNAP_NONE:
495 NOTREACHED(); 495 NOTREACHED();
496 } 496 }
497 } 497 }
498 498
499 } // namespace ash 499 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/frame_maximize_button.h ('k') | ash/wm/workspace/multi_window_resize_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698