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

Side by Side Diff: ui/app_list/views/app_list_view.cc

Issue 2950913002: Added new features tests to AppListPresenterDelegateUnittests. (Closed)
Patch Set: Added new feature tests to AppListPresenterDelegateUnittests. Added early test returns for Config::… Created 3 years, 6 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
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 "ui/app_list/views/app_list_view.h" 5 #include "ui/app_list/views/app_list_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 fullscreen_widget_->SetBounds(new_widget_bounds); 515 fullscreen_widget_->SetBounds(new_widget_bounds);
516 } 516 }
517 517
518 void AppListView::EndDrag(const gfx::Point& location) { 518 void AppListView::EndDrag(const gfx::Point& location) {
519 // Change the app list state based on where the drag ended. If fling velocity 519 // Change the app list state based on where the drag ended. If fling velocity
520 // was over the threshold, snap to the next state in the direction of the 520 // was over the threshold, snap to the next state in the direction of the
521 // fling. 521 // fling.
522 int const new_y_position = location.y() - initial_drag_point_.y() + 522 int const new_y_position = location.y() - initial_drag_point_.y() +
523 fullscreen_widget_->GetWindowBoundsInScreen().y(); 523 fullscreen_widget_->GetWindowBoundsInScreen().y();
524 if (std::abs(last_fling_velocity_) > kAppListDragVelocityThreshold) { 524 if (std::abs(last_fling_velocity_) >= kAppListDragVelocityThreshold) {
525 // If the user releases drag with velocity over the threshold, snap to 525 // If the user releases drag with velocity over the threshold, snap to
526 // the next state, ignoring the drag release position. 526 // the next state, ignoring the drag release position.
527 527
528 if (last_fling_velocity_ > 0) { 528 if (last_fling_velocity_ > 0) {
529 switch (app_list_state_) { 529 switch (app_list_state_) {
530 case PEEKING: 530 case PEEKING:
531 case HALF: 531 case HALF:
532 case FULLSCREEN_SEARCH: 532 case FULLSCREEN_SEARCH:
533 SetState(CLOSED); 533 SetState(CLOSED);
534 break; 534 break;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 default: 717 default:
718 break; 718 break;
719 } 719 }
720 } 720 }
721 721
722 void AppListView::OnGestureEvent(ui::GestureEvent* event) { 722 void AppListView::OnGestureEvent(ui::GestureEvent* event) {
723 if (!is_fullscreen_app_list_enabled_) 723 if (!is_fullscreen_app_list_enabled_)
724 return; 724 return;
725 725
726 switch (event->type()) { 726 switch (event->type()) {
727 case ui::ET_SCROLL_FLING_START:
727 case ui::ET_GESTURE_SCROLL_BEGIN: 728 case ui::ET_GESTURE_SCROLL_BEGIN:
728 StartDrag(event->location()); 729 StartDrag(event->location());
729 event->SetHandled(); 730 event->SetHandled();
730 break; 731 break;
731 case ui::ET_GESTURE_SCROLL_UPDATE: 732 case ui::ET_GESTURE_SCROLL_UPDATE:
732 last_fling_velocity_ = event->details().velocity_y(); 733 last_fling_velocity_ = event->details().scroll_y();
733 UpdateDrag(event->location()); 734 UpdateDrag(event->location());
734 event->SetHandled(); 735 event->SetHandled();
735 break; 736 break;
736 case ui::ET_GESTURE_END: 737 case ui::ET_GESTURE_END:
737 EndDrag(event->location()); 738 EndDrag(event->location());
738 event->SetHandled(); 739 event->SetHandled();
739 break; 740 break;
740 default: 741 default:
741 break; 742 break;
742 } 743 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 break; 849 break;
849 case FULLSCREEN_ALL_APPS: 850 case FULLSCREEN_ALL_APPS:
850 new_widget_bounds.set_y(0); 851 new_widget_bounds.set_y(0);
851 app_list_main_view_->contents_view()->SetActiveState( 852 app_list_main_view_->contents_view()->SetActiveState(
852 AppListModel::STATE_APPS); 853 AppListModel::STATE_APPS);
853 break; 854 break;
854 case FULLSCREEN_SEARCH: 855 case FULLSCREEN_SEARCH:
855 new_widget_bounds.set_y(0); 856 new_widget_bounds.set_y(0);
856 break; 857 break;
857 case CLOSED: 858 case CLOSED:
859 GetWidget()->Close();
xiyuan 2017/06/21 18:16:18 Why do we need to do this? delegate_->Dismiss() do
newcomer 2017/06/21 20:39:42 I changed it so I could test it more easily. I agr
858 app_list_main_view_->Close(); 860 app_list_main_view_->Close();
859 delegate_->Dismiss(); 861 delegate_->Dismiss();
860 break; 862 break;
861 } 863 }
862 fullscreen_widget_->SetBounds(new_widget_bounds); 864 fullscreen_widget_->SetBounds(new_widget_bounds);
863 app_list_state_ = new_state_override; 865 app_list_state_ = new_state_override;
864 } 866 }
865 867
866 void AppListView::OnWidgetDestroying(views::Widget* widget) { 868 void AppListView::OnWidgetDestroying(views::Widget* widget) {
867 BubbleDialogDelegateView::OnWidgetDestroying(widget); 869 BubbleDialogDelegateView::OnWidgetDestroying(widget);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 .work_area() 960 .work_area()
959 .size(); 961 .size();
960 size.Enlarge(0, kShelfSize); 962 size.Enlarge(0, kShelfSize);
961 fullscreen_widget_->SetSize(size); 963 fullscreen_widget_->SetSize(size);
962 964
963 // Update the |fullscreen_widget_| bounds to accomodate the new work area. 965 // Update the |fullscreen_widget_| bounds to accomodate the new work area.
964 SetState(app_list_state_); 966 SetState(app_list_state_);
965 } 967 }
966 968
967 } // namespace app_list 969 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698