| Index: mash/wm/frame/caption_buttons/frame_caption_button.cc
|
| diff --git a/ash/frame/caption_buttons/frame_caption_button.cc b/mash/wm/frame/caption_buttons/frame_caption_button.cc
|
| similarity index 85%
|
| copy from ash/frame/caption_buttons/frame_caption_button.cc
|
| copy to mash/wm/frame/caption_buttons/frame_caption_button.cc
|
| index 2b166436a2498ea7ec13bca7ef6266ad55753127..ca1501fb082e74b86ec44fadc29d59d1ae92283e 100644
|
| --- a/ash/frame/caption_buttons/frame_caption_button.cc
|
| +++ b/mash/wm/frame/caption_buttons/frame_caption_button.cc
|
| @@ -1,15 +1,16 @@
|
| -// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ash/frame/caption_buttons/frame_caption_button.h"
|
| +#include "mash/wm/frame/caption_buttons/frame_caption_button.h"
|
|
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/animation/slide_animation.h"
|
| #include "ui/gfx/animation/throb_animation.h"
|
| #include "ui/gfx/canvas.h"
|
|
|
| -namespace ash {
|
| +namespace mash {
|
| +namespace wm {
|
|
|
| namespace {
|
|
|
| @@ -45,8 +46,7 @@ FrameCaptionButton::FrameCaptionButton(views::ButtonListener* listener,
|
| // horizontally symmetrical.
|
| }
|
|
|
| -FrameCaptionButton::~FrameCaptionButton() {
|
| -}
|
| +FrameCaptionButton::~FrameCaptionButton() {}
|
|
|
| void FrameCaptionButton::SetImages(CaptionButtonIcon icon,
|
| Animate animate,
|
| @@ -68,15 +68,16 @@ void FrameCaptionButton::SetImages(CaptionButtonIcon icon,
|
|
|
| icon_ = icon;
|
| icon_image_id_ = icon_image_id;
|
| + // TODO(sky): it doesn't seem like these are used.
|
| hovered_background_image_id_ = hovered_background_image_id;
|
| pressed_background_image_id_ = pressed_background_image_id;
|
|
|
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| icon_image_ = *rb.GetImageSkiaNamed(icon_image_id);
|
| - hovered_background_image_ = *rb.GetImageSkiaNamed(
|
| - hovered_background_image_id);
|
| - pressed_background_image_ = *rb.GetImageSkiaNamed(
|
| - pressed_background_image_id);
|
| + hovered_background_image_ =
|
| + *rb.GetImageSkiaNamed(hovered_background_image_id);
|
| + pressed_background_image_ =
|
| + *rb.GetImageSkiaNamed(pressed_background_image_id);
|
|
|
| if (animate == ANIMATE_YES) {
|
| swap_images_animation_->Reset(0);
|
| @@ -101,8 +102,8 @@ void FrameCaptionButton::SetAlpha(int alpha) {
|
| }
|
|
|
| gfx::Size FrameCaptionButton::GetPreferredSize() const {
|
| - return hovered_background_image_.isNull() ?
|
| - gfx::Size() : hovered_background_image_.size();
|
| + return hovered_background_image_.isNull() ? gfx::Size()
|
| + : hovered_background_image_.size();
|
| }
|
|
|
| const char* FrameCaptionButton::GetClassName() const {
|
| @@ -111,8 +112,10 @@ const char* FrameCaptionButton::GetClassName() const {
|
|
|
| void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) {
|
| if (hover_animation_->is_animating() || state() == STATE_HOVERED) {
|
| - int hovered_background_alpha = hover_animation_->is_animating() ?
|
| - hover_animation_->CurrentValueBetween(0, 255) : 255;
|
| + int hovered_background_alpha =
|
| + hover_animation_->is_animating()
|
| + ? hover_animation_->CurrentValueBetween(0, 255)
|
| + : 255;
|
| SkPaint paint;
|
| paint.setAlpha(hovered_background_alpha);
|
| canvas->DrawImageInt(hovered_background_image_, 0, 0, paint);
|
| @@ -123,7 +126,7 @@ void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) {
|
| int icon_alpha = swap_images_animation_->CurrentValueBetween(0, 255);
|
| int crossfade_icon_alpha = 0;
|
| if (icon_alpha < static_cast<int>(kFadeOutRatio * 255))
|
| - crossfade_icon_alpha = static_cast<int>(255 - icon_alpha / kFadeOutRatio);
|
| + crossfade_icon_alpha = static_cast<int>(255 - icon_alpha / kFadeOutRatio);
|
|
|
| if (crossfade_icon_alpha > 0 && !crossfade_icon_image_.isNull()) {
|
| gfx::Canvas icon_canvas(icon_image_.size(), canvas->image_scale(), false);
|
| @@ -184,10 +187,9 @@ void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas,
|
|
|
| SkPaint paint;
|
| paint.setAlpha(alpha);
|
| - canvas->DrawImageInt(to_center,
|
| - (width() - to_center.width()) / 2,
|
| - (height() - to_center.height()) / 2,
|
| - paint);
|
| + canvas->DrawImageInt(to_center, (width() - to_center.width()) / 2,
|
| + (height() - to_center.height()) / 2, paint);
|
| }
|
|
|
| -} // namespace ash
|
| +} // namespace wm
|
| +} // namespace mash
|
|
|