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

Unified Diff: ui/app_list/views/start_page_view.cc

Issue 307333002: Add search results to experimental app list start page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« ui/app_list/views/contents_view.cc ('K') | « ui/app_list/views/start_page_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/start_page_view.cc
diff --git a/ui/app_list/views/start_page_view.cc b/ui/app_list/views/start_page_view.cc
index 7cff74e209e108213813c00cc7b836fd3cc266d4..e93d6b5b79525ec21fbf34252438065b7b0bd2b9 100644
--- a/ui/app_list/views/start_page_view.cc
+++ b/ui/app_list/views/start_page_view.cc
@@ -11,6 +11,7 @@
#include "ui/app_list/app_list_model.h"
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/views/app_list_main_view.h"
+#include "ui/app_list/views/search_result_list_view.h"
#include "ui/app_list/views/tile_item_view.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/button/custom_button.h"
@@ -78,15 +79,16 @@ StartPageView::StartPageView(AppListMainView* app_list_main_view,
: app_list_main_view_(app_list_main_view),
model_(NULL),
view_delegate_(view_delegate),
+ results_view_(
+ new SearchResultListView(app_list_main_view, view_delegate)),
instant_container_(new views::View),
tiles_container_(new views::View) {
- SetLayoutManager(new views::BoxLayout(
- views::BoxLayout::kVertical, 0, kTopMargin, kInstantContainerSpacing));
-
// The view containing the start page WebContents and the BarPlaceholder.
AddChildView(instant_container_);
views::BoxLayout* instant_layout_manager = new views::BoxLayout(
views::BoxLayout::kVertical, 0, 0, kInstantContainerSpacing);
+ instant_layout_manager->set_inside_border_insets(
+ gfx::Insets(kTopMargin, 0, kInstantContainerSpacing, 0));
instant_layout_manager->set_main_axis_alignment(
views::BoxLayout::MAIN_AXIS_ALIGNMENT_END);
instant_container_->SetLayoutManager(instant_layout_manager);
@@ -102,6 +104,9 @@ StartPageView::StartPageView(AppListMainView* app_list_main_view,
instant_container_->AddChildView(web_view);
instant_container_->AddChildView(new BarPlaceholderButton(this));
+ // The view containing the search results.
+ AddChildView(results_view_);
+
// The view containing the start page tiles.
AddChildView(tiles_container_);
views::BoxLayout* tiles_layout_manager =
@@ -129,11 +134,13 @@ void StartPageView::SetModel(AppListModel* model) {
model_->RemoveObserver(this);
model_ = model;
model_->AddObserver(this);
+ results_view_->SetResults(model_->results());
Reset();
}
void StartPageView::Reset() {
instant_container_->SetVisible(true);
+ results_view_->SetVisible(false);
if (!model_ || !model_->top_level_item_list())
return;
@@ -143,8 +150,33 @@ void StartPageView::Reset() {
item = model_->top_level_item_list()->item_at(i);
tile_views_[i]->SetAppListItem(item);
}
+}
+
+void StartPageView::ShowSearchResults() {
+ instant_container_->SetVisible(false);
+ results_view_->SetVisible(true);
+ results_view_->SetSelectedIndex(0);
+ results_view_->UpdateAutoLaunchState();
+}
+
+bool StartPageView::OnKeyPressed(const ui::KeyEvent& event) {
+ if (results_view_->visible())
+ return results_view_->OnKeyPressed(event);
tapted 2014/06/04 06:12:43 this seems a bit odd here and might have accessibi
calamity 2014/06/12 05:16:56 The SearchResultListView sends accessibility event
+
+ return false;
+}
- Layout();
+void StartPageView::Layout() {
+ // Instant and search results take up the height of the instant container.
+ gfx::Rect bounds(GetContentsBounds());
+ bounds.set_height(instant_container_->GetHeightForWidth(bounds.width()));
+ instant_container_->SetBoundsRect(bounds);
+ results_view_->SetBoundsRect(bounds);
+
+ // Tiles begin where the instant container ends.
+ bounds.set_y(bounds.bottom());
+ bounds.set_height(tiles_container_->GetHeightForWidth(bounds.width()));
+ tiles_container_->SetBoundsRect(bounds);
}
void StartPageView::ButtonPressed(views::Button* sender,
« ui/app_list/views/contents_view.cc ('K') | « ui/app_list/views/start_page_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698