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

Side by Side Diff: chrome/browser/ui/views/download/download_started_animation_views.cc

Issue 2009333002: Converts Widget::SetOpacity from char to float (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | chrome/browser/ui/views/exclusive_access_bubble_views.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) 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 "chrome/browser/download/download_started_animation.h" 5 #include "chrome/browser/download/download_started_animation.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
9 #include "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 popup_->Close(); 106 popup_->Close();
107 } 107 }
108 108
109 void DownloadStartedAnimationViews::AnimateToState(double state) { 109 void DownloadStartedAnimationViews::AnimateToState(double state) {
110 if (state >= 1.0) { 110 if (state >= 1.0) {
111 Close(); 111 Close();
112 } else { 112 } else {
113 Reposition(); 113 Reposition();
114 114
115 // Start at zero, peak halfway and end at zero. 115 // Start at zero, peak halfway and end at zero.
116 double opacity = std::min(1.0 - pow(GetCurrentValue() - 0.5, 2) * 4.0, 116 popup_->SetOpacity(static_cast<float>(
117 static_cast<double>(1.0)); 117 std::min(1.0 - pow(GetCurrentValue() - 0.5, 2) * 4.0, 1.0)));
118
119 popup_->SetOpacity(static_cast<unsigned char>(opacity * 255.0));
120 } 118 }
121 } 119 }
122 120
123 } // namespace 121 } // namespace
124 122
125 // static 123 // static
126 void DownloadStartedAnimation::Show(content::WebContents* web_contents) { 124 void DownloadStartedAnimation::Show(content::WebContents* web_contents) {
127 // The animation will delete itself when it's finished. 125 // The animation will delete itself when it's finished.
128 new DownloadStartedAnimationViews(web_contents); 126 new DownloadStartedAnimationViews(web_contents);
129 } 127 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/exclusive_access_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698