Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "ash/wm/maximize_bubble_controller.h" | |
| 11 #include "ash/wm/workspace/phantom_window_controller.h" | 12 #include "ash/wm/workspace/phantom_window_controller.h" |
| 12 #include "ash/wm/workspace/snap_sizer.h" | 13 #include "ash/wm/workspace/snap_sizer.h" |
| 13 #include "grit/ash_strings.h" | 14 #include "grit/ash_strings.h" |
| 14 #include "grit/ui_resources.h" | 15 #include "grit/ui_resources.h" |
| 15 #include "ui/aura/event.h" | 16 #include "ui/aura/event.h" |
| 16 #include "ui/aura/event_filter.h" | 17 #include "ui/aura/event_filter.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 68 |
| 68 FrameMaximizeButton::EscapeEventFilter::~EscapeEventFilter() { | 69 FrameMaximizeButton::EscapeEventFilter::~EscapeEventFilter() { |
| 69 Shell::GetInstance()->RemoveEnvEventFilter(this); | 70 Shell::GetInstance()->RemoveEnvEventFilter(this); |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool FrameMaximizeButton::EscapeEventFilter::PreHandleKeyEvent( | 73 bool FrameMaximizeButton::EscapeEventFilter::PreHandleKeyEvent( |
| 73 aura::Window* target, | 74 aura::Window* target, |
| 74 aura::KeyEvent* event) { | 75 aura::KeyEvent* event) { |
| 75 if (event->type() == ui::ET_KEY_PRESSED && | 76 if (event->type() == ui::ET_KEY_PRESSED && |
| 76 event->key_code() == ui::VKEY_ESCAPE) { | 77 event->key_code() == ui::VKEY_ESCAPE) { |
| 77 button_->Cancel(); | 78 button_->Cancel(false); |
| 78 } | 79 } |
| 79 return false; | 80 return false; |
| 80 } | 81 } |
| 81 | 82 |
| 82 bool FrameMaximizeButton::EscapeEventFilter::PreHandleMouseEvent( | 83 bool FrameMaximizeButton::EscapeEventFilter::PreHandleMouseEvent( |
| 83 aura::Window* target, | 84 aura::Window* target, |
| 84 aura::MouseEvent* event) { | 85 aura::MouseEvent* event) { |
| 85 return false; | 86 return false; |
| 86 } | 87 } |
| 87 | 88 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 98 } | 99 } |
| 99 | 100 |
| 100 // FrameMaximizeButton --------------------------------------------------------- | 101 // FrameMaximizeButton --------------------------------------------------------- |
| 101 | 102 |
| 102 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, | 103 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, |
| 103 views::NonClientFrameView* frame) | 104 views::NonClientFrameView* frame) |
| 104 : ImageButton(listener), | 105 : ImageButton(listener), |
| 105 frame_(frame), | 106 frame_(frame), |
| 106 is_snap_enabled_(false), | 107 is_snap_enabled_(false), |
| 107 exceeded_drag_threshold_(false), | 108 exceeded_drag_threshold_(false), |
| 109 window_(NULL), | |
| 108 snap_type_(SNAP_NONE) { | 110 snap_type_(SNAP_NONE) { |
| 109 // TODO(sky): nuke this. It's temporary while we don't have good images. | 111 // TODO(sky): nuke this. It's temporary while we don't have good images. |
| 110 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); | 112 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); |
| 111 SetTooltipText(l10n_util::GetStringUTF16(IDS_FRAME_MAXIMIZE_BUTTON_TOOLTIP)); | |
| 112 } | 113 } |
| 113 | 114 |
| 114 FrameMaximizeButton::~FrameMaximizeButton() { | 115 FrameMaximizeButton::~FrameMaximizeButton() { |
| 116 if (window_) | |
| 117 OnWindowDestroying(window_); | |
| 118 } | |
| 119 | |
| 120 void FrameMaximizeButton::SnapButtonHovered(SnapType type) { | |
| 121 // Make sure to only show hover operations when no button is pressed and | |
| 122 // a similar snap operation in progress does not get re-applied. | |
| 123 if (is_snap_enabled_ || (type == snap_type_ && snap_sizer_.get())) | |
| 124 return; | |
| 125 // Prime the mouse location with the center of the (local) button. | |
| 126 press_location_ = gfx::Point(width() / 2, height() / 2); | |
| 127 // Then get an adjusted mouse position to initiate the effect. | |
| 128 gfx::Point location = press_location_; | |
| 129 switch (type) { | |
| 130 case SNAP_LEFT: | |
| 131 location.set_x(location.x() - width()); | |
| 132 break; | |
| 133 case SNAP_RIGHT: | |
| 134 location.set_x(location.x() + width()); | |
| 135 break; | |
| 136 case SNAP_MINIMIZE: | |
| 137 location.set_y(location.y() + height()); | |
| 138 break; | |
| 139 case SNAP_MAXIMIZE: | |
| 140 case SNAP_RESTORE: | |
| 141 break; | |
| 142 case SNAP_NONE: | |
| 143 Cancel(true); | |
| 144 return; | |
| 145 default: | |
| 146 // We should not come here. | |
| 147 NOTREACHED(); | |
| 148 } | |
| 149 UpdateSnap(location); | |
| 150 } | |
| 151 | |
| 152 void FrameMaximizeButton::ExecuteSnapAndCloseMenu(SnapType snap_type) { | |
| 153 DCHECK_NE(snap_type_, SNAP_NONE); | |
| 154 snap_type_ = snap_type; | |
| 155 Snap(); | |
| 156 // Remove any pending snap previews. | |
| 157 SnapButtonHovered(SNAP_NONE); | |
| 158 // At this point the operation has been performed and the menu should be | |
| 159 // closed - if not, it'll get now closed. | |
| 160 maximizer_.reset(); | |
| 161 } | |
| 162 | |
| 163 void FrameMaximizeButton::DestroyMaximizeMenu() { | |
| 164 maximizer_.reset(); | |
| 165 } | |
| 166 | |
| 167 void FrameMaximizeButton::OnWindowBoundsChanged( | |
| 168 aura::Window* window, | |
| 169 const gfx::Rect& old_bounds, | |
| 170 const gfx::Rect& new_bounds) { | |
| 171 Cancel(false); | |
| 172 } | |
| 173 | |
| 174 void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) { | |
| 175 maximizer_.reset(); | |
| 176 if (window_) { | |
| 177 CHECK_EQ(window_, window); | |
| 178 window_->RemoveObserver(this); | |
| 179 window_ = NULL; | |
| 180 } | |
| 115 } | 181 } |
| 116 | 182 |
| 117 bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) { | 183 bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) { |
| 118 is_snap_enabled_ = event.IsLeftMouseButton(); | 184 is_snap_enabled_ = event.IsLeftMouseButton(); |
| 119 if (is_snap_enabled_) | 185 if (is_snap_enabled_) |
| 120 ProcessStartEvent(event); | 186 ProcessStartEvent(event); |
| 121 ImageButton::OnMousePressed(event); | 187 ImageButton::OnMousePressed(event); |
| 122 return true; | 188 return true; |
| 123 } | 189 } |
| 124 | 190 |
| 125 void FrameMaximizeButton::OnMouseEntered(const views::MouseEvent& event) { | 191 void FrameMaximizeButton::OnMouseEntered(const views::MouseEvent& event) { |
| 126 ImageButton::OnMouseEntered(event); | 192 ImageButton::OnMouseEntered(event); |
| 193 if (!maximizer_.get()) { | |
| 194 DCHECK(GetWidget()); | |
| 195 if (!window_) { | |
| 196 window_ = frame_->GetWidget()->GetNativeWindow(); | |
| 197 window_->AddObserver(this); | |
| 198 } | |
| 199 maximizer_.reset(new MaximizeBubbleController( | |
| 200 this, | |
| 201 frame_->GetWidget()->IsMaximized())); | |
| 202 } | |
| 127 } | 203 } |
| 128 | 204 |
| 129 void FrameMaximizeButton::OnMouseExited(const views::MouseEvent& event) { | 205 void FrameMaximizeButton::OnMouseExited(const views::MouseEvent& event) { |
| 130 ImageButton::OnMouseExited(event); | 206 ImageButton::OnMouseExited(event); |
| 207 // Remove the bubble menu when the button is not pressed and the mouse is not | |
| 208 // within the bubble. | |
| 209 if (!is_snap_enabled_ && maximizer_.get() && maximizer_->GetBubbleWindow()) { | |
| 210 gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint(); | |
| 211 if (!maximizer_->GetBubbleWindow()->GetBoundsInScreen().Contains( | |
| 212 screen_location)) { | |
| 213 maximizer_.reset(); | |
| 214 // Make sure that all remaining snap hover states get removed. | |
| 215 SnapButtonHovered(SNAP_NONE); | |
| 216 } | |
| 217 } | |
| 131 } | 218 } |
| 132 | 219 |
| 133 bool FrameMaximizeButton::OnMouseDragged(const views::MouseEvent& event) { | 220 bool FrameMaximizeButton::OnMouseDragged(const views::MouseEvent& event) { |
| 134 if (is_snap_enabled_) | 221 if (is_snap_enabled_) |
| 135 ProcessUpdateEvent(event); | 222 ProcessUpdateEvent(event); |
| 136 return ImageButton::OnMouseDragged(event); | 223 return ImageButton::OnMouseDragged(event); |
| 137 } | 224 } |
| 138 | 225 |
| 139 void FrameMaximizeButton::OnMouseReleased(const views::MouseEvent& event) { | 226 void FrameMaximizeButton::OnMouseReleased(const views::MouseEvent& event) { |
| 227 maximizer_.reset(); | |
| 140 if (!ProcessEndEvent(event)) | 228 if (!ProcessEndEvent(event)) |
| 141 ImageButton::OnMouseReleased(event); | 229 ImageButton::OnMouseReleased(event); |
| 230 // At this point |this| might be already destroyed. | |
| 142 } | 231 } |
| 143 | 232 |
| 144 void FrameMaximizeButton::OnMouseCaptureLost() { | 233 void FrameMaximizeButton::OnMouseCaptureLost() { |
| 145 Cancel(); | 234 Cancel(false); |
| 146 ImageButton::OnMouseCaptureLost(); | 235 ImageButton::OnMouseCaptureLost(); |
| 147 } | 236 } |
| 148 | 237 |
| 149 ui::GestureStatus FrameMaximizeButton::OnGestureEvent( | 238 ui::GestureStatus FrameMaximizeButton::OnGestureEvent( |
| 150 const views::GestureEvent& event) { | 239 const views::GestureEvent& event) { |
| 151 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { | 240 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { |
| 152 is_snap_enabled_ = true; | 241 is_snap_enabled_ = true; |
| 153 ProcessStartEvent(event); | 242 ProcessStartEvent(event); |
| 154 return ui::GESTURE_STATUS_CONSUMED; | 243 return ui::GESTURE_STATUS_CONSUMED; |
| 155 } | 244 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 173 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || | 262 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || |
| 174 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 263 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 175 ProcessUpdateEvent(event); | 264 ProcessUpdateEvent(event); |
| 176 return ui::GESTURE_STATUS_CONSUMED; | 265 return ui::GESTURE_STATUS_CONSUMED; |
| 177 } | 266 } |
| 178 } | 267 } |
| 179 | 268 |
| 180 return ImageButton::OnGestureEvent(event); | 269 return ImageButton::OnGestureEvent(event); |
| 181 } | 270 } |
| 182 | 271 |
| 183 gfx::ImageSkia FrameMaximizeButton::GetImageToPaint() { | |
| 184 if (is_snap_enabled_) { | |
| 185 int id = 0; | |
| 186 if (frame_->GetWidget()->IsMaximized()) { | |
| 187 switch (snap_type_) { | |
| 188 case SNAP_LEFT: | |
| 189 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P; | |
| 190 break; | |
| 191 case SNAP_RIGHT: | |
| 192 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P; | |
| 193 break; | |
| 194 case SNAP_MAXIMIZE: | |
| 195 case SNAP_RESTORE: | |
| 196 case SNAP_NONE: | |
| 197 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_P; | |
| 198 break; | |
| 199 case SNAP_MINIMIZE: | |
| 200 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_MINIMIZE_P; | |
| 201 break; | |
| 202 default: | |
| 203 NOTREACHED(); | |
| 204 } | |
| 205 } else { | |
| 206 switch (snap_type_) { | |
| 207 case SNAP_LEFT: | |
| 208 id = IDR_AURA_WINDOW_SNAP_LEFT_P; | |
| 209 break; | |
| 210 case SNAP_RIGHT: | |
| 211 id = IDR_AURA_WINDOW_SNAP_RIGHT_P; | |
| 212 break; | |
| 213 case SNAP_MAXIMIZE: | |
| 214 case SNAP_RESTORE: | |
| 215 case SNAP_NONE: | |
| 216 id = IDR_AURA_WINDOW_SNAP_P; | |
| 217 break; | |
| 218 case SNAP_MINIMIZE: | |
| 219 id = IDR_AURA_WINDOW_SNAP_MINIMIZE_P; | |
| 220 break; | |
| 221 default: | |
| 222 NOTREACHED(); | |
| 223 } | |
| 224 } | |
| 225 return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); | |
| 226 } | |
| 227 // Hot and pressed states handled by regular ImageButton. | |
| 228 return ImageButton::GetImageToPaint(); | |
| 229 } | |
| 230 | |
| 231 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { | 272 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { |
| 232 DCHECK(is_snap_enabled_); | 273 DCHECK(is_snap_enabled_); |
| 274 // Prepare the help menu. | |
| 275 if (!maximizer_.get()) { | |
| 276 maximizer_.reset(new MaximizeBubbleController( | |
| 277 this, | |
| 278 frame_->GetWidget()->IsMaximized())); | |
| 279 } else { | |
| 280 // If the menu did not show up yet, we delay it even a bit more. | |
| 281 maximizer_->DelayCreation(); | |
| 282 } | |
| 233 snap_sizer_.reset(NULL); | 283 snap_sizer_.reset(NULL); |
| 234 InstallEventFilter(); | 284 InstallEventFilter(); |
| 235 snap_type_ = SNAP_NONE; | 285 snap_type_ = SNAP_NONE; |
| 236 press_location_ = event.location(); | 286 press_location_ = event.location(); |
| 237 exceeded_drag_threshold_ = false; | 287 exceeded_drag_threshold_ = false; |
| 238 update_timer_.Start( | 288 update_timer_.Start( |
| 239 FROM_HERE, | 289 FROM_HERE, |
| 240 base::TimeDelta::FromMilliseconds(kUpdateDelayMS), | 290 base::TimeDelta::FromMilliseconds(kUpdateDelayMS), |
| 241 this, | 291 this, |
| 242 &FrameMaximizeButton::UpdateSnapFromEventLocation); | 292 &FrameMaximizeButton::UpdateSnapFromEventLocation); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 253 if (exceeded_drag_threshold_) | 303 if (exceeded_drag_threshold_) |
| 254 UpdateSnap(event.location()); | 304 UpdateSnap(event.location()); |
| 255 } | 305 } |
| 256 | 306 |
| 257 bool FrameMaximizeButton::ProcessEndEvent(const views::LocatedEvent& event) { | 307 bool FrameMaximizeButton::ProcessEndEvent(const views::LocatedEvent& event) { |
| 258 update_timer_.Stop(); | 308 update_timer_.Stop(); |
| 259 UninstallEventFilter(); | 309 UninstallEventFilter(); |
| 260 bool should_snap = is_snap_enabled_; | 310 bool should_snap = is_snap_enabled_; |
| 261 is_snap_enabled_ = false; | 311 is_snap_enabled_ = false; |
| 262 | 312 |
| 313 // Remove our help bubble. | |
| 314 maximizer_.reset(); | |
| 315 | |
| 263 if (!should_snap || snap_type_ == SNAP_NONE) | 316 if (!should_snap || snap_type_ == SNAP_NONE) |
| 264 return false; | 317 return false; |
| 265 | 318 |
| 266 SetState(BS_NORMAL); | 319 SetState(BS_NORMAL); |
| 267 // SetState will not call SchedulePaint() if state was already set to | 320 // SetState will not call SchedulePaint() if state was already set to |
| 268 // BS_NORMAL during a drag. | 321 // BS_NORMAL during a drag. |
| 269 SchedulePaint(); | 322 SchedulePaint(); |
| 270 phantom_window_.reset(); | 323 phantom_window_.reset(); |
| 271 Snap(); | 324 Snap(); |
| 272 return true; | 325 return true; |
| 273 } | 326 } |
| 274 | 327 |
| 275 void FrameMaximizeButton::Cancel() { | 328 void FrameMaximizeButton::Cancel(bool keep_menu_open) { |
| 276 UninstallEventFilter(); | 329 if (!keep_menu_open) { |
| 277 is_snap_enabled_ = false; | 330 maximizer_.reset(); |
| 331 UninstallEventFilter(); | |
| 332 is_snap_enabled_ = false; | |
| 333 } | |
| 278 phantom_window_.reset(); | 334 phantom_window_.reset(); |
| 279 snap_sizer_.reset(); | 335 snap_sizer_.reset(); |
| 336 snap_type_ = SNAP_NONE; | |
| 280 update_timer_.Stop(); | 337 update_timer_.Stop(); |
| 281 SchedulePaint(); | 338 SchedulePaint(); |
| 282 } | 339 } |
| 283 | 340 |
| 284 void FrameMaximizeButton::InstallEventFilter() { | 341 void FrameMaximizeButton::InstallEventFilter() { |
| 285 if (escape_event_filter_.get()) | 342 if (escape_event_filter_.get()) |
| 286 return; | 343 return; |
| 287 | 344 |
| 288 escape_event_filter_.reset(new EscapeEventFilter(this)); | 345 escape_event_filter_.reset(new EscapeEventFilter(this)); |
| 289 } | 346 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; | 383 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
| 327 int grid_size = Shell::GetInstance()->GetGridSize(); | 384 int grid_size = Shell::GetInstance()->GetGridSize(); |
| 328 snap_sizer_.reset(new SnapSizer(frame_->GetWidget()->GetNativeWindow(), | 385 snap_sizer_.reset(new SnapSizer(frame_->GetWidget()->GetNativeWindow(), |
| 329 LocationForSnapSizer(location), | 386 LocationForSnapSizer(location), |
| 330 snap_edge, grid_size)); | 387 snap_edge, grid_size)); |
| 331 } | 388 } |
| 332 if (!phantom_window_.get()) { | 389 if (!phantom_window_.get()) { |
| 333 phantom_window_.reset(new internal::PhantomWindowController( | 390 phantom_window_.reset(new internal::PhantomWindowController( |
| 334 frame_->GetWidget()->GetNativeWindow())); | 391 frame_->GetWidget()->GetNativeWindow())); |
| 335 } | 392 } |
| 393 if (maximizer_.get()) { | |
| 394 phantom_window_->set_phantom_below_window(maximizer_->GetBubbleWindow()); | |
| 395 maximizer_->SetSnapType(snap_type_); | |
| 396 } | |
| 336 phantom_window_->Show(ScreenBoundsForType(snap_type_)); | 397 phantom_window_->Show(ScreenBoundsForType(snap_type_)); |
| 337 } | 398 } |
| 338 | 399 |
| 339 FrameMaximizeButton::SnapType FrameMaximizeButton::SnapTypeForLocation( | 400 SnapType FrameMaximizeButton::SnapTypeForLocation( |
| 340 const gfx::Point& location) const { | 401 const gfx::Point& location) const { |
| 341 int delta_x = location.x() - press_location_.x(); | 402 int delta_x = location.x() - press_location_.x(); |
| 342 int delta_y = location.y() - press_location_.y(); | 403 int delta_y = location.y() - press_location_.y(); |
| 343 if (!views::View::ExceededDragThreshold(delta_x, delta_y)) | 404 if (!views::View::ExceededDragThreshold(delta_x, delta_y)) |
| 344 return !frame_->GetWidget()->IsMaximized() ? SNAP_MAXIMIZE : SNAP_RESTORE; | 405 return !frame_->GetWidget()->IsMaximized() ? SNAP_MAXIMIZE : SNAP_RESTORE; |
| 345 else if (delta_x < 0 && delta_y > delta_x && delta_y < -delta_x) | 406 else if (delta_x < 0 && delta_y > delta_x && delta_y < -delta_x) |
| 346 return SNAP_LEFT; | 407 return SNAP_LEFT; |
| 347 else if (delta_x > 0 && delta_y > -delta_x && delta_y < delta_x) | 408 else if (delta_x > 0 && delta_y > -delta_x && delta_y < delta_x) |
| 348 return SNAP_RIGHT; | 409 return SNAP_RIGHT; |
| 349 else if (delta_y > 0) | 410 else if (delta_y > 0) |
| 350 return SNAP_MINIMIZE; | 411 return SNAP_MINIMIZE; |
| 351 return !frame_->GetWidget()->IsMaximized() ? SNAP_MAXIMIZE : SNAP_RESTORE; | 412 return !frame_->GetWidget()->IsMaximized() ? SNAP_MAXIMIZE : SNAP_RESTORE; |
| 352 } | 413 } |
| 353 | 414 |
| 354 gfx::Rect FrameMaximizeButton::ScreenBoundsForType(SnapType type) const { | 415 gfx::Rect FrameMaximizeButton::ScreenBoundsForType( |
| 416 SnapType type) const { | |
|
msw
2012/08/04 01:21:30
nit: fits on line above.
Mr4D (OOO till 08-26)
2012/08/04 02:56:22
Done.
| |
| 355 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); | 417 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); |
| 356 switch (type) { | 418 switch (type) { |
| 357 case SNAP_LEFT: | 419 case SNAP_LEFT: |
| 358 case SNAP_RIGHT: | 420 case SNAP_RIGHT: |
| 359 return ScreenAsh::ConvertRectToScreen( | 421 return ScreenAsh::ConvertRectToScreen( |
| 360 frame_->GetWidget()->GetNativeView()->parent(), | 422 frame_->GetWidget()->GetNativeView()->parent(), |
| 361 snap_sizer_->target_bounds()); | 423 snap_sizer_->target_bounds()); |
| 362 case SNAP_MAXIMIZE: | 424 case SNAP_MAXIMIZE: |
| 363 return ScreenAsh::ConvertRectToScreen( | 425 return ScreenAsh::ConvertRectToScreen( |
| 364 window->parent(), | 426 window->parent(), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 break; | 474 break; |
| 413 case SNAP_RESTORE: | 475 case SNAP_RESTORE: |
| 414 frame_->GetWidget()->Restore(); | 476 frame_->GetWidget()->Restore(); |
| 415 break; | 477 break; |
| 416 case SNAP_NONE: | 478 case SNAP_NONE: |
| 417 NOTREACHED(); | 479 NOTREACHED(); |
| 418 } | 480 } |
| 419 } | 481 } |
| 420 | 482 |
| 421 } // namespace ash | 483 } // namespace ash |
| OLD | NEW |