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

Side by Side Diff: ash/system/tray/tray_background_view.cc

Issue 10878068: Replace Ash web notification tray view with a button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/tray/tray_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include "ash/launcher/background_animator.h" 7 #include "ash/launcher/background_animator.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/status_area_widget.h" 10 #include "ash/system/status_area_widget.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 layout->set_spread_blank_space(true); 145 layout->set_spread_blank_space(true);
146 views::View::SetLayoutManager(layout); 146 views::View::SetLayoutManager(layout);
147 } 147 }
148 PreferredSizeChanged(); 148 PreferredSizeChanged();
149 } 149 }
150 150
151 //////////////////////////////////////////////////////////////////////////////// 151 ////////////////////////////////////////////////////////////////////////////////
152 // TrayBackgroundView 152 // TrayBackgroundView
153 153
154 TrayBackgroundView::TrayBackgroundView( 154 TrayBackgroundView::TrayBackgroundView(
155 internal::StatusAreaWidget* status_area_widget) 155 internal::StatusAreaWidget* status_area_widget,
156 bool set_background)
156 : status_area_widget_(status_area_widget), 157 : status_area_widget_(status_area_widget),
157 tray_container_(NULL), 158 tray_container_(NULL),
158 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), 159 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM),
159 background_(NULL), 160 background_(NULL),
160 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_( 161 ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(
161 this, 0, kTrayBackgroundAlpha)), 162 this, 0, kTrayBackgroundAlpha)),
162 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_( 163 ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_(
163 this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)), 164 this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)),
164 ALLOW_THIS_IN_INITIALIZER_LIST(layer_animation_observer_( 165 ALLOW_THIS_IN_INITIALIZER_LIST(layer_animation_observer_(
165 new TrayLayerAnimationObserver(this))) { 166 new TrayLayerAnimationObserver(this))) {
166 set_notify_enter_exit_on_child(true); 167 set_notify_enter_exit_on_child(true);
167 168
168 // Initially we want to paint the background, but without the hover effect. 169 // Initially we want to paint the background, but without the hover effect.
169 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE); 170 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE);
170 hover_background_animator_.SetPaintsBackground(false, 171 hover_background_animator_.SetPaintsBackground(false,
171 internal::BackgroundAnimator::CHANGE_IMMEDIATE); 172 internal::BackgroundAnimator::CHANGE_IMMEDIATE);
172 173
173 tray_container_ = new TrayContainer(shelf_alignment_); 174 tray_container_ = new TrayContainer(shelf_alignment_);
174 SetContents(tray_container_); 175 SetContents(tray_container_, set_background);
175 } 176 }
176 177
177 TrayBackgroundView::~TrayBackgroundView() { 178 TrayBackgroundView::~TrayBackgroundView() {
178 if (GetWidget()) { 179 if (GetWidget()) {
179 GetWidget()->GetNativeView()->layer()->GetAnimator()->RemoveObserver( 180 GetWidget()->GetNativeView()->layer()->GetAnimator()->RemoveObserver(
180 layer_animation_observer_.get()); 181 layer_animation_observer_.get());
181 } 182 }
182 } 183 }
183 184
184 void TrayBackgroundView::Initialize() { 185 void TrayBackgroundView::Initialize() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 229 }
229 230
230 void TrayBackgroundView::UpdateBackground(int alpha) { 231 void TrayBackgroundView::UpdateBackground(int alpha) {
231 if (background_) { 232 if (background_) {
232 background_->set_alpha(hide_background_animator_.alpha() + 233 background_->set_alpha(hide_background_animator_.alpha() +
233 hover_background_animator_.alpha()); 234 hover_background_animator_.alpha());
234 } 235 }
235 SchedulePaint(); 236 SchedulePaint();
236 } 237 }
237 238
238 void TrayBackgroundView::SetContents(views::View* contents) { 239 void TrayBackgroundView::SetContents(views::View* contents,
239 background_ = new internal::TrayBackground; 240 bool set_background) {
240 contents->set_background(background_); 241 if (set_background) {
242 background_ = new internal::TrayBackground;
243 contents->set_background(background_);
244 }
241 245
242 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 246 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
243 AddChildView(contents); 247 AddChildView(contents);
244 } 248 }
245 249
246 void TrayBackgroundView::SetPaintsBackground( 250 void TrayBackgroundView::SetPaintsBackground(
247 bool value, 251 bool value,
248 internal::BackgroundAnimator::ChangeType change_type) { 252 internal::BackgroundAnimator::ChangeType change_type) {
249 hide_background_animator_.SetPaintsBackground(value, change_type); 253 hide_background_animator_.SetPaintsBackground(value, change_type);
250 } 254 }
(...skipping 25 matching lines...) Expand all
276 kPaddingFromOuterEdgeOfLauncherVerticalAlignment)); 280 kPaddingFromOuterEdgeOfLauncherVerticalAlignment));
277 } 281 }
278 } 282 }
279 283
280 void TrayBackgroundView::UpdateShouldShowLauncher() { 284 void TrayBackgroundView::UpdateShouldShowLauncher() {
281 status_area_widget()->UpdateShouldShowLauncher(); 285 status_area_widget()->UpdateShouldShowLauncher();
282 } 286 }
283 287
284 } // namespace internal 288 } // namespace internal
285 } // namespace ash 289 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698