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

Unified Diff: ui/app_list/views/search_box_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/search_box_view.cc
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index 7acba845febcd0d4e5a8ece9eb0d896d608d78c4..064f58705b4b4b8371f445ffc2874107114f99b6 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -10,12 +10,14 @@
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "ui/app_list/app_list_constants.h"
+#include "ui/app_list/app_list_features.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/resources/grit/app_list_resources.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/speech_ui_model.h"
+#include "ui/app_list/views/app_list_view.h"
#include "ui/app_list/views/contents_view.h"
#include "ui/app_list/views/search_box_view_delegate.h"
#include "ui/base/ime/text_input_flags.h"
@@ -33,6 +35,7 @@
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/shadow_border.h"
+#include "ui/views/widget/widget.h"
namespace app_list {
@@ -41,11 +44,13 @@ namespace {
const int kPadding = 16;
const int kInnerPadding = 24;
const int kPreferredWidth = 360;
+const int kPreferredWidthFullscreen = 544;
const int kPreferredHeight = 48;
const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0);
const int kBackgroundBorderCornerRadius = 2;
+const int kBackgroundBorderCornerRadiusFullscreen = 20;
// A background that paints a solid white rounded rect with a thin grey border.
class SearchBoxBackground : public views::Background {
@@ -61,7 +66,11 @@ class SearchBoxBackground : public views::Background {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kSearchBoxBackground);
- canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, flags);
+ canvas->DrawRoundRect(bounds,
+ features::IsFullscreenAppListEnabled()
vadimt 2017/05/22 23:36:58 Is Paint() called frequently enough to start worry
newcomer 2017/05/25 23:10:53 Good question. I'm not sure but I'll ask around. I
vadimt 2017/05/26 01:27:56 And make sure that a SearchBoxBackground instance
newcomer 2017/05/26 23:20:20 They aren't. SearchBoxBackground is created when a
+ ? kBackgroundBorderCornerRadiusFullscreen
+ : kBackgroundBorderCornerRadius,
+ flags);
}
DISALLOW_COPY_AND_ASSIGN(SearchBoxBackground);
@@ -113,7 +122,7 @@ class SearchBoxImageButton : public views::ImageButton {
};
SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
- AppListViewDelegate* view_delegate)
+ AppListViewDelegate* view_delegate )
vadimt 2017/05/22 23:36:58 git cl format . to remove added space
newcomer 2017/05/25 23:10:53 Done.
: delegate_(delegate),
view_delegate_(view_delegate),
model_(NULL),
@@ -122,6 +131,7 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
speech_button_(NULL),
search_box_(new views::Textfield),
contents_view_(NULL),
+ app_list_view_(),
vadimt 2017/05/22 23:36:58 This leaves it uninitialized. Replace with '=nullp
newcomer 2017/05/25 23:10:53 The other pointers are set to NULL in the construc
vadimt 2017/05/26 01:27:56 Just old code. nullptr is a new way, and is my pre
newcomer 2017/05/26 23:20:20 It is now initialized as a constant pointer to the
focused_view_(FOCUS_SEARCH_BOX) {
SetLayoutManager(new views::FillLayout);
AddChildView(content_container_);
@@ -188,6 +198,10 @@ void SearchBoxView::ClearSearch() {
NotifyQueryChanged();
}
+void SearchBoxView::SetAppListView(AppListView* app_list_view) {
+ app_list_view_ = app_list_view;
+}
+
void SearchBoxView::SetShadow(const gfx::ShadowValue& shadow) {
SetBorder(base::MakeUnique<views::ShadowBorder>(shadow));
Layout();
@@ -287,7 +301,10 @@ void SearchBoxView::SetBackButtonLabel(bool folder) {
}
gfx::Size SearchBoxView::GetPreferredSize() const {
- return gfx::Size(kPreferredWidth, kPreferredHeight);
+ return gfx::Size(features::IsFullscreenAppListEnabled()
+ ? kPreferredWidthFullscreen
+ : kPreferredWidth,
+ kPreferredHeight);
}
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
@@ -325,6 +342,12 @@ void SearchBoxView::ContentsChanged(views::Textfield* sender,
UpdateModel();
view_delegate_->AutoLaunchCanceled();
NotifyQueryChanged();
+
+ if (features::IsFullscreenAppListEnabled() &&
+ !app_list_view_->IsFullscreen()) {
+ // If the app list is in the peeking state, switch it to fullscreen.
+ app_list_view_->ToFullscreen();
+ }
}
bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,

Powered by Google App Engine
This is Rietveld 408576698