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/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
| 12 #include "ash/touch/touch_uma.h" | |
| 12 #include "ash/wm/maximize_bubble_controller.h" | 13 #include "ash/wm/maximize_bubble_controller.h" |
| 13 #include "ash/wm/property_util.h" | 14 #include "ash/wm/property_util.h" |
| 14 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
| 15 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 16 #include "ash/wm/workspace/phantom_window_controller.h" | 17 #include "ash/wm/workspace/phantom_window_controller.h" |
| 17 #include "ash/wm/workspace/snap_sizer.h" | 18 #include "ash/wm/workspace/snap_sizer.h" |
| 18 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 #include "ui/base/events/event.h" | 21 #include "ui/base/events/event.h" |
| 21 #include "ui/base/events/event_handler.h" | 22 #include "ui/base/events/event_handler.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 25 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
| 26 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 27 #include "ui/views/window/non_client_view.h" | 28 #include "ui/views/window/non_client_view.h" |
| 28 | 29 |
| 29 using ash::internal::SnapSizer; | 30 using ash::internal::SnapSizer; |
| 31 using ash::internal::TouchUMA; | |
| 30 | 32 |
| 31 namespace ash { | 33 namespace ash { |
| 32 | 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 // Delay before forcing an update of the snap location. | 37 // Delay before forcing an update of the snap location. |
| 36 const int kUpdateDelayMS = 400; | 38 const int kUpdateDelayMS = 400; |
| 37 | 39 |
| 38 // The delay of the bubble appearance. | 40 // The delay of the bubble appearance. |
| 39 const int kBubbleAppearanceDelayMS = 500; | 41 const int kBubbleAppearanceDelayMS = 500; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 return; | 274 return; |
| 273 } | 275 } |
| 274 | 276 |
| 275 if (event->type() == ui::ET_GESTURE_TAP || | 277 if (event->type() == ui::ET_GESTURE_TAP || |
| 276 (event->type() == ui::ET_GESTURE_SCROLL_END && is_snap_enabled_) || | 278 (event->type() == ui::ET_GESTURE_SCROLL_END && is_snap_enabled_) || |
| 277 event->type() == ui::ET_SCROLL_FLING_START) { | 279 event->type() == ui::ET_SCROLL_FLING_START) { |
| 278 // The position of the event may have changed from the previous event (both | 280 // The position of the event may have changed from the previous event (both |
| 279 // for TAP and SCROLL_END). So it is necessary to update the snap-state for | 281 // for TAP and SCROLL_END). So it is necessary to update the snap-state for |
| 280 // the current event. | 282 // the current event. |
| 281 ProcessUpdateEvent(*event); | 283 ProcessUpdateEvent(*event); |
| 282 if (event->type() == ui::ET_GESTURE_TAP) | 284 if (event->type() == ui::ET_GESTURE_TAP) { |
| 283 snap_type_ = SnapTypeForLocation(event->location()); | 285 snap_type_ = SnapTypeForLocation(event->location()); |
| 286 #if defined(USE_ASH) | |
|
sky
2013/06/26 23:42:55
This is in ash, you shouldn't need the ifdef.
tdanderson
2013/06/27 22:39:33
Done.
| |
| 287 TouchUMA::GetInstance()->RecordGestureAction( | |
| 288 TouchUMA::GESTURE_FRAMEMAXIMIZE_TAP); | |
| 289 #endif | |
| 290 } | |
| 284 ProcessEndEvent(*event); | 291 ProcessEndEvent(*event); |
| 285 event->SetHandled(); | 292 event->SetHandled(); |
| 286 return; | 293 return; |
| 287 } | 294 } |
| 288 | 295 |
| 289 if (is_snap_enabled_) { | 296 if (is_snap_enabled_) { |
| 290 if (event->type() == ui::ET_GESTURE_END && | 297 if (event->type() == ui::ET_GESTURE_END && |
| 291 event->details().touch_points() == 1) { | 298 event->details().touch_points() == 1) { |
| 292 // The position of the event may have changed from the previous event. So | 299 // The position of the event may have changed from the previous event. So |
| 293 // it is necessary to update the snap-state for the current event. | 300 // it is necessary to update the snap-state for the current event. |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 return FRAME_STATE_SNAP_LEFT; | 618 return FRAME_STATE_SNAP_LEFT; |
| 612 if (bounds.right() == screen.right()) | 619 if (bounds.right() == screen.right()) |
| 613 return FRAME_STATE_SNAP_RIGHT; | 620 return FRAME_STATE_SNAP_RIGHT; |
| 614 // If we come here, it is likely caused by the fact that the | 621 // If we come here, it is likely caused by the fact that the |
| 615 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 622 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
| 616 // we allow all maximize operations (and keep the restore rectangle). | 623 // we allow all maximize operations (and keep the restore rectangle). |
| 617 return FRAME_STATE_NONE; | 624 return FRAME_STATE_NONE; |
| 618 } | 625 } |
| 619 | 626 |
| 620 } // namespace ash | 627 } // namespace ash |
| OLD | NEW |