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

Side by Side Diff: ui/app_list/views/start_page_view.cc

Issue 2960123002: Revert of Replace AllAppsTileItemView with ArrowExpandView (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/app_list/views/start_page_view.h ('k') | ui/app_list/views/suggestions_container_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "ui/accessibility/ax_node_data.h" 14 #include "ui/accessibility/ax_node_data.h"
15 #include "ui/app_list/app_list_constants.h" 15 #include "ui/app_list/app_list_constants.h"
16 #include "ui/app_list/app_list_features.h" 16 #include "ui/app_list/app_list_features.h"
17 #include "ui/app_list/app_list_item.h" 17 #include "ui/app_list/app_list_item.h"
18 #include "ui/app_list/app_list_model.h" 18 #include "ui/app_list/app_list_model.h"
19 #include "ui/app_list/app_list_switches.h" 19 #include "ui/app_list/app_list_switches.h"
20 #include "ui/app_list/app_list_view_delegate.h" 20 #include "ui/app_list/app_list_view_delegate.h"
21 #include "ui/app_list/search_result.h" 21 #include "ui/app_list/search_result.h"
22 #include "ui/app_list/views/all_apps_tile_item_view.h" 22 #include "ui/app_list/views/all_apps_tile_item_view.h"
23 #include "ui/app_list/views/app_list_main_view.h" 23 #include "ui/app_list/views/app_list_main_view.h"
24 #include "ui/app_list/views/contents_view.h" 24 #include "ui/app_list/views/contents_view.h"
25 #include "ui/app_list/views/custom_launcher_page_view.h" 25 #include "ui/app_list/views/custom_launcher_page_view.h"
26 #include "ui/app_list/views/expand_arrow_view.h"
27 #include "ui/app_list/views/indicator_chip_view.h" 26 #include "ui/app_list/views/indicator_chip_view.h"
28 #include "ui/app_list/views/search_box_view.h" 27 #include "ui/app_list/views/search_box_view.h"
29 #include "ui/app_list/views/search_result_container_view.h" 28 #include "ui/app_list/views/search_result_container_view.h"
30 #include "ui/app_list/views/search_result_tile_item_view.h" 29 #include "ui/app_list/views/search_result_tile_item_view.h"
31 #include "ui/app_list/views/suggestions_container_view.h" 30 #include "ui/app_list/views/suggestions_container_view.h"
32 #include "ui/app_list/views/tile_item_view.h" 31 #include "ui/app_list/views/tile_item_view.h"
33 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/gfx/canvas.h" 33 #include "ui/gfx/canvas.h"
35 #include "ui/gfx/geometry/insets.h" 34 #include "ui/gfx/geometry/insets.h"
36 #include "ui/strings/grit/ui_strings.h" 35 #include "ui/strings/grit/ui_strings.h"
(...skipping 13 matching lines...) Expand all
50 constexpr int kInstantContainerSpacing = 24; 49 constexpr int kInstantContainerSpacing = 24;
51 constexpr int kSearchBoxAndTilesSpacing = 35; 50 constexpr int kSearchBoxAndTilesSpacing = 35;
52 constexpr int kSearchBoxAndIndicatorSpacing = 21; 51 constexpr int kSearchBoxAndIndicatorSpacing = 21;
53 constexpr int kStartPageSearchBoxWidth = 480; 52 constexpr int kStartPageSearchBoxWidth = 480;
54 constexpr int kStartPageSearchBoxWidthFullscreen = 544; 53 constexpr int kStartPageSearchBoxWidthFullscreen = 544;
55 54
56 // WebView constants. 55 // WebView constants.
57 constexpr int kWebViewWidth = 700; 56 constexpr int kWebViewWidth = 700;
58 constexpr int kWebViewHeight = 224; 57 constexpr int kWebViewHeight = 224;
59 58
60 constexpr int kExpandArrowTopPadding = 28;
61 constexpr int kLauncherPageBackgroundWidth = 400; 59 constexpr int kLauncherPageBackgroundWidth = 400;
62 60
63 } // namespace 61 } // namespace
64 62
65 class CustomLauncherPageBackgroundView : public views::View { 63 class CustomLauncherPageBackgroundView : public views::View {
66 public: 64 public:
67 explicit CustomLauncherPageBackgroundView( 65 explicit CustomLauncherPageBackgroundView(
68 const std::string& custom_launcher_page_name) 66 const std::string& custom_launcher_page_name)
69 : selected_(false), 67 : selected_(false),
70 custom_launcher_page_name_(custom_launcher_page_name) { 68 custom_launcher_page_name_(custom_launcher_page_name) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 AddChildView(instant_container_); 118 AddChildView(instant_container_);
121 119
122 if (is_fullscreen_app_list_enabled_) { 120 if (is_fullscreen_app_list_enabled_) {
123 indicator_ = new IndicatorChipView( 121 indicator_ = new IndicatorChipView(
124 l10n_util::GetStringUTF16(IDS_SUGGESTED_APPS_INDICATOR)); 122 l10n_util::GetStringUTF16(IDS_SUGGESTED_APPS_INDICATOR));
125 AddChildView(indicator_); 123 AddChildView(indicator_);
126 } 124 }
127 125
128 // The view containing the start page tiles. 126 // The view containing the start page tiles.
129 AddChildView(suggestions_container_); 127 AddChildView(suggestions_container_);
130 if (is_fullscreen_app_list_enabled_) {
131 expand_arrow_view_ = new ExpandArrowView(
132 app_list_main_view_->contents_view(), app_list_view);
133 AddChildView(expand_arrow_view_);
134 }
135 AddChildView(custom_launcher_page_background_); 128 AddChildView(custom_launcher_page_background_);
136 129
137 suggestions_container_->SetResults(view_delegate_->GetModel()->results()); 130 suggestions_container_->SetResults(view_delegate_->GetModel()->results());
138 } 131 }
139 132
140 StartPageView::~StartPageView() = default; 133 StartPageView::~StartPageView() = default;
141 134
142 void StartPageView::InitInstantContainer() { 135 void StartPageView::InitInstantContainer() {
143 views::BoxLayout* instant_layout_manager = new views::BoxLayout( 136 views::BoxLayout* instant_layout_manager = new views::BoxLayout(
144 views::BoxLayout::kVertical, gfx::Insets(), kInstantContainerSpacing); 137 views::BoxLayout::kVertical, gfx::Insets(), kInstantContainerSpacing);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 bounds.Inset(0, indicator_->GetPreferredSize().height(), 0, 0); 238 bounds.Inset(0, indicator_->GetPreferredSize().height(), 0, 0);
246 } 239 }
247 bounds.set_height(suggestions_container_->GetHeightForWidth(bounds.width())); 240 bounds.set_height(suggestions_container_->GetHeightForWidth(bounds.width()));
248 if (is_fullscreen_app_list_enabled_) { 241 if (is_fullscreen_app_list_enabled_) {
249 bounds.Offset((bounds.width() - kGridTileWidth) / 2 - 242 bounds.Offset((bounds.width() - kGridTileWidth) / 2 -
250 (kGridTileWidth + kGridTileSpacing) * 2, 243 (kGridTileWidth + kGridTileSpacing) * 2,
251 0); 244 0);
252 } 245 }
253 suggestions_container_->SetBoundsRect(bounds); 246 suggestions_container_->SetBoundsRect(bounds);
254 247
255 if (expand_arrow_view_) {
256 gfx::Rect expand_arrow_rect(GetContentsBounds());
257 int left_right_padding =
258 (bounds.width() - expand_arrow_view_->GetPreferredSize().width()) / 2;
259
260 expand_arrow_rect.Inset(left_right_padding, 0, left_right_padding, 0);
261 expand_arrow_rect.set_y(bounds.bottom() + kExpandArrowTopPadding);
262 expand_arrow_rect.set_height(
263 expand_arrow_view_->GetPreferredSize().height());
264 expand_arrow_view_->SetBoundsRect(expand_arrow_rect);
265 }
266
267 CustomLauncherPageView* custom_launcher_page_view = 248 CustomLauncherPageView* custom_launcher_page_view =
268 app_list_main_view_->contents_view()->custom_page_view(); 249 app_list_main_view_->contents_view()->custom_page_view();
269 if (!custom_launcher_page_view) 250 if (!custom_launcher_page_view)
270 return; 251 return;
271 252
272 bounds = app_list_main_view_->contents_view() 253 bounds = app_list_main_view_->contents_view()
273 ->custom_page_view() 254 ->custom_page_view()
274 ->GetCollapsedLauncherPageBounds(); 255 ->GetCollapsedLauncherPageBounds();
275 bounds.Intersect(GetContentsBounds()); 256 bounds.Intersect(GetContentsBounds());
276 bounds.ClampToCenteredSize( 257 bounds.ClampToCenteredSize(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // is enabled). 384 // is enabled).
404 if (event->type() == ui::ET_SCROLL && event->y_offset() < 0) 385 if (event->type() == ui::ET_SCROLL && event->y_offset() < 0)
405 MaybeOpenCustomLauncherPage(); 386 MaybeOpenCustomLauncherPage();
406 } 387 }
407 388
408 TileItemView* StartPageView::GetTileItemView(size_t index) { 389 TileItemView* StartPageView::GetTileItemView(size_t index) {
409 return suggestions_container_->GetTileItemView(index); 390 return suggestions_container_->GetTileItemView(index);
410 } 391 }
411 392
412 } // namespace app_list 393 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/start_page_view.h ('k') | ui/app_list/views/suggestions_container_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698