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

Unified Diff: athena/home/home_card_impl.cc

Issue 521493002: Cleanup home card shadow code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « no previous file | athena/home/home_card_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/home/home_card_impl.cc
diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc
index 0066cf3d3be8e000d6fe2972df30c5e20fa8b190..1dfadf0ba02c74fb7b4da4e911b003dfabb4fcd7 100644
--- a/athena/home/home_card_impl.cc
+++ b/athena/home/home_card_impl.cc
@@ -165,24 +165,11 @@ class HomeCardView : public views::WidgetDelegateView {
main_view_->SetLayoutState(1.0f - progress);
else if (to_state == HomeCard::VISIBLE_CENTERED)
main_view_->SetLayoutState(progress);
- else
- SetState(to_state);
- }
-
- void SetState(HomeCard::State state) {
- if (state == HomeCard::VISIBLE_CENTERED)
- main_view_->RequestFocusOnSearchBox();
- else
- GetWidget()->GetFocusManager()->ClearFocus();
- wm::SetShadowType(GetWidget()->GetNativeView(),
- state == HomeCard::VISIBLE_MINIMIZED ?
- wm::SHADOW_TYPE_NONE :
- wm::SHADOW_TYPE_RECTANGULAR);
- main_view_->SetLayoutState(
- (state == HomeCard::VISIBLE_CENTERED) ? 1.0f : 0.0f);
+ UpdateShadow(true);
}
void SetStateWithAnimation(HomeCard::State state) {
+ UpdateShadow(state != HomeCard::VISIBLE_MINIMIZED);
if (state == HomeCard::VISIBLE_CENTERED)
main_view_->RequestFocusOnSearchBox();
else
@@ -221,6 +208,12 @@ class HomeCardView : public views::WidgetDelegateView {
}
private:
+ void UpdateShadow(bool should_show) {
+ wm::SetShadowType(
+ GetWidget()->GetNativeWindow(),
+ should_show ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE);
+ }
+
// views::WidgetDelegate:
virtual views::View* GetContentsView() OVERRIDE {
return this;
« no previous file with comments | « no previous file | athena/home/home_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698