Commit d556afc4 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Revert "cros: Added Launcher Animations"

This reverts commit 30a59b17.

Reason for revert: Suspected cause of repeat failures such as https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/473789. Apologies if this speculative revert is incorrect.

Original change's description:
> cros: Added Launcher Animations
> 
> First round of launcher animations.
> The launcher now animates from the bottom of the screen when it is
> loaded.
> The launcher also animates between states.
> When the launcher is closed it keeps its old closing animation (for
> now).
> 
> Round 2 changes:
> Linking the launcher animation with the search result animation.
> Jank improvements.
> 
> ** Also in this CL: **
> 
> AppListView cleanup
> AppListPresenterDelegateUnittest fixes
> -Introduced HalfToPeekingByClickorTap to test for this use case.
> -Refactored and parameterized TapAndClickOutsideClosesHalfAppList 
> 
> BUG=735498
> 
> Change-Id: I11bc0324f9b34d0257e6c08642f0bddb512fa4e4
> Reviewed-on: https://chromium-review.googlesource.com/576257
> Commit-Queue: Alex Newcomer <newcomer@chromium.org>
> Reviewed-by: James Cook <jamescook@chromium.org>
> Reviewed-by: Yury Khmel <khmel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#488513}

TBR=jamescook@chromium.org,khmel@chromium.org,newcomer@chromium.org

Change-Id: I7dbbb7feba9bdc3d46b13ef173476afcf7500415
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 735498
Reviewed-on: https://chromium-review.googlesource.com/580430Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488568}
parent 8add4064
...@@ -145,6 +145,7 @@ TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) { ...@@ -145,6 +145,7 @@ TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility()); EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
} }
...@@ -170,7 +171,6 @@ TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) { ...@@ -170,7 +171,6 @@ TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) {
aura::Window* app_window = app_list_presenter_impl()->GetWindow(); aura::Window* app_window = app_list_presenter_impl()->GetWindow();
ASSERT_TRUE(app_window); ASSERT_TRUE(app_window);
ui::test::EventGenerator& generator = GetEventGenerator(); ui::test::EventGenerator& generator = GetEventGenerator();
// Click on the bubble itself. The bubble should remain visible. // Click on the bubble itself. The bubble should remain visible.
generator.MoveMouseToCenterOf(app_window); generator.MoveMouseToCenterOf(app_window);
generator.ClickLeftButton(); generator.ClickLeftButton();
...@@ -189,11 +189,12 @@ TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) { ...@@ -189,11 +189,12 @@ TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) {
// Tests that tapping outside the app-list bubble closes it. // Tests that tapping outside the app-list bubble closes it.
TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) { TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list_presenter_impl()->Show(GetPrimaryDisplayId());
aura::Window* app_window = app_list_presenter_impl()->GetWindow(); aura::Window* app_window = app_list_presenter_impl()->GetWindow();
ASSERT_TRUE(app_window); ASSERT_TRUE(app_window);
gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow(); gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
ui::test::EventGenerator& generator = GetEventGenerator();
ui::test::EventGenerator& generator = GetEventGenerator();
// Click on the bubble itself. The bubble should remain visible. // Click on the bubble itself. The bubble should remain visible.
generator.GestureTapAt(app_window_bounds.CenterPoint()); generator.GestureTapAt(app_window_bounds.CenterPoint());
EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility()); EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
...@@ -471,7 +472,6 @@ TEST_F(FullscreenAppListPresenterDelegateTest, ...@@ -471,7 +472,6 @@ TEST_F(FullscreenAppListPresenterDelegateTest,
app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
EXPECT_EQ(app_list->app_list_state(), EXPECT_EQ(app_list->app_list_state(),
app_list::AppListView::FULLSCREEN_ALL_APPS); app_list::AppListView::FULLSCREEN_ALL_APPS);
// Type in the search box to transition to |FULLSCREEN_SEARCH|. // Type in the search box to transition to |FULLSCREEN_SEARCH|.
ui::test::EventGenerator& generator = GetEventGenerator(); ui::test::EventGenerator& generator = GetEventGenerator();
generator.PressKey(ui::KeyboardCode::VKEY_0, 0); generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
...@@ -558,6 +558,7 @@ TEST_P(FullscreenAppListPresenterDelegateTest, ...@@ -558,6 +558,7 @@ TEST_P(FullscreenAppListPresenterDelegateTest,
// Tap outside the search box, the AppListView should transition to Peeking // Tap outside the search box, the AppListView should transition to Peeking
// and the search box should be inactive. // and the search box should be inactive.
if (test_mouse_event) { if (test_mouse_event) {
generator.MoveMouseTo(GetPointOutsideSearchbox()); generator.MoveMouseTo(GetPointOutsideSearchbox());
generator.ClickLeftButton(); generator.ClickLeftButton();
...@@ -702,9 +703,10 @@ TEST_F(AppListPresenterDelegateTest, ...@@ -702,9 +703,10 @@ TEST_F(AppListPresenterDelegateTest,
SHELF_BACKGROUND_DEFAULT); SHELF_BACKGROUND_DEFAULT);
} }
// Tests that the app list in HALF with an active search transitions to PEEKING // Tests that the half app list closes if the user taps outside its bounds.
// after the body is clicked/tapped. TEST_F(FullscreenAppListPresenterDelegateTest,
TEST_P(FullscreenAppListPresenterDelegateTest, HalfToPeekingByClickOrTap) { TapAndClickOutsideClosesHalfAppList) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
app_list_presenter_impl()->Show(GetPrimaryDisplayId()); app_list_presenter_impl()->Show(GetPrimaryDisplayId());
ui::test::EventGenerator& generator = GetEventGenerator(); ui::test::EventGenerator& generator = GetEventGenerator();
...@@ -713,46 +715,38 @@ TEST_P(FullscreenAppListPresenterDelegateTest, HalfToPeekingByClickOrTap) { ...@@ -713,46 +715,38 @@ TEST_P(FullscreenAppListPresenterDelegateTest, HalfToPeekingByClickOrTap) {
app_list::AppListView* app_list = app_list_presenter_impl()->GetView(); app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
// Click or Tap the app list view body. // Grab the bounds of the search box,
if (TestMouseEventParam()) { // which is guaranteed to be inside the app list.
generator.MoveMouseTo(GetPointOutsideSearchbox()); gfx::Point tap_point = app_list_presenter_impl()
generator.ClickLeftButton(); ->GetView()
generator.ReleaseLeftButton(); ->search_box_widget()
} else { ->GetContentsView()
generator.GestureTapAt(GetPointOutsideSearchbox()); ->GetBoundsInScreen()
} .CenterPoint();
EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::PEEKING);
// Tapping inside the bounds doesn't close the app list.
generator.GestureTapAt(tap_point);
EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
// Click or Tap the app list view body again. // Clicking inside the bounds doesn't close the app list.
if (TestMouseEventParam()) { generator.MoveMouseTo(tap_point);
generator.MoveMouseTo(GetPointOutsideSearchbox()); generator.ClickLeftButton();
generator.ClickLeftButton(); EXPECT_TRUE(app_list_presenter_impl()->IsVisible());
generator.ReleaseLeftButton(); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
} else {
generator.GestureTapAt(GetPointOutsideSearchbox());
}
EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::CLOSED);
}
// Tests that the half app list closes if the user taps outside its bounds. // Tapping outside the bounds closes the app list.
TEST_P(FullscreenAppListPresenterDelegateTest, generator.GestureTapAt(gfx::Point(10, 10));
TapAndClickOutsideClosesHalfAppList) { EXPECT_FALSE(app_list_presenter_impl()->IsVisible());
// TODO(newcomer): Investigate mash failures crbug.com/726838
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
ui::test::EventGenerator& generator = GetEventGenerator();
// Transition to half app list by entering text. // Reset the app list to half state.
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
generator.PressKey(ui::KeyboardCode::VKEY_0, 0); generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF); EXPECT_EQ(app_list->app_list_state(), app_list::AppListView::HALF);
// Clicking/tapping outside the bounds closes the app list. // Clicking outside the bounds closes the app list.
if (TestMouseEventParam()) { generator.MoveMouseTo(gfx::Point(10, 10));
generator.MoveMouseTo(gfx::Point(10, 10)); generator.ClickLeftButton();
generator.ClickLeftButton();
} else {
generator.GestureTapAt(gfx::Point(10, 10));
}
EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); EXPECT_FALSE(app_list_presenter_impl()->IsVisible());
} }
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
-FullscreenAppListPresenterDelegateTest.AppListViewDragHandlerTabletModeFromSearch -FullscreenAppListPresenterDelegateTest.AppListViewDragHandlerTabletModeFromSearch
-FullscreenAppListPresenterDelegateTest.BottomShelfAlignmentTextStateTransitions -FullscreenAppListPresenterDelegateTest.BottomShelfAlignmentTextStateTransitions
-FullscreenAppListPresenterDelegateTest.HalfToFullscreenWhenTabletModeIsActive -FullscreenAppListPresenterDelegateTest.HalfToFullscreenWhenTabletModeIsActive
-FullscreenAppListPresenterDelegateTest.HalfToPeekingByClickOrTap/0
-FullscreenAppListPresenterDelegateTest.HalfToPeekingByClickOrTap/1
-FullscreenAppListPresenterDelegateTest.KeyPressEnablesSearchBox -FullscreenAppListPresenterDelegateTest.KeyPressEnablesSearchBox
-FullscreenAppListPresenterDelegateTest.TabletModeTextStateTransitions -FullscreenAppListPresenterDelegateTest.TabletModeTextStateTransitions
-FullscreenAppListPresenterDelegateTest.PeekingToFullscreenWhenTabletModeIsActive -FullscreenAppListPresenterDelegateTest.PeekingToFullscreenWhenTabletModeIsActive
...@@ -14,8 +12,7 @@ ...@@ -14,8 +12,7 @@
-FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/0 -FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/0
-FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/1 -FullscreenAppListPresenterDelegateTest.StateTransitionsByTappingAppListBodyFromFullscreen/1
-FullscreenAppListPresenterDelegateTest.TapAndClickEnablesSearchBox -FullscreenAppListPresenterDelegateTest.TapAndClickEnablesSearchBox
-FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesHalfAppList/0 -FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesHalfAppList
-FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesHalfAppList/1
-FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesPeekingAppList -FullscreenAppListPresenterDelegateTest.TapAndClickOutsideClosesPeekingAppList
-FullscreenAppListPresenterDelegateTest.WhitespaceQuery -FullscreenAppListPresenterDelegateTest.WhitespaceQuery
-NativeCursorManagerAshTest.FractionalScale -NativeCursorManagerAshTest.FractionalScale
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
...@@ -87,9 +86,6 @@ constexpr float kAppListOpacity = 0.8; ...@@ -87,9 +86,6 @@ constexpr float kAppListOpacity = 0.8;
// The vertical position for the appearing animation of the speech UI. // The vertical position for the appearing animation of the speech UI.
constexpr float kSpeechUIAppearingPosition = 12; constexpr float kSpeechUIAppearingPosition = 12;
// The animation duration for app list movement.
constexpr float kAppListAnimationDurationMs = 300;
// This view forwards the focus to the search box widget by providing it as a // This view forwards the focus to the search box widget by providing it as a
// FocusTraversable when a focus search is provided. // FocusTraversable when a focus search is provided.
class SearchBoxFocusHost : public views::View { class SearchBoxFocusHost : public views::View {
...@@ -455,14 +451,14 @@ void AppListView::InitChildWidgets() { ...@@ -455,14 +451,14 @@ void AppListView::InitChildWidgets() {
void AppListView::InitializeFullscreen(gfx::NativeView parent, void AppListView::InitializeFullscreen(gfx::NativeView parent,
int initial_apps_page) { int initial_apps_page) {
const display::Display display_nearest_view = GetDisplayNearestView(); gfx::Rect display_work_area_bounds =
const gfx::Rect display_work_area_bounds = display_nearest_view.work_area(); display::Screen::GetScreen()
const int bottom_of_screen = display_nearest_view.size().height(); ->GetDisplayNearestView(parent_window())
.work_area();
gfx::Rect app_list_overlay_view_bounds( gfx::Rect app_list_overlay_view_bounds(
display_work_area_bounds.x(), display_work_area_bounds.x(),
bottom_of_screen, // Set the widget at the bottom of the screen so it can display_work_area_bounds.height() + kShelfSize - kPeekingAppListHeight,
// animate up when shown.
display_work_area_bounds.width(), display_work_area_bounds.width(),
display_work_area_bounds.height() + kShelfSize); display_work_area_bounds.height() + kShelfSize);
...@@ -547,10 +543,11 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -547,10 +543,11 @@ void AppListView::EndDrag(const gfx::Point& location) {
// When the SearchBoxView closes the app list, ignore the final event. // When the SearchBoxView closes the app list, ignore the final event.
if (app_list_state_ == CLOSED) if (app_list_state_ == CLOSED)
return; return;
// Change the app list state based on where the drag ended. If fling velocity // Change the app list state based on where the drag ended. If fling velocity
// was over the threshold, snap to the next state in the direction of the // was over the threshold, snap to the next state in the direction of the
// fling. // fling.
int const new_y_position = location.y() - initial_drag_point_.y() +
fullscreen_widget_->GetWindowBoundsInScreen().y();
if (std::abs(last_fling_velocity_) >= kAppListDragVelocityThreshold) { if (std::abs(last_fling_velocity_) >= kAppListDragVelocityThreshold) {
// If the user releases drag with velocity over the threshold, snap to // If the user releases drag with velocity over the threshold, snap to
// the next state, ignoring the drag release position. // the next state, ignoring the drag release position.
...@@ -587,7 +584,10 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -587,7 +584,10 @@ void AppListView::EndDrag(const gfx::Point& location) {
} }
} }
} else { } else {
const int display_height = GetDisplayNearestView().size().height(); int display_height = display::Screen::GetScreen()
->GetDisplayNearestView(parent_window())
.size()
.height();
int app_list_y_for_state = 0; int app_list_y_for_state = 0;
int app_list_height = 0; int app_list_height = 0;
switch (app_list_state_) { switch (app_list_state_) {
...@@ -609,13 +609,10 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -609,13 +609,10 @@ void AppListView::EndDrag(const gfx::Point& location) {
break; break;
} }
int app_list_threshold = app_list_height / kAppListThresholdDenominator;
int drag_delta = app_list_y_for_state - new_y_position;
gfx::Point location_in_screen_coordinates = location; gfx::Point location_in_screen_coordinates = location;
ConvertPointToScreen(this, &location_in_screen_coordinates); ConvertPointToScreen(this, &location_in_screen_coordinates);
const int new_y_position =
location_in_screen_coordinates.y() - initial_drag_point_.y();
const int app_list_threshold =
app_list_height / kAppListThresholdDenominator;
const int drag_delta = app_list_y_for_state - new_y_position;
switch (app_list_state_) { switch (app_list_state_) {
case FULLSCREEN_ALL_APPS: case FULLSCREEN_ALL_APPS:
if (std::abs(drag_delta) > app_list_threshold) if (std::abs(drag_delta) > app_list_threshold)
...@@ -658,10 +655,6 @@ void AppListView::EndDrag(const gfx::Point& location) { ...@@ -658,10 +655,6 @@ void AppListView::EndDrag(const gfx::Point& location) {
} }
} }
display::Display AppListView::GetDisplayNearestView() const {
return display::Screen::GetScreen()->GetDisplayNearestView(parent_window());
}
void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty) { void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty) {
switch (app_list_state_) { switch (app_list_state_) {
case PEEKING: case PEEKING:
...@@ -895,17 +888,20 @@ void AppListView::SetState(AppListState new_state) { ...@@ -895,17 +888,20 @@ void AppListView::SetState(AppListState new_state) {
new_state_override = FULLSCREEN_SEARCH; new_state_override = FULLSCREEN_SEARCH;
} }
gfx::Rect new_widget_bounds = fullscreen_widget_->GetWindowBoundsInScreen();
int display_height = display::Screen::GetScreen()
->GetDisplayNearestView(parent_window())
.size()
.height();
switch (new_state_override) { switch (new_state_override) {
case PEEKING: { case PEEKING: {
switch (app_list_state_) { switch (app_list_state_) {
case HALF: case HALF:
case FULLSCREEN_ALL_APPS: case FULLSCREEN_ALL_APPS:
StartAnimationForState(new_state_override);
app_list_main_view_->contents_view()->SetActiveState(
AppListModel::STATE_START);
break;
case PEEKING: { case PEEKING: {
StartAnimationForState(new_state_override); int peeking_app_list_y = display_height - kPeekingAppListHeight;
new_widget_bounds.set_y(peeking_app_list_y);
app_list_main_view_->contents_view()->SetActiveState( app_list_main_view_->contents_view()->SetActiveState(
AppListModel::STATE_START); AppListModel::STATE_START);
search_box_view()->ClearSearch(); search_box_view()->ClearSearch();
...@@ -922,7 +918,8 @@ void AppListView::SetState(AppListState new_state) { ...@@ -922,7 +918,8 @@ void AppListView::SetState(AppListState new_state) {
switch (app_list_state_) { switch (app_list_state_) {
case PEEKING: case PEEKING:
case HALF: { case HALF: {
StartAnimationForState(new_state_override); int half_app_list_y = display_height - kHalfAppListHeight;
new_widget_bounds.set_y(half_app_list_y);
break; break;
} }
case FULLSCREEN_SEARCH: case FULLSCREEN_SEARCH:
...@@ -933,7 +930,7 @@ void AppListView::SetState(AppListState new_state) { ...@@ -933,7 +930,7 @@ void AppListView::SetState(AppListState new_state) {
} }
break; break;
case FULLSCREEN_ALL_APPS: { case FULLSCREEN_ALL_APPS: {
StartAnimationForState(new_state_override); new_widget_bounds.set_y(0);
AppsContainerView* apps_container_view = AppsContainerView* apps_container_view =
app_list_main_view_->contents_view()->apps_container_view(); app_list_main_view_->contents_view()->apps_container_view();
...@@ -945,47 +942,17 @@ void AppListView::SetState(AppListState new_state) { ...@@ -945,47 +942,17 @@ void AppListView::SetState(AppListState new_state) {
break; break;
} }
case FULLSCREEN_SEARCH: case FULLSCREEN_SEARCH:
StartAnimationForState(new_state_override); new_widget_bounds.set_y(0);
break; break;
case CLOSED: case CLOSED:
app_list_main_view_->Close(); app_list_main_view_->Close();
delegate_->Dismiss(); delegate_->Dismiss();
break; break;
} }
fullscreen_widget_->SetBounds(new_widget_bounds);
app_list_state_ = new_state_override; app_list_state_ = new_state_override;
} }
void AppListView::StartAnimationForState(AppListState target_state) {
const int display_height = GetDisplayNearestView().size().height();
int target_state_y = 0;
switch (target_state) {
case PEEKING:
target_state_y = display_height - kPeekingAppListHeight;
break;
case HALF:
target_state_y = display_height - kHalfAppListHeight;
break;
default:
break;
}
gfx::Rect target_bounds = fullscreen_widget_->GetWindowBoundsInScreen();
target_bounds.set_y(target_state_y);
std::unique_ptr<ui::LayerAnimationElement> animation_element =
ui::LayerAnimationElement::CreateBoundsElement(
target_bounds,
base::TimeDelta::FromMilliseconds(kAppListAnimationDurationMs));
animation_element->set_tween_type(gfx::Tween::EASE_OUT);
ui::LayerAnimator* animator = fullscreen_widget_->GetLayer()->GetAnimator();
animator->set_preemption_strategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
animator->ScheduleAnimation(
new ui::LayerAnimationSequence(std::move(animation_element)));
}
void AppListView::OnWidgetDestroying(views::Widget* widget) { void AppListView::OnWidgetDestroying(views::Widget* widget) {
BubbleDialogDelegateView::OnWidgetDestroying(widget); BubbleDialogDelegateView::OnWidgetDestroying(widget);
if (delegate_ && widget == GetWidget()) if (delegate_ && widget == GetWidget())
...@@ -1062,11 +1029,10 @@ void AppListView::OnSpeechRecognitionStateChanged( ...@@ -1062,11 +1029,10 @@ void AppListView::OnSpeechRecognitionStateChanged(
speech_view_->SetVisible(true); speech_view_->SetVisible(true);
} else { } else {
app_list_main_view_->SetVisible(true); app_list_main_view_->SetVisible(true);
// Refocus the search box. However, if the app list widget does not have
// Refocus the search box. However, if the app list widget does not // focus, it means another window has already taken focus, and we *must
// have focus, it means another window has already taken focus, and we // not* focus the search box (or we would steal focus back into the app
// *must not* focus the search box (or we would steal focus back into // list).
// the app list).
if (GetWidget()->IsActive()) if (GetWidget()->IsActive())
search_box_view_->search_box()->RequestFocus(); search_box_view_->search_box()->RequestFocus();
} }
...@@ -1078,12 +1044,14 @@ void AppListView::OnDisplayMetricsChanged(const display::Display& display, ...@@ -1078,12 +1044,14 @@ void AppListView::OnDisplayMetricsChanged(const display::Display& display,
return; return;
// Set the |fullscreen_widget_| size to fit the new display metrics. // Set the |fullscreen_widget_| size to fit the new display metrics.
gfx::Size size = GetDisplayNearestView().work_area().size(); gfx::Size size = display::Screen::GetScreen()
->GetDisplayNearestView(parent_window())
.work_area()
.size();
size.Enlarge(0, kShelfSize); size.Enlarge(0, kShelfSize);
fullscreen_widget_->SetSize(size); fullscreen_widget_->SetSize(size);
// Update the |fullscreen_widget_| bounds to accomodate the new work // Update the |fullscreen_widget_| bounds to accomodate the new work area.
// area.
SetState(app_list_state_); SetState(app_list_state_);
} }
......
...@@ -94,6 +94,10 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -94,6 +94,10 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// hiding the app list when a modal dialog is being shown). // hiding the app list when a modal dialog is being shown).
void SetAppListOverlayVisible(bool visible); void SetAppListOverlayVisible(bool visible);
views::Widget* search_box_widget() const { return search_box_widget_; }
SearchBoxView* search_box_view() { return search_box_view_; }
// Overridden from views::View: // Overridden from views::View:
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
void OnPaint(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override;
...@@ -105,6 +109,8 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -105,6 +109,8 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
gfx::NativeView child, gfx::NativeView child,
const gfx::Point& location) override; const gfx::Point& location) override;
AppListMainView* app_list_main_view() { return app_list_main_view_; }
// Gets the PaginationModel owned by this view's apps grid. // Gets the PaginationModel owned by this view's apps grid.
PaginationModel* GetAppsPaginationModel(); PaginationModel* GetAppsPaginationModel();
...@@ -116,26 +122,19 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -116,26 +122,19 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// Changes the app list state. // Changes the app list state.
void SetState(AppListState new_state); void SetState(AppListState new_state);
// Kicks off the proper animation for the state change. If an animation is
// in progress it will be interrupted.
void StartAnimationForState(AppListState new_state);
// Changes the app list state depending on the current |app_list_state_| and // Changes the app list state depending on the current |app_list_state_| and
// whether the search box is empty. // whether the search box is empty.
void SetStateFromSearchBoxView(bool search_box_is_empty); void SetStateFromSearchBoxView(bool search_box_is_empty);
// Called when tablet mode starts and ends.
void OnTabletModeChanged(bool started);
bool is_fullscreen() const { bool is_fullscreen() const {
return app_list_state_ == FULLSCREEN_ALL_APPS || return app_list_state_ == FULLSCREEN_ALL_APPS ||
app_list_state_ == FULLSCREEN_SEARCH; app_list_state_ == FULLSCREEN_SEARCH;
} }
AppListState app_list_state() const { return app_list_state_; } AppListState app_list_state() const { return app_list_state_; }
AppListMainView* app_list_main_view() const { return app_list_main_view_; }
views::Widget* search_box_widget() const { return search_box_widget_; } // Called when tablet mode starts and ends.
SearchBoxView* search_box_view() const { return search_box_view_; } void OnTabletModeChanged(bool started);
// Changes |app_list_state_| from |PEEKING| to |FULLSCREEN_ALL_APPS|. // Changes |app_list_state_| from |PEEKING| to |FULLSCREEN_ALL_APPS|.
bool HandleScroll(const ui::Event* event); bool HandleScroll(const ui::Event* event);
...@@ -168,9 +167,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -168,9 +167,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// release position and snap to the next state. // release position and snap to the next state.
void EndDrag(const gfx::Point& location); void EndDrag(const gfx::Point& location);
// Gets the display nearest to the parent window.
display::Display GetDisplayNearestView() const;
// Overridden from views::BubbleDialogDelegateView: // Overridden from views::BubbleDialogDelegateView:
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override; views::Widget* widget) const override;
...@@ -225,6 +221,7 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, ...@@ -225,6 +221,7 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
bool processing_scroll_event_series_; bool processing_scroll_event_series_;
// The state of the app list, controlled via SetState(). // The state of the app list, controlled via SetState().
AppListState app_list_state_; AppListState app_list_state_;
// An observer that notifies AppListView when the display has changed. // An observer that notifies AppListView when the display has changed.
ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; ScopedObserver<display::Screen, display::DisplayObserver> display_observer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment