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/screen_ash.h" |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
9 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
10 #include "ash/wm/workspace/phantom_window_controller.h" | 11 #include "ash/wm/workspace/phantom_window_controller.h" |
11 #include "ash/wm/workspace/snap_sizer.h" | 12 #include "ash/wm/workspace/snap_sizer.h" |
12 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.h" |
13 #include "ui/aura/event.h" | 14 #include "ui/aura/event.h" |
14 #include "ui/aura/event_filter.h" | 15 #include "ui/aura/event_filter.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return frame_->GetWidget()->IsMaximized() ? SNAP_NONE : SNAP_MAXIMIZE; | 273 return frame_->GetWidget()->IsMaximized() ? SNAP_NONE : SNAP_MAXIMIZE; |
273 } | 274 } |
274 | 275 |
275 gfx::Rect FrameMaximizeButton::BoundsForType(SnapType type) const { | 276 gfx::Rect FrameMaximizeButton::BoundsForType(SnapType type) const { |
276 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); | 277 aura::Window* window = frame_->GetWidget()->GetNativeWindow(); |
277 switch (type) { | 278 switch (type) { |
278 case SNAP_LEFT: | 279 case SNAP_LEFT: |
279 case SNAP_RIGHT: | 280 case SNAP_RIGHT: |
280 return snap_sizer_->target_bounds(); | 281 return snap_sizer_->target_bounds(); |
281 case SNAP_MAXIMIZE: | 282 case SNAP_MAXIMIZE: |
282 return gfx::Screen::GetMonitorWorkAreaNearestWindow(window); | 283 return ScreenAsh::GetMaximizedWindowBounds(window); |
283 case SNAP_MINIMIZE: { | 284 case SNAP_MINIMIZE: { |
284 Launcher* launcher = Shell::GetInstance()->launcher(); | 285 Launcher* launcher = Shell::GetInstance()->launcher(); |
285 gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow(window)); | 286 gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow(window)); |
286 if (!item_rect.IsEmpty()) { | 287 if (!item_rect.IsEmpty()) { |
287 // PhantomWindowController insets slightly, outset it so the phantom | 288 // PhantomWindowController insets slightly, outset it so the phantom |
288 // doesn't appear inset. | 289 // doesn't appear inset. |
289 item_rect.Inset(-8, -8); | 290 item_rect.Inset(-8, -8); |
290 return item_rect; | 291 return item_rect; |
291 } | 292 } |
292 return launcher->widget()->GetWindowScreenBounds(); | 293 return launcher->widget()->GetWindowScreenBounds(); |
(...skipping 28 matching lines...) Expand all Loading... |
321 break; | 322 break; |
322 case SNAP_MINIMIZE: | 323 case SNAP_MINIMIZE: |
323 frame_->GetWidget()->Minimize(); | 324 frame_->GetWidget()->Minimize(); |
324 break; | 325 break; |
325 default: | 326 default: |
326 NOTREACHED(); | 327 NOTREACHED(); |
327 } | 328 } |
328 } | 329 } |
329 | 330 |
330 } // namespace ash | 331 } // namespace ash |
OLD | NEW |