| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/app_list/views/start_page_view.h" | 5 #include "ui/app_list/views/start_page_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/app_list/app_list_constants.h" | 8 #include "ui/app_list/app_list_constants.h" |
| 9 #include "ui/app_list/app_list_item.h" | 9 #include "ui/app_list/app_list_item.h" |
| 10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 views::BoxLayout* tiles_layout_manager = | 122 views::BoxLayout* tiles_layout_manager = |
| 123 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, kTileSpacing); | 123 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, kTileSpacing); |
| 124 tiles_layout_manager->set_main_axis_alignment( | 124 tiles_layout_manager->set_main_axis_alignment( |
| 125 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 125 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
| 126 tiles_container_->SetLayoutManager(tiles_layout_manager); | 126 tiles_container_->SetLayoutManager(tiles_layout_manager); |
| 127 | 127 |
| 128 // Add SearchResultTileItemViews to the container. | 128 // Add SearchResultTileItemViews to the container. |
| 129 for (size_t i = 0; i < kNumStartPageTiles; ++i) { | 129 for (size_t i = 0; i < kNumStartPageTiles; ++i) { |
| 130 SearchResultTileItemView* tile_item = new SearchResultTileItemView(); | 130 SearchResultTileItemView* tile_item = new SearchResultTileItemView(); |
| 131 tiles_container_->AddChildView(tile_item); | 131 tiles_container_->AddChildView(tile_item); |
| 132 tile_item->SetTitleBackgroundColor(kLabelBackgroundColor); |
| 132 search_result_tile_views_.push_back(tile_item); | 133 search_result_tile_views_.push_back(tile_item); |
| 133 } | 134 } |
| 134 | 135 |
| 135 // Also add a special "all apps" button to the end of the container. | 136 // Also add a special "all apps" button to the end of the container. |
| 136 all_apps_button_ = new AllAppsTileItemView( | 137 all_apps_button_ = new AllAppsTileItemView( |
| 137 app_list_main_view_->contents_view(), | 138 app_list_main_view_->contents_view(), |
| 138 view_delegate_->GetModel()->top_level_item_list()); | 139 view_delegate_->GetModel()->top_level_item_list()); |
| 139 all_apps_button_->UpdateIcon(); | 140 all_apps_button_->UpdateIcon(); |
| 141 all_apps_button_->SetTitleBackgroundColor(kLabelBackgroundColor); |
| 140 tiles_container_->AddChildView(all_apps_button_); | 142 tiles_container_->AddChildView(all_apps_button_); |
| 141 } | 143 } |
| 142 | 144 |
| 143 void StartPageView::Reset() { | 145 void StartPageView::Reset() { |
| 144 // This can be called when the app list is closing (widget is invisible). In | 146 // This can be called when the app list is closing (widget is invisible). In |
| 145 // that case, do not steal focus from other elements. | 147 // that case, do not steal focus from other elements. |
| 146 if (GetWidget() && GetWidget()->IsVisible()) | 148 if (GetWidget() && GetWidget()->IsVisible()) |
| 147 search_box_view_->search_box()->RequestFocus(); | 149 search_box_view_->search_box()->RequestFocus(); |
| 148 | 150 |
| 149 search_box_view_->ClearSearch(); | 151 search_box_view_->ClearSearch(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 191 |
| 190 void StartPageView::QueryChanged(SearchBoxView* sender) { | 192 void StartPageView::QueryChanged(SearchBoxView* sender) { |
| 191 // Forward the search terms on to the real search box and clear the dummy | 193 // Forward the search terms on to the real search box and clear the dummy |
| 192 // search box. | 194 // search box. |
| 193 app_list_main_view_->OnStartPageSearchTextfieldChanged( | 195 app_list_main_view_->OnStartPageSearchTextfieldChanged( |
| 194 sender->search_box()->text()); | 196 sender->search_box()->text()); |
| 195 sender->search_box()->SetText(base::string16()); | 197 sender->search_box()->SetText(base::string16()); |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace app_list | 200 } // namespace app_list |
| OLD | NEW |