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 7f0c4bed1f50fcac6b2426981cc8881fc8a5c9a1..6505375e21e8a6be95cb9d767be91abadd508adf 100644 |
--- a/ui/app_list/views/search_box_view.cc |
+++ b/ui/app_list/views/search_box_view.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#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_box_model.h" |
#include "ui/app_list/speech_ui_model.h" |
@@ -14,6 +15,7 @@ |
#include "ui/app_list/views/search_box_view_delegate.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/events/event.h" |
+#include "ui/gfx/canvas.h" |
#include "ui/resources/grit/ui_resources.h" |
#include "ui/views/border.h" |
#include "ui/views/controls/button/image_button.h" |
@@ -39,6 +41,40 @@ const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); |
const int kMenuYOffsetFromButton = -4; |
const int kMenuXOffsetFromButton = -7; |
+// Experimental app list constants. |
+const int kExperimentalSearchBoxHeight = 37; |
+ |
+const int kExperimentalBorderWidth = 1; |
+const int kExperimentalBorderBottomWidth = 2; |
+const int kExperimentalBorderCornerRadius = 2; |
+const SkColor kExperimentalBorderColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); |
+ |
+// A background that paints a solid white rounded rect with a thin grey border. |
+class ExperimentalBackground : public views::Background { |
Matt Giuca
2014/08/25 05:15:25
Same here: Call this BorderedBackground or similar
calamity
2014/08/26 01:16:30
Done. I don't think the comment will be necessary.
|
+ public: |
+ ExperimentalBackground() {} |
+ virtual ~ExperimentalBackground() {} |
+ |
+ private: |
+ // views::Background overrides: |
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { |
+ gfx::Rect bounds = view->GetContentsBounds(); |
+ |
+ SkPaint paint; |
+ paint.setFlags(SkPaint::kAntiAlias_Flag); |
+ paint.setColor(kExperimentalBorderColor); |
+ canvas->DrawRoundRect(bounds, kExperimentalBorderCornerRadius, paint); |
+ bounds.Inset(kExperimentalBorderWidth, |
+ kExperimentalBorderWidth, |
+ kExperimentalBorderWidth, |
+ kExperimentalBorderBottomWidth); |
+ paint.setColor(SK_ColorWHITE); |
+ canvas->DrawRoundRect(bounds, kExperimentalBorderCornerRadius, paint); |
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExperimentalBackground); |
+}; |
+ |
} // namespace |
SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, |
@@ -51,6 +87,8 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, |
search_box_(new views::Textfield), |
contents_view_(NULL) { |
AddChildView(icon_view_); |
+ if (switches::IsExperimentalAppListEnabled()) |
+ set_background(new ExperimentalBackground()); |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
@@ -111,7 +149,10 @@ void SearchBoxView::InvalidateMenu() { |
} |
gfx::Size SearchBoxView::GetPreferredSize() const { |
- return gfx::Size(kPreferredWidth, kPreferredHeight); |
+ return gfx::Size(kPreferredWidth, |
+ switches::IsExperimentalAppListEnabled() |
+ ? kExperimentalSearchBoxHeight |
+ : kPreferredHeight); |
} |
void SearchBoxView::Layout() { |