Commit a61444ac authored by calamity's avatar calamity Committed by Commit bot

Change ContentsView::SetActivePage to use States rather than indexes.

This CL makes the ContentsView's API state-keyed rather than page index
keyed. This removes cruft from callers of SetActivePage and will
support further refactors.

BUG=455059
TBR=jamescook@chromium.org, benwells@chromium.org

Review URL: https://codereview.chromium.org/947903002

Cr-Commit-Position: refs/heads/master@{#321513}
parent f3af70d5
...@@ -88,10 +88,10 @@ class CustomLauncherPageBrowserTest ...@@ -88,10 +88,10 @@ class CustomLauncherPageBrowserTest
// Set the active page on the app list, according to |state|. Does not wait // Set the active page on the app list, according to |state|. Does not wait
// for any animation or custom page to complete. // for any animation or custom page to complete.
void SetActivePageAndVerify(app_list::AppListModel::State state) { void SetActiveStateAndVerify(app_list::AppListModel::State state) {
app_list::ContentsView* contents_view = app_list::ContentsView* contents_view =
GetAppListView()->app_list_main_view()->contents_view(); GetAppListView()->app_list_main_view()->contents_view();
contents_view->SetActivePage(contents_view->GetPageIndexForState(state)); contents_view->SetActiveState(state);
EXPECT_TRUE(contents_view->IsStateActive(state)); EXPECT_TRUE(contents_view->IsStateActive(state));
} }
...@@ -133,15 +133,14 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -133,15 +133,14 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
{ {
ExtensionTestMessageListener listener("onPageProgressAt1", false); ExtensionTestMessageListener listener("onPageProgressAt1", false);
contents_view->SetActivePage(contents_view->GetPageIndexForState( contents_view->SetActiveState(
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
listener.WaitUntilSatisfied(); listener.WaitUntilSatisfied();
} }
{ {
ExtensionTestMessageListener listener("onPageProgressAt0", false); ExtensionTestMessageListener listener("onPageProgressAt0", false);
contents_view->SetActivePage(contents_view->GetPageIndexForState( contents_view->SetActiveState(app_list::AppListModel::STATE_START);
app_list::AppListModel::STATE_START));
listener.WaitUntilSatisfied(); listener.WaitUntilSatisfied();
} }
...@@ -193,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -193,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
// Back to the start page. And send a mouse wheel event. // Back to the start page. And send a mouse wheel event.
SetActivePageAndVerify(app_list::AppListModel::STATE_START); SetActiveStateAndVerify(app_list::AppListModel::STATE_START);
// Generate wheel events above the clickzone. // Generate wheel events above the clickzone.
event_generator.MoveMouseRelativeTo(window, point_above_clickzone); event_generator.MoveMouseRelativeTo(window, point_above_clickzone);
// Scrolling left, right or up should do nothing. // Scrolling left, right or up should do nothing.
...@@ -224,7 +223,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -224,7 +223,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
#endif #endif
// Back to the start page. And send a scroll gesture. // Back to the start page. And send a scroll gesture.
SetActivePageAndVerify(app_list::AppListModel::STATE_START); SetActiveStateAndVerify(app_list::AppListModel::STATE_START);
// Going down should do nothing. // Going down should do nothing.
event_generator.GestureScrollSequence( event_generator.GestureScrollSequence(
point_above_clickzone, point_in_clickzone, step_delay, num_steps); point_above_clickzone, point_in_clickzone, step_delay, num_steps);
...@@ -237,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -237,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
// Back to the start page. And send a trackpad scroll event. // Back to the start page. And send a trackpad scroll event.
SetActivePageAndVerify(app_list::AppListModel::STATE_START); SetActiveStateAndVerify(app_list::AppListModel::STATE_START);
// Going down left, right or up should do nothing. // Going down left, right or up should do nothing.
event_generator.ScrollSequence(point_in_clickzone, step_delay, -5, 0, event_generator.ScrollSequence(point_in_clickzone, step_delay, -5, 0,
num_steps, num_fingers); num_steps, num_fingers);
...@@ -254,7 +253,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -254,7 +253,7 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
// Back to the start page. And send a tap gesture. // Back to the start page. And send a tap gesture.
SetActivePageAndVerify(app_list::AppListModel::STATE_START); SetActiveStateAndVerify(app_list::AppListModel::STATE_START);
// Tapping outside the clickzone should do nothing. // Tapping outside the clickzone should do nothing.
event_generator.GestureTapAt(point_above_clickzone); event_generator.GestureTapAt(point_above_clickzone);
EXPECT_TRUE( EXPECT_TRUE(
...@@ -278,8 +277,8 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LauncherPageSubpages) { ...@@ -278,8 +277,8 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LauncherPageSubpages) {
{ {
ExtensionTestMessageListener listener("onPageProgressAt1", false); ExtensionTestMessageListener listener("onPageProgressAt1", false);
contents_view->SetActivePage(contents_view->GetPageIndexForState( contents_view->SetActiveState(
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
listener.WaitUntilSatisfied(); listener.WaitUntilSatisfied();
EXPECT_TRUE(contents_view->IsStateActive( EXPECT_TRUE(contents_view->IsStateActive(
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
...@@ -405,8 +404,8 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, ...@@ -405,8 +404,8 @@ IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
{ {
ExtensionTestMessageListener listener("onPageProgressAt1", false); ExtensionTestMessageListener listener("onPageProgressAt1", false);
contents_view->SetActivePage(contents_view->GetPageIndexForState( contents_view->SetActiveState(
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
listener.WaitUntilSatisfied(); listener.WaitUntilSatisfied();
EXPECT_TRUE(contents_view->IsStateActive( EXPECT_TRUE(contents_view->IsStateActive(
app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
......
...@@ -105,8 +105,8 @@ void AppListServiceViews::ShowForProfileInternal( ...@@ -105,8 +105,8 @@ void AppListServiceViews::ShowForProfileInternal(
if (state != app_list::AppListModel::INVALID_STATE) { if (state != app_list::AppListModel::INVALID_STATE) {
app_list::ContentsView* contents_view = app_list::ContentsView* contents_view =
shower_.app_list()->app_list_main_view()->contents_view(); shower_.app_list()->app_list_main_view()->contents_view();
contents_view->SetActivePage(contents_view->GetPageIndexForState(state), contents_view->SetActiveState(state,
shower_.IsAppListVisible() /* animate */); shower_.IsAppListVisible() /* animate */);
} }
shower_.ShowForCurrentProfile(); shower_.ShowForCurrentProfile();
......
...@@ -49,8 +49,7 @@ void AppListServiceAsh::ShowAndSwitchToState( ...@@ -49,8 +49,7 @@ void AppListServiceAsh::ShowAndSwitchToState(
app_list::ContentsView* contents_view = app_list::ContentsView* contents_view =
app_list_view->app_list_main_view()->contents_view(); app_list_view->app_list_main_view()->contents_view();
contents_view->SetActivePage(contents_view->GetPageIndexForState(state), contents_view->SetActiveState(state, app_list_was_open /* animate */);
app_list_was_open /* animate */);
} }
void AppListServiceAsh::Init(Profile* initial_profile) { void AppListServiceAsh::Init(Profile* initial_profile) {
......
...@@ -32,8 +32,7 @@ void AllAppsTileItemView::ButtonPressed(views::Button* sender, ...@@ -32,8 +32,7 @@ void AllAppsTileItemView::ButtonPressed(views::Button* sender,
UMA_HISTOGRAM_ENUMERATION(kPageOpenedHistogram, AppListModel::STATE_APPS, UMA_HISTOGRAM_ENUMERATION(kPageOpenedHistogram, AppListModel::STATE_APPS,
AppListModel::STATE_LAST); AppListModel::STATE_LAST);
contents_view_->SetActivePage( contents_view_->SetActiveState(AppListModel::STATE_APPS);
contents_view_->GetPageIndexForState(AppListModel::STATE_APPS));
} }
void AllAppsTileItemView::OnFolderImageUpdated() { void AllAppsTileItemView::OnFolderImageUpdated() {
......
...@@ -144,10 +144,9 @@ void AppListMainView::ShowAppListWhenReady() { ...@@ -144,10 +144,9 @@ void AppListMainView::ShowAppListWhenReady() {
} }
void AppListMainView::ResetForShow() { void AppListMainView::ResetForShow() {
if (switches::IsExperimentalAppListEnabled()) { if (switches::IsExperimentalAppListEnabled())
contents_view_->SetActivePage( contents_view_->SetActiveState(AppListModel::STATE_START);
contents_view_->GetPageIndexForState(AppListModel::STATE_START));
}
contents_view_->apps_container_view()->ResetForShowApps(); contents_view_->apps_container_view()->ResetForShowApps();
// We clear the search when hiding so when app list appears it is not showing // We clear the search when hiding so when app list appears it is not showing
// search results. // search results.
...@@ -262,8 +261,7 @@ void AppListMainView::UpdateCustomLauncherPageVisibility() { ...@@ -262,8 +261,7 @@ void AppListMainView::UpdateCustomLauncherPageVisibility() {
AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) {
// Animate to the start page if currently on the custom page view. The view // Animate to the start page if currently on the custom page view. The view
// will hide on animation completion. // will hide on animation completion.
contents_view_->SetActivePage( contents_view_->SetActiveState(AppListModel::STATE_START);
contents_view_->GetPageIndexForState(AppListModel::STATE_START));
} else { } else {
// Hide the view immediately otherwise. // Hide the view immediately otherwise.
custom_page->SetVisible(false); custom_page->SetVisible(false);
......
...@@ -278,8 +278,7 @@ TEST_F(AppListMainViewTest, MouseHoverToHighlight) { ...@@ -278,8 +278,7 @@ TEST_F(AppListMainViewTest, MouseHoverToHighlight) {
// If experimental launcher, switch to All Apps page // If experimental launcher, switch to All Apps page
if (app_list::switches::IsExperimentalAppListEnabled()) { if (app_list::switches::IsExperimentalAppListEnabled()) {
GetContentsView()->SetActivePage( GetContentsView()->SetActiveState(AppListModel::STATE_APPS);
GetContentsView()->GetPageIndexForState(AppListModel::STATE_APPS));
GetContentsView()->Layout(); GetContentsView()->Layout();
} }
...@@ -314,8 +313,7 @@ TEST_F(AppListMainViewTest, MAYBE_TapGestureToHighlight) { ...@@ -314,8 +313,7 @@ TEST_F(AppListMainViewTest, MAYBE_TapGestureToHighlight) {
// If experimental launcher, switch to All Apps page // If experimental launcher, switch to All Apps page
if (app_list::switches::IsExperimentalAppListEnabled()) { if (app_list::switches::IsExperimentalAppListEnabled()) {
GetContentsView()->SetActivePage( GetContentsView()->SetActiveState(AppListModel::STATE_APPS);
GetContentsView()->GetPageIndexForState(AppListModel::STATE_APPS));
GetContentsView()->Layout(); GetContentsView()->Layout();
} }
...@@ -371,8 +369,7 @@ TEST_F(AppListMainViewTest, DragReparentItemOntoPageSwitcher) { ...@@ -371,8 +369,7 @@ TEST_F(AppListMainViewTest, DragReparentItemOntoPageSwitcher) {
// Ensure we are on the apps grid view page. // Ensure we are on the apps grid view page.
app_list::ContentsView* contents_view = GetContentsView(); app_list::ContentsView* contents_view = GetContentsView();
contents_view->SetActivePage( contents_view->SetActiveState(AppListModel::STATE_APPS);
contents_view->GetPageIndexForState(AppListModel::STATE_APPS));
contents_view->Layout(); contents_view->Layout();
AppListItemView* folder_item_view = CreateAndOpenSingleItemFolder(); AppListItemView* folder_item_view = CreateAndOpenSingleItemFolder();
......
...@@ -234,8 +234,7 @@ void AppListViewTestContext::CheckView(views::View* subview) { ...@@ -234,8 +234,7 @@ void AppListViewTestContext::CheckView(views::View* subview) {
bool AppListViewTestContext::SetAppListState(AppListModel::State state) { bool AppListViewTestContext::SetAppListState(AppListModel::State state) {
ContentsView* contents_view = view_->app_list_main_view()->contents_view(); ContentsView* contents_view = view_->app_list_main_view()->contents_view();
int index = contents_view->GetPageIndexForState(state); contents_view->SetActiveState(state);
contents_view->SetActivePage(index);
contents_view->Layout(); contents_view->Layout();
return IsStateShown(state); return IsStateShown(state);
} }
...@@ -509,47 +508,51 @@ void AppListViewTestContext::RunPageSwitchingAnimationTest() { ...@@ -509,47 +508,51 @@ void AppListViewTestContext::RunPageSwitchingAnimationTest() {
EXPECT_NO_FATAL_FAILURE(CheckView(main_view->contents_view())); EXPECT_NO_FATAL_FAILURE(CheckView(main_view->contents_view()));
ContentsView* contents_view = main_view->contents_view(); ContentsView* contents_view = main_view->contents_view();
// Pad the ContentsView with blank pages so we have at least 3 views.
while (contents_view->NumLauncherPages() < 3)
contents_view->AddBlankPageForTesting();
contents_view->SetActivePage(0); int start_page_index =
contents_view->GetPageIndexForState(AppListModel::STATE_START);
int search_results_page_index =
contents_view->GetPageIndexForState(AppListModel::STATE_SEARCH_RESULTS);
int apps_page_index =
contents_view->GetPageIndexForState(AppListModel::STATE_APPS);
contents_view->SetActiveState(AppListModel::STATE_START);
contents_view->Layout(); contents_view->Layout();
EXPECT_EQ(contents_view->GetOnscreenPageBounds(0), EXPECT_EQ(contents_view->GetOnscreenPageBounds(start_page_index),
contents_view->GetPageView(0)->bounds()); contents_view->GetPageView(start_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(1), EXPECT_NE(contents_view->GetOnscreenPageBounds(search_results_page_index),
contents_view->GetPageView(1)->bounds()); contents_view->GetPageView(search_results_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(2), EXPECT_NE(contents_view->GetOnscreenPageBounds(apps_page_index),
contents_view->GetPageView(2)->bounds()); contents_view->GetPageView(apps_page_index)->bounds());
// Change pages. View should not have moved without Layout(). // Change pages. View should not have moved without Layout().
contents_view->SetActivePage(1); contents_view->SetActiveState(AppListModel::STATE_SEARCH_RESULTS);
EXPECT_EQ(contents_view->GetOnscreenPageBounds(0), EXPECT_EQ(contents_view->GetOnscreenPageBounds(start_page_index),
contents_view->GetPageView(0)->bounds()); contents_view->GetPageView(start_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(1), EXPECT_NE(contents_view->GetOnscreenPageBounds(search_results_page_index),
contents_view->GetPageView(1)->bounds()); contents_view->GetPageView(search_results_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(2), EXPECT_NE(contents_view->GetOnscreenPageBounds(apps_page_index),
contents_view->GetPageView(2)->bounds()); contents_view->GetPageView(apps_page_index)->bounds());
// Change to a third page. This queues up the second animation behind the // Change to a third page. This queues up the second animation behind the
// first. // first.
contents_view->SetActivePage(2); contents_view->SetActiveState(AppListModel::STATE_APPS);
EXPECT_EQ(contents_view->GetOnscreenPageBounds(0), EXPECT_EQ(contents_view->GetOnscreenPageBounds(start_page_index),
contents_view->GetPageView(0)->bounds()); contents_view->GetPageView(start_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(1), EXPECT_NE(contents_view->GetOnscreenPageBounds(search_results_page_index),
contents_view->GetPageView(1)->bounds()); contents_view->GetPageView(search_results_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(2), EXPECT_NE(contents_view->GetOnscreenPageBounds(apps_page_index),
contents_view->GetPageView(2)->bounds()); contents_view->GetPageView(apps_page_index)->bounds());
// Call Layout(). Should jump to the third page. // Call Layout(). Should jump to the third page.
contents_view->Layout(); contents_view->Layout();
EXPECT_NE(contents_view->GetOnscreenPageBounds(0), EXPECT_NE(contents_view->GetOnscreenPageBounds(start_page_index),
contents_view->GetPageView(0)->bounds()); contents_view->GetPageView(start_page_index)->bounds());
EXPECT_NE(contents_view->GetOnscreenPageBounds(1), EXPECT_NE(contents_view->GetOnscreenPageBounds(search_results_page_index),
contents_view->GetPageView(1)->bounds()); contents_view->GetPageView(search_results_page_index)->bounds());
EXPECT_EQ(contents_view->GetOnscreenPageBounds(2), EXPECT_EQ(contents_view->GetOnscreenPageBounds(apps_page_index),
contents_view->GetPageView(2)->bounds()); contents_view->GetPageView(apps_page_index)->bounds());
} }
Close(); Close();
......
...@@ -131,15 +131,15 @@ void ContentsView::SetDragAndDropHostOfCurrentAppList( ...@@ -131,15 +131,15 @@ void ContentsView::SetDragAndDropHostOfCurrentAppList(
apps_container_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); apps_container_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
} }
void ContentsView::SetActivePage(int page_index) { void ContentsView::SetActiveState(AppListModel::State state) {
SetActivePage(page_index, true); SetActiveState(state, true);
} }
void ContentsView::SetActivePage(int page_index, bool animate) { void ContentsView::SetActiveState(AppListModel::State state, bool animate) {
if (GetActivePageIndex() == page_index) if (IsStateActive(state))
return; return;
SetActivePageInternal(page_index, false, animate); SetActiveStateInternal(GetPageIndexForState(state), false, animate);
} }
int ContentsView::GetActivePageIndex() const { int ContentsView::GetActivePageIndex() const {
...@@ -180,9 +180,9 @@ int ContentsView::NumLauncherPages() const { ...@@ -180,9 +180,9 @@ int ContentsView::NumLauncherPages() const {
return pagination_model_.total_pages(); return pagination_model_.total_pages();
} }
void ContentsView::SetActivePageInternal(int page_index, void ContentsView::SetActiveStateInternal(int page_index,
bool show_search_results, bool show_search_results,
bool animate) { bool animate) {
if (!GetPageView(page_index)->visible()) if (!GetPageView(page_index)->visible())
return; return;
...@@ -237,7 +237,7 @@ void ContentsView::ShowSearchResults(bool show) { ...@@ -237,7 +237,7 @@ void ContentsView::ShowSearchResults(bool show) {
int search_page = GetPageIndexForState(AppListModel::STATE_SEARCH_RESULTS); int search_page = GetPageIndexForState(AppListModel::STATE_SEARCH_RESULTS);
DCHECK_GE(search_page, 0); DCHECK_GE(search_page, 0);
SetActivePageInternal(show ? search_page : page_before_search_, show, true); SetActiveStateInternal(show ? search_page : page_before_search_, show, true);
} }
bool ContentsView::IsShowingSearchResults() const { bool ContentsView::IsShowingSearchResults() const {
...@@ -335,11 +335,6 @@ SearchBoxView* ContentsView::GetSearchBoxView() const { ...@@ -335,11 +335,6 @@ SearchBoxView* ContentsView::GetSearchBoxView() const {
return app_list_main_view_->search_box_view(); return app_list_main_view_->search_box_view();
} }
void ContentsView::AddBlankPageForTesting() {
AddLauncherPage(new views::View);
pagination_model_.SetTotalPages(view_model_->view_size());
}
int ContentsView::AddLauncherPage(views::View* view) { int ContentsView::AddLauncherPage(views::View* view) {
int page_index = view_model_->view_size(); int page_index = view_model_->view_size();
AddChildView(view); AddChildView(view);
...@@ -432,13 +427,13 @@ bool ContentsView::Back() { ...@@ -432,13 +427,13 @@ bool ContentsView::Back() {
if (app_list_main_view_->model()->PopCustomLauncherPageSubpage()) if (app_list_main_view_->model()->PopCustomLauncherPageSubpage())
app_list_main_view_->view_delegate()->CustomLauncherPagePopSubpage(); app_list_main_view_->view_delegate()->CustomLauncherPagePopSubpage();
else else
SetActivePage(GetPageIndexForState(AppListModel::STATE_START)); SetActiveState(AppListModel::STATE_START);
break; break;
case AppListModel::STATE_APPS: case AppListModel::STATE_APPS:
if (apps_container_view_->IsInFolderView()) if (apps_container_view_->IsInFolderView())
apps_container_view_->app_list_folder_view()->CloseFolderPage(); apps_container_view_->app_list_folder_view()->CloseFolderPage();
else else
SetActivePage(GetPageIndexForState(AppListModel::STATE_START)); SetActiveState(AppListModel::STATE_START);
break; break;
case AppListModel::STATE_SEARCH_RESULTS: case AppListModel::STATE_SEARCH_RESULTS:
GetSearchBoxView()->ClearSearch(); GetSearchBoxView()->ClearSearch();
......
...@@ -70,8 +70,8 @@ class APP_LIST_EXPORT ContentsView : public views::View, ...@@ -70,8 +70,8 @@ class APP_LIST_EXPORT ContentsView : public views::View,
void ShowFolderContent(AppListFolderItem* folder); void ShowFolderContent(AppListFolderItem* folder);
// Sets the active launcher page and animates the pages into place. // Sets the active launcher page and animates the pages into place.
void SetActivePage(int page_index); void SetActiveState(AppListModel::State state);
void SetActivePage(int page_index, bool animate); void SetActiveState(AppListModel::State state, bool animate);
// The index of the currently active launcher page. // The index of the currently active launcher page.
int GetActivePageIndex() const; int GetActivePageIndex() const;
...@@ -108,9 +108,6 @@ class APP_LIST_EXPORT ContentsView : public views::View, ...@@ -108,9 +108,6 @@ class APP_LIST_EXPORT ContentsView : public views::View,
AppListMainView* app_list_main_view() const { return app_list_main_view_; } AppListMainView* app_list_main_view() const { return app_list_main_view_; }
// Adds a blank launcher page. For use in tests only.
void AddBlankPageForTesting();
// Returns the pagination model for the ContentsView. // Returns the pagination model for the ContentsView.
const PaginationModel& pagination_model() { return pagination_model_; } const PaginationModel& pagination_model() { return pagination_model_; }
...@@ -166,9 +163,9 @@ class APP_LIST_EXPORT ContentsView : public views::View, ...@@ -166,9 +163,9 @@ class APP_LIST_EXPORT ContentsView : public views::View,
private: private:
// Sets the active launcher page, accounting for whether the change is for // Sets the active launcher page, accounting for whether the change is for
// search results. // search results.
void SetActivePageInternal(int page_index, void SetActiveStateInternal(int page_index,
bool show_search_results, bool show_search_results,
bool animate); bool animate);
// Invoked when active view is changed. // Invoked when active view is changed.
void ActivePageChanged(); void ActivePageChanged();
......
...@@ -279,9 +279,7 @@ void StartPageView::MaybeOpenCustomLauncherPage() { ...@@ -279,9 +279,7 @@ void StartPageView::MaybeOpenCustomLauncherPage() {
AppListModel::STATE_CUSTOM_LAUNCHER_PAGE, AppListModel::STATE_CUSTOM_LAUNCHER_PAGE,
AppListModel::STATE_LAST); AppListModel::STATE_LAST);
int custom_page_index = contents_view->GetPageIndexForState( contents_view->SetActiveState(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
contents_view->SetActivePage(custom_page_index);
} }
void StartPageView::Reset() { void StartPageView::Reset() {
......
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