forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move app list search tiles into SearchResultTileItemListView.
This CL factors a SearchResultTileItemListView out of SearchResultPageView which is responsible for displaying tile item search results in a list. BUG=416756 Review URL: https://codereview.chromium.org/720663002 Cr-Commit-Position: refs/heads/master@{#304009}
- Loading branch information
Showing
8 changed files
with
106 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/app_list/views/search_result_tile_item_list_view.h" | ||
|
||
#include "ui/app_list/app_list_constants.h" | ||
#include "ui/app_list/app_list_view_delegate.h" | ||
#include "ui/app_list/search_result.h" | ||
#include "ui/app_list/views/search_result_tile_item_view.h" | ||
#include "ui/views/background.h" | ||
#include "ui/views/layout/box_layout.h" | ||
|
||
namespace { | ||
|
||
// Layout constants. | ||
const size_t kNumSearchResultTiles = 5; | ||
const int kTileSpacing = 10; | ||
|
||
} // namespace | ||
|
||
namespace app_list { | ||
|
||
SearchResultTileItemListView::SearchResultTileItemListView() { | ||
SetLayoutManager( | ||
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, kTileSpacing)); | ||
for (size_t i = 0; i < kNumSearchResultTiles; ++i) { | ||
SearchResultTileItemView* tile_item = new SearchResultTileItemView(); | ||
tile_views_.push_back(tile_item); | ||
AddChildView(tile_item); | ||
} | ||
} | ||
|
||
SearchResultTileItemListView::~SearchResultTileItemListView() { | ||
} | ||
|
||
void SearchResultTileItemListView::Update() { | ||
std::vector<SearchResult*> display_results = | ||
AppListModel::FilterSearchResultsByDisplayType( | ||
results(), SearchResult::DISPLAY_TILE, kNumSearchResultTiles); | ||
for (size_t i = 0; i < kNumSearchResultTiles; ++i) { | ||
SearchResult* item = | ||
i < display_results.size() ? display_results[i] : nullptr; | ||
tile_views_[i]->SetSearchResult(item); | ||
} | ||
} | ||
|
||
} // namespace app_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_LIST_VIEW_H_ | ||
#define UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_LIST_VIEW_H_ | ||
|
||
#include <vector> | ||
|
||
#include "base/macros.h" | ||
#include "ui/app_list/views/search_result_container_view.h" | ||
|
||
namespace app_list { | ||
|
||
class SearchResultTileItemView; | ||
|
||
// Displays a list of SearchResultTileItemView. | ||
class APP_LIST_EXPORT SearchResultTileItemListView | ||
: public SearchResultContainerView { | ||
public: | ||
SearchResultTileItemListView(); | ||
~SearchResultTileItemListView() override; | ||
|
||
// Overridden from SearchResultContainerView: | ||
void Update() override; | ||
|
||
private: | ||
std::vector<SearchResultTileItemView*> tile_views_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemListView); | ||
}; | ||
|
||
} // namespace app_list | ||
|
||
#endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_LIST_VIEW_H_ |