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

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

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Created 3 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
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 f7a48f5c900e6a2109be35841165c41bc0c2ed68..79af653e593affdbd715da98f11e3e2836efd5f3 100644
--- a/ui/app_list/views/start_page_view.cc
+++ b/ui/app_list/views/start_page_view.cc
@@ -13,8 +13,10 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/app_list/app_list_constants.h"
+#include "ui/app_list/app_list_features.h"
#include "ui/app_list/app_list_item.h"
#include "ui/app_list/app_list_model.h"
+#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/search_result.h"
#include "ui/app_list/views/all_apps_tile_item_view.h"
@@ -41,8 +43,8 @@ namespace {
// Layout constants.
constexpr int kInstantContainerSpacing = 24;
constexpr int kSearchBoxAndTilesSpacing = 35;
-constexpr int kStartPageSearchBoxWidth = 480;
-
+int kStartPageSearchBoxWidth = 480;
vadimt 2017/05/22 23:36:58 constexpr?
newcomer 2017/05/25 23:10:53 Done.
+int kStartPageSearchBoxWidthFullscreen = 544;
// WebView constants.
constexpr int kWebViewWidth = 700;
constexpr int kWebViewHeight = 224;
@@ -60,7 +62,10 @@ constexpr int kLauncherPageBackgroundWidth = 400;
class SearchBoxSpacerView : public views::View {
public:
explicit SearchBoxSpacerView(const gfx::Size& search_box_size)
- : size_(kStartPageSearchBoxWidth, search_box_size.height()) {}
+ : size_(features::IsFullscreenAppListEnabled()
+ ? kStartPageSearchBoxWidthFullscreen
+ : kStartPageSearchBoxWidth,
+ search_box_size.height()) {}
~SearchBoxSpacerView() override {}
@@ -156,7 +161,10 @@ StartPageView::StartPageTilesContainer::StartPageTilesContainer(
views::Background::CreateSolidBackground(kLabelBackgroundColor));
all_apps_button_->SetHoverStyle(TileItemView::HOVER_STYLE_ANIMATE_SHADOW);
all_apps_button_->SetParentBackgroundColor(kLabelBackgroundColor);
- CreateAppsGrid(kNumStartPageTiles);
+ if (features::IsFullscreenAppListEnabled())
vadimt 2017/05/22 23:36:58 Move condition into param calculation as a ternary
newcomer 2017/05/25 23:10:53 Done.
+ CreateAppsGrid(fullscreen_constants::kNumStartPageTiles);
+ else
+ CreateAppsGrid(kNumStartPageTiles);
}
StartPageView::StartPageTilesContainer::~StartPageTilesContainer() {
@@ -250,6 +258,9 @@ void StartPageView::StartPageTilesContainer::CreateAppsGrid(int apps_num) {
int i = 0;
search_result_tile_views_.reserve(apps_num);
for (; i < apps_num; ++i) {
+ if (features::IsFullscreenAppListEnabled() && i == 5) {
vadimt 2017/05/22 23:36:58 Const for 5.
xiyuan 2017/05/24 18:28:18 Make |apps_num| 5 somehow (either here or at call
newcomer 2017/05/25 23:10:53 Done! I think I left this in by accident while exp
newcomer 2017/05/25 23:10:53 Done.
+ break;
+ }
SearchResultTileItemView* tile_item =
new SearchResultTileItemView(this, view_delegate_);
if (i % kNumStartPageTilesCols == 0)
@@ -261,10 +272,19 @@ void StartPageView::StartPageTilesContainer::CreateAppsGrid(int apps_num) {
search_result_tile_views_.emplace_back(tile_item);
}
- // Also add a special "all apps" button to the end of the container.
all_apps_button_->UpdateIcon();
- if (i % kNumStartPageTilesCols == 0)
+ if (features::IsFullscreenAppListEnabled()) {
+ // Also add a special "all apps" button to the middle of the next row of the
+ // container.
tiles_layout_manager->StartRow(0, 0);
+ tiles_layout_manager->SkipColumns(3);
vadimt 2017/05/22 23:36:58 ... and 3
newcomer 2017/05/25 23:10:53 Done.
+ } else {
+ // Also add a special "all apps" button to the end of the next row of the
+ // container.
+ if (i % kNumStartPageTilesCols == 0)
+ tiles_layout_manager->StartRow(0, 0);
+ }
+
tiles_layout_manager->AddView(all_apps_button_);
AddChildView(all_apps_button_);
}
@@ -290,7 +310,6 @@ StartPageView::StartPageView(AppListMainView* app_list_main_view,
// The view containing the start page tiles.
AddChildView(tiles_container_);
-
AddChildView(custom_launcher_page_background_);
tiles_container_->SetResults(view_delegate_->GetModel()->results());
@@ -310,11 +329,16 @@ void StartPageView::InitInstantContainer() {
views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
instant_container_->SetLayoutManager(instant_layout_manager);
- views::View* web_view = view_delegate_->CreateStartPageWebView(
- gfx::Size(kWebViewWidth, kWebViewHeight));
- if (web_view) {
- web_view->SetFocusBehavior(FocusBehavior::NEVER);
- instant_container_->AddChildView(web_view);
+ // Create the view for the Google Doodle if the fullscreen launcher is not
+ // enabled.
+ if (!features::IsFullscreenAppListEnabled()) {
+ views::View* web_view = view_delegate_->CreateStartPageWebView(
+ gfx::Size(kWebViewWidth, kWebViewHeight));
+
+ if (web_view) {
+ web_view->SetFocusBehavior(FocusBehavior::NEVER);
+ instant_container_->AddChildView(web_view);
+ }
}
instant_container_->AddChildView(search_box_spacer_view_);
« ui/app_list/views/search_box_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