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

Unified Diff: trunk/src/ui/app_list/views/contents_view.cc

Issue 35783003: Revert 230227 "Implement app list folder management page UI, inc..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/ui/app_list/views/contents_view.h ('k') | trunk/src/ui/app_list/views/folder_header_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/app_list/views/contents_view.cc
===================================================================
--- trunk/src/ui/app_list/views/contents_view.cc (revision 230254)
+++ trunk/src/ui/app_list/views/contents_view.cc (working copy)
@@ -11,7 +11,6 @@
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/pagination_model.h"
#include "ui/app_list/views/app_list_main_view.h"
-#include "ui/app_list/views/apps_container_view.h"
#include "ui/app_list/views/apps_grid_view.h"
#include "ui/app_list/views/search_result_list_view.h"
#include "ui/events/event.h"
@@ -23,8 +22,10 @@
namespace {
+const int kPreferredIconDimension = 48;
+
// Indexes of interesting views in ViewModel of ContentsView.
-const int kIndexAppsContainer = 0;
+const int kIndexAppsGrid = 0;
const int kIndexSearchResults = 1;
const int kMinMouseWheelToSwitchPage = 20;
@@ -33,8 +34,9 @@
const double kFinishTransitionThreshold = 0.33;
-AppsContainerView* GetAppsContainerView(views::ViewModel* model) {
- return static_cast<AppsContainerView*>(model->view_at(kIndexAppsContainer));
+// Helpers to get certain child view from |model|.
+AppsGridView* GetAppsGridView(views::ViewModel* model) {
+ return static_cast<AppsGridView*>(model->view_at(kIndexAppsGrid));
}
SearchResultListView* GetSearchResultListView(views::ViewModel* model) {
@@ -57,16 +59,20 @@
kPageTransitionDurationInMs,
kOverscrollPageTransitionDurationMs);
- apps_container_view_ = new AppsContainerView(
- app_list_main_view, pagination_model, model, start_page_contents);
- AddChildView(apps_container_view_);
- view_model_->Add(apps_container_view_, kIndexAppsContainer);
+ apps_grid_view_ = new AppsGridView(
+ app_list_main_view, pagination_model, start_page_contents);
+ apps_grid_view_->SetLayout(kPreferredIconDimension,
+ kPreferredCols,
+ kPreferredRows);
+ AddChildView(apps_grid_view_);
+ view_model_->Add(apps_grid_view_, kIndexAppsGrid);
SearchResultListView* search_results_view = new SearchResultListView(
app_list_main_view);
AddChildView(search_results_view);
view_model_->Add(search_results_view, kIndexSearchResults);
+ GetAppsGridView(view_model_.get())->SetModel(model);
GetSearchResultListView(view_model_.get())->SetResults(model->results());
}
@@ -74,14 +80,13 @@
}
void ContentsView::CancelDrag() {
- if (apps_container_view_->apps_grid_view()->has_dragged_view())
- apps_container_view_->apps_grid_view()->EndDrag(true);
+ if (apps_grid_view_ && apps_grid_view_->has_dragged_view())
+ apps_grid_view_->EndDrag(true);
}
void ContentsView::SetDragAndDropHostOfCurrentAppList(
ApplicationDragAndDropHost* drag_and_drop_host) {
- apps_container_view_->apps_grid_view()->
- SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
+ apps_grid_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
}
void ContentsView::SetShowState(ShowState show_state) {
@@ -109,7 +114,7 @@
if (rect.IsEmpty())
return;
- gfx::Rect container_frame(rect);
+ gfx::Rect grid_frame(rect);
gfx::Rect results_frame(rect);
// Offsets apps grid and result list based on |show_state_|.
@@ -121,14 +126,14 @@
results_frame.Offset(0, -contents_area_height);
break;
case SHOW_SEARCH_RESULTS:
- container_frame.Offset(0, contents_area_height);
+ grid_frame.Offset(0, contents_area_height);
break;
default:
NOTREACHED() << "Unknown show_state_ " << show_state_;
break;
}
- view_model_->set_ideal_bounds(kIndexAppsContainer, container_frame);
+ view_model_->set_ideal_bounds(kIndexAppsGrid, grid_frame);
view_model_->set_ideal_bounds(kIndexSearchResults, results_frame);
}
@@ -144,23 +149,19 @@
SetShowState(show ? SHOW_SEARCH_RESULTS : SHOW_APPS);
}
-void ContentsView::ShowFolderContent(AppListFolderItem* item) {
- apps_container_view_->ShowActiveFolder(item);
-}
-
void ContentsView::Prerender() {
const int selected_page = std::max(0, pagination_model_->selected_page());
- apps_container_view_->apps_grid_view()->Prerender(selected_page);
+ GetAppsGridView(view_model_.get())->Prerender(selected_page);
}
gfx::Size ContentsView::GetPreferredSize() {
- const gfx::Size container_size = GetAppsContainerView(view_model_.get())->
- apps_grid_view()->GetPreferredSize();
+ const gfx::Size grid_size =
+ GetAppsGridView(view_model_.get())->GetPreferredSize();
const gfx::Size results_size =
GetSearchResultListView(view_model_.get())->GetPreferredSize();
- int width = std::max(container_size.width(), results_size.width());
- int height = std::max(container_size.height(), results_size.height());
+ int width = std::max(grid_size.width(), results_size.width());
+ int height = std::max(grid_size.height(), results_size.height());
return gfx::Size(width, height);
}
@@ -172,7 +173,7 @@
bool ContentsView::OnKeyPressed(const ui::KeyEvent& event) {
switch (show_state_) {
case SHOW_APPS:
- return GetAppsContainerView(view_model_.get())->OnKeyPressed(event);
+ return GetAppsGridView(view_model_.get())->OnKeyPressed(event);
case SHOW_SEARCH_RESULTS:
return GetSearchResultListView(view_model_.get())->OnKeyPressed(event);
default:
« no previous file with comments | « trunk/src/ui/app_list/views/contents_view.h ('k') | trunk/src/ui/app_list/views/folder_header_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698