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/maximize_bubble_controller.h" | 10 #include "ash/wm/maximize_bubble_controller.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 case SNAP_LEFT: | 470 case SNAP_LEFT: |
471 case SNAP_RIGHT: | 471 case SNAP_RIGHT: |
472 return ScreenAsh::ConvertRectToScreen( | 472 return ScreenAsh::ConvertRectToScreen( |
473 frame_->GetWidget()->GetNativeView()->parent(), | 473 frame_->GetWidget()->GetNativeView()->parent(), |
474 snap_sizer.target_bounds()); | 474 snap_sizer.target_bounds()); |
475 case SNAP_MAXIMIZE: | 475 case SNAP_MAXIMIZE: |
476 return ScreenAsh::ConvertRectToScreen( | 476 return ScreenAsh::ConvertRectToScreen( |
477 window->parent(), | 477 window->parent(), |
478 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); | 478 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); |
479 case SNAP_MINIMIZE: { | 479 case SNAP_MINIMIZE: { |
480 Launcher* launcher = Shell::GetInstance()->launcher(); | 480 Launcher* launcher = Launcher::ForWindow(window); |
| 481 // Launcher is created lazily and can be NULL. |
| 482 if (!launcher) |
| 483 return gfx::Rect(); |
481 gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow( | 484 gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow( |
482 window)); | 485 window)); |
483 if (!item_rect.IsEmpty()) { | 486 if (!item_rect.IsEmpty()) { |
484 // PhantomWindowController insets slightly, outset it so the phantom | 487 // PhantomWindowController insets slightly, outset it so the phantom |
485 // doesn't appear inset. | 488 // doesn't appear inset. |
486 item_rect.Inset(-8, -8); | 489 item_rect.Inset(-8, -8); |
487 return item_rect; | 490 return item_rect; |
488 } | 491 } |
489 return launcher->widget()->GetWindowBoundsInScreen(); | 492 return launcher->widget()->GetWindowBoundsInScreen(); |
490 } | 493 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 return FRAME_STATE_SNAP_LEFT; | 577 return FRAME_STATE_SNAP_LEFT; |
575 if (bounds.right() == screen.right()) | 578 if (bounds.right() == screen.right()) |
576 return FRAME_STATE_SNAP_RIGHT; | 579 return FRAME_STATE_SNAP_RIGHT; |
577 // If we come here, it is likely caused by the fact that the | 580 // If we come here, it is likely caused by the fact that the |
578 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 581 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
579 // we allow all maximize operations (and keep the restore rectangle). | 582 // we allow all maximize operations (and keep the restore rectangle). |
580 return FRAME_STATE_NONE; | 583 return FRAME_STATE_NONE; |
581 } | 584 } |
582 | 585 |
583 } // namespace ash | 586 } // namespace ash |
OLD | NEW |