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

Side by Side Diff: chrome/browser/ui/views/new_back_shortcut_bubble.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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/ui/views/new_back_shortcut_bubble.h" 5 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 animation_->Show(); 78 animation_->Show();
79 79
80 // Wait a few seconds before hiding. 80 // Wait a few seconds before hiding.
81 hide_timeout_.Start(FROM_HERE, 81 hide_timeout_.Start(FROM_HERE,
82 base::TimeDelta::FromMilliseconds(kShowDurationMs), this, 82 base::TimeDelta::FromMilliseconds(kShowDurationMs), this,
83 &NewBackShortcutBubble::OnTimerElapsed); 83 &NewBackShortcutBubble::OnTimerElapsed);
84 } 84 }
85 85
86 void NewBackShortcutBubble::AnimationProgressed( 86 void NewBackShortcutBubble::AnimationProgressed(
87 const gfx::Animation* animation) { 87 const gfx::Animation* animation) {
88 int opacity = animation_->CurrentValueBetween(0, 255); 88 float opacity = static_cast<float>(animation_->CurrentValueBetween(0.0, 1.0));
89 if (opacity == 0) { 89 if (opacity == 0) {
90 popup_->Hide(); 90 popup_->Hide();
91 } else { 91 } else {
92 if (!popup_->IsVisible()) 92 if (!popup_->IsVisible())
93 popup_->Show(); 93 popup_->Show();
94 94
95 popup_->SetOpacity(opacity); 95 popup_->SetOpacity(opacity);
96 } 96 }
97 } 97 }
98 98
(...skipping 10 matching lines...) Expand all
109 int desired_top = kPopupTopPx - view_->border()->GetInsets().top(); 109 int desired_top = kPopupTopPx - view_->border()->GetInsets().top();
110 int y = widget_bounds.y() + desired_top; 110 int y = widget_bounds.y() + desired_top;
111 return gfx::Rect(gfx::Point(x, y), size); 111 return gfx::Rect(gfx::Point(x, y), size);
112 } 112 }
113 113
114 void NewBackShortcutBubble::OnTimerElapsed() { 114 void NewBackShortcutBubble::OnTimerElapsed() {
115 // Hide the bubble. 115 // Hide the bubble.
116 animation_->SetSlideDuration(kSlideOutDurationMs); 116 animation_->SetSlideDuration(kSlideOutDurationMs);
117 animation_->Hide(); 117 animation_->Hide();
118 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_started_animation_views.cc ('k') | ui/message_center/views/toast_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698