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, |