CustomButton cleanup: make protected members private, create accessors
Also delete some old file that's not in use. BUG=none TBR=erg@chromium.org Review URL: https://codereview.chromium.org/1534303002 Cr-Commit-Position: refs/heads/master@{#367093}
This commit is contained in:
ash
chrome/browser/ui/views
mash/wm/frame/caption_buttons
ui
@ -110,9 +110,11 @@ 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;
|
||||
if (hover_animation().is_animating() || state() == STATE_HOVERED) {
|
||||
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);
|
||||
@ -173,9 +175,9 @@ void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas,
|
||||
if (!paint_as_active_) {
|
||||
// Paint icons as active when they are hovered over or pressed.
|
||||
double inactive_alpha = kInactiveIconAlpha;
|
||||
if (hover_animation_->is_animating()) {
|
||||
if (hover_animation().is_animating()) {
|
||||
inactive_alpha =
|
||||
hover_animation_->CurrentValueBetween(inactive_alpha, 1.0f);
|
||||
hover_animation().CurrentValueBetween(inactive_alpha, 1.0f);
|
||||
} else if (state() == STATE_PRESSED || state() == STATE_HOVERED) {
|
||||
inactive_alpha = 1.0f;
|
||||
}
|
||||
|
@ -71,9 +71,9 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(SkPaint::kFill_Style);
|
||||
paint.setColor(SkColorSetARGB(
|
||||
kButtonHoverAlpha * hover_animation_->GetCurrentValue(),
|
||||
0, 0, 0));
|
||||
paint.setColor(
|
||||
SkColorSetA(SK_ColorBLACK,
|
||||
hover_animation().CurrentValueBetween(0, kButtonHoverAlpha)));
|
||||
|
||||
const SkScalar radius = SkIntToScalar(kButtonCornerRadius);
|
||||
SkPath path;
|
||||
|
@ -149,7 +149,7 @@ bool MediaIndicatorButton::OnMousePressed(const ui::MouseEvent& event) {
|
||||
// pressed or when any modifier keys are being held down. Instead, the Tab
|
||||
// should react (e.g., middle-click for close, right-click for context menu).
|
||||
if (event.flags() != ui::EF_LEFT_MOUSE_BUTTON) {
|
||||
if (state_ != views::CustomButton::STATE_DISABLED)
|
||||
if (state() != views::CustomButton::STATE_DISABLED)
|
||||
SetState(views::CustomButton::STATE_NORMAL); // Turn off hover.
|
||||
return false; // Event to be handled by Tab.
|
||||
}
|
||||
@ -167,7 +167,7 @@ bool MediaIndicatorButton::OnMouseDragged(const ui::MouseEvent& event) {
|
||||
|
||||
void MediaIndicatorButton::OnMouseEntered(const ui::MouseEvent& event) {
|
||||
// If any modifier keys are being held down, do not turn on hover.
|
||||
if (state_ != views::CustomButton::STATE_DISABLED &&
|
||||
if (state() != views::CustomButton::STATE_DISABLED &&
|
||||
event.flags() != ui::EF_NONE) {
|
||||
SetState(views::CustomButton::STATE_NORMAL);
|
||||
return;
|
||||
@ -177,7 +177,7 @@ void MediaIndicatorButton::OnMouseEntered(const ui::MouseEvent& event) {
|
||||
|
||||
void MediaIndicatorButton::OnMouseMoved(const ui::MouseEvent& event) {
|
||||
// If any modifier keys are being held down, turn off hover.
|
||||
if (state_ != views::CustomButton::STATE_DISABLED &&
|
||||
if (state() != views::CustomButton::STATE_DISABLED &&
|
||||
event.flags() != ui::EF_NONE) {
|
||||
SetState(views::CustomButton::STATE_NORMAL);
|
||||
return;
|
||||
|
@ -313,7 +313,6 @@ class NewTabButton : public views::ImageButton,
|
||||
// Paints the fill region of the button into |canvas|, according to the
|
||||
// supplied values from GetImage() and the given |fill| path.
|
||||
void PaintFill(bool pressed,
|
||||
double hover_value,
|
||||
float scale,
|
||||
const SkPath& fill,
|
||||
gfx::Canvas* canvas) const;
|
||||
@ -378,10 +377,6 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
|
||||
canvas->Translate(gfx::Vector2d(0, height() - visible_height));
|
||||
|
||||
const bool pressed = state() == views::CustomButton::STATE_PRESSED;
|
||||
double hover_value =
|
||||
(state() == views::CustomButton::STATE_HOVERED) ? 1 : 0;
|
||||
if (hover_animation_->is_animating())
|
||||
hover_value = hover_animation_->GetCurrentValue();
|
||||
const float scale = canvas->image_scale();
|
||||
|
||||
SkPath fill;
|
||||
@ -401,7 +396,7 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
|
||||
fill.rLineTo(diag_width, diag_height);
|
||||
fill.rCubicTo(0, 0.5 * scale, -0.25 * scale, scale, -scale, scale);
|
||||
fill.close();
|
||||
PaintFill(pressed, hover_value, scale, fill, canvas);
|
||||
PaintFill(pressed, scale, fill, canvas);
|
||||
|
||||
// Stroke.
|
||||
gfx::ScopedCanvas scoped_canvas(canvas);
|
||||
@ -433,7 +428,7 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
|
||||
scale : ui::GetScaleForScaleFactor(ui::SCALE_FACTOR_100P);
|
||||
gfx::Canvas fill_canvas(GetLayoutSize(NEW_TAB_BUTTON), fill_canvas_scale,
|
||||
false);
|
||||
PaintFill(pressed, hover_value, fill_canvas_scale, fill, &fill_canvas);
|
||||
PaintFill(pressed, fill_canvas_scale, fill, &fill_canvas);
|
||||
gfx::ImageSkia image(fill_canvas.ExtractImageRep());
|
||||
canvas->DrawImageInt(
|
||||
gfx::ImageSkiaOperations::CreateMaskedImage(image, *mask), 0, 0);
|
||||
@ -527,7 +522,6 @@ void NewTabButton::GetBorderPath(float button_y,
|
||||
}
|
||||
|
||||
void NewTabButton::PaintFill(bool pressed,
|
||||
double hover_value,
|
||||
float scale,
|
||||
const SkPath& fill,
|
||||
gfx::Canvas* canvas) const {
|
||||
@ -606,12 +600,10 @@ void NewTabButton::PaintFill(bool pressed,
|
||||
}
|
||||
|
||||
// White highlight on hover.
|
||||
if (hover_value) {
|
||||
const int alpha =
|
||||
gfx::Tween::LinearIntValueBetween(hover_value, 0x00, md ? 0x4D : 0x40);
|
||||
canvas->FillRect(GetLocalBounds(),
|
||||
SkColorSetA(SK_ColorWHITE, static_cast<SkAlpha>(alpha)));
|
||||
}
|
||||
const SkAlpha alpha = static_cast<SkAlpha>(
|
||||
hover_animation().CurrentValueBetween(0x00, md ? 0x4D : 0x40));
|
||||
if (alpha != SK_AlphaTRANSPARENT)
|
||||
canvas->FillRect(GetLocalBounds(), SkColorSetA(SK_ColorWHITE, alpha));
|
||||
|
||||
// For MD, most states' opacities are adjusted using an opacity recorder in
|
||||
// TabStrip::PaintChildren(), but the pressed state is excluded there and
|
||||
|
@ -142,7 +142,7 @@ void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) {
|
||||
// Starting a drag results in a MouseExited, we need to ignore it.
|
||||
// A right click release triggers an exit event. We want to
|
||||
// remain in a PUSHED state until the drop down menu closes.
|
||||
if (state_ != STATE_DISABLED && !InDrag() && state_ != STATE_PRESSED)
|
||||
if (state() != STATE_DISABLED && !InDrag() && state() != STATE_PRESSED)
|
||||
SetState(STATE_NORMAL);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ void ToolbarButton::ShowDropDownMenu(ui::MenuSourceType source_type) {
|
||||
SetMouseHandler(nullptr);
|
||||
|
||||
// Set the state back to normal after the drop down menu is closed.
|
||||
if (state_ != STATE_DISABLED)
|
||||
if (state() != STATE_DISABLED)
|
||||
SetState(STATE_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,9 @@ const char* FrameCaptionButton::GetClassName() const {
|
||||
}
|
||||
|
||||
void FrameCaptionButton::OnPaint(gfx::Canvas* canvas) {
|
||||
if (hover_animation_->is_animating() || state() == STATE_HOVERED) {
|
||||
if (hover_animation().is_animating() || state() == STATE_HOVERED) {
|
||||
int hovered_background_alpha =
|
||||
hover_animation_->is_animating()
|
||||
? hover_animation_->CurrentValueBetween(0, 255)
|
||||
: 255;
|
||||
hover_animation().CurrentValueBetween(0, 255);
|
||||
SkPaint paint;
|
||||
paint.setAlpha(hovered_background_alpha);
|
||||
canvas->DrawImageInt(hovered_background_image_, 0, 0, paint);
|
||||
@ -176,9 +174,9 @@ void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas,
|
||||
if (!paint_as_active_) {
|
||||
// Paint icons as active when they are hovered over or pressed.
|
||||
double inactive_alpha = kInactiveIconAlpha;
|
||||
if (hover_animation_->is_animating()) {
|
||||
if (hover_animation().is_animating()) {
|
||||
inactive_alpha =
|
||||
hover_animation_->CurrentValueBetween(inactive_alpha, 1.0f);
|
||||
hover_animation().CurrentValueBetween(inactive_alpha, 1.0f);
|
||||
} else if (state() == STATE_PRESSED || state() == STATE_HOVERED) {
|
||||
inactive_alpha = 1.0f;
|
||||
}
|
||||
|
@ -144,11 +144,11 @@ void AppListItemView::SetIcon(const gfx::ImageSkia& icon) {
|
||||
shadow_animator_.SetOriginalImage(resized);
|
||||
}
|
||||
|
||||
void AppListItemView::SetUIState(UIState state) {
|
||||
if (ui_state_ == state)
|
||||
void AppListItemView::SetUIState(UIState ui_state) {
|
||||
if (ui_state_ == ui_state)
|
||||
return;
|
||||
|
||||
ui_state_ = state;
|
||||
ui_state_ = ui_state;
|
||||
|
||||
switch (ui_state_) {
|
||||
case UI_STATE_NORMAL:
|
||||
@ -467,14 +467,14 @@ void AppListItemView::OnGestureEvent(ui::GestureEvent* event) {
|
||||
}
|
||||
break;
|
||||
case ui::ET_GESTURE_TAP_DOWN:
|
||||
if (::switches::IsTouchFeedbackEnabled() && state_ != STATE_DISABLED) {
|
||||
if (::switches::IsTouchFeedbackEnabled() && state() != STATE_DISABLED) {
|
||||
SetState(STATE_PRESSED);
|
||||
event->SetHandled();
|
||||
}
|
||||
break;
|
||||
case ui::ET_GESTURE_TAP:
|
||||
case ui::ET_GESTURE_TAP_CANCEL:
|
||||
if (::switches::IsTouchFeedbackEnabled() && state_ != STATE_DISABLED)
|
||||
if (::switches::IsTouchFeedbackEnabled() && state() != STATE_DISABLED)
|
||||
SetState(STATE_NORMAL);
|
||||
break;
|
||||
case ui::ET_GESTURE_LONG_PRESS:
|
||||
|
@ -105,7 +105,7 @@ class SearchBoxImageButton : public views::ImageButton {
|
||||
private:
|
||||
// views::View overrides:
|
||||
void OnPaintBackground(gfx::Canvas* canvas) override {
|
||||
if (state_ == STATE_HOVERED || state_ == STATE_PRESSED || selected_)
|
||||
if (state() == STATE_HOVERED || state() == STATE_PRESSED || selected_)
|
||||
canvas->FillRect(gfx::Rect(size()), kSelectedColor);
|
||||
}
|
||||
|
||||
|
@ -62,21 +62,21 @@ void CustomButton::SetState(ButtonState state) {
|
||||
return;
|
||||
|
||||
if (animate_on_state_change_ &&
|
||||
(!is_throbbing_ || !hover_animation_->is_animating())) {
|
||||
(!is_throbbing_ || !hover_animation_.is_animating())) {
|
||||
is_throbbing_ = false;
|
||||
if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) {
|
||||
// For HOVERED -> NORMAL, animate from hovered (1) to not hovered (0).
|
||||
hover_animation_->Hide();
|
||||
hover_animation_.Hide();
|
||||
} else if (state != STATE_HOVERED) {
|
||||
// For HOVERED -> PRESSED/DISABLED, or any transition not involving
|
||||
// HOVERED at all, simply set the state to not hovered (0).
|
||||
hover_animation_->Reset();
|
||||
hover_animation_.Reset();
|
||||
} else if (state_ == STATE_NORMAL) {
|
||||
// For NORMAL -> HOVERED, animate from not hovered (0) to hovered (1).
|
||||
hover_animation_->Show();
|
||||
hover_animation_.Show();
|
||||
} else {
|
||||
// For PRESSED/DISABLED -> HOVERED, simply set the state to hovered (1).
|
||||
hover_animation_->Reset(1);
|
||||
hover_animation_.Reset(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,18 +87,18 @@ void CustomButton::SetState(ButtonState state) {
|
||||
|
||||
void CustomButton::StartThrobbing(int cycles_til_stop) {
|
||||
is_throbbing_ = true;
|
||||
hover_animation_->StartThrobbing(cycles_til_stop);
|
||||
hover_animation_.StartThrobbing(cycles_til_stop);
|
||||
}
|
||||
|
||||
void CustomButton::StopThrobbing() {
|
||||
if (hover_animation_->is_animating()) {
|
||||
hover_animation_->Stop();
|
||||
if (hover_animation_.is_animating()) {
|
||||
hover_animation_.Stop();
|
||||
SchedulePaint();
|
||||
}
|
||||
}
|
||||
|
||||
void CustomButton::SetAnimationDuration(int duration) {
|
||||
hover_animation_->SetSlideDuration(duration);
|
||||
hover_animation_.SetSlideDuration(duration);
|
||||
}
|
||||
|
||||
void CustomButton::SetHotTracked(bool is_hot_tracked) {
|
||||
@ -243,7 +243,7 @@ void CustomButton::OnGestureEvent(ui::GestureEvent* event) {
|
||||
// STATE_NORMAL beginning the fade out animation. See
|
||||
// http://crbug.com/131184.
|
||||
SetState(STATE_HOVERED);
|
||||
hover_animation_->Reset(1.0);
|
||||
hover_animation_.Reset(1.0);
|
||||
NotifyClick(*event);
|
||||
event->StopPropagation();
|
||||
} else if (event->type() == ui::ET_GESTURE_TAP_DOWN &&
|
||||
@ -336,6 +336,7 @@ void CustomButton::AnimationProgressed(const gfx::Animation* animation) {
|
||||
CustomButton::CustomButton(ButtonListener* listener)
|
||||
: Button(listener),
|
||||
state_(STATE_NORMAL),
|
||||
hover_animation_(this),
|
||||
animate_on_state_change_(true),
|
||||
is_throbbing_(false),
|
||||
triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON),
|
||||
@ -344,8 +345,7 @@ CustomButton::CustomButton(ButtonListener* listener)
|
||||
notify_action_(NOTIFY_ON_RELEASE),
|
||||
has_ink_drop_action_on_click_(false),
|
||||
ink_drop_action_on_click_(InkDropState::QUICK_ACTION) {
|
||||
hover_animation_.reset(new gfx::ThrobAnimation(this));
|
||||
hover_animation_->SetSlideDuration(kHoverFadeDurationMs);
|
||||
hover_animation_.SetSlideDuration(kHoverFadeDurationMs);
|
||||
}
|
||||
|
||||
void CustomButton::StateChanged() {
|
||||
|
@ -9,13 +9,10 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "ui/events/event_constants.h"
|
||||
#include "ui/gfx/animation/animation_delegate.h"
|
||||
#include "ui/gfx/animation/throb_animation.h"
|
||||
#include "ui/views/animation/ink_drop_state.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
|
||||
namespace gfx {
|
||||
class ThrobAnimation;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
|
||||
class InkDropDelegate;
|
||||
@ -147,11 +144,9 @@ class VIEWS_EXPORT CustomButton : public Button,
|
||||
void NotifyClick(const ui::Event& event) override;
|
||||
void OnClickCanceled(const ui::Event& event) override;
|
||||
|
||||
// The button state (defined in implementation)
|
||||
ButtonState state_;
|
||||
|
||||
// Hover animation.
|
||||
scoped_ptr<gfx::ThrobAnimation> hover_animation_;
|
||||
const gfx::ThrobAnimation& hover_animation() const {
|
||||
return hover_animation_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Returns true if this is not a top level widget. Virtual for tests.
|
||||
@ -159,6 +154,10 @@ class VIEWS_EXPORT CustomButton : public Button,
|
||||
// Returns true if the focus is not in a top level widget. Virtual for tests.
|
||||
virtual bool FocusInChildWidget() const;
|
||||
|
||||
ButtonState state_;
|
||||
|
||||
gfx::ThrobAnimation hover_animation_;
|
||||
|
||||
// Should we animate when the state changes? Defaults to true.
|
||||
bool animate_on_state_change_;
|
||||
|
||||
|
@ -145,11 +145,12 @@ void ImageButton::OnBlur() {
|
||||
gfx::ImageSkia ImageButton::GetImageToPaint() {
|
||||
gfx::ImageSkia img;
|
||||
|
||||
if (!images_[STATE_HOVERED].isNull() && hover_animation_->is_animating()) {
|
||||
img = gfx::ImageSkiaOperations::CreateBlendedImage(images_[STATE_NORMAL],
|
||||
images_[STATE_HOVERED], hover_animation_->GetCurrentValue());
|
||||
if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) {
|
||||
img = gfx::ImageSkiaOperations::CreateBlendedImage(
|
||||
images_[STATE_NORMAL], images_[STATE_HOVERED],
|
||||
hover_animation().GetCurrentValue());
|
||||
} else {
|
||||
img = images_[state_];
|
||||
img = images_[state()];
|
||||
}
|
||||
|
||||
return !img.isNull() ? img : images_[STATE_NORMAL];
|
||||
@ -212,14 +213,14 @@ void ToggleImageButton::SetToggled(bool toggled) {
|
||||
NotifyAccessibilityEvent(ui::AX_EVENT_VALUE_CHANGED, true);
|
||||
}
|
||||
|
||||
void ToggleImageButton::SetToggledImage(ButtonState state,
|
||||
void ToggleImageButton::SetToggledImage(ButtonState image_state,
|
||||
const gfx::ImageSkia* image) {
|
||||
if (toggled_) {
|
||||
images_[state] = image ? *image : gfx::ImageSkia();
|
||||
if (state_ == state)
|
||||
images_[image_state] = image ? *image : gfx::ImageSkia();
|
||||
if (state() == image_state)
|
||||
SchedulePaint();
|
||||
} else {
|
||||
alternate_images_[state] = image ? *image : gfx::ImageSkia();
|
||||
alternate_images_[image_state] = image ? *image : gfx::ImageSkia();
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,19 +231,20 @@ void ToggleImageButton::SetToggledTooltipText(const base::string16& tooltip) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ToggleImageButton, ImageButton overrides:
|
||||
|
||||
const gfx::ImageSkia& ToggleImageButton::GetImage(ButtonState state) const {
|
||||
const gfx::ImageSkia& ToggleImageButton::GetImage(
|
||||
ButtonState image_state) const {
|
||||
if (toggled_)
|
||||
return alternate_images_[state];
|
||||
return images_[state];
|
||||
return alternate_images_[image_state];
|
||||
return images_[image_state];
|
||||
}
|
||||
|
||||
void ToggleImageButton::SetImage(ButtonState state,
|
||||
void ToggleImageButton::SetImage(ButtonState image_state,
|
||||
const gfx::ImageSkia* image) {
|
||||
if (toggled_) {
|
||||
alternate_images_[state] = image ? *image : gfx::ImageSkia();
|
||||
alternate_images_[image_state] = image ? *image : gfx::ImageSkia();
|
||||
} else {
|
||||
images_[state] = image ? *image : gfx::ImageSkia();
|
||||
if (state_ == state)
|
||||
images_[image_state] = image ? *image : gfx::ImageSkia();
|
||||
if (state() == image_state)
|
||||
SchedulePaint();
|
||||
}
|
||||
PreferredSizeChanged();
|
||||
|
@ -501,7 +501,7 @@ ui::NativeTheme::State LabelButton::GetThemeState(
|
||||
}
|
||||
|
||||
const gfx::Animation* LabelButton::GetThemeAnimation() const {
|
||||
return hover_animation_.get();
|
||||
return &hover_animation();
|
||||
}
|
||||
|
||||
ui::NativeTheme::State LabelButton::GetBackgroundThemeState(
|
||||
|
@ -101,7 +101,7 @@ class TransparentButton : public CustomButton {
|
||||
}
|
||||
|
||||
double GetAnimationValue() const {
|
||||
return hover_animation_->GetCurrentValue();
|
||||
return hover_animation().GetCurrentValue();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -96,7 +96,7 @@ ui::NativeTheme::ExtraParams
|
||||
ScrollBarButton::GetNativeThemeParams() const {
|
||||
ui::NativeTheme::ExtraParams params;
|
||||
|
||||
switch (state_) {
|
||||
switch (state()) {
|
||||
case CustomButton::STATE_HOVERED:
|
||||
params.scrollbar_arrow.is_hovering = true;
|
||||
break;
|
||||
@ -119,32 +119,29 @@ ui::NativeTheme::Part
|
||||
return ui::NativeTheme::kScrollbarLeftArrow;
|
||||
case RIGHT:
|
||||
return ui::NativeTheme::kScrollbarRightArrow;
|
||||
default:
|
||||
return ui::NativeTheme::kScrollbarUpArrow;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return ui::NativeTheme::kScrollbarUpArrow;
|
||||
}
|
||||
|
||||
ui::NativeTheme::State
|
||||
ScrollBarButton::GetNativeThemeState() const {
|
||||
ui::NativeTheme::State state;
|
||||
|
||||
switch (state_) {
|
||||
switch (state()) {
|
||||
case CustomButton::STATE_HOVERED:
|
||||
state = ui::NativeTheme::kHovered;
|
||||
break;
|
||||
return ui::NativeTheme::kHovered;
|
||||
case CustomButton::STATE_PRESSED:
|
||||
state = ui::NativeTheme::kPressed;
|
||||
break;
|
||||
return ui::NativeTheme::kPressed;
|
||||
case CustomButton::STATE_DISABLED:
|
||||
state = ui::NativeTheme::kDisabled;
|
||||
break;
|
||||
return ui::NativeTheme::kDisabled;
|
||||
case CustomButton::STATE_NORMAL:
|
||||
default:
|
||||
state = ui::NativeTheme::kNormal;
|
||||
return ui::NativeTheme::kNormal;
|
||||
case CustomButton::STATE_COUNT:
|
||||
break;
|
||||
}
|
||||
|
||||
return state;
|
||||
NOTREACHED();
|
||||
return ui::NativeTheme::kNormal;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -197,25 +194,21 @@ ui::NativeTheme::Part ScrollBarThumb::GetNativeThemePart() const {
|
||||
}
|
||||
|
||||
ui::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const {
|
||||
ui::NativeTheme::State state;
|
||||
|
||||
switch (GetState()) {
|
||||
case CustomButton::STATE_HOVERED:
|
||||
state = ui::NativeTheme::kHovered;
|
||||
break;
|
||||
return ui::NativeTheme::kHovered;
|
||||
case CustomButton::STATE_PRESSED:
|
||||
state = ui::NativeTheme::kPressed;
|
||||
break;
|
||||
return ui::NativeTheme::kPressed;
|
||||
case CustomButton::STATE_DISABLED:
|
||||
state = ui::NativeTheme::kDisabled;
|
||||
break;
|
||||
return ui::NativeTheme::kDisabled;
|
||||
case CustomButton::STATE_NORMAL:
|
||||
default:
|
||||
state = ui::NativeTheme::kNormal;
|
||||
return ui::NativeTheme::kNormal;
|
||||
case CustomButton::STATE_COUNT:
|
||||
break;
|
||||
}
|
||||
|
||||
return state;
|
||||
NOTREACHED();
|
||||
return ui::NativeTheme::kNormal;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -170,8 +170,6 @@
|
||||
'controls/scrollbar/base_scroll_bar_button.h',
|
||||
'controls/scrollbar/base_scroll_bar_thumb.cc',
|
||||
'controls/scrollbar/base_scroll_bar_thumb.h',
|
||||
'controls/scrollbar/kennedy_scroll_bar.cc',
|
||||
'controls/scrollbar/kennedy_scroll_bar.h',
|
||||
'controls/scrollbar/native_scroll_bar.cc',
|
||||
'controls/scrollbar/native_scroll_bar.h',
|
||||
'controls/scrollbar/native_scroll_bar_views.cc',
|
||||
|
Reference in New Issue
Block a user