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

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button.cc

Issue 2901503003: Rename GetPreferredSize to CalculatePreferredSize in ash/ (Closed)
Patch Set: Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/frame/caption_buttons/frame_caption_button.h" 5 #include "ash/frame/caption_buttons/frame_caption_button.h"
6 6
7 #include "ui/gfx/animation/slide_animation.h" 7 #include "ui/gfx/animation/slide_animation.h"
8 #include "ui/gfx/animation/throb_animation.h" 8 #include "ui/gfx/animation/throb_animation.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/color_palette.h" 10 #include "ui/gfx/color_palette.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return swap_images_animation_->is_animating(); 90 return swap_images_animation_->is_animating();
91 } 91 }
92 92
93 void FrameCaptionButton::SetAlpha(int alpha) { 93 void FrameCaptionButton::SetAlpha(int alpha) {
94 if (alpha_ != alpha) { 94 if (alpha_ != alpha) {
95 alpha_ = alpha; 95 alpha_ = alpha;
96 SchedulePaint(); 96 SchedulePaint();
97 } 97 }
98 } 98 }
99 99
100 gfx::Size FrameCaptionButton::GetPreferredSize() const { 100 gfx::Size FrameCaptionButton::CalculatePreferredSize() const {
101 return size_; 101 return size_;
102 } 102 }
103 103
104 const char* FrameCaptionButton::GetClassName() const { 104 const char* FrameCaptionButton::GetClassName() const {
105 return kViewClassName; 105 return kViewClassName;
106 } 106 }
107 107
108 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) { 108 void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) {
109 SkAlpha bg_alpha = SK_AlphaTRANSPARENT; 109 SkAlpha bg_alpha = SK_AlphaTRANSPARENT;
110 if (hover_animation().is_animating()) 110 if (hover_animation().is_animating())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (hover_animation().is_animating()) { 181 if (hover_animation().is_animating()) {
182 inactive_alpha = 182 inactive_alpha =
183 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); 183 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f);
184 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { 184 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) {
185 inactive_alpha = 1.0f; 185 inactive_alpha = 1.0f;
186 } 186 }
187 return base_alpha * inactive_alpha; 187 return base_alpha * inactive_alpha;
188 } 188 }
189 189
190 } // namespace ash 190 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698