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

Side by Side Diff: ui/message_center/views/toast_contents_view.cc

Issue 2016203002: Widget opacity goes from 0 to 1, not 0 to 255. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 6 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
« no previous file with comments | « chrome/browser/ui/views/new_back_shortcut_bubble.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/views/toast_contents_view.h" 5 #include "ui/message_center/views/toast_contents_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 const gfx::Animation* animation) { 192 const gfx::Animation* animation) {
193 if (is_closing_ && closing_animation_ == animation && GetWidget()) { 193 if (is_closing_ && closing_animation_ == animation && GetWidget()) {
194 views::Widget* widget = GetWidget(); 194 views::Widget* widget = GetWidget();
195 195
196 // TODO(dewittj): This is a workaround to prevent a nasty bug where 196 // TODO(dewittj): This is a workaround to prevent a nasty bug where
197 // closing a transparent widget doesn't actually remove the window, 197 // closing a transparent widget doesn't actually remove the window,
198 // causing entire areas of the screen to become unresponsive to clicks. 198 // causing entire areas of the screen to become unresponsive to clicks.
199 // See crbug.com/243469 199 // See crbug.com/243469
200 widget->Hide(); 200 widget->Hide();
201 #if defined(OS_WIN) 201 #if defined(OS_WIN)
202 widget->SetOpacity(0xFF); 202 widget->SetOpacity(1.f);
203 #endif 203 #endif
204 204
205 widget->Close(); 205 widget->Close();
206 } 206 }
207 207
208 // This cannot be called before GetWidget()->Close(). Decrementing defer count 208 // This cannot be called before GetWidget()->Close(). Decrementing defer count
209 // will invoke update, which may invoke another close animation with 209 // will invoke update, which may invoke another close animation with
210 // incrementing defer counter. Close() after such process will cause a 210 // incrementing defer counter. Close() after such process will cause a
211 // mismatch between increment/decrement. See crbug.com/238477 211 // mismatch between increment/decrement. See crbug.com/238477
212 if (collection_) 212 if (collection_)
213 collection_->DecrementDeferCounter(); 213 collection_->DecrementDeferCounter();
214 } 214 }
215 215
216 // gfx::AnimationDelegate 216 // gfx::AnimationDelegate
217 void ToastContentsView::AnimationProgressed(const gfx::Animation* animation) { 217 void ToastContentsView::AnimationProgressed(const gfx::Animation* animation) {
218 if (animation == bounds_animation_.get()) { 218 if (animation == bounds_animation_.get()) {
219 gfx::Rect current(animation->CurrentValueBetween( 219 gfx::Rect current(animation->CurrentValueBetween(
220 animated_bounds_start_, animated_bounds_end_)); 220 animated_bounds_start_, animated_bounds_end_));
221 GetWidget()->SetBounds(current); 221 GetWidget()->SetBounds(current);
222 } else if (animation == fade_animation_.get()) { 222 } else if (animation == fade_animation_.get()) {
223 unsigned char opacity = 223 GetWidget()->SetOpacity(
224 static_cast<unsigned char>(fade_animation_->GetCurrentValue() * 255); 224 static_cast<float>(fade_animation_->GetCurrentValue()));
225 GetWidget()->SetOpacity(opacity);
226 } 225 }
227 } 226 }
228 227
229 void ToastContentsView::AnimationEnded(const gfx::Animation* animation) { 228 void ToastContentsView::AnimationEnded(const gfx::Animation* animation) {
230 OnBoundsAnimationEndedOrCancelled(animation); 229 OnBoundsAnimationEndedOrCancelled(animation);
231 } 230 }
232 231
233 void ToastContentsView::AnimationCanceled( 232 void ToastContentsView::AnimationCanceled(
234 const gfx::Animation* animation) { 233 const gfx::Animation* animation) {
235 OnBoundsAnimationEndedOrCancelled(animation); 234 OnBoundsAnimationEndedOrCancelled(animation);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 380 }
382 381
383 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { 382 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) {
384 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, 383 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth,
385 bounds.y(), 384 bounds.y(),
386 kClosedToastWidth, 385 kClosedToastWidth,
387 bounds.height()); 386 bounds.height());
388 } 387 }
389 388
390 } // namespace message_center 389 } // namespace message_center
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/new_back_shortcut_bubble.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698