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

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 2389453002: Remove IsModeMaterial checks in ui/views/ (Closed)
Patch Set: oops Created 4 years, 2 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 (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 "ui/views/controls/button/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/gfx/animation/throb_animation.h" 15 #include "ui/gfx/animation/throb_animation.h"
17 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/color_utils.h" 17 #include "ui/gfx/color_utils.h"
19 #include "ui/gfx/font_list.h" 18 #include "ui/gfx/font_list.h"
20 #include "ui/gfx/geometry/vector2d.h" 19 #include "ui/gfx/geometry/vector2d.h"
21 #include "ui/native_theme/native_theme.h" 20 #include "ui/native_theme/native_theme.h"
22 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 21 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
23 #include "ui/views/animation/ink_drop_highlight.h" 22 #include "ui/views/animation/ink_drop_highlight.h"
24 #include "ui/views/animation/square_ink_drop_ripple.h" 23 #include "ui/views/animation/square_ink_drop_ripple.h"
25 #include "ui/views/background.h" 24 #include "ui/views/background.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 const char* LabelButton::GetClassName() const { 382 const char* LabelButton::GetClassName() const {
384 return kViewClassName; 383 return kViewClassName;
385 } 384 }
386 385
387 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) { 386 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) {
388 CustomButton::EnableCanvasFlippingForRTLUI(flip); 387 CustomButton::EnableCanvasFlippingForRTLUI(flip);
389 image_->EnableCanvasFlippingForRTLUI(flip); 388 image_->EnableCanvasFlippingForRTLUI(flip);
390 } 389 }
391 390
392 std::unique_ptr<LabelButtonBorder> LabelButton::CreateDefaultBorder() const { 391 std::unique_ptr<LabelButtonBorder> LabelButton::CreateDefaultBorder() const {
393 if (!ui::MaterialDesignController::IsModeMaterial() || 392 if (style_ != Button::STYLE_TEXTBUTTON)
394 style_ != Button::STYLE_TEXTBUTTON) {
395 return base::MakeUnique<LabelButtonAssetBorder>(style_); 393 return base::MakeUnique<LabelButtonAssetBorder>(style_);
396 }
397 std::unique_ptr<LabelButtonBorder> border = 394 std::unique_ptr<LabelButtonBorder> border =
398 base::MakeUnique<LabelButtonBorder>(); 395 base::MakeUnique<LabelButtonBorder>();
399 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( 396 border->set_insets(views::LabelButtonAssetBorder::GetDefaultInsetsForStyle(
400 style_)); 397 style_));
401 return border; 398 return border;
402 } 399 }
403 400
404 void LabelButton::SetBorder(std::unique_ptr<Border> border) { 401 void LabelButton::SetBorder(std::unique_ptr<Border> border) {
405 border_is_themed_border_ = false; 402 border_is_themed_border_ = false;
406 View::SetBorder(std::move(border)); 403 View::SetBorder(std::move(border));
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 void LabelButton::ResetLabelEnabledColor() { 613 void LabelButton::ResetLabelEnabledColor() {
617 const SkColor color = 614 const SkColor color =
618 explicitly_set_colors_[state()] 615 explicitly_set_colors_[state()]
619 ? button_state_colors_[state()] 616 ? button_state_colors_[state()]
620 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 617 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
621 if (state() != STATE_DISABLED && label_->enabled_color() != color) 618 if (state() != STATE_DISABLED && label_->enabled_color() != color)
622 label_->SetEnabledColor(color); 619 label_->SetEnabledColor(color);
623 } 620 }
624 621
625 } // namespace views 622 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698