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 28f363ec57b1d15114bdfed9ee64a38dca7b5744..c5a799f7444de0a53cc6b91678c10c3cec66389b 100644 |
--- a/ui/app_list/views/search_box_view.cc |
+++ b/ui/app_list/views/search_box_view.cc |
@@ -43,10 +43,6 @@ const int kMenuXOffsetFromButton = -7; |
const int kBackgroundBorderCornerRadius = 2; |
-const int kShadowBlur = 4; |
-const int kShadowYOffset = 2; |
-const SkColor kShadowColor = SkColorSetARGB(0x33, 0, 0, 0); |
- |
// A background that paints a solid white rounded rect with a thin grey border. |
class ExperimentalSearchBoxBackground : public views::Background { |
public: |
@@ -85,8 +81,7 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, |
AddChildView(content_container_); |
if (switches::IsExperimentalAppListEnabled()) { |
- SetBorder(make_scoped_ptr( |
- new views::ShadowBorder(kShadowBlur, kShadowColor, kShadowYOffset, 0))); |
+ SetShadow(GetShadowForZHeight(1)); |
back_button_ = new views::ImageButton(this); |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
back_button_->SetImage( |
@@ -175,10 +170,15 @@ void SearchBoxView::InvalidateMenu() { |
menu_.reset(); |
} |
+void SearchBoxView::SetShadow(const gfx::ShadowValue& shadow) { |
+ SetBorder(make_scoped_ptr(new views::ShadowBorder(shadow))); |
+ Layout(); |
+} |
+ |
gfx::Rect SearchBoxView::GetViewBoundsForSearchBoxContentsBounds( |
const gfx::Rect& rect) const { |
gfx::Rect view_bounds = rect; |
- view_bounds.Inset(GetInsets().Scale(-1)); |
+ view_bounds.Inset(-GetInsets()); |
return view_bounds; |
} |
@@ -201,6 +201,22 @@ void SearchBoxView::OnEnabledChanged() { |
speech_button_->SetEnabled(enabled()); |
} |
+// static |
+gfx::ShadowValue SearchBoxView::GetShadowForZHeight(int z_height) { |
+ if (z_height <= 0) |
+ return gfx::ShadowValue(); |
+ |
+ if (z_height == 1) { |
Matt Giuca
2015/02/06 04:32:27
How about
switch (z_height) {
case 1:
case 2:
calamity
2015/02/06 05:17:51
Kay.
|
+ return gfx::ShadowValue(gfx::Point(0, kCardShadowYOffset), kCardShadowBlur, |
+ kCardShadowColor); |
+ } |
+ |
+ if (z_height == 2) |
+ return gfx::ShadowValue(gfx::Point(0, 2), 4, SkColorSetARGB(0x33, 0, 0, 0)); |
Matt Giuca
2015/02/06 04:32:27
Without going all the way of defining new constant
calamity
2015/02/06 05:17:51
I don't think this necessarily a good idea. How ab
Matt Giuca
2015/02/06 05:42:18
OK move it to app_list_constants and then it's jus
|
+ |
+ return gfx::ShadowValue(gfx::Point(0, 8), 12, SkColorSetARGB(0x3F, 0, 0, 0)); |
Matt Giuca
2015/02/06 04:32:27
Is this ever used?
calamity
2015/02/06 05:17:51
Nope. It's the 'touch' one in the mocks. I guess w
Matt Giuca
2015/02/06 05:42:18
If it's moved to ALC, then just leave this here.
|
+} |
+ |
void SearchBoxView::UpdateModel() { |
// Temporarily remove from observer to ignore notifications caused by us. |
model_->search_box()->RemoveObserver(this); |